datakeen-session-react 1.1.201 → 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.
Files changed (51) hide show
  1. package/dist/cjs/components/document-collection/DocumentCollection.js +2 -2
  2. package/dist/cjs/components/document-collection/DocumentError.js +18 -14
  3. package/dist/cjs/components/document-collection/DocumentProcessing.js +3 -1
  4. package/dist/cjs/components/id-check/Photo.js +42 -36
  5. package/dist/cjs/components/jdi/JDIDocumentSelection.js +3 -0
  6. package/dist/cjs/components/jdi/JDIDocumentUpload.js +5 -2
  7. package/dist/cjs/components/jdi/JDIError.js +16 -12
  8. package/dist/cjs/components/jdi/JDIProcessing.js +6 -1
  9. package/dist/cjs/components/nfc-scan/NfcScanNode.js +3 -4
  10. package/dist/cjs/components/session/DocumentCheck.js +48 -32
  11. package/dist/cjs/components/session/controleJdiPolicy.js +6 -1
  12. package/dist/cjs/components/signature-electronic/SignatureElectronic.js +13 -30
  13. package/dist/cjs/components/template/ExternalVerificationNodeHandler.js +94 -63
  14. package/dist/cjs/hooks/useStepNavigation.js +9 -1
  15. package/dist/cjs/i18n/en.json.js +11 -0
  16. package/dist/cjs/i18n/es.json.js +11 -0
  17. package/dist/cjs/i18n/fr.json.js +11 -0
  18. package/dist/cjs/index.css.js +1 -1
  19. package/dist/cjs/services/analysis.js +7 -0
  20. package/dist/cjs/services/cameraService.js +44 -23
  21. package/dist/cjs/services/pollingService.js +4 -1
  22. package/dist/cjs/services/sessionService.js +20 -10
  23. package/dist/cjs/utils/analysisErrors.js +11 -0
  24. package/dist/cjs/utils/cameraResolution.js +12 -0
  25. package/dist/cjs/utils/sessionStatus.js +3 -2
  26. package/dist/esm/components/document-collection/DocumentCollection.js +2 -2
  27. package/dist/esm/components/document-collection/DocumentError.js +18 -14
  28. package/dist/esm/components/document-collection/DocumentProcessing.js +4 -2
  29. package/dist/esm/components/id-check/Photo.js +42 -36
  30. package/dist/esm/components/jdi/JDIDocumentSelection.js +3 -0
  31. package/dist/esm/components/jdi/JDIDocumentUpload.js +5 -2
  32. package/dist/esm/components/jdi/JDIError.js +16 -12
  33. package/dist/esm/components/jdi/JDIProcessing.js +7 -2
  34. package/dist/esm/components/nfc-scan/NfcScanNode.js +3 -4
  35. package/dist/esm/components/session/DocumentCheck.js +48 -32
  36. package/dist/esm/components/session/controleJdiPolicy.js +6 -1
  37. package/dist/esm/components/signature-electronic/SignatureElectronic.js +13 -30
  38. package/dist/esm/components/template/ExternalVerificationNodeHandler.js +94 -63
  39. package/dist/esm/hooks/useStepNavigation.js +9 -1
  40. package/dist/esm/i18n/en.json.js +11 -0
  41. package/dist/esm/i18n/es.json.js +11 -0
  42. package/dist/esm/i18n/fr.json.js +11 -0
  43. package/dist/esm/index.css.js +1 -1
  44. package/dist/esm/services/analysis.js +7 -0
  45. package/dist/esm/services/cameraService.js +44 -23
  46. package/dist/esm/services/pollingService.js +4 -1
  47. package/dist/esm/services/sessionService.js +20 -11
  48. package/dist/esm/utils/analysisErrors.js +10 -1
  49. package/dist/esm/utils/cameraResolution.js +9 -0
  50. package/dist/esm/utils/sessionStatus.js +3 -2
  51. package/package.json +2 -1
@@ -308,7 +308,7 @@ var DocumentCollection = function (_a) {
308
308
  case "before-recto":
309
309
  return jsxRuntime.jsx(BeforePhoto.default, { setStep: function () { return setPhotoSubStep("recto"); }, isSingleSided: !requiresTwoSides_1, onBack: handleBack });
310
310
  case "recto":
311
- return jsxRuntime.jsx(Photo.default, { onCapture: function (img) { return handlePhotoCapture(img, "recto"); }, automaticCapture: false, maskType: "document" });
311
+ return jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (img) { return handlePhotoCapture(img, "recto"); }, automaticCapture: false, maskType: "document" });
312
312
  case "preview-recto":
