datakeen-session-react 1.1.194-rc.6 → 1.1.195-dev.1
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.
- package/dist/cjs/components/start-flow/Start.js +1 -0
- package/dist/cjs/components/start-flow/Start.js.map +1 -1
- package/dist/cjs/components/template/ComplementaryMandateNodeHandler.js +36 -0
- package/dist/cjs/components/template/ComplementaryMandateNodeHandler.js.map +1 -0
- package/dist/cjs/components/template/TemplateNodeRenderer.js +3 -0
- package/dist/cjs/components/template/TemplateNodeRenderer.js.map +1 -1
- package/dist/cjs/hooks/useSessionData.js +10 -5
- package/dist/cjs/hooks/useSessionData.js.map +1 -1
- package/dist/cjs/hooks/useStepNavigation.js +1 -1
- package/dist/cjs/hooks/useStepNavigation.js.map +1 -1
- package/dist/cjs/hooks/useUserInputForm.js +27 -6
- package/dist/cjs/hooks/useUserInputForm.js.map +1 -1
- package/dist/cjs/i18n/en.json.js +22 -1
- package/dist/cjs/i18n/en.json.js.map +1 -1
- package/dist/cjs/i18n/es.json.js +22 -1
- package/dist/cjs/i18n/es.json.js.map +1 -1
- package/dist/cjs/i18n/fr.json.js +22 -1
- package/dist/cjs/i18n/fr.json.js.map +1 -1
- package/dist/cjs/services/sessionService.js +33 -6
- package/dist/cjs/services/sessionService.js.map +1 -1
- package/dist/cjs/types/session.js.map +1 -1
- package/dist/cjs/utils/customFieldValidation.js +44 -1
- package/dist/cjs/utils/customFieldValidation.js.map +1 -1
- package/dist/esm/components/start-flow/Start.js +1 -0
- package/dist/esm/components/start-flow/Start.js.map +1 -1
- package/dist/esm/components/template/ComplementaryMandateNodeHandler.js +32 -0
- package/dist/esm/components/template/ComplementaryMandateNodeHandler.js.map +1 -0
- package/dist/esm/components/template/TemplateNodeRenderer.js +3 -0
- package/dist/esm/components/template/TemplateNodeRenderer.js.map +1 -1
- package/dist/esm/hooks/useSessionData.js +10 -5
- package/dist/esm/hooks/useSessionData.js.map +1 -1
- package/dist/esm/hooks/useStepNavigation.js +1 -1
- package/dist/esm/hooks/useStepNavigation.js.map +1 -1
- package/dist/esm/hooks/useUserInputForm.js +28 -7
- package/dist/esm/hooks/useUserInputForm.js.map +1 -1
- package/dist/esm/i18n/en.json.js +22 -2
- package/dist/esm/i18n/en.json.js.map +1 -1
- package/dist/esm/i18n/es.json.js +22 -2
- package/dist/esm/i18n/es.json.js.map +1 -1
- package/dist/esm/i18n/fr.json.js +22 -2
- package/dist/esm/i18n/fr.json.js.map +1 -1
- package/dist/esm/services/sessionService.js +33 -7
- package/dist/esm/services/sessionService.js.map +1 -1
- package/dist/esm/types/session.js.map +1 -1
- package/dist/esm/utils/customFieldValidation.js +44 -2
- package/dist/esm/utils/customFieldValidation.js.map +1 -1
- package/docs/COMPLEMENTARY_MANDATE.md +22 -0
- package/docs/JOURNEY_NODE_BUILDER.md +15 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionService.js","sources":["../../../../src/services/sessionService.ts"],"sourcesContent":["/**\n * Session Service\n *\n * Service for interacting with the Datakeen Session API.\n * Handles fetching session data by ID.\n */\n\nimport type {\n ClientInfo,\n SessionData,\n SessionTemplate,\n SessionTemplateNode,\n} from \"../types/session\";\nimport { apiService } from \"./api\";\nimport { logStatusModified } from \"./auditTrailService\";\nimport { clearSessionMemory } from \"./sessionMemoryStore\";\n\n/**\n * Fetches session data by ID from the Datakeen backend\n *\n * @param sessionId - The unique identifier of the session\n * @returns The session data\n */\nexport const fetchSessionById = async (\n sessionId: string,\n): Promise<SessionData> => {\n try {\n const response = await apiService.get(`/session/sdk/${sessionId}`);\n return response.data;\n } catch (error) {\n console.error(\"Error fetching session data:\", error);\n throw error;\n }\n};\n\n/** Sends client information (IP, device, browser, OS) to the backend for a specific session\n *\n * @param sessionId - The unique identifier of the session\n * @param clientInfo - The client information to send\n */\nexport const sendClientInfo = async (\n sessionId: string,\n clientInfo: ClientInfo,\n): Promise<void> => {\n try {\n await apiService.post(`/session/sdk/${sessionId}/client-info`, clientInfo);\n } catch (error) {\n console.error(\"Error sending client info:\", error);\n throw error;\n }\n};\n\n/**\n * Determines if the session template has a specific type of node\n *\n * @param template - The session template\n * @param nodeType - The type of node to check for\n * @returns true if the template has a node of the specified type, false otherwise\n */\nexport const hasNodeType = (\n template: SessionTemplate,\n nodeType: string,\n): boolean => {\n return template.nodes.some((node) => node.type === nodeType);\n};\n\n/**\n * Determines if the session template has a node with a specific requiredDocumentType\n *\n * @param template - The session template\n * @param requiredDocumentType - The requiredDocumentType to check for\n * @returns true if the template has a node with the specified requiredDocumentType, false otherwise\n */\nexport const hasDocumentTypeNode = (\n template: SessionTemplate,\n requiredDocumentType: string,\n): boolean => {\n return template.nodes.some(\n (node) => node.requiredDocumentType === requiredDocumentType,\n );\n};\n\n/**\n * Gets all nodes of a specific type\n *\n * @param template - The session template\n * @param nodeType - The type of node to get\n * @returns Array of nodes matching the type\n */\nexport const getNodesByType = (\n template: SessionTemplate,\n nodeType: string,\n): SessionTemplateNode[] => {\n return template.nodes.filter((node) => node.type === nodeType);\n};\n\n/**\n * Gets all nodes with a specific requiredDocumentType\n *\n * @param template - The session template\n * @param requiredDocumentType - The requiredDocumentType to get\n * @returns Array of nodes matching the requiredDocumentType\n */\nexport const getNodesByDocumentType = (\n template: SessionTemplate,\n requiredDocumentType: string,\n): SessionTemplateNode[] => {\n return template.nodes.filter(\n (node) => node.requiredDocumentType === requiredDocumentType,\n );\n};\n\n/**\n * Get document options for a specific document type\n *\n * @param template - The session template\n * @param requiredDocumentType - The document type to get options for\n * @returns Array of document options (empty if none found)\n */\nexport const getDocumentOptions = (\n template: SessionTemplate,\n requiredDocumentType: string,\n): string[] => {\n const node = template.nodes.find(\n (node) => node.requiredDocumentType === requiredDocumentType,\n );\n return node?.selectedOptions || [];\n};\n\n/**\n * Determines if the session template has a selfie step\n *\n * @param template - The session template\n * @returns true if the template has a selfie step, false otherwise\n */\nexport const hasSelfieCaptureStep = (template: SessionTemplate): boolean => {\n return hasNodeType(template, \"selfie-capture\");\n};\n\n/**\n * Determines if the session template has an ID document step\n *\n * @param template - The session template\n * @returns true if the template has an ID document step, false otherwise\n */\nexport const hasDocumentStep = (template: SessionTemplate): boolean => {\n // Check if there's any document-selection node with requiredDocumentType \"id-card\"\n // or if none specified, just check for document-selection nodes\n const hasIDCard = hasDocumentTypeNode(template, \"id-card\");\n return hasIDCard || hasNodeType(template, \"document-selection\");\n};\n\n/**\n * Determines if the session template has a JDD (proof of address) step\n *\n * @param template - The session template\n * @returns true if the template has a JDD step, false otherwise\n */\nexport const hasJDDStep = (template: SessionTemplate): boolean => {\n return hasDocumentTypeNode(template, \"jdd\");\n};\n\n/**\n * Determines if the session template has a proof of funds step\n *\n * @param template - The session template\n * @returns true if the template has a proof of funds step, false otherwise\n */\nexport const hasProofOfFundsStep = (template: SessionTemplate): boolean => {\n return hasDocumentTypeNode(template, \"income-proof\");\n};\n\n/**\n * Determines if the session template has a document collection step\n *\n * @param template - The session template\n * @returns true if the template has a document collection step, false otherwise\n */\nexport const hasDocumentCollectionStep = (\n template: SessionTemplate,\n): boolean => {\n return hasNodeType(template, \"document-collection\");\n};\n\n/**\n * Gets all node types in the template\n *\n * @param template - The session template\n * @returns Array of node types in the template\n */\nexport const getNodeTypes = (template: SessionTemplate): string[] => {\n return Array.from(new Set(template.nodes.map((node) => node.type)));\n};\n\n/**\n * Gets all document types required in the template\n *\n * @param template - The session template\n * @returns Array of document types required in the template\n */\nexport const getRequiredDocumentTypes = (\n template: SessionTemplate,\n): string[] => {\n return Array.from(\n new Set(\n template.nodes\n .filter((node) => node.requiredDocumentType)\n .map((node) => node.requiredDocumentType!),\n ),\n );\n};\n\n/**\n * Converts template document type to internal document type\n * This helps standardize document types between the template and the application\n *\n * @param templateDocType - The document type as defined in the template\n * @returns The internal document type used by the application\n */\nexport const convertTemplateDocTypeToInternal = (\n templateDocType: string,\n): string => {\n if (!templateDocType) return \"\";\n\n // Mapping between template document types and internal document types\n const typeMap: Record<string, string> = {\n \"id-card\": \"id-card\",\n jdd: \"jdd\",\n \"income-proof\": \"income-proof\", // Using consistent naming\n };\n\n return typeMap[templateDocType] || templateDocType;\n};\n\n/**\n * Converts internal document type to template document type\n *\n * @param internalDocType - The document type used internally by the application\n * @returns The document type as expected in the template\n */\nexport const convertInternalDocTypeToTemplate = (\n internalDocType: string,\n): string => {\n if (!internalDocType) return \"\";\n\n // Mapping between internal document types and template document types\n const typeMap: Record<string, string> = {\n \"id-card\": \"id-card\",\n jdd: \"jdd\",\n funds: \"income-proof\", // Map funds to income-proof for backwards compatibility\n \"income-proof\": \"income-proof\",\n };\n\n return typeMap[internalDocType] || internalDocType;\n};\n\n/**\n * Updates session data with user input information\n *\n * @param sessionId - The unique identifier of the session\n * @param userInput - The user input data (firstName, lastName, birthDate)\n * @returns The updated session data\n */\nexport const updateSessionUserInput = async (\n sessionId: string,\n userInput: {\n firstName?: string;\n lastName?: string;\n birthDate?: string;\n [key: string]: unknown;\n },\n): Promise<SessionData> => {\n try {\n const response = await apiService.patch(`/session/sdk/${sessionId}`, {\n userInput,\n });\n return response.data;\n } catch (error) {\n console.error(\"Error updating session data:\", error);\n throw error;\n }\n};\n\n/**\n * Records the NFC fallback reason when the user declares they cannot use the\n * contactless scan, and marks the NFC scan as skipped server-side.\n *\n * @param sessionId - The unique identifier of the session\n * @param payload - The selected reason (technical key), its human-readable label,\n * and an optional free-text comment.\n */\nexport const skipNfcWithReason = async (\n sessionId: string,\n payload: { reason: string; label: string; comment?: string },\n): Promise<void> => {\n await apiService.post(`/session/sdk/${sessionId}/nfc-skip`, payload);\n};\n\nexport type SelfieFailureReason =\n | \"timeout\"\n | \"network_error\"\n | \"api_error\"\n | \"user_bypassed\";\n\nexport interface SelfieFailurePayload {\n nodeId: string;\n reason?: SelfieFailureReason;\n conformityCode?: string;\n bypassed?: boolean;\n}\n\nexport const reportSelfieFailure = async (\n sessionId: string,\n payload: SelfieFailurePayload,\n): Promise<void> => {\n await apiService.post(`/session/sdk/${sessionId}/selfie-failed`, payload);\n};\n\n/**\n * Resets a terminal NFC failure before the user starts again with another\n * document. The backend keeps completed scans immutable and treats this call\n * as a no-op when the status is not terminal.\n */\nexport const resetNfcScan = async (sessionId: string): Promise<void> => {\n await apiService.post(`/session/sdk/${sessionId}/nfc-reset`);\n};\n\n/**\n * Updates session data with contact information\n *\n * @param sessionId - The unique identifier of the session\n * @param contactInfo - The contact information data (email, phoneNumber)\n * @returns The updated session data\n */\nexport const updateSessionContactInfo = async (\n sessionId: string,\n contactInfo: {\n email: string;\n phoneNumber: string;\n [key: string]: unknown;\n },\n): Promise<SessionData> => {\n try {\n const response = await apiService.patch(`/session/sdk/${sessionId}`, {\n contactInfo,\n });\n return response.data;\n } catch (error) {\n console.error(\"Error updating contact information:\", error);\n throw error;\n }\n};\n\n/**\n * Updates session status\n *\n * @param sessionId - The unique identifier of the session\n * @param status - The new status for the session\n * @param reachedEndNodeId - Id of the end node actually reached (when status is \"ended\"),\n * so the backend can force the correct final status with multiple end nodes.\n * @returns The updated session data\n */\nexport const updateSessionStatus = async (\n sessionId: string,\n status: string,\n reachedEndNodeId?: string,\n): Promise<SessionData> => {\n try {\n const response = await apiService.patch(`/session/sdk/${sessionId}`, {\n status,\n ...(reachedEndNodeId ? { reachedEndNodeId } : {}),\n });\n\n // Log status modification in audit trail\n if (response.data && response.data.analysisId) {\n try {\n await logStatusModified(\n sessionId,\n status,\n response.data.clientInfoId || undefined,\n );\n } catch (err) {\n console.error(\"Failed to log status modification in audit trail:\", err);\n // Non-blocking error - continue session\n }\n }\n\n return response.data;\n } catch (error) {\n console.error(\"Error updating session status:\", error);\n throw error;\n }\n};\n\n/**\n * Updates the current step in the session\n *\n * @param sessionId - The unique identifier of the session\n * @param currentStep - The current step index in the workflow\n * @returns The updated session data\n */\nexport const updateSessionCurrentStep = async (\n sessionId: string,\n currentStep: number,\n): Promise<SessionData> => {\n try {\n const response = await apiService.patch(`/session/sdk/${sessionId}`, {\n currentStep,\n });\n return response.data;\n } catch (error) {\n console.error(\"Error updating session current step:\", error);\n throw error;\n }\n};\n\n/**\n * Gets the journey steps from the template in order\n *\n * @param template - The session template\n * @returns Array of ordered steps\n */\nexport const getOrderedJourneySteps = (\n template: SessionTemplate,\n): SessionTemplateNode[] => {\n // Filter out only start nodes, keep end nodes for proper journey completion, then sort by order.\n // Tiebreaker on id keeps the ordering deterministic when several nodes share the same `order`\n // (e.g. parallel branches of a condition), independently of their position in template.nodes.\n return template.nodes\n .filter((node) => node.type !== \"start\")\n .sort((a, b) => a.order - b.order || a.id.localeCompare(b.id));\n};\n\nconst normalizeHandle = (value?: string): string => {\n return (value || \"\").trim().toLowerCase();\n};\n\n/**\n * Finds the outgoing edge to follow from a node.\n *\n * Resolution order:\n * 1. Exact handle match via sourceHandle/conditionValue.\n * 2. For condition:false loops, fallback to targetHandle=right.\n * 3. First outgoing edge as final fallback.\n */\nexport const findOutgoingEdge = (\n currentNodeId: string,\n template: SessionTemplate,\n handle?: string,\n): SessionTemplate[\"edges\"][number] | null => {\n const outgoingEdges = (template.edges || []).filter(\n (edge) => edge.source === currentNodeId,\n );\n\n if (outgoingEdges.length === 0) {\n return null;\n }\n\n if (!handle) {\n return outgoingEdges[0];\n }\n\n const normalizedHandle = normalizeHandle(handle);\n const edgeByHandle = outgoingEdges.find((edge) => {\n return (\n normalizeHandle(edge.sourceHandle) === normalizedHandle ||\n normalizeHandle(edge.conditionValue) === normalizedHandle\n );\n });\n\n if (edgeByHandle) {\n return edgeByHandle;\n }\n\n const currentNode = template.nodes.find((node) => node.id === currentNodeId);\n if (currentNode?.type === \"condition\" && normalizedHandle === \"false\") {\n const rightHandleLoopEdge = outgoingEdges.find(\n (edge) => normalizeHandle(edge.targetHandle) === \"right\",\n );\n if (rightHandleLoopEdge) {\n return rightHandleLoopEdge;\n }\n }\n\n return outgoingEdges[0];\n};\n\n/**\n * Strict existence check for a named outgoing edge — unlike `findOutgoingEdge`,\n * this does NOT fall back to the first outgoing edge when no edge matches the\n * handle. Used by controle-jdi to decide whether a node is \"new-style\" (author\n * explicitly wired a \"false\" edge, enabling automatic true/false routing) or\n * \"legacy\" (single edge, preserve the existing manual continue/retry UX).\n */\nexport const hasOutgoingEdgeForHandle = (\n currentNodeId: string,\n template: SessionTemplate,\n handle: string,\n): boolean => {\n const normalizedHandle = normalizeHandle(handle);\n return (template.edges || []).some(\n (edge) =>\n edge.source === currentNodeId &&\n normalizeHandle(edge.sourceHandle) === normalizedHandle,\n );\n};\n\n/**\n * Gets the next step index by following the graph edge from the current node\n *\n * @param currentNodeId - The ID of the current node\n * @param template - The session template\n * @returns The next step index (1-based) or null if no edge found\n */\nexport const getNextStepIndex = (\n currentNodeId: string,\n template: SessionTemplate,\n handle?: string,\n): number | null => {\n const orderedNodes = getOrderedJourneySteps(template);\n const edge = findOutgoingEdge(currentNodeId, template, handle);\n\n if (!edge) {\n console.debug(\n `[sessionService] No outgoing edge found for node ${currentNodeId}${handle ? ` with handle ${handle}` : \"\"}`,\n );\n return null;\n }\n\n const targetId = edge.target;\n const targetIndex = orderedNodes.findIndex((n) => n.id === targetId);\n\n if (targetIndex === -1) {\n console.debug(\n `[sessionService] Target node ${targetId} not found in ordered steps`,\n );\n return null;\n }\n\n // steps are 1-indexed in the SDK (0 is StartSession)\n return 1 + targetIndex;\n};\n\n/**\n * Reconstructs the navigation history by following the graph from step 0\n * up to (and including) targetStep. Returns [0, ...stepIndices].\n * If the graph path cannot reach targetStep, falls back to [0, targetStep].\n */\nexport const reconstructHistoryToStep = (\n targetStep: number,\n template: SessionTemplate,\n): number[] => {\n if (targetStep <= 0) return [0];\n\n const orderedNodes = getOrderedJourneySteps(template);\n const history: number[] = [0];\n let currentStep = 1; // first node is step 1\n\n // Follow the default (first) edge from each node in sequence\n for (let safetyLimit = 0; safetyLimit < orderedNodes.length + 1; safetyLimit++) {\n if (currentStep === targetStep) {\n history.push(currentStep);\n break;\n }\n if (currentStep > targetStep) break;\n\n const nodeIndex = currentStep - 1;\n const currentNode = orderedNodes[nodeIndex];\n if (!currentNode) break;\n\n history.push(currentStep);\n\n const nextStep = getNextStepIndex(currentNode.id, template);\n if (nextStep === null) break;\n currentStep = nextStep;\n }\n\n // Fallback: if we couldn't reach targetStep via graph, use simple seed\n if (history[history.length - 1] !== targetStep) {\n return [0, targetStep];\n }\n\n return history;\n};\n\n/**\n * Maps a template node type to a step component type\n *\n * @param node - The session template node\n * @returns The step component type\n */\nexport const getStepComponentType = (node: SessionTemplateNode): string => {\n // Map from template node types to component types\n const typeMap: Record<string, string> = {\n \"document-selection\": \"document\",\n \"document-collection\": \"document-collection\",\n \"selfie-capture\": \"selfie\",\n \"contact-info\": \"contact-info\",\n \"user-input\": \"user-input\",\n \"otp-verification\": \"otp\",\n };\n\n // First check the node type\n if (node.type in typeMap) {\n return typeMap[node.type];\n }\n\n // Then check the requiredDocumentType\n if (node.requiredDocumentType) {\n return node.requiredDocumentType;\n }\n\n // Default fallback\n return node.type;\n};\n\n/**\n * Checks if a session has expired\n *\n * @param session - The session data to check\n * @returns true if the session has expired, false otherwise\n */\nexport const isSessionExpired = (session: SessionData): boolean => {\n if (!session.expireTime) {\n return false;\n }\n\n const currentTime = Date.now();\n return currentTime > session.expireTime;\n};\n\n/**\n * Stores document options in localStorage for a specific document type\n *\n * @param sessionId - The session ID\n * @param documentTypeId - The document type ID (e.g., 'jdd', 'income-proof')\n * @param options - The options to store\n */\nexport const storeDocumentOptions = (\n sessionId: string,\n documentTypeId: string,\n options: string[],\n): void => {\n if (!sessionId || !documentTypeId || !options || options.length === 0) {\n console.warn(\"Missing data for storeDocumentOptions:\", {\n sessionId,\n documentTypeId,\n options,\n });\n return;\n }\n\n // Create a consistent key format based on document type\n let storageKey = \"\";\n\n switch (documentTypeId) {\n case \"jdd\":\n storageKey = `jddOptions_${sessionId}`;\n break;\n case \"income-proof\":\n storageKey = `fundsOptions_${sessionId}`;\n break;\n case \"id-card\":\n storageKey = `idOptions_${sessionId}`;\n break;\n case \"document-collection\":\n storageKey = `documentCollectionOptions_${sessionId}`;\n break;\n default:\n storageKey = `${documentTypeId}Options_${sessionId}`;\n }\n\n localStorage.setItem(storageKey, JSON.stringify(options));\n};\n\n/**\n * Retrieves document options from localStorage for a specific document type\n *\n * @param sessionId - The session ID\n * @param documentTypeId - The document type ID (e.g., 'jdd', 'income-proof')\n * @returns Array of options or default options if none found\n */\nexport const retrieveDocumentOptions = (\n sessionId: string,\n documentTypeId: string,\n): string[] => {\n if (!sessionId || !documentTypeId) {\n console.warn(\"Missing data for retrieveDocumentOptions:\", {\n sessionId,\n documentTypeId,\n });\n return [];\n }\n\n // Create consistent key formats to check\n const possibleKeys = [\n `${documentTypeId}Options_${sessionId}`,\n documentTypeId === \"jdd\" ? `jddOptions_${sessionId}` : \"\",\n documentTypeId === \"income-proof\" ? `fundsOptions_${sessionId}` : \"\",\n documentTypeId === \"id-card\" ? `idOptions_${sessionId}` : \"\",\n documentTypeId === \"document-collection\"\n ? `documentCollectionOptions_${sessionId}`\n : \"\",\n ].filter(Boolean);\n\n // Try each possible key\n for (const key of possibleKeys) {\n const savedOptions = localStorage.getItem(key);\n if (savedOptions) {\n try {\n const parsedOptions = JSON.parse(savedOptions);\n\n return parsedOptions;\n } catch (e) {\n console.error(\n `Error parsing options for ${documentTypeId} with key ${key}:`,\n e,\n );\n }\n }\n }\n\n // Return default options if none found\n console.warn(`No options found for ${documentTypeId}, using defaults`);\n if (documentTypeId === \"jdd\") {\n return [\n \"Facture d'électricité (< 3 mois)\",\n \"Facture de gaz (< 3 mois)\",\n \"Facture d'eau (< 3 mois)\",\n \"Quittance de loyer (< 3 mois)\",\n \"Facture téléphone/internet (< 3 mois)\",\n \"Attestation d'assurance habitation (< 3 mois)\",\n ];\n } else if (documentTypeId === \"income-proof\") {\n return [\n \"Bulletin de salaire\",\n \"Avis d'imposition\",\n \"Relevé de compte bancaire\",\n \"Attestation de revenus\",\n \"Contrat de travail\",\n ];\n } else if (documentTypeId === \"id-card\") {\n return [\"Carte nationale d'identité\", \"Passeport\", \"Permis de conduire\"];\n } else if (documentTypeId === \"document-collection\") {\n return [\"Document administratif\", \"Justificatif\", \"Attestation\"];\n }\n\n return [];\n};\n\nconst clearStorageBySessionId = (sessionId: string): void => {\n const scopedKeys = [\n `userInput_${sessionId}`,\n `contactInfo_${sessionId}`,\n `sessionData_${sessionId}`,\n ];\n\n scopedKeys.forEach((key) => {\n localStorage.removeItem(key);\n sessionStorage.removeItem(key);\n });\n\n for (let i = localStorage.length - 1; i >= 0; i -= 1) {\n const key = localStorage.key(i);\n if (!key) {\n continue;\n }\n if (key.endsWith(`_${sessionId}`)) {\n localStorage.removeItem(key);\n }\n }\n\n for (let i = sessionStorage.length - 1; i >= 0; i -= 1) {\n const key = sessionStorage.key(i);\n if (!key) {\n continue;\n }\n if (key.endsWith(`_${sessionId}`)) {\n sessionStorage.removeItem(key);\n }\n }\n\n if (localStorage.getItem(\"sessionId\") === sessionId) {\n localStorage.removeItem(\"sessionId\");\n }\n if (sessionStorage.getItem(\"sessionId\") === sessionId) {\n sessionStorage.removeItem(\"sessionId\");\n }\n};\n\n/**\n * Clears all client-side session traces (memory + browser storage)\n * for a given session. This is intentionally aggressive for security.\n */\nexport const clearSessionSensitiveData = (sessionId?: string): void => {\n clearSessionMemory(sessionId);\n\n if (sessionId) {\n clearStorageBySessionId(sessionId);\n return;\n }\n\n localStorage.removeItem(\"sessionId\");\n sessionStorage.removeItem(\"sessionId\");\n\n for (let i = localStorage.length - 1; i >= 0; i -= 1) {\n const key = localStorage.key(i);\n if (!key) {\n continue;\n }\n if (\n key.startsWith(\"userInput_\") ||\n key.startsWith(\"contactInfo_\") ||\n key.includes(\"Options_\")\n ) {\n localStorage.removeItem(key);\n }\n }\n\n for (let i = sessionStorage.length - 1; i >= 0; i -= 1) {\n const key = sessionStorage.key(i);\n if (!key) {\n continue;\n }\n if (\n key.startsWith(\"userInput_\") ||\n key.startsWith(\"contactInfo_\") ||\n key.includes(\"Options_\")\n ) {\n sessionStorage.removeItem(key);\n }\n }\n};\n\n/**\n * Returns the pre-fill data for a given run index from a `userInput` object\n * that contains a `_list` array.\n *\n * Convention: when the integrator wants to pre-fill different data per run\n * (e.g. multiple persons in a loop), they pass `userInput: { _list: [...] }`\n * at session creation. Each element in `_list` corresponds to a run (0-indexed).\n *\n * @param userInput - The session's userInput object\n * @param runIndex - The current run index (0 = first pass, 1 = second pass, …)\n * @returns The pre-fill data for that run, or null if not defined\n */\nexport const getRunPrefillData = (\n userInput: Record<string, unknown>,\n runIndex: number,\n): Record<string, unknown> | null => {\n const list = userInput?._list;\n if (!Array.isArray(list)) return null;\n return (list[runIndex] as Record<string, unknown>) ?? null;\n};\n"],"names":["__awaiter","apiService","__assign","logStatusModified","clearSessionMemory"],"mappings":";;;;;;;AAAA;;;;;AAKG;AAYH;;;;;AAKG;AACI,IAAM,gBAAgB,GAAG,UAC9B,SAAiB,EAAA,EAAA,OAAAA,mBAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,YAAA;;;;;;gBAGE,OAAA,CAAA,CAAA,YAAMC,cAAU,CAAC,GAAG,CAAC,uBAAgB,SAAS,CAAE,CAAC,CAAA;;AAA5D,gBAAA,QAAQ,GAAG,EAAA,CAAA,IAAA,EAAiD;gBAClE,OAAA,CAAA,CAAA,aAAO,QAAQ,CAAC,IAAI,CAAA;;;AAEpB,gBAAA,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,OAAK,CAAC;AACpD,gBAAA,MAAM,OAAK;;;;;AAIf;;;;AAIG;AACI,IAAM,cAAc,GAAG,UAC5B,SAAiB,EACjB,UAAsB,EAAA,EAAA,OAAAD,mBAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,YAAA;;;;;;gBAGpB,OAAA,CAAA,CAAA,YAAMC,cAAU,CAAC,IAAI,CAAC,eAAA,CAAA,MAAA,CAAgB,SAAS,EAAA,cAAA,CAAc,EAAE,UAAU,CAAC,CAAA;;AAA1E,gBAAA,EAAA,CAAA,IAAA,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AAG,CAAC,UAAU,CAAC,cAAc,CAAC;AAC9B,YAAA,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EACxB;AACA,YAAA,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC;QAChC;IACF;AACF;AAEA;;;;;;;;;;;AAWG;AACI,IAAM,iBAAiB,GAAG,UAC/B,SAAkC,EAClC,QAAgB,EAAA;;IAEhB,IAAM,IAAI,GAAG,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,MAAA,GAAA,MAAA,GAAT,SAAS,CAAE,KAAK;AAC7B,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;AAAE,QAAA,OAAO,IAAI;AACrC,IAAA,OAAO,MAAC,IAAI,CAAC,QAAQ,CAA6B,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,IAAI;AAC5D;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sessionService.js","sources":["../../../../src/services/sessionService.ts"],"sourcesContent":["import type { ComplementaryMandateOutcome } from '../types/session';\n/**\n * Session Service\n *\n * Service for interacting with the Datakeen Session API.\n * Handles fetching session data by ID.\n */\n\nimport type {\n ClientInfo,\n SessionData,\n SessionTemplate,\n SessionTemplateNode,\n} from \"../types/session\";\nimport { apiService } from \"./api\";\nimport { logStatusModified } from \"./auditTrailService\";\nimport { clearSessionMemory } from \"./sessionMemoryStore\";\n\n/**\n * Fetches session data by ID from the Datakeen backend\n *\n * @param sessionId - The unique identifier of the session\n * @returns The session data\n */\nexport const fetchSessionById = async (\n sessionId: string,\n): Promise<SessionData> => {\n try {\n const response = await apiService.get(`/session/sdk/${sessionId}`);\n return response.data;\n } catch (error) {\n console.error(\"Error fetching session data:\", error);\n throw error;\n }\n};\n\n/** Sends client information (IP, device, browser, OS) to the backend for a specific session\n *\n * @param sessionId - The unique identifier of the session\n * @param clientInfo - The client information to send\n */\nexport const sendClientInfo = async (\n sessionId: string,\n clientInfo: ClientInfo,\n): Promise<void> => {\n try {\n await apiService.post(`/session/sdk/${sessionId}/client-info`, clientInfo);\n } catch (error) {\n console.error(\"Error sending client info:\", error);\n throw error;\n }\n};\n\n/**\n * Determines if the session template has a specific type of node\n *\n * @param template - The session template\n * @param nodeType - The type of node to check for\n * @returns true if the template has a node of the specified type, false otherwise\n */\nexport const hasNodeType = (\n template: SessionTemplate,\n nodeType: string,\n): boolean => {\n return template.nodes.some((node) => node.type === nodeType);\n};\n\n/**\n * Determines if the session template has a node with a specific requiredDocumentType\n *\n * @param template - The session template\n * @param requiredDocumentType - The requiredDocumentType to check for\n * @returns true if the template has a node with the specified requiredDocumentType, false otherwise\n */\nexport const hasDocumentTypeNode = (\n template: SessionTemplate,\n requiredDocumentType: string,\n): boolean => {\n return template.nodes.some(\n (node) => node.requiredDocumentType === requiredDocumentType,\n );\n};\n\n/**\n * Gets all nodes of a specific type\n *\n * @param template - The session template\n * @param nodeType - The type of node to get\n * @returns Array of nodes matching the type\n */\nexport const getNodesByType = (\n template: SessionTemplate,\n nodeType: string,\n): SessionTemplateNode[] => {\n return template.nodes.filter((node) => node.type === nodeType);\n};\n\n/**\n * Gets all nodes with a specific requiredDocumentType\n *\n * @param template - The session template\n * @param requiredDocumentType - The requiredDocumentType to get\n * @returns Array of nodes matching the requiredDocumentType\n */\nexport const getNodesByDocumentType = (\n template: SessionTemplate,\n requiredDocumentType: string,\n): SessionTemplateNode[] => {\n return template.nodes.filter(\n (node) => node.requiredDocumentType === requiredDocumentType,\n );\n};\n\n/**\n * Get document options for a specific document type\n *\n * @param template - The session template\n * @param requiredDocumentType - The document type to get options for\n * @returns Array of document options (empty if none found)\n */\nexport const getDocumentOptions = (\n template: SessionTemplate,\n requiredDocumentType: string,\n): string[] => {\n const node = template.nodes.find(\n (node) => node.requiredDocumentType === requiredDocumentType,\n );\n return node?.selectedOptions || [];\n};\n\n/**\n * Determines if the session template has a selfie step\n *\n * @param template - The session template\n * @returns true if the template has a selfie step, false otherwise\n */\nexport const hasSelfieCaptureStep = (template: SessionTemplate): boolean => {\n return hasNodeType(template, \"selfie-capture\");\n};\n\n/**\n * Determines if the session template has an ID document step\n *\n * @param template - The session template\n * @returns true if the template has an ID document step, false otherwise\n */\nexport const hasDocumentStep = (template: SessionTemplate): boolean => {\n // Check if there's any document-selection node with requiredDocumentType \"id-card\"\n // or if none specified, just check for document-selection nodes\n const hasIDCard = hasDocumentTypeNode(template, \"id-card\");\n return hasIDCard || hasNodeType(template, \"document-selection\");\n};\n\n/**\n * Determines if the session template has a JDD (proof of address) step\n *\n * @param template - The session template\n * @returns true if the template has a JDD step, false otherwise\n */\nexport const hasJDDStep = (template: SessionTemplate): boolean => {\n return hasDocumentTypeNode(template, \"jdd\");\n};\n\n/**\n * Determines if the session template has a proof of funds step\n *\n * @param template - The session template\n * @returns true if the template has a proof of funds step, false otherwise\n */\nexport const hasProofOfFundsStep = (template: SessionTemplate): boolean => {\n return hasDocumentTypeNode(template, \"income-proof\");\n};\n\n/**\n * Determines if the session template has a document collection step\n *\n * @param template - The session template\n * @returns true if the template has a document collection step, false otherwise\n */\nexport const hasDocumentCollectionStep = (\n template: SessionTemplate,\n): boolean => {\n return hasNodeType(template, \"document-collection\");\n};\n\n/**\n * Gets all node types in the template\n *\n * @param template - The session template\n * @returns Array of node types in the template\n */\nexport const getNodeTypes = (template: SessionTemplate): string[] => {\n return Array.from(new Set(template.nodes.map((node) => node.type)));\n};\n\n/**\n * Gets all document types required in the template\n *\n * @param template - The session template\n * @returns Array of document types required in the template\n */\nexport const getRequiredDocumentTypes = (\n template: SessionTemplate,\n): string[] => {\n return Array.from(\n new Set(\n template.nodes\n .filter((node) => node.requiredDocumentType)\n .map((node) => node.requiredDocumentType!),\n ),\n );\n};\n\n/**\n * Converts template document type to internal document type\n * This helps standardize document types between the template and the application\n *\n * @param templateDocType - The document type as defined in the template\n * @returns The internal document type used by the application\n */\nexport const convertTemplateDocTypeToInternal = (\n templateDocType: string,\n): string => {\n if (!templateDocType) return \"\";\n\n // Mapping between template document types and internal document types\n const typeMap: Record<string, string> = {\n \"id-card\": \"id-card\",\n jdd: \"jdd\",\n \"income-proof\": \"income-proof\", // Using consistent naming\n };\n\n return typeMap[templateDocType] || templateDocType;\n};\n\n/**\n * Converts internal document type to template document type\n *\n * @param internalDocType - The document type used internally by the application\n * @returns The document type as expected in the template\n */\nexport const convertInternalDocTypeToTemplate = (\n internalDocType: string,\n): string => {\n if (!internalDocType) return \"\";\n\n // Mapping between internal document types and template document types\n const typeMap: Record<string, string> = {\n \"id-card\": \"id-card\",\n jdd: \"jdd\",\n funds: \"income-proof\", // Map funds to income-proof for backwards compatibility\n \"income-proof\": \"income-proof\",\n };\n\n return typeMap[internalDocType] || internalDocType;\n};\n\n/**\n * Updates session data with user input information\n *\n * @param sessionId - The unique identifier of the session\n * @param userInput - The user input data (firstName, lastName, birthDate)\n * @returns The updated session data\n */\nexport const updateSessionUserInput = async (\n sessionId: string,\n userInput: {\n firstName?: string;\n lastName?: string;\n birthDate?: string;\n [key: string]: unknown;\n },\n): Promise<SessionData> => {\n try {\n const response = await apiService.patch(`/session/sdk/${sessionId}`, {\n userInput,\n });\n return response.data;\n } catch (error) {\n console.error(\"Error updating session data:\", error);\n throw error;\n }\n};\n\n/**\n * Records the NFC fallback reason when the user declares they cannot use the\n * contactless scan, and marks the NFC scan as skipped server-side.\n *\n * @param sessionId - The unique identifier of the session\n * @param payload - The selected reason (technical key), its human-readable label,\n * and an optional free-text comment.\n */\nexport const skipNfcWithReason = async (\n sessionId: string,\n payload: { reason: string; label: string; comment?: string },\n): Promise<void> => {\n await apiService.post(`/session/sdk/${sessionId}/nfc-skip`, payload);\n};\n\nexport type SelfieFailureReason =\n | \"timeout\"\n | \"network_error\"\n | \"api_error\"\n | \"user_bypassed\";\n\nexport interface SelfieFailurePayload {\n nodeId: string;\n reason?: SelfieFailureReason;\n conformityCode?: string;\n bypassed?: boolean;\n}\n\nexport const reportSelfieFailure = async (\n sessionId: string,\n payload: SelfieFailurePayload,\n): Promise<void> => {\n await apiService.post(`/session/sdk/${sessionId}/selfie-failed`, payload);\n};\n\n/**\n * Resets a terminal NFC failure before the user starts again with another\n * document. The backend keeps completed scans immutable and treats this call\n * as a no-op when the status is not terminal.\n */\nexport const resetNfcScan = async (sessionId: string): Promise<void> => {\n await apiService.post(`/session/sdk/${sessionId}/nfc-reset`);\n};\n\n/**\n * Updates session data with contact information\n *\n * @param sessionId - The unique identifier of the session\n * @param contactInfo - The contact information data (email, phoneNumber)\n * @returns The updated session data\n */\nexport const updateSessionContactInfo = async (\n sessionId: string,\n contactInfo: {\n email: string;\n phoneNumber: string;\n [key: string]: unknown;\n },\n): Promise<SessionData> => {\n try {\n const response = await apiService.patch(`/session/sdk/${sessionId}`, {\n contactInfo,\n });\n return response.data;\n } catch (error) {\n console.error(\"Error updating contact information:\", error);\n throw error;\n }\n};\n\n/**\n * Updates session status\n *\n * @param sessionId - The unique identifier of the session\n * @param status - The new status for the session\n * @param reachedEndNodeId - Id of the end node actually reached (when status is \"ended\"),\n * so the backend can force the correct final status with multiple end nodes.\n * @returns The updated session data\n */\nexport const updateSessionStatus = async (\n sessionId: string,\n status: string,\n reachedEndNodeId?: string,\n): Promise<SessionData> => {\n try {\n const response = await apiService.patch(`/session/sdk/${sessionId}`, {\n status,\n ...(reachedEndNodeId ? { reachedEndNodeId } : {}),\n });\n\n // Log status modification in audit trail\n if (response.data && response.data.analysisId) {\n try {\n await logStatusModified(\n sessionId,\n status,\n response.data.clientInfoId || undefined,\n );\n } catch (err) {\n console.error(\"Failed to log status modification in audit trail:\", err);\n // Non-blocking error - continue session\n }\n }\n\n return response.data;\n } catch (error) {\n console.error(\"Error updating session status:\", error);\n throw error;\n }\n};\n\n/**\n * Updates the current step in the session\n *\n * @param sessionId - The unique identifier of the session\n * @param currentStep - The current step index in the workflow\n * @returns The updated session data\n */\nexport const updateSessionCurrentStep = async (\n sessionId: string,\n currentStep: number,\n): Promise<SessionData> => {\n try {\n const response = await apiService.patch(`/session/sdk/${sessionId}`, {\n currentStep,\n });\n return response.data;\n } catch (error) {\n console.error(\"Error updating session current step:\", error);\n throw error;\n }\n};\n\n/**\n * Gets the journey steps from the template in order\n *\n * @param template - The session template\n * @returns Array of ordered steps\n */\nexport const getOrderedJourneySteps = (\n template: SessionTemplate,\n): SessionTemplateNode[] => {\n // Filter out only start nodes, keep end nodes for proper journey completion, then sort by order.\n // Tiebreaker on id keeps the ordering deterministic when several nodes share the same `order`\n // (e.g. parallel branches of a condition), independently of their position in template.nodes.\n return template.nodes\n .filter((node) => node.type !== \"start\")\n .sort((a, b) => a.order - b.order || a.id.localeCompare(b.id));\n};\n\nconst normalizeHandle = (value?: string): string => {\n return (value || \"\").trim().toLowerCase();\n};\n\n/**\n * Finds the outgoing edge to follow from a node.\n *\n * Resolution order:\n * 1. Exact handle match via sourceHandle/conditionValue.\n * 2. For condition:false loops, fallback to targetHandle=right.\n * 3. First outgoing edge as final fallback.\n */\nexport const findOutgoingEdge = (\n currentNodeId: string,\n template: SessionTemplate,\n handle?: string,\n): SessionTemplate[\"edges\"][number] | null => {\n const outgoingEdges = (template.edges || []).filter(\n (edge) => edge.source === currentNodeId,\n );\n\n if (outgoingEdges.length === 0) {\n return null;\n }\n\n if (!handle) {\n return outgoingEdges[0];\n }\n\n const normalizedHandle = normalizeHandle(handle);\n const edgeByHandle = outgoingEdges.find((edge) => {\n return (\n normalizeHandle(edge.sourceHandle) === normalizedHandle ||\n normalizeHandle(edge.conditionValue) === normalizedHandle\n );\n });\n\n if (edgeByHandle) {\n return edgeByHandle;\n }\n\n const currentNode = template.nodes.find((node) => node.id === currentNodeId);\n if (currentNode?.type === \"condition\" && normalizedHandle === \"false\") {\n const rightHandleLoopEdge = outgoingEdges.find(\n (edge) => normalizeHandle(edge.targetHandle) === \"right\",\n );\n if (rightHandleLoopEdge) {\n return rightHandleLoopEdge;\n }\n }\n\n return outgoingEdges[0];\n};\n\n/**\n * Strict existence check for a named outgoing edge — unlike `findOutgoingEdge`,\n * this does NOT fall back to the first outgoing edge when no edge matches the\n * handle. Used by controle-jdi to decide whether a node is \"new-style\" (author\n * explicitly wired a \"false\" edge, enabling automatic true/false routing) or\n * \"legacy\" (single edge, preserve the existing manual continue/retry UX).\n */\nexport const hasOutgoingEdgeForHandle = (\n currentNodeId: string,\n template: SessionTemplate,\n handle: string,\n): boolean => {\n const normalizedHandle = normalizeHandle(handle);\n return (template.edges || []).some(\n (edge) =>\n edge.source === currentNodeId &&\n normalizeHandle(edge.sourceHandle) === normalizedHandle,\n );\n};\n\n/**\n * Gets the next step index by following the graph edge from the current node\n *\n * @param currentNodeId - The ID of the current node\n * @param template - The session template\n * @returns The next step index (1-based) or null if no edge found\n */\nexport const getNextStepIndex = (\n currentNodeId: string,\n template: SessionTemplate,\n handle?: string,\n): number | null => {\n const orderedNodes = getOrderedJourneySteps(template);\n const edge = findOutgoingEdge(currentNodeId, template, handle);\n\n if (!edge) {\n console.debug(\n `[sessionService] No outgoing edge found for node ${currentNodeId}${handle ? ` with handle ${handle}` : \"\"}`,\n );\n return null;\n }\n\n const targetId = edge.target;\n const targetIndex = orderedNodes.findIndex((n) => n.id === targetId);\n\n if (targetIndex === -1) {\n console.debug(\n `[sessionService] Target node ${targetId} not found in ordered steps`,\n );\n return null;\n }\n\n // steps are 1-indexed in the SDK (0 is StartSession)\n return 1 + targetIndex;\n};\n\n/**\n * Reconstructs the navigation history by following the graph from step 0\n * up to (and including) targetStep. Returns [0, ...stepIndices].\n * If the graph path cannot reach targetStep, falls back to [0, targetStep].\n */\nexport const reconstructHistoryToStep = (\n targetStep: number,\n template: SessionTemplate,\n): number[] => {\n if (targetStep <= 0) return [0];\n\n const orderedNodes = getOrderedJourneySteps(template);\n const history: number[] = [0];\n let currentStep = 1; // first node is step 1\n\n // Follow the default (first) edge from each node in sequence\n for (let safetyLimit = 0; safetyLimit < orderedNodes.length + 1; safetyLimit++) {\n if (currentStep === targetStep) {\n history.push(currentStep);\n break;\n }\n if (currentStep > targetStep) break;\n\n const nodeIndex = currentStep - 1;\n const currentNode = orderedNodes[nodeIndex];\n if (!currentNode) break;\n\n history.push(currentStep);\n\n const nextStep = getNextStepIndex(currentNode.id, template);\n if (nextStep === null) break;\n currentStep = nextStep;\n }\n\n // Fallback: if we couldn't reach targetStep via graph, use simple seed\n if (history[history.length - 1] !== targetStep) {\n return [0, targetStep];\n }\n\n return history;\n};\n\n/**\n * Maps a template node type to a step component type\n *\n * @param node - The session template node\n * @returns The step component type\n */\nexport const getStepComponentType = (node: SessionTemplateNode): string => {\n // Map from template node types to component types\n const typeMap: Record<string, string> = {\n \"document-selection\": \"document\",\n \"document-collection\": \"document-collection\",\n \"selfie-capture\": \"selfie\",\n \"contact-info\": \"contact-info\",\n \"user-input\": \"user-input\",\n \"otp-verification\": \"otp\",\n };\n\n // First check the node type\n if (node.type in typeMap) {\n return typeMap[node.type];\n }\n\n // Then check the requiredDocumentType\n if (node.requiredDocumentType) {\n return node.requiredDocumentType;\n }\n\n // Default fallback\n return node.type;\n};\n\n/**\n * Checks if a session has expired\n *\n * @param session - The session data to check\n * @returns true if the session has expired, false otherwise\n */\nexport const isSessionExpired = (session: SessionData): boolean => {\n if (!session.expireTime) {\n return false;\n }\n\n const currentTime = Date.now();\n return currentTime > session.expireTime;\n};\n\n/**\n * Stores document options in localStorage for a specific document type\n *\n * @param sessionId - The session ID\n * @param documentTypeId - The document type ID (e.g., 'jdd', 'income-proof')\n * @param options - The options to store\n */\nexport const storeDocumentOptions = (\n sessionId: string,\n documentTypeId: string,\n options: string[],\n): void => {\n if (!sessionId || !documentTypeId || !options || options.length === 0) {\n console.warn(\"Missing data for storeDocumentOptions:\", {\n sessionId,\n documentTypeId,\n options,\n });\n return;\n }\n\n // Create a consistent key format based on document type\n let storageKey = \"\";\n\n switch (documentTypeId) {\n case \"jdd\":\n storageKey = `jddOptions_${sessionId}`;\n break;\n case \"income-proof\":\n storageKey = `fundsOptions_${sessionId}`;\n break;\n case \"id-card\":\n storageKey = `idOptions_${sessionId}`;\n break;\n case \"document-collection\":\n storageKey = `documentCollectionOptions_${sessionId}`;\n break;\n default:\n storageKey = `${documentTypeId}Options_${sessionId}`;\n }\n\n localStorage.setItem(storageKey, JSON.stringify(options));\n};\n\n/**\n * Retrieves document options from localStorage for a specific document type\n *\n * @param sessionId - The session ID\n * @param documentTypeId - The document type ID (e.g., 'jdd', 'income-proof')\n * @returns Array of options or default options if none found\n */\nexport const retrieveDocumentOptions = (\n sessionId: string,\n documentTypeId: string,\n): string[] => {\n if (!sessionId || !documentTypeId) {\n console.warn(\"Missing data for retrieveDocumentOptions:\", {\n sessionId,\n documentTypeId,\n });\n return [];\n }\n\n // Create consistent key formats to check\n const possibleKeys = [\n `${documentTypeId}Options_${sessionId}`,\n documentTypeId === \"jdd\" ? `jddOptions_${sessionId}` : \"\",\n documentTypeId === \"income-proof\" ? `fundsOptions_${sessionId}` : \"\",\n documentTypeId === \"id-card\" ? `idOptions_${sessionId}` : \"\",\n documentTypeId === \"document-collection\"\n ? `documentCollectionOptions_${sessionId}`\n : \"\",\n ].filter(Boolean);\n\n // Try each possible key\n for (const key of possibleKeys) {\n const savedOptions = localStorage.getItem(key);\n if (savedOptions) {\n try {\n const parsedOptions = JSON.parse(savedOptions);\n\n return parsedOptions;\n } catch (e) {\n console.error(\n `Error parsing options for ${documentTypeId} with key ${key}:`,\n e,\n );\n }\n }\n }\n\n // Return default options if none found\n console.warn(`No options found for ${documentTypeId}, using defaults`);\n if (documentTypeId === \"jdd\") {\n return [\n \"Facture d'électricité (< 3 mois)\",\n \"Facture de gaz (< 3 mois)\",\n \"Facture d'eau (< 3 mois)\",\n \"Quittance de loyer (< 3 mois)\",\n \"Facture téléphone/internet (< 3 mois)\",\n \"Attestation d'assurance habitation (< 3 mois)\",\n ];\n } else if (documentTypeId === \"income-proof\") {\n return [\n \"Bulletin de salaire\",\n \"Avis d'imposition\",\n \"Relevé de compte bancaire\",\n \"Attestation de revenus\",\n \"Contrat de travail\",\n ];\n } else if (documentTypeId === \"id-card\") {\n return [\"Carte nationale d'identité\", \"Passeport\", \"Permis de conduire\"];\n } else if (documentTypeId === \"document-collection\") {\n return [\"Document administratif\", \"Justificatif\", \"Attestation\"];\n }\n\n return [];\n};\n\nconst clearStorageBySessionId = (sessionId: string): void => {\n const scopedKeys = [\n `userInput_${sessionId}`,\n `contactInfo_${sessionId}`,\n `sessionData_${sessionId}`,\n ];\n\n scopedKeys.forEach((key) => {\n localStorage.removeItem(key);\n sessionStorage.removeItem(key);\n });\n\n for (let i = localStorage.length - 1; i >= 0; i -= 1) {\n const key = localStorage.key(i);\n if (!key) {\n continue;\n }\n if (key.endsWith(`_${sessionId}`)) {\n localStorage.removeItem(key);\n }\n }\n\n for (let i = sessionStorage.length - 1; i >= 0; i -= 1) {\n const key = sessionStorage.key(i);\n if (!key) {\n continue;\n }\n if (key.endsWith(`_${sessionId}`)) {\n sessionStorage.removeItem(key);\n }\n }\n\n if (localStorage.getItem(\"sessionId\") === sessionId) {\n localStorage.removeItem(\"sessionId\");\n }\n if (sessionStorage.getItem(\"sessionId\") === sessionId) {\n sessionStorage.removeItem(\"sessionId\");\n }\n};\n\n/**\n * Clears all client-side session traces (memory + browser storage)\n * for a given session. This is intentionally aggressive for security.\n */\nexport const clearSessionSensitiveData = (sessionId?: string): void => {\n clearSessionMemory(sessionId);\n\n if (sessionId) {\n clearStorageBySessionId(sessionId);\n return;\n }\n\n localStorage.removeItem(\"sessionId\");\n sessionStorage.removeItem(\"sessionId\");\n\n for (let i = localStorage.length - 1; i >= 0; i -= 1) {\n const key = localStorage.key(i);\n if (!key) {\n continue;\n }\n if (\n key.startsWith(\"userInput_\") ||\n key.startsWith(\"contactInfo_\") ||\n key.includes(\"Options_\")\n ) {\n localStorage.removeItem(key);\n }\n }\n\n for (let i = sessionStorage.length - 1; i >= 0; i -= 1) {\n const key = sessionStorage.key(i);\n if (!key) {\n continue;\n }\n if (\n key.startsWith(\"userInput_\") ||\n key.startsWith(\"contactInfo_\") ||\n key.includes(\"Options_\")\n ) {\n sessionStorage.removeItem(key);\n }\n }\n};\n\n/**\n * Returns the pre-fill data for a given run index from a `userInput` object\n * that contains a `_list` array.\n *\n * Convention: when the integrator wants to pre-fill different data per run\n * (e.g. multiple persons in a loop), they pass `userInput: { _list: [...] }`\n * at session creation. Each element in `_list` corresponds to a run (0-indexed).\n *\n * @param userInput - The session's userInput object\n * @param runIndex - The current run index (0 = first pass, 1 = second pass, …)\n * @returns The pre-fill data for that run, or null if not defined\n */\nexport const getRunPrefillData = (\n userInput: Record<string, unknown>,\n runIndex: number,\n): Record<string, unknown> | null => {\n const list = userInput?._list;\n if (!Array.isArray(list)) return null;\n return (list[runIndex] as Record<string, unknown>) ?? null;\n};\n\n/**\n * Checks en cours par nœud : un double montage (StrictMode, remontage) partage\n * la même requête au lieu d'en lancer une seconde qui entrerait en concurrence\n * avec la première côté serveur. L'entrée est libérée dès que l'appel aboutit,\n * pour qu'un réessai reparte bien du serveur.\n */\nconst pendingMandateChecks = new Map<string, Promise<{ outcome: ComplementaryMandateOutcome }>>();\n\n/** The server reads persisted identity; no identity or verdict is submitted. */\nexport function checkComplementaryMandate(sessionId: string, nodeId: string): Promise<{ outcome: ComplementaryMandateOutcome }> {\n const key = `${sessionId}:${nodeId}`;\n const pending = pendingMandateChecks.get(key);\n if (pending) return pending;\n const request = (async () => {\n const response = await apiService.post(`/session/sdk/${sessionId}/complementary-mandate/${encodeURIComponent(nodeId)}`);\n const outcome = response.data?.outcome;\n if (!['same_signer', 'new_signer', 'no_mandate'].includes(outcome)) throw new Error('Invalid complementary mandate outcome');\n return { outcome };\n })().finally(() => pendingMandateChecks.delete(key));\n pendingMandateChecks.set(key, request);\n return request;\n}\n"],"names":["__awaiter","apiService","__assign","logStatusModified","clearSessionMemory"],"mappings":";;;;;;;AAkBA;;;;;AAKG;AACI,IAAM,gBAAgB,GAAG,UAC9B,SAAiB,EAAA,EAAA,OAAAA,mBAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,E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AC;AACtC,IAAA,OAAO,OAAO;AAChB;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sources":["../../../../src/types/session.ts"],"sourcesContent":["import type React from \"react\";\n\nexport interface SessionConfig {\n sessionToken?: string;\n selfie?: boolean;\n requireMobile?: boolean;\n}\n\nexport interface DatakeenSessionProps {\n /** Session credential returned by server-side session creation. Required by secured backends. */\n sessionToken?: string;\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 /** Absent means personal data. Lists are classified as a whole, not per column. */\n containsPersonalData?: 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\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 /**\n * INPI_RBE only. Opt-in: retry against INSEE (Sirene) when the RNE finds\n * nothing. Tried before the RNA fallback when both are enabled.\n */\n enableInseeFallback?: 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 /** Écran affiché après la signature. Valeurs vides : textes standard traduits. */\n signedScreenTitle?: string;\n signedScreenDescription?: string;\n signedScreenDownloadHint?: 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 * Déprécié pour controle-jdi/identity-control quand une sortie \"false\" est\n * câblée : dans ce cas le routage automatique (blockingCodes +\n * maxResubmissionAction) prend le relais et ce bouton disparaît. Reste lu\n * tel quel pour les nœuds legacy sans sortie \"false\" (rétrocompat).\n */\n allowContinueOnFailure?: boolean;\n\n /**\n * Codes JDI exacts considérés comme bloquants pour ce nœud controle-jdi\n * (déclenchent la boucle de resoumission). Absent = DEFAULT_BLOCKING_CODES\n * (utils/jdiCodes.ts) — comportement legacy inchangé. Le code 8.0 est\n * toujours bloquant indépendamment de cette liste.\n */\n blockingCodes?: string[];\n\n /**\n * Action suivie quand les resoumissions sont épuisées sur un code bloquant\n * ET qu'une sortie \"false\" est câblée sur ce nœud controle-jdi (miroir de\n * conditionMaxRetryAction sur le nœud condition). Défaut \"end-journey\".\n */\n maxResubmissionAction?: \"end-journey\" | \"force-true\";\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":";;AA0EO,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 sessionToken?: string;\n selfie?: boolean;\n requireMobile?: boolean;\n}\n\nexport interface DatakeenSessionProps {\n /** Session credential returned by server-side session creation. Required by secured backends. */\n sessionToken?: string;\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/** Un cas de la règle : une option du pilote → un regex. */\nexport interface ListColumnRegexCase {\n value: string; // valeur exacte d'une option du pilote\n regex: string; // source JS sans slashes ; vide = pas de contrainte\n errorMessage?: string; // message spécifique à ce cas\n}\n\n/** Regex conditionnelle pilotée par une autre colonne enum de la même ligne. */\nexport interface ListColumnRegexRules {\n /** Builder-only explicit opt-out for uncovered text options. */\n allowUnconstrained?: boolean;\n sourceColumn: string; // label de la colonne enum pilote\n cases: ListColumnRegexCase[]; // une entrée par option couverte\n}\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/email — JS regex source (without slashes)\n regexErrorMessage?: string; // text/email — message displayed when regex fails\n regexRules?: ListColumnRegexRules; // text/email — conditional regex rules\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 /** Absent means personal data. Lists are classified as a whole, not per column. */\n containsPersonalData?: 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\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 /**\n * INPI_RBE only. Opt-in: retry against INSEE (Sirene) when the RNE finds\n * nothing. Tried before the RNA fallback when both are enabled.\n */\n enableInseeFallback?: 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 /** Écran affiché après la signature. Valeurs vides : textes standard traduits. */\n signedScreenTitle?: string;\n signedScreenDescription?: string;\n signedScreenDownloadHint?: 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 * Déprécié pour controle-jdi/identity-control quand une sortie \"false\" est\n * câblée : dans ce cas le routage automatique (blockingCodes +\n * maxResubmissionAction) prend le relais et ce bouton disparaît. Reste lu\n * tel quel pour les nœuds legacy sans sortie \"false\" (rétrocompat).\n */\n allowContinueOnFailure?: boolean;\n\n /**\n * Codes JDI exacts considérés comme bloquants pour ce nœud controle-jdi\n * (déclenchent la boucle de resoumission). Absent = DEFAULT_BLOCKING_CODES\n * (utils/jdiCodes.ts) — comportement legacy inchangé. Le code 8.0 est\n * toujours bloquant indépendamment de cette liste.\n */\n blockingCodes?: string[];\n\n /**\n * Action suivie quand les resoumissions sont épuisées sur un code bloquant\n * ET qu'une sortie \"false\" est câblée sur ce nœud controle-jdi (miroir de\n * conditionMaxRetryAction sur le nœud condition). Défaut \"end-journey\".\n */\n maxResubmissionAction?: \"end-journey\" | \"force-true\";\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\nexport type ComplementaryMandateOutcome = 'same_signer' | 'new_signer' | 'no_mandate';\nexport interface ComplementaryMandateNode extends SessionTemplateNode {\n type: 'complementary-mandate';\n sourceJourneyId?: string;\n maxAgeMonths?: number;\n excludedInheritedFields?: string[];\n}\n"],"names":[],"mappings":";;AA0EO,IAAM,2BAA2B,GAAsB;;;;"}
|
|
@@ -15,7 +15,9 @@ var DATE_FORMAT_SPECS = {
|
|
|
15
15
|
"yyyy-mm-dd": { re: ISO_DATE_RE, order: ["year", "month", "day"] },
|
|
16
16
|
};
|
|
17
17
|
var isValidDateParts = function (year, month, day) {
|
|
18
|
-
if (!Number.isInteger(year) ||
|
|
18
|
+
if (!Number.isInteger(year) ||
|
|
19
|
+
!Number.isInteger(month) ||
|
|
20
|
+
!Number.isInteger(day)) {
|
|
19
21
|
return false;
|
|
20
22
|
}
|
|
21
23
|
if (year < 1 || month < 1 || month > 12 || day < 1 || day > 31)
|
|
@@ -55,6 +57,46 @@ var isRegexMatch = function (value, source) {
|
|
|
55
57
|
return true;
|
|
56
58
|
}
|
|
57
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Resolves the regex for a list cell from another enum cell in the same row.
|
|
62
|
+
* Malformed or incomplete conditional rules deliberately fall back to the
|
|
63
|
+
* column regex so legacy configurations remain usable.
|
|
64
|
+
*/
|
|
65
|
+
var resolveColumnRegex = function (col, row) {
|
|
66
|
+
var fallback = {
|
|
67
|
+
regex: typeof col.regex === "string" ? col.regex : "",
|
|
68
|
+
errorMessage: typeof col.regexErrorMessage === "string"
|
|
69
|
+
? col.regexErrorMessage
|
|
70
|
+
: undefined,
|
|
71
|
+
};
|
|
72
|
+
var rules = col.regexRules;
|
|
73
|
+
if (!rules ||
|
|
74
|
+
typeof rules.sourceColumn !== "string" ||
|
|
75
|
+
!rules.sourceColumn ||
|
|
76
|
+
!Array.isArray(rules.cases) ||
|
|
77
|
+
!row) {
|
|
78
|
+
return fallback;
|
|
79
|
+
}
|
|
80
|
+
var sourceValue = row[rules.sourceColumn];
|
|
81
|
+
if (typeof sourceValue !== "string" || !sourceValue)
|
|
82
|
+
return fallback;
|
|
83
|
+
var matchingCase = rules.cases.find(function (candidate) {
|
|
84
|
+
return candidate &&
|
|
85
|
+
typeof candidate.value === "string" &&
|
|
86
|
+
candidate.value === sourceValue;
|
|
87
|
+
});
|
|
88
|
+
if (!matchingCase || typeof matchingCase.regex !== "string")
|
|
89
|
+
return fallback;
|
|
90
|
+
var regex = matchingCase.regex.trim();
|
|
91
|
+
if (!regex)
|
|
92
|
+
return fallback;
|
|
93
|
+
return {
|
|
94
|
+
regex: regex,
|
|
95
|
+
errorMessage: typeof matchingCase.errorMessage === "string"
|
|
96
|
+
? matchingCase.errorMessage
|
|
97
|
+
: fallback.errorMessage,
|
|
98
|
+
};
|
|
99
|
+
};
|
|
58
100
|
var cellErrorKey = function (rowIndex, columnLabel) {
|
|
59
101
|
return "".concat(rowIndex, "::").concat(columnLabel);
|
|
60
102
|
};
|
|
@@ -64,4 +106,5 @@ exports.cellErrorKey = cellErrorKey;
|
|
|
64
106
|
exports.isDateValid = isDateValid;
|
|
65
107
|
exports.isEmailValid = isEmailValid;
|
|
66
108
|
exports.isRegexMatch = isRegexMatch;
|
|
109
|
+
exports.resolveColumnRegex = resolveColumnRegex;
|
|
67
110
|
//# sourceMappingURL=customFieldValidation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customFieldValidation.js","sources":["../../../../src/utils/customFieldValidation.ts"],"sourcesContent":["import type { DateDisplayFormat } from \"../types/session\";\nimport { DEFAULT_DATE_DISPLAY_FORMAT } from \"../types/session\";\n\nexport const EMAIL_REGEX = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\nconst warnedInvalidRegexSources = new Set<string>();\n\nexport const isEmailValid = (value: string): boolean =>\n EMAIL_REGEX.test(String(value).trim());\n\nconst SLASH_DATE_RE = /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/;\nconst ISO_DATE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\ntype DatePart = \"day\" | \"month\" | \"year\";\n\nconst DATE_FORMAT_SPECS: Record<\n DateDisplayFormat,\n { re: RegExp; order: [DatePart, DatePart, DatePart] }\n> = {\n \"dd/mm/yyyy\": { re: SLASH_DATE_RE, order: [\"day\", \"month\", \"year\"] },\n \"mm/dd/yyyy\": { re: SLASH_DATE_RE, order: [\"month\", \"day\", \"year\"] },\n \"yyyy-mm-dd\": { re: ISO_DATE_RE, order: [\"year\", \"month\", \"day\"] },\n};\n\nconst isValidDateParts = (year: number
|
|
1
|
+
{"version":3,"file":"customFieldValidation.js","sources":["../../../../src/utils/customFieldValidation.ts"],"sourcesContent":["import type { DateDisplayFormat, ListColumn } from \"../types/session\";\nimport { DEFAULT_DATE_DISPLAY_FORMAT } from \"../types/session\";\n\nexport const EMAIL_REGEX = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\nconst warnedInvalidRegexSources = new Set<string>();\n\nexport const isEmailValid = (value: string): boolean =>\n EMAIL_REGEX.test(String(value).trim());\n\nconst SLASH_DATE_RE = /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/;\nconst ISO_DATE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\ntype DatePart = \"day\" | \"month\" | \"year\";\n\nconst DATE_FORMAT_SPECS: Record<\n DateDisplayFormat,\n { re: RegExp; order: [DatePart, DatePart, DatePart] }\n> = {\n \"dd/mm/yyyy\": { re: SLASH_DATE_RE, order: [\"day\", \"month\", \"year\"] },\n \"mm/dd/yyyy\": { re: SLASH_DATE_RE, order: [\"month\", \"day\", \"year\"] },\n \"yyyy-mm-dd\": { re: ISO_DATE_RE, order: [\"year\", \"month\", \"day\"] },\n};\n\nconst isValidDateParts = (\n year: number,\n month: number,\n day: number,\n): boolean => {\n if (\n !Number.isInteger(year) ||\n !Number.isInteger(month) ||\n !Number.isInteger(day)\n ) {\n return false;\n }\n if (year < 1 || month < 1 || month > 12 || day < 1 || day > 31) return false;\n const d = new Date(Date.UTC(year, month - 1, day));\n return (\n d.getUTCFullYear() === year &&\n d.getUTCMonth() === month - 1 &&\n d.getUTCDate() === day\n );\n};\n\nexport const isDateValid = (\n value: string,\n format: DateDisplayFormat = DEFAULT_DATE_DISPLAY_FORMAT,\n): boolean => {\n const v = String(value || \"\").trim();\n if (!v) return false;\n const spec =\n DATE_FORMAT_SPECS[format] ?? DATE_FORMAT_SPECS[DEFAULT_DATE_DISPLAY_FORMAT];\n const m = v.match(spec.re);\n if (!m) return false;\n const parts: Record<DatePart, number> = { day: 0, month: 0, year: 0 };\n spec.order.forEach((part, i) => {\n parts[part] = Number(m[i + 1]);\n });\n return isValidDateParts(parts.year, parts.month, parts.day);\n};\n\nexport const isRegexMatch = (value: string, source: string): boolean => {\n if (!source) return true;\n try {\n return new RegExp(source).test(String(value));\n } catch (error) {\n if (!warnedInvalidRegexSources.has(source)) {\n warnedInvalidRegexSources.add(source);\n console.warn(\n \"[customFieldValidation] Invalid regex; validation was skipped.\",\n source,\n error,\n );\n }\n return true;\n }\n};\n\n/**\n * Resolves the regex for a list cell from another enum cell in the same row.\n * Malformed or incomplete conditional rules deliberately fall back to the\n * column regex so legacy configurations remain usable.\n */\nexport const resolveColumnRegex = (\n col: ListColumn,\n row: Record<string, string> | undefined,\n): { regex: string; errorMessage?: string } => {\n const fallback = {\n regex: typeof col.regex === \"string\" ? col.regex : \"\",\n errorMessage:\n typeof col.regexErrorMessage === \"string\"\n ? col.regexErrorMessage\n : undefined,\n };\n const rules = col.regexRules;\n\n if (\n !rules ||\n typeof rules.sourceColumn !== \"string\" ||\n !rules.sourceColumn ||\n !Array.isArray(rules.cases) ||\n !row\n ) {\n return fallback;\n }\n\n const sourceValue = row[rules.sourceColumn];\n if (typeof sourceValue !== \"string\" || !sourceValue) return fallback;\n\n const matchingCase = rules.cases.find(\n (candidate) =>\n candidate &&\n typeof candidate.value === \"string\" &&\n candidate.value === sourceValue,\n );\n if (!matchingCase || typeof matchingCase.regex !== \"string\") return fallback;\n\n const regex = matchingCase.regex.trim();\n if (!regex) return fallback;\n\n return {\n regex,\n errorMessage:\n typeof matchingCase.errorMessage === \"string\"\n ? matchingCase.errorMessage\n : fallback.errorMessage,\n };\n};\n\nexport const cellErrorKey = (rowIndex: number, columnLabel: string): string =>\n `${rowIndex}::${columnLabel}`;\n"],"names":["DEFAULT_DATE_DISPLAY_FORMAT"],"mappings":";;;;AAGO,IAAM,WAAW,GAAG;AAE3B,IAAM,yBAAyB,GAAG,IAAI,GAAG,EAAU;AAE5C,IAAM,YAAY,GAAG,UAAC,KAAa,EAAA;IACxC,OAAA,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAAtC;AAEF,IAAM,aAAa,GAAG,6BAA6B;AACnD,IAAM,WAAW,GAAG,2BAA2B;AAI/C,IAAM,iBAAiB,GAGnB;AACF,IAAA,YAAY,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE;AACpE,IAAA,YAAY,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE;AACpE,IAAA,YAAY,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,E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|
import '../../context/DocumentContext.js';
|
|
10
10
|
import '../../services/api.js';
|
|
11
11
|
import '../../config/env.js';
|
|
12
|
+
import 'axios';
|
|
12
13
|
import '../../services/auditTrailService.js';
|
|
13
14
|
import 'ua-parser-js';
|
|
14
15
|
import StartIcon from '../icons/StartIcon.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Start.js","sources":["../../../../../src/components/start-flow/Start.tsx"],"sourcesContent":["import { useI18n } from \"../..\";\nimport { SessionData } from \"../../types/session\";\nimport StartIcon from \"../icons/StartIcon\";\nimport Button from \"../ui/Button\";\nimport PageActions from \"../ui/PageActions\";\nimport Subtitle from \"../ui/Subtitle\";\nimport Title from \"../ui/Title\";\nimport MobilePageLayout from \"../ui/MobilePageLayout\";\n\ninterface StartProps {\n setStep: (nubr: number) => void;\n welcomeTitle?: string;\n welcomeSubtitle?: string;\n welcomeDescription?: string;\n welcomeImage?: string;\n session?: SessionData;\n}\n\nconst Start = ({\n setStep,\n welcomeTitle,\n welcomeSubtitle,\n welcomeDescription,\n welcomeImage,\n session,\n}: StartProps) => {\n const { t } = useI18n();\n\n const displayTitle =\n welcomeTitle || t(\"start.welcome_title\", \"Vérifions votre identité\");\n const displaySubtitle =\n welcomeSubtitle ||\n t(\"start.welcome_subtitle\", \"Nous devons vérifier votre identité\");\n const displayDescription =\n welcomeDescription || t(\"start.welcome_description\");\n\n const goOnNextStep = () => {\n setStep(1);\n };\n\n return (\n <MobilePageLayout\n footer={\n <PageActions\n primary={\n <Button onClick={goOnNextStep}>{t(\"start_verification\")}</Button>\n }\n />\n }\n session={session}\n >\n <div className=\"flex flex-col items-center px-4 py-8 md:px-8\">\n <div className=\"w-full max-w-md mx-auto text-center space-y-6 flex flex-col\">\n {/* Icon/Image - shown on top for both mobile and desktop */}\n <div className=\"flex justify-center\">\n {welcomeImage ? (\n <img\n src={welcomeImage}\n alt=\"Welcome image\"\n className=\"max-w-48 w-auto h-auto rounded-lg\"\n />\n ) : (\n <StartIcon className=\"w-48 h-48\" />\n )}\n </div>\n\n {/* Text content */}\n <div className=\"space-y-4\">\n <Title className=\"text-xl md:text-2xl lg:text-3xl\">\n {displayTitle}\n </Title>\n <Subtitle className=\"text-sm md:text-base text-gray-600 leading-relaxed whitespace-pre-line\">\n {displaySubtitle}\n </Subtitle>\n </div>\n\n {/* Terms notice */}\n <div className=\"md:block mt-8\">\n <p className=\"text-xs text-gray-500 leading-relaxed max-w-sm mx-auto whitespace-pre-line\">\n {displayDescription}\n </p>\n </div>\n </div>\n </div>\n </MobilePageLayout>\n );\n};\n\nexport default Start;\n"],"names":["_jsx","_jsxs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Start.js","sources":["../../../../../src/components/start-flow/Start.tsx"],"sourcesContent":["import { useI18n } from \"../..\";\nimport { SessionData } from \"../../types/session\";\nimport StartIcon from \"../icons/StartIcon\";\nimport Button from \"../ui/Button\";\nimport PageActions from \"../ui/PageActions\";\nimport Subtitle from \"../ui/Subtitle\";\nimport Title from \"../ui/Title\";\nimport MobilePageLayout from \"../ui/MobilePageLayout\";\n\ninterface StartProps {\n setStep: (nubr: number) => void;\n welcomeTitle?: string;\n welcomeSubtitle?: string;\n welcomeDescription?: string;\n welcomeImage?: string;\n session?: SessionData;\n}\n\nconst Start = ({\n setStep,\n welcomeTitle,\n welcomeSubtitle,\n welcomeDescription,\n welcomeImage,\n session,\n}: StartProps) => {\n const { t } = useI18n();\n\n const displayTitle =\n welcomeTitle || t(\"start.welcome_title\", \"Vérifions votre identité\");\n const displaySubtitle =\n welcomeSubtitle ||\n t(\"start.welcome_subtitle\", \"Nous devons vérifier votre identité\");\n const displayDescription =\n welcomeDescription || t(\"start.welcome_description\");\n\n const goOnNextStep = () => {\n setStep(1);\n };\n\n return (\n <MobilePageLayout\n footer={\n <PageActions\n primary={\n <Button onClick={goOnNextStep}>{t(\"start_verification\")}</Button>\n }\n />\n }\n session={session}\n >\n <div className=\"flex flex-col items-center px-4 py-8 md:px-8\">\n <div className=\"w-full max-w-md mx-auto text-center space-y-6 flex flex-col\">\n {/* Icon/Image - shown on top for both mobile and desktop */}\n <div className=\"flex justify-center\">\n {welcomeImage ? (\n <img\n src={welcomeImage}\n alt=\"Welcome image\"\n className=\"max-w-48 w-auto h-auto rounded-lg\"\n />\n ) : (\n <StartIcon className=\"w-48 h-48\" />\n )}\n </div>\n\n {/* Text content */}\n <div className=\"space-y-4\">\n <Title className=\"text-xl md:text-2xl lg:text-3xl\">\n {displayTitle}\n </Title>\n <Subtitle className=\"text-sm md:text-base text-gray-600 leading-relaxed whitespace-pre-line\">\n {displaySubtitle}\n </Subtitle>\n </div>\n\n {/* Terms notice */}\n <div className=\"md:block mt-8\">\n <p className=\"text-xs text-gray-500 leading-relaxed max-w-sm mx-auto whitespace-pre-line\">\n {displayDescription}\n </p>\n </div>\n </div>\n </div>\n </MobilePageLayout>\n );\n};\n\nexport default Start;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAM,KAAK,GAAG,UAAC,EAOF,EAAA;AANX,IAAA,IAAA,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,kBAAkB,wBAAA,EAClB,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,OAAO,GAAA,EAAA,CAAA,OAAA;AAEC,IAAA,IAAA,CAAC,GAAK,OAAO,EAAE,EAAd;IAET,IAAM,YAAY,GAChB,YAAY,IAAI,CAAC,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IACtE,IAAM,eAAe,GACnB,eAAe;AACf,QAAA,CAAC,CAAC,wBAAwB,EAAE,qCAAqC,CAAC;IACpE,IAAM,kBAAkB,GACtB,kBAAkB,IAAI,CAAC,CAAC,2BAA2B,CAAC;AAEtD,IAAA,IAAM,YAAY,GAAG,YAAA;QACnB,OAAO,CAAC,C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{ jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { useI18n } from '../../hooks/useI18n.js';
|
|
4
|
+
import { checkComplementaryMandate } from '../../services/sessionService.js';
|
|
5
|
+
import LoadingState from '../states/LoadingState.js';
|
|
6
|
+
import Button from '../ui/Button.js';
|
|
7
|
+
|
|
8
|
+
function ComplementaryMandateNodeHandler(_a) {
|
|
9
|
+
var sessionId = _a.sessionId, nodeId = _a.nodeId, onOutcome = _a.onOutcome;
|
|
10
|
+
var t = useI18n().t;
|
|
11
|
+
var _b = useState(false), error = _b[0], setError = _b[1];
|
|
12
|
+
var _c = useState(0), attempt = _c[0], setAttempt = _c[1];
|
|
13
|
+
var callback = useRef(onOutcome);
|
|
14
|
+
callback.current = onOutcome;
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
var active = true;
|
|
17
|
+
setError(false);
|
|
18
|
+
checkComplementaryMandate(sessionId, nodeId).then(function (_a) {
|
|
19
|
+
var outcome = _a.outcome;
|
|
20
|
+
if (active)
|
|
21
|
+
callback.current(outcome);
|
|
22
|
+
}).catch(function () { if (active)
|
|
23
|
+
setError(true); });
|
|
24
|
+
return function () { active = false; };
|
|
25
|
+
}, [sessionId, nodeId, attempt]);
|
|
26
|
+
if (!error)
|
|
27
|
+
return jsx(LoadingState, { message: t('complementary_mandate.loading') });
|
|
28
|
+
return jsxs("div", { className: "flex flex-col items-center gap-4 p-6", children: [jsx("p", { role: "alert", children: t('complementary_mandate.error') }), jsx(Button, { onClick: function () { return setAttempt(function (value) { return value + 1; }); }, children: t('complementary_mandate.retry') })] });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { ComplementaryMandateNodeHandler as default };
|
|
32
|
+
//# sourceMappingURL=ComplementaryMandateNodeHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComplementaryMandateNodeHandler.js","sources":["../../../../../src/components/template/ComplementaryMandateNodeHandler.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { useI18n } from '../../hooks/useI18n';\nimport { checkComplementaryMandate } from '../../services/sessionService';\nimport type { ComplementaryMandateOutcome } from '../../types/session';\nimport LoadingState from '../states/LoadingState';\nimport Button from '../ui/Button';\n\nexport default function ComplementaryMandateNodeHandler({ sessionId, nodeId, onOutcome }: { sessionId: string; nodeId: string; onOutcome: (outcome: ComplementaryMandateOutcome) => void }) {\n const { t } = useI18n();\n const [error, setError] = useState(false);\n const [attempt, setAttempt] = useState(0);\n const callback = useRef(onOutcome);\n callback.current = onOutcome;\n useEffect(() => {\n let active = true;\n setError(false);\n checkComplementaryMandate(sessionId, nodeId).then(({ outcome }) => {\n if (active) callback.current(outcome);\n }).catch(() => { if (active) setError(true); });\n return () => { active = false; };\n }, [sessionId, nodeId, attempt]);\n if (!error) return <LoadingState message={t('complementary_mandate.loading')} />;\n return <div className=\"flex flex-col items-center gap-4 p-6\">\n <p role=\"alert\">{t('complementary_mandate.error')}</p>\n <Button onClick={() => setAttempt(value => value + 1)}>{t('complementary_mandate.retry')}</Button>\n </div>;\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;AAOc,SAAU,+BAA+B,CAAC,EAAkI,EAAA;AAAhI,IAAA,IAAA,SAAS,eAAA,EAAE,MAAM,GAAA,EAAA,CAAA,MAAA,EAAE,SAAS,GAAA,EAAA,CAAA,SAAA;AAC5E,IAAA,IAAA,CAAC,GAAK,OAAO,EAAE,EAAd;IACH,IAAA,EAAA,GAAoB,QAAQ,CAAC,KAAK,CAAC,EAAlC,KAAK,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,QAAQ,GAAA,EAAA,CAAA,CAAA,CAAmB;IACnC,IAAA,EAAA,GAAwB,QAAQ,CAAC,CAAC,CAAC,EAAlC,OAAO,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,UAAU,GAAA,EAAA,CAAA,CAAA,CAAe;AACzC,IAAA,IAAM,QAAQ,GAAG,MAAM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{ jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import ComplementaryMandateNodeHandler from './ComplementaryMandateNodeHandler.js';
|
|
3
4
|
import { useMemo } from 'react';
|
|
4
5
|
import Selfie from '../session/Selfie.js';
|
|
5
6
|
import VideoWorkInProgress from '../session/VideoWorkInProgress.js';
|
|
@@ -123,6 +124,8 @@ var TemplateNodeRenderer = function (_a) {
|
|
|
123
124
|
case "condition":
|
|
124
125
|
console.debug("🔀 Rendering Condition Node Handler component and well");
|
|
125
126
|
return (jsx(ConditionNodeHandler, { node: node, session: session, templateNodes: templateNodes, stepObject: stepObject, userInput: userInput, contactInfo: contactInfo }));
|
|
127
|
+
case "complementary-mandate":
|
|
128
|
+
return jsx(ComplementaryMandateNodeHandler, { sessionId: sessionId, nodeId: node.id, onOutcome: function (outcome) { return stepObject.goToNextStep(node.id, session.template, outcome); } });
|
|
126
129
|
case "external-verification":
|
|
127
130
|
console.debug("🔍 Rendering External Verification Node Handler");
|
|
128
131
|
return (jsx(ExternalVerificationNodeHandler, { node: node, session: session, userInput: userInput, setUserInput: setUserInput, onNext: function () { return stepObject.goToNextStep(node.id, session.template); }, onPrevious: function () { return stepObject.goBack(); }, onNavigateToNode: function (nodeId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateNodeRenderer.js","sources":["../../../../../src/components/template/TemplateNodeRenderer.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport Selfie from \"../session/Selfie\";\nimport VideoWorkInProgress from \"../session/VideoWorkInProgress\";\nimport DocumentCheck, { NodeIdentityControl } from \"../session/DocumentCheck\";\nimport DocumentCollection, {\n DocumentTypeSide,\n NodeDocumentCollection,\n} from \"../document-collection/DocumentCollection\";\nimport EndFlow from \"../session/EndFlow\";\nimport LoadingState from \"../states/LoadingState\";\nimport JDDWorkInProgress from \"../jdi/JDDWorkInProgress\";\nimport { getOrderedJourneySteps, getRunPrefillData } from \"../../services/sessionService\";\nimport type { SessionData, stepObject } from \"../../types/session\";\nimport type { UserInput } from \"../../types/userInput\";\nimport type { ContactInfo } from \"../../types/contactInfo\";\nimport UserInputForm from \"../session/UserInputForm\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport ConditionNodeHandler from \"./ConditionNodeHandler\";\nimport SignatureElectronic from \"../signature-electronic/SignatureElectronic\";\nimport ExternalVerificationNodeHandler from \"./ExternalVerificationNodeHandler\";\nimport PdfGeneration from \"../session/PdfGeneration\";\nimport LegalConsentNode from \"../legal-consent/LegalConsentNode\";\n\ninterface TemplateNodeRendererProps {\n session: SessionData;\n sessionId: string;\n stepObject: stepObject;\n stepHistory: number[];\n templateIndex: number;\n onContinueOnPC: () => void;\n userInput: UserInput;\n setUserInput: React.Dispatch<React.SetStateAction<UserInput>>;\n contactInfo: ContactInfo;\n setContactInfo: React.Dispatch<React.SetStateAction<ContactInfo>>;\n isMobileTemplate: boolean;\n}\n\nconst TemplateNodeRenderer: React.FC<TemplateNodeRendererProps> = ({\n session,\n sessionId,\n stepObject,\n stepHistory,\n templateIndex,\n onContinueOnPC,\n userInput,\n setUserInput,\n contactInfo,\n setContactInfo,\n isMobileTemplate,\n}) => {\n const { t } = useI18n();\n\n if (!session?.template) {\n console.error(t(\"template.error.console_no_template\"));\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(\"template.error.configuration\")}\n </h2>\n <p className=\"text-gray-600 mb-4\">{t(\"template.error.no_template\")}</p>\n </div>\n );\n }\n\n // Check if session is ended before rendering nodes\n if (session.status === \"ended\") {\n return (\n <EndFlow\n sessionId={sessionId}\n sessionStatus={session.status}\n callbackURL={session.callbackURL}\n compliantCase={session.template?.endScreenConfig?.compliant}\n nonCompliantCase={session.template?.endScreenConfig?.nonCompliant}\n />\n );\n }\n\n // Use getOrderedWorkflowSteps to get sorted and filtered nodes\n const templateNodes = useMemo(\n () => getOrderedJourneySteps(session.template),\n [session.template],\n );\n\n // Check if index is valid\n if (templateNodes.length === 0) {\n console.warn(\"No valid template nodes found after filtering\");\n return (\n <EndFlow\n sessionId={sessionId}\n sessionStatus={session?.status}\n callbackURL={session?.callbackURL}\n />\n );\n }\n\n if (templateIndex < 0 || templateIndex >= templateNodes.length) {\n console.warn(\n `Invalid template index: ${templateIndex}, max index: ${templateNodes.length - 1\n }`,\n );\n\n // If we're beyond the maximum index, it means we've completed all nodes\n if (templateIndex >= templateNodes.length) {\n return (\n <EndFlow\n sessionId={sessionId}\n sessionStatus={session?.status}\n callbackURL={session?.callbackURL}\n compliantCase={session?.template?.endScreenConfig?.compliant}\n nonCompliantCase={session?.template?.endScreenConfig?.nonCompliant}\n />\n );\n }\n\n // If index is negative, redirect to start\n if (templateIndex < 0) {\n setTimeout(() => stepObject.setStep(0), 0);\n return <LoadingState message={t(\"loading.step\")} subtitle=\"\" />;\n }\n }\n\n // At this point, we should have a valid node\n const node = templateNodes[templateIndex];\n if (!node) {\n console.error(\n `Node at index ${templateIndex} is undefined. Available nodes:`,\n templateNodes,\n );\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(\"template.error.render\")}\n </h2>\n <p className=\"text-gray-600 mb-4\">\n {t(\"template.error.node_not_found\")}\n </p>\n <button\n className=\"px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors\"\n onClick={() => stepObject.setStep(0)}\n >\n {t(\"template.buttons.restart\")}\n </button>\n </div>\n );\n }\n\n switch (node.type) {\n case \"end\":\n console.log(\"📄 Rendering EndFlow component\");\n return (\n <EndFlow\n sessionId={sessionId}\n sessionStatus={session?.status}\n callbackURL={session?.callbackURL}\n endNodeId={node.id}\n expectedResult={node.expectedResult}\n compliantCase={session?.template?.endScreenConfig?.compliant}\n nonCompliantCase={session?.template?.endScreenConfig?.nonCompliant}\n />\n );\n\n case \"information-input\": {\n // runIndex = nombre de fois que ce step a déjà été visité dans l'historique\n // (0 = premier passage, 1 = deuxième, …).\n // On compte les occurrences de (templateIndex + 1) dans stepHistory,\n // minus 1 car le step courant est déjà dans l'historique.\n const currentStep = templateIndex + 1;\n const visitCount = stepHistory.filter((s) => s === currentStep).length;\n const runIndex = Math.max(0, visitCount - 1);\n\n // Pré-remplissage multi-ENTITÉS : si _list présent, utiliser _list[runIndex]\n // (ou {} hors borne). L'énumération de plusieurs entités successives passe\n // exclusivement par _list (cf. docs/multi-runs.md).\n // Sans _list : on pré-remplit TOUJOURS depuis le userInput persisté — y compris\n // sur une ré-entrée (boucle condition de correction, retour arrière, bouton\n // \"Corriger ma saisie\"). Une ré-entrée sans _list = corriger les MÊMES données,\n // pas en saisir de nouvelles → on ne doit pas vider le formulaire.\n const hasList = Array.isArray(\n (session.userInput as Record<string, unknown>)?._list,\n );\n let initialUserInput: UserInput;\n if (hasList) {\n const prefill = getRunPrefillData(\n session.userInput as Record<string, unknown>,\n runIndex,\n );\n initialUserInput = (prefill ?? {}) as UserInput;\n } else {\n initialUserInput = userInput;\n }\n return (\n // key={node.id} : remonte le formulaire à chaque changement de nœud, pour\n // qu'il se ré-initialise depuis initialUserInput (comportement \"refresh sans\n // refresh\"). Évite la réutilisation d'instance qui laissait customFormData\n // périmé au retour arrière entre deux nœuds information-input.\n <UserInputForm\n key={node.id}\n stepObject={stepObject}\n node={node}\n template={session.template}\n setUserInput={setUserInput}\n initialUserInput={initialUserInput}\n contactInfo={contactInfo}\n setContactInfo={setContactInfo}\n sessionId={sessionId}\n />\n );\n }\n\n case \"document-collection\": {\n return (\n <DocumentCollection\n key={`doc-collection-${templateIndex}`}\n node={node as NodeDocumentCollection}\n stepObject={stepObject}\n sessionId={sessionId}\n template={session.template}\n onContinueOnPC={onContinueOnPC}\n allowedDocumentTypes={(node.allowedDocumentTypes || []).map(\n (docType: any) => ({\n ...docType,\n side:\n typeof docType.side === \"string\" ||\n typeof docType.side === \"number\"\n ? (docType.side as DocumentTypeSide)\n : undefined,\n }),\n )}\n allowedAddingMethods={node.allowedAddingMethods || [\"download\"]}\n introductionPage={node.introductionPage}\n documentSelection={node.documentSelection}\n allowResubmission={node.allowResubmission}\n maxResubmissionAttempts={node.maxResubmissionAttempts}\n />\n );\n }\n\n case \"document-selection\":\n case \"controle-jdi\": {\n if (!node.requiredDocumentType) {\n console.error(\n \"Missing requiredDocumentType in document-selection node:\",\n node,\n );\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 Erreur de configuration\n </h2>\n <p className=\"text-gray-600 mb-4\">\n Le type de document requis n'est pas spécifié dans le template.\n </p>\n <button\n className=\"px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors\"\n onClick={() => stepObject.setStep(0)}\n >\n Recommencer\n </button>\n </div>\n );\n }\n\n // Determine if current device is mobile for capture method\n const isMobile =\n /Android|iPhone|iPad|iPod|Opera Mini|IEMobile|WPDesktop/i.test(\n navigator.userAgent,\n );\n\n return (\n <DocumentCheck\n key={`doc-check-${templateIndex}`}\n stepObject={stepObject}\n node={node as NodeIdentityControl}\n sessionId={sessionId}\n documentTypeId={node.requiredDocumentType}\n acceptedCountries={node.acceptedCountries}\n onContinueOnPC={onContinueOnPC}\n isMobileCapture={isMobileTemplate && isMobile}\n allowedAddingMethods={\n node.allowedAddingMethods || [\"download\", \"picture\"]\n }\n template={session.template}\n templateIndex={templateIndex}\n setUserInput={setUserInput}\n />\n );\n // }\n }\n\n case \"biometric-capture\":\n case \"selfie-capture\":\n return (\n <Selfie\n key={`selfie-${templateIndex}`}\n stepObject={stepObject}\n sessionId={sessionId}\n node={node}\n template={session.template}\n />\n );\n\n case \"signature-electronic\":\n return (\n <SignatureElectronic\n key={`signature-${templateIndex}`}\n sessionId={sessionId}\n stepObject={stepObject}\n node={node}\n session={session}\n title={node.title}\n description={node.description}\n // Always pass a stable node identifier so backend can resolve\n // either a static DocuSeal template OR a generated PDF source.\n external_id={node.templateId || node.external_id || node.id}\n fieldMappings={node.fieldMappings}\n userInput={userInput}\n contactInfo={contactInfo}\n />\n );\n\n case \"video-capture\":\n console.log(\"🎥 Rendering Video Work in Progress component\");\n return <VideoWorkInProgress onContinue={onContinueOnPC} />;\n\n case \"jdd\":\n console.log(\"🚧 Rendering JDD Work in Progress component\");\n return <JDDWorkInProgress onContinue={onContinueOnPC} />;\n\n case \"condition\":\n console.debug(\"🔀 Rendering Condition Node Handler component and well\");\n return (\n <ConditionNodeHandler\n node={node}\n session={session}\n templateNodes={templateNodes}\n stepObject={stepObject}\n userInput={userInput}\n contactInfo={contactInfo}\n />\n );\n\n case \"external-verification\":\n console.debug(\"🔍 Rendering External Verification Node Handler\");\n return (\n <ExternalVerificationNodeHandler\n node={node}\n session={session}\n userInput={userInput}\n setUserInput={setUserInput}\n onNext={() => stepObject.goToNextStep(node.id, session.template)}\n onPrevious={() => stepObject.goBack()}\n onNavigateToNode={(nodeId: string) => {\n const idx = templateNodes.findIndex((n: any) => n.id === nodeId);\n // idx est 0-based, les steps sont 1-based → idx + 1.\n // goBackToStep tronque l'historique pour que le nœud corrigé\n // redevienne runIndex 0 (formulaire pré-rempli).\n if (idx !== -1) stepObject.goBackToStep(idx + 1);\n else stepObject.goBack();\n }}\n />\n );\n\n case \"pdf-generation\":\n console.debug(\"📄 Rendering PDF Generation component\");\n return (\n <PdfGeneration\n key={`pdf-generation-${templateIndex}`}\n node={node}\n session={session}\n sessionId={sessionId}\n stepObject={stepObject}\n userInput={userInput}\n />\n );\n\n case \"legal-consent\":\n return (\n <LegalConsentNode\n node={node}\n session={session}\n sessionId={sessionId}\n stepObject={stepObject}\n />\n );\n\n case \"custom\":\n // For custom nodes, we provide a basic structure that can be extended\n return (\n <div className=\"flex flex-col items-center justify-center h-full p-4 text-center\">\n <div className=\"text-blue-500 text-4xl mb-4\">🔧</div>\n <h2 className=\"text-xl font-bold text-blue-600 mb-2\">\n Nœud personnalisé\n </h2>\n <p className=\"text-gray-600 mb-4\">\n Implémentation personnalisée requise pour: \"{node.title || node.id}\"\n </p>\n <div className=\"bg-blue-50 border border-blue-200 rounded p-3 text-left text-sm mb-4 max-w-md\">\n <p className=\"font-semibold text-blue-700 mb-2\">\n Configuration du nœud:\n </p>\n <pre className=\"text-xs overflow-auto max-h-32\">\n {JSON.stringify(\n {\n id: node.id,\n title: node.title,\n description: node.description,\n options: node.options,\n selectedOptions: node.selectedOptions,\n },\n null,\n 2,\n )}\n </pre>\n </div>\n <button\n className=\"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors\"\n onClick={() => {\n console.log(\"Custom node action:\", node);\n stepObject.goToNextStep(node.id, session.template);\n }}\n >\n {t(\"template.buttons.continue\")}\n </button>\n </div>\n );\n\n default:\n console.warn(`❌ Type de nœud non supporté: ${node.type}`, node);\n console.log(\"❓ Available supported types:\", [\n \"end\",\n \"information-input\",\n \"document-collection\",\n \"document-selection\",\n \"document-upload\",\n \"controle-jdi\",\n \"selfie-capture\",\n \"video-capture\",\n \"country-selection\",\n \"identity-control\",\n \"jdd\",\n \"condition\",\n \"custom\",\n ]);\n return (\n <div className=\"flex flex-col items-center justify-center h-full p-4 text-center\">\n <div className=\"text-yellow-500 text-4xl mb-4\">⚠️</div>\n <h2 className=\"text-xl font-bold text-yellow-600 mb-2\">\n Étape non supportée\n </h2>\n <p className=\"text-gray-600 mb-4\">\n Le type d'étape \"{node.type}\" n'est pas pris en charge.\n </p>\n <div className=\"bg-gray-100 p-4 rounded mb-4 text-left text-xs overflow-auto max-h-32\">\n <pre>{JSON.stringify(node, null, 2)}</pre>\n </div>\n <button\n className=\"px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors\"\n onClick={() => {\n stepObject.goToNextStep(node.id, session.template);\n }}\n >\n {t(\"template.buttons.continue\")}\n </button>\n </div>\n );\n }\n};\n\nexport default TemplateN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CAAC,GAAG,CAAC,8BAA8B,EAAE;gBAC1C,KAAK;gBACL,mBAAmB;gBACnB,qBAAqB;gBACrB,oBAAoB;gBACpB,iBAAiB;gBACjB,cAAc;gBACd,gBAAgB;gBAChB,eAAe;gBACf,mBAAmB;gBACnB,kBAAkB;gBAClB,KAAK;gBACL,WAAW;gBACX,QAAQ;AACT,aAAA,CAAC;YACF,QACED,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kEAAkE,aAC/EC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,+BAA+B,EAAA,QAAA,EAAA,cAAA,EAAA,CAAS,EACvDA,YAAI,SAAS,EAAC,wCAAwC,EAAA,QAAA,EAAA,+BAAA,EAAA,CAEjD,EACLD,IAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,oBAAoB,EAAA,QAAA,EAAA,CAAA,yBAAA,EACb,IAAI,CAAC,IAAI,oCACzB,EACJC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,uEAAuE,EAAA,QAAA,EACpFA,uBAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAA,CAAO,EAAA,CACtC,EACNA,GAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAC,iFAAiF,EAC3F,OAAO,EAAE,YAAA;4BACP,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC;wBACpD,CAAC,EAAA,QAAA,EAEA,CAAC,CAAC,2BAA2B,CAAC,EAAA,CACxB,CAAA,EAAA,CACL;;AAGd;;;;"}
|
|
1
|
+
{"version":3,"file":"TemplateNodeRenderer.js","sources":["../../../../../src/components/template/TemplateNodeRenderer.tsx"],"sourcesContent":["import ComplementaryMandateNodeHandler from './ComplementaryMandateNodeHandler';\nimport React, { useMemo } from \"react\";\nimport Selfie from \"../session/Selfie\";\nimport VideoWorkInProgress from \"../session/VideoWorkInProgress\";\nimport DocumentCheck, { NodeIdentityControl } from \"../session/DocumentCheck\";\nimport DocumentCollection, {\n DocumentTypeSide,\n NodeDocumentCollection,\n} from \"../document-collection/DocumentCollection\";\nimport EndFlow from \"../session/EndFlow\";\nimport LoadingState from \"../states/LoadingState\";\nimport JDDWorkInProgress from \"../jdi/JDDWorkInProgress\";\nimport { getOrderedJourneySteps, getRunPrefillData } from \"../../services/sessionService\";\nimport type { SessionData, stepObject } from \"../../types/session\";\nimport type { UserInput } from \"../../types/userInput\";\nimport type { ContactInfo } from \"../../types/contactInfo\";\nimport UserInputForm from \"../session/UserInputForm\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport ConditionNodeHandler from \"./ConditionNodeHandler\";\nimport SignatureElectronic from \"../signature-electronic/SignatureElectronic\";\nimport ExternalVerificationNodeHandler from \"./ExternalVerificationNodeHandler\";\nimport PdfGeneration from \"../session/PdfGeneration\";\nimport LegalConsentNode from \"../legal-consent/LegalConsentNode\";\n\ninterface TemplateNodeRendererProps {\n session: SessionData;\n sessionId: string;\n stepObject: stepObject;\n stepHistory: number[];\n templateIndex: number;\n onContinueOnPC: () => void;\n userInput: UserInput;\n setUserInput: React.Dispatch<React.SetStateAction<UserInput>>;\n contactInfo: ContactInfo;\n setContactInfo: React.Dispatch<React.SetStateAction<ContactInfo>>;\n isMobileTemplate: boolean;\n}\n\nconst TemplateNodeRenderer: React.FC<TemplateNodeRendererProps> = ({\n session,\n sessionId,\n stepObject,\n stepHistory,\n templateIndex,\n onContinueOnPC,\n userInput,\n setUserInput,\n contactInfo,\n setContactInfo,\n isMobileTemplate,\n}) => {\n const { t } = useI18n();\n\n if (!session?.template) {\n console.error(t(\"template.error.console_no_template\"));\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(\"template.error.configuration\")}\n </h2>\n <p className=\"text-gray-600 mb-4\">{t(\"template.error.no_template\")}</p>\n </div>\n );\n }\n\n // Check if session is ended before rendering nodes\n if (session.status === \"ended\") {\n return (\n <EndFlow\n sessionId={sessionId}\n sessionStatus={session.status}\n callbackURL={session.callbackURL}\n compliantCase={session.template?.endScreenConfig?.compliant}\n nonCompliantCase={session.template?.endScreenConfig?.nonCompliant}\n />\n );\n }\n\n // Use getOrderedWorkflowSteps to get sorted and filtered nodes\n const templateNodes = useMemo(\n () => getOrderedJourneySteps(session.template),\n [session.template],\n );\n\n // Check if index is valid\n if (templateNodes.length === 0) {\n console.warn(\"No valid template nodes found after filtering\");\n return (\n <EndFlow\n sessionId={sessionId}\n sessionStatus={session?.status}\n callbackURL={session?.callbackURL}\n />\n );\n }\n\n if (templateIndex < 0 || templateIndex >= templateNodes.length) {\n console.warn(\n `Invalid template index: ${templateIndex}, max index: ${templateNodes.length - 1\n }`,\n );\n\n // If we're beyond the maximum index, it means we've completed all nodes\n if (templateIndex >= templateNodes.length) {\n return (\n <EndFlow\n sessionId={sessionId}\n sessionStatus={session?.status}\n callbackURL={session?.callbackURL}\n compliantCase={session?.template?.endScreenConfig?.compliant}\n nonCompliantCase={session?.template?.endScreenConfig?.nonCompliant}\n />\n );\n }\n\n // If index is negative, redirect to start\n if (templateIndex < 0) {\n setTimeout(() => stepObject.setStep(0), 0);\n return <LoadingState message={t(\"loading.step\")} subtitle=\"\" />;\n }\n }\n\n // At this point, we should have a valid node\n const node = templateNodes[templateIndex];\n if (!node) {\n console.error(\n `Node at index ${templateIndex} is undefined. Available nodes:`,\n templateNodes,\n );\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(\"template.error.render\")}\n </h2>\n <p className=\"text-gray-600 mb-4\">\n {t(\"template.error.node_not_found\")}\n </p>\n <button\n className=\"px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors\"\n onClick={() => stepObject.setStep(0)}\n >\n {t(\"template.buttons.restart\")}\n </button>\n </div>\n );\n }\n\n switch (node.type) {\n case \"end\":\n console.log(\"📄 Rendering EndFlow component\");\n return (\n <EndFlow\n sessionId={sessionId}\n sessionStatus={session?.status}\n callbackURL={session?.callbackURL}\n endNodeId={node.id}\n expectedResult={node.expectedResult}\n compliantCase={session?.template?.endScreenConfig?.compliant}\n nonCompliantCase={session?.template?.endScreenConfig?.nonCompliant}\n />\n );\n\n case \"information-input\": {\n // runIndex = nombre de fois que ce step a déjà été visité dans l'historique\n // (0 = premier passage, 1 = deuxième, …).\n // On compte les occurrences de (templateIndex + 1) dans stepHistory,\n // minus 1 car le step courant est déjà dans l'historique.\n const currentStep = templateIndex + 1;\n const visitCount = stepHistory.filter((s) => s === currentStep).length;\n const runIndex = Math.max(0, visitCount - 1);\n\n // Pré-remplissage multi-ENTITÉS : si _list présent, utiliser _list[runIndex]\n // (ou {} hors borne). L'énumération de plusieurs entités successives passe\n // exclusivement par _list (cf. docs/multi-runs.md).\n // Sans _list : on pré-remplit TOUJOURS depuis le userInput persisté — y compris\n // sur une ré-entrée (boucle condition de correction, retour arrière, bouton\n // \"Corriger ma saisie\"). Une ré-entrée sans _list = corriger les MÊMES données,\n // pas en saisir de nouvelles → on ne doit pas vider le formulaire.\n const hasList = Array.isArray(\n (session.userInput as Record<string, unknown>)?._list,\n );\n let initialUserInput: UserInput;\n if (hasList) {\n const prefill = getRunPrefillData(\n session.userInput as Record<string, unknown>,\n runIndex,\n );\n initialUserInput = (prefill ?? {}) as UserInput;\n } else {\n initialUserInput = userInput;\n }\n return (\n // key={node.id} : remonte le formulaire à chaque changement de nœud, pour\n // qu'il se ré-initialise depuis initialUserInput (comportement \"refresh sans\n // refresh\"). Évite la réutilisation d'instance qui laissait customFormData\n // périmé au retour arrière entre deux nœuds information-input.\n <UserInputForm\n key={node.id}\n stepObject={stepObject}\n node={node}\n template={session.template}\n setUserInput={setUserInput}\n initialUserInput={initialUserInput}\n contactInfo={contactInfo}\n setContactInfo={setContactInfo}\n sessionId={sessionId}\n />\n );\n }\n\n case \"document-collection\": {\n return (\n <DocumentCollection\n key={`doc-collection-${templateIndex}`}\n node={node as NodeDocumentCollection}\n stepObject={stepObject}\n sessionId={sessionId}\n template={session.template}\n onContinueOnPC={onContinueOnPC}\n allowedDocumentTypes={(node.allowedDocumentTypes || []).map(\n (docType: any) => ({\n ...docType,\n side:\n typeof docType.side === \"string\" ||\n typeof docType.side === \"number\"\n ? (docType.side as DocumentTypeSide)\n : undefined,\n }),\n )}\n allowedAddingMethods={node.allowedAddingMethods || [\"download\"]}\n introductionPage={node.introductionPage}\n documentSelection={node.documentSelection}\n allowResubmission={node.allowResubmission}\n maxResubmissionAttempts={node.maxResubmissionAttempts}\n />\n );\n }\n\n case \"document-selection\":\n case \"controle-jdi\": {\n if (!node.requiredDocumentType) {\n console.error(\n \"Missing requiredDocumentType in document-selection node:\",\n node,\n );\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 Erreur de configuration\n </h2>\n <p className=\"text-gray-600 mb-4\">\n Le type de document requis n'est pas spécifié dans le template.\n </p>\n <button\n className=\"px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors\"\n onClick={() => stepObject.setStep(0)}\n >\n Recommencer\n </button>\n </div>\n );\n }\n\n // Determine if current device is mobile for capture method\n const isMobile =\n /Android|iPhone|iPad|iPod|Opera Mini|IEMobile|WPDesktop/i.test(\n navigator.userAgent,\n );\n\n return (\n <DocumentCheck\n key={`doc-check-${templateIndex}`}\n stepObject={stepObject}\n node={node as NodeIdentityControl}\n sessionId={sessionId}\n documentTypeId={node.requiredDocumentType}\n acceptedCountries={node.acceptedCountries}\n onContinueOnPC={onContinueOnPC}\n isMobileCapture={isMobileTemplate && isMobile}\n allowedAddingMethods={\n node.allowedAddingMethods || [\"download\", \"picture\"]\n }\n template={session.template}\n templateIndex={templateIndex}\n setUserInput={setUserInput}\n />\n );\n // }\n }\n\n case \"biometric-capture\":\n case \"selfie-capture\":\n return (\n <Selfie\n key={`selfie-${templateIndex}`}\n stepObject={stepObject}\n sessionId={sessionId}\n node={node}\n template={session.template}\n />\n );\n\n case \"signature-electronic\":\n return (\n <SignatureElectronic\n key={`signature-${templateIndex}`}\n sessionId={sessionId}\n stepObject={stepObject}\n node={node}\n session={session}\n title={node.title}\n description={node.description}\n // Always pass a stable node identifier so backend can resolve\n // either a static DocuSeal template OR a generated PDF source.\n external_id={node.templateId || node.external_id || node.id}\n fieldMappings={node.fieldMappings}\n userInput={userInput}\n contactInfo={contactInfo}\n />\n );\n\n case \"video-capture\":\n console.log(\"🎥 Rendering Video Work in Progress component\");\n return <VideoWorkInProgress onContinue={onContinueOnPC} />;\n\n case \"jdd\":\n console.log(\"🚧 Rendering JDD Work in Progress component\");\n return <JDDWorkInProgress onContinue={onContinueOnPC} />;\n\n case \"condition\":\n console.debug(\"🔀 Rendering Condition Node Handler component and well\");\n return (\n <ConditionNodeHandler\n node={node}\n session={session}\n templateNodes={templateNodes}\n stepObject={stepObject}\n userInput={userInput}\n contactInfo={contactInfo}\n />\n );\n\n case \"complementary-mandate\":\n return <ComplementaryMandateNodeHandler sessionId={sessionId} nodeId={node.id} onOutcome={outcome => stepObject.goToNextStep(node.id, session.template, outcome)} />;\n\n case \"external-verification\":\n console.debug(\"🔍 Rendering External Verification Node Handler\");\n return (\n <ExternalVerificationNodeHandler\n node={node}\n session={session}\n userInput={userInput}\n setUserInput={setUserInput}\n onNext={() => stepObject.goToNextStep(node.id, session.template)}\n onPrevious={() => stepObject.goBack()}\n onNavigateToNode={(nodeId: string) => {\n const idx = templateNodes.findIndex((n: any) => n.id === nodeId);\n // idx est 0-based, les steps sont 1-based → idx + 1.\n // goBackToStep tronque l'historique pour que le nœud corrigé\n // redevienne runIndex 0 (formulaire pré-rempli).\n if (idx !== -1) stepObject.goBackToStep(idx + 1);\n else stepObject.goBack();\n }}\n />\n );\n\n case \"pdf-generation\":\n console.debug(\"📄 Rendering PDF Generation component\");\n return (\n <PdfGeneration\n key={`pdf-generation-${templateIndex}`}\n node={node}\n session={session}\n sessionId={sessionId}\n stepObject={stepObject}\n userInput={userInput}\n />\n );\n\n case \"legal-consent\":\n return (\n <LegalConsentNode\n node={node}\n session={session}\n sessionId={sessionId}\n stepObject={stepObject}\n />\n );\n\n case \"custom\":\n // For custom nodes, we provide a basic structure that can be extended\n return (\n <div className=\"flex flex-col items-center justify-center h-full p-4 text-center\">\n <div className=\"text-blue-500 text-4xl mb-4\">🔧</div>\n <h2 className=\"text-xl font-bold text-blue-600 mb-2\">\n Nœud personnalisé\n </h2>\n <p className=\"text-gray-600 mb-4\">\n Implémentation personnalisée requise pour: \"{node.title || node.id}\"\n </p>\n <div className=\"bg-blue-50 border border-blue-200 rounded p-3 text-left text-sm mb-4 max-w-md\">\n <p className=\"font-semibold text-blue-700 mb-2\">\n Configuration du nœud:\n </p>\n <pre className=\"text-xs overflow-auto max-h-32\">\n {JSON.stringify(\n {\n id: node.id,\n title: node.title,\n description: node.description,\n options: node.options,\n selectedOptions: node.selectedOptions,\n },\n null,\n 2,\n )}\n </pre>\n </div>\n <button\n className=\"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors\"\n onClick={() => {\n console.log(\"Custom node action:\", node);\n stepObject.goToNextStep(node.id, session.template);\n }}\n >\n {t(\"template.buttons.continue\")}\n </button>\n </div>\n );\n\n default:\n console.warn(`❌ Type de nœud non supporté: ${node.type}`, node);\n console.log(\"❓ Available supported types:\", [\n \"end\",\n \"information-input\",\n \"document-collection\",\n \"document-selection\",\n \"document-upload\",\n \"controle-jdi\",\n \"selfie-capture\",\n \"video-capture\",\n \"country-selection\",\n \"identity-control\",\n \"jdd\",\n \"condition\",\n \"custom\",\n ]);\n return (\n <div className=\"flex flex-col items-center justify-center h-full p-4 text-center\">\n <div className=\"text-yellow-500 text-4xl mb-4\">⚠️</div>\n <h2 className=\"text-xl font-bold text-yellow-600 mb-2\">\n Étape non supportée\n </h2>\n <p className=\"text-gray-600 mb-4\">\n Le type d'étape \"{node.type}\" n'est pas pris en charge.\n </p>\n <div className=\"bg-gray-100 p-4 rounded mb-4 text-left text-xs overflow-auto max-h-32\">\n <pre>{JSON.stringify(node, null, 2)}</pre>\n </div>\n <button\n className=\"px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors\"\n onClick={() => {\n stepObject.goToNextStep(node.id, session.template);\n }}\n >\n {t(\"template.buttons.continue\")}\n </button>\n </div>\n );\n }\n};\n\nexport default TemplateNodeRenderer;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsCA,IAAM,oBAAoB,GAAwC,UAAC,EAYlE,EAAA;;AAXC,IAAA,IAAA,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,WAAW,GAAA,EAAA,CAAA,WAAA,EACX,aAAa,mBAAA,EACb,cAAc,GAAA,EAAA,CAAA,cAAA,EACd,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,WAAW,GAAA,EAAA,CAAA,WAAA,EACX,cAAc,GAAA,EAAA,CAAA,cAAA,EACd,gBAAgB,GAAA,EAAA,CAAA,gBAAA;AAER,IAAA,IAAA,CAAC,GAAK,OAAO,EAAE,EAAd;IAET,IAAI,EAAC,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,MAAA,GAAA,MAAA,GAAP,OAAO,CAAE,QAAQ,CAAA,EAAE;QACtB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC;AACtD,QAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kEAAkE,EAAA,QAAA,EAAA,CAC/EC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC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