datakeen-session-react 1.1.195-dev.5 → 1.1.195-dev.6
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/jdi/JDIProcessing.js +3 -3
- package/dist/cjs/components/jdi/JDIProcessing.js.map +1 -1
- package/dist/cjs/components/selfie/Video.js +2 -2
- package/dist/cjs/components/selfie/Video.js.map +1 -1
- package/dist/cjs/components/selfie/selfie-flow/SelfieFlow.js +2 -2
- package/dist/cjs/components/selfie/selfie-flow/SelfieFlow.js.map +1 -1
- package/dist/cjs/components/selfie/selfie-flow/SelfieProcessing.js +5 -1
- package/dist/cjs/components/selfie/selfie-flow/SelfieProcessing.js.map +1 -1
- package/dist/cjs/components/selfie/selfie-flow/SelfieRecorder.js +123 -13
- package/dist/cjs/components/selfie/selfie-flow/SelfieRecorder.js.map +1 -1
- package/dist/cjs/components/session/Selfie.js +1 -1
- package/dist/cjs/components/session/Selfie.js.map +1 -1
- package/dist/cjs/services/analysis.js +40 -26
- package/dist/cjs/services/analysis.js.map +1 -1
- package/dist/cjs/services/iadService.js +30 -0
- package/dist/cjs/services/iadService.js.map +1 -0
- package/dist/cjs/types/session.js.map +1 -1
- package/dist/esm/components/jdi/JDIProcessing.js +3 -3
- package/dist/esm/components/jdi/JDIProcessing.js.map +1 -1
- package/dist/esm/components/selfie/Video.js +2 -2
- package/dist/esm/components/selfie/Video.js.map +1 -1
- package/dist/esm/components/selfie/selfie-flow/SelfieFlow.js +2 -2
- package/dist/esm/components/selfie/selfie-flow/SelfieFlow.js.map +1 -1
- package/dist/esm/components/selfie/selfie-flow/SelfieProcessing.js +5 -1
- package/dist/esm/components/selfie/selfie-flow/SelfieProcessing.js.map +1 -1
- package/dist/esm/components/selfie/selfie-flow/SelfieRecorder.js +124 -14
- package/dist/esm/components/selfie/selfie-flow/SelfieRecorder.js.map +1 -1
- package/dist/esm/components/session/Selfie.js +1 -1
- package/dist/esm/components/session/Selfie.js.map +1 -1
- package/dist/esm/services/analysis.js +40 -26
- package/dist/esm/services/analysis.js.map +1 -1
- package/dist/esm/services/iadService.js +28 -0
- package/dist/esm/services/iadService.js.map +1 -0
- package/dist/esm/types/session.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.js","sources":["../../../../src/services/analysis.ts"],"sourcesContent":["import type { onUploadFiles } from \"../types/uploadFiles\";\nimport { dataURLtoFile, getMimeTypeFromDataURL } from \"./utils\";\nimport { mimeTypeToExtension } from \"../utils/mimeTypes\";\nimport { apiService } from \"./api\";\nimport type { SelfieCaptureData } from \"../types/selfie\";\nimport type {\n DocumentVideoCaptureBySide,\n DocumentVideoPreviewBySide,\n} from \"../types/documentVideo\";\nimport { getSessionMemoryUserInput } from \"./sessionMemoryStore\";\nimport {\n logDocumentUploaded,\n logSelfieCaptured,\n logAiControlled,\n logStatusModified,\n} from \"./auditTrailService\";\nimport { pollAnalysisStatus, stopPolling } from \"./pollingService\";\nimport type { PollingOptions } from \"./pollingService\";\n\n// Timeout configurations (in milliseconds)\nconst ANALYSIS_TIMEOUT = 600000; // 10 minutes for document analysis (increased for large files + ML processing)\nconst SELFIE_ANALYSIS_TIMEOUT = 600000; // 10 minutes for selfie analysis\nconst UPLOAD_TIMEOUT = 300000; // 5 minutes for file uploads\n\n// Map pour suivre les analyses en cours et éviter les doublons\nconst ongoingAnalyses = new Map<string, Promise<any>>();\n\nexport interface AnalyzeFilesOptions {\n personPhoto?: string | null;\n save?: boolean;\n incrementAnalysis?: boolean;\n forceUpload?: boolean;\n documentTypeKey?: string | null;\n requiresTwoSides?: boolean;\n enablePolling?: boolean; // Enable polling for analysis progress (default: true)\n pollingOptions?: PollingOptions; // Custom polling configuration\n collectOnly?: boolean; // Bypass AI verification — document is collected as-is\n}\n\ninterface LaunchAnalysisOptions extends AnalyzeFilesOptions {}\n\nfunction createFileName(fileURL: string, baseName: string = \"file\") {\n const mimeType = getMimeTypeFromDataURL(fileURL);\n if (!mimeType) {\n throw new Error(\"Unable to determine MIME type from file URL\");\n }\n\n const ext = mimeTypeToExtension(mimeType);\n const safeBase = baseName.replace(/\\.+$/, \"\");\n return ext ? `${safeBase}.${ext}` : safeBase;\n}\n\nfunction normalizeDocumentTypeKey(\n rawType?: string | null,\n fallback: string = \"document\",\n) {\n if (!rawType) {\n return fallback;\n }\n\n const trimmed = rawType.trim();\n if (!trimmed) {\n return fallback;\n }\n\n const withUnderscores = trimmed\n .replace(/([a-z0-9])([A-Z])/g, \"$1_$2\")\n .replace(/[\\s-]+/g, \"_\")\n .replace(/[^a-zA-Z0-9_]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_+|_+$/g, \"\")\n .toLowerCase();\n\n return withUnderscores || fallback;\n}\n\n// Fonction pour créer une clé unique pour identifier une analyse\nfunction createAnalysisKey(\n sessionId: string,\n files: onUploadFiles,\n documentTypeId: string,\n): string {\n const frontHash = files.front ? files.front.substring(0, 50) : \"no-front\";\n const backHash = files.back ? files.back.substring(0, 50) : \"no-back\";\n return `${sessionId}-${documentTypeId}-${frontHash}-${backHash}`;\n}\n\nasync function launchAnalysis(\n sessionId: string,\n nodeId: string,\n files: onUploadFiles,\n documentTypeId: string | null,\n options: LaunchAnalysisOptions = {},\n) {\n if (!sessionId || !files) {\n throw new Error(\"Invalid parameters for analysis\");\n }\n\n const {\n personPhoto = null,\n save = true,\n incrementAnalysis = true,\n forceUpload = false,\n documentTypeKey = null,\n requiresTwoSides,\n collectOnly = false,\n } = options;\n\n const formData = new FormData();\n formData.append(\"sessionId\", sessionId);\n formData.append(\"nodeId\", nodeId);\n formData.append(\"save\", String(save));\n\n const userInput = getSessionMemoryUserInput(sessionId);\n if (Object.keys(userInput).length > 0) {\n const fullName = `${userInput.firstName || \"\"} ${\n userInput.lastName || \"\"\n }`.trim();\n formData.append(\"name\", fullName || \"Unknown\");\n\n formData.append(\"firstName\", userInput.firstName || \"\");\n formData.append(\"lastName\", userInput.lastName || \"\");\n formData.append(\"birthDate\", userInput.birthDate || \"\");\n formData.append(\"countryCode\", userInput.countryCode || \"\");\n }\n\n const fileTypes: Record<string, string> = {};\n const normalizedDocumentType = normalizeDocumentTypeKey(\n documentTypeKey ?? documentTypeId ?? undefined,\n );\n const hyphenDocumentType = normalizedDocumentType.replace(/_/g, \"-\");\n const appendSide =\n typeof requiresTwoSides === \"boolean\"\n ? requiresTwoSides\n : Boolean(files.back);\n\n if (files.front) {\n const frontBaseName = appendSide\n ? `${normalizedDocumentType}_front`\n : normalizedDocumentType;\n const frontFileName = createFileName(files.front, frontBaseName);\n const frontFile = dataURLtoFile(files.front, frontFileName);\n formData.append(\"files\", frontFile, frontFileName);\n\n fileTypes[frontFileName] = appendSide\n ? `${hyphenDocumentType}-front`\n : hyphenDocumentType;\n }\n\n if (files.back) {\n const backBaseName = `${normalizedDocumentType}_back`;\n const backFileName = createFileName(files.back, backBaseName);\n const backFile = dataURLtoFile(files.back, backFileName);\n formData.append(\"files\", backFile, backFileName);\n\n fileTypes[backFileName] = `${hyphenDocumentType}-back`;\n }\n\n formData.append(\"fileTypes\", JSON.stringify(fileTypes));\n formData.append(\"incrementAnalysis\", String(incrementAnalysis));\n formData.append(\"forceUpload\", String(forceUpload));\n\n if (documentTypeId) {\n formData.append(\"documentTemplateId\", documentTypeId);\n }\n\n if (personPhoto) {\n formData.append(\"personPhoto\", personPhoto);\n }\n\n if (collectOnly) {\n formData.append(\"collectOnly\", \"true\");\n }\n\n console.debug(\"FormData prepared for analysis:\", {\n sessionId,\n documentTypeId,\n files: Object.keys(fileTypes),\n save,\n incrementAnalysis,\n forceUpload,\n collectOnly,\n });\n return formData;\n}\n\nexport async function analyzeFiles(\n sessionId: string,\n nodeId: string,\n files: onUploadFiles,\n documentTypeId: string,\n options: AnalyzeFilesOptions = {},\n): Promise<any> {\n // Validate required parameters\n if (!sessionId) {\n throw new Error(\"Missing sessionId: A valid session ID is required.\");\n }\n if (!files || Object.keys(files).length === 0) {\n throw new Error(\n \"Missing files: At least one file must be provided for analysis.\",\n );\n }\n\n const {\n personPhoto = null,\n save = true,\n incrementAnalysis = true,\n forceUpload = false,\n documentTypeKey = null,\n requiresTwoSides,\n enablePolling = true,\n pollingOptions = {},\n collectOnly = false,\n } = options;\n\n // Pour les retry, on ne force pas l'upload mais on écrase l'analyse existante\n const isRetry = !incrementAnalysis && !forceUpload;\n\n // Créer une clé unique pour cette analyse\n const analysisKey = createAnalysisKey(sessionId, files, documentTypeId);\n\n // Vérifier si une analyse identique est déjà en cours\n if (ongoingAnalyses.has(analysisKey) && !isRetry) {\n return ongoingAnalyses.get(analysisKey);\n }\n\n // Helper function for retry logic with exponential backoff\n async function submitAnalysisWithRetry(\n formData: FormData,\n maxAttempts: number = 3,\n ) {\n let lastError: any;\n\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n const rawClient = apiService.getRawClient();\n\n const response = await rawClient.post(\n `/session/sdk/${sessionId}/analysis`,\n formData,\n {\n timeout: ANALYSIS_TIMEOUT,\n },\n );\n\n return response;\n } catch (error: any) {\n lastError = error;\n\n // Check if it's a network error (likely backend didn't respond in time)\n if (\n error.code === \"ERR_NETWORK\" ||\n error.message?.includes(\"CORS request did not succeed\")\n ) {\n console.warn(\n `⚠️ Network error on attempt ${attempt}: ${error.message}`,\n );\n\n if (attempt < maxAttempts) {\n // Exponential backoff: wait 2s, 4s, 8s...\n const waitTime = Math.pow(2, attempt) * 1000;\n console.log(`⏳ Retrying in ${waitTime / 1000}s...`);\n await new Promise((resolve) => setTimeout(resolve, waitTime));\n continue;\n }\n }\n\n // For other errors, don't retry\n throw error;\n }\n }\n\n throw lastError;\n }\n\n // Créer la promesse d'analyse et la stocker\n const analysisPromise = (async () => {\n try {\n const formData = await launchAnalysis(\n sessionId,\n nodeId,\n files,\n documentTypeId,\n {\n personPhoto,\n save,\n incrementAnalysis: isRetry ? false : incrementAnalysis,\n forceUpload: isRetry ? true : forceUpload,\n documentTypeKey,\n requiresTwoSides,\n collectOnly,\n },\n );\n\n await logDocumentUploaded(sessionId, {\n documentTypeId: documentTypeId || \"unknown\",\n ...(documentTypeKey ? { documentTypeKey } : {}),\n hasFrontImage: !!files.front,\n hasBackImage: !!files.back,\n });\n\n // Submit with automatic retry on network errors\n const response = await submitAnalysisWithRetry(formData);\n\n // Wrap response to match ApiResponse type\n const wrappedResponse = {\n data: response.data,\n success: true,\n status: response.status,\n };\n\n await logAiControlled(\n sessionId,\n {\n analysisResult: response.data.status || \"unknown\",\n documentTypeId: documentTypeId || \"unknown\",\n },\n response.data.clientInfoId || undefined,\n );\n\n if (!wrappedResponse.success) {\n throw new Error(`Analysis failed: ${response.data}`);\n }\n\n // Start polling for analysis progress if enabled\n if (enablePolling) {\n try {\n const pollConfig: PollingOptions = {\n ...pollingOptions,\n };\n\n const pollingResult = await pollAnalysisStatus(sessionId, pollConfig);\n\n return pollingResult;\n } catch (pollError) {\n console.warn(\n \"⚠️ Polling error (analysis may still be processing):\",\n pollError,\n );\n // Don't throw - polling error shouldn't fail the analysis submission\n // The backend is still processing even if polling fails\n return response.data;\n }\n }\n\n return response.data;\n } catch (error) {\n console.error(\"❌ Analysis failed:\", error);\n // Stop any ongoing polling on error\n stopPolling();\n throw error;\n } finally {\n // Nettoyer la promesse de la map une fois terminée\n ongoingAnalyses.delete(analysisKey);\n }\n })();\n\n // Stocker la promesse pour éviter les appels simultanés\n ongoingAnalyses.set(analysisKey, analysisPromise);\n\n return analysisPromise;\n}\n\nexport async function analyzeSelfie(\n sessionId: string,\n selfieFile: SelfieCaptureData,\n selfiePhoto: string,\n nodeId?: string,\n): Promise<any> {\n console.log(\"🤳 Starting selfie analysis for session:\", sessionId);\n console.log(\"� File size:\", selfieFile.media.size, \"bytes\");\n\n const formData = new FormData();\n formData.append(\"file\", selfieFile.media, \"selfie.mp4\");\n formData.append(\"photo\", selfiePhoto);\n if (nodeId) formData.append(\"nodeId\", nodeId);\n\n try {\n console.log(\"🚀 Sending selfie to UNISSEY API...\");\n\n const response = await apiService.post(\n `/session/unissey/${sessionId}/analyze`,\n formData,\n {\n timeout: SELFIE_ANALYSIS_TIMEOUT,\n },\n );\n\n console.log(\"✅ Analysis response:\", response);\n\n // Si la réponse API indique un succès, traiter la réponse Unissey\n if (response.success && response.data) {\n console.log(\"🎉 Unissey analysis completed - checking results...\");\n\n // response.data contient directement la réponse Unissey avec status, message, data\n const unisseyResponse = response.data;\n\n // Vérifier si Unissey a répondu avec succès\n if (\n unisseyResponse.status === 200 &&\n (unisseyResponse.message === \"success\" ||\n unisseyResponse.message === \"ok\")\n ) {\n console.log(\"✅ Unissey returned success status\");\n\n // Utiliser les données réelles de la réponse Unissey\n const unisseyData = unisseyResponse.data;\n\n // Vérifier si la comparaison faciale a un niveau de confiance élevé\n const faceComparison = unisseyData.details?.face_comparison;\n const isHighConfidence = faceComparison?.confidence_level === \"high\";\n const isMatch =\n unisseyData.is_match && faceComparison?.result === \"match\";\n\n // is_genuine est basé sur la confiance élevée de la comparaison faciale\n const isGenuine = isHighConfidence && isMatch;\n\n // Log selfie captured in audit trail\n try {\n const analysisResponse = await apiService.get(\n `/session/sdk/${sessionId}`,\n );\n if (analysisResponse.data && analysisResponse.data.analysisId) {\n await logSelfieCaptured(\n sessionId,\n analysisResponse.data.clientInfoId || undefined,\n );\n\n // Log AI control with selfie analysis results\n await logAiControlled(\n sessionId,\n {\n selfieAnalysisResult: isGenuine ? \"genuine\" : \"not_genuine\",\n isMatch: isMatch ? \"match\" : \"no_match\",\n confidenceLevel: faceComparison?.confidence_level || \"unknown\",\n },\n analysisResponse.data.clientInfoId || undefined,\n );\n\n await logStatusModified(\n sessionId,\n {\n selfieAnalysisResult: isGenuine ? \"genuine\" : \"not_genuine\",\n isMatch: isMatch ? \"match\" : \"no_match\",\n confidenceLevel: faceComparison?.confidence_level || \"unknown\",\n },\n analysisResponse.data.clientInfoId || undefined,\n );\n }\n } catch (err) {\n console.error(\"Failed to log selfie capture in audit trail:\", err);\n // Non-blocking error - continue analysis\n }\n\n // Retourner la structure attendue par l'UI\n return {\n success: true,\n data: {\n ...unisseyData,\n is_genuine: isGenuine, // Basé sur confidence_level === \"high\"\n },\n };\n } else {\n console.error(\n \"❌ Unissey returned error status:\",\n unisseyResponse.status,\n unisseyResponse.message,\n );\n throw new Error(\n `Unissey analysis failed: ${\n unisseyResponse.message || \"Unknown Unissey error\"\n }`,\n );\n }\n }\n\n // Gestion des erreurs spécifiques API\n const errorMessage =\n response.data?.message || response.data || \"Unknown error\";\n console.error(\"❌ API call failed:\", errorMessage);\n throw new Error(`Face comparison analysis failed: ${errorMessage}`);\n } catch (error: any) {\n console.error(\"💥 Analysis error:\", error);\n\n // Améliorer le message d'erreur pour l'UI\n if (error.response?.data?.message) {\n throw new Error(`Analysis failed: ${error.response.data.message}`);\n } else if (error.message) {\n throw error; // Garder le message d'erreur original si déjà formaté\n } else {\n throw new Error(\n \"Face comparison analysis failed due to an unexpected error\",\n );\n }\n }\n}\n\nexport async function uploadConvertedIdCardImage(\n sessionId: string,\n file: File,\n): Promise<any> {\n if (!sessionId || !file) {\n throw new Error(\"Invalid parameters for uploading converted ID card image\");\n }\n\n // rename file to converted_id_card.png\n const renamedFile = new File([file], \"converted_id_card.png\", {\n type: file.type,\n });\n\n const formData = new FormData();\n formData.append(\"file\", renamedFile, renamedFile.name);\n\n try {\n console.log(\n `🚀 Uploading converted ID card image for session: ${sessionId}`,\n );\n const response = await apiService.post(\n `/session/sdk/${sessionId}/converted_id_card.png`,\n formData,\n {\n timeout: UPLOAD_TIMEOUT,\n },\n );\n console.log(\"✅ Upload response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"❌ Upload error:\", error);\n throw new Error(\"Failed to upload converted ID card image\");\n }\n}\n\n/**\n * Analyzes a document video captured with Unissey DOC_VIDEO preset.\n * Sends the video file and thumbnail to the backend for document verification.\n *\n * @param sessionId - Unique identifier for the current session\n * @param nodeId - Identifier for the current node in the journey\n * @param videoData - Document video capture data containing media blob and metadata\n * @param thumbnail - Base64 thumbnail extracted from the video\n * @param documentTemplateId - Template ID for the document type being verified\n * @returns Analysis response from the backend\n */\nexport async function analyzeDocumentVideo(\n sessionId: string,\n nodeId: string,\n videoData: DocumentVideoCaptureBySide,\n previews: DocumentVideoPreviewBySide,\n documentTemplateId: string,\n options: {\n documentType?: string;\n requiresTwoSides?: boolean;\n enablePolling?: boolean;\n pollingOptions?: PollingOptions;\n } = {},\n): Promise<any> {\n if (!videoData.recto || !previews.recto) {\n throw new Error(\"Missing recto video or preview\");\n }\n\n const normalizedDocumentType = normalizeDocumentTypeKey(\n options.documentType ?? documentTemplateId ?? undefined,\n );\n const hyphenDocumentType = normalizedDocumentType.replace(/_/g, \"-\");\n const appendSide =\n typeof options.requiresTwoSides === \"boolean\"\n ? options.requiresTwoSides\n : Boolean(videoData.verso || previews.verso);\n\n const frontBaseName = appendSide\n ? `${normalizedDocumentType}_front`\n : normalizedDocumentType;\n const backBaseName = `${normalizedDocumentType}_back`;\n\n const previewFrontFileName = `${frontBaseName}.jpg`;\n const previewFrontFile = dataURLtoFile(previews.recto, previewFrontFileName);\n const previewBackFileName = `${backBaseName}.jpg`;\n const previewBackFile = previews.verso\n ? dataURLtoFile(previews.verso, previewBackFileName)\n : null;\n\n const formData = new FormData();\n\n formData.append(\n \"videoFront\",\n videoData.recto.media,\n \"document_video_recto.mp4\",\n );\n if (videoData.verso) {\n formData.append(\n \"videoBack\",\n videoData.verso.media,\n \"document_video_verso.mp4\",\n );\n }\n\n formData.append(\"previewFront\", previewFrontFile, previewFrontFileName);\n if (previewBackFile) {\n formData.append(\"previewBack\", previewBackFile, previewBackFileName);\n }\n\n const fileTypes: Record<string, string> = {};\n fileTypes[previewFrontFileName] = appendSide\n ? `${hyphenDocumentType}-front`\n : hyphenDocumentType;\n if (previewBackFile) {\n fileTypes[previewBackFileName] = `${hyphenDocumentType}-back`;\n }\n\n formData.append(\"fileTypes\", JSON.stringify(fileTypes));\n formData.append(\"sessionId\", sessionId);\n formData.append(\"nodeId\", nodeId);\n formData.append(\"documentTemplateId\", documentTemplateId);\n formData.append(\"documentType\", options.documentType || \"\");\n formData.append(\"requiresTwoSides\", String(appendSide));\n formData.append(\"save\", \"true\");\n\n const { enablePolling = true, pollingOptions = {} } = options;\n\n try {\n console.log(\"🚀 Sending document video to document-video API...\");\n const response = await apiService.post(\n `/session/sdk/${sessionId}/document-video`,\n formData,\n { timeout: ANALYSIS_TIMEOUT },\n );\n\n if (enablePolling) {\n try {\n const pollConfig: PollingOptions = {\n ...pollingOptions,\n defaultValue: {\n sessionId,\n status: \"processing\",\n progress: 50,\n currentStep: \"processing\",\n message: \"Document analysis in progress\",\n analysisId: null,\n startedAt: new Date().toISOString(),\n completedAt: null,\n error: null,\n },\n };\n const pollingResult = await pollAnalysisStatus(sessionId, pollConfig);\n return pollingResult;\n } catch (pollError) {\n console.warn(\n \"⚠️ Polling error (document-video may still be processing):\",\n pollError,\n );\n }\n }\n\n if (response?.success || response?.data?.success) {\n return response.data ?? response;\n }\n\n const errorMessage = response?.data?.message || \"Unknown error\";\n throw new Error(`Document video analysis failed: ${errorMessage}`);\n } catch (error: any) {\n stopPolling();\n if (error.response?.data?.message) {\n throw new Error(`Analysis failed: ${error.response.data.message}`);\n }\n if (error.message) {\n throw error;\n }\n throw new Error(\n \"Document video analysis failed due to an unexpected error\",\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAmBA;AACA,IAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,IAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,IAAM,cAAc,GAAG,MAAM,CAAC;AAE9B;AACA,IAAM,eAAe,GAAG,IAAI,GAAG,EAAwB;AAgBvD,SAAS,cAAc,CAAC,OAAe,EAAE,QAAyB,EAAA;AAAzB,IAAA,IAAA,QAAA,KAAA,MAAA,EAAA,EAAA,QAAA,GAAA,MAAyB,CAAA,CAAA;AAChE,IAAA,IAAM,QAAQ,GAAG,sBAAsB,CAAC,OAAO,CAAC;IAChD,IAAI,CAAC,QAAQ,EAA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I,KAAK,CAAC,mBAAA,CAAA,MAAA,CAAoB,OAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAE,CAAC;oBACpE;AACA,oBAAA,IAAI,OAAK,CAAC,OAAO,EAAE;AACjB,wBAAA,MAAM,OAAK;oBACb;AACA,oBAAA,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D;;;;;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"analysis.js","sources":["../../../../src/services/analysis.ts"],"sourcesContent":["import type { onUploadFiles } from \"../types/uploadFiles\";\nimport { dataURLtoFile, getMimeTypeFromDataURL } from \"./utils\";\nimport { mimeTypeToExtension } from \"../utils/mimeTypes\";\nimport { apiService } from \"./api\";\nimport type { SelfieCaptureData } from \"../types/selfie\";\nimport type {\n DocumentVideoCaptureBySide,\n DocumentVideoPreviewBySide,\n} from \"../types/documentVideo\";\nimport { getSessionMemoryUserInput } from \"./sessionMemoryStore\";\nimport {\n logDocumentUploaded,\n logSelfieCaptured,\n logAiControlled,\n logStatusModified,\n} from \"./auditTrailService\";\nimport { pollAnalysisStatus, stopPolling } from \"./pollingService\";\nimport type { PollingOptions } from \"./pollingService\";\n\n// Timeout configurations (in milliseconds)\nconst ANALYSIS_TIMEOUT = 600000; // 10 minutes for document analysis (increased for large files + ML processing)\nconst SELFIE_ANALYSIS_TIMEOUT = 600000; // 10 minutes for selfie analysis\nconst UPLOAD_TIMEOUT = 300000; // 5 minutes for file uploads\n\n// Map pour suivre les analyses en cours et éviter les doublons\nconst ongoingAnalyses = new Map<string, Promise<any>>();\n\nexport interface AnalyzeFilesOptions {\n personPhoto?: string | null;\n save?: boolean;\n incrementAnalysis?: boolean;\n forceUpload?: boolean;\n documentTypeKey?: string | null;\n requiresTwoSides?: boolean;\n enablePolling?: boolean; // Enable polling for analysis progress (default: true)\n pollingOptions?: PollingOptions; // Custom polling configuration\n collectOnly?: boolean; // Bypass AI verification — document is collected as-is\n}\n\ninterface LaunchAnalysisOptions extends AnalyzeFilesOptions {}\n\nfunction createFileName(fileURL: string, baseName: string = \"file\") {\n const mimeType = getMimeTypeFromDataURL(fileURL);\n if (!mimeType) {\n throw new Error(\"Unable to determine MIME type from file URL\");\n }\n\n const ext = mimeTypeToExtension(mimeType);\n const safeBase = baseName.replace(/\\.+$/, \"\");\n return ext ? `${safeBase}.${ext}` : safeBase;\n}\n\nfunction normalizeDocumentTypeKey(\n rawType?: string | null,\n fallback: string = \"document\",\n) {\n if (!rawType) {\n return fallback;\n }\n\n const trimmed = rawType.trim();\n if (!trimmed) {\n return fallback;\n }\n\n const withUnderscores = trimmed\n .replace(/([a-z0-9])([A-Z])/g, \"$1_$2\")\n .replace(/[\\s-]+/g, \"_\")\n .replace(/[^a-zA-Z0-9_]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_+|_+$/g, \"\")\n .toLowerCase();\n\n return withUnderscores || fallback;\n}\n\n// Fonction pour créer une clé unique pour identifier une analyse\nfunction createAnalysisKey(\n sessionId: string,\n files: onUploadFiles,\n documentTypeId: string,\n): string {\n const frontHash = files.front ? files.front.substring(0, 50) : \"no-front\";\n const backHash = files.back ? files.back.substring(0, 50) : \"no-back\";\n return `${sessionId}-${documentTypeId}-${frontHash}-${backHash}`;\n}\n\nasync function launchAnalysis(\n sessionId: string,\n nodeId: string,\n files: onUploadFiles,\n documentTypeId: string | null,\n options: LaunchAnalysisOptions = {},\n) {\n if (!sessionId || !files) {\n throw new Error(\"Invalid parameters for analysis\");\n }\n\n const {\n personPhoto = null,\n save = true,\n incrementAnalysis = true,\n forceUpload = false,\n documentTypeKey = null,\n requiresTwoSides,\n collectOnly = false,\n } = options;\n\n const formData = new FormData();\n formData.append(\"sessionId\", sessionId);\n formData.append(\"nodeId\", nodeId);\n formData.append(\"save\", String(save));\n\n const userInput = getSessionMemoryUserInput(sessionId);\n if (Object.keys(userInput).length > 0) {\n const fullName = `${userInput.firstName || \"\"} ${\n userInput.lastName || \"\"\n }`.trim();\n formData.append(\"name\", fullName || \"Unknown\");\n\n formData.append(\"firstName\", userInput.firstName || \"\");\n formData.append(\"lastName\", userInput.lastName || \"\");\n formData.append(\"birthDate\", userInput.birthDate || \"\");\n formData.append(\"countryCode\", userInput.countryCode || \"\");\n }\n\n const fileTypes: Record<string, string> = {};\n const normalizedDocumentType = normalizeDocumentTypeKey(\n documentTypeKey ?? documentTypeId ?? undefined,\n );\n const hyphenDocumentType = normalizedDocumentType.replace(/_/g, \"-\");\n const appendSide =\n typeof requiresTwoSides === \"boolean\"\n ? requiresTwoSides\n : Boolean(files.back);\n\n if (files.front) {\n const frontBaseName = appendSide\n ? `${normalizedDocumentType}_front`\n : normalizedDocumentType;\n const frontFileName = createFileName(files.front, frontBaseName);\n const frontFile = dataURLtoFile(files.front, frontFileName);\n formData.append(\"files\", frontFile, frontFileName);\n\n fileTypes[frontFileName] = appendSide\n ? `${hyphenDocumentType}-front`\n : hyphenDocumentType;\n }\n\n if (files.back) {\n const backBaseName = `${normalizedDocumentType}_back`;\n const backFileName = createFileName(files.back, backBaseName);\n const backFile = dataURLtoFile(files.back, backFileName);\n formData.append(\"files\", backFile, backFileName);\n\n fileTypes[backFileName] = `${hyphenDocumentType}-back`;\n }\n\n formData.append(\"fileTypes\", JSON.stringify(fileTypes));\n formData.append(\"incrementAnalysis\", String(incrementAnalysis));\n formData.append(\"forceUpload\", String(forceUpload));\n\n if (documentTypeId) {\n formData.append(\"documentTemplateId\", documentTypeId);\n }\n\n if (personPhoto) {\n formData.append(\"personPhoto\", personPhoto);\n }\n\n if (collectOnly) {\n formData.append(\"collectOnly\", \"true\");\n }\n\n console.debug(\"FormData prepared for analysis:\", {\n sessionId,\n documentTypeId,\n files: Object.keys(fileTypes),\n save,\n incrementAnalysis,\n forceUpload,\n collectOnly,\n });\n return formData;\n}\n\nexport async function analyzeFiles(\n sessionId: string,\n nodeId: string,\n files: onUploadFiles,\n documentTypeId: string,\n options: AnalyzeFilesOptions = {},\n): Promise<any> {\n // Validate required parameters\n if (!sessionId) {\n throw new Error(\"Missing sessionId: A valid session ID is required.\");\n }\n if (!files || Object.keys(files).length === 0) {\n throw new Error(\n \"Missing files: At least one file must be provided for analysis.\",\n );\n }\n\n const {\n personPhoto = null,\n save = true,\n incrementAnalysis = true,\n forceUpload = false,\n documentTypeKey = null,\n requiresTwoSides,\n enablePolling = true,\n pollingOptions = {},\n collectOnly = false,\n } = options;\n\n // Pour les retry, on ne force pas l'upload mais on écrase l'analyse existante\n const isRetry = !incrementAnalysis && !forceUpload;\n\n // Créer une clé unique pour cette analyse\n const analysisKey = createAnalysisKey(sessionId, files, documentTypeId);\n\n // Vérifier si une analyse identique est déjà en cours\n if (ongoingAnalyses.has(analysisKey) && !isRetry) {\n return ongoingAnalyses.get(analysisKey);\n }\n\n // Helper function for retry logic with exponential backoff\n async function submitAnalysisWithRetry(\n formData: FormData,\n maxAttempts: number = 3,\n ) {\n let lastError: any;\n\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n const rawClient = apiService.getRawClient();\n\n const response = await rawClient.post(\n `/session/sdk/${sessionId}/analysis`,\n formData,\n {\n timeout: ANALYSIS_TIMEOUT,\n },\n );\n\n return response;\n } catch (error: any) {\n lastError = error;\n\n // Check if it's a network error (likely backend didn't respond in time)\n if (\n error.code === \"ERR_NETWORK\" ||\n error.message?.includes(\"CORS request did not succeed\")\n ) {\n console.warn(\n `⚠️ Network error on attempt ${attempt}: ${error.message}`,\n );\n\n if (attempt < maxAttempts) {\n // Exponential backoff: wait 2s, 4s, 8s...\n const waitTime = Math.pow(2, attempt) * 1000;\n console.log(`⏳ Retrying in ${waitTime / 1000}s...`);\n await new Promise((resolve) => setTimeout(resolve, waitTime));\n continue;\n }\n }\n\n // For other errors, don't retry\n throw error;\n }\n }\n\n throw lastError;\n }\n\n // Créer la promesse d'analyse et la stocker\n const analysisPromise = (async () => {\n try {\n const formData = await launchAnalysis(\n sessionId,\n nodeId,\n files,\n documentTypeId,\n {\n personPhoto,\n save,\n incrementAnalysis: isRetry ? false : incrementAnalysis,\n forceUpload: isRetry ? true : forceUpload,\n documentTypeKey,\n requiresTwoSides,\n collectOnly,\n },\n );\n\n await logDocumentUploaded(sessionId, {\n documentTypeId: documentTypeId || \"unknown\",\n ...(documentTypeKey ? { documentTypeKey } : {}),\n hasFrontImage: !!files.front,\n hasBackImage: !!files.back,\n });\n\n // Submit with automatic retry on network errors\n const response = await submitAnalysisWithRetry(formData);\n\n // Wrap response to match ApiResponse type\n const wrappedResponse = {\n data: response.data,\n success: true,\n status: response.status,\n };\n\n await logAiControlled(\n sessionId,\n {\n analysisResult: response.data.status || \"unknown\",\n documentTypeId: documentTypeId || \"unknown\",\n },\n response.data.clientInfoId || undefined,\n );\n\n if (!wrappedResponse.success) {\n throw new Error(`Analysis failed: ${response.data}`);\n }\n\n // Start polling for analysis progress if enabled\n if (enablePolling) {\n try {\n const pollConfig: PollingOptions = {\n ...pollingOptions,\n };\n\n const pollingResult = await pollAnalysisStatus(sessionId, pollConfig);\n\n return pollingResult;\n } catch (pollError) {\n console.warn(\n \"⚠️ Polling error (analysis may still be processing):\",\n pollError,\n );\n // Don't throw - polling error shouldn't fail the analysis submission\n // The backend is still processing even if polling fails\n return response.data;\n }\n }\n\n return response.data;\n } catch (error) {\n console.error(\"❌ Analysis failed:\", error);\n // Stop any ongoing polling on error\n stopPolling();\n throw error;\n } finally {\n // Nettoyer la promesse de la map une fois terminée\n ongoingAnalyses.delete(analysisKey);\n }\n })();\n\n // Stocker la promesse pour éviter les appels simultanés\n ongoingAnalyses.set(analysisKey, analysisPromise);\n\n return analysisPromise;\n}\n\nexport async function analyzeSelfie(\n sessionId: string,\n selfieFile: SelfieCaptureData,\n selfiePhoto: string,\n nodeId?: string,\n): Promise<any> {\n console.log(\"🤳 Starting selfie analysis for session:\", sessionId);\n console.log(\"� File size:\", selfieFile.media.size, \"bytes\");\n\n const formData = new FormData();\n formData.append(\"file\", selfieFile.media, \"selfie.mp4\");\n formData.append(\"photo\", selfiePhoto);\n if (selfieFile.metadata?.trim()) {\n formData.append(\"selfie-metadata\", selfieFile.metadata);\n }\n if (nodeId) formData.append(\"nodeId\", nodeId);\n\n try {\n console.log(\"🚀 Sending selfie to UNISSEY API...\");\n\n const response = await apiService.post(\n `/session/unissey/${sessionId}/analyze`,\n formData,\n {\n timeout: SELFIE_ANALYSIS_TIMEOUT,\n },\n );\n\n // Si la réponse API indique un succès, traiter la réponse Unissey\n if (response.success && response.data) {\n console.log(\"🎉 Unissey analysis completed - checking results...\");\n\n // response.data contient directement la réponse Unissey avec status, message, data\n const unisseyResponse = response.data;\n\n // Vérifier si Unissey a répondu avec succès\n if (\n unisseyResponse.status === 200 &&\n (unisseyResponse.message === \"success\" ||\n unisseyResponse.message === \"ok\")\n ) {\n console.log(\"✅ Unissey returned success status\");\n\n // Utiliser les données réelles de la réponse Unissey\n const unisseyData = unisseyResponse.data;\n\n // Vérifier si la comparaison faciale a un niveau de confiance élevé\n const faceComparison = unisseyData.details?.face_comparison;\n const faceComparisonDisabled =\n unisseyData.face_comparison_disabled === true;\n const isHighConfidence = faceComparison?.confidence_level === \"high\";\n const isMatch = !faceComparisonDisabled &&\n unisseyData.is_match && faceComparison?.result === \"match\";\n\n // is_genuine est basé sur la confiance élevée de la comparaison faciale\n const isGenuine = faceComparisonDisabled\n ? unisseyData.is_genuine !== false\n : isHighConfidence && isMatch;\n\n // Log selfie captured in audit trail\n try {\n const analysisResponse = await apiService.get(\n `/session/sdk/${sessionId}`,\n );\n if (analysisResponse.data && analysisResponse.data.analysisId) {\n await logSelfieCaptured(\n sessionId,\n analysisResponse.data.clientInfoId || undefined,\n );\n\n // Log AI control with selfie analysis results\n await logAiControlled(\n sessionId,\n {\n selfieAnalysisResult: isGenuine ? \"genuine\" : \"not_genuine\",\n isMatch: faceComparisonDisabled\n ? \"not_performed\"\n : isMatch\n ? \"match\"\n : \"no_match\",\n confidenceLevel: faceComparison?.confidence_level || \"unknown\",\n },\n analysisResponse.data.clientInfoId || undefined,\n );\n\n await logStatusModified(\n sessionId,\n {\n selfieAnalysisResult: isGenuine ? \"genuine\" : \"not_genuine\",\n isMatch: faceComparisonDisabled\n ? \"not_performed\"\n : isMatch\n ? \"match\"\n : \"no_match\",\n confidenceLevel: faceComparison?.confidence_level || \"unknown\",\n },\n analysisResponse.data.clientInfoId || undefined,\n );\n }\n } catch (err) {\n console.error(\"Failed to log selfie capture in audit trail:\", err);\n // Non-blocking error - continue analysis\n }\n\n // Retourner la structure attendue par l'UI\n return {\n success: true,\n data: {\n ...unisseyData,\n is_genuine: isGenuine, // Basé sur confidence_level === \"high\"\n },\n };\n } else {\n console.error(\n \"❌ Unissey returned error status:\",\n unisseyResponse.status,\n unisseyResponse.message,\n );\n throw new Error(\n `Unissey analysis failed: ${\n unisseyResponse.message || \"Unknown Unissey error\"\n }`,\n );\n }\n }\n\n // Gestion des erreurs spécifiques API\n const errorMessage =\n response.data?.message || response.data || \"Unknown error\";\n console.error(\"❌ API call failed:\", errorMessage);\n throw new Error(`Face comparison analysis failed: ${errorMessage}`);\n } catch (error: any) {\n console.error(\"💥 Analysis error:\", error);\n\n // Améliorer le message d'erreur pour l'UI\n if (error.response?.data?.message) {\n throw new Error(`Analysis failed: ${error.response.data.message}`);\n } else if (error.message) {\n throw error; // Garder le message d'erreur original si déjà formaté\n } else {\n throw new Error(\n \"Face comparison analysis failed due to an unexpected error\",\n );\n }\n }\n}\n\nexport async function uploadConvertedIdCardImage(\n sessionId: string,\n file: File,\n nodeId?: string,\n): Promise<any> {\n if (!sessionId || !file) {\n throw new Error(\"Invalid parameters for uploading converted ID card image\");\n }\n\n // rename file to converted_id_card.png\n const renamedFile = new File([file], \"converted_id_card.png\", {\n type: file.type,\n });\n\n const formData = new FormData();\n formData.append(\"file\", renamedFile, renamedFile.name);\n\n try {\n console.log(\n `🚀 Uploading converted ID card image for session: ${sessionId}`,\n );\n const response = await apiService.post(\n `/session/sdk/${sessionId}/converted_id_card.png${\n nodeId ? `?nodeId=${encodeURIComponent(nodeId)}` : ''\n }`,\n formData,\n {\n timeout: UPLOAD_TIMEOUT,\n },\n );\n console.log(\"✅ Upload response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"❌ Upload error:\", error);\n throw new Error(\"Failed to upload converted ID card image\");\n }\n}\n\n/**\n * Analyzes a document video captured with Unissey DOC_VIDEO preset.\n * Sends the video file and thumbnail to the backend for document verification.\n *\n * @param sessionId - Unique identifier for the current session\n * @param nodeId - Identifier for the current node in the journey\n * @param videoData - Document video capture data containing media blob and metadata\n * @param thumbnail - Base64 thumbnail extracted from the video\n * @param documentTemplateId - Template ID for the document type being verified\n * @returns Analysis response from the backend\n */\nexport async function analyzeDocumentVideo(\n sessionId: string,\n nodeId: string,\n videoData: DocumentVideoCaptureBySide,\n previews: DocumentVideoPreviewBySide,\n documentTemplateId: string,\n options: {\n documentType?: string;\n requiresTwoSides?: boolean;\n enablePolling?: boolean;\n pollingOptions?: PollingOptions;\n } = {},\n): Promise<any> {\n if (!videoData.recto || !previews.recto) {\n throw new Error(\"Missing recto video or preview\");\n }\n\n const normalizedDocumentType = normalizeDocumentTypeKey(\n options.documentType ?? documentTemplateId ?? undefined,\n );\n const hyphenDocumentType = normalizedDocumentType.replace(/_/g, \"-\");\n const appendSide =\n typeof options.requiresTwoSides === \"boolean\"\n ? options.requiresTwoSides\n : Boolean(videoData.verso || previews.verso);\n\n const frontBaseName = appendSide\n ? `${normalizedDocumentType}_front`\n : normalizedDocumentType;\n const backBaseName = `${normalizedDocumentType}_back`;\n\n const previewFrontFileName = `${frontBaseName}.jpg`;\n const previewFrontFile = dataURLtoFile(previews.recto, previewFrontFileName);\n const previewBackFileName = `${backBaseName}.jpg`;\n const previewBackFile = previews.verso\n ? dataURLtoFile(previews.verso, previewBackFileName)\n : null;\n\n const formData = new FormData();\n\n formData.append(\n \"videoFront\",\n videoData.recto.media,\n \"document_video_recto.mp4\",\n );\n if (videoData.verso) {\n formData.append(\n \"videoBack\",\n videoData.verso.media,\n \"document_video_verso.mp4\",\n );\n }\n\n formData.append(\"previewFront\", previewFrontFile, previewFrontFileName);\n if (previewBackFile) {\n formData.append(\"previewBack\", previewBackFile, previewBackFileName);\n }\n\n const fileTypes: Record<string, string> = {};\n fileTypes[previewFrontFileName] = appendSide\n ? `${hyphenDocumentType}-front`\n : hyphenDocumentType;\n if (previewBackFile) {\n fileTypes[previewBackFileName] = `${hyphenDocumentType}-back`;\n }\n\n formData.append(\"fileTypes\", JSON.stringify(fileTypes));\n formData.append(\"sessionId\", sessionId);\n formData.append(\"nodeId\", nodeId);\n formData.append(\"documentTemplateId\", documentTemplateId);\n formData.append(\"documentType\", options.documentType || \"\");\n formData.append(\"requiresTwoSides\", String(appendSide));\n formData.append(\"save\", \"true\");\n\n const { enablePolling = true, pollingOptions = {} } = options;\n\n try {\n console.log(\"🚀 Sending document video to document-video API...\");\n const response = await apiService.post(\n `/session/sdk/${sessionId}/document-video`,\n formData,\n { timeout: ANALYSIS_TIMEOUT },\n );\n\n if (enablePolling) {\n try {\n const pollConfig: PollingOptions = {\n ...pollingOptions,\n defaultValue: {\n sessionId,\n status: \"processing\",\n progress: 50,\n currentStep: \"processing\",\n message: \"Document analysis in progress\",\n analysisId: null,\n startedAt: new Date().toISOString(),\n completedAt: null,\n error: null,\n },\n };\n const pollingResult = await pollAnalysisStatus(sessionId, pollConfig);\n return pollingResult;\n } catch (pollError) {\n console.warn(\n \"⚠️ Polling error (document-video may still be processing):\",\n pollError,\n );\n }\n }\n\n if (response?.success || response?.data?.success) {\n return response.data ?? response;\n }\n\n const errorMessage = response?.data?.message || \"Unknown error\";\n throw new Error(`Document video analysis failed: ${errorMessage}`);\n } catch (error: any) {\n stopPolling();\n if (error.response?.data?.message) {\n throw new Error(`Analysis failed: ${error.response.data.message}`);\n }\n if (error.message) {\n throw error;\n }\n throw new Error(\n \"Document video analysis failed due to an unexpected error\",\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAmBA;AACA,IAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,IAAM,uBAA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AA,QAAQ,KAAA,IAAA,IAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,OAAO,CAAA,EAAE;AAChD,wBAAA,OAAA,CAAA,CAAA,aAAO,MAAA,QAAQ,CAAC,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,QAAQ,CAAA;oBAClC;AAEM,oBAAA,YAAY,GAAG,CAAA,CAAA,EAAA,GAAA,QAAQ,aAAR,QAAQ,KAAA,MAAA,GAAA,MAAA,GAAR,QAAQ,CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,OAAO,KAAI,eAAe;AAC/D,oBAAA,MAAM,IAAI,KAAK,CAAC,0CAAmC,YAAY,CAAE,CAAC;;;AAElE,oBAAA,WAAW,EAAE;oBACb,IAAI,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,OAAK,CAAC,QAAQ,0CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,OAAO,EAAE;AACjC,wBAAA,MAAM,IAAI,KAAK,CAAC,mBAAA,CAAA,MAAA,CAAoB,OAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAE,CAAC;oBACpE;AACA,oBAAA,IAAI,OAAK,CAAC,OAAO,EAAE;AACjB,wBAAA,MAAM,OAAK;oBACb;AACA,oBAAA,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D;;;;;AAEJ;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __awaiter, __generator } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { apiService } from './api.js';
|
|
3
|
+
|
|
4
|
+
function prepareIadCapture(sessionId) {
|
|
5
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6
|
+
var response, preparation;
|
|
7
|
+
var _a;
|
|
8
|
+
return __generator(this, function (_b) {
|
|
9
|
+
switch (_b.label) {
|
|
10
|
+
case 0: return [4 /*yield*/, apiService.post("/session/sdk/".concat(sessionId, "/iad/prepare"))];
|
|
11
|
+
case 1:
|
|
12
|
+
response = _b.sent();
|
|
13
|
+
preparation = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
14
|
+
if (!preparation ||
|
|
15
|
+
typeof preparation.data !== "string" ||
|
|
16
|
+
preparation.data.length === 0 ||
|
|
17
|
+
(preparation.mode !== "passive" &&
|
|
18
|
+
preparation.mode !== "active-fallback")) {
|
|
19
|
+
throw new Error("Invalid IAD preparation response");
|
|
20
|
+
}
|
|
21
|
+
return [2 /*return*/, preparation];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { prepareIadCapture };
|
|
28
|
+
//# sourceMappingURL=iadService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iadService.js","sources":["../../../../src/services/iadService.ts"],"sourcesContent":["import type { IadMode } from \"@unissey-web/sdk-react\";\nimport { apiService } from \"./api\";\n\nexport interface IadPreparation {\n data: string;\n mode: IadMode;\n}\n\nexport async function prepareIadCapture(\n sessionId: string,\n): Promise<IadPreparation> {\n const response = await apiService.post<{\n status: number;\n message: string;\n data: IadPreparation;\n }>(`/session/sdk/${sessionId}/iad/prepare`);\n const preparation = response.data?.data;\n\n if (\n !preparation ||\n typeof preparation.data !== \"string\" ||\n preparation.data.length === 0 ||\n (preparation.mode !== \"passive\" &&\n preparation.mode !== \"active-fallback\")\n ) {\n throw new Error(\"Invalid IAD preparation response\");\n }\n\n return preparation;\n}\n"],"names":[],"mappings":";;;AAQM,SAAgB,iBAAiB,CACrC,SAAiB,EAAA;;;;;;wBAEA,OAAA,CAAA,CAAA,YAAM,UAAU,CAAC,IAAI,CAInC,uBAAgB,SAAS,EAAA,cAAA,CAAc,CAAC,CAAA;;AAJrC,oBAAA,QAAQ,GAAG,EAAA,CAAA,IAAA,EAI0B;AACrC,oBAAA,WAAW,GAAG,CAAA,EAAA,GAAA,QAAQ,CAAC,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,IAAI;AAEvC,oBAAA,IACE,CAAC,WAAW;AACZ,wBAAA,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ;AACpC,wBAAA,WAAW,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;AAC7B,yBAAC,WAAW,CAAC,IAAI,KAAK,SAAS;AAC7B,4BAAA,WAAW,CAAC,IAAI,KAAK,iBAAiB,CAAC,EACzC;AACA,wBAAA,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC;oBACrD;AAEA,oBAAA,OAAA,CAAA,CAAA,aAAO,WAAW,CAAA;;;;AACnB;;;;"}
|
|
@@ -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/** 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;;;;"}
|
|
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 iad?: {\n enabled: boolean;\n level?: \"basic\" | \"reinforced\";\n };\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;;;;"}
|