313
313
  return (jsxRuntime.jsx(PhotoPreview.default, { imageUrl: capturedImages.recto, side: "recto", isSingleSided: !requiresTwoSides_1, onValidate: function () { return setPhotoSubStep(requiresTwoSides_1 ? "before-verso" : "confirmation"); }, onRetake: function () {
314
314
  setCapturedImages(function (prev) { var next = tslib_es6.__assign({}, prev); delete next.recto; return next; });
@@ -317,7 +317,7 @@ var DocumentCollection = function (_a) {
317
317
  case "before-verso":
318
318
  return jsxRuntime.jsx(BeforeVersoPhoto.default, { setStep: function () { return setPhotoSubStep("verso"); } });
319
319
  case "verso":
320
- return jsxRuntime.jsx(Photo.default, { onCapture: function (img) { return handlePhotoCapture(img, "verso"); }, automaticCapture: false, maskType: "document" });
320
+ return jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (img) { return handlePhotoCapture(img, "verso"); }, automaticCapture: false, maskType: "document" });
321
321
  case "preview-verso":
322
322
  return (jsxRuntime.jsx(PhotoPreview.default, { imageUrl: capturedImages.verso, side: "verso", onValidate: function () { return setPhotoSubStep("confirmation"); }, onRetake: function () {
323
323
  setCapturedImages(function (prev) { var next = tslib_es6.__assign({}, prev); delete next.verso; return next; });
@@ -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
- : t("errors.verification_failed", "Vérification échouée") }), jsxRuntime.jsx(Subtitle.default, { className: "text-sm text-gray-600 leading-relaxed", children: blockContinue
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
- : isRetryAllowed
56
- ? t("errors.verification_failed_subtitle", {
57
- documentType: getDocumentLabel(documentType),
58
- defaultValue: "Nous n'avons pas pu valider votre {{documentType}}. Veuillez vérifier les points ci-dessous et réessayer.",
59
- })
60
- : t("errors.verification_failed_subtitle_no_retry", {
61
- documentType: getDocumentLabel(documentType),
62
- defaultValue: "Nous n'avons pas pu valider votre {{documentType}}. Veuillez vérifier les points ci-dessous.",
63
- }) })] }), !blockContinue && (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
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: analysisErrors.isServiceErrorCode(errorCode)
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;
@@ -234,7 +234,9 @@ var DocumentProcessing = React.memo(function (_a) {
234
234
  },
235
235
  ]
236
236
  : undefined,
237
- canRetry: isUploadNotConfirmed || !!serviceErrorCode,
237
+ canRetry: isUploadNotConfirmed ||
238
+ !!serviceErrorCode ||
239
+ analysisErrors.isAnalysisFailedError(error_1),
238
240
  blockContinue: isUploadNotConfirmed,
239
241
  });
240
242
  setIsComplete(true);
@@ -11,27 +11,31 @@ var CameraError = require('./CameraError.js');
11
11
  var CameraMask = require('./CameraMask.js');
12
12
  var OrientationToggle = require('./OrientationToggle.js');
13
13
  var useI18n = require('../../hooks/useI18n.js');
14
+ var cameraResolution = require('../../utils/cameraResolution.js');
15
+ var sessionService = require('../../services/sessionService.js');
14
16
  var useIsMobile = require('../../hooks/useIsMobile.js');
15
17
 
16
18
  var Photo = function (_a) {
17
- var onCapture = _a.onCapture, _b = _a.automaticCapture, automaticCapture = _b === void 0 ? false : _b, _c = _a.maskType, maskType = _c === void 0 ? "id" : _c;
19
+ var onCapture = _a.onCapture, sessionId = _a.sessionId, nodeId = _a.nodeId, _b = _a.automaticCapture, automaticCapture = _b === void 0 ? false : _b, _c = _a.maskType, maskType = _c === void 0 ? "id" : _c;
18
20
  var isMobile = useIsMobile.default(768);
19
21
  var videoRef = React.useRef(null);
20
- var _d = React.useState(false), isDetecting = _d[0], setIsDetecting = _d[1];
21
- var _e = React.useState("environment"), facingMode = _e[0], setFacingMode = _e[1];
22
- var _f = React.useState(null), cameraError = _f[0], setCameraError = _f[1];
23
- var _g = React.useState(window.matchMedia("(orientation: portrait)").matches), isPortrait = _g[0], setIsPortrait = _g[1];
24
- var _h = React.useState(false), isCountingDown = _h[0], setIsCountingDown = _h[1];
25
- var _j = React.useState(0), countdown = _j[0], setCountdown = _j[1];
26
- var _k = React.useState(false), documentDetected = _k[0], setDocumentDetected = _k[1];
27
- var _l = React.useState(undefined), qualityHint = _l[0], setQualityHint = _l[1];
28
- var _m = React.useState(true), isInitializing = _m[0], setIsInitializing = _m[1];
29
- var _o = React.useState(false), isProcessing = _o[0], setIsProcessing = _o[1];
30
- var _p = React.useState(null), captureError = _p[0], setCaptureError = _p[1];
31
- var _q = React.useState(false), showCaptureFlash = _q[0], setShowCaptureFlash = _q[1];
22
+ var _d = React.useState(false), lowResolution = _d[0], setLowResolution = _d[1];
23
+ var _e = React.useState(0), cameraAttempt = _e[0], setCameraAttempt = _e[1];
24
+ var _f = React.useState(false), isDetecting = _f[0], setIsDetecting = _f[1];
25
+ var _g = React.useState("environment"), facingMode = _g[0], setFacingMode = _g[1];
26
+ var _h = React.useState(null), cameraError = _h[0], setCameraError = _h[1];
27
+ var _j = React.useState(window.matchMedia("(orientation: portrait)").matches), isPortrait = _j[0], setIsPortrait = _j[1];
28
+ var _k = React.useState(false), isCountingDown = _k[0], setIsCountingDown = _k[1];
29
+ var _l = React.useState(0), countdown = _l[0], setCountdown = _l[1];
30
+ var _m = React.useState(false), documentDetected = _m[0], setDocumentDetected = _m[1];
31
+ var _o = React.useState(undefined), qualityHint = _o[0], setQualityHint = _o[1];
32
+ var _p = React.useState(true), isInitializing = _p[0], setIsInitializing = _p[1];
33
+ var _q = React.useState(false), isProcessing = _q[0], setIsProcessing = _q[1];
34
+ var _r = React.useState(null), captureError = _r[0], setCaptureError = _r[1];
35
+ var _s = React.useState(false), showCaptureFlash = _s[0], setShowCaptureFlash = _s[1];
32
36
  var t = useI18n.useI18n().t;
33
- var _r = React.useState(null); _r[0]; var setLastCaptureMeta = _r[1];
34
- var _s = React.useState(null), maskRect = _s[0], setMaskRect = _s[1];
37
+ var _t = React.useState(null); _t[0]; var setLastCaptureMeta = _t[1];
38
+ var _u = React.useState(null), maskRect = _u[0], setMaskRect = _u[1];
35
39
  var countdownIntervalRef = React.useRef(null);
36
40
  var detectionHandlerRef = React.useRef(null);
37
41
  var flashTimeoutRef = React.useRef(null);
@@ -220,11 +224,13 @@ var Photo = function (_a) {
220
224
  React.useEffect(function () {
221
225
  var isCancelled = false;
222
226
  var initCamera = function () { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
223
- var result;
224
- return tslib_es6.__generator(this, function (_a) {
225
- switch (_a.label) {
227
+ var result, belowHd;
228
+ var _a, _b, _c, _d;
229
+ return tslib_es6.__generator(this, function (_e) {
230
+ switch (_e.label) {
226
231
  case 0:
227
232
  setCameraError(null);
233
+ setLowResolution(false);
228
234
  setIsInitializing(true);
229
235
  return [4 /*yield*/, cameraService.cameraService.startCamera(videoRef.current, {
230
236
  facingMode: facingMode,
@@ -232,11 +238,25 @@ var Photo = function (_a) {
232
238
  preferImageCapture: true,
233
239
  })];
234
240
  case 1:
235
- result = _a.sent();
241
+ result = _e.sent();
236
242
  if (isCancelled)
237
243
  return [2 /*return*/];
238
244
  setIsInitializing(false);
239
245
  if (result.success) {
246
+ belowHd = cameraResolution.isBelowHd(result.settings);
247
+ setLowResolution(belowHd);
248
+ if (sessionId && nodeId) {
249
+ void sessionService.reportCaptureDiagnostics(sessionId, nodeId, {
250
+ requested: result.requested,
251
+ obtained: { w: (_a = result.settings) === null || _a === void 0 ? void 0 : _a.width, h: (_b = result.settings) === null || _b === void 0 ? void 0 : _b.height, frameRate: (_c = result.settings) === null || _c === void 0 ? void 0 : _c.frameRate },
252
+ retriedWithHd: (_d = result.retriedWithHd) !== null && _d !== void 0 ? _d : false,
253
+ devicePixelRatio: window.devicePixelRatio,
254
+ cameraLabel: result.label,
255
+ lowResolutionWarningShown: belowHd,
256
+ facingMode: facingMode,
257
+ at: new Date().toISOString(),
258
+ }).catch(function () { });
259
+ }
240
260
  setLastCaptureMeta(null);
241
261
  // Detection also runs in manual mode: it only drives the visual
242
262
  // feedback on the mask (documentDetected), it never starts the
@@ -264,7 +284,7 @@ var Photo = function (_a) {
264
284
  flashTimeoutRef.current = null;
265
285
  }
266
286
  };
267
- }, [facingMode, clearCountdown, stopDetection]);
287
+ }, [facingMode, cameraAttempt, sessionId, nodeId, clearCountdown, stopDetection]);
268
288
  React.useEffect(function () {
269
289
  if (!isDetecting || !videoRef.current) {
270
290
  return;
@@ -307,21 +327,7 @@ var Photo = function (_a) {
307
327
  setIsInitializing(true);
308
328
  stopDetection();
309
329
  cameraService.cameraService.stopCamera();
310
- cameraService.cameraService
311
- .startCamera(videoRef.current, {
312
- facingMode: facingMode,
313
- idealResolution: { width: 4096, height: 3072 },
314
- preferImageCapture: true,
315
- })
316
- .then(function (result) {
317
- setIsInitializing(false);
318
- if (result.success) {
319
- setIsDetecting(true);
320
- }
321
- else if (result.error) {
322
- setCameraError(result.error);
323
- }
324
- });
330
+ setCameraAttempt(function (attempt) { return attempt + 1; });
325
331
  };
326
332
  var handleManualCapture = function () {
327
333
  if (isProcessing) {
@@ -345,7 +351,7 @@ var Photo = function (_a) {
345
351
  zIndex: isMobile ? 50 : "auto",
346
352
  height: "100%",
347
353
  width: "100%",
348
- }, children: [jsxRuntime.jsx("div", { className: "flex-1 relative overflow-hidden bg-black", children: cameraError ? (jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full px-4 py-6", children: jsxRuntime.jsx(CameraError.default, { errorMessage: cameraError, onRetry: handleRetry }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isInitializing && (jsxRuntime.jsxs("div", { "data-testid": "camera-initializing", className: "absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 bg-black", children: [jsxRuntime.jsx("div", { className: "w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin" }), jsxRuntime.jsx("span", { className: "text-white text-sm", children: t("id_check.photo.initializing", "Ouverture de la caméra…") })] })), isProcessing && (jsxRuntime.jsxs("div", { "data-testid": "camera-processing", className: "absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 bg-black bg-opacity-70", children: [jsxRuntime.jsx("div", { className: "w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin" }), jsxRuntime.jsx("span", { className: "text-white text-sm", children: t("id_check.photo.processing", "Traitement de l'image…") })] })), jsxRuntime.jsx("video", { ref: videoRef, autoPlay: true, playsInline: true, muted: true, className: "absolute inset-0 w-full h-full object-cover z-0 bg-black ".concat(facingMode === "user" ? "scale-x-[-1]" : "") }), jsxRuntime.jsx("div", { className: "absolute top-4 left-1/2 transform -translate-x-1/2 z-50", children: jsxRuntime.jsx("span", { className: "text-white z-50 text-sm font-semibold drop-shadow-lg", children: automaticCapture ? (jsxRuntime.jsx("span", { className: "animate-pulse", children: t("id_check.photo.mode_autocapture", "Autocapture activée") })) : (jsxRuntime.jsx("span", { className: "bg-orange-500 px-2 py-1 rounded hidden", children: t("id_check.photo.mode_manual", "Mode manuel") })) }) }), jsxRuntime.jsx(CameraMask.default, { isDetecting: isDetecting, isPortrait: isPortrait, facingMode: facingMode, isCountingDown: isCountingDown, countdown: countdown, maskType: maskType, documentDetected: documentDetected, qualityHint: qualityHint, onMaskRectChange: setMaskRect }), jsxRuntime.jsx("div", { className: "absolute bottom-20 left-0 right-0 z-20 pointer-events-none", children: jsxRuntime.jsx("div", { className: "text-center px-4", children: jsxRuntime.jsx("div", { className: "bg-black bg-opacity-60 text-white text-sm px-4 py-2 rounded-lg inline-block", children: t("id_check.photo.position_document", "Posez le document à plat ou tenez-le dans le cadre") }) }) }), jsxRuntime.jsx(OrientationToggle.default, { onCameraToggle: toggleCamera }), showCaptureFlash && (jsxRuntime.jsx("div", { "data-testid": "capture-flash", className: "absolute inset-0 z-40 bg-white pointer-events-none animate-pulse" }))] })) }), jsxRuntime.jsx("div", { className: "relative z-20 bg-black bg-opacity-80 p-4", children: jsxRuntime.jsxs("div", { className: "flex flex-col items-center space-y-4", children: [jsxRuntime.jsx("button", { onClick: handleManualCapture, className: "w-16 h-16 rounded-full border-4 border-white flex items-center justify-center transition-all duration-150 bg-transparent hover:bg-white hover:bg-opacity-20 cursor-pointer ".concat(showCaptureFlash ? "scale-90 ring-4 ring-[#11E5C5]" : ""), children: jsxRuntime.jsx("div", { className: "w-8 h-8 bg-white rounded-full" }) }), jsxRuntime.jsxs("div", { className: "text-white text-center text-sm", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-center space-x-2", children: [jsxRuntime.jsx("div", { className: "w-2 h-2 rounded-full ".concat(automaticCapture
354
+ }, children: [jsxRuntime.jsx("div", { className: "flex-1 relative overflow-hidden bg-black", children: cameraError ? (jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full px-4 py-6", children: jsxRuntime.jsx(CameraError.default, { errorMessage: cameraError, onRetry: handleRetry }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isInitializing && (jsxRuntime.jsxs("div", { "data-testid": "camera-initializing", className: "absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 bg-black", children: [jsxRuntime.jsx("div", { className: "w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin" }), jsxRuntime.jsx("span", { className: "text-white text-sm", children: t("id_check.photo.initializing", "Ouverture de la caméra…") })] })), isProcessing && (jsxRuntime.jsxs("div", { "data-testid": "camera-processing", className: "absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 bg-black bg-opacity-70", children: [jsxRuntime.jsx("div", { className: "w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin" }), jsxRuntime.jsx("span", { className: "text-white text-sm", children: t("id_check.photo.processing", "Traitement de l'image…") })] })), jsxRuntime.jsx("video", { ref: videoRef, autoPlay: true, playsInline: true, muted: true, className: "absolute inset-0 w-full h-full object-cover z-0 bg-black ".concat(facingMode === "user" ? "scale-x-[-1]" : "") }), jsxRuntime.jsx("div", { className: "absolute top-4 left-1/2 transform -translate-x-1/2 z-50", children: jsxRuntime.jsx("span", { className: "text-white z-50 text-sm font-semibold drop-shadow-lg", children: automaticCapture ? (jsxRuntime.jsx("span", { className: "animate-pulse", children: t("id_check.photo.mode_autocapture", "Autocapture activée") })) : (jsxRuntime.jsx("span", { className: "bg-orange-500 px-2 py-1 rounded hidden", children: t("id_check.photo.mode_manual", "Mode manuel") })) }) }), jsxRuntime.jsx(CameraMask.default, { isDetecting: isDetecting, isPortrait: isPortrait, facingMode: facingMode, isCountingDown: isCountingDown, countdown: countdown, maskType: maskType, documentDetected: documentDetected, qualityHint: qualityHint, onMaskRectChange: setMaskRect }), jsxRuntime.jsx("div", { className: "absolute bottom-20 left-0 right-0 z-20 pointer-events-none", children: jsxRuntime.jsx("div", { className: "text-center px-4", children: jsxRuntime.jsx("div", { className: "bg-black bg-opacity-60 text-white text-sm px-4 py-2 rounded-lg inline-block", children: t("id_check.photo.position_document", "Posez le document à plat ou tenez-le dans le cadre") }) }) }), jsxRuntime.jsx(OrientationToggle.default, { onCameraToggle: toggleCamera }), lowResolution && !cameraError && (jsxRuntime.jsx("div", { role: "status", className: "absolute inset-x-3 z-30 ".concat(automaticCapture ? "top-12" : "top-3"), children: jsxRuntime.jsx("div", { className: "rounded-xl bg-black/75 text-white shadow-lg backdrop-blur-sm", children: jsxRuntime.jsxs("details", { className: "group", children: [jsxRuntime.jsxs("summary", { className: "flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-xl px-3 py-2 text-sm font-medium focus-visible:outline focus-visible:outline-2 focus-visible:outline-white [&::-webkit-details-marker]:hidden", children: [jsxRuntime.jsx("svg", { "aria-hidden": "true", className: "h-5 w-5 shrink-0 text-amber-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v4m0 4h.01M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z" }) }), jsxRuntime.jsx("span", { className: "min-w-0 flex-1", children: t("id_check.camera.low_resolution.title") }), jsxRuntime.jsx("svg", { "aria-hidden": "true", className: "h-4 w-4 shrink-0 transition-transform group-open:rotate-180 motion-reduce:transition-none", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m6 9 6 6 6-6" }) })] }), jsxRuntime.jsxs("div", { className: "space-y-2 px-3 pb-3 text-sm leading-relaxed text-white/85", children: [jsxRuntime.jsx("p", { children: t("id_check.camera.low_resolution.body") }), jsxRuntime.jsx("p", { children: t("id_check.camera.low_resolution.tips") }), jsxRuntime.jsx("button", { type: "button", onClick: handleRetry, disabled: isProcessing, className: "min-h-11 w-full rounded-lg bg-white px-4 font-medium text-gray-900 hover:bg-white/90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white disabled:opacity-50", children: t("id_check.camera.low_resolution.retry") })] })] }) }) })), showCaptureFlash && (jsxRuntime.jsx("div", { "data-testid": "capture-flash", className: "absolute inset-0 z-40 bg-white pointer-events-none animate-pulse" }))] })) }), jsxRuntime.jsx("div", { className: "relative z-20 bg-black bg-opacity-80 p-4", children: jsxRuntime.jsxs("div", { className: "flex flex-col items-center space-y-4", children: [jsxRuntime.jsx("button", { onClick: handleManualCapture, className: "w-16 h-16 rounded-full border-4 border-white flex items-center justify-center transition-all duration-150 bg-transparent hover:bg-white hover:bg-opacity-20 cursor-pointer ".concat(showCaptureFlash ? "scale-90 ring-4 ring-[#11E5C5]" : ""), children: jsxRuntime.jsx("div", { className: "w-8 h-8 bg-white rounded-full" }) }), jsxRuntime.jsxs("div", { className: "text-white text-center text-sm", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-center space-x-2", children: [jsxRuntime.jsx("div", { className: "w-2 h-2 rounded-full ".concat(automaticCapture
349
355
  ? "bg-[#11E5C5] animate-pulse"
350
356
  : "bg-orange-500") }), jsxRuntime.jsx("span", { children: statusMessage })] }), captureError && (jsxRuntime.jsx("p", { className: "text-red-400 text-xs mt-2 text-center", children: captureError }))] })] }) })] }));
351
357
  };
@@ -139,6 +139,7 @@ var JDIDocumentSelection = function (_a) {
139
139
  case "idCard":
140
140
  return [
141
141
  t("jdi.document_selection.instructions.idCard.recto_verso"),
142
+ t("jdi.document_selection.instructions.two_sided_files"),
142
143
  t("jdi.document_selection.instructions.idCard.readable"),
143
144
  t("jdi.document_selection.instructions.idCard.valid"),
144
145
  ];
@@ -151,6 +152,7 @@ var JDIDocumentSelection = function (_a) {
151
152
  case "driverLicense":
152
153
  return [
153
154
  t("jdi.document_selection.instructions.driverLicense.recto_verso"),
155
+ t("jdi.document_selection.instructions.two_sided_files"),
154
156
  t("jdi.document_selection.instructions.driverLicense.not_expired"),
155
157
  t("jdi.document_selection.instructions.driverLicense.all_visible"),
156
158
  ];
@@ -163,6 +165,7 @@ var JDIDocumentSelection = function (_a) {
163
165
  case "residencePermit":
164
166
  return [
165
167
  t("jdi.document_selection.instructions.residencePermit.recto_verso"),
168
+ t("jdi.document_selection.instructions.two_sided_files"),
166
169
  t("jdi.document_selection.instructions.residencePermit.valid"),
167
170
  t("jdi.document_selection.instructions.residencePermit.readable"),
168
171
  ];
@@ -15,8 +15,11 @@ var documentLabels = require('../../utils/documentLabels.js');
15
15
  var MobilePageLayout = require('../ui/MobilePageLayout.js');
16
16
 
17
17
  var JDIDocumentUpload = function (_a) {
18
- var documentType = _a.documentType, onUpload = _a.onUpload, onBack = _a.onBack, documentTypeId = _a.documentTypeId, documentLabel = _a.documentLabel, _b = _a.initialFront, initialFront = _b === void 0 ? null : _b, _c = _a.initialBack, initialBack = _c === void 0 ? null : _c; _a.sessionId;
18
+ var documentType = _a.documentType, onUpload = _a.onUpload, onBack = _a.onBack, documentTypeId = _a.documentTypeId, documentLabel = _a.documentLabel, _b = _a.initialFront, initialFront = _b === void 0 ? null : _b, _c = _a.initialBack, initialBack = _c === void 0 ? null : _c; _a.sessionId; var title = _a.title, description = _a.description;
19
19
  var t = useI18n.useI18n().t;
20
+ var documentName = t("documentTypes." + documentType);
21
+ var customTitle = title === null || title === void 0 ? void 0 : title.trim().replace(/\{\{\s*document\s*\}\}/g, function () { return documentName; });
22
+ var customDescription = description === null || description === void 0 ? void 0 : description.trim().replace(/\{\{\s*document\s*\}\}/g, function () { return documentName; });
20
23
  // Helper functions for conditional text
21
24
  var getDropZoneText = function () {
22
25
  return t("jdi.document_upload.drop_zone", {
@@ -462,7 +465,7 @@ var JDIDocumentUpload = function (_a) {
462
465
  }
463
466
  });
464
467
  }); };
465
- return (jsxRuntime.jsx(MobilePageLayout.default, { contentClassName: "h-full", footer: jsxRuntime.jsx(PageActions.default, { primary: jsxRuntime.jsx(Button.default, { onClick: handleUpload, disabled: (!frontFile && !isFrontFromInitial) || isUploading, children: getValidateButtonText() }), secondary: onBack ? (jsxRuntime.jsx(Button.default, { variant: "secondary", onClick: onBack, disabled: isUploading, children: t("jdi.document_upload.back") })) : undefined }), children: jsxRuntime.jsx("div", { className: "flex-1 flex items-start justify-center md:items-center p-4", children: jsxRuntime.jsxs("div", { className: "w-full max-w-lg", children: [jsxRuntime.jsxs("div", { className: "text-center mb-8", children: [jsxRuntime.jsx("h1", { className: "text-2xl md:text-3xl font-bold text-gray-900 mb-2", children: getDropZoneText() }), jsxRuntime.jsx("p", { className: "text-gray-600", children: getUploadInstruction() })] }), jsxRuntime.jsx(Card.Card, { ref: dropZoneRef, className: "border-2 border-dashed ".concat(isDragging
468
+ return (jsxRuntime.jsx(MobilePageLayout.default, { contentClassName: "h-full", footer: jsxRuntime.jsx(PageActions.default, { primary: jsxRuntime.jsx(Button.default, { onClick: handleUpload, disabled: (!frontFile && !isFrontFromInitial) || isUploading, children: getValidateButtonText() }), secondary: onBack ? (jsxRuntime.jsx(Button.default, { variant: "secondary", onClick: onBack, disabled: isUploading, children: t("jdi.document_upload.back") })) : undefined }), children: jsxRuntime.jsx("div", { className: "flex-1 flex items-start justify-center md:items-center p-4", children: jsxRuntime.jsxs("div", { className: "w-full max-w-lg", children: [jsxRuntime.jsxs("div", { className: "text-center mb-8", children: [jsxRuntime.jsx("h1", { className: "text-2xl md:text-3xl font-bold text-gray-900 mb-2", children: customTitle || getDropZoneText() }), jsxRuntime.jsx("p", { className: "text-gray-600 whitespace-pre-line", children: customDescription || getUploadInstruction() })] }), jsxRuntime.jsx(Card.Card, { ref: dropZoneRef, className: "border-2 border-dashed ".concat(isDragging
466
469
  ? "border-teal-500 bg-teal-100/50"
467
470
  : "border-teal-300 bg-teal-50/30", " p-8 mb-6 transition-colors"), onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, children: jsxRuntime.jsx("div", { className: "text-center space-y-6", children: !frontPreview ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-gray-900 mb-4", children: t("documentTypes." + documentType) }), jsxRuntime.jsx("div", { className: "flex justify-center w-full", children: jsxRuntime.jsx(Button.default, { onClick: function () { var _a; return (_a = frontInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, className: "border border-teal-300 text-teal-600 bg-transparent hover:bg-teal-50 px-4 py-2 rounded-lg font-medium text-sm mx-auto flex items-center", disabled: isUploading, children: jsxRuntime.jsx("span", { children: t("jdi.document_upload.add_file") }) }) }), jsxRuntime.jsx("p", { className: "text-sm text-gray-500 italic", children: t("jdi.document_upload.drag_drop_hint", "ou glissez-déposez vos fichiers ici") }), jsxRuntime.jsxs("div", { className: "text-sm text-gray-600 space-y-1", children: [jsxRuntime.jsx("p", { children: t("jdi.document_upload.accepted_formats") }), jsxRuntime.jsx("p", { children: twoSidesRequired
468
471
  ? frontPreview
@@ -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
- : t("errors.verification_failed") }), jsxRuntime.jsx(Subtitle.default, { className: "text-sm text-gray-600 leading-relaxed", children: blockContinue
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
- : isRetryAllowed
44
- ? t("errors.verification_failed_subtitle", {
45
- documentType: "document",
46
- })
47
- : t("errors.verification_failed_subtitle_no_retry", {
48
- documentType: "document",
49
- }) })] }), !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 && (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
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: analysisErrors.isServiceErrorCode(errorCode)
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;
@@ -320,7 +320,12 @@ var JDIProcessing = React.memo(function (_a) {
320
320
  },
321
321
  ]
322
322
  : undefined,
323
- canRetry: isNetworkError || isUploadNotConfirmed || !!serviceErrorCode,
323
+ // Analyse en erreur côté moteur : nouvel essai possible (dans la
324
+ // limite de resoumission du nœud), jamais un passage silencieux.
325
+ canRetry: isNetworkError ||
326
+ isUploadNotConfirmed ||
327
+ !!serviceErrorCode ||
328
+ analysisErrors.isAnalysisFailedError(error_2),
324
329
  blockContinue: isUploadNotConfirmed,
325
330
  });
326
331
  setIsComplete(true);
@@ -35,11 +35,10 @@ var NfcScanStep = function (_a) {
35
35
  // Sur mobile, on ouvre directement l'app de scan au lieu d'afficher un QR code inutile.
36
36
  var isMobile = React.useMemo(function () { return isMobileDevice.isMobileDevice(); }, []);
37
37
  var isIOS = React.useMemo(function () { return isMobileDevice.isIOSDevice(); }, []);
38
- var nfcUrl = React.useMemo(function () {
39
- var origin = typeof window !== "undefined" ? window.location.origin : "";
40
- return "".concat(origin, "/scan/").concat(sessionId);
41
- }, [sessionId]);
42
38
  var apiBaseUrl = React.useMemo(function () { return api.getBaseURL(); }, []);
39
+ // Domaine Datakeen (celui de l'API), pas celui de la page hôte : seul lui sert l'AASA qui
40
+ // déclenche l'App Clip iOS. Sur un site intégrateur, l'origine de la page ouvrait le navigateur.
41
+ var nfcUrl = React.useMemo(function () { return "".concat(new URL(apiBaseUrl, window.location.href).origin, "/scan/").concat(sessionId); }, [apiBaseUrl, sessionId]);
43
42
  var iosAppLinks = React.useMemo(function () {
44
43
  var host = new URL(apiBaseUrl, window.location.href).host;
45
44
  // `return` : l'app rouvre exactement cette URL en fin de scan, ce qui ramène Safari sur cet
@@ -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');
@@ -75,12 +76,12 @@ var normalizeNfcMode = function (mode) {
75
76
  * - Uses hooks for translation, retry navigation, and context management.
76
77
  */
77
78
  var DocumentCheck = function (_a) {
78
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
79
- var stepObject = _a.stepObject, sessionId = _a.sessionId, node = _a.node, documentTypeId = _a.documentTypeId, acceptedCountries = _a.acceptedCountries, _p = _a.isMobileCapture, isMobileCapture = _p === void 0 ? false : _p, allowedAddingMethods = _a.allowedAddingMethods, template = _a.template, setUserInput = _a.setUserInput;
79
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
80
+ var stepObject = _a.stepObject, sessionId = _a.sessionId, node = _a.node, documentTypeId = _a.documentTypeId, acceptedCountries = _a.acceptedCountries, _r = _a.isMobileCapture, isMobileCapture = _r === void 0 ? false : _r, allowedAddingMethods = _a.allowedAddingMethods, template = _a.template, setUserInput = _a.setUserInput;
80
81
  var t = useI18n.useI18n().t;
81
82
  var session = SessionContext.getSession().session;
82
- var _q = React.useState(), documentTemplates = _q[0], setDocumentTemplates = _q[1];
83
- var _r = React.useState(true), loadingTemplates = _r[0], setLoadingTemplates = _r[1];
83
+ var _s = React.useState(), documentTemplates = _s[0], setDocumentTemplates = _s[1];
84
+ var _t = React.useState(true), loadingTemplates = _t[0], setLoadingTemplates = _t[1];
84
85
  React.useEffect(function () {
85
86
  (function () { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
86
87
  var templates;
@@ -99,7 +100,7 @@ var DocumentCheck = function (_a) {
99
100
  }); })();
100
101
  }, []);
101
102
  var initialRetryCount = retryService.getNodeRetryCount(session, node.id);
102
- var _s = React.useState(null), selectedMethod = _s[0], setSelectedMethod = _s[1];
103
+ var _u = React.useState(null), selectedMethod = _u[0], setSelectedMethod = _u[1];
103
104
  var isPictureAllowed = (_b = allowedAddingMethods === null || allowedAddingMethods === void 0 ? void 0 : allowedAddingMethods.includes("picture")) !== null && _b !== void 0 ? _b : true;
104
105
  var isDownloadAllowed = (_c = allowedAddingMethods === null || allowedAddingMethods === void 0 ? void 0 : allowedAddingMethods.includes("download")) !== null && _c !== void 0 ? _c : true;
105
106
  // Check if retry is allowed based on initial retry count
@@ -118,25 +119,25 @@ var DocumentCheck = function (_a) {
118
119
  return true;
119
120
  };
120
121
  // Initialize docStep - if retries exhausted, start at error page (step 6)
121
- var _t = React.useState(function () {
122
+ var _v = React.useState(function () {
122
123
  if (initialRetryCount > 0 && !isInitialRetryAllowed()) {
123
124
  return 6; // Error page
124
125
  }
125
126
  return 0; // Normal flow - start with introduction
126
- }), docStep = _t[0], setDocStep = _t[1];
127
- var _u = React.useState(((_e = (_d = acceptedCountries === null || acceptedCountries === void 0 ? void 0 : acceptedCountries[0]) === null || _d === void 0 ? void 0 : _d.code) === null || _e === void 0 ? void 0 : _e.toUpperCase()) || "FR"), selectedCountry = _u[0], setSelectedCountry = _u[1];
128
- var _v = React.useState(null), fileUploaded = _v[0], setFileUploaded = _v[1];
129
- var _w = React.useState(null), analysisData = _w[0], setAnalysisData = _w[1];
130
- var _x = React.useState(null), errorCode = _x[0], setErrorCode = _x[1];
131
- var _y = React.useState(false), blockContinue = _y[0], setBlockContinue = _y[1];
132
- var _z = React.useState(null), nfcPreparationError = _z[0], setNfcPreparationError = _z[1];
127
+ }), docStep = _v[0], setDocStep = _v[1];
128
+ var _w = React.useState(((_e = (_d = acceptedCountries === null || acceptedCountries === void 0 ? void 0 : acceptedCountries[0]) === null || _d === void 0 ? void 0 : _d.code) === null || _e === void 0 ? void 0 : _e.toUpperCase()) || "FR"), selectedCountry = _w[0], setSelectedCountry = _w[1];
129
+ var _x = React.useState(null), fileUploaded = _x[0], setFileUploaded = _x[1];
130
+ var _y = React.useState(null), analysisData = _y[0], setAnalysisData = _y[1];
131
+ var _z = React.useState(null), errorCode = _z[0], setErrorCode = _z[1];
132
+ var _0 = React.useState(false), blockContinue = _0[0], setBlockContinue = _0[1];
133
+ var _1 = React.useState(null), nfcPreparationError = _1[0], setNfcPreparationError = _1[1];
133
134
  // Quand l'utilisateur déclare ne pas avoir de puce (questionnaire de fallback),
134
135
  // on ne doit plus le réorienter vers le scan NFC (ni avant, ni après l'analyse API).
135
- var _0 = React.useState(false), nfcSkipped = _0[0], setNfcSkipped = _0[1];
136
+ var _2 = React.useState(false), nfcSkipped = _2[0], setNfcSkipped = _2[1];
136
137
  // Initialize retry count from session data
137
- var _1 = React.useState(function () {
138
+ var _3 = React.useState(function () {
138
139
  return retryService.getNodeRetryCount(session, node.id);
139
- }), retryCount = _1[0], setRetryCount = _1[1];
140
+ }), retryCount = _3[0], setRetryCount = _3[1];
140
141
  // Update retry count when session loads/changes
141
142
  React.useEffect(function () {
142
143
  if (session) {
@@ -231,10 +232,10 @@ var DocumentCheck = function (_a) {
231
232
  setDocStep(6);
232
233
  }
233
234
  }, [retryCount, node.allowResubmission, node.maxResubmissionAttempts]);
234
- var _2 = React.useState({}), capturedImages = _2[0], setCapturedImages = _2[1];
235
- var _3 = React.useState("before-recto"), currentPhotoStep = _3[0], setCurrentPhotoStep = _3[1];
236
- var _4 = React.useState("photo"), videoFlowPhase = _4[0], setVideoFlowPhase = _4[1];
237
- var _5 = DocumentContext.useDocumentContext(), selectedDocumentType = _5.selectedDocumentType, setSelectedDocumentType = _5.setSelectedDocumentType;
235
+ var _4 = React.useState({}), capturedImages = _4[0], setCapturedImages = _4[1];
236
+ var _5 = React.useState("before-recto"), currentPhotoStep = _5[0], setCurrentPhotoStep = _5[1];
237
+ var _6 = React.useState("photo"), videoFlowPhase = _6[0], setVideoFlowPhase = _6[1];
238
+ var _7 = DocumentContext.useDocumentContext(), selectedDocumentType = _7.selectedDocumentType, setSelectedDocumentType = _7.setSelectedDocumentType;
238
239
  var finalAcceptedCountries = React.useMemo(function () {
239
240
  if (loadingTemplates)
240
241
  return acceptedCountries;
@@ -549,12 +550,21 @@ var DocumentCheck = function (_a) {
549
550
  setDocStep(5);
550
551
  }
551
552
  else {
552
- var newRetryCount = retryCount + 1;
553
- // Increment retry count both in state and session
554
- setRetryCount(newRetryCount);
555
- retryService.incrementNodeRetryCount(sessionId, node.id, retryCount).catch(function (error) {
556
- console.error("Failed to update retry count in session:", error);
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 = apiAnalysisData && apiAnalysisData.length > 0
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;
@@ -764,13 +780,13 @@ var DocumentCheck = function (_a) {
764
780
  return (jsxRuntime.jsx(BeforePhoto.default, { setStep: function () { return setCurrentPhotoStep("recto"); }, isSingleSided: isSingleSided, onBack: function () { return setDocStep(2); } }));
765
781
  }
766
782
  if (currentPhotoStep === "recto") {
767
- return (jsxRuntime.jsx(Photo.default, { onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }));
783
+ return (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }));
768
784
  }
769
785
  if (currentPhotoStep === "before-verso") {
770
786
  return (jsxRuntime.jsx(BeforeVersoPhoto.default, { setStep: function () { return setCurrentPhotoStep("verso"); } }));
771
787
  }
772
788
  if (currentPhotoStep === "verso") {
773
- return (jsxRuntime.jsx(Photo.default, { onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }));
789
+ return (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }));
774
790
  }
775
791
  if (currentPhotoStep === "confirmation") {
776
792
  return (jsxRuntime.jsx(PhotoConfirmation.default, { imageUrl: capturedImages.recto || "", versoImageUrl: capturedImages.verso, requiresTwoSides: !!capturedImages.verso, onConfirm: onConfirm, onRetry: function () { return setCurrentPhotoStep("before-recto"); }, onRetryAfterProcessing: function () { return setCurrentPhotoStep("before-recto"); }, fileUploaded: fileUploaded, isSingleSided: isSingleSided }));
@@ -778,7 +794,7 @@ var DocumentCheck = function (_a) {
778
794
  return (jsxRuntime.jsx(BeforePhoto.default, { setStep: function () { return setCurrentPhotoStep("recto"); }, isSingleSided: isSingleSided, onBack: function () { return setDocStep(2); } }));
779
795
  }
780
796
  else {
781
- return (jsxRuntime.jsx(JDIDocumentUpload.default, { documentType: (selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id) || documentTypeId, documentTypeId: documentTypeId, documentLabel: selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.label, onUpload: handleDocumentUpload, onBack: function () {
797
+ return (jsxRuntime.jsx(JDIDocumentUpload.default, { title: (_p = node.documentUpload) === null || _p === void 0 ? void 0 : _p.title, description: (_q = node.documentUpload) === null || _q === void 0 ? void 0 : _q.description, documentType: (selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id) || documentTypeId, documentTypeId: documentTypeId, documentLabel: selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.label, onUpload: handleDocumentUpload, onBack: function () {
782
798
  if (isPictureAllowed && isDownloadAllowed) {
783
799
  setSelectedMethod(null);
784
800
  }
@@ -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
  }