datakeen-session-react 1.1.202-rc.4 → 1.1.202-rc.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/document-collection/DocumentError.js +18 -14
- package/dist/cjs/components/jdi/JDIError.js +16 -12
- package/dist/cjs/components/session/DocumentCheck.js +25 -9
- package/dist/cjs/components/session/controleJdiPolicy.js +6 -1
- package/dist/cjs/hooks/useUserInputForm.js +42 -0
- package/dist/esm/components/document-collection/DocumentError.js +18 -14
- package/dist/esm/components/jdi/JDIError.js +16 -12
- package/dist/esm/components/session/DocumentCheck.js +25 -9
- package/dist/esm/components/session/controleJdiPolicy.js +6 -1
- package/dist/esm/hooks/useUserInputForm.js +42 -0
- package/package.json +1 -1
|
@@ -17,6 +17,9 @@ var DocumentError = 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 = analysisErrors.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 && analysisErrors.isServiceErrorCode(errorCode);
|
|
20
23
|
var _f = React.useState([]), validationPoints = _f[0], setValidationPoints = _f[1];
|
|
21
24
|
React.useEffect(function () {
|
|
22
25
|
// Use shared utility to get validation points
|
|
@@ -50,22 +53,23 @@ var DocumentError = function (_a) {
|
|
|
50
53
|
};
|
|
51
54
|
return (jsxRuntime.jsxs("div", { className: "flex flex-col justify-between h-full w-full", children: [jsxRuntime.jsx("div", { className: "flex-1 px-4 py-6 pt-11 md:px-8 md:py-8", children: jsxRuntime.jsxs("div", { className: "w-full max-w-md mx-auto space-y-6", children: [jsxRuntime.jsx("div", { className: "text-center", children: jsxRuntime.jsx("div", { className: "mx-auto w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mb-4", children: jsxRuntime.jsx("div", { className: "w-8 h-8 bg-red-500 rounded-full flex items-center justify-center", children: jsxRuntime.jsx("span", { className: "text-white text-lg", children: "\u2715" }) }) }) }), jsxRuntime.jsxs("div", { className: "text-center space-y-4", children: [jsxRuntime.jsx(Title.default, { className: "text-xl md:text-2xl lg:text-3xl text-red-600", children: blockContinue
|
|
52
55
|
? t("errors.upload_not_confirmed.title")
|
|
53
|
-
:
|
|
56
|
+
: isServiceRefusal
|
|
57
|
+
? t("errors.service_refusal_title")
|
|
58
|
+
: t("errors.verification_failed", "Vérification échouée") }), jsxRuntime.jsx(Subtitle.default, { className: "text-sm text-gray-600 leading-relaxed", children: blockContinue
|
|
54
59
|
? t("errors.upload_not_confirmed.subtitle")
|
|
55
|
-
:
|
|
56
|
-
?
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
: isServiceRefusal
|
|
61
|
+
? getUserGuidance()
|
|
62
|
+
: isRetryAllowed
|
|
63
|
+
? t("errors.verification_failed_subtitle", {
|
|
64
|
+
documentType: getDocumentLabel(documentType),
|
|
65
|
+
defaultValue: "Nous n'avons pas pu valider votre {{documentType}}. Veuillez vérifier les points ci-dessous et réessayer.",
|
|
66
|
+
})
|
|
67
|
+
: t("errors.verification_failed_subtitle_no_retry", {
|
|
68
|
+
documentType: getDocumentLabel(documentType),
|
|
69
|
+
defaultValue: "Nous n'avons pas pu valider votre {{documentType}}. Veuillez vérifier les points ci-dessous.",
|
|
70
|
+
}) })] }), !blockContinue && !isServiceRefusal && (jsxRuntime.jsxs("div", { className: "bg-red-50 border border-red-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-red-900 mb-2", children: t("errors.problems_detected", "Problèmes détectés") }), jsxRuntime.jsx("div", { className: "text-sm text-red-800 space-y-1", children: validationPoints.map(function (point, index) { return (jsxRuntime.jsx("p", { children: point }, index)); }) })] })), !blockContinue && !isRetryAllowed && (jsxRuntime.jsxs("div", { className: "bg-orange-50 border border-orange-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-orange-900 mb-2", children: t("errors.resubmission.max_attempts_reached", "Nombre maximum de tentatives atteint") }), jsxRuntime.jsx("p", { className: "text-sm text-orange-800", children: maxResubmissionAttempts !== undefined
|
|
64
71
|
? t("errors.resubmission.max_attempts_reached_description")
|
|
65
|
-
: t("errors.resubmission.no_resubmission_allowed") })] })), !blockContinue && getUserGuidance() && (jsxRuntime.jsxs("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-yellow-900 mb-2", children:
|
|
66
|
-
? // Quota / out of credits: nothing for the end user to improve.
|
|
67
|
-
t("errors.service_refusal_title")
|
|
68
|
-
: "\uD83D\uDCA1 ".concat(t("errors.improvement_tips", "Conseils d'amélioration")) }), jsxRuntime.jsx("p", { className: "text-sm text-yellow-800", children: getUserGuidance() })] })), !blockContinue && isRetryAllowed && (jsxRuntime.jsxs("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-blue-900 mb-2", children: t("errors.next_steps", "Prochaines étapes") }), jsxRuntime.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é.") })] }))] }) }), jsxRuntime.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: jsxRuntime.jsxs("div", { className: "w-full max-w-md mx-auto", children: [jsxRuntime.jsx("div", { className: "flex flex-col space-y-3 md:hidden", children: blockContinue ? (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [onBackToUserInput && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onBackToUserInput, type: "back", children: t("errors.back_to_user_input", "Retour aux informations d'identité") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") })), isRetryAllowed && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })), !isRetryAllowed && continueAnyway && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") }))] })) }), jsxRuntime.jsx("div", { className: "hidden md:flex flex-col space-y-3", children: jsxRuntime.jsx("div", { className: "flex justify-center space-x-3", children: blockContinue ? (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [onBackToUserInput && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onBackToUserInput, type: "back", children: t("errors.back_to_user_input", "Retour aux informations d'identité") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") })), isRetryAllowed && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })), !isRetryAllowed && continueAnyway && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "continue", children: t("errors.continue_anyway", "Poursuivre tout de même") }))] })) }) })] }) })] }));
|
|
72
|
+
: t("errors.resubmission.no_resubmission_allowed") })] })), !blockContinue && !isServiceRefusal && getUserGuidance() && (jsxRuntime.jsxs("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-yellow-900 mb-2", children: "\uD83D\uDCA1 ".concat(t("errors.improvement_tips", "Conseils d'amélioration")) }), jsxRuntime.jsx("p", { className: "text-sm text-yellow-800", children: getUserGuidance() })] })), !blockContinue && !isServiceRefusal && isRetryAllowed && (jsxRuntime.jsxs("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-blue-900 mb-2", children: t("errors.next_steps", "Prochaines étapes") }), jsxRuntime.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é.") })] }))] }) }), jsxRuntime.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: jsxRuntime.jsxs("div", { className: "w-full max-w-md mx-auto", children: [jsxRuntime.jsx("div", { className: "flex flex-col space-y-3 md:hidden", children: blockContinue ? (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [onBackToUserInput && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onBackToUserInput, type: "back", children: t("errors.back_to_user_input", "Retour aux informations d'identité") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") })), isRetryAllowed && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })), !isRetryAllowed && continueAnyway && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") }))] })) }), jsxRuntime.jsx("div", { className: "hidden md:flex flex-col space-y-3", children: jsxRuntime.jsx("div", { className: "flex justify-center space-x-3", children: blockContinue ? (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [onBackToUserInput && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onBackToUserInput, type: "back", children: t("errors.back_to_user_input", "Retour aux informations d'identité") })), retryCount >= 1 && isRetryAllowed && continueAnyway && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "back", children: t("errors.continue_anyway", "Poursuivre tout de même") })), isRetryAllowed && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification", "Recommencer la vérification") })), !isRetryAllowed && continueAnyway && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "continue", children: t("errors.continue_anyway", "Poursuivre tout de même") }))] })) }) })] }) })] }));
|
|
69
73
|
};
|
|
70
74
|
|
|
71
75
|
exports.default = DocumentError;
|
|
@@ -21,6 +21,9 @@ var JDIError = function (_a) {
|
|
|
21
21
|
// APP3-1955: a service refusal (no credits / quota) blocks the journey,
|
|
22
22
|
// whatever node.allowContinueOnFailure says.
|
|
23
23
|
var continueAnyway = analysisErrors.isServiceErrorCode(errorCode) ? undefined : onContinueAnyway;
|
|
24
|
+
// Quota / plus de crédits : rien à corriger sur le document. Écran dédié
|
|
25
|
+
// (message de refus en tête), pas la structure d'un document rejeté.
|
|
26
|
+
var isServiceRefusal = !blockContinue && analysisErrors.isServiceErrorCode(errorCode);
|
|
24
27
|
var _g = React.useState([]), validationPoints = _g[0], setValidationPoints = _g[1];
|
|
25
28
|
// Détail de mismatch d'identité (code 7.0), calculé côté backend et porté
|
|
26
29
|
// par la première prédiction. Absent pour tous les autres codes.
|
|
@@ -38,20 +41,21 @@ var JDIError = function (_a) {
|
|
|
38
41
|
};
|
|
39
42
|
return (jsxRuntime.jsx(MobilePageLayout.default, { footer: jsxRuntime.jsxs("div", { className: "w-full max-w-md mx-auto", children: [jsxRuntime.jsx("div", { className: "flex flex-col space-y-3 md:hidden", children: blockContinue ? (jsxRuntime.jsx(Button.default, { onClick: onRetry, className: "w-full py-3", children: t("errors.retry_verification") })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [onBackToUserInput && (jsxRuntime.jsx(ButtonDesktop.default, { 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 && (jsxRuntime.jsx(ButtonDesktop.default, { 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 && (jsxRuntime.jsx(Button.default, { onClick: onRetry, className: "w-full py-3", children: t("errors.retry_verification") })), !isRetryAllowed && continueAnyway && (jsxRuntime.jsx(Button.default, { onClick: continueAnyway, className: "w-full py-3", children: t("errors.continue_anyway") }))] })) }), jsxRuntime.jsx("div", { className: "hidden md:flex flex-col space-y-3", children: jsxRuntime.jsx("div", { className: "flex justify-center space-x-3", children: blockContinue ? (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification") })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [onBackToUserInput && (jsxRuntime.jsx(ButtonDesktop.default, { 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 && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "back", className: "text-black text-center font-poppins text-sm font-medium py-2", children: t("errors.continue_anyway") })), isRetryAllowed && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: onRetry, type: "continue", children: t("errors.retry_verification") })), !isRetryAllowed && continueAnyway && (jsxRuntime.jsx(ButtonDesktop.default, { onClick: continueAnyway, type: "continue", children: t("errors.continue_anyway") }))] })) }) })] }), children: jsxRuntime.jsx("div", { className: "px-4 py-6 pt-11 md:px-8 md:py-8", children: jsxRuntime.jsxs("div", { className: "w-full max-w-md mx-auto space-y-6", children: [jsxRuntime.jsx("div", { className: "text-center", children: jsxRuntime.jsx("div", { className: "mx-auto w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mb-4", children: jsxRuntime.jsx("div", { className: "w-8 h-8 bg-red-500 rounded-full flex items-center justify-center", children: jsxRuntime.jsx("span", { className: "text-white text-lg", children: "\u2715" }) }) }) }), jsxRuntime.jsxs("div", { className: "text-center space-y-4", children: [jsxRuntime.jsx(Title.default, { className: "text-xl md:text-2xl lg:text-3xl text-red-600", children: blockContinue
|
|
40
43
|
? t("errors.upload_not_confirmed.title")
|
|
41
|
-
:
|
|
44
|
+
: isServiceRefusal
|
|
45
|
+
? t("errors.service_refusal_title")
|
|
46
|
+
: t("errors.verification_failed") }), jsxRuntime.jsx(Subtitle.default, { className: "text-sm text-gray-600 leading-relaxed", children: blockContinue
|
|
42
47
|
? t("errors.upload_not_confirmed.subtitle")
|
|
43
|
-
:
|
|
44
|
-
?
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
: isServiceRefusal
|
|
49
|
+
? getUserGuidance()
|
|
50
|
+
: isRetryAllowed
|
|
51
|
+
? t("errors.verification_failed_subtitle", {
|
|
52
|
+
documentType: "document",
|
|
53
|
+
})
|
|
54
|
+
: t("errors.verification_failed_subtitle_no_retry", {
|
|
55
|
+
documentType: "document",
|
|
56
|
+
}) })] }), !blockContinue && (errorCode === null || errorCode === void 0 ? void 0 : errorCode.startsWith("8")) && (jsxRuntime.jsx("div", { className: "bg-orange-50 border border-orange-200 rounded-lg p-4", children: jsxRuntime.jsx("p", { className: "text-sm text-orange-800", children: t("errors.specimen_detected") }) })), !blockContinue && !isServiceRefusal && (jsxRuntime.jsxs("div", { className: "bg-red-50 border border-red-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-red-900 mb-2", children: t("errors.problems_detected") }), jsxRuntime.jsx("div", { className: "text-sm text-red-800 space-y-1", children: validationPoints.map(function (point, index) { return (jsxRuntime.jsx("p", { children: point }, index)); }) })] })), !blockContinue && !isRetryAllowed && (jsxRuntime.jsxs("div", { className: "bg-orange-50 border border-orange-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-orange-900 mb-2", children: t("errors.resubmission.max_attempts_reached") }), jsxRuntime.jsx("p", { className: "text-sm text-orange-800", children: maxResubmissionAttempts !== undefined
|
|
50
57
|
? t("errors.resubmission.max_attempts_reached_description")
|
|
51
|
-
: t("errors.resubmission.no_resubmission_allowed") })] })), !blockContinue && getUserGuidance() && (jsxRuntime.jsxs("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-yellow-900 mb-2", children:
|
|
52
|
-
? // Quota / out of credits: nothing for the end user to improve.
|
|
53
|
-
t("errors.service_refusal_title")
|
|
54
|
-
: "\uD83D\uDCA1 ".concat(t("errors.improvement_tips", "Conseils d'amélioration")) }), jsxRuntime.jsx("p", { className: "text-sm text-yellow-800", children: getUserGuidance() })] })), !blockContinue && isRetryAllowed && (jsxRuntime.jsxs("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-blue-900 mb-2", children: t("errors.next_steps") }), jsxRuntime.jsx("p", { className: "text-sm text-blue-800", children: t("errors.next_steps_description") })] }))] }) }) }));
|
|
58
|
+
: t("errors.resubmission.no_resubmission_allowed") })] })), !blockContinue && !isServiceRefusal && getUserGuidance() && (jsxRuntime.jsxs("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-yellow-900 mb-2", children: "\uD83D\uDCA1 ".concat(t("errors.improvement_tips", "Conseils d'amélioration")) }), jsxRuntime.jsx("p", { className: "text-sm text-yellow-800", children: getUserGuidance() })] })), !blockContinue && !isServiceRefusal && isRetryAllowed && (jsxRuntime.jsxs("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: [jsxRuntime.jsx("h3", { className: "font-medium text-blue-900 mb-2", children: t("errors.next_steps") }), jsxRuntime.jsx("p", { className: "text-sm text-blue-800", children: t("errors.next_steps_description") })] }))] }) }) }));
|
|
55
59
|
};
|
|
56
60
|
|
|
57
61
|
exports.default = JDIError;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var analysisErrors = require('../../utils/analysisErrors.js');
|
|
8
9
|
var JDIPreIntroduction = require('../jdi/JDIPreIntroduction.js');
|
|
9
10
|
var JDICountrySelection = require('../jdi/JDICountrySelection.js');
|
|
10
11
|
var JDIDocumentSelection = require('../jdi/JDIDocumentSelection.js');
|
|
@@ -549,12 +550,21 @@ var DocumentCheck = function (_a) {
|
|
|
549
550
|
setDocStep(5);
|
|
550
551
|
}
|
|
551
552
|
else {
|
|
552
|
-
var
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
553
|
+
var failureCode = apiAnalysisData && apiAnalysisData.length > 0
|
|
554
|
+
? apiAnalysisData[0].code
|
|
555
|
+
: (errorCode !== null && errorCode !== void 0 ? errorCode : undefined);
|
|
556
|
+
// Refus de service (quota du moteur / crédits épuisés) : le document n'y
|
|
557
|
+
// est pour rien. Ce n'est pas une resoumission consommée, et jamais de
|
|
558
|
+
// routage automatique : l'écran d'erreur explique le blocage.
|
|
559
|
+
var isServiceRefusal = analysisErrors.isServiceErrorCode(failureCode);
|
|
560
|
+
var newRetryCount = isServiceRefusal ? retryCount : retryCount + 1;
|
|
561
|
+
if (!isServiceRefusal) {
|
|
562
|
+
// Increment retry count both in state and session
|
|
563
|
+
setRetryCount(newRetryCount);
|
|
564
|
+
retryService.incrementNodeRetryCount(sessionId, node.id, retryCount).catch(function (error) {
|
|
565
|
+
console.error("Failed to update retry count in session:", error);
|
|
566
|
+
});
|
|
567
|
+
}
|
|
558
568
|
// Routage automatique vers la sortie "false" (nouveau) : uniquement
|
|
559
569
|
// pour un véritable échec de code JDI bloquant (pas un souci d'upload
|
|
560
570
|
// S3 non confirmé — cf. shouldBlockContinue), une fois les
|
|
@@ -562,9 +572,7 @@ var DocumentCheck = function (_a) {
|
|
|
562
572
|
// Sinon, comportement legacy inchangé : écran d'erreur (retry et/ou
|
|
563
573
|
// "continuer quand même" selon isRetryAllowed/allowContinueOnFailure).
|
|
564
574
|
if (shouldBlockContinue !== true && template) {
|
|
565
|
-
var currentCode =
|
|
566
|
-
? apiAnalysisData[0].code
|
|
567
|
-
: (errorCode !== null && errorCode !== void 0 ? errorCode : undefined);
|
|
575
|
+
var currentCode = failureCode;
|
|
568
576
|
var effectiveMaxAttempts = (currentCode === null || currentCode === void 0 ? void 0 : currentCode.startsWith("8")) || node.allowResubmission === false
|
|
569
577
|
? 0
|
|
570
578
|
: ((_a = node.maxResubmissionAttempts) !== null && _a !== void 0 ? _a : Infinity);
|
|
@@ -572,6 +580,7 @@ var DocumentCheck = function (_a) {
|
|
|
572
580
|
hasExceededAttempts: controleJdiPolicy.hasExceededResubmissionAttempts(newRetryCount, effectiveMaxAttempts),
|
|
573
581
|
hasFalseEdge: sessionService.hasOutgoingEdgeForHandle(node.id, template, "false"),
|
|
574
582
|
action: controleJdiPolicy.normalizeMaxResubmissionAction(node.maxResubmissionAction),
|
|
583
|
+
isServiceRefusal: isServiceRefusal,
|
|
575
584
|
});
|
|
576
585
|
if (!route.showErrorScreen && route.handle) {
|
|
577
586
|
stepObject.goToNextStep(node.id, template, route.handle);
|
|
@@ -605,6 +614,13 @@ var DocumentCheck = function (_a) {
|
|
|
605
614
|
maxResubmissionAttempts: node.maxResubmissionAttempts,
|
|
606
615
|
retryCount: retryCount,
|
|
607
616
|
});
|
|
617
|
+
// Refus de service (quota / crédits) : réessayer reste possible (le quota
|
|
618
|
+
// peut se libérer) et ne consomme pas de resoumission ; « continuer quand
|
|
619
|
+
// même » est masqué par JDIError. Sans cela, l'utilisateur serait bloqué.
|
|
620
|
+
// `?? undefined` : passe une copie au garde de type pour ne pas réduire `errorCode` à `never` plus bas.
|
|
621
|
+
if (analysisErrors.isServiceErrorCode(errorCode !== null && errorCode !== void 0 ? errorCode : undefined)) {
|
|
622
|
+
return true;
|
|
623
|
+
}
|
|
608
624
|
// Specimen documents (code 8.x) block retry — user can only continue anyway
|
|
609
625
|
if (errorCode === null || errorCode === void 0 ? void 0 : errorCode.startsWith("8")) {
|
|
610
626
|
return false;
|
|
@@ -31,9 +31,14 @@ function hasExceededResubmissionAttempts(retryCountAfterFailure, maxAttempts) {
|
|
|
31
31
|
* inchangé (rétrocompat totale, aucune navigation automatique).
|
|
32
32
|
* - Échec épuisé, sortie "false" câblée → navigation automatique silencieuse
|
|
33
33
|
* selon `action` (miroir de `conditionMaxRetryAction`).
|
|
34
|
+
* - Refus de service (quota / crédits) → toujours l'écran d'erreur : le
|
|
35
|
+
* parcours ne doit pas avancer sans que l'utilisateur sache pourquoi.
|
|
34
36
|
*/
|
|
35
37
|
function resolveControleJdiOutcomeRoute(params) {
|
|
36
|
-
var hasExceededAttempts = params.hasExceededAttempts, hasFalseEdge = params.hasFalseEdge, action = params.action;
|
|
38
|
+
var hasExceededAttempts = params.hasExceededAttempts, hasFalseEdge = params.hasFalseEdge, action = params.action, isServiceRefusal = params.isServiceRefusal;
|
|
39
|
+
if (isServiceRefusal) {
|
|
40
|
+
return { handle: undefined, showErrorScreen: true };
|
|
41
|
+
}
|
|
37
42
|
if (!hasExceededAttempts || !hasFalseEdge) {
|
|
38
43
|
return { handle: undefined, showErrorScreen: true };
|
|
39
44
|
}
|
|
@@ -13,6 +13,7 @@ var labelToKey = require('../utils/labelToKey.js');
|
|
|
13
13
|
var session = require('../types/session.js');
|
|
14
14
|
var useI18n = require('./useI18n.js');
|
|
15
15
|
var auditTrailService = require('../services/auditTrailService.js');
|
|
16
|
+
var sessionService = require('../services/sessionService.js');
|
|
16
17
|
|
|
17
18
|
var useUserInputForm = function (_a) {
|
|
18
19
|
var stepObject = _a.stepObject, setUserInput = _a.setUserInput, initialUserInput = _a.initialUserInput, node = _a.node, template = _a.template, contactInfo = _a.contactInfo, setContactInfo = _a.setContactInfo, onContinueCallback = _a.onContinueCallback, sessionId = _a.sessionId;
|
|
@@ -269,6 +270,47 @@ var useUserInputForm = function (_a) {
|
|
|
269
270
|
form.phoneNumber,
|
|
270
271
|
form.companyName,
|
|
271
272
|
]);
|
|
273
|
+
// APP3-2020 — le serveur reporte prénom, nom et date de naissance lus sur la pièce
|
|
274
|
+
// à la racine de userInput après l'analyse : absents de la mémoire du SDK, on les
|
|
275
|
+
// relit à l'ouverture du formulaire personne physique (une fois par nœud, remount
|
|
276
|
+
// par key). Seules les clés vides sont complétées ; l'effet ci-dessus re-synchronise.
|
|
277
|
+
React.useEffect(function () {
|
|
278
|
+
var _a;
|
|
279
|
+
if (informationType !== "identity" ||
|
|
280
|
+
!sessionId ||
|
|
281
|
+
(initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.firstName) ||
|
|
282
|
+
(initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.lastName) ||
|
|
283
|
+
!((_a = template === null || template === void 0 ? void 0 : template.nodes) !== null && _a !== void 0 ? _a : []).some(function (n) {
|
|
284
|
+
return (n.type === "controle-jdi" || n.type === "identity-control") &&
|
|
285
|
+
n.copyIdentityToUserInput === true;
|
|
286
|
+
})) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
var cancelled = false;
|
|
290
|
+
sessionService.fetchSessionById(sessionId)
|
|
291
|
+
.then(function (fresh) {
|
|
292
|
+
var _a;
|
|
293
|
+
var server = ((_a = fresh === null || fresh === void 0 ? void 0 : fresh.userInput) !== null && _a !== void 0 ? _a : {});
|
|
294
|
+
var fill = ["firstName", "lastName", "birthDate"].filter(function (key) { return typeof server[key] === "string" && server[key]; });
|
|
295
|
+
if (cancelled || !fill.length)
|
|
296
|
+
return;
|
|
297
|
+
setUserInput(function (prev) {
|
|
298
|
+
var next = tslib_es6.__assign({}, prev);
|
|
299
|
+
for (var _i = 0, fill_1 = fill; _i < fill_1.length; _i++) {
|
|
300
|
+
var key = fill_1[_i];
|
|
301
|
+
if (!next[key])
|
|
302
|
+
next[key] = server[key];
|
|
303
|
+
}
|
|
304
|
+
return next;
|
|
305
|
+
});
|
|
306
|
+
})
|
|
307
|
+
.catch(function (error) {
|
|
308
|
+
console.warn("[UserInputForm] Identité reportée indisponible", error);
|
|
309
|
+
});
|
|
310
|
+
return function () {
|
|
311
|
+
cancelled = true;
|
|
312
|
+
};
|
|
313
|
+
}, []); // Une seule relecture à l'ouverture du nœud.
|
|
272
314
|
// Re-synchronise customFormData depuis initialUserInput quand on (ré)affiche un
|
|
273
315
|
// nœud DIFFÉRENT sur une instance réutilisée (retour arrière sans remount).
|
|
274
316
|
// Le champ form standard a déjà son propre effet de re-sync ci-dessus ; le
|
|
@@ -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 };
|
|
@@ -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 };
|
|
@@ -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
|
}
|
|
@@ -11,6 +11,7 @@ import { labelToKey } from '../utils/labelToKey.js';
|
|
|
11
11
|
import { DEFAULT_DATE_DISPLAY_FORMAT } from '../types/session.js';
|
|
12
12
|
import { useI18n } from './useI18n.js';
|
|
13
13
|
import { logFormValidated } from '../services/auditTrailService.js';
|
|
14
|
+
import { fetchSessionById } from '../services/sessionService.js';
|
|
14
15
|
|
|
15
16
|
var useUserInputForm = function (_a) {
|
|
16
17
|
var stepObject = _a.stepObject, setUserInput = _a.setUserInput, initialUserInput = _a.initialUserInput, node = _a.node, template = _a.template, contactInfo = _a.contactInfo, setContactInfo = _a.setContactInfo, onContinueCallback = _a.onContinueCallback, sessionId = _a.sessionId;
|
|
@@ -267,6 +268,47 @@ var useUserInputForm = function (_a) {
|
|
|
267
268
|
form.phoneNumber,
|
|
268
269
|
form.companyName,
|
|
269
270
|
]);
|
|
271
|
+
// APP3-2020 — le serveur reporte prénom, nom et date de naissance lus sur la pièce
|
|
272
|
+
// à la racine de userInput après l'analyse : absents de la mémoire du SDK, on les
|
|
273
|
+
// relit à l'ouverture du formulaire personne physique (une fois par nœud, remount
|
|
274
|
+
// par key). Seules les clés vides sont complétées ; l'effet ci-dessus re-synchronise.
|
|
275
|
+
useEffect(function () {
|
|
276
|
+
var _a;
|
|
277
|
+
if (informationType !== "identity" ||
|
|
278
|
+
!sessionId ||
|
|
279
|
+
(initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.firstName) ||
|
|
280
|
+
(initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.lastName) ||
|
|
281
|
+
!((_a = template === null || template === void 0 ? void 0 : template.nodes) !== null && _a !== void 0 ? _a : []).some(function (n) {
|
|
282
|
+
return (n.type === "controle-jdi" || n.type === "identity-control") &&
|
|
283
|
+
n.copyIdentityToUserInput === true;
|
|
284
|
+
})) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
var cancelled = false;
|
|
288
|
+
fetchSessionById(sessionId)
|
|
289
|
+
.then(function (fresh) {
|
|
290
|
+
var _a;
|
|
291
|
+
var server = ((_a = fresh === null || fresh === void 0 ? void 0 : fresh.userInput) !== null && _a !== void 0 ? _a : {});
|
|
292
|
+
var fill = ["firstName", "lastName", "birthDate"].filter(function (key) { return typeof server[key] === "string" && server[key]; });
|
|
293
|
+
if (cancelled || !fill.length)
|
|
294
|
+
return;
|
|
295
|
+
setUserInput(function (prev) {
|
|
296
|
+
var next = __assign({}, prev);
|
|
297
|
+
for (var _i = 0, fill_1 = fill; _i < fill_1.length; _i++) {
|
|
298
|
+
var key = fill_1[_i];
|
|
299
|
+
if (!next[key])
|
|
300
|
+
next[key] = server[key];
|
|
301
|
+
}
|
|
302
|
+
return next;
|
|
303
|
+
});
|
|
304
|
+
})
|
|
305
|
+
.catch(function (error) {
|
|
306
|
+
console.warn("[UserInputForm] Identité reportée indisponible", error);
|
|
307
|
+
});
|
|
308
|
+
return function () {
|
|
309
|
+
cancelled = true;
|
|
310
|
+
};
|
|
311
|
+
}, []); // Une seule relecture à l'ouverture du nœud.
|
|
270
312
|
// Re-synchronise customFormData depuis initialUserInput quand on (ré)affiche un
|
|
271
313
|
// nœud DIFFÉRENT sur une instance réutilisée (retour arrière sans remount).
|
|
272
314
|
// Le champ form standard a déjà son propre effet de re-sync ci-dessus ; le
|