datakeen-session-react 1.1.202-dev.1 → 1.1.202-dev.10
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/document-collection/DocumentError.js +18 -14
- package/dist/cjs/components/document-collection/DocumentProcessing.js +3 -1
- package/dist/cjs/components/jdi/JDIError.js +16 -12
- package/dist/cjs/components/jdi/JDIProcessing.js +6 -1
- package/dist/cjs/components/nfc-scan/NfcScanNode.js +3 -4
- package/dist/cjs/components/session/DocumentCheck.js +25 -9
- package/dist/cjs/components/session/controleJdiPolicy.js +6 -1
- package/dist/cjs/components/signature-electronic/SignatureElectronic.js +13 -30
- package/dist/cjs/components/template/ExternalVerificationNodeHandler.js +94 -63
- package/dist/cjs/hooks/useStepNavigation.js +9 -1
- package/dist/cjs/services/analysis.js +7 -0
- package/dist/cjs/services/pollingService.js +4 -1
- package/dist/cjs/services/sessionService.js +4 -4
- package/dist/cjs/utils/analysisErrors.js +11 -0
- package/dist/cjs/utils/sessionStatus.js +3 -2
- package/dist/esm/components/document-collection/DocumentError.js +18 -14
- package/dist/esm/components/document-collection/DocumentProcessing.js +4 -2
- package/dist/esm/components/jdi/JDIError.js +16 -12
- package/dist/esm/components/jdi/JDIProcessing.js +7 -2
- package/dist/esm/components/nfc-scan/NfcScanNode.js +3 -4
- package/dist/esm/components/session/DocumentCheck.js +25 -9
- package/dist/esm/components/session/controleJdiPolicy.js +6 -1
- package/dist/esm/components/signature-electronic/SignatureElectronic.js +13 -30
- package/dist/esm/components/template/ExternalVerificationNodeHandler.js +94 -63
- package/dist/esm/hooks/useStepNavigation.js +9 -1
- package/dist/esm/services/analysis.js +7 -0
- package/dist/esm/services/pollingService.js +4 -1
- package/dist/esm/services/sessionService.js +4 -4
- package/dist/esm/utils/analysisErrors.js +10 -1
- package/dist/esm/utils/sessionStatus.js +3 -2
- package/package.json +2 -1
|
@@ -7,6 +7,7 @@ var api = require('./api.js');
|
|
|
7
7
|
var sessionMemoryStore = require('./sessionMemoryStore.js');
|
|
8
8
|
var auditTrailService = require('./auditTrailService.js');
|
|
9
9
|
var pollingService = require('./pollingService.js');
|
|
10
|
+
var analysisErrors = require('../utils/analysisErrors.js');
|
|
10
11
|
|
|
11
12
|
// Timeout configurations (in milliseconds)
|
|
12
13
|
var ANALYSIS_TIMEOUT = 600000; // 10 minutes for document analysis (increased for large files + ML processing)
|
|
@@ -248,6 +249,10 @@ function analyzeFiles(sessionId_1, nodeId_1, files_1, documentTypeId_1) {
|
|
|
248
249
|
return [2 /*return*/, pollingResult];
|
|
249
250
|
case 7:
|
|
250
251
|
pollError_1 = _a.sent();
|
|
252
|
+
// Une analyse terminée en erreur doit bloquer le nœud : seule une
|
|
253
|
+
// panne du polling (timeout, réseau) laisse le backend finir.
|
|
254
|
+
if (analysisErrors.isAnalysisFailedError(pollError_1))
|
|
255
|
+
throw pollError_1;
|
|
251
256
|
console.warn("⚠️ Polling error (analysis may still be processing):", pollError_1);
|
|
252
257
|
// Don't throw - polling error shouldn't fail the analysis submission
|
|
253
258
|
// The backend is still processing even if polling fails
|
|
@@ -509,6 +514,8 @@ function analyzeDocumentVideo(sessionId_1, nodeId_1, videoData_1, previews_1, do
|
|
|
509
514
|
return [2 /*return*/, pollingResult];
|
|
510
515
|
case 5:
|
|
511
516
|
pollError_2 = _k.sent();
|
|
517
|
+
if (analysisErrors.isAnalysisFailedError(pollError_2))
|
|
518
|
+
throw pollError_2;
|
|
512
519
|
console.warn("⚠️ Polling error (document-video may still be processing):", pollError_2);
|
|
513
520
|
return [3 /*break*/, 6];
|
|
514
521
|
case 6:
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
|
|
4
4
|
var api = require('./api.js');
|
|
5
|
+
var analysisErrors = require('../utils/analysisErrors.js');
|
|
5
6
|
|
|
6
7
|
var pollingTimeoutId = null;
|
|
7
8
|
var pollingStartTime = 0;
|
|
@@ -107,7 +108,9 @@ function pollAnalysisStatus(sessionId_1) {
|
|
|
107
108
|
}
|
|
108
109
|
isPollingActive = false;
|
|
109
110
|
pollingTimeoutId = null;
|
|
110
|
-
reject(new Error("Analysis failed: ".concat(userMessage))
|
|
111
|
+
reject(Object.assign(new Error("Analysis failed: ".concat(userMessage)), {
|
|
112
|
+
code: analysisErrors.ANALYSIS_FAILED_CODE,
|
|
113
|
+
}));
|
|
111
114
|
return [2 /*return*/];
|
|
112
115
|
}
|
|
113
116
|
// Analysis completed successfully (approved, rejected, to_verify, or completed)
|
|
@@ -202,17 +202,17 @@ var updateSessionStatus = function (sessionId, status, reachedEndNodeId) { retur
|
|
|
202
202
|
*
|
|
203
203
|
* @param sessionId - The unique identifier of the session
|
|
204
204
|
* @param currentStep - The current step index in the workflow
|
|
205
|
+
* @param currentNodeId - Stable id of the journey node at this step, when there is one
|
|
206
|
+
* (none for the welcome and QR screens). The backend timestamps the node entry.
|
|
205
207
|
* @returns The updated session data
|
|
206
208
|
*/
|
|
207
|
-
var updateSessionCurrentStep = function (sessionId, currentStep) { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
|
|
209
|
+
var updateSessionCurrentStep = function (sessionId, currentStep, currentNodeId) { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
|
|
208
210
|
var response, error_6;
|
|
209
211
|
return tslib_es6.__generator(this, function (_a) {
|
|
210
212
|
switch (_a.label) {
|
|
211
213
|
case 0:
|
|
212
214
|
_a.trys.push([0, 2, , 3]);
|
|
213
|
-
return [4 /*yield*/, api.apiService.patch("/session/sdk/".concat(sessionId), {
|
|
214
|
-
currentStep: currentStep,
|
|
215
|
-
})];
|
|
215
|
+
return [4 /*yield*/, api.apiService.patch("/session/sdk/".concat(sessionId), tslib_es6.__assign({ currentStep: currentStep }, (currentNodeId ? { currentNodeId: currentNodeId } : {})))];
|
|
216
216
|
case 1:
|
|
217
217
|
response = _a.sent();
|
|
218
218
|
return [2 /*return*/, response.data];
|
|
@@ -16,6 +16,15 @@ var isS3UploadNotConfirmedError = function (error) {
|
|
|
16
16
|
return (apiError.details.code ===
|
|
17
17
|
S3_UPLOAD_NOT_CONFIRMED_CODE);
|
|
18
18
|
};
|
|
19
|
+
// Code SDK interne : l'analyse s'est terminée en `error`/`failed` côté moteur
|
|
20
|
+
// (posé par pollingService). Distinct d'un simple timeout de polling, où le
|
|
21
|
+
// backend peut encore produire un résultat.
|
|
22
|
+
var ANALYSIS_FAILED_CODE = "ANALYSIS_FAILED";
|
|
23
|
+
var isAnalysisFailedError = function (error) {
|
|
24
|
+
return typeof error === "object" &&
|
|
25
|
+
error !== null &&
|
|
26
|
+
error.code === ANALYSIS_FAILED_CODE;
|
|
27
|
+
};
|
|
19
28
|
// Must stay aligned with QUOTA_EXCEEDED_CODE in the backend
|
|
20
29
|
// (src/common/constants/quota-exceeded.constant.ts).
|
|
21
30
|
var QUOTA_EXCEEDED_CODE = "QUOTA_EXCEEDED";
|
|
@@ -51,10 +60,12 @@ var isServiceErrorCode = function (code) {
|
|
|
51
60
|
/** Same as getServiceErrorCode, from the polled fallback document codeName. */
|
|
52
61
|
var getServiceErrorCodeFromCodeName = function (codeName) { var _a; return typeof codeName === "string" ? (_a = SERVICE_ERROR_CODE_NAMES[codeName]) !== null && _a !== void 0 ? _a : null : null; };
|
|
53
62
|
|
|
63
|
+
exports.ANALYSIS_FAILED_CODE = ANALYSIS_FAILED_CODE;
|
|
54
64
|
exports.INSUFFICIENT_CREDITS_CODE = INSUFFICIENT_CREDITS_CODE;
|
|
55
65
|
exports.QUOTA_EXCEEDED_CODE = QUOTA_EXCEEDED_CODE;
|
|
56
66
|
exports.S3_UPLOAD_NOT_CONFIRMED_CODE = S3_UPLOAD_NOT_CONFIRMED_CODE;
|
|
57
67
|
exports.getServiceErrorCode = getServiceErrorCode;
|
|
58
68
|
exports.getServiceErrorCodeFromCodeName = getServiceErrorCodeFromCodeName;
|
|
69
|
+
exports.isAnalysisFailedError = isAnalysisFailedError;
|
|
59
70
|
exports.isS3UploadNotConfirmedError = isS3UploadNotConfirmedError;
|
|
60
71
|
exports.isServiceErrorCode = isServiceErrorCode;
|
|
@@ -15,8 +15,9 @@ var CONSOLIDATED_RESULT_STATUSES = new Set([
|
|
|
15
15
|
* true si la session est terminée (écran de fin), qu'elle porte encore le
|
|
16
16
|
* statut brut "ended" ou déjà un statut de résultat consolidé.
|
|
17
17
|
*
|
|
18
|
-
* Ne PAS confondre avec "conform" : posé
|
|
19
|
-
*
|
|
18
|
+
* Ne PAS confondre avec "conform" : posé juste après la signature par les
|
|
19
|
+
* anciennes versions du SDK (la signature ne modifie plus le statut depuis
|
|
20
|
+
* APP3-1996), avant le vrai nœud "end" — ce n'est pas une fin de parcours.
|
|
20
21
|
*/
|
|
21
22
|
var isSessionFinished = function (status) {
|
|
22
23
|
if (!status)
|
|
@@ -13,6 +13,9 @@ var DocumentError = function (_a) {
|
|
|
13
13
|
// APP3-1955: a service refusal (no credits / quota) blocks the journey,
|
|
14
14
|
// whatever node.allowContinueOnFailure says.
|
|
15
15
|
var continueAnyway = isServiceErrorCode(errorCode) ? undefined : onContinueAnyway;
|
|
16
|
+
// Quota / plus de crédits : rien à corriger sur le document. Écran dédié
|
|
17
|
+
// (message de refus en tête), pas la structure d'un document rejeté.
|
|
18
|
+
var isServiceRefusal = !blockContinue && isServiceErrorCode(errorCode);
|
|
16
19
|
var _f = useState([]), validationPoints = _f[0], setValidationPoints = _f[1];
|
|
17
20
|
useEffect(function () {
|
|
18
21
|
// Use shared utility to get validation points
|
|
@@ -46,22 +49,23 @@ var DocumentError = function (_a) {
|
|
|
46
49
|
};
|
|
47
50
|
return (jsxs("div", { className: "flex flex-col justify-between h-full w-full", children: [jsx("div", { className: "flex-1 px-4 py-6 pt-11 md:px-8 md:py-8", children: jsxs("div", { className: "w-full max-w-md mx-auto space-y-6", children: [jsx("div", { className: "text-center", children: jsx("div", { className: "mx-auto w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mb-4", children: jsx("div", { className: "w-8 h-8 bg-red-500 rounded-full flex items-center justify-center", children: jsx("span", { className: "text-white text-lg", children: "\u2715" }) }) }) }), jsxs("div", { className: "text-center space-y-4", children: [jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl text-red-600", children: blockContinue
|
|
48
51
|
? t("errors.upload_not_confirmed.title")
|
|
49
|
-
:
|
|
52
|
+
: isServiceRefusal
|
|
53
|
+
? t("errors.service_refusal_title")
|
|
54
|
+
: t("errors.verification_failed", "Vérification échouée") }), jsx(Subtitle, { className: "text-sm text-gray-600 leading-relaxed", children: blockContinue
|
|
50
55
|
? t("errors.upload_not_confirmed.subtitle")
|
|
51
|
-
:
|
|
52
|
-
?
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
: isServiceRefusal
|
|
57
|
+
? getUserGuidance()
|
|
58
|
+
: isRetryAllowed
|
|
59
|
+
? t("errors.verification_failed_subtitle", {
|
|
60
|
+
documentType: getDocumentLabel(documentType),
|
|
61
|
+
defaultValue: "Nous n'avons pas pu valider votre {{documentType}}. Veuillez vérifier les points ci-dessous et réessayer.",
|
|
62
|
+
})
|
|
63
|
+
: t("errors.verification_failed_subtitle_no_retry", {
|
|
64
|
+
documentType: getDocumentLabel(documentType),
|
|
65
|
+
defaultValue: "Nous n'avons pas pu valider votre {{documentType}}. Veuillez vérifier les points ci-dessous.",
|
|
66
|
+
}) })] }), !blockContinue && !isServiceRefusal && (jsxs("div", { className: "bg-red-50 border border-red-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-red-900 mb-2", children: t("errors.problems_detected", "Problèmes détectés") }), jsx("div", { className: "text-sm text-red-800 space-y-1", children: validationPoints.map(function (point, index) { return (jsx("p", { children: point }, index)); }) })] })), !blockContinue && !isRetryAllowed && (jsxs("div", { className: "bg-orange-50 border border-orange-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-orange-900 mb-2", children: t("errors.resubmission.max_attempts_reached", "Nombre maximum de tentatives atteint") }), jsx("p", { className: "text-sm text-orange-800", children: maxResubmissionAttempts !== undefined
|
|
60
67
|
? t("errors.resubmission.max_attempts_reached_description")
|
|
61
|
-
: t("errors.resubmission.no_resubmission_allowed") })] })), !blockContinue && getUserGuidance() && (jsxs("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-yellow-900 mb-2", children:
|
|
62
|
-
? // Quota / out of credits: nothing for the end user to improve.
|
|
63
|
-
t("errors.service_refusal_title")
|
|
64
|
-
: "\uD83D\uDCA1 ".concat(t("errors.improvement_tips", "Conseils d'amélioration")) }), jsx("p", { className: "text-sm text-yellow-800", children: getUserGuidance() })] })), !blockContinue && isRetryAllowed && (jsxs("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-blue-900 mb-2", children: t("errors.next_steps", "Prochaines étapes") }), jsx("p", { className: "text-sm text-blue-800", children: t("errors.next_steps_description", "Veuillez reprendre les photos de votre document en suivant les conseils d'amélioration pour une meilleure qualité.") })] }))] }) }), jsx("div", { className: "sticky bottom-0 md:static bg-white border-t md:border-t-0 p-4 md:p-0 md:pb-8", children: jsxs("div", { className: "w-full max-w-md mx-auto", children: [jsx("div", { className: "flex flex-col space-y-3 md:hidden", children: blockContinue ? (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })) : (jsxs(Fragment, { children: [onBackToUserInput && (jsx(ButtonDesktop, { onClick: onBackToUserInput, type: "back", children: t("errors.back_to_user_input", "Retour aux informations d'identité") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") })), isRetryAllowed && (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })), !isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") }))] })) }), jsx("div", { className: "hidden md:flex flex-col space-y-3", children: jsx("div", { className: "flex justify-center space-x-3", children: blockContinue ? (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })) : (jsxs(Fragment, { children: [onBackToUserInput && (jsx(ButtonDesktop, { onClick: onBackToUserInput, type: "back", children: t("errors.back_to_user_input", "Retour aux informations d'identité") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") })), isRetryAllowed && (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })), !isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "continue", children: t("errors.continue_anyway", "Poursuivre tout de même") }))] })) }) })] }) })] }));
|
|
68
|
+
: t("errors.resubmission.no_resubmission_allowed") })] })), !blockContinue && !isServiceRefusal && getUserGuidance() && (jsxs("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-yellow-900 mb-2", children: "\uD83D\uDCA1 ".concat(t("errors.improvement_tips", "Conseils d'amélioration")) }), jsx("p", { className: "text-sm text-yellow-800", children: getUserGuidance() })] })), !blockContinue && !isServiceRefusal && isRetryAllowed && (jsxs("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-blue-900 mb-2", children: t("errors.next_steps", "Prochaines étapes") }), jsx("p", { className: "text-sm text-blue-800", children: t("errors.next_steps_description", "Veuillez reprendre les photos de votre document en suivant les conseils d'amélioration pour une meilleure qualité.") })] }))] }) }), jsx("div", { className: "sticky bottom-0 md:static bg-white border-t md:border-t-0 p-4 md:p-0 md:pb-8", children: jsxs("div", { className: "w-full max-w-md mx-auto", children: [jsx("div", { className: "flex flex-col space-y-3 md:hidden", children: blockContinue ? (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })) : (jsxs(Fragment, { children: [onBackToUserInput && (jsx(ButtonDesktop, { onClick: onBackToUserInput, type: "back", children: t("errors.back_to_user_input", "Retour aux informations d'identité") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") })), isRetryAllowed && (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })), !isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") }))] })) }), jsx("div", { className: "hidden md:flex flex-col space-y-3", children: jsx("div", { className: "flex justify-center space-x-3", children: blockContinue ? (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })) : (jsxs(Fragment, { children: [onBackToUserInput && (jsx(ButtonDesktop, { onClick: onBackToUserInput, type: "back", children: t("errors.back_to_user_input", "Retour aux informations d'identité") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") })), isRetryAllowed && (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })), !isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "continue", children: t("errors.continue_anyway", "Poursuivre tout de même") }))] })) }) })] }) })] }));
|
|
65
69
|
};
|
|
66
70
|
|
|
67
71
|
export { DocumentError as default };
|
|
@@ -6,7 +6,7 @@ import Subtitle from '../ui/Subtitle.js';
|
|
|
6
6
|
import { useI18n } from '../../hooks/useI18n.js';
|
|
7
7
|
import { analyzeFiles } from '../../services/analysis.js';
|
|
8
8
|
import { getActiveSessionId } from '../../services/sessionMemoryStore.js';
|
|
9
|
-
import { getServiceErrorCodeFromCodeName, isS3UploadNotConfirmedError, getServiceErrorCode } from '../../utils/analysisErrors.js';
|
|
9
|
+
import { getServiceErrorCodeFromCodeName, isS3UploadNotConfirmedError, getServiceErrorCode, isAnalysisFailedError } from '../../utils/analysisErrors.js';
|
|
10
10
|
|
|
11
11
|
// Localized processing steps generator
|
|
12
12
|
var getProcessingSteps = function (t) { return [
|
|
@@ -230,7 +230,9 @@ var DocumentProcessing = memo(function (_a) {
|
|
|
230
230
|
},
|
|
231
231
|
]
|
|
232
232
|
: undefined,
|
|
233
|
-
canRetry: isUploadNotConfirmed ||
|
|
233
|
+
canRetry: isUploadNotConfirmed ||
|
|
234
|
+
!!serviceErrorCode ||
|
|
235
|
+
isAnalysisFailedError(error_1),
|
|
234
236
|
blockContinue: isUploadNotConfirmed,
|
|
235
237
|
});
|
|
236
238
|
setIsComplete(true);
|
|
@@ -17,6 +17,9 @@ var JDIError = function (_a) {
|
|
|
17
17
|
// APP3-1955: a service refusal (no credits / quota) blocks the journey,
|
|
18
18
|
// whatever node.allowContinueOnFailure says.
|
|
19
19
|
var continueAnyway = isServiceErrorCode(errorCode) ? undefined : onContinueAnyway;
|
|
20
|
+
// Quota / plus de crédits : rien à corriger sur le document. Écran dédié
|
|
21
|
+
// (message de refus en tête), pas la structure d'un document rejeté.
|
|
22
|
+
var isServiceRefusal = !blockContinue && isServiceErrorCode(errorCode);
|
|
20
23
|
var _g = useState([]), validationPoints = _g[0], setValidationPoints = _g[1];
|
|
21
24
|
// Détail de mismatch d'identité (code 7.0), calculé côté backend et porté
|
|
22
25
|
// par la première prédiction. Absent pour tous les autres codes.
|
|
@@ -34,20 +37,21 @@ var JDIError = function (_a) {
|
|
|
34
37
|
};
|
|
35
38
|
return (jsx(MobilePageLayout, { footer: jsxs("div", { className: "w-full max-w-md mx-auto", children: [jsx("div", { className: "flex flex-col space-y-3 md:hidden", children: blockContinue ? (jsx(Button, { onClick: onRetry, className: "w-full py-3", children: t("errors.retry_verification") })) : (jsxs(Fragment, { children: [onBackToUserInput && (jsx(ButtonDesktop, { onClick: onBackToUserInput, type: "back", className: "w-full text-black text-center font-poppins text-sm font-medium py-2", children: t("errors.back_to_user_input") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "back", className: "w-full text-black text-center font-poppins text-sm font-medium py-2", children: t("errors.continue_anyway") })), isRetryAllowed && (jsx(Button, { onClick: onRetry, className: "w-full py-3", children: t("errors.retry_verification") })), !isRetryAllowed && continueAnyway && (jsx(Button, { onClick: continueAnyway, className: "w-full py-3", children: t("errors.continue_anyway") }))] })) }), jsx("div", { className: "hidden md:flex flex-col space-y-3", children: jsx("div", { className: "flex justify-center space-x-3", children: blockContinue ? (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification") })) : (jsxs(Fragment, { children: [onBackToUserInput && (jsx(ButtonDesktop, { onClick: onBackToUserInput, type: "back", className: "text-black text-center font-poppins text-sm font-medium py-2", children: t("errors.back_to_user_input") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "back", className: "text-black text-center font-poppins text-sm font-medium py-2", children: t("errors.continue_anyway") })), isRetryAllowed && (jsx(ButtonDesktop, { onClick: onRetry, type: "continue", children: t("errors.retry_verification") })), !isRetryAllowed && continueAnyway && (jsx(ButtonDesktop, { onClick: continueAnyway, type: "continue", children: t("errors.continue_anyway") }))] })) }) })] }), children: jsx("div", { className: "px-4 py-6 pt-11 md:px-8 md:py-8", children: jsxs("div", { className: "w-full max-w-md mx-auto space-y-6", children: [jsx("div", { className: "text-center", children: jsx("div", { className: "mx-auto w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mb-4", children: jsx("div", { className: "w-8 h-8 bg-red-500 rounded-full flex items-center justify-center", children: jsx("span", { className: "text-white text-lg", children: "\u2715" }) }) }) }), jsxs("div", { className: "text-center space-y-4", children: [jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl text-red-600", children: blockContinue
|
|
36
39
|
? t("errors.upload_not_confirmed.title")
|
|
37
|
-
:
|
|
40
|
+
: isServiceRefusal
|
|
41
|
+
? t("errors.service_refusal_title")
|
|
42
|
+
: t("errors.verification_failed") }), jsx(Subtitle, { className: "text-sm text-gray-600 leading-relaxed", children: blockContinue
|
|
38
43
|
? t("errors.upload_not_confirmed.subtitle")
|
|
39
|
-
:
|
|
40
|
-
?
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
: isServiceRefusal
|
|
45
|
+
? getUserGuidance()
|
|
46
|
+
: isRetryAllowed
|
|
47
|
+
? t("errors.verification_failed_subtitle", {
|
|
48
|
+
documentType: "document",
|
|
49
|
+
})
|
|
50
|
+
: t("errors.verification_failed_subtitle_no_retry", {
|
|
51
|
+
documentType: "document",
|
|
52
|
+
}) })] }), !blockContinue && (errorCode === null || errorCode === void 0 ? void 0 : errorCode.startsWith("8")) && (jsx("div", { className: "bg-orange-50 border border-orange-200 rounded-lg p-4", children: jsx("p", { className: "text-sm text-orange-800", children: t("errors.specimen_detected") }) })), !blockContinue && !isServiceRefusal && (jsxs("div", { className: "bg-red-50 border border-red-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-red-900 mb-2", children: t("errors.problems_detected") }), jsx("div", { className: "text-sm text-red-800 space-y-1", children: validationPoints.map(function (point, index) { return (jsx("p", { children: point }, index)); }) })] })), !blockContinue && !isRetryAllowed && (jsxs("div", { className: "bg-orange-50 border border-orange-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-orange-900 mb-2", children: t("errors.resubmission.max_attempts_reached") }), jsx("p", { className: "text-sm text-orange-800", children: maxResubmissionAttempts !== undefined
|
|
46
53
|
? t("errors.resubmission.max_attempts_reached_description")
|
|
47
|
-
: t("errors.resubmission.no_resubmission_allowed") })] })), !blockContinue && getUserGuidance() && (jsxs("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-yellow-900 mb-2", children:
|
|
48
|
-
? // Quota / out of credits: nothing for the end user to improve.
|
|
49
|
-
t("errors.service_refusal_title")
|
|
50
|
-
: "\uD83D\uDCA1 ".concat(t("errors.improvement_tips", "Conseils d'amélioration")) }), jsx("p", { className: "text-sm text-yellow-800", children: getUserGuidance() })] })), !blockContinue && isRetryAllowed && (jsxs("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-blue-900 mb-2", children: t("errors.next_steps") }), jsx("p", { className: "text-sm text-blue-800", children: t("errors.next_steps_description") })] }))] }) }) }));
|
|
54
|
+
: t("errors.resubmission.no_resubmission_allowed") })] })), !blockContinue && !isServiceRefusal && getUserGuidance() && (jsxs("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-yellow-900 mb-2", children: "\uD83D\uDCA1 ".concat(t("errors.improvement_tips", "Conseils d'amélioration")) }), jsx("p", { className: "text-sm text-yellow-800", children: getUserGuidance() })] })), !blockContinue && !isServiceRefusal && isRetryAllowed && (jsxs("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: [jsx("h3", { className: "font-medium text-blue-900 mb-2", children: t("errors.next_steps") }), jsx("p", { className: "text-sm text-blue-800", children: t("errors.next_steps_description") })] }))] }) }) }));
|
|
51
55
|
};
|
|
52
56
|
|
|
53
57
|
export { JDIError as default };
|
|
@@ -8,7 +8,7 @@ import { getActiveSessionId } from '../../services/sessionMemoryStore.js';
|
|
|
8
8
|
import { isPng, dataUrlToFile, isJpeg, convertJpegToPng, isPdf, convertPdfToPng } from '../../utils/imageConverter.js';
|
|
9
9
|
import { useI18n } from '../../hooks/useI18n.js';
|
|
10
10
|
import { requiresTwoSides } from '../../utils/documentLabels.js';
|
|
11
|
-
import { isS3UploadNotConfirmedError, getServiceErrorCode, getServiceErrorCodeFromCodeName } from '../../utils/analysisErrors.js';
|
|
11
|
+
import { isS3UploadNotConfirmedError, getServiceErrorCode, isAnalysisFailedError, getServiceErrorCodeFromCodeName } from '../../utils/analysisErrors.js';
|
|
12
12
|
import { isBlockingCode } from '../../utils/jdiCodes.js';
|
|
13
13
|
|
|
14
14
|
// Fonction pour obtenir les étapes de traitement traduites
|
|
@@ -316,7 +316,12 @@ var JDIProcessing = memo(function (_a) {
|
|
|
316
316
|
},
|
|
317
317
|
]
|
|
318
318
|
: undefined,
|
|
319
|
-
|
|
319
|
+
// Analyse en erreur côté moteur : nouvel essai possible (dans la
|
|
320
|
+
// limite de resoumission du nœud), jamais un passage silencieux.
|
|
321
|
+
canRetry: isNetworkError ||
|
|
322
|
+
isUploadNotConfirmed ||
|
|
323
|
+
!!serviceErrorCode ||
|
|
324
|
+
isAnalysisFailedError(error_2),
|
|
320
325
|
blockContinue: isUploadNotConfirmed,
|
|
321
326
|
});
|
|
322
327
|
setIsComplete(true);
|
|
@@ -31,11 +31,10 @@ var NfcScanStep = function (_a) {
|
|
|
31
31
|
// Sur mobile, on ouvre directement l'app de scan au lieu d'afficher un QR code inutile.
|
|
32
32
|
var isMobile = useMemo(function () { return isMobileDevice(); }, []);
|
|
33
33
|
var isIOS = useMemo(function () { return isIOSDevice(); }, []);
|
|
34
|
-
var nfcUrl = useMemo(function () {
|
|
35
|
-
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
36
|
-
return "".concat(origin, "/scan/").concat(sessionId);
|
|
37
|
-
}, [sessionId]);
|
|
38
34
|
var apiBaseUrl = useMemo(function () { return getBaseURL(); }, []);
|
|
35
|
+
// Domaine Datakeen (celui de l'API), pas celui de la page hôte : seul lui sert l'AASA qui
|
|
36
|
+
// déclenche l'App Clip iOS. Sur un site intégrateur, l'origine de la page ouvrait le navigateur.
|
|
37
|
+
var nfcUrl = useMemo(function () { return "".concat(new URL(apiBaseUrl, window.location.href).origin, "/scan/").concat(sessionId); }, [apiBaseUrl, sessionId]);
|
|
39
38
|
var iosAppLinks = useMemo(function () {
|
|
40
39
|
var host = new URL(apiBaseUrl, window.location.href).host;
|
|
41
40
|
// `return` : l'app rouvre exactement cette URL en fin de scan, ce qui ramène Safari sur cet
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __awaiter, __generator, __assign } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useEffect, useRef, useMemo } from 'react';
|
|
4
|
+
import { isServiceErrorCode } from '../../utils/analysisErrors.js';
|
|
4
5
|
import JDIPreIntroduction from '../jdi/JDIPreIntroduction.js';
|
|
5
6
|
import JDICountrySelection from '../jdi/JDICountrySelection.js';
|
|
6
7
|
import JDIDocumentSelection from '../jdi/JDIDocumentSelection.js';
|
|
@@ -545,12 +546,21 @@ var DocumentCheck = function (_a) {
|
|
|
545
546
|
setDocStep(5);
|
|
546
547
|
}
|
|
547
548
|
else {
|
|
548
|
-
var
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
549
|
+
var failureCode = apiAnalysisData && apiAnalysisData.length > 0
|
|
550
|
+
? apiAnalysisData[0].code
|
|
551
|
+
: (errorCode !== null && errorCode !== void 0 ? errorCode : undefined);
|
|
552
|
+
// Refus de service (quota du moteur / crédits épuisés) : le document n'y
|
|
553
|
+
// est pour rien. Ce n'est pas une resoumission consommée, et jamais de
|
|
554
|
+
// routage automatique : l'écran d'erreur explique le blocage.
|
|
555
|
+
var isServiceRefusal = isServiceErrorCode(failureCode);
|
|
556
|
+
var newRetryCount = isServiceRefusal ? retryCount : retryCount + 1;
|
|
557
|
+
if (!isServiceRefusal) {
|
|
558
|
+
// Increment retry count both in state and session
|
|
559
|
+
setRetryCount(newRetryCount);
|
|
560
|
+
incrementNodeRetryCount(sessionId, node.id, retryCount).catch(function (error) {
|
|
561
|
+
console.error("Failed to update retry count in session:", error);
|
|
562
|
+
});
|
|
563
|
+
}
|
|
554
564
|
// Routage automatique vers la sortie "false" (nouveau) : uniquement
|
|
555
565
|
// pour un véritable échec de code JDI bloquant (pas un souci d'upload
|
|
556
566
|
// S3 non confirmé — cf. shouldBlockContinue), une fois les
|
|
@@ -558,9 +568,7 @@ var DocumentCheck = function (_a) {
|
|
|
558
568
|
// Sinon, comportement legacy inchangé : écran d'erreur (retry et/ou
|
|
559
569
|
// "continuer quand même" selon isRetryAllowed/allowContinueOnFailure).
|
|
560
570
|
if (shouldBlockContinue !== true && template) {
|
|
561
|
-
var currentCode =
|
|
562
|
-
? apiAnalysisData[0].code
|
|
563
|
-
: (errorCode !== null && errorCode !== void 0 ? errorCode : undefined);
|
|
571
|
+
var currentCode = failureCode;
|
|
564
572
|
var effectiveMaxAttempts = (currentCode === null || currentCode === void 0 ? void 0 : currentCode.startsWith("8")) || node.allowResubmission === false
|
|
565
573
|
? 0
|
|
566
574
|
: ((_a = node.maxResubmissionAttempts) !== null && _a !== void 0 ? _a : Infinity);
|
|
@@ -568,6 +576,7 @@ var DocumentCheck = function (_a) {
|
|
|
568
576
|
hasExceededAttempts: hasExceededResubmissionAttempts(newRetryCount, effectiveMaxAttempts),
|
|
569
577
|
hasFalseEdge: hasOutgoingEdgeForHandle(node.id, template, "false"),
|
|
570
578
|
action: normalizeMaxResubmissionAction(node.maxResubmissionAction),
|
|
579
|
+
isServiceRefusal: isServiceRefusal,
|
|
571
580
|
});
|
|
572
581
|
if (!route.showErrorScreen && route.handle) {
|
|
573
582
|
stepObject.goToNextStep(node.id, template, route.handle);
|
|
@@ -601,6 +610,13 @@ var DocumentCheck = function (_a) {
|
|
|
601
610
|
maxResubmissionAttempts: node.maxResubmissionAttempts,
|
|
602
611
|
retryCount: retryCount,
|
|
603
612
|
});
|
|
613
|
+
// Refus de service (quota / crédits) : réessayer reste possible (le quota
|
|
614
|
+
// peut se libérer) et ne consomme pas de resoumission ; « continuer quand
|
|
615
|
+
// même » est masqué par JDIError. Sans cela, l'utilisateur serait bloqué.
|
|
616
|
+
// `?? undefined` : passe une copie au garde de type pour ne pas réduire `errorCode` à `never` plus bas.
|
|
617
|
+
if (isServiceErrorCode(errorCode !== null && errorCode !== void 0 ? errorCode : undefined)) {
|
|
618
|
+
return true;
|
|
619
|
+
}
|
|
604
620
|
// Specimen documents (code 8.x) block retry — user can only continue anyway
|
|
605
621
|
if (errorCode === null || errorCode === void 0 ? void 0 : errorCode.startsWith("8")) {
|
|
606
622
|
return false;
|
|
@@ -29,9 +29,14 @@ function hasExceededResubmissionAttempts(retryCountAfterFailure, maxAttempts) {
|
|
|
29
29
|
* inchangé (rétrocompat totale, aucune navigation automatique).
|
|
30
30
|
* - Échec épuisé, sortie "false" câblée → navigation automatique silencieuse
|
|
31
31
|
* selon `action` (miroir de `conditionMaxRetryAction`).
|
|
32
|
+
* - Refus de service (quota / crédits) → toujours l'écran d'erreur : le
|
|
33
|
+
* parcours ne doit pas avancer sans que l'utilisateur sache pourquoi.
|
|
32
34
|
*/
|
|
33
35
|
function resolveControleJdiOutcomeRoute(params) {
|
|
34
|
-
var hasExceededAttempts = params.hasExceededAttempts, hasFalseEdge = params.hasFalseEdge, action = params.action;
|
|
36
|
+
var hasExceededAttempts = params.hasExceededAttempts, hasFalseEdge = params.hasFalseEdge, action = params.action, isServiceRefusal = params.isServiceRefusal;
|
|
37
|
+
if (isServiceRefusal) {
|
|
38
|
+
return { handle: undefined, showErrorScreen: true };
|
|
39
|
+
}
|
|
35
40
|
if (!hasExceededAttempts || !hasFalseEdge) {
|
|
36
41
|
return { handle: undefined, showErrorScreen: true };
|
|
37
42
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter, __generator } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
2
|
import { useMemo, useState, useEffect } from 'react';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
@@ -6,7 +5,6 @@ import sdkI18n from '../../i18n/index.js';
|
|
|
6
5
|
import SignatureElectronicIntroduction from './SignatureElectronicIntroduction.js';
|
|
7
6
|
import DocusealSignature from './DocusealSignature.js';
|
|
8
7
|
import SignedDocumentPreview from './SignedDocumentPreview.js';
|
|
9
|
-
import { updateSessionStatus } from '../../services/sessionService.js';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Maps an InformationFieldKey (journey field) to the corresponding UserInput key.
|
|
@@ -86,34 +84,19 @@ var SignatureElectronic = function (_a) {
|
|
|
86
84
|
var handleContinue = function () {
|
|
87
85
|
setShowSignature(true);
|
|
88
86
|
};
|
|
89
|
-
var handleComplete = function () {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
_a.sent();
|
|
103
|
-
return [3 /*break*/, 4];
|
|
104
|
-
case 3:
|
|
105
|
-
err_1 = _a.sent();
|
|
106
|
-
console.error("[SignatureElectronic] Failed to update session status:", err_1);
|
|
107
|
-
return [3 /*break*/, 4];
|
|
108
|
-
case 4:
|
|
109
|
-
// Toujours montrer le document réellement signé avant de continuer
|
|
110
|
-
// (rassure l'utilisateur — pas de bascule directe vers l'étape suivante).
|
|
111
|
-
setSignedAt(new Date().toISOString());
|
|
112
|
-
setShowSignedDocumentPreview(true);
|
|
113
|
-
return [2 /*return*/];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}); };
|
|
87
|
+
var handleComplete = function () {
|
|
88
|
+
if (typeof window !== "undefined") {
|
|
89
|
+
window.sessionStorage.removeItem(signatureViewStorageKey);
|
|
90
|
+
}
|
|
91
|
+
// La signature ne modifie PLUS le statut de la session (APP3-1996) : seul le
|
|
92
|
+
// nœud « end » le fait (PATCH `ended`). Poser `conform` ici affichait « Conforme »
|
|
93
|
+
// dans le backoffice, en vert, entre la signature et la fin du parcours, alors
|
|
94
|
+
// que le verdict n'était pas encore rendu.
|
|
95
|
+
// Toujours montrer le document réellement signé avant de continuer
|
|
96
|
+
// (rassure l'utilisateur — pas de bascule directe vers l'étape suivante).
|
|
97
|
+
setSignedAt(new Date().toISOString());
|
|
98
|
+
setShowSignedDocumentPreview(true);
|
|
99
|
+
};
|
|
117
100
|
var handleContinueFromPreview = function () {
|
|
118
101
|
// Progress to the next step via graph edges (pas d'arithmétique — évite de sauter dans la mauvaise branche)
|
|
119
102
|
stepObject.goToNextStep(node.id, session.template);
|