email error
This commit is contained in:
parent
2fa1299e2c
commit
857eee27b1
181
public/funnels/palm.json
Normal file
181
public/funnels/palm.json
Normal file
@ -0,0 +1,181 @@
|
||||
{
|
||||
"meta": {
|
||||
"id": "palm",
|
||||
"title": "Palm Test",
|
||||
"description": "Palm",
|
||||
"firstScreenId": "screen-1"
|
||||
},
|
||||
"defaultTexts": {
|
||||
"nextButton": "Continue"
|
||||
},
|
||||
"screens": [
|
||||
{
|
||||
"id": "screen-1",
|
||||
"template": "info",
|
||||
"title": {
|
||||
"text": "Добро пожаловать!",
|
||||
"show": true,
|
||||
"font": "manrope",
|
||||
"weight": "bold",
|
||||
"size": "md",
|
||||
"align": "center",
|
||||
"color": "default"
|
||||
},
|
||||
"subtitle": {
|
||||
"text": "Это ваша новая воронка. Начните редактирование.",
|
||||
"show": true,
|
||||
"font": "manrope",
|
||||
"weight": "regular",
|
||||
"size": "md",
|
||||
"align": "center",
|
||||
"color": "muted"
|
||||
},
|
||||
"navigation": {
|
||||
"rules": [],
|
||||
"defaultNextScreenId": "screen-2",
|
||||
"isEndScreen": false
|
||||
},
|
||||
"icon": {
|
||||
"type": "emoji",
|
||||
"value": "🎯",
|
||||
"size": "lg"
|
||||
},
|
||||
"variables": [],
|
||||
"variants": []
|
||||
},
|
||||
{
|
||||
"id": "screen-2",
|
||||
"template": "letScan",
|
||||
"header": {
|
||||
"showBackButton": false,
|
||||
"showProgress": false,
|
||||
"show": false
|
||||
},
|
||||
"title": {
|
||||
"text": "Призыв к сканированию",
|
||||
"show": false,
|
||||
"font": "manrope",
|
||||
"weight": "bold",
|
||||
"size": "2xl",
|
||||
"align": "left",
|
||||
"color": "default"
|
||||
},
|
||||
"bottomActionButton": {
|
||||
"show": false,
|
||||
"cornerRadius": "3xl",
|
||||
"showPrivacyTermsConsent": false
|
||||
},
|
||||
"navigation": {
|
||||
"rules": [],
|
||||
"defaultNextScreenId": "screen-3",
|
||||
"isEndScreen": false
|
||||
},
|
||||
"variants": [],
|
||||
"texts": {
|
||||
"title": "We Are Scanning Your Palm",
|
||||
"desription": "Follow the on-screen instructions so we can analyze the lines of your palm, revealing the future and the secrets of your destiny!",
|
||||
"button": "Next",
|
||||
"biometricData": "We do not collect biometric data. The entire recognition process happens on your device."
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "screen-3",
|
||||
"template": "camera",
|
||||
"header": {
|
||||
"showBackButton": false,
|
||||
"showProgress": false,
|
||||
"show": false
|
||||
},
|
||||
"title": {
|
||||
"text": "Camera",
|
||||
"show": false,
|
||||
"font": "manrope",
|
||||
"weight": "bold",
|
||||
"size": "2xl",
|
||||
"align": "left",
|
||||
"color": "default"
|
||||
},
|
||||
"bottomActionButton": {
|
||||
"show": false,
|
||||
"cornerRadius": "3xl",
|
||||
"showPrivacyTermsConsent": false
|
||||
},
|
||||
"navigation": {
|
||||
"rules": [],
|
||||
"defaultNextScreenId": "screen-4",
|
||||
"isEndScreen": true
|
||||
},
|
||||
"variants": [],
|
||||
"cameraSettings": {
|
||||
"system": "auto",
|
||||
"isShowCameraRequestModal": true,
|
||||
"isShowScanHand": true,
|
||||
"cameraTemplate": "v4",
|
||||
"fingersNames": {
|
||||
"thumb": "Thumb",
|
||||
"index_finger": "Index finger",
|
||||
"middle_finger": "Middle finger",
|
||||
"ring_finger": "Ring finger",
|
||||
"pinky": "Little finger"
|
||||
},
|
||||
"scanHand": {
|
||||
"title": "Place your palm against the phone screen.",
|
||||
"scanHandTime": "v0"
|
||||
},
|
||||
"scannedPhoto": {
|
||||
"title": "Your In-Depth Palmistry Compatibility Analysis Is Almost Ready!",
|
||||
"description": "Judging by your lines, you have an exciting future ahead. Let's dive into all the details!",
|
||||
"modalVariant": "v0",
|
||||
"scanResultNumbers": "on",
|
||||
"modalsText": [
|
||||
{
|
||||
"title": "Clarifying question.",
|
||||
"description": "Have you noticed recurring cycles in your life?",
|
||||
"answerLeft": "NO",
|
||||
"answerRight": "YES"
|
||||
},
|
||||
{
|
||||
"title": "Clarifying question.",
|
||||
"description": "What's more important to you: fate or choice?",
|
||||
"answerLeft": "CHOICE",
|
||||
"answerRight": "FATE"
|
||||
},
|
||||
{
|
||||
"title": "Clarifying question.",
|
||||
"description": "Do you believe there's more to love than chance?",
|
||||
"answerLeft": "NO",
|
||||
"answerRight": "YES"
|
||||
}
|
||||
],
|
||||
"loadersText": [
|
||||
{
|
||||
"title1": "Analyzing your key traits...",
|
||||
"title2": "Reading astrological parameters..."
|
||||
},
|
||||
{
|
||||
"title1": "Calculating your unique compatibility chart...",
|
||||
"title2": "Creating a personalized love strategy..."
|
||||
},
|
||||
{
|
||||
"title1": "Comparing you across 1,120,000 potential astrological combinations...",
|
||||
"title2": "Checking forecast accuracy—almost there..."
|
||||
}
|
||||
]
|
||||
},
|
||||
"requestModal": {
|
||||
"title": "To scan your hand, access to the Camera is required.",
|
||||
"cancelText": "Cancel",
|
||||
"allowText": "Allow"
|
||||
},
|
||||
"scanInstruction": {
|
||||
"scanInstructionImageVariant": "v0",
|
||||
"title": "Photograph Your Palm as Shown",
|
||||
"errorText": "Something went wrong. Please try again.",
|
||||
"scanButtonText": "Take Photo Now",
|
||||
"uploadButtonText": "Upload palm photo",
|
||||
"biometricDataText": "We don’t collect any biometric data. All recognition processes occur on your device."
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -132,17 +132,33 @@ export const useAuth = ({ funnelId, googleAnalyticsId, registrationData }: IUseA
|
||||
} catch (err) {
|
||||
// Extract error message and suggestion from API error
|
||||
if (err instanceof ApiError && err.data) {
|
||||
const errorData = err.data as { errors?: Array<{ msg: string; path: string }> };
|
||||
const emailError = errorData.errors?.find(e => e.path === 'email');
|
||||
const errorData = err.data as {
|
||||
errors?: Array<{ msg: string; path: string }>;
|
||||
status?: string;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
if (emailError) {
|
||||
setError(emailError.msg);
|
||||
// Handle service error format: { status: "error", message: "..." }
|
||||
if (errorData.status === 'error' && errorData.message) {
|
||||
setError(errorData.message);
|
||||
setSuggestedEmail(null);
|
||||
}
|
||||
// Handle express-validator format: { errors: [{ msg, path }] }
|
||||
else if (errorData.errors) {
|
||||
const emailError = errorData.errors.find(e => e.path === 'email');
|
||||
|
||||
// Extract suggested email from "Did you mean user@gmail.com?" message
|
||||
const suggestionMatch = emailError.msg.match(/Did you mean (.+)\?/);
|
||||
if (suggestionMatch) {
|
||||
setSuggestedEmail(suggestionMatch[1]);
|
||||
if (emailError) {
|
||||
setError(emailError.msg);
|
||||
|
||||
// Extract suggested email from "Did you mean user@gmail.com?" message
|
||||
const suggestionMatch = emailError.msg.match(/Did you mean (.+)\?/);
|
||||
if (suggestionMatch) {
|
||||
setSuggestedEmail(suggestionMatch[1]);
|
||||
} else {
|
||||
setSuggestedEmail(null);
|
||||
}
|
||||
} else {
|
||||
setError(errorData.errors[0]?.msg || 'Email validation failed');
|
||||
setSuggestedEmail(null);
|
||||
}
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user