datakeen-session-react 1.1.140-dev.127 → 1.1.140-dev.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/cjs/components/document-collection/DocumentCollection.js +1 -1
  2. package/dist/cjs/components/document-collection/DocumentCollection.js.map +1 -1
  3. package/dist/cjs/components/document-collection/DocumentCollectionIntroduction.js +1 -1
  4. package/dist/cjs/components/document-collection/DocumentCollectionIntroduction.js.map +1 -1
  5. package/dist/cjs/components/document-collection/DocumentCollectionMethodSelection.js +1 -1
  6. package/dist/cjs/components/document-collection/DocumentCollectionMethodSelection.js.map +1 -1
  7. package/dist/cjs/components/document-collection/DocumentCollectionSelection.js +1 -1
  8. package/dist/cjs/components/document-collection/DocumentCollectionSelection.js.map +1 -1
  9. package/dist/cjs/components/document-collection/DocumentCollectionUpload.js +1 -1
  10. package/dist/cjs/components/document-collection/DocumentCollectionUpload.js.map +1 -1
  11. package/dist/cjs/components/jdi/JDICountrySelection.js +1 -1
  12. package/dist/cjs/components/jdi/JDICountrySelection.js.map +1 -1
  13. package/dist/cjs/components/jdi/JDIDocumentSelection.js +1 -1
  14. package/dist/cjs/components/jdi/JDIDocumentSelection.js.map +1 -1
  15. package/dist/cjs/components/jdi/JDIDocumentUpload.js +1 -1
  16. package/dist/cjs/components/jdi/JDIDocumentUpload.js.map +1 -1
  17. package/dist/cjs/components/jdi/JDIPreIntroduction.js +1 -1
  18. package/dist/cjs/components/jdi/JDIPreIntroduction.js.map +1 -1
  19. package/dist/cjs/components/selfie/Video.js +2 -2
  20. package/dist/cjs/components/selfie/Video.js.map +1 -1
  21. package/dist/cjs/components/selfie/selfie-flow/SelfieFlow.js +2 -11
  22. package/dist/cjs/components/selfie/selfie-flow/SelfieFlow.js.map +1 -1
  23. package/dist/cjs/components/selfie/selfie-flow/SelfiePreIntroduction.js.map +1 -1
  24. package/dist/cjs/components/session/DocumentCheck.js +1 -1
  25. package/dist/cjs/components/session/DocumentCheck.js.map +1 -1
  26. package/dist/cjs/components/session/Selfie.js +4 -18
  27. package/dist/cjs/components/session/Selfie.js.map +1 -1
  28. package/dist/cjs/components/session/UserInputForm.js +1 -7
  29. package/dist/cjs/components/session/UserInputForm.js.map +1 -1
  30. package/dist/cjs/components/signature-electronic/SignatureElectronic.js +1 -1
  31. package/dist/cjs/components/signature-electronic/SignatureElectronic.js.map +1 -1
  32. package/dist/cjs/components/signature-electronic/SignatureElectronicIntroduction.js +2 -2
  33. package/dist/cjs/components/signature-electronic/SignatureElectronicIntroduction.js.map +1 -1
  34. package/dist/cjs/hooks/useStepNavigation.js +60 -12
  35. package/dist/cjs/hooks/useStepNavigation.js.map +1 -1
  36. package/dist/cjs/hooks/useUserInputForm.js +1 -2
  37. package/dist/cjs/hooks/useUserInputForm.js.map +1 -1
  38. package/dist/cjs/types/session.js.map +1 -1
  39. package/dist/esm/components/document-collection/DocumentCollection.js +1 -1
  40. package/dist/esm/components/document-collection/DocumentCollection.js.map +1 -1
  41. package/dist/esm/components/document-collection/DocumentCollectionIntroduction.js +1 -1
  42. package/dist/esm/components/document-collection/DocumentCollectionIntroduction.js.map +1 -1
  43. package/dist/esm/components/document-collection/DocumentCollectionMethodSelection.js +1 -1
  44. package/dist/esm/components/document-collection/DocumentCollectionMethodSelection.js.map +1 -1
  45. package/dist/esm/components/document-collection/DocumentCollectionSelection.js +1 -1
  46. package/dist/esm/components/document-collection/DocumentCollectionSelection.js.map +1 -1
  47. package/dist/esm/components/document-collection/DocumentCollectionUpload.js +1 -1
  48. package/dist/esm/components/document-collection/DocumentCollectionUpload.js.map +1 -1
  49. package/dist/esm/components/jdi/JDICountrySelection.js +1 -1
  50. package/dist/esm/components/jdi/JDICountrySelection.js.map +1 -1
  51. package/dist/esm/components/jdi/JDIDocumentSelection.js +1 -1
  52. package/dist/esm/components/jdi/JDIDocumentSelection.js.map +1 -1
  53. package/dist/esm/components/jdi/JDIDocumentUpload.js +1 -1
  54. package/dist/esm/components/jdi/JDIDocumentUpload.js.map +1 -1
  55. package/dist/esm/components/jdi/JDIPreIntroduction.js +1 -1
  56. package/dist/esm/components/jdi/JDIPreIntroduction.js.map +1 -1
  57. package/dist/esm/components/selfie/Video.js +2 -2
  58. package/dist/esm/components/selfie/Video.js.map +1 -1
  59. package/dist/esm/components/selfie/selfie-flow/SelfieFlow.js +2 -11
  60. package/dist/esm/components/selfie/selfie-flow/SelfieFlow.js.map +1 -1
  61. package/dist/esm/components/selfie/selfie-flow/SelfiePreIntroduction.js.map +1 -1
  62. package/dist/esm/components/session/DocumentCheck.js +1 -1
  63. package/dist/esm/components/session/DocumentCheck.js.map +1 -1
  64. package/dist/esm/components/session/Selfie.js +4 -18
  65. package/dist/esm/components/session/Selfie.js.map +1 -1
  66. package/dist/esm/components/session/UserInputForm.js +1 -7
  67. package/dist/esm/components/session/UserInputForm.js.map +1 -1
  68. package/dist/esm/components/signature-electronic/SignatureElectronic.js +1 -1
  69. package/dist/esm/components/signature-electronic/SignatureElectronic.js.map +1 -1
  70. package/dist/esm/components/signature-electronic/SignatureElectronicIntroduction.js +2 -2
  71. package/dist/esm/components/signature-electronic/SignatureElectronicIntroduction.js.map +1 -1
  72. package/dist/esm/hooks/useStepNavigation.js +60 -12
  73. package/dist/esm/hooks/useStepNavigation.js.map +1 -1
  74. package/dist/esm/hooks/useUserInputForm.js +1 -2
  75. package/dist/esm/hooks/useUserInputForm.js.map +1 -1
  76. package/dist/esm/types/session.js.map +1 -1
  77. package/docs/navigation-history.md +18 -1
  78. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useUserInputForm.js","sources":["../../../../src/hooks/useUserInputForm.ts"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from \"react\";\nimport type { UserInputFormProps } from \"../types/userInput\";\nimport type {\n AddressSuggestion,\n InformationType,\n RequestedFields,\n UserInputFormErrors,\n UserInputFormState,\n} from \"../types/userInputForm\";\nimport {\n DEFAULT_FIELDS,\n FALLBACK_ADDRESS_SUGGESTIONS,\n GEOCODING_AUTOCOMPLETE_ENDPOINT,\n} from \"../constants/userInputForm\";\nimport { API_BASE_URL } from \"../config/env\";\nimport {\n checkIsMajor,\n parseBirthDate,\n resolveInformationType,\n} from \"../utils/userInputForm\";\nimport {\n countNonEmptyListRows,\n getListFieldMinRows,\n normalizeListColumns,\n} from \"../utils/listFieldUtils\";\nimport {\n cellErrorKey,\n isDateValid,\n isEmailValid,\n isRegexMatch,\n} from \"../utils/customFieldValidation\";\nimport { labelToKey } from \"../utils/labelToKey\";\nimport { DEFAULT_DATE_DISPLAY_FORMAT } from \"../types/session\";\nimport { useI18n } from \"./useI18n\";\nimport { logFormValidated } from \"../services/auditTrailService\";\n\nexport type CustomFieldErrorValue = string | boolean;\n\ninterface UseUserInputFormResult {\n form: UserInputFormState;\n errors: UserInputFormErrors;\n informationType: InformationType;\n requestedFields: RequestedFields;\n pageTitle: string;\n pageDescription: string;\n addressSuggestions: AddressSuggestion[];\n showSuggestions: boolean;\n handleFieldChange: (key: keyof UserInputFormState, value: string) => void;\n handleAddressChange: (value: string) => void;\n handleAddressFocus: () => void;\n handleAddressBlur: () => void;\n applyAddressSuggestion: (suggestion: AddressSuggestion) => void;\n goOnNextStep: () => void;\n goOnPreviousStep: () => void;\n // Custom form fields\n customFormData: Record<string, any>;\n customFormErrors: Record<string, CustomFieldErrorValue>;\n customFormCellErrors: Record<string, Record<string, CustomFieldErrorValue>>;\n handleCustomFieldChange: (fieldId: string, value: any) => void;\n}\n\nexport const useUserInputForm = ({\n stepObject,\n setUserInput,\n initialUserInput,\n node,\n template,\n contactInfo,\n setContactInfo,\n onContinueCallback,\n sessionId,\n}: UserInputFormProps & { sessionId?: string }): UseUserInputFormResult => {\n const { setStep, goBack, goToNextStep, step } = stepObject;\n const { t } = useI18n();\n\n const informationType = useMemo<InformationType>(() => {\n const resolved = resolveInformationType(\n node.informationType as string,\n \"identity\",\n );\n console.log(\"🔍 [useUserInputForm] Resolving informationType:\", {\n nodeInformationType: node.informationType,\n resolved,\n hasCustomFields: !!node.customFields,\n customFieldsCount: node.customFields?.length,\n });\n return resolved;\n }, [node.informationType, node.customFields]);\n\n const requestedFields = useMemo<RequestedFields>(() => {\n const defaults = DEFAULT_FIELDS[informationType] || [];\n const optional =\n node.optionalFields && node.optionalFields.length > 0\n ? node.optionalFields\n : defaults;\n const merged = new Set<string>(optional);\n\n if (node.requiredFields) {\n node.requiredFields.forEach((field) => merged.add(field));\n }\n\n return merged;\n }, [node.optionalFields, node.requiredFields, informationType]);\n\n const birthDateParts = useMemo(\n () => parseBirthDate(initialUserInput?.birthDate || \"\"),\n [initialUserInput?.birthDate],\n );\n\n const [form, setForm] = useState<UserInputFormState>({\n lastName: initialUserInput?.lastName || \"\",\n firstName: initialUserInput?.firstName || \"\",\n birthDate: initialUserInput?.birthDate || \"\",\n day: birthDateParts.day,\n month: birthDateParts.month,\n year: birthDateParts.year,\n email: initialUserInput?.email || contactInfo?.email || \"\",\n phoneNumber:\n initialUserInput?.phoneNumber || contactInfo?.phoneNumber || \"\",\n sms: initialUserInput?.sms || \"\",\n addressLine1: initialUserInput?.addressLine1 || \"\",\n addressLine2: initialUserInput?.addressLine2 || \"\",\n postalCode: initialUserInput?.postalCode || \"\",\n city: initialUserInput?.city || \"\",\n countryCode: initialUserInput?.countryCode || \"\",\n nationality: initialUserInput?.nationality || \"\",\n companyName: initialUserInput?.companyName || \"\",\n siret: initialUserInput?.siret || \"\",\n tva: initialUserInput?.tva || \"\",\n registrationNumber: initialUserInput?.registrationNumber || \"\",\n legalRepresentativeLastName:\n initialUserInput?.legalRepresentativeLastName || \"\",\n legalRepresentativeFirstName:\n initialUserInput?.legalRepresentativeFirstName || \"\",\n legalRepresentativeSiren:\n initialUserInput?.legalRepresentativeSiren || \"\",\n });\n\n const [errors, setErrors] = useState<UserInputFormErrors>({});\n\n // Custom form state\n const [customFormData, setCustomFormData] = useState<Record<string, any>>(\n () => {\n if (informationType !== \"custom\" || !node.customFields) return {};\n\n const initial: Record<string, any> = {};\n node.customFields.forEach((field) => {\n const topLevelKey = field.userInputKey ?? labelToKey(field.label);\n // Priorité : top level (nouveau format) > customFormData[field.id] (ancien format)\n const savedValue =\n (initialUserInput as Record<string, any>)?.[topLevelKey] ??\n initialUserInput?.customFormData?.[field.id];\n if (field.valueType === \"list\") {\n initial[field.id] = Array.isArray(savedValue) ? savedValue : [];\n return;\n }\n\n initial[field.id] = savedValue || \"\";\n });\n return initial;\n },\n );\n const [customFormErrors, setCustomFormErrors] = useState<\n Record<string, CustomFieldErrorValue>\n >({});\n const [customFormCellErrors, setCustomFormCellErrors] = useState<\n Record<string, Record<string, CustomFieldErrorValue>>\n >({});\n\n const [addressSuggestions, setAddressSuggestions] = useState<\n AddressSuggestion[]\n >([]);\n const [showSuggestions, setShowSuggestions] = useState(false);\n const isFirstRender = useRef(true);\n const prevCustomNodeIdRef = useRef(node.id);\n const hideSuggestionTimeout = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const addressRequestState = useRef<{\n debounce: ReturnType<typeof setTimeout> | null;\n controller: AbortController | null;\n }>({\n debounce: null,\n controller: null,\n });\n\n const formTitles = useMemo<Record<InformationType, string>>(\n () => ({\n identity: t(\"user_input_form.titles.identity\"),\n \"identity-legal\": t(\"user_input_form.titles.identity_legal\"),\n contact: t(\"user_input_form.titles.contact\"),\n address: t(\"user_input_form.titles.address\"),\n nationality: t(\"user_input_form.titles.nationality\"),\n custom: t(\"user_input_form.titles.custom\"),\n }),\n [t],\n );\n\n const formDescriptions = useMemo<Record<InformationType, string>>(\n () => ({\n identity: t(\"user_input_form.descriptions.identity\"),\n \"identity-legal\": t(\"user_input_form.descriptions.identity_legal\"),\n contact: t(\"user_input_form.descriptions.contact\"),\n address: t(\"user_input_form.descriptions.address\"),\n nationality: t(\"user_input_form.descriptions.nationality\"),\n custom: t(\"user_input_form.descriptions.custom\"),\n }),\n [t],\n );\n\n const applyAddressSuggestion = (suggestion: AddressSuggestion) => {\n const normalizedCountry =\n suggestion.countryCode?.toUpperCase() || suggestion.country || \"\";\n\n setForm((previous) => ({\n ...previous,\n addressLine1: suggestion.addressLine1 || suggestion.label,\n postalCode: suggestion.postalCode || previous.postalCode,\n city: suggestion.city || previous.city,\n countryCode: normalizedCountry || previous.countryCode,\n }));\n setErrors((previous) => ({\n ...previous,\n addressLine1: false,\n postalCode: false,\n city: false,\n country: false,\n }));\n setShowSuggestions(false);\n setAddressSuggestions([]);\n };\n\n const mapGeoapifyFeature = (feature: any): AddressSuggestion | null => {\n if (!feature || !feature.properties) {\n return null;\n }\n\n const { properties } = feature;\n const label: string =\n properties.formatted ||\n properties.address_line1 ||\n [properties.housenumber, properties.street]\n .filter(Boolean)\n .join(\" \")\n .trim();\n\n if (!label) {\n return null;\n }\n\n const addressLine1 =\n [properties.housenumber, properties.street]\n .filter(Boolean)\n .join(\" \")\n .trim() ||\n properties.address_line1 ||\n label;\n\n const city =\n properties.city ||\n properties.town ||\n properties.village ||\n properties.state ||\n \"\";\n\n return {\n id:\n (properties.place_id && String(properties.place_id)) ||\n feature.id ||\n `${properties.lon ?? \"\"}-${properties.lat ?? \"\"}-${label}`,\n label,\n addressLine1,\n postalCode: properties.postcode || \"\",\n city,\n country: properties.country || \"\",\n countryCode: properties.country_code || undefined,\n };\n };\n\n const requestAddressSuggestions = (\n query: string,\n { autoComplete }: { autoComplete: boolean },\n ) => {\n if (addressRequestState.current.debounce) {\n clearTimeout(addressRequestState.current.debounce);\n addressRequestState.current.debounce = null;\n }\n\n if (query.trim().length < 3) {\n if (addressRequestState.current.controller) {\n addressRequestState.current.controller.abort();\n addressRequestState.current.controller = null;\n }\n setAddressSuggestions([]);\n setShowSuggestions(false);\n return;\n }\n\n addressRequestState.current.debounce = setTimeout(async () => {\n if (addressRequestState.current.controller) {\n addressRequestState.current.controller.abort();\n }\n\n const controller = new AbortController();\n addressRequestState.current.controller = controller;\n\n try {\n const searchParams = new URLSearchParams({\n text: query,\n lang: \"fr\",\n });\n\n const response = await fetch(\n `${API_BASE_URL}${GEOCODING_AUTOCOMPLETE_ENDPOINT}?${searchParams.toString()}`,\n { signal: controller.signal },\n );\n\n if (!response.ok) {\n throw new Error(\n `Geocoding request failed with status ${response.status}`,\n );\n }\n\n const payload = await response.json();\n\n const suggestions: AddressSuggestion[] = Array.isArray(\n payload?.features,\n )\n ? payload.features\n .map((feature: any) => mapGeoapifyFeature(feature))\n .filter(\n (\n suggestion: AddressSuggestion | null,\n ): suggestion is AddressSuggestion => Boolean(suggestion),\n )\n : [];\n\n setAddressSuggestions(suggestions);\n setShowSuggestions(suggestions.length > 0);\n\n if (autoComplete && suggestions.length === 1) {\n const single = suggestions[0];\n const normalizedQuery = query.trim().toLowerCase();\n if (\n normalizedQuery.length >= 6 &&\n single.label.toLowerCase().startsWith(normalizedQuery)\n ) {\n applyAddressSuggestion(single);\n }\n }\n } catch (error) {\n if ((error as Error).name === \"AbortError\") {\n return;\n }\n\n const fallback = FALLBACK_ADDRESS_SUGGESTIONS.filter((suggestion) =>\n suggestion.label.toLowerCase().includes(query.toLowerCase()),\n );\n setAddressSuggestions(fallback);\n setShowSuggestions(fallback.length > 0);\n } finally {\n addressRequestState.current.controller = null;\n }\n }, 250);\n };\n\n useEffect(() => {\n if (!initialUserInput) {\n return;\n }\n\n if (\n isFirstRender.current ||\n (!form.firstName &&\n !form.lastName &&\n !form.email &&\n !form.phoneNumber &&\n !form.companyName)\n ) {\n const nextBirthParts = parseBirthDate(initialUserInput.birthDate || \"\");\n setForm((previous) => ({\n ...previous,\n lastName: initialUserInput.lastName || previous.lastName,\n firstName: initialUserInput.firstName || previous.firstName,\n birthDate: initialUserInput.birthDate || previous.birthDate,\n day: nextBirthParts.day,\n month: nextBirthParts.month,\n year: nextBirthParts.year,\n email: initialUserInput.email || previous.email,\n phoneNumber: initialUserInput.phoneNumber || previous.phoneNumber,\n sms: initialUserInput.sms || previous.sms,\n addressLine1: initialUserInput.addressLine1 || previous.addressLine1,\n addressLine2: initialUserInput.addressLine2 || previous.addressLine2,\n postalCode: initialUserInput.postalCode || previous.postalCode,\n city: initialUserInput.city || previous.city,\n countryCode: initialUserInput.countryCode || previous.countryCode,\n nationality: initialUserInput.nationality || previous.nationality,\n companyName: initialUserInput.companyName || previous.companyName,\n siret: initialUserInput.siret || previous.siret,\n tva: initialUserInput.tva || previous.tva,\n registrationNumber: initialUserInput.registrationNumber || previous.registrationNumber,\n }));\n\n isFirstRender.current = false;\n }\n }, [\n initialUserInput,\n form.firstName,\n form.lastName,\n form.email,\n form.phoneNumber,\n form.companyName,\n ]);\n\n // Re-synchronise customFormData depuis initialUserInput quand on (ré)affiche un\n // nœud DIFFÉRENT sur une instance réutilisée (retour arrière sans remount).\n // Le champ form standard a déjà son propre effet de re-sync ci-dessus ; le\n // customFormData n'en avait aucun → il restait périmé (formulaire perso vidé).\n // On garde sur node.id : sur le MÊME nœud (frappe en cours), on ne touche à rien.\n // Redondant avec le remount par key={node.id} côté renderer, mais sert de filet.\n useEffect(() => {\n if (prevCustomNodeIdRef.current === node.id) {\n return;\n }\n prevCustomNodeIdRef.current = node.id;\n\n if (informationType !== \"custom\" || !node.customFields) {\n setCustomFormData({});\n return;\n }\n\n const next: Record<string, any> = {};\n node.customFields.forEach((field) => {\n const topLevelKey = field.userInputKey ?? labelToKey(field.label);\n const savedValue =\n (initialUserInput as Record<string, any>)?.[topLevelKey] ??\n initialUserInput?.customFormData?.[field.id];\n if (field.valueType === \"list\") {\n next[field.id] = Array.isArray(savedValue) ? savedValue : [];\n return;\n }\n next[field.id] = savedValue || \"\";\n });\n setCustomFormData(next);\n }, [node.id, informationType, node.customFields, initialUserInput]);\n\n useEffect(() => {\n return () => {\n if (hideSuggestionTimeout.current) {\n clearTimeout(hideSuggestionTimeout.current);\n }\n if (addressRequestState.current.debounce) {\n clearTimeout(addressRequestState.current.debounce);\n }\n if (addressRequestState.current.controller) {\n addressRequestState.current.controller.abort();\n }\n };\n }, []);\n\n const handleFieldChange = (key: keyof UserInputFormState, value: string) => {\n setErrors((previous) => ({\n ...previous,\n [key]: false,\n notMajor: false,\n }));\n\n setForm((previous) => {\n const next = { ...previous, [key]: value };\n if (key === \"day\" || key === \"month\" || key === \"year\") {\n const { day, month, year } = next;\n if (day && month && year) {\n const paddedDay = day.padStart(2, \"0\");\n const paddedMonth = month.padStart(2, \"0\");\n next.birthDate = `${paddedDay}-${paddedMonth}-${year}`;\n } else {\n next.birthDate = \"\";\n }\n }\n return next;\n });\n };\n\n const handleAddressChange = (value: string) => {\n handleFieldChange(\"addressLine1\", value);\n requestAddressSuggestions(value, { autoComplete: true });\n };\n\n const handleAddressFocus = () => {\n requestAddressSuggestions(form.addressLine1, { autoComplete: false });\n };\n\n const handleAddressBlur = () => {\n if (hideSuggestionTimeout.current) {\n clearTimeout(hideSuggestionTimeout.current);\n }\n hideSuggestionTimeout.current = setTimeout(() => {\n setShowSuggestions(false);\n hideSuggestionTimeout.current = null;\n }, 150);\n };\n\n const validateForm = () => {\n const nextErrors: UserInputFormErrors = {};\n let hasError = false;\n\n const markError = (key: string) => {\n nextErrors[key] = true;\n hasError = true;\n };\n\n if (informationType === \"identity\") {\n if (requestedFields.has(\"prenom\") && !form.firstName) {\n markError(\"firstName\");\n }\n if (requestedFields.has(\"nom\") && !form.lastName) {\n markError(\"lastName\");\n }\n if (requestedFields.has(\"date_naissance\")) {\n if (!form.birthDate) {\n markError(\"birthDate\");\n } else if (!checkIsMajor(form.birthDate)) {\n nextErrors.notMajor = true;\n hasError = true;\n }\n }\n }\n\n if (informationType === \"identity-legal\") {\n if (requestedFields.has(\"nom\") && !form.companyName) {\n markError(\"companyName\");\n }\n if (requestedFields.has(\"siret\") && !form.siret) {\n markError(\"siret\");\n }\n if (requestedFields.has(\"tva\") && !form.tva) {\n markError(\"tva\");\n }\n if (requestedFields.has(\"registrationNumber\") && !form.registrationNumber) {\n markError(\"registrationNumber\");\n }\n }\n\n if (informationType === \"identity-legal-rep\") {\n if (\n requestedFields.has(\"legalRepresentativeNom\") &&\n !form.legalRepresentativeLastName\n ) {\n markError(\"legalRepresentativeLastName\");\n }\n if (\n requestedFields.has(\"legalRepresentativePrenom\") &&\n !form.legalRepresentativeFirstName\n ) {\n markError(\"legalRepresentativeFirstName\");\n }\n // RL personne morale (délégation de pouvoir) : SIREN à la place de\n // Nom/Prénom, mutuellement exclusif — mode fixé par le concepteur du\n // parcours via requestedFields, jamais par l'utilisateur final.\n if (\n requestedFields.has(\"legalRepresentativeSiren\") &&\n !/^\\d{9}$/.test((form.legalRepresentativeSiren || \"\").replace(/\\s+/g, \"\"))\n ) {\n markError(\"legalRepresentativeSiren\");\n }\n }\n\n if (informationType === \"contact\") {\n if (requestedFields.has(\"email\")) {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n if (!form.email || !emailRegex.test(form.email)) {\n markError(\"email\");\n }\n }\n if (requestedFields.has(\"sms\")) {\n if (\n !form.phoneNumber ||\n form.phoneNumber.replace(/\\D/g, \"\").length < 6\n ) {\n markError(\"phoneNumber\");\n }\n }\n }\n\n if (\n (informationType === \"address\" || informationType === \"identity-legal\") &&\n requestedFields.has(\"adresse\")\n ) {\n if (!form.addressLine1) {\n markError(\"addressLine1\");\n }\n if (!form.postalCode) {\n markError(\"postalCode\");\n }\n if (!form.city) {\n markError(\"city\");\n }\n if (!form.countryCode) {\n markError(\"country\");\n }\n }\n\n if (\n informationType === \"nationality\" &&\n requestedFields.has(\"nationalite\")\n ) {\n if (!form.nationality) {\n markError(\"nationality\");\n }\n }\n\n setErrors(nextErrors);\n return !hasError;\n };\n\n const validateCustomForm = () => {\n const errors: Record<string, CustomFieldErrorValue> = {};\n const cellErrors: Record<string, Record<string, CustomFieldErrorValue>> = {};\n let hasError = false;\n\n node.customFields?.forEach((field) => {\n const value = customFormData[field.id];\n\n if (field.valueType === \"list\") {\n const rows: Record<string, string>[] = Array.isArray(value) ? value : [];\n const minRows = getListFieldMinRows(field);\n const columns = normalizeListColumns(field.listColumns);\n const fieldCellErrors: Record<string, CustomFieldErrorValue> = {};\n let listFieldInvalid = false;\n\n if (field.required && countNonEmptyListRows(rows) < minRows) {\n errors[field.id] = true;\n hasError = true;\n listFieldInvalid = true;\n }\n\n rows.forEach((row, rowIndex) => {\n const rowIsEmpty = columns.every(\n (col) => !String(row?.[col.label] ?? \"\").trim(),\n );\n if (rowIsEmpty && !field.required) return;\n\n columns.forEach((col) => {\n const cellValue = String(row?.[col.label] ?? \"\").trim();\n const key = cellErrorKey(rowIndex, col.label);\n\n if (!cellValue) {\n if (field.required && !rowIsEmpty) {\n fieldCellErrors[key] = t(\"custom_form.required_field\");\n listFieldInvalid = true;\n }\n return;\n }\n\n switch (col.type) {\n case \"email\":\n if (!isEmailValid(cellValue)) {\n fieldCellErrors[key] = t(\"custom_form.invalid_email\");\n listFieldInvalid = true;\n }\n break;\n case \"date\": {\n const fmt = col.dateFormat ?? DEFAULT_DATE_DISPLAY_FORMAT;\n if (!isDateValid(cellValue, fmt)) {\n fieldCellErrors[key] = t(\"custom_form.invalid_date\", {\n format: fmt,\n });\n listFieldInvalid = true;\n }\n break;\n }\n case \"text\":\n if (col.regex && !isRegexMatch(cellValue, col.regex)) {\n fieldCellErrors[key] =\n col.regexErrorMessage ||\n t(\"custom_form.invalid_format\");\n listFieldInvalid = true;\n }\n break;\n }\n });\n });\n\n if (Object.keys(fieldCellErrors).length > 0) {\n cellErrors[field.id] = fieldCellErrors;\n }\n if (listFieldInvalid) {\n // This field-level boolean only drives the red field outline. When\n // cell errors exist, their messages are rendered at cell level.\n errors[field.id] = errors[field.id] ?? true;\n hasError = true;\n }\n return;\n }\n\n // Check if required field is missing\n if (field.required && !value) {\n errors[field.id] = true;\n hasError = true;\n return;\n }\n\n // Type-specific validation\n if (value) {\n switch (field.valueType) {\n case \"number\":\n if (isNaN(Number(value))) {\n errors[field.id] = true;\n hasError = true;\n }\n break;\n\n case \"email\":\n if (!isEmailValid(String(value))) {\n errors[field.id] = t(\"custom_form.invalid_email\");\n hasError = true;\n }\n break;\n\n case \"text\":\n if (field.regex && !isRegexMatch(String(value), field.regex)) {\n errors[field.id] =\n field.regexErrorMessage || t(\"custom_form.invalid_format\");\n hasError = true;\n }\n break;\n\n case \"date\": {\n const fmt = field.dateFormat ?? DEFAULT_DATE_DISPLAY_FORMAT;\n if (!isDateValid(String(value), fmt)) {\n errors[field.id] = t(\"custom_form.invalid_date\", {\n format: fmt,\n });\n hasError = true;\n }\n break;\n }\n\n case \"address\":\n // Validate address object if required\n if (field.required && typeof value === \"object\") {\n const addressValue = value as {\n addressLine1?: string;\n postalCode?: string;\n city?: string;\n countryCode?: string;\n };\n if (\n !addressValue.addressLine1 ||\n !addressValue.postalCode ||\n !addressValue.city ||\n !addressValue.countryCode\n ) {\n errors[field.id] = true;\n hasError = true;\n }\n }\n break;\n }\n }\n });\n\n setCustomFormErrors(errors);\n setCustomFormCellErrors(cellErrors);\n return !hasError;\n };\n\n const handleCustomFieldChange = (fieldId: string, value: any) => {\n setCustomFormData((prev) => ({ ...prev, [fieldId]: value }));\n setCustomFormErrors((prev) => ({ ...prev, [fieldId]: false }));\n setCustomFormCellErrors((prev) => {\n if (!(fieldId in prev)) return prev;\n const { [fieldId]: _removed, ...rest } = prev;\n return rest;\n });\n };\n\n const goOnNextStep = () => {\n // Handle custom form validation and submission\n if (informationType === \"custom\") {\n if (!validateCustomForm()) {\n return;\n }\n\n const topLevelEntries: Record<string, any> = {};\n const customFormDataEntries: Record<string, any> = {};\n node.customFields?.forEach((field) => {\n const key = field.userInputKey ?? labelToKey(field.label);\n topLevelEntries[key] = customFormData[field.id];\n customFormDataEntries[field.id] = customFormData[field.id];\n });\n\n setUserInput((prev) => ({\n ...prev,\n // Top level avec clé lisible dérivée du label (attendu par l'API cliente)\n ...topLevelEntries,\n // customFormData avec les field.id d'origine (rétrocompat : conditions, sessions existantes)\n customFormData: { ...(prev.customFormData ?? {}), ...customFormDataEntries },\n }));\n\n if (sessionId) logFormValidated(sessionId);\n if (onContinueCallback) {\n onContinueCallback();\n } else {\n goToNextStep(node.id, template);\n }\n return;\n }\n\n // Standard form validation\n if (!validateForm()) {\n return;\n }\n\n setUserInput((previous) => ({\n ...previous,\n ...(requestedFields.has(\"nom\") && {\n ...(informationType === \"identity-legal\"\n ? { companyName: form.companyName }\n : { lastName: form.lastName }),\n }),\n ...(requestedFields.has(\"prenom\") && { firstName: form.firstName }),\n ...(requestedFields.has(\"date_naissance\") && {\n birthDate: form.birthDate,\n }),\n ...(requestedFields.has(\"email\") && { email: form.email }),\n ...(requestedFields.has(\"sms\") && {\n phoneNumber: form.phoneNumber,\n sms: form.phoneNumber,\n }),\n ...(requestedFields.has(\"adresse\") && {\n addressLine1: form.addressLine1,\n addressLine2: form.addressLine2,\n postalCode: form.postalCode,\n city: form.city,\n countryCode: form.countryCode,\n }),\n ...(requestedFields.has(\"siret\") && { siret: form.siret }),\n ...(requestedFields.has(\"tva\") && { tva: form.tva }),\n ...(requestedFields.has(\"registrationNumber\") && { registrationNumber: form.registrationNumber }),\n ...(requestedFields.has(\"siret\") && !requestedFields.has(\"registrationNumber\") && { registrationNumber: form.siret }),\n ...(requestedFields.has(\"nationalite\") && {\n nationality: form.nationality,\n }),\n ...(requestedFields.has(\"legalRepresentativeNom\") && {\n legalRepresentativeLastName: form.legalRepresentativeLastName,\n }),\n ...(requestedFields.has(\"legalRepresentativePrenom\") && {\n legalRepresentativeFirstName: form.legalRepresentativeFirstName,\n }),\n ...(requestedFields.has(\"legalRepresentativeSiren\") && {\n legalRepresentativeSiren: form.legalRepresentativeSiren,\n }),\n }));\n\n if (informationType === \"contact\" && setContactInfo) {\n setContactInfo((previous) => ({\n ...previous,\n ...(requestedFields.has(\"email\") && { email: form.email }),\n ...(requestedFields.has(\"sms\") && { phoneNumber: form.phoneNumber }),\n }));\n }\n\n if (sessionId) logFormValidated(sessionId);\n if (onContinueCallback) {\n onContinueCallback();\n } else {\n goToNextStep(node.id, template);\n }\n };\n\n const goOnPreviousStep = () => {\n console.log(\"[goOnPreviousStep] called — step:\", step, \"canGoBack:\", stepObject.canGoBack);\n goBack();\n };\n\n const pageTitle = node.pageTitle || formTitles[informationType];\n\n const pageDescription =\n node.pageDescription || formDescriptions[informationType];\n\n return {\n form,\n errors,\n informationType,\n requestedFields,\n pageTitle,\n pageDescription,\n addressSuggestions,\n showSuggestions,\n handleFieldChange,\n handleAddressChange,\n handleAddressFocus,\n handleAddressBlur,\n applyAddressSuggestion,\n goOnNextStep,\n goOnPreviousStep,\n customFormData,\n customFormErrors,\n customFormCellErrors,\n handleCustomFieldChange,\n };\n};\n"],"names":["useI18n","useMemo","resolveInformationType","DEFAULT_FIELDS","parseBirthDate","useState","labelToKey","useRef","__assign","__awaiter","API_BASE_URL","GEOCODING_AUTOCOMPLETE_ENDPOINT","FALLBACK_ADDRESS_SUGGESTIONS","useEffect","checkIsMajor","getListFieldMinRows","normalizeListColumns","countNonEmptyListRows","cellErrorKey","isEmailValid","DEFAULT_DATE_DISPLAY_FORMAT","isDateValid","isRegexMatch","__rest","logFormValidated"],"mappings":";;;;;;;;;;;;;;AA6DO,IAAM,gBAAgB,GAAG,UAAC,EAUa,EAAA;QAT5C,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,gBAAgB,GAAA,EAAA,CAAA,gBAAA,EAChB,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,QAAQ,cAAA,EACR,WAAW,GAAA,EAAA,CAAA,WAAA,EACX,cAAc,GAAA,EAAA,CAAA,cAAA,EACd,kBAAkB,GAAA,EAAA,CAAA,kBAAA,EAClB,SAAS,GAAA,EAAA,CAAA,SAAA;AAED,IAAwC,UAAU,QAA3C,CAAA,KAAE,MAAM,GAAyB,UAAU,CAAA,MAAnC,EAAE,YAAY,GAAW,UAAU,CAAA,YAArB,CAAA,CAAE,IAAI,GAAK,UAAU;AAClD,IAAA,IAAA,CAAC,GAAKA,eAAO,EAAE,EAAd;IAET,IAAM,eAAe,GAAGC,aAAO,CAAkB,YAAA;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Ae,GACnB,IAAI,CAAC,eAAe,IAAI,gBAAgB,CAAC,eAAe,CAAC;IAE3D,OAAO;AACL,QAAA,IAAI,EAAA,IAAA;AACJ,QAAA,MAAM,EAAA,MAAA;AACN,QAAA,eAAe,EAAA,eAAA;AACf,QAAA,eAAe,EAAA,eAAA;AACf,QAAA,SAAS,EAAA,SAAA;AACT,QAAA,eAAe,EAAA,eAAA;AACf,QAAA,kBAAkB,EAAA,kBAAA;AAClB,QAAA,eAAe,EAAA,eAAA;AACf,QAAA,iBAAiB,EAAA,iBAAA;AACjB,QAAA,mBAAmB,EAAA,mBAAA;AACnB,QAAA,kBAAkB,EAAA,kBAAA;AAClB,QAAA,iBAAiB,EAAA,iBAAA;AACjB,QAAA,sBAAsB,EAAA,sBAAA;AACtB,QAAA,YAAY,EAAA,YAAA;AACZ,QAAA,gBAAgB,EAAA,gBAAA;AAChB,QAAA,cAAc,EAAA,cAAA;AACd,QAAA,gBAAgB,EAAA,gBAAA;AAChB,QAAA,oBAAoB,EAAA,oBAAA;AACpB,QAAA,uBAAuB,EAAA,uBAAA;KACxB;AACH;;;;"}
1
+ {"version":3,"file":"useUserInputForm.js","sources":["../../../../src/hooks/useUserInputForm.ts"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from \"react\";\nimport type { UserInputFormProps } from \"../types/userInput\";\nimport type {\n AddressSuggestion,\n InformationType,\n RequestedFields,\n UserInputFormErrors,\n UserInputFormState,\n} from \"../types/userInputForm\";\nimport {\n DEFAULT_FIELDS,\n FALLBACK_ADDRESS_SUGGESTIONS,\n GEOCODING_AUTOCOMPLETE_ENDPOINT,\n} from \"../constants/userInputForm\";\nimport { API_BASE_URL } from \"../config/env\";\nimport {\n checkIsMajor,\n parseBirthDate,\n resolveInformationType,\n} from \"../utils/userInputForm\";\nimport {\n countNonEmptyListRows,\n getListFieldMinRows,\n normalizeListColumns,\n} from \"../utils/listFieldUtils\";\nimport {\n cellErrorKey,\n isDateValid,\n isEmailValid,\n isRegexMatch,\n} from \"../utils/customFieldValidation\";\nimport { labelToKey } from \"../utils/labelToKey\";\nimport { DEFAULT_DATE_DISPLAY_FORMAT } from \"../types/session\";\nimport { useI18n } from \"./useI18n\";\nimport { logFormValidated } from \"../services/auditTrailService\";\n\nexport type CustomFieldErrorValue = string | boolean;\n\ninterface UseUserInputFormResult {\n form: UserInputFormState;\n errors: UserInputFormErrors;\n informationType: InformationType;\n requestedFields: RequestedFields;\n pageTitle: string;\n pageDescription: string;\n addressSuggestions: AddressSuggestion[];\n showSuggestions: boolean;\n handleFieldChange: (key: keyof UserInputFormState, value: string) => void;\n handleAddressChange: (value: string) => void;\n handleAddressFocus: () => void;\n handleAddressBlur: () => void;\n applyAddressSuggestion: (suggestion: AddressSuggestion) => void;\n goOnNextStep: () => void;\n goOnPreviousStep: () => void;\n // Custom form fields\n customFormData: Record<string, any>;\n customFormErrors: Record<string, CustomFieldErrorValue>;\n customFormCellErrors: Record<string, Record<string, CustomFieldErrorValue>>;\n handleCustomFieldChange: (fieldId: string, value: any) => void;\n}\n\nexport const useUserInputForm = ({\n stepObject,\n setUserInput,\n initialUserInput,\n node,\n template,\n contactInfo,\n setContactInfo,\n onContinueCallback,\n sessionId,\n}: UserInputFormProps & { sessionId?: string }): UseUserInputFormResult => {\n const { setStep, goBack, goToNextStep, step } = stepObject;\n const { t } = useI18n();\n\n const informationType = useMemo<InformationType>(() => {\n const resolved = resolveInformationType(\n node.informationType as string,\n \"identity\",\n );\n console.log(\"🔍 [useUserInputForm] Resolving informationType:\", {\n nodeInformationType: node.informationType,\n resolved,\n hasCustomFields: !!node.customFields,\n customFieldsCount: node.customFields?.length,\n });\n return resolved;\n }, [node.informationType, node.customFields]);\n\n const requestedFields = useMemo<RequestedFields>(() => {\n const defaults = DEFAULT_FIELDS[informationType] || [];\n const optional =\n node.optionalFields && node.optionalFields.length > 0\n ? node.optionalFields\n : defaults;\n const merged = new Set<string>(optional);\n\n if (node.requiredFields) {\n node.requiredFields.forEach((field) => merged.add(field));\n }\n\n return merged;\n }, [node.optionalFields, node.requiredFields, informationType]);\n\n const birthDateParts = useMemo(\n () => parseBirthDate(initialUserInput?.birthDate || \"\"),\n [initialUserInput?.birthDate],\n );\n\n const [form, setForm] = useState<UserInputFormState>({\n lastName: initialUserInput?.lastName || \"\",\n firstName: initialUserInput?.firstName || \"\",\n birthDate: initialUserInput?.birthDate || \"\",\n day: birthDateParts.day,\n month: birthDateParts.month,\n year: birthDateParts.year,\n email: initialUserInput?.email || contactInfo?.email || \"\",\n phoneNumber:\n initialUserInput?.phoneNumber || contactInfo?.phoneNumber || \"\",\n sms: initialUserInput?.sms || \"\",\n addressLine1: initialUserInput?.addressLine1 || \"\",\n addressLine2: initialUserInput?.addressLine2 || \"\",\n postalCode: initialUserInput?.postalCode || \"\",\n city: initialUserInput?.city || \"\",\n countryCode: initialUserInput?.countryCode || \"\",\n nationality: initialUserInput?.nationality || \"\",\n companyName: initialUserInput?.companyName || \"\",\n siret: initialUserInput?.siret || \"\",\n tva: initialUserInput?.tva || \"\",\n registrationNumber: initialUserInput?.registrationNumber || \"\",\n legalRepresentativeLastName:\n initialUserInput?.legalRepresentativeLastName || \"\",\n legalRepresentativeFirstName:\n initialUserInput?.legalRepresentativeFirstName || \"\",\n legalRepresentativeSiren:\n initialUserInput?.legalRepresentativeSiren || \"\",\n });\n\n const [errors, setErrors] = useState<UserInputFormErrors>({});\n\n // Custom form state\n const [customFormData, setCustomFormData] = useState<Record<string, any>>(\n () => {\n if (informationType !== \"custom\" || !node.customFields) return {};\n\n const initial: Record<string, any> = {};\n node.customFields.forEach((field) => {\n const topLevelKey = field.userInputKey ?? labelToKey(field.label);\n // Priorité : top level (nouveau format) > customFormData[field.id] (ancien format)\n const savedValue =\n (initialUserInput as Record<string, any>)?.[topLevelKey] ??\n initialUserInput?.customFormData?.[field.id];\n if (field.valueType === \"list\") {\n initial[field.id] = Array.isArray(savedValue) ? savedValue : [];\n return;\n }\n\n initial[field.id] = savedValue || \"\";\n });\n return initial;\n },\n );\n const [customFormErrors, setCustomFormErrors] = useState<\n Record<string, CustomFieldErrorValue>\n >({});\n const [customFormCellErrors, setCustomFormCellErrors] = useState<\n Record<string, Record<string, CustomFieldErrorValue>>\n >({});\n\n const [addressSuggestions, setAddressSuggestions] = useState<\n AddressSuggestion[]\n >([]);\n const [showSuggestions, setShowSuggestions] = useState(false);\n const isFirstRender = useRef(true);\n const prevCustomNodeIdRef = useRef(node.id);\n const hideSuggestionTimeout = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const addressRequestState = useRef<{\n debounce: ReturnType<typeof setTimeout> | null;\n controller: AbortController | null;\n }>({\n debounce: null,\n controller: null,\n });\n\n const formTitles = useMemo<Record<InformationType, string>>(\n () => ({\n identity: t(\"user_input_form.titles.identity\"),\n \"identity-legal\": t(\"user_input_form.titles.identity_legal\"),\n contact: t(\"user_input_form.titles.contact\"),\n address: t(\"user_input_form.titles.address\"),\n nationality: t(\"user_input_form.titles.nationality\"),\n custom: t(\"user_input_form.titles.custom\"),\n }),\n [t],\n );\n\n const formDescriptions = useMemo<Record<InformationType, string>>(\n () => ({\n identity: t(\"user_input_form.descriptions.identity\"),\n \"identity-legal\": t(\"user_input_form.descriptions.identity_legal\"),\n contact: t(\"user_input_form.descriptions.contact\"),\n address: t(\"user_input_form.descriptions.address\"),\n nationality: t(\"user_input_form.descriptions.nationality\"),\n custom: t(\"user_input_form.descriptions.custom\"),\n }),\n [t],\n );\n\n const applyAddressSuggestion = (suggestion: AddressSuggestion) => {\n const normalizedCountry =\n suggestion.countryCode?.toUpperCase() || suggestion.country || \"\";\n\n setForm((previous) => ({\n ...previous,\n addressLine1: suggestion.addressLine1 || suggestion.label,\n postalCode: suggestion.postalCode || previous.postalCode,\n city: suggestion.city || previous.city,\n countryCode: normalizedCountry || previous.countryCode,\n }));\n setErrors((previous) => ({\n ...previous,\n addressLine1: false,\n postalCode: false,\n city: false,\n country: false,\n }));\n setShowSuggestions(false);\n setAddressSuggestions([]);\n };\n\n const mapGeoapifyFeature = (feature: any): AddressSuggestion | null => {\n if (!feature || !feature.properties) {\n return null;\n }\n\n const { properties } = feature;\n const label: string =\n properties.formatted ||\n properties.address_line1 ||\n [properties.housenumber, properties.street]\n .filter(Boolean)\n .join(\" \")\n .trim();\n\n if (!label) {\n return null;\n }\n\n const addressLine1 =\n [properties.housenumber, properties.street]\n .filter(Boolean)\n .join(\" \")\n .trim() ||\n properties.address_line1 ||\n label;\n\n const city =\n properties.city ||\n properties.town ||\n properties.village ||\n properties.state ||\n \"\";\n\n return {\n id:\n (properties.place_id && String(properties.place_id)) ||\n feature.id ||\n `${properties.lon ?? \"\"}-${properties.lat ?? \"\"}-${label}`,\n label,\n addressLine1,\n postalCode: properties.postcode || \"\",\n city,\n country: properties.country || \"\",\n countryCode: properties.country_code || undefined,\n };\n };\n\n const requestAddressSuggestions = (\n query: string,\n { autoComplete }: { autoComplete: boolean },\n ) => {\n if (addressRequestState.current.debounce) {\n clearTimeout(addressRequestState.current.debounce);\n addressRequestState.current.debounce = null;\n }\n\n if (query.trim().length < 3) {\n if (addressRequestState.current.controller) {\n addressRequestState.current.controller.abort();\n addressRequestState.current.controller = null;\n }\n setAddressSuggestions([]);\n setShowSuggestions(false);\n return;\n }\n\n addressRequestState.current.debounce = setTimeout(async () => {\n if (addressRequestState.current.controller) {\n addressRequestState.current.controller.abort();\n }\n\n const controller = new AbortController();\n addressRequestState.current.controller = controller;\n\n try {\n const searchParams = new URLSearchParams({\n text: query,\n lang: \"fr\",\n });\n\n const response = await fetch(\n `${API_BASE_URL}${GEOCODING_AUTOCOMPLETE_ENDPOINT}?${searchParams.toString()}`,\n { signal: controller.signal },\n );\n\n if (!response.ok) {\n throw new Error(\n `Geocoding request failed with status ${response.status}`,\n );\n }\n\n const payload = await response.json();\n\n const suggestions: AddressSuggestion[] = Array.isArray(\n payload?.features,\n )\n ? payload.features\n .map((feature: any) => mapGeoapifyFeature(feature))\n .filter(\n (\n suggestion: AddressSuggestion | null,\n ): suggestion is AddressSuggestion => Boolean(suggestion),\n )\n : [];\n\n setAddressSuggestions(suggestions);\n setShowSuggestions(suggestions.length > 0);\n\n if (autoComplete && suggestions.length === 1) {\n const single = suggestions[0];\n const normalizedQuery = query.trim().toLowerCase();\n if (\n normalizedQuery.length >= 6 &&\n single.label.toLowerCase().startsWith(normalizedQuery)\n ) {\n applyAddressSuggestion(single);\n }\n }\n } catch (error) {\n if ((error as Error).name === \"AbortError\") {\n return;\n }\n\n const fallback = FALLBACK_ADDRESS_SUGGESTIONS.filter((suggestion) =>\n suggestion.label.toLowerCase().includes(query.toLowerCase()),\n );\n setAddressSuggestions(fallback);\n setShowSuggestions(fallback.length > 0);\n } finally {\n addressRequestState.current.controller = null;\n }\n }, 250);\n };\n\n useEffect(() => {\n if (!initialUserInput) {\n return;\n }\n\n if (\n isFirstRender.current ||\n (!form.firstName &&\n !form.lastName &&\n !form.email &&\n !form.phoneNumber &&\n !form.companyName)\n ) {\n const nextBirthParts = parseBirthDate(initialUserInput.birthDate || \"\");\n setForm((previous) => ({\n ...previous,\n lastName: initialUserInput.lastName || previous.lastName,\n firstName: initialUserInput.firstName || previous.firstName,\n birthDate: initialUserInput.birthDate || previous.birthDate,\n day: nextBirthParts.day,\n month: nextBirthParts.month,\n year: nextBirthParts.year,\n email: initialUserInput.email || previous.email,\n phoneNumber: initialUserInput.phoneNumber || previous.phoneNumber,\n sms: initialUserInput.sms || previous.sms,\n addressLine1: initialUserInput.addressLine1 || previous.addressLine1,\n addressLine2: initialUserInput.addressLine2 || previous.addressLine2,\n postalCode: initialUserInput.postalCode || previous.postalCode,\n city: initialUserInput.city || previous.city,\n countryCode: initialUserInput.countryCode || previous.countryCode,\n nationality: initialUserInput.nationality || previous.nationality,\n companyName: initialUserInput.companyName || previous.companyName,\n siret: initialUserInput.siret || previous.siret,\n tva: initialUserInput.tva || previous.tva,\n registrationNumber: initialUserInput.registrationNumber || previous.registrationNumber,\n }));\n\n isFirstRender.current = false;\n }\n }, [\n initialUserInput,\n form.firstName,\n form.lastName,\n form.email,\n form.phoneNumber,\n form.companyName,\n ]);\n\n // Re-synchronise customFormData depuis initialUserInput quand on (ré)affiche un\n // nœud DIFFÉRENT sur une instance réutilisée (retour arrière sans remount).\n // Le champ form standard a déjà son propre effet de re-sync ci-dessus ; le\n // customFormData n'en avait aucun → il restait périmé (formulaire perso vidé).\n // On garde sur node.id : sur le MÊME nœud (frappe en cours), on ne touche à rien.\n // Redondant avec le remount par key={node.id} côté renderer, mais sert de filet.\n useEffect(() => {\n if (prevCustomNodeIdRef.current === node.id) {\n return;\n }\n prevCustomNodeIdRef.current = node.id;\n\n if (informationType !== \"custom\" || !node.customFields) {\n setCustomFormData({});\n return;\n }\n\n const next: Record<string, any> = {};\n node.customFields.forEach((field) => {\n const topLevelKey = field.userInputKey ?? labelToKey(field.label);\n const savedValue =\n (initialUserInput as Record<string, any>)?.[topLevelKey] ??\n initialUserInput?.customFormData?.[field.id];\n if (field.valueType === \"list\") {\n next[field.id] = Array.isArray(savedValue) ? savedValue : [];\n return;\n }\n next[field.id] = savedValue || \"\";\n });\n setCustomFormData(next);\n }, [node.id, informationType, node.customFields, initialUserInput]);\n\n useEffect(() => {\n return () => {\n if (hideSuggestionTimeout.current) {\n clearTimeout(hideSuggestionTimeout.current);\n }\n if (addressRequestState.current.debounce) {\n clearTimeout(addressRequestState.current.debounce);\n }\n if (addressRequestState.current.controller) {\n addressRequestState.current.controller.abort();\n }\n };\n }, []);\n\n const handleFieldChange = (key: keyof UserInputFormState, value: string) => {\n setErrors((previous) => ({\n ...previous,\n [key]: false,\n notMajor: false,\n }));\n\n setForm((previous) => {\n const next = { ...previous, [key]: value };\n if (key === \"day\" || key === \"month\" || key === \"year\") {\n const { day, month, year } = next;\n if (day && month && year) {\n const paddedDay = day.padStart(2, \"0\");\n const paddedMonth = month.padStart(2, \"0\");\n next.birthDate = `${paddedDay}-${paddedMonth}-${year}`;\n } else {\n next.birthDate = \"\";\n }\n }\n return next;\n });\n };\n\n const handleAddressChange = (value: string) => {\n handleFieldChange(\"addressLine1\", value);\n requestAddressSuggestions(value, { autoComplete: true });\n };\n\n const handleAddressFocus = () => {\n requestAddressSuggestions(form.addressLine1, { autoComplete: false });\n };\n\n const handleAddressBlur = () => {\n if (hideSuggestionTimeout.current) {\n clearTimeout(hideSuggestionTimeout.current);\n }\n hideSuggestionTimeout.current = setTimeout(() => {\n setShowSuggestions(false);\n hideSuggestionTimeout.current = null;\n }, 150);\n };\n\n const validateForm = () => {\n const nextErrors: UserInputFormErrors = {};\n let hasError = false;\n\n const markError = (key: string) => {\n nextErrors[key] = true;\n hasError = true;\n };\n\n if (informationType === \"identity\") {\n if (requestedFields.has(\"prenom\") && !form.firstName) {\n markError(\"firstName\");\n }\n if (requestedFields.has(\"nom\") && !form.lastName) {\n markError(\"lastName\");\n }\n if (requestedFields.has(\"date_naissance\")) {\n if (!form.birthDate) {\n markError(\"birthDate\");\n } else if (!checkIsMajor(form.birthDate)) {\n nextErrors.notMajor = true;\n hasError = true;\n }\n }\n }\n\n if (informationType === \"identity-legal\") {\n if (requestedFields.has(\"nom\") && !form.companyName) {\n markError(\"companyName\");\n }\n if (requestedFields.has(\"siret\") && !form.siret) {\n markError(\"siret\");\n }\n if (requestedFields.has(\"tva\") && !form.tva) {\n markError(\"tva\");\n }\n if (requestedFields.has(\"registrationNumber\") && !form.registrationNumber) {\n markError(\"registrationNumber\");\n }\n }\n\n if (informationType === \"identity-legal-rep\") {\n if (\n requestedFields.has(\"legalRepresentativeNom\") &&\n !form.legalRepresentativeLastName\n ) {\n markError(\"legalRepresentativeLastName\");\n }\n if (\n requestedFields.has(\"legalRepresentativePrenom\") &&\n !form.legalRepresentativeFirstName\n ) {\n markError(\"legalRepresentativeFirstName\");\n }\n // RL personne morale (délégation de pouvoir) : SIREN à la place de\n // Nom/Prénom, mutuellement exclusif — mode fixé par le concepteur du\n // parcours via requestedFields, jamais par l'utilisateur final.\n if (\n requestedFields.has(\"legalRepresentativeSiren\") &&\n !/^\\d{9}$/.test((form.legalRepresentativeSiren || \"\").replace(/\\s+/g, \"\"))\n ) {\n markError(\"legalRepresentativeSiren\");\n }\n }\n\n if (informationType === \"contact\") {\n if (requestedFields.has(\"email\")) {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n if (!form.email || !emailRegex.test(form.email)) {\n markError(\"email\");\n }\n }\n if (requestedFields.has(\"sms\")) {\n if (\n !form.phoneNumber ||\n form.phoneNumber.replace(/\\D/g, \"\").length < 6\n ) {\n markError(\"phoneNumber\");\n }\n }\n }\n\n if (\n (informationType === \"address\" || informationType === \"identity-legal\") &&\n requestedFields.has(\"adresse\")\n ) {\n if (!form.addressLine1) {\n markError(\"addressLine1\");\n }\n if (!form.postalCode) {\n markError(\"postalCode\");\n }\n if (!form.city) {\n markError(\"city\");\n }\n if (!form.countryCode) {\n markError(\"country\");\n }\n }\n\n if (\n informationType === \"nationality\" &&\n requestedFields.has(\"nationalite\")\n ) {\n if (!form.nationality) {\n markError(\"nationality\");\n }\n }\n\n setErrors(nextErrors);\n return !hasError;\n };\n\n const validateCustomForm = () => {\n const errors: Record<string, CustomFieldErrorValue> = {};\n const cellErrors: Record<string, Record<string, CustomFieldErrorValue>> = {};\n let hasError = false;\n\n node.customFields?.forEach((field) => {\n const value = customFormData[field.id];\n\n if (field.valueType === \"list\") {\n const rows: Record<string, string>[] = Array.isArray(value) ? value : [];\n const minRows = getListFieldMinRows(field);\n const columns = normalizeListColumns(field.listColumns);\n const fieldCellErrors: Record<string, CustomFieldErrorValue> = {};\n let listFieldInvalid = false;\n\n if (field.required && countNonEmptyListRows(rows) < minRows) {\n errors[field.id] = true;\n hasError = true;\n listFieldInvalid = true;\n }\n\n rows.forEach((row, rowIndex) => {\n const rowIsEmpty = columns.every(\n (col) => !String(row?.[col.label] ?? \"\").trim(),\n );\n if (rowIsEmpty && !field.required) return;\n\n columns.forEach((col) => {\n const cellValue = String(row?.[col.label] ?? \"\").trim();\n const key = cellErrorKey(rowIndex, col.label);\n\n if (!cellValue) {\n if (field.required && !rowIsEmpty) {\n fieldCellErrors[key] = t(\"custom_form.required_field\");\n listFieldInvalid = true;\n }\n return;\n }\n\n switch (col.type) {\n case \"email\":\n if (!isEmailValid(cellValue)) {\n fieldCellErrors[key] = t(\"custom_form.invalid_email\");\n listFieldInvalid = true;\n }\n break;\n case \"date\": {\n const fmt = col.dateFormat ?? DEFAULT_DATE_DISPLAY_FORMAT;\n if (!isDateValid(cellValue, fmt)) {\n fieldCellErrors[key] = t(\"custom_form.invalid_date\", {\n format: fmt,\n });\n listFieldInvalid = true;\n }\n break;\n }\n case \"text\":\n if (col.regex && !isRegexMatch(cellValue, col.regex)) {\n fieldCellErrors[key] =\n col.regexErrorMessage ||\n t(\"custom_form.invalid_format\");\n listFieldInvalid = true;\n }\n break;\n }\n });\n });\n\n if (Object.keys(fieldCellErrors).length > 0) {\n cellErrors[field.id] = fieldCellErrors;\n }\n if (listFieldInvalid) {\n // This field-level boolean only drives the red field outline. When\n // cell errors exist, their messages are rendered at cell level.\n errors[field.id] = errors[field.id] ?? true;\n hasError = true;\n }\n return;\n }\n\n // Check if required field is missing\n if (field.required && !value) {\n errors[field.id] = true;\n hasError = true;\n return;\n }\n\n // Type-specific validation\n if (value) {\n switch (field.valueType) {\n case \"number\":\n if (isNaN(Number(value))) {\n errors[field.id] = true;\n hasError = true;\n }\n break;\n\n case \"email\":\n if (!isEmailValid(String(value))) {\n errors[field.id] = t(\"custom_form.invalid_email\");\n hasError = true;\n }\n break;\n\n case \"text\":\n if (field.regex && !isRegexMatch(String(value), field.regex)) {\n errors[field.id] =\n field.regexErrorMessage || t(\"custom_form.invalid_format\");\n hasError = true;\n }\n break;\n\n case \"date\": {\n const fmt = field.dateFormat ?? DEFAULT_DATE_DISPLAY_FORMAT;\n if (!isDateValid(String(value), fmt)) {\n errors[field.id] = t(\"custom_form.invalid_date\", {\n format: fmt,\n });\n hasError = true;\n }\n break;\n }\n\n case \"address\":\n // Validate address object if required\n if (field.required && typeof value === \"object\") {\n const addressValue = value as {\n addressLine1?: string;\n postalCode?: string;\n city?: string;\n countryCode?: string;\n };\n if (\n !addressValue.addressLine1 ||\n !addressValue.postalCode ||\n !addressValue.city ||\n !addressValue.countryCode\n ) {\n errors[field.id] = true;\n hasError = true;\n }\n }\n break;\n }\n }\n });\n\n setCustomFormErrors(errors);\n setCustomFormCellErrors(cellErrors);\n return !hasError;\n };\n\n const handleCustomFieldChange = (fieldId: string, value: any) => {\n setCustomFormData((prev) => ({ ...prev, [fieldId]: value }));\n setCustomFormErrors((prev) => ({ ...prev, [fieldId]: false }));\n setCustomFormCellErrors((prev) => {\n if (!(fieldId in prev)) return prev;\n const { [fieldId]: _removed, ...rest } = prev;\n return rest;\n });\n };\n\n const goOnNextStep = () => {\n // Handle custom form validation and submission\n if (informationType === \"custom\") {\n if (!validateCustomForm()) {\n return;\n }\n\n const topLevelEntries: Record<string, any> = {};\n const customFormDataEntries: Record<string, any> = {};\n node.customFields?.forEach((field) => {\n const key = field.userInputKey ?? labelToKey(field.label);\n topLevelEntries[key] = customFormData[field.id];\n customFormDataEntries[field.id] = customFormData[field.id];\n });\n\n setUserInput((prev) => ({\n ...prev,\n // Top level avec clé lisible dérivée du label (attendu par l'API cliente)\n ...topLevelEntries,\n // customFormData avec les field.id d'origine (rétrocompat : conditions, sessions existantes)\n customFormData: { ...(prev.customFormData ?? {}), ...customFormDataEntries },\n }));\n\n if (sessionId) logFormValidated(sessionId);\n if (onContinueCallback) {\n onContinueCallback();\n } else {\n goToNextStep(node.id, template);\n }\n return;\n }\n\n // Standard form validation\n if (!validateForm()) {\n return;\n }\n\n setUserInput((previous) => ({\n ...previous,\n ...(requestedFields.has(\"nom\") && {\n ...(informationType === \"identity-legal\"\n ? { companyName: form.companyName }\n : { lastName: form.lastName }),\n }),\n ...(requestedFields.has(\"prenom\") && { firstName: form.firstName }),\n ...(requestedFields.has(\"date_naissance\") && {\n birthDate: form.birthDate,\n }),\n ...(requestedFields.has(\"email\") && { email: form.email }),\n ...(requestedFields.has(\"sms\") && {\n phoneNumber: form.phoneNumber,\n sms: form.phoneNumber,\n }),\n ...(requestedFields.has(\"adresse\") && {\n addressLine1: form.addressLine1,\n addressLine2: form.addressLine2,\n postalCode: form.postalCode,\n city: form.city,\n countryCode: form.countryCode,\n }),\n ...(requestedFields.has(\"siret\") && { siret: form.siret }),\n ...(requestedFields.has(\"tva\") && { tva: form.tva }),\n ...(requestedFields.has(\"registrationNumber\") && { registrationNumber: form.registrationNumber }),\n ...(requestedFields.has(\"siret\") && !requestedFields.has(\"registrationNumber\") && { registrationNumber: form.siret }),\n ...(requestedFields.has(\"nationalite\") && {\n nationality: form.nationality,\n }),\n ...(requestedFields.has(\"legalRepresentativeNom\") && {\n legalRepresentativeLastName: form.legalRepresentativeLastName,\n }),\n ...(requestedFields.has(\"legalRepresentativePrenom\") && {\n legalRepresentativeFirstName: form.legalRepresentativeFirstName,\n }),\n ...(requestedFields.has(\"legalRepresentativeSiren\") && {\n legalRepresentativeSiren: form.legalRepresentativeSiren,\n }),\n }));\n\n if (informationType === \"contact\" && setContactInfo) {\n setContactInfo((previous) => ({\n ...previous,\n ...(requestedFields.has(\"email\") && { email: form.email }),\n ...(requestedFields.has(\"sms\") && { phoneNumber: form.phoneNumber }),\n }));\n }\n\n if (sessionId) logFormValidated(sessionId);\n if (onContinueCallback) {\n onContinueCallback();\n } else {\n goToNextStep(node.id, template);\n }\n };\n\n const goOnPreviousStep = () => {\n goBack();\n };\n\n const pageTitle = node.pageTitle || formTitles[informationType];\n\n const pageDescription =\n node.pageDescription || formDescriptions[informationType];\n\n return {\n form,\n errors,\n informationType,\n requestedFields,\n pageTitle,\n pageDescription,\n addressSuggestions,\n showSuggestions,\n handleFieldChange,\n handleAddressChange,\n handleAddressFocus,\n handleAddressBlur,\n applyAddressSuggestion,\n goOnNextStep,\n goOnPreviousStep,\n customFormData,\n customFormErrors,\n customFormCellErrors,\n handleCustomFieldChange,\n };\n};\n"],"names":["useI18n","useMemo","resolveInformationType","DEFAULT_FIELDS","parseBirthDate","useState","labelToKey","useRef","__assign","__awaiter","API_BASE_URL","GEOCODING_AUTOCOMPLETE_ENDPOINT","FALLBACK_ADDRESS_SUGGESTIONS","useEffect","checkIsMajor","getListFieldMinRows","normalizeListColumns","countNonEmptyListRows","cellErrorKey","isEmailValid","DEFAULT_DATE_DISPLAY_FORMAT","isDateValid","isRegexMatch","__rest","logFormValidated"],"mappings":";;;;;;;;;;;;;;AA6DO,IAAM,gBAAgB,GAAG,UAAC,EAUa,EAAA;QAT5C,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,gBAAgB,GAAA,EAAA,CAAA,gBAAA,EAChB,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,QAAQ,cAAA,EACR,WAAW,GAAA,EAAA,CAAA,WAAA,EACX,cAAc,GAAA,EAAA,CAAA,cAAA,EACd,kBAAkB,GAAA,EAAA,CAAA,kBAAA,EAClB,SAAS,GAAA,EAAA,CAAA,SAAA;AAED,IAAwC,UAAU,QAA3C,CAAA,KAAE,MAAM,GAAyB,UAAU,CAAA,MAAnC,EAAE,YAAY,GAAW,UAAU,CAAA,YAArB,CAAA,CAAW,UAAU;AAClD,IAAA,IAAA,CAAC,GAAKA,eAAO,EAAE,EAAd;IAET,IAAM,eAAe,GAAGC,aAAO,CAAkB,YAAA;;QAC/C,IAAM,QAAQ,GAAGC,oCAAsB,CACrC,IAAI,CAAC,eAAyB,EAC9B,UAAU,CACX;AACD,QAAA,OAAO,CAAC,GAAG,CAAC,kDAAkD,EAAE;YAC9D,mBAAmB,EAAE,IAAI,CAAC,eAAe;AACzC,YAAA,QAAQ,EAAA,QAAA;AACR,YAAA,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;AACpC,YAAA,iBAAiB,EAAE,CAAA,EAAA,GAAA,IAAI,CAAC,YAAY,0CAAE,MAAM;AAC7C,SAAA,CAAC;AACF,QA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sBAAsB,EAAA,sBAAA;AACtB,QAAA,YAAY,EAAA,YAAA;AACZ,QAAA,gBAAgB,EAAA,gBAAA;AAChB,QAAA,cAAc,EAAA,cAAA;AACd,QAAA,gBAAgB,EAAA,gBAAA;AAChB,QAAA,oBAAoB,EAAA,oBAAA;AACpB,QAAA,uBAAuB,EAAA,uBAAA;KACxB;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sources":["../../../../src/types/session.ts"],"sourcesContent":["import type React from \"react\";\n\nexport interface SessionConfig {\n selfie?: boolean;\n requireMobile?: boolean;\n}\n\nexport interface DatakeenSessionProps {\n sessionId: string;\n sessionConfig?: SessionConfig;\n apiBaseUrl?: string; // Optional API base URL for dynamic environment configuration\n}\n\nexport interface UseSessionReturn {\n SessionComponent: React.ReactElement;\n}\n\nexport type stepObject = {\n setStep: (step: number, skipHistory?: boolean) => void;\n goBack: () => void;\n /** Retour arrière vers un nœud précis (ex: \"Corriger ma saisie\") :\n * tronque l'historique jusqu'à `targetStep` au lieu de l'empiler. */\n goBackToStep: (targetStep: number) => void;\n goToNextStep: (\n currentNodeId: string,\n template: SessionTemplate,\n handle?: string,\n ) => void;\n step: number;\n canGoBack: boolean;\n};\n\nexport interface ProcessingStep {\n title: string;\n subtitle: string;\n hasError?: boolean;\n}\n\nexport type ConditionTokenType = \"variable\" | \"control\" | \"operator\" | \"input\";\n\nexport interface ConditionToken {\n type: ConditionTokenType;\n value: string;\n label?: string;\n sourceNodeId?: string;\n}\n\n/**\n * Type for custom field value types\n */\nexport type CustomFieldValueType =\n | \"text\"\n | \"enum\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"email\"\n | \"address\"\n | \"list\";\n\n/**\n * Display formats supported for date fields (top-level and list columns).\n */\nexport type DateDisplayFormat = \"dd/mm/yyyy\" | \"mm/dd/yyyy\" | \"yyyy-mm-dd\";\n\nexport const DEFAULT_DATE_DISPLAY_FORMAT: DateDisplayFormat = \"dd/mm/yyyy\";\n\n/**\n * Column definition for a list-type custom field\n */\nexport interface ListColumn {\n label: string;\n type: \"text\" | \"enum\" | \"date\" | \"email\";\n options?: string[]; // required when type === 'enum'\n placeholder?: string; // text/email/date — shown to the end user\n regex?: string; // text — JS regex source (without slashes)\n regexErrorMessage?: string; // text — message displayed when regex fails\n dateFormat?: DateDisplayFormat; // date — display format expected\n}\n\n/**\n * Interface for custom field definition\n */\nexport interface CustomField {\n id: string;\n label: string;\n placeholder?: string;\n description?: string;\n valueType: CustomFieldValueType;\n enumOptions?: string[];\n listColumns?: ListColumn[]; // for list type: column definitions\n minRows?: number; // for list type: minimum rows expected\n required?: boolean;\n regex?: string; // text — JS regex source (without slashes)\n regexErrorMessage?: string; // text — message displayed when regex fails\n dateFormat?: DateDisplayFormat; // date — display format expected\n lockedFromApi?: boolean;\n editableIfMissing?: boolean; // soft lock — éditable si la valeur API est absente\n userInputKey?: string;\n}\n\n/**\n * Interface for session template node\n */\nexport interface SessionTemplateNode {\n id: string;\n type: string;\n title: string;\n description: string;\n informationType?:\n | \"identity\"\n | \"identity-legal\"\n | \"contact\"\n | \"address\"\n | \"nationality\"\n | \"custom\";\n position: {\n x: number;\n y: number;\n };\n options: unknown[];\n selectedOptions: string[];\n requiredDocumentType?: string;\n isRequired: boolean;\n order: number;\n optionalFields?: string[];\n requiredFields?: string[];\n pageTitle?: string;\n pageDescription?: string;\n // Properties for document-collection node type\n allowedDocumentTypes?: Array<{\n id: string;\n name: string;\n /**\n * Optional side information coming from the template.\n * When provided and equals to two (\"two\", 2, \"double\", \"recto-verso\"),\n * consumers should allow uploading two sides (front/back).\n */\n side?: string | number;\n }>;\n allowedAddingMethods?: string[];\n introductionPage?: {\n title?: string;\n description?: string;\n };\n documentSelection?: {\n title?: string;\n description?: string;\n };\n // Start node specific properties\n welcomeTitle?: string;\n welcomeSubtitle?: string;\n welcomeDescription?: string;\n welcomeImage?: string;\n qrCodeTitle?: string;\n qrCodeDescription?: string;\n showLegacyCGU?: boolean; // default: true — rétrocompatibilité\n\n // Legal consent node specific properties\n consentDescription?: string;\n consentDescription2?: string;\n cguUrl?: string;\n privacyPolicyUrl?: string;\n cguLinkLabel?: string;\n privacyLinkLabel?: string;\n checkboxText?: string;\n // Identity control specific properties\n automaticPhotoCapture?: boolean;\n nfcEnabled?: boolean;\n // \"nfcAndApi\" reste accepté pour rétrocompat (parcours legacy) ; à normaliser à la lecture.\n nfcMode?: \"nfcOnly\" | \"nfcOrPhoto\" | \"nfcAndApi\";\n acceptedCountries?: AcceptedCountry[];\n // End node specific properties\n callbackURL?: string | null;\n // Résultat forcé par le nœud `end` (configuré dans le builder). Sert au SDK à\n // afficher la variante « erreur conservée » de l'écran de fin quand la branche\n // fausse d'une condition pointe directement vers un end non_compliant.\n expectedResult?: string;\n // Condition node specific properties\n conditionExpression?: string;\n conditionTokens?: ConditionToken[];\n conditionFalseErrorMessage?: string;\n conditionMaxRetries?: number;\n conditionMaxRetryAction?: \"end-journey\" | \"force-true\";\n // Undefined is treated as \"loop\" by the SDK for legacy templates.\n conditionFalseMode?: \"retry\" | \"loop\";\n\n // External verification specific properties\n targetApi?: \"INSEE\" | \"INPI_RBE\";\n /** INPI_RBE only. Opt-in: retry against the RNA (associations) when the RNE finds nothing. */\n rnaFallbackEnabled?: boolean;\n referenceNodeId?: string;\n referenceNodeType?:\n | \"information-input\"\n | \"document-collection\"\n | \"identity-control\";\n referenceField?: \"siren\" | \"siret\";\n referenceVariable?: string;\n // Custom form fields (for information-input with type 'custom')\n customFields?: CustomField[];\n\n // Electronic signature specific properties\n templateId?: string;\n external_id?: string;\n fieldMappings?: Array<{\n sourceFieldId: string;\n label: string;\n docusealType: string;\n readonly: boolean;\n role?: string;\n sourceNodeId?: string;\n }>;\n /** If set, the generated PDF from this upstream pdf-generation node will be used as the document to sign */\n sourcePdfNodeId?: string;\n\n // PDF generation node specific properties\n // Note: htmlTemplate is intentionally NOT included — it is server-side only and never sent to the client\n pdfMode?: \"upload\" | \"html-template\";\n sourceNodeIds?: string[];\n\n // retry properties\n allowResubmission: boolean;\n maxResubmissionAttempts?: number;\n\n /**\n * Paramétrable par nœud depuis le journey builder : autorise ou non le\n * bouton \"Poursuivre quand même\" en cas d'échec. S'applique aux nœuds\n * identity-control, document-collection, biometric-capture (selfie/video)\n * et external-verification. Absent/true = comportement actuel inchangé\n * (bouton proposé), false = masqué.\n */\n allowContinueOnFailure?: boolean;\n}\n\n/**\n * Interface for accepted countries\n */\nexport interface AcceptedCountry {\n code: string;\n documents: {\n passport: string[];\n idCard: string[];\n driverLicense: string[];\n residencePermit: string[];\n pinkDriverLicense: string[];\n };\n}\n\n/**\n * Interface for session template edge\n */\nexport interface SessionTemplateEdge {\n id: string;\n source: string;\n target: string;\n sourceHandle?: string;\n targetHandle?: string;\n conditionValue?: string;\n}\n\n/**\n * Interface for platform information\n */\nexport interface PlatformInfo {\n mobile: boolean;\n desktop: boolean;\n backoffice: boolean;\n}\n\n/**\n * Interface for session template\n */\n/** Clé du catalogue d'icônes des écrans de fin (mappée vers lucide-react au rendu). */\nexport type EndScreenIcon =\n | \"thanks\"\n | \"send\"\n | \"mail\"\n | \"check\"\n | \"clock\"\n | \"shield\"\n | \"user\"\n | \"info\";\n\nexport interface EndScreenItem {\n icon: EndScreenIcon;\n text: string;\n}\n\nexport interface EndScreenCase {\n title?: string;\n items: EndScreenItem[];\n}\n\n/** Textes de fin personnalisés (config globale du journey). Vide → fallback standard. */\nexport interface EndScreenConfig {\n compliant?: EndScreenCase;\n nonCompliant?: EndScreenCase;\n}\n\nexport interface SessionTemplate {\n id: string;\n name: string;\n description: string;\n version: string;\n languages: string[];\n nodes: SessionTemplateNode[];\n edges: SessionTemplateEdge[];\n groupId: string;\n userId: string | null;\n created_at: string;\n updated_at: string;\n platforms?: PlatformInfo;\n logo?: string;\n showQRCode?: boolean;\n buttonBgColor?: string;\n buttonTextColor?: string;\n endScreenConfig?: EndScreenConfig;\n}\n\n/**\n * Interface for session data\n */\nexport interface SessionData {\n id: string;\n userId: string | null;\n token: string;\n templateId: string;\n templateKey: string;\n expireTime: number;\n status: string;\n result: Record<string, unknown>;\n landingPage: unknown;\n withSelfie: boolean | null;\n groupId: string | null;\n userInput: Record<string, unknown>;\n contactInfo?: {\n email: string;\n phoneNumber: string;\n };\n callbackURL?: string | null;\n webhookURL: string;\n analysisTemplateId: string | null;\n userAgent: unknown[];\n mobile: boolean;\n analysisId: string | null;\n currentStep?: number;\n nfcStatus?: \"pending\" | \"opened\" | \"completed\" | \"skipped\" | \"failed\";\n createdAt: string;\n updatedAt: string;\n auditTrail: unknown[];\n user: unknown | null;\n analysis: unknown[];\n documents: unknown[];\n template: SessionTemplate;\n retryCounts?: Record<string, number>; // nodeId -> retry count\n}\n\nexport interface ClientInfo {\n ip?: string;\n location?: string;\n device: string;\n browser: string;\n os: string;\n}\n"],"names":[],"mappings":";;AAiEO,IAAM,2BAA2B,GAAsB;;;;"}
1
+ {"version":3,"file":"session.js","sources":["../../../../src/types/session.ts"],"sourcesContent":["import type React from \"react\";\n\nexport interface SessionConfig {\n selfie?: boolean;\n requireMobile?: boolean;\n}\n\nexport interface DatakeenSessionProps {\n sessionId: string;\n sessionConfig?: SessionConfig;\n apiBaseUrl?: string; // Optional API base URL for dynamic environment configuration\n}\n\nexport interface UseSessionReturn {\n SessionComponent: React.ReactElement;\n}\n\nexport type stepObject = {\n setStep: (step: number, skipHistory?: boolean) => void;\n goBack: () => void;\n /** Retour arrière vers un nœud précis (ex: \"Corriger ma saisie\") :\n * tronque l'historique jusqu'à `targetStep` au lieu de l'empiler. */\n goBackToStep: (targetStep: number) => void;\n goToNextStep: (\n currentNodeId: string,\n template: SessionTemplate,\n handle?: string,\n ) => void;\n /** Avance via le graphe et tronque l'historique au nœud d'arrivée. */\n goToNextStepCommitted: (\n currentNodeId: string,\n template: SessionTemplate,\n handle?: string,\n ) => void;\n step: number;\n canGoBack: boolean;\n};\n\nexport interface ProcessingStep {\n title: string;\n subtitle: string;\n hasError?: boolean;\n}\n\nexport type ConditionTokenType = \"variable\" | \"control\" | \"operator\" | \"input\";\n\nexport interface ConditionToken {\n type: ConditionTokenType;\n value: string;\n label?: string;\n sourceNodeId?: string;\n}\n\n/**\n * Type for custom field value types\n */\nexport type CustomFieldValueType =\n | \"text\"\n | \"enum\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"email\"\n | \"address\"\n | \"list\";\n\n/**\n * Display formats supported for date fields (top-level and list columns).\n */\nexport type DateDisplayFormat = \"dd/mm/yyyy\" | \"mm/dd/yyyy\" | \"yyyy-mm-dd\";\n\nexport const DEFAULT_DATE_DISPLAY_FORMAT: DateDisplayFormat = \"dd/mm/yyyy\";\n\n/**\n * Column definition for a list-type custom field\n */\nexport interface ListColumn {\n label: string;\n type: \"text\" | \"enum\" | \"date\" | \"email\";\n options?: string[]; // required when type === 'enum'\n placeholder?: string; // text/email/date — shown to the end user\n regex?: string; // text — JS regex source (without slashes)\n regexErrorMessage?: string; // text — message displayed when regex fails\n dateFormat?: DateDisplayFormat; // date — display format expected\n}\n\n/**\n * Interface for custom field definition\n */\nexport interface CustomField {\n id: string;\n label: string;\n placeholder?: string;\n description?: string;\n valueType: CustomFieldValueType;\n enumOptions?: string[];\n listColumns?: ListColumn[]; // for list type: column definitions\n minRows?: number; // for list type: minimum rows expected\n required?: boolean;\n regex?: string; // text — JS regex source (without slashes)\n regexErrorMessage?: string; // text — message displayed when regex fails\n dateFormat?: DateDisplayFormat; // date — display format expected\n lockedFromApi?: boolean;\n editableIfMissing?: boolean; // soft lock — éditable si la valeur API est absente\n userInputKey?: string;\n}\n\n/**\n * Interface for session template node\n */\nexport interface SessionTemplateNode {\n id: string;\n type: string;\n title: string;\n description: string;\n informationType?:\n | \"identity\"\n | \"identity-legal\"\n | \"contact\"\n | \"address\"\n | \"nationality\"\n | \"custom\";\n position: {\n x: number;\n y: number;\n };\n options: unknown[];\n selectedOptions: string[];\n requiredDocumentType?: string;\n isRequired: boolean;\n order: number;\n optionalFields?: string[];\n requiredFields?: string[];\n pageTitle?: string;\n pageDescription?: string;\n // Properties for document-collection node type\n allowedDocumentTypes?: Array<{\n id: string;\n name: string;\n /**\n * Optional side information coming from the template.\n * When provided and equals to two (\"two\", 2, \"double\", \"recto-verso\"),\n * consumers should allow uploading two sides (front/back).\n */\n side?: string | number;\n }>;\n allowedAddingMethods?: string[];\n introductionPage?: {\n title?: string;\n description?: string;\n };\n documentSelection?: {\n title?: string;\n description?: string;\n };\n // Start node specific properties\n welcomeTitle?: string;\n welcomeSubtitle?: string;\n welcomeDescription?: string;\n welcomeImage?: string;\n qrCodeTitle?: string;\n qrCodeDescription?: string;\n showLegacyCGU?: boolean; // default: true — rétrocompatibilité\n\n // Legal consent node specific properties\n consentDescription?: string;\n consentDescription2?: string;\n cguUrl?: string;\n privacyPolicyUrl?: string;\n cguLinkLabel?: string;\n privacyLinkLabel?: string;\n checkboxText?: string;\n // Identity control specific properties\n automaticPhotoCapture?: boolean;\n nfcEnabled?: boolean;\n // \"nfcAndApi\" reste accepté pour rétrocompat (parcours legacy) ; à normaliser à la lecture.\n nfcMode?: \"nfcOnly\" | \"nfcOrPhoto\" | \"nfcAndApi\";\n acceptedCountries?: AcceptedCountry[];\n // End node specific properties\n callbackURL?: string | null;\n // Résultat forcé par le nœud `end` (configuré dans le builder). Sert au SDK à\n // afficher la variante « erreur conservée » de l'écran de fin quand la branche\n // fausse d'une condition pointe directement vers un end non_compliant.\n expectedResult?: string;\n // Condition node specific properties\n conditionExpression?: string;\n conditionTokens?: ConditionToken[];\n conditionFalseErrorMessage?: string;\n conditionMaxRetries?: number;\n conditionMaxRetryAction?: \"end-journey\" | \"force-true\";\n // Undefined is treated as \"loop\" by the SDK for legacy templates.\n conditionFalseMode?: \"retry\" | \"loop\";\n\n // External verification specific properties\n targetApi?: \"INSEE\" | \"INPI_RBE\";\n /** INPI_RBE only. Opt-in: retry against the RNA (associations) when the RNE finds nothing. */\n rnaFallbackEnabled?: boolean;\n referenceNodeId?: string;\n referenceNodeType?:\n | \"information-input\"\n | \"document-collection\"\n | \"identity-control\";\n referenceField?: \"siren\" | \"siret\";\n referenceVariable?: string;\n // Custom form fields (for information-input with type 'custom')\n customFields?: CustomField[];\n\n // Electronic signature specific properties\n templateId?: string;\n external_id?: string;\n fieldMappings?: Array<{\n sourceFieldId: string;\n label: string;\n docusealType: string;\n readonly: boolean;\n role?: string;\n sourceNodeId?: string;\n }>;\n /** If set, the generated PDF from this upstream pdf-generation node will be used as the document to sign */\n sourcePdfNodeId?: string;\n\n // PDF generation node specific properties\n // Note: htmlTemplate is intentionally NOT included — it is server-side only and never sent to the client\n pdfMode?: \"upload\" | \"html-template\";\n sourceNodeIds?: string[];\n\n // retry properties\n allowResubmission: boolean;\n maxResubmissionAttempts?: number;\n\n /**\n * Paramétrable par nœud depuis le journey builder : autorise ou non le\n * bouton \"Poursuivre quand même\" en cas d'échec. S'applique aux nœuds\n * identity-control, document-collection, biometric-capture (selfie/video)\n * et external-verification. Absent/true = comportement actuel inchangé\n * (bouton proposé), false = masqué.\n */\n allowContinueOnFailure?: boolean;\n}\n\n/**\n * Interface for accepted countries\n */\nexport interface AcceptedCountry {\n code: string;\n documents: {\n passport: string[];\n idCard: string[];\n driverLicense: string[];\n residencePermit: string[];\n pinkDriverLicense: string[];\n };\n}\n\n/**\n * Interface for session template edge\n */\nexport interface SessionTemplateEdge {\n id: string;\n source: string;\n target: string;\n sourceHandle?: string;\n targetHandle?: string;\n conditionValue?: string;\n}\n\n/**\n * Interface for platform information\n */\nexport interface PlatformInfo {\n mobile: boolean;\n desktop: boolean;\n backoffice: boolean;\n}\n\n/**\n * Interface for session template\n */\n/** Clé du catalogue d'icônes des écrans de fin (mappée vers lucide-react au rendu). */\nexport type EndScreenIcon =\n | \"thanks\"\n | \"send\"\n | \"mail\"\n | \"check\"\n | \"clock\"\n | \"shield\"\n | \"user\"\n | \"info\";\n\nexport interface EndScreenItem {\n icon: EndScreenIcon;\n text: string;\n}\n\nexport interface EndScreenCase {\n title?: string;\n items: EndScreenItem[];\n}\n\n/** Textes de fin personnalisés (config globale du journey). Vide → fallback standard. */\nexport interface EndScreenConfig {\n compliant?: EndScreenCase;\n nonCompliant?: EndScreenCase;\n}\n\nexport interface SessionTemplate {\n id: string;\n name: string;\n description: string;\n version: string;\n languages: string[];\n nodes: SessionTemplateNode[];\n edges: SessionTemplateEdge[];\n groupId: string;\n userId: string | null;\n created_at: string;\n updated_at: string;\n platforms?: PlatformInfo;\n logo?: string;\n showQRCode?: boolean;\n buttonBgColor?: string;\n buttonTextColor?: string;\n endScreenConfig?: EndScreenConfig;\n}\n\n/**\n * Interface for session data\n */\nexport interface SessionData {\n id: string;\n userId: string | null;\n token: string;\n templateId: string;\n templateKey: string;\n expireTime: number;\n status: string;\n result: Record<string, unknown>;\n landingPage: unknown;\n withSelfie: boolean | null;\n groupId: string | null;\n userInput: Record<string, unknown>;\n contactInfo?: {\n email: string;\n phoneNumber: string;\n };\n callbackURL?: string | null;\n webhookURL: string;\n analysisTemplateId: string | null;\n userAgent: unknown[];\n mobile: boolean;\n analysisId: string | null;\n currentStep?: number;\n nfcStatus?: \"pending\" | \"opened\" | \"completed\" | \"skipped\" | \"failed\";\n createdAt: string;\n updatedAt: string;\n auditTrail: unknown[];\n user: unknown | null;\n analysis: unknown[];\n documents: unknown[];\n template: SessionTemplate;\n retryCounts?: Record<string, number>; // nodeId -> retry count\n}\n\nexport interface ClientInfo {\n ip?: string;\n location?: string;\n device: string;\n browser: string;\n os: string;\n}\n"],"names":[],"mappings":";;AAuEO,IAAM,2BAA2B,GAAsB;;;;"}
@@ -275,7 +275,7 @@ var DocumentCollection = function (_a) {
275
275
  };
276
276
  switch (currentStep) {
277
277
  case 0:
278
- return (jsx(DocumentCollectionIntroduction, { onContinue: handleContinueFromIntroduction, onBack: handleBack, introductionPage: introductionPage }));
278
+ return (jsx(DocumentCollectionIntroduction, { onContinue: handleContinueFromIntroduction, onBack: stepObject.canGoBack ? handleBack : undefined, introductionPage: introductionPage }));
279
279
  case 1:
280
280
  return (jsx(DocumentCollectionSelection, { onContinue: handleDocumentTypeSelect, onBack: handleBack, allowedDocumentTypes: allowedDocumentTypes, allowedAddingMethods: allowedAddingMethods, stepObject: stepObject, documentSelection: documentSelection }));
281
281
  case 2:
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentCollection.js","sources":["../../../../../src/components/document-collection/DocumentCollection.tsx"],"sourcesContent":["import { useState, useEffect } from \"react\";\nimport {\n SessionTemplate,\n SessionTemplateNode,\n stepObject,\n} from \"../../types/session\";\nimport type { onUploadFiles } from \"../../types/uploadFiles\";\nimport type { Prediction } from \"../../utils/apiAnalysis\";\nimport DocumentCollectionIntroduction from \"./DocumentCollectionIntroduction\";\nimport DocumentCollectionSelection from \"./DocumentCollectionSelection\";\nimport DocumentCollectionUpload from \"./DocumentCollectionUpload\";\nimport DocumentCollectionMethodSelection from \"./DocumentCollectionMethodSelection\";\nimport { DocumentError, DocumentProcessing, DocumentSuccess } from \".\";\nimport JDIProcessing from \"../jdi/JDIProcessing\";\nimport JDISuccess from \"../jdi/JDISuccess\";\nimport JDIError from \"../jdi/JDIError\";\nimport BeforePhoto from \"../id-check/BeforePhoto\";\nimport BeforeVersoPhoto from \"../id-check/BeforeVersoPhoto\";\nimport Photo from \"../id-check/Photo\";\nimport PhotoPreview from \"../id-check/PhotoPreview\";\nimport PhotoConfirmation from \"../id-check/PhotoConfirmation\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport ButtonDesktop from \"../ui/ButtonDesktop\";\nimport { updateSessionCurrentStep } from \"../../services/sessionService\";\nimport { analyzeFiles } from \"../../services/analysis\";\nimport {\n getNodeRetryCount,\n incrementNodeRetryCount,\n} from \"../../services/retryService\";\nimport { getSession } from \"../../context/SessionContext\";\nimport {\n resizeAfterCapture,\n dataUrlToBlob,\n blobToDataUrl,\n} from \"../../utils/imageProcessing\";\n\nexport type DocumentTypeSide = \"ONE_FILE\" | \"RECTO_VERSO\";\n\nexport interface NodeDocumentCollection {\n id: string;\n allowedDocumentTypes: Array<{\n name: string;\n id: string;\n collectOnly?: boolean;\n }>;\n allowedAddingMethods: Array<'download' | 'picture'>;\n introductionPage: {\n title: string;\n description: string;\n };\n documentSelection: {\n title: string;\n description: string;\n };\n allowResubmission: boolean;\n maxResubmissionAttempts?: number;\n /** Paramétrable par nœud dans le journey builder. Absent/true = comportement\n * actuel inchangé (bouton \"Continuer quand même\" proposé) ; false = masqué. */\n allowContinueOnFailure?: boolean;\n}\n\ninterface AllowedDocumentType {\n id: string;\n name: string;\n side?: DocumentTypeSide;\n collectOnly?: boolean;\n}\n\ninterface DocumentCollectionProps {\n stepObject: stepObject;\n sessionId: string;\n node: NodeDocumentCollection;\n onContinueOnPC?: () => void;\n allowedDocumentTypes: AllowedDocumentType[];\n allowedAddingMethods: string[];\n template?: SessionTemplate;\n introductionPage?: {\n title?: string;\n description?: string;\n };\n documentSelection?: {\n title?: string;\n description?: string;\n };\n allowResubmission?: boolean;\n maxResubmissionAttempts?: number;\n}\n\n/**\n * DocumentCollection component manages the multi-step document collection flow.\n * It handles document type selection, document upload, processing, and error/success handling.\n *\n * @component\n * @param {Object} props - Component props.\n * @param {stepObject} props.stepObject - Object managing the current step in the parent flow, with setStep and step properties.\n * @param {string} props.sessionId - Unique identifier for the current session.\n * @param {NodeDocumentCollection} props.node - Node configuration containing allowed document types and page content.\n * @param {() => void} [props.onContinueOnPC] - Optional callback to continue the process on a PC.\n * @param {AllowedDocumentType[]} props.allowedDocumentTypes - List of document types accepted for collection.\n * @param {string[]} props.allowedAddingMethods - List of allowed methods for adding documents (download, picture, etc.).\n * @param {Object} [props.introductionPage] - Optional introduction page configuration with title and description.\n * @param {Object} [props.documentSelection] - Optional document selection page configuration with title and description.\n *\n * @returns {JSX.Element} Multi-step document collection UI, rendering different subcomponents based on the current step.\n *\n * @remarks\n * - Manages internal state for step navigation, document selection, file uploads, and error handling.\n * - Displays error messages and fallback UI for invalid navigation.\n * - Uses translation hooks for internationalization support.\n */\nconst DocumentCollection = ({\n stepObject,\n sessionId,\n node,\n template,\n onContinueOnPC,\n allowedDocumentTypes,\n allowedAddingMethods,\n introductionPage,\n documentSelection,\n allowResubmission,\n maxResubmissionAttempts,\n}: DocumentCollectionProps) => {\n const { t } = useI18n();\n const { session } = getSession();\n\n const [currentStep, setCurrentStep] = useState(introductionPage?.title ? 0 : 1);\n const [fileUploaded, setFileUploaded] = useState<onUploadFiles | null>(null);\n const [selectedDocumentType, setSelectedDocumentType] = useState<string>(\"\");\n const [analysisData, setAnalysisData] = useState<Prediction[] | null>(null);\n const [errorCode, setErrorCode] = useState<string | null>(null);\n const [blockContinue, setBlockContinue] = useState(false);\n const [selectedMethod, setSelectedMethod] = useState<\"download\" | \"picture\" | null>(null);\n const [photoSubStep, setPhotoSubStep] = useState<\"before-recto\" | \"recto\" | \"preview-recto\" | \"before-verso\" | \"verso\" | \"preview-verso\" | \"confirmation\">(\"before-recto\");\n const [capturedImages, setCapturedImages] = useState<Record<string, string>>({});\n\n // Initialize retry count from session data\n const [retryCount, setRetryCount] = useState(() => {\n return getNodeRetryCount(session, node.id);\n });\n\n // Update retry count when session loads/changes\n useEffect(() => {\n if (session) {\n const sessionRetryCount = getNodeRetryCount(session, node.id);\n setRetryCount(sessionRetryCount);\n }\n }, [session, node.id]);\n\n // Check retry limits on mount/reload - if retries exhausted, show error page\n useEffect(() => {\n // Special case: if allowResubmission is false and retryCount > 0, show error immediately\n if (allowResubmission === false && retryCount > 0) {\n setCurrentStep(6);\n return;\n }\n\n // Normal case: check against maxResubmissionAttempts\n if (retryCount > 0 && !isRetryAllowed()) {\n // User has exhausted retries, redirect to error page\n setCurrentStep(6);\n }\n }, [retryCount, allowResubmission]);\n\n const handleContinueFromIntroduction = () => {\n setCurrentStep(1);\n };\n\n const handleDocumentTypeSelect = (docType: string, files?: onUploadFiles) => {\n setSelectedDocumentType(docType);\n\n if (files) {\n handleDocumentUpload(files);\n return;\n }\n\n const isPictureAllowed = allowedAddingMethods.includes(\"picture\");\n const isDownloadAllowed = allowedAddingMethods.includes(\"download\");\n\n if (isPictureAllowed && isDownloadAllowed) {\n setCurrentStep(2); // Method selection\n } else {\n const method = isPictureAllowed ? \"picture\" : \"download\";\n handleMethodSelect(method);\n }\n };\n\n const handleMethodSelect = (method: \"download\" | \"picture\") => {\n setSelectedMethod(method);\n if (method === \"picture\") {\n setPhotoSubStep(\"before-recto\");\n setCapturedImages({});\n }\n setCurrentStep(3); // Go to action (Upload screen or Photo flow)\n };\n\n const handlePhotoCapture = async (imageData: string, side: \"recto\" | \"verso\") => {\n try {\n const imageBlob = dataUrlToBlob(imageData);\n const processedBlob = await resizeAfterCapture(imageBlob);\n const processedDataUrl = await blobToDataUrl(processedBlob);\n setCapturedImages((prev) => ({ ...prev, [side]: processedDataUrl }));\n } catch (error) {\n console.error(`[DocumentCollection] Failed to process photo for ${side}:`, error);\n setCapturedImages((prev) => ({ ...prev, [side]: imageData }));\n }\n setPhotoSubStep(side === \"recto\" ? \"preview-recto\" : \"preview-verso\");\n };\n\n const handlePhotoConfirmation = () => {\n if (capturedImages.recto) {\n const files: onUploadFiles = {\n front: capturedImages.recto,\n back: capturedImages.verso || null,\n };\n setFileUploaded(files);\n setCurrentStep(4);\n }\n };\n\n const handleDocumentUpload = (files: onUploadFiles) => {\n setFileUploaded(files);\n\n // Check if the selected document type is collectOnly — skip processing step\n const selectedDoc = allowedDocumentTypes.find((d) => d.id === selectedDocumentType);\n if (selectedDoc?.collectOnly) {\n handleCollectOnlyUpload(files);\n return;\n }\n\n // Check if retry limit is reached before processing\n if (!isRetryAllowed() && retryCount > 0) {\n // Skip processing and go directly to error page\n setCurrentStep(6);\n } else {\n // Proceed to processing\n setCurrentStep(4);\n }\n };\n\n const handleProcessingComplete = (\n success: boolean,\n currentRetryCount?: number,\n apiAnalysisData?: Prediction[] | null,\n shouldBlockContinue?: boolean,\n ) => {\n setBlockContinue(shouldBlockContinue === true);\n if (apiAnalysisData) {\n setAnalysisData(apiAnalysisData);\n if (apiAnalysisData.length > 0) {\n setErrorCode(apiAnalysisData[0].code);\n }\n }\n\n if (success) {\n // Always follow the graph edges. Arithmetic fallback only when no template is available\n // (out of the normal TemplateNodeRenderer flow).\n if (template) {\n stepObject.goToNextStep(node.id, template);\n } else {\n stepObject.setStep(stepObject.step + 1);\n }\n setCurrentStep(5);\n } else {\n setRetryCount((prev) => {\n const newCount = prev + 1;\n incrementNodeRetryCount(sessionId, node.id, prev).catch((error) => {\n console.error(\"Failed to update retry count in session:\", error);\n });\n return newCount;\n });\n setCurrentStep(6);\n }\n };\n\n const handleCollectOnlyUpload = async (files: onUploadFiles) => {\n try {\n await analyzeFiles(sessionId, node.id, files, selectedDocumentType, {\n documentTypeKey: selectedDocumentType,\n collectOnly: true,\n enablePolling: false,\n });\n handleProcessingComplete(true, retryCount, null);\n } catch (error) {\n console.error(\"[DocumentCollection] collectOnly upload failed:\", error);\n handleProcessingComplete(false, retryCount, null);\n }\n };\n\n const handleRetryFromError = () => {\n setBlockContinue(false);\n setCurrentStep(1);\n setSelectedMethod(null);\n setCapturedImages({});\n setFileUploaded(null);\n };\n\n // Check if retry is allowed based on configuration\n const isRetryAllowed = () => {\n if (allowResubmission === undefined) return true;\n if (!allowResubmission) return false;\n if (maxResubmissionAttempts !== undefined) {\n return retryCount <= maxResubmissionAttempts;\n }\n return true;\n };\n\n // Node progression must follow the graph edges. `onContinueOnPC` is reserved for the\n // QR / mobile→PC redirection and must NOT drive node progression (it navigates by raw step\n // arithmetic, which breaks when several nodes share the same `order`).\n const handleContinueAnyway = () => {\n if (template) {\n stepObject.goToNextStep(node.id, template);\n } else if (onContinueOnPC) {\n onContinueOnPC();\n } else {\n stepObject.setStep(stepObject.step + 1);\n }\n };\n\n const handleSuccessContinue = () => {\n if (template) {\n stepObject.goToNextStep(node.id, template);\n } else if (onContinueOnPC) {\n onContinueOnPC();\n } else {\n stepObject.setStep(stepObject.step + 1);\n }\n };\n\n const handleBack = () => {\n if (currentStep === 0) {\n // Inter-node back navigation goes through the history-aware goBack(), never raw arithmetic.\n stepObject.goBack();\n } else {\n setCurrentStep(currentStep - 1);\n }\n };\n\n switch (currentStep) {\n case 0:\n return (\n <DocumentCollectionIntroduction\n onContinue={handleContinueFromIntroduction}\n onBack={handleBack}\n introductionPage={introductionPage}\n />\n );\n case 1:\n return (\n <DocumentCollectionSelection\n onContinue={handleDocumentTypeSelect}\n onBack={handleBack}\n allowedDocumentTypes={allowedDocumentTypes}\n allowedAddingMethods={allowedAddingMethods}\n stepObject={stepObject}\n documentSelection={documentSelection}\n />\n );\n case 2:\n return (\n <DocumentCollectionMethodSelection\n onMethodSelect={handleMethodSelect}\n onBack={handleBack}\n title={documentSelection?.title}\n description={documentSelection?.description}\n />\n );\n case 3:\n if (selectedMethod === \"download\") {\n return (\n <DocumentCollectionUpload\n selectedDocumentType={selectedDocumentType}\n allowedDocumentTypes={allowedDocumentTypes}\n onUpload={handleDocumentUpload}\n onBack={handleBack}\n documentSelection={documentSelection}\n sessionId={sessionId}\n />\n );\n } else {\n // Photo flow\n const requiresTwoSides = allowedDocumentTypes.find((dt) => dt.id === selectedDocumentType)?.side === \"RECTO_VERSO\";\n\n switch (photoSubStep) {\n case \"before-recto\":\n return <BeforePhoto setStep={() => setPhotoSubStep(\"recto\")} isSingleSided={!requiresTwoSides} onBack={handleBack} />;\n case \"recto\":\n return <Photo onCapture={(img) => handlePhotoCapture(img, \"recto\")} automaticCapture={false} maskType=\"document\" />;\n case \"preview-recto\":\n return (\n <PhotoPreview\n imageUrl={capturedImages.recto}\n side=\"recto\"\n isSingleSided={!requiresTwoSides}\n onValidate={() => setPhotoSubStep(requiresTwoSides ? \"before-verso\" : \"confirmation\")}\n onRetake={() => {\n setCapturedImages((prev) => { const next = { ...prev }; delete next.recto; return next; });\n setPhotoSubStep(\"recto\");\n }}\n />\n );\n case \"before-verso\":\n return <BeforeVersoPhoto setStep={() => setPhotoSubStep(\"verso\")} />;\n case \"verso\":\n return <Photo onCapture={(img) => handlePhotoCapture(img, \"verso\")} automaticCapture={false} maskType=\"document\" />;\n case \"preview-verso\":\n return (\n <PhotoPreview\n imageUrl={capturedImages.verso}\n side=\"verso\"\n onValidate={() => setPhotoSubStep(\"confirmation\")}\n onRetake={() => {\n setCapturedImages((prev) => { const next = { ...prev }; delete next.verso; return next; });\n setPhotoSubStep(\"verso\");\n }}\n />\n );\n case \"confirmation\":\n return (\n <PhotoConfirmation\n imageUrl={capturedImages.recto}\n versoImageUrl={capturedImages.verso}\n requiresTwoSides={requiresTwoSides}\n onConfirm={handlePhotoConfirmation}\n onRetry={() => {\n setPhotoSubStep(\"before-recto\");\n setCapturedImages({});\n }}\n onRetryAfterProcessing={() => {\n setCurrentStep(1);\n setPhotoSubStep(\"before-recto\");\n setCapturedImages({});\n }}\n fileUploaded={fileUploaded}\n isSingleSided={!requiresTwoSides}\n />\n );\n }\n }\n return null;\n\n case 4:\n return (\n <DocumentProcessing\n documentType={selectedDocumentType}\n onProcessingComplete={handleProcessingComplete}\n fileUploaded={fileUploaded}\n documentTypeId={selectedDocumentType}\n retryCount={retryCount}\n nodeId={node.id}\n />\n );\n case 5:\n return (\n <DocumentSuccess\n documentType={selectedDocumentType}\n documentTypeLabel={t(allowedDocumentTypes.find((dt) => dt.id === selectedDocumentType)?.name || \"\")}\n onContinue={handleSuccessContinue}\n errorCode={errorCode || undefined}\n successDetails={{\n nextSteps: {\n title: t(\"success.next_steps\", \"Prochaines étapes\"),\n description: t(\n \"success.next_steps_description\",\n \"Vous pouvez maintenant continuer le processus de vérification en suivant les instructions à l'écran.\"\n ),\n },\n }}\n />\n );\n case 6:\n return (\n <DocumentError\n documentType={selectedDocumentType}\n onRetry={handleRetryFromError}\n onContinueAnyway={\n node.allowContinueOnFailure === false\n ? undefined\n : handleContinueAnyway\n }\n retryCount={retryCount}\n predictions={analysisData || undefined}\n errorCode={errorCode || undefined}\n allowResubmission={allowResubmission}\n maxResubmissionAttempts={maxResubmissionAttempts}\n isRetryAllowed={isRetryAllowed()}\n blockContinue={blockContinue}\n />\n );\n\n default:\n console.error(`Invalid document collection step: ${currentStep} `);\n return (\n <div className=\"flex flex-col items-center justify-center h-full p-4 text-center\">\n <div className=\"text-red-500 text-4xl mb-4\">⚠️</div>\n <h2 className=\"text-xl font-bold text-red-600 mb-2\">\n {t(\"document_collection.navigation_error.title\", \"Erreur de navigation\")}\n </h2>\n <p className=\"text-gray-600 mb-4\">\n {t(\"document_collection.navigation_error.description\", \"Étape non valide. Veuillez recommencer.\")}\n </p>\n <ButtonDesktop\n type=\"back\"\n className=\"w-full\"\n onClick={() => setCurrentStep(0)}\n >\n {t(\"document_collection.navigation_error.back\", \"Retour au début\")}\n </ButtonDesktop>\n </div>\n );\n }\n};\n\nexport default DocumentCollection;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwFA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACH,IAAM,kBAAkB,GAAG,UAAC,EAYF,EAAA;;AAXxB,IAAA,IAAA,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,cAAc,oBAAA,EACd,oBAAoB,GAAA,EAAA,CAAA,oBAAA,EACpB,oBAAoB,GAAA,EAAA,CAAA,oBAAA,EACpB,gBAAgB,GAAA,EAAA,CAAA,gBAAA,EAChB,iBAAiB,GAAA,EAAA,CAAA,iBAAA,EACjB,iBAAiB,GAAA,EAAA,CAAA,iBAAA,EACjB,uBAAuB,GAAA,EAAA,CAAA,uBAAA;AAEf,IAAA,IAAA,CAAC,GAAK,OAAO,EAAE,EAAd;AACD,IAAA,IAAA,OAAO,GAAK,UAAU,EAAE,QAAjB;IAET,IAAA,EAAA,GAAgC,QAAQ,CAAC,CAAA,gBAAgB,KAAA,IAAA,IAAhB,gBAAgB,KAAA,MAAA,GAAA,MAAA,GAAhB,gBAAgB,CAAE,KAAK,IAAG,CAAC,GAAG,CAA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AAGN,QAAA;AACE,YAAA,OAAO,CAAC,KAAK,CAAC,4CAAqC,WAAW,EAAA,GAAA,CAAG,CAAC;AAClE,YAAA,QACEC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kEAAkE,EAAA,QAAA,EAAA,CAC/ED,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4BAA4B,EAAA,QAAA,EAAA,cAAA,EAAA,CAAS,EACpDA,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,qCAAqC,EAAA,QAAA,EAChD,CAAC,CAAC,4CAA4C,EAAE,sBAAsB,CAAC,EAAA,CACrE,EACLA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,oBAAoB,EAAA,QAAA,EAC9B,CAAC,CAAC,kDAAkD,EAAE,yCAAyC,CAAC,EAAA,CAC/F,EACJA,GAAA,CAAC,aAAa,IACZ,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAE,YAAA,EAAM,OAAA,cAAc,CAAC,CAAC,CAAC,CAAA,CAAjB,CAAiB,EAAA,QAAA,EAE/B,CAAC,CAAC,2CAA2C,EAAE,iBAAiB,CAAC,EAAA,CACpD,CAAA,EAAA,CACZ;;AAGd;;;;"}
1
+ {"version":3,"file":"DocumentCollection.js","sources":["../../../../../src/components/document-collection/DocumentCollection.tsx"],"sourcesContent":["import { useState, useEffect } from \"react\";\nimport {\n SessionTemplate,\n SessionTemplateNode,\n stepObject,\n} from \"../../types/session\";\nimport type { onUploadFiles } from \"../../types/uploadFiles\";\nimport type { Prediction } from \"../../utils/apiAnalysis\";\nimport DocumentCollectionIntroduction from \"./DocumentCollectionIntroduction\";\nimport DocumentCollectionSelection from \"./DocumentCollectionSelection\";\nimport DocumentCollectionUpload from \"./DocumentCollectionUpload\";\nimport DocumentCollectionMethodSelection from \"./DocumentCollectionMethodSelection\";\nimport { DocumentError, DocumentProcessing, DocumentSuccess } from \".\";\nimport JDIProcessing from \"../jdi/JDIProcessing\";\nimport JDISuccess from \"../jdi/JDISuccess\";\nimport JDIError from \"../jdi/JDIError\";\nimport BeforePhoto from \"../id-check/BeforePhoto\";\nimport BeforeVersoPhoto from \"../id-check/BeforeVersoPhoto\";\nimport Photo from \"../id-check/Photo\";\nimport PhotoPreview from \"../id-check/PhotoPreview\";\nimport PhotoConfirmation from \"../id-check/PhotoConfirmation\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport ButtonDesktop from \"../ui/ButtonDesktop\";\nimport { updateSessionCurrentStep } from \"../../services/sessionService\";\nimport { analyzeFiles } from \"../../services/analysis\";\nimport {\n getNodeRetryCount,\n incrementNodeRetryCount,\n} from \"../../services/retryService\";\nimport { getSession } from \"../../context/SessionContext\";\nimport {\n resizeAfterCapture,\n dataUrlToBlob,\n blobToDataUrl,\n} from \"../../utils/imageProcessing\";\n\nexport type DocumentTypeSide = \"ONE_FILE\" | \"RECTO_VERSO\";\n\nexport interface NodeDocumentCollection {\n id: string;\n allowedDocumentTypes: Array<{\n name: string;\n id: string;\n collectOnly?: boolean;\n }>;\n allowedAddingMethods: Array<'download' | 'picture'>;\n introductionPage: {\n title: string;\n description: string;\n };\n documentSelection: {\n title: string;\n description: string;\n };\n allowResubmission: boolean;\n maxResubmissionAttempts?: number;\n /** Paramétrable par nœud dans le journey builder. Absent/true = comportement\n * actuel inchangé (bouton \"Continuer quand même\" proposé) ; false = masqué. */\n allowContinueOnFailure?: boolean;\n}\n\ninterface AllowedDocumentType {\n id: string;\n name: string;\n side?: DocumentTypeSide;\n collectOnly?: boolean;\n}\n\ninterface DocumentCollectionProps {\n stepObject: stepObject;\n sessionId: string;\n node: NodeDocumentCollection;\n onContinueOnPC?: () => void;\n allowedDocumentTypes: AllowedDocumentType[];\n allowedAddingMethods: string[];\n template?: SessionTemplate;\n introductionPage?: {\n title?: string;\n description?: string;\n };\n documentSelection?: {\n title?: string;\n description?: string;\n };\n allowResubmission?: boolean;\n maxResubmissionAttempts?: number;\n}\n\n/**\n * DocumentCollection component manages the multi-step document collection flow.\n * It handles document type selection, document upload, processing, and error/success handling.\n *\n * @component\n * @param {Object} props - Component props.\n * @param {stepObject} props.stepObject - Object managing the current step in the parent flow, with setStep and step properties.\n * @param {string} props.sessionId - Unique identifier for the current session.\n * @param {NodeDocumentCollection} props.node - Node configuration containing allowed document types and page content.\n * @param {() => void} [props.onContinueOnPC] - Optional callback to continue the process on a PC.\n * @param {AllowedDocumentType[]} props.allowedDocumentTypes - List of document types accepted for collection.\n * @param {string[]} props.allowedAddingMethods - List of allowed methods for adding documents (download, picture, etc.).\n * @param {Object} [props.introductionPage] - Optional introduction page configuration with title and description.\n * @param {Object} [props.documentSelection] - Optional document selection page configuration with title and description.\n *\n * @returns {JSX.Element} Multi-step document collection UI, rendering different subcomponents based on the current step.\n *\n * @remarks\n * - Manages internal state for step navigation, document selection, file uploads, and error handling.\n * - Displays error messages and fallback UI for invalid navigation.\n * - Uses translation hooks for internationalization support.\n */\nconst DocumentCollection = ({\n stepObject,\n sessionId,\n node,\n template,\n onContinueOnPC,\n allowedDocumentTypes,\n allowedAddingMethods,\n introductionPage,\n documentSelection,\n allowResubmission,\n maxResubmissionAttempts,\n}: DocumentCollectionProps) => {\n const { t } = useI18n();\n const { session } = getSession();\n\n const [currentStep, setCurrentStep] = useState(introductionPage?.title ? 0 : 1);\n const [fileUploaded, setFileUploaded] = useState<onUploadFiles | null>(null);\n const [selectedDocumentType, setSelectedDocumentType] = useState<string>(\"\");\n const [analysisData, setAnalysisData] = useState<Prediction[] | null>(null);\n const [errorCode, setErrorCode] = useState<string | null>(null);\n const [blockContinue, setBlockContinue] = useState(false);\n const [selectedMethod, setSelectedMethod] = useState<\"download\" | \"picture\" | null>(null);\n const [photoSubStep, setPhotoSubStep] = useState<\"before-recto\" | \"recto\" | \"preview-recto\" | \"before-verso\" | \"verso\" | \"preview-verso\" | \"confirmation\">(\"before-recto\");\n const [capturedImages, setCapturedImages] = useState<Record<string, string>>({});\n\n // Initialize retry count from session data\n const [retryCount, setRetryCount] = useState(() => {\n return getNodeRetryCount(session, node.id);\n });\n\n // Update retry count when session loads/changes\n useEffect(() => {\n if (session) {\n const sessionRetryCount = getNodeRetryCount(session, node.id);\n setRetryCount(sessionRetryCount);\n }\n }, [session, node.id]);\n\n // Check retry limits on mount/reload - if retries exhausted, show error page\n useEffect(() => {\n // Special case: if allowResubmission is false and retryCount > 0, show error immediately\n if (allowResubmission === false && retryCount > 0) {\n setCurrentStep(6);\n return;\n }\n\n // Normal case: check against maxResubmissionAttempts\n if (retryCount > 0 && !isRetryAllowed()) {\n // User has exhausted retries, redirect to error page\n setCurrentStep(6);\n }\n }, [retryCount, allowResubmission]);\n\n const handleContinueFromIntroduction = () => {\n setCurrentStep(1);\n };\n\n const handleDocumentTypeSelect = (docType: string, files?: onUploadFiles) => {\n setSelectedDocumentType(docType);\n\n if (files) {\n handleDocumentUpload(files);\n return;\n }\n\n const isPictureAllowed = allowedAddingMethods.includes(\"picture\");\n const isDownloadAllowed = allowedAddingMethods.includes(\"download\");\n\n if (isPictureAllowed && isDownloadAllowed) {\n setCurrentStep(2); // Method selection\n } else {\n const method = isPictureAllowed ? \"picture\" : \"download\";\n handleMethodSelect(method);\n }\n };\n\n const handleMethodSelect = (method: \"download\" | \"picture\") => {\n setSelectedMethod(method);\n if (method === \"picture\") {\n setPhotoSubStep(\"before-recto\");\n setCapturedImages({});\n }\n setCurrentStep(3); // Go to action (Upload screen or Photo flow)\n };\n\n const handlePhotoCapture = async (imageData: string, side: \"recto\" | \"verso\") => {\n try {\n const imageBlob = dataUrlToBlob(imageData);\n const processedBlob = await resizeAfterCapture(imageBlob);\n const processedDataUrl = await blobToDataUrl(processedBlob);\n setCapturedImages((prev) => ({ ...prev, [side]: processedDataUrl }));\n } catch (error) {\n console.error(`[DocumentCollection] Failed to process photo for ${side}:`, error);\n setCapturedImages((prev) => ({ ...prev, [side]: imageData }));\n }\n setPhotoSubStep(side === \"recto\" ? \"preview-recto\" : \"preview-verso\");\n };\n\n const handlePhotoConfirmation = () => {\n if (capturedImages.recto) {\n const files: onUploadFiles = {\n front: capturedImages.recto,\n back: capturedImages.verso || null,\n };\n setFileUploaded(files);\n setCurrentStep(4);\n }\n };\n\n const handleDocumentUpload = (files: onUploadFiles) => {\n setFileUploaded(files);\n\n // Check if the selected document type is collectOnly — skip processing step\n const selectedDoc = allowedDocumentTypes.find((d) => d.id === selectedDocumentType);\n if (selectedDoc?.collectOnly) {\n handleCollectOnlyUpload(files);\n return;\n }\n\n // Check if retry limit is reached before processing\n if (!isRetryAllowed() && retryCount > 0) {\n // Skip processing and go directly to error page\n setCurrentStep(6);\n } else {\n // Proceed to processing\n setCurrentStep(4);\n }\n };\n\n const handleProcessingComplete = (\n success: boolean,\n currentRetryCount?: number,\n apiAnalysisData?: Prediction[] | null,\n shouldBlockContinue?: boolean,\n ) => {\n setBlockContinue(shouldBlockContinue === true);\n if (apiAnalysisData) {\n setAnalysisData(apiAnalysisData);\n if (apiAnalysisData.length > 0) {\n setErrorCode(apiAnalysisData[0].code);\n }\n }\n\n if (success) {\n // Always follow the graph edges. Arithmetic fallback only when no template is available\n // (out of the normal TemplateNodeRenderer flow).\n if (template) {\n stepObject.goToNextStep(node.id, template);\n } else {\n stepObject.setStep(stepObject.step + 1);\n }\n setCurrentStep(5);\n } else {\n setRetryCount((prev) => {\n const newCount = prev + 1;\n incrementNodeRetryCount(sessionId, node.id, prev).catch((error) => {\n console.error(\"Failed to update retry count in session:\", error);\n });\n return newCount;\n });\n setCurrentStep(6);\n }\n };\n\n const handleCollectOnlyUpload = async (files: onUploadFiles) => {\n try {\n await analyzeFiles(sessionId, node.id, files, selectedDocumentType, {\n documentTypeKey: selectedDocumentType,\n collectOnly: true,\n enablePolling: false,\n });\n handleProcessingComplete(true, retryCount, null);\n } catch (error) {\n console.error(\"[DocumentCollection] collectOnly upload failed:\", error);\n handleProcessingComplete(false, retryCount, null);\n }\n };\n\n const handleRetryFromError = () => {\n setBlockContinue(false);\n setCurrentStep(1);\n setSelectedMethod(null);\n setCapturedImages({});\n setFileUploaded(null);\n };\n\n // Check if retry is allowed based on configuration\n const isRetryAllowed = () => {\n if (allowResubmission === undefined) return true;\n if (!allowResubmission) return false;\n if (maxResubmissionAttempts !== undefined) {\n return retryCount <= maxResubmissionAttempts;\n }\n return true;\n };\n\n // Node progression must follow the graph edges. `onContinueOnPC` is reserved for the\n // QR / mobile→PC redirection and must NOT drive node progression (it navigates by raw step\n // arithmetic, which breaks when several nodes share the same `order`).\n const handleContinueAnyway = () => {\n if (template) {\n stepObject.goToNextStep(node.id, template);\n } else if (onContinueOnPC) {\n onContinueOnPC();\n } else {\n stepObject.setStep(stepObject.step + 1);\n }\n };\n\n const handleSuccessContinue = () => {\n if (template) {\n stepObject.goToNextStep(node.id, template);\n } else if (onContinueOnPC) {\n onContinueOnPC();\n } else {\n stepObject.setStep(stepObject.step + 1);\n }\n };\n\n const handleBack = () => {\n if (currentStep === 0) {\n // Inter-node back navigation goes through the history-aware goBack(), never raw arithmetic.\n stepObject.goBack();\n } else {\n setCurrentStep(currentStep - 1);\n }\n };\n\n switch (currentStep) {\n case 0:\n return (\n <DocumentCollectionIntroduction\n onContinue={handleContinueFromIntroduction}\n onBack={stepObject.canGoBack ? handleBack : undefined}\n introductionPage={introductionPage}\n />\n );\n case 1:\n return (\n <DocumentCollectionSelection\n onContinue={handleDocumentTypeSelect}\n onBack={handleBack}\n allowedDocumentTypes={allowedDocumentTypes}\n allowedAddingMethods={allowedAddingMethods}\n stepObject={stepObject}\n documentSelection={documentSelection}\n />\n );\n case 2:\n return (\n <DocumentCollectionMethodSelection\n onMethodSelect={handleMethodSelect}\n onBack={handleBack}\n title={documentSelection?.title}\n description={documentSelection?.description}\n />\n );\n case 3:\n if (selectedMethod === \"download\") {\n return (\n <DocumentCollectionUpload\n selectedDocumentType={selectedDocumentType}\n allowedDocumentTypes={allowedDocumentTypes}\n onUpload={handleDocumentUpload}\n onBack={handleBack}\n documentSelection={documentSelection}\n sessionId={sessionId}\n />\n );\n } else {\n // Photo flow\n const requiresTwoSides = allowedDocumentTypes.find((dt) => dt.id === selectedDocumentType)?.side === \"RECTO_VERSO\";\n\n switch (photoSubStep) {\n case \"before-recto\":\n return <BeforePhoto setStep={() => setPhotoSubStep(\"recto\")} isSingleSided={!requiresTwoSides} onBack={handleBack} />;\n case \"recto\":\n return <Photo onCapture={(img) => handlePhotoCapture(img, \"recto\")} automaticCapture={false} maskType=\"document\" />;\n case \"preview-recto\":\n return (\n <PhotoPreview\n imageUrl={capturedImages.recto}\n side=\"recto\"\n isSingleSided={!requiresTwoSides}\n onValidate={() => setPhotoSubStep(requiresTwoSides ? \"before-verso\" : \"confirmation\")}\n onRetake={() => {\n setCapturedImages((prev) => { const next = { ...prev }; delete next.recto; return next; });\n setPhotoSubStep(\"recto\");\n }}\n />\n );\n case \"before-verso\":\n return <BeforeVersoPhoto setStep={() => setPhotoSubStep(\"verso\")} />;\n case \"verso\":\n return <Photo onCapture={(img) => handlePhotoCapture(img, \"verso\")} automaticCapture={false} maskType=\"document\" />;\n case \"preview-verso\":\n return (\n <PhotoPreview\n imageUrl={capturedImages.verso}\n side=\"verso\"\n onValidate={() => setPhotoSubStep(\"confirmation\")}\n onRetake={() => {\n setCapturedImages((prev) => { const next = { ...prev }; delete next.verso; return next; });\n setPhotoSubStep(\"verso\");\n }}\n />\n );\n case \"confirmation\":\n return (\n <PhotoConfirmation\n imageUrl={capturedImages.recto}\n versoImageUrl={capturedImages.verso}\n requiresTwoSides={requiresTwoSides}\n onConfirm={handlePhotoConfirmation}\n onRetry={() => {\n setPhotoSubStep(\"before-recto\");\n setCapturedImages({});\n }}\n onRetryAfterProcessing={() => {\n setCurrentStep(1);\n setPhotoSubStep(\"before-recto\");\n setCapturedImages({});\n }}\n fileUploaded={fileUploaded}\n isSingleSided={!requiresTwoSides}\n />\n );\n }\n }\n return null;\n\n case 4:\n return (\n <DocumentProcessing\n documentType={selectedDocumentType}\n onProcessingComplete={handleProcessingComplete}\n fileUploaded={fileUploaded}\n documentTypeId={selectedDocumentType}\n retryCount={retryCount}\n nodeId={node.id}\n />\n );\n case 5:\n return (\n <DocumentSuccess\n documentType={selectedDocumentType}\n documentTypeLabel={t(allowedDocumentTypes.find((dt) => dt.id === selectedDocumentType)?.name || \"\")}\n onContinue={handleSuccessContinue}\n errorCode={errorCode || undefined}\n successDetails={{\n nextSteps: {\n title: t(\"success.next_steps\", \"Prochaines étapes\"),\n description: t(\n \"success.next_steps_description\",\n \"Vous pouvez maintenant continuer le processus de vérification en suivant les instructions à l'écran.\"\n ),\n },\n }}\n />\n );\n case 6:\n return (\n <DocumentError\n documentType={selectedDocumentType}\n onRetry={handleRetryFromError}\n onContinueAnyway={\n node.allowContinueOnFailure === false\n ? undefined\n : handleContinueAnyway\n }\n retryCount={retryCount}\n predictions={analysisData || undefined}\n errorCode={errorCode || undefined}\n allowResubmission={allowResubmission}\n maxResubmissionAttempts={maxResubmissionAttempts}\n isRetryAllowed={isRetryAllowed()}\n blockContinue={blockContinue}\n />\n );\n\n default:\n console.error(`Invalid document collection step: ${currentStep} `);\n return (\n <div className=\"flex flex-col items-center justify-center h-full p-4 text-center\">\n <div className=\"text-red-500 text-4xl mb-4\">⚠️</div>\n <h2 className=\"text-xl font-bold text-red-600 mb-2\">\n {t(\"document_collection.navigation_error.title\", \"Erreur de navigation\")}\n </h2>\n <p className=\"text-gray-600 mb-4\">\n {t(\"document_collection.navigation_error.description\", \"Étape non valide. Veuillez recommencer.\")}\n </p>\n <ButtonDesktop\n type=\"back\"\n className=\"w-full\"\n onClick={() => setCurrentStep(0)}\n >\n {t(\"document_collection.navigation_error.back\", \"Retour au début\")}\n </ButtonDesktop>\n </div>\n );\n }\n};\n\nexport default DocumentCollection;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwFA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACH,IAAM,kBAAkB,GAAG,UAAC,EAYF,EAAA;;AAXxB,IAAA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,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAE,YAAA,EAAM,OAAA,cAAc,CAAC,CAAC,CAAC,CAAA,CAAjB,CAAiB,EAAA,QAAA,EAE/B,CAAC,CAAC,2CAA2C,EAAE,iBAAiB,CAAC,EAAA,CACpD,CAAA,EAAA,CACZ;;AAGd;;;;"}
@@ -19,7 +19,7 @@ var DocumentCollectionIntroduction = function (_a) {
19
19
  t("document_upload.selection_title");
20
20
  var description = (introductionPage === null || introductionPage === void 0 ? void 0 : introductionPage.description) ||
21
21
  t("document_upload.selection_description");
22
- return (jsx(MobilePageLayout, { footer: jsx(PageActions, { primary: jsx(Button, { onClick: onContinue, children: t("buttons.continue") }), secondary: jsx(Button, { variant: "secondary", onClick: onBack, children: t("buttons.back") }) }), children: jsx("div", { className: "px-4 py-6 md:px-8 md:py-8", children: jsxs("div", { className: "w-full max-w-md mx-auto space-y-6", children: [jsxs("div", { className: "text-center space-y-4", children: [jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl", children: title }), jsx(Subtitle, { className: "text-sm md:text-base text-gray-600 leading-relaxed whitespace-pre-line", children: description })] }), jsx("div", { className: "flex justify-center py-6", children: jsx("img", { src: beforeDocumentIcon, alt: t("document_upload.selection_title"), className: "max-w-full h-auto object-contain max-h-[25vh]" }) }), jsx("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: jsxs("div", { className: "flex", children: [jsx("div", { className: "flex-shrink-0", children: jsx("svg", { className: "h-5 w-5 text-blue-400", fill: "currentColor", viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }) }), jsxs("div", { className: "ml-3", children: [jsx("h3", { className: "text-sm font-medium text-blue-800", children: t("jdi.document_selection.info_title") }), jsx("div", { className: "mt-2 text-sm text-blue-700", children: jsxs("ul", { className: "list-disc pl-5 space-y-1", children: [jsx("li", { children: t("jdi.document_upload.info_point1") }), jsx("li", { children: t("jdi.document_upload.accepted_formats") }), jsxs("li", { children: [t("jdi.document_upload.max_size_label"), " ", t("jdi.document_upload.max_size")] })] }) })] })] }) })] }) }) }));
22
+ return (jsx(MobilePageLayout, { footer: jsx(PageActions, { primary: jsx(Button, { onClick: onContinue, children: t("buttons.continue") }), secondary: onBack ? (jsx(Button, { variant: "secondary", onClick: onBack, children: t("buttons.back") })) : undefined }), children: jsx("div", { className: "px-4 py-6 md:px-8 md:py-8", children: jsxs("div", { className: "w-full max-w-md mx-auto space-y-6", children: [jsxs("div", { className: "text-center space-y-4", children: [jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl", children: title }), jsx(Subtitle, { className: "text-sm md:text-base text-gray-600 leading-relaxed whitespace-pre-line", children: description })] }), jsx("div", { className: "flex justify-center py-6", children: jsx("img", { src: beforeDocumentIcon, alt: t("document_upload.selection_title"), className: "max-w-full h-auto object-contain max-h-[25vh]" }) }), jsx("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: jsxs("div", { className: "flex", children: [jsx("div", { className: "flex-shrink-0", children: jsx("svg", { className: "h-5 w-5 text-blue-400", fill: "currentColor", viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }) }), jsxs("div", { className: "ml-3", children: [jsx("h3", { className: "text-sm font-medium text-blue-800", children: t("jdi.document_selection.info_title") }), jsx("div", { className: "mt-2 text-sm text-blue-700", children: jsxs("ul", { className: "list-disc pl-5 space-y-1", children: [jsx("li", { children: t("jdi.document_upload.info_point1") }), jsx("li", { children: t("jdi.document_upload.accepted_formats") }), jsxs("li", { children: [t("jdi.document_upload.max_size_label"), " ", t("jdi.document_upload.max_size")] })] }) })] })] }) })] }) }) }));
23
23
  };
24
24
 
25
25
  export { DocumentCollectionIntroduction as default };
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentCollectionIntroduction.js","sources":["../../../../../src/components/document-collection/DocumentCollectionIntroduction.tsx"],"sourcesContent":["import Title from \"../ui/Title\";\nimport Subtitle from \"../ui/Subtitle\";\nimport Button from \"../ui/Button\";\nimport PageActions from \"../ui/PageActions\";\nimport { beforeDocumentIcon } from \"../../assets\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport MobilePageLayout from \"../ui/MobilePageLayout\";\n\ninterface DocumentCollectionIntroductionProps {\n onContinue: () => void;\n onBack: () => void;\n introductionPage?: {\n title?: string;\n description?: string;\n };\n}\n\nconst DocumentCollectionIntroduction = ({\n onContinue,\n onBack,\n introductionPage,\n}: DocumentCollectionIntroductionProps) => {\n // Use provided values or fallback to defaults (use i18n keys)\n const { t } = useI18n();\n const title =\n introductionPage?.title ||\n t(\"document_upload.selection_title\");\n const description =\n introductionPage?.description ||\n t(\"document_upload.selection_description\");\n\n return (\n <MobilePageLayout\n footer={\n <PageActions\n primary={\n <Button onClick={onContinue}>\n {t(\"buttons.continue\")}\n </Button>\n }\n secondary={\n <Button variant=\"secondary\" onClick={onBack}>\n {t(\"buttons.back\")}\n </Button>\n }\n />\n }\n >\n <div className=\"px-4 py-6 md:px-8 md:py-8\">\n <div className=\"w-full max-w-md mx-auto space-y-6\">\n {/* Header */}\n <div className=\"text-center space-y-4\">\n <Title className=\"text-xl md:text-2xl lg:text-3xl\">{title}</Title>\n <Subtitle className=\"text-sm md:text-base text-gray-600 leading-relaxed whitespace-pre-line\">\n {description}\n </Subtitle>\n </div>\n\n {/* Document collection illustration */}\n <div className=\"flex justify-center py-6\">\n <img\n src={beforeDocumentIcon}\n alt={t(\"document_upload.selection_title\")}\n className=\"max-w-full h-auto object-contain max-h-[25vh]\"\n />\n </div>\n\n {/* Information box */}\n <div className=\"bg-blue-50 border border-blue-200 rounded-lg p-4\">\n <div className=\"flex\">\n <div className=\"flex-shrink-0\">\n <svg\n className=\"h-5 w-5 text-blue-400\"\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\"\n clipRule=\"evenodd\"\n />\n </svg>\n </div>\n <div className=\"ml-3\">\n <h3 className=\"text-sm font-medium text-blue-800\">\n {t(\"jdi.document_selection.info_title\")}\n </h3>\n <div className=\"mt-2 text-sm text-blue-700\">\n <ul className=\"list-disc pl-5 space-y-1\">\n <li>{t(\"jdi.document_upload.info_point1\")}</li>\n <li>{t(\"jdi.document_upload.accepted_formats\")}</li>\n <li>{t(\"jdi.document_upload.max_size_label\")} {t(\"jdi.document_upload.max_size\")}</li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </MobilePageLayout>\n );\n};\n\nexport default DocumentCollectionIntroduction;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;AAiBA,IAAM,8BAA8B,GAAG,UAAC,EAIF,EAAA;AAHpC,IAAA,IAAA,UAAU,gBAAA,EACV,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,gBAAgB,GAAA,EAAA,CAAA,gBAAA;;AAGR,IAAA,IAAA,CAAC,GAAK,OAAO,EAAE,EAAd;IACT,IAAM,KAAK,GACT,CAAA,gBAAgB,aAAhB,gBAAgB,KAAA,MAAA,GAAA,MAAA,GAAhB,gBAAgB,CAAE,KAAK;QACvB,CAAC,CAAC,iCAAiC,CAAC;IACtC,IAAM,WAAW,GACf,CAAA,gBAA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BAAuB,EACjC,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,4BAA4B,EAAA,QAAA,EAElCA,cACE,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,kIAAkI,EACpI,QAAQ,EAAC,SAAS,EAAA,CAClB,EAAA,CACE,EAAA,CACF,EACNC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,MAAM,EAAA,QAAA,EAAA,CACnBD,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,mCAAmC,EAAA,QAAA,EAC9C,CAAC,CAAC,mCAAmC,CAAC,GACpC,EACLA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4BAA4B,EAAA,QAAA,EACzCC,aAAI,SAAS,EAAC,0BAA0B,EAAA,QAAA,EAAA,CACtCD,GAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EAAK,CAAC,CAAC,iCAAiC,CAAC,EAAA,CAAM,EAC/CA,GAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EAAK,CAAC,CAAC,sCAAsC,CAAC,GAAM,EACpDC,IAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EAAA,CAAK,CAAC,CAAC,oCAAoC,CAAC,EAAA,GAAA,EAAG,CAAC,CAAC,8BAA8B,CAAC,CAAA,EAAA,CAAM,CAAA,EAAA,CACnF,EAAA,CACD,CAAA,EAAA,CACF,CAAA,EAAA,CACF,GACF,CAAA,EAAA,CACF,EAAA,CACF,EAAA,CACW;AAEvB;;;;"}
1
+ {"version":3,"file":"DocumentCollectionIntroduction.js","sources":["../../../../../src/components/document-collection/DocumentCollectionIntroduction.tsx"],"sourcesContent":["import Title from \"../ui/Title\";\nimport Subtitle from \"../ui/Subtitle\";\nimport Button from \"../ui/Button\";\nimport PageActions from \"../ui/PageActions\";\nimport { beforeDocumentIcon } from \"../../assets\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport MobilePageLayout from \"../ui/MobilePageLayout\";\n\ninterface DocumentCollectionIntroductionProps {\n onContinue: () => void;\n onBack?: () => void;\n introductionPage?: {\n title?: string;\n description?: string;\n };\n}\n\nconst DocumentCollectionIntroduction = ({\n onContinue,\n onBack,\n introductionPage,\n}: DocumentCollectionIntroductionProps) => {\n // Use provided values or fallback to defaults (use i18n keys)\n const { t } = useI18n();\n const title =\n introductionPage?.title ||\n t(\"document_upload.selection_title\");\n const description =\n introductionPage?.description ||\n t(\"document_upload.selection_description\");\n\n return (\n <MobilePageLayout\n footer={\n <PageActions\n primary={\n <Button onClick={onContinue}>\n {t(\"buttons.continue\")}\n </Button>\n }\n secondary={onBack ? (\n <Button variant=\"secondary\" onClick={onBack}>\n {t(\"buttons.back\")}\n </Button>\n ) : undefined}\n />\n }\n >\n <div className=\"px-4 py-6 md:px-8 md:py-8\">\n <div className=\"w-full max-w-md mx-auto space-y-6\">\n {/* Header */}\n <div className=\"text-center space-y-4\">\n <Title className=\"text-xl md:text-2xl lg:text-3xl\">{title}</Title>\n <Subtitle className=\"text-sm md:text-base text-gray-600 leading-relaxed whitespace-pre-line\">\n {description}\n </Subtitle>\n </div>\n\n {/* Document collection illustration */}\n <div className=\"flex justify-center py-6\">\n <img\n src={beforeDocumentIcon}\n alt={t(\"document_upload.selection_title\")}\n className=\"max-w-full h-auto object-contain max-h-[25vh]\"\n />\n </div>\n\n {/* Information box */}\n <div className=\"bg-blue-50 border border-blue-200 rounded-lg p-4\">\n <div className=\"flex\">\n <div className=\"flex-shrink-0\">\n <svg\n className=\"h-5 w-5 text-blue-400\"\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\"\n clipRule=\"evenodd\"\n />\n </svg>\n </div>\n <div className=\"ml-3\">\n <h3 className=\"text-sm font-medium text-blue-800\">\n {t(\"jdi.document_selection.info_title\")}\n </h3>\n <div className=\"mt-2 text-sm text-blue-700\">\n <ul className=\"list-disc pl-5 space-y-1\">\n <li>{t(\"jdi.document_upload.info_point1\")}</li>\n <li>{t(\"jdi.document_upload.accepted_formats\")}</li>\n <li>{t(\"jdi.document_upload.max_size_label\")} {t(\"jdi.document_upload.max_size\")}</li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </MobilePageLayout>\n );\n};\n\nexport default DocumentCollectionIntroduction;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;AAiBA,IAAM,8BAA8B,GAAG,UAAC,EAIF,EAAA;AAHpC,IAAA,IAAA,UAAU,gBAAA,EACV,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,gBAAgB,GAAA,EAAA,CAAA,gBAAA;;AAGR,IAAA,IAAA,CAAC,GAAK,OAAO,EAAE,EAAd;IACT,IAAM,KAAK,GACT,CAAA,gBAAgB,aAAhB,gBAAgB,KAAA,MAAA,GAAA,MAAA,GAAhB,gBAAgB,CAAE,KAAK;QACvB,CAAC,CAAC,iCAAiC,CAAC;IACtC,IAAM,WAAW,GACf,CAAA,gBAAgB,aAAhB,gBAAgB,KAAA,MAAA,GAAA,MAAA,GAAhB,gBAAgB,CAAE,WAAW;QAC7B,CAAC,CAAC,uCAAuC,CAAC;IAE5C,QACEA,GAAA,CAAC,gBAAgB,EAAA,EACf,MAAM,EACJA,GAAA,CAAC,WAAW,EAAA,EACV,OAAO,EACLA,GAAA,CAAC,MAAM,EAAA,EAAC,OAAO,EAAE,UAAU,EAAA,QAAA,EACxB,CAAC,CAAC,kBAAkB,CAAC,EAAA,CACf,EAEX,SAAS,EAAE,MAAM,IACfA,GAAA,CAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,MAAM,EAAA,QAAA,EACxC,CAAC,CAAC,cAAc,CAAC,EAAA,CACX,IACP,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C,EACLA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4BAA4B,EAAA,QAAA,EACzCC,IAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,0BAA0B,EAAA,QAAA,EAAA,CACtCD,sBAAK,CAAC,CAAC,iCAAiC,CAAC,EAAA,CAAM,EAC/CA,sBAAK,CAAC,CAAC,sCAAsC,CAAC,EAAA,CAAM,EACpDC,wBAAK,CAAC,CAAC,oCAAoC,CAAC,EAAA,GAAA,EAAG,CAAC,CAAC,8BAA8B,CAAC,CAAA,EAAA,CAAM,CAAA,EAAA,CACnF,EAAA,CACD,CAAA,EAAA,CACF,CAAA,EAAA,CACF,EAAA,CACF,CAAA,EAAA,CACF,EAAA,CACF,EAAA,CACW;AAEvB;;;;"}
@@ -10,7 +10,7 @@ import MobilePageLayout from '../ui/MobilePageLayout.js';
10
10
  var DocumentCollectionMethodSelection = function (_a) {
11
11
  var onMethodSelect = _a.onMethodSelect, onBack = _a.onBack, title = _a.title, description = _a.description;
12
12
  var t = useI18n().t;
13
- return (jsx(MobilePageLayout, { footer: jsx(PageActions, { primary: jsx(Button, { variant: "secondary", onClick: onBack, children: t("buttons.back", "Retour") }) }), children: jsx("div", { className: "px-4 py-6 pt-11 md:px-8 md:py-8", children: jsxs("div", { className: "w-full max-w-md mx-auto space-y-6", children: [jsxs("div", { className: "text-center space-y-4", children: [jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl", children: title || t("document_check.method_selection.title", "Choisissez une méthode") }), jsx(Subtitle, { className: "text-sm text-gray-600 leading-relaxed", children: description || t("document_check.method_selection.subtitle", "Comment souhaitez-vous ajouter votre document ?") })] }), jsxs("div", { className: "grid gap-4", children: [jsxs("button", { onClick: function () { return onMethodSelect("picture"); }, className: "flex items-center p-4 bg-white border-2 border-gray-100 rounded-xl hover:border-teal-500 transition-colors text-left group", children: [jsx("div", { className: "w-12 h-12 bg-teal-50 rounded-lg flex items-center justify-center text-teal-600 group-hover:bg-teal-100 transition-colors mr-4", children: jsx(Camera, { size: 24 }) }), jsxs("div", { children: [jsx("p", { className: "font-semibold text-gray-900", children: t("document_check.method_selection.picture_title", "Prendre une photo") }), jsx("p", { className: "text-sm text-gray-500", children: t("document_check.method_selection.picture_desc", "Utilisez l'appareil photo de votre appareil") })] })] }), jsxs("button", { onClick: function () { return onMethodSelect("download"); }, className: "flex items-center p-4 bg-white border-2 border-gray-100 rounded-xl hover:border-teal-500 transition-colors text-left group", children: [jsx("div", { className: "w-12 h-12 bg-teal-50 rounded-lg flex items-center justify-center text-teal-600 group-hover:bg-teal-100 transition-colors mr-4", children: jsx(Upload, { size: 24 }) }), jsxs("div", { children: [jsx("p", { className: "font-semibold text-gray-900", children: t("document_check.method_selection.download_title", "Téléverser un fichier") }), jsx("p", { className: "text-sm text-gray-500", children: t("document_check.method_selection.download_desc", "Sélectionnez un fichier sur votre appareil") })] })] })] })] }) }) }));
13
+ return (jsx(MobilePageLayout, { footer: jsx(PageActions, { primary: onBack ? (jsx(Button, { variant: "secondary", onClick: onBack, children: t("buttons.back", "Retour") })) : undefined }), children: jsx("div", { className: "px-4 py-6 pt-11 md:px-8 md:py-8", children: jsxs("div", { className: "w-full max-w-md mx-auto space-y-6", children: [jsxs("div", { className: "text-center space-y-4", children: [jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl", children: title || t("document_check.method_selection.title", "Choisissez une méthode") }), jsx(Subtitle, { className: "text-sm text-gray-600 leading-relaxed", children: description || t("document_check.method_selection.subtitle", "Comment souhaitez-vous ajouter votre document ?") })] }), jsxs("div", { className: "grid gap-4", children: [jsxs("button", { onClick: function () { return onMethodSelect("picture"); }, className: "flex items-center p-4 bg-white border-2 border-gray-100 rounded-xl hover:border-teal-500 transition-colors text-left group", children: [jsx("div", { className: "w-12 h-12 bg-teal-50 rounded-lg flex items-center justify-center text-teal-600 group-hover:bg-teal-100 transition-colors mr-4", children: jsx(Camera, { size: 24 }) }), jsxs("div", { children: [jsx("p", { className: "font-semibold text-gray-900", children: t("document_check.method_selection.picture_title", "Prendre une photo") }), jsx("p", { className: "text-sm text-gray-500", children: t("document_check.method_selection.picture_desc", "Utilisez l'appareil photo de votre appareil") })] })] }), jsxs("button", { onClick: function () { return onMethodSelect("download"); }, className: "flex items-center p-4 bg-white border-2 border-gray-100 rounded-xl hover:border-teal-500 transition-colors text-left group", children: [jsx("div", { className: "w-12 h-12 bg-teal-50 rounded-lg flex items-center justify-center text-teal-600 group-hover:bg-teal-100 transition-colors mr-4", children: jsx(Upload, { size: 24 }) }), jsxs("div", { children: [jsx("p", { className: "font-semibold text-gray-900", children: t("document_check.method_selection.download_title", "Téléverser un fichier") }), jsx("p", { className: "text-sm text-gray-500", children: t("document_check.method_selection.download_desc", "Sélectionnez un fichier sur votre appareil") })] })] })] })] }) }) }));
14
14
  };
15
15
 
16
16
  export { DocumentCollectionMethodSelection as default };