datakeen-session-react 1.1.140-rc.71 → 1.1.140-rc.73

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 (57) hide show
  1. package/dist/cjs/components/jdi/JDIDocumentSelection.js +9 -6
  2. package/dist/cjs/components/jdi/JDIDocumentSelection.js.map +1 -1
  3. package/dist/cjs/components/nfc-scan/BiometricSymbol.js +22 -0
  4. package/dist/cjs/components/nfc-scan/BiometricSymbol.js.map +1 -0
  5. package/dist/cjs/components/nfc-scan/NfcChipGate.js +36 -0
  6. package/dist/cjs/components/nfc-scan/NfcChipGate.js.map +1 -0
  7. package/dist/cjs/components/nfc-scan/NfcFallbackSurvey.js +70 -0
  8. package/dist/cjs/components/nfc-scan/NfcFallbackSurvey.js.map +1 -0
  9. package/dist/cjs/components/nfc-scan/NfcOnboardingNotice.js +44 -0
  10. package/dist/cjs/components/nfc-scan/NfcOnboardingNotice.js.map +1 -0
  11. package/dist/cjs/components/nfc-scan/NfcScanNode.js +23 -4
  12. package/dist/cjs/components/nfc-scan/NfcScanNode.js.map +1 -1
  13. package/dist/cjs/components/nfc-scan/PuceCniSymbol.js +22 -0
  14. package/dist/cjs/components/nfc-scan/PuceCniSymbol.js.map +1 -0
  15. package/dist/cjs/components/session/DocumentCheck.js +147 -36
  16. package/dist/cjs/components/session/DocumentCheck.js.map +1 -1
  17. package/dist/cjs/hooks/useNfcSseStatus.js +12 -0
  18. package/dist/cjs/hooks/useNfcSseStatus.js.map +1 -1
  19. package/dist/cjs/i18n/en.json.js +37 -4
  20. package/dist/cjs/i18n/en.json.js.map +1 -1
  21. package/dist/cjs/i18n/fr.json.js +37 -4
  22. package/dist/cjs/i18n/fr.json.js.map +1 -1
  23. package/dist/cjs/index.css.js +1 -1
  24. package/dist/cjs/services/sessionService.js +19 -0
  25. package/dist/cjs/services/sessionService.js.map +1 -1
  26. package/dist/cjs/types/session.js.map +1 -1
  27. package/dist/cjs/utils/isMobileDevice.js +17 -0
  28. package/dist/cjs/utils/isMobileDevice.js.map +1 -0
  29. package/dist/esm/components/jdi/JDIDocumentSelection.js +9 -6
  30. package/dist/esm/components/jdi/JDIDocumentSelection.js.map +1 -1
  31. package/dist/esm/components/nfc-scan/BiometricSymbol.js +18 -0
  32. package/dist/esm/components/nfc-scan/BiometricSymbol.js.map +1 -0
  33. package/dist/esm/components/nfc-scan/NfcChipGate.js +32 -0
  34. package/dist/esm/components/nfc-scan/NfcChipGate.js.map +1 -0
  35. package/dist/esm/components/nfc-scan/NfcFallbackSurvey.js +66 -0
  36. package/dist/esm/components/nfc-scan/NfcFallbackSurvey.js.map +1 -0
  37. package/dist/esm/components/nfc-scan/NfcOnboardingNotice.js +40 -0
  38. package/dist/esm/components/nfc-scan/NfcOnboardingNotice.js.map +1 -0
  39. package/dist/esm/components/nfc-scan/NfcScanNode.js +23 -4
  40. package/dist/esm/components/nfc-scan/NfcScanNode.js.map +1 -1
  41. package/dist/esm/components/nfc-scan/PuceCniSymbol.js +18 -0
  42. package/dist/esm/components/nfc-scan/PuceCniSymbol.js.map +1 -0
  43. package/dist/esm/components/session/DocumentCheck.js +149 -38
  44. package/dist/esm/components/session/DocumentCheck.js.map +1 -1
  45. package/dist/esm/hooks/useNfcSseStatus.js +12 -0
  46. package/dist/esm/hooks/useNfcSseStatus.js.map +1 -1
  47. package/dist/esm/i18n/en.json.js +37 -4
  48. package/dist/esm/i18n/en.json.js.map +1 -1
  49. package/dist/esm/i18n/fr.json.js +37 -4
  50. package/dist/esm/i18n/fr.json.js.map +1 -1
  51. package/dist/esm/index.css.js +1 -1
  52. package/dist/esm/services/sessionService.js +19 -1
  53. package/dist/esm/services/sessionService.js.map +1 -1
  54. package/dist/esm/types/session.js.map +1 -1
  55. package/dist/esm/utils/isMobileDevice.js +15 -0
  56. package/dist/esm/utils/isMobileDevice.js.map +1 -0
  57. package/package.json +1 -1
@@ -32,6 +32,8 @@ var retryService = require('../../services/retryService.js');
32
32
  var SessionContext = require('../../context/SessionContext.js');
33
33
  var sessionService = require('../../services/sessionService.js');
34
34
  var NfcScanNode = require('../nfc-scan/NfcScanNode.js');
35
+ var NfcChipGate = require('../nfc-scan/NfcChipGate.js');
36
+ var NfcFallbackSurvey = require('../nfc-scan/NfcFallbackSurvey.js');
35
37
  var europeanCountries = require('../../utils/europeanCountries.js');
36
38
 
37
39
  var NFC_ELIGIBLE_DOCUMENT_TYPES = new Set([
@@ -39,6 +41,14 @@ var NFC_ELIGIBLE_DOCUMENT_TYPES = new Set([
39
41
  "idCard",
40
42
  "residencePermit",
41
43
  ]);
44
+ /**
45
+ * Normalise le mode NFC vers les valeurs courantes.
46
+ * Rétrocompat : les parcours enregistrés avant le renommage portent encore
47
+ * `nfcAndApi`, qui doit être traité comme `nfcOrPhoto` (scan NFC avec alternative photo).
48
+ */
49
+ var normalizeNfcMode = function (mode) {
50
+ return mode === "nfcAndApi" || mode === "nfcOrPhoto" ? "nfcOrPhoto" : "nfcOnly";
51
+ };
42
52
  /**
43
53
  * DocumentCheck component manages the multi-step document verification flow for a session.
44
54
  * It handles country and document type selection, document upload or photo capture, processing, and error/success handling.
@@ -64,12 +74,12 @@ var NFC_ELIGIBLE_DOCUMENT_TYPES = new Set([
64
74
  * - Uses hooks for translation, retry navigation, and context management.
65
75
  */
66
76
  var DocumentCheck = function (_a) {
67
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
68
- var stepObject = _a.stepObject, sessionId = _a.sessionId, node = _a.node; _a.onContinueOnPC; var documentTypeId = _a.documentTypeId, acceptedCountries = _a.acceptedCountries, _m = _a.isMobileCapture, isMobileCapture = _m === void 0 ? false : _m, allowedAddingMethods = _a.allowedAddingMethods, template = _a.template, setUserInput = _a.setUserInput;
77
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
78
+ var stepObject = _a.stepObject, sessionId = _a.sessionId, node = _a.node; _a.onContinueOnPC; var documentTypeId = _a.documentTypeId, acceptedCountries = _a.acceptedCountries, _p = _a.isMobileCapture, isMobileCapture = _p === void 0 ? false : _p, allowedAddingMethods = _a.allowedAddingMethods, template = _a.template, setUserInput = _a.setUserInput;
69
79
  var t = useI18n.useI18n().t;
70
80
  var session = SessionContext.getSession().session;
71
- var _o = React.useState(), documentTemplates = _o[0], setDocumentTemplates = _o[1];
72
- var _p = React.useState(true), loadingTemplates = _p[0], setLoadingTemplates = _p[1];
81
+ var _q = React.useState(), documentTemplates = _q[0], setDocumentTemplates = _q[1];
82
+ var _r = React.useState(true), loadingTemplates = _r[0], setLoadingTemplates = _r[1];
73
83
  React.useEffect(function () {
74
84
  (function () { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
75
85
  var templates;
@@ -88,7 +98,7 @@ var DocumentCheck = function (_a) {
88
98
  }); })();
89
99
  }, []);
90
100
  var initialRetryCount = retryService.getNodeRetryCount(session, node.id);
91
- var _q = React.useState(null), selectedMethod = _q[0], setSelectedMethod = _q[1];
101
+ var _s = React.useState(null), selectedMethod = _s[0], setSelectedMethod = _s[1];
92
102
  var isPictureAllowed = (_b = allowedAddingMethods === null || allowedAddingMethods === void 0 ? void 0 : allowedAddingMethods.includes("picture")) !== null && _b !== void 0 ? _b : true;
93
103
  var isDownloadAllowed = (_c = allowedAddingMethods === null || allowedAddingMethods === void 0 ? void 0 : allowedAddingMethods.includes("download")) !== null && _c !== void 0 ? _c : true;
94
104
  // Check if retry is allowed based on initial retry count
@@ -107,21 +117,24 @@ var DocumentCheck = function (_a) {
107
117
  return true;
108
118
  };
109
119
  // Initialize docStep - if retries exhausted, start at error page (step 6)
110
- var _r = React.useState(function () {
120
+ var _t = React.useState(function () {
111
121
  if (initialRetryCount > 0 && !isInitialRetryAllowed()) {
112
122
  return 6; // Error page
113
123
  }
114
124
  return 0; // Normal flow - start with introduction
115
- }), docStep = _r[0], setDocStep = _r[1];
116
- var _s = 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 = _s[0], setSelectedCountry = _s[1];
117
- var _t = React.useState(null), fileUploaded = _t[0], setFileUploaded = _t[1];
118
- var _u = React.useState(null), analysisData = _u[0], setAnalysisData = _u[1];
119
- var _v = React.useState(null), errorCode = _v[0], setErrorCode = _v[1];
120
- var _w = React.useState(null), nfcPreparationError = _w[0], setNfcPreparationError = _w[1];
125
+ }), docStep = _t[0], setDocStep = _t[1];
126
+ 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];
127
+ var _v = React.useState(null), fileUploaded = _v[0], setFileUploaded = _v[1];
128
+ var _w = React.useState(null), analysisData = _w[0], setAnalysisData = _w[1];
129
+ var _x = React.useState(null), errorCode = _x[0], setErrorCode = _x[1];
130
+ var _y = React.useState(null), nfcPreparationError = _y[0], setNfcPreparationError = _y[1];
131
+ // Quand l'utilisateur déclare ne pas avoir de puce (questionnaire de fallback),
132
+ // on ne doit plus le réorienter vers le scan NFC (ni avant, ni après l'analyse API).
133
+ var _z = React.useState(false), nfcSkipped = _z[0], setNfcSkipped = _z[1];
121
134
  // Initialize retry count from session data
122
- var _x = React.useState(function () {
135
+ var _0 = React.useState(function () {
123
136
  return retryService.getNodeRetryCount(session, node.id);
124
- }), retryCount = _x[0], setRetryCount = _x[1];
137
+ }), retryCount = _0[0], setRetryCount = _0[1];
125
138
  // Update retry count when session loads/changes
126
139
  React.useEffect(function () {
127
140
  if (session) {
@@ -129,6 +142,21 @@ var DocumentCheck = function (_a) {
129
142
  setRetryCount(sessionRetryCount);
130
143
  }
131
144
  }, [session, node.id]);
145
+ // Restauration après refresh : si le NFC est en cours côté backend (l'utilisateur attendait sur
146
+ // l'écran QR), revenir directement à cet écran (docStep 7) au lieu de repartir au début du nœud.
147
+ // `docStep` est en mémoire et serait sinon perdu au rechargement.
148
+ var hasRestoredNfcStep = React.useRef(false);
149
+ React.useEffect(function () {
150
+ if (hasRestoredNfcStep.current)
151
+ return;
152
+ if (node.nfcEnabled !== true)
153
+ return;
154
+ var status = session === null || session === void 0 ? void 0 : session.nfcStatus;
155
+ if (status === "pending" || status === "opened") {
156
+ hasRestoredNfcStep.current = true;
157
+ setDocStep(7);
158
+ }
159
+ }, [session, node.nfcEnabled]);
132
160
  // Check retry limits on mount/reload - if retries exhausted, show error page immediately
133
161
  React.useEffect(function () {
134
162
  // Special case: if allowResubmission is false and retryCount > 0, show error immediately
@@ -161,10 +189,10 @@ var DocumentCheck = function (_a) {
161
189
  setDocStep(6);
162
190
  }
163
191
  }, [retryCount, node.allowResubmission, node.maxResubmissionAttempts]);
164
- var _y = React.useState({}), capturedImages = _y[0], setCapturedImages = _y[1];
165
- var _z = React.useState("before-recto"), currentPhotoStep = _z[0], setCurrentPhotoStep = _z[1];
166
- var _0 = React.useState("photo"), videoFlowPhase = _0[0], setVideoFlowPhase = _0[1];
167
- var _1 = DocumentContext.useDocumentContext(), selectedDocumentType = _1.selectedDocumentType, setSelectedDocumentType = _1.setSelectedDocumentType;
192
+ var _1 = React.useState({}), capturedImages = _1[0], setCapturedImages = _1[1];
193
+ var _2 = React.useState("before-recto"), currentPhotoStep = _2[0], setCurrentPhotoStep = _2[1];
194
+ var _3 = React.useState("photo"), videoFlowPhase = _3[0], setVideoFlowPhase = _3[1];
195
+ var _4 = DocumentContext.useDocumentContext(), selectedDocumentType = _4.selectedDocumentType, setSelectedDocumentType = _4.setSelectedDocumentType;
168
196
  var finalAcceptedCountries = React.useMemo(function () {
169
197
  if (loadingTemplates)
170
198
  return acceptedCountries;
@@ -244,6 +272,11 @@ var DocumentCheck = function (_a) {
244
272
  if (docStep === 6) {
245
273
  return;
246
274
  }
275
+ // En NFC, on affiche d'abord l'écran de confirmation de la puce (gate -1)
276
+ if (node.nfcEnabled === true) {
277
+ setDocStep(-1);
278
+ return;
279
+ }
247
280
  if (((_a = node.introductionPage) === null || _a === void 0 ? void 0 : _a.title) === undefined &&
248
281
  ((_b = node.introductionPage) === null || _b === void 0 ? void 0 : _b.description) === undefined) {
249
282
  setDocStep(1);
@@ -348,9 +381,9 @@ var DocumentCheck = function (_a) {
348
381
  };
349
382
  var handleDocumentTypeSelect = function (documentId) { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
350
383
  var documentLabel, documentTemplateID, selectedDoc, selectedCountryCode, selectedDocumentInput, nfcMode, error_2;
351
- var _a, _b;
352
- return tslib_es6.__generator(this, function (_c) {
353
- switch (_c.label) {
384
+ var _a;
385
+ return tslib_es6.__generator(this, function (_b) {
386
+ switch (_b.label) {
354
387
  case 0:
355
388
  documentLabel = t("documentTypes.".concat(documentId), documentId);
356
389
  auditTrailService.logDocumentTypeSelected(sessionId, documentId, documentLabel);
@@ -383,22 +416,24 @@ var DocumentCheck = function (_a) {
383
416
  setCapturedImages({});
384
417
  setCurrentPhotoStep("before-recto");
385
418
  setVideoFlowPhase("photo");
386
- if (!(node.nfcEnabled === true && NFC_ELIGIBLE_DOCUMENT_TYPES.has(documentId))) return [3 /*break*/, 5];
387
- nfcMode = (_a = node.nfcMode) !== null && _a !== void 0 ? _a : "nfcOnly";
388
- _c.label = 1;
419
+ if (!(node.nfcEnabled === true &&
420
+ !nfcSkipped &&
421
+ NFC_ELIGIBLE_DOCUMENT_TYPES.has(documentId))) return [3 /*break*/, 5];
422
+ nfcMode = normalizeNfcMode(node.nfcMode);
423
+ _b.label = 1;
389
424
  case 1:
390
- _c.trys.push([1, 3, , 4]);
391
- return [4 /*yield*/, sessionService.updateSessionUserInput(sessionId, tslib_es6.__assign(tslib_es6.__assign({}, ((_b = session === null || session === void 0 ? void 0 : session.userInput) !== null && _b !== void 0 ? _b : {})), selectedDocumentInput))];
425
+ _b.trys.push([1, 3, , 4]);
426
+ return [4 /*yield*/, sessionService.updateSessionUserInput(sessionId, tslib_es6.__assign(tslib_es6.__assign({}, ((_a = session === null || session === void 0 ? void 0 : session.userInput) !== null && _a !== void 0 ? _a : {})), selectedDocumentInput))];
392
427
  case 2:
393
- _c.sent();
428
+ _b.sent();
394
429
  return [3 /*break*/, 4];
395
430
  case 3:
396
- error_2 = _c.sent();
431
+ error_2 = _b.sent();
397
432
  console.error("Failed to persist NFC document selection:", error_2);
398
433
  setNfcPreparationError(t("nfc_scan.preparation_failed", "Impossible de préparer le scan NFC. Veuillez réessayer."));
399
434
  return [3 /*break*/, 4];
400
435
  case 4:
401
- setDocStep(nfcMode === "nfcAndApi" ? 3 : 7);
436
+ setDocStep(nfcMode === "nfcOrPhoto" ? 3 : 7);
402
437
  return [2 /*return*/];
403
438
  case 5:
404
439
  setDocStep(3);
@@ -424,7 +459,6 @@ var DocumentCheck = function (_a) {
424
459
  }
425
460
  };
426
461
  var handleProcessingComplete = function (success, _retryCount, apiAnalysisData) {
427
- var _a;
428
462
  if (apiAnalysisData) {
429
463
  setAnalysisData(apiAnalysisData);
430
464
  // Extract and store the error code
@@ -435,7 +469,8 @@ var DocumentCheck = function (_a) {
435
469
  }
436
470
  if (success) {
437
471
  var shouldRunNfcAfterApi = node.nfcEnabled === true &&
438
- ((_a = node.nfcMode) !== null && _a !== void 0 ? _a : "nfcOnly") === "nfcAndApi" &&
472
+ !nfcSkipped &&
473
+ normalizeNfcMode(node.nfcMode) === "nfcOrPhoto" &&
439
474
  !!(selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id) &&
440
475
  NFC_ELIGIBLE_DOCUMENT_TYPES.has(selectedDocumentType.id);
441
476
  if (shouldRunNfcAfterApi) {
@@ -524,7 +559,61 @@ var DocumentCheck = function (_a) {
524
559
  }
525
560
  setDocStep(0);
526
561
  };
562
+ // Questionnaire de fallback NFC : l'utilisateur a déclaré ne pas avoir de puce.
563
+ // On enregistre la raison (non bloquant) puis on poursuit selon le mode du nœud :
564
+ // - nfcOrPhoto → flux photo/API du même nœud (intro/pays → upload → analyse), sans scan NFC
565
+ // - nfcOnly → on saute le nœud (nœud suivant)
566
+ var handleNfcFallback = function (reason, label, comment) { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
567
+ var error_3, nfcMode, hasIntroduction;
568
+ var _a, _b;
569
+ return tslib_es6.__generator(this, function (_c) {
570
+ switch (_c.label) {
571
+ case 0:
572
+ setNfcSkipped(true);
573
+ _c.label = 1;
574
+ case 1:
575
+ _c.trys.push([1, 3, , 4]);
576
+ return [4 /*yield*/, sessionService.skipNfcWithReason(sessionId, { reason: reason, label: label, comment: comment })];
577
+ case 2:
578
+ _c.sent();
579
+ return [3 /*break*/, 4];
580
+ case 3:
581
+ error_3 = _c.sent();
582
+ console.error("Failed to persist NFC fallback reason:", error_3);
583
+ return [3 /*break*/, 4];
584
+ case 4:
585
+ nfcMode = normalizeNfcMode(node.nfcMode);
586
+ if (nfcMode === "nfcOrPhoto") {
587
+ hasIntroduction = ((_a = node.introductionPage) === null || _a === void 0 ? void 0 : _a.title) !== undefined ||
588
+ ((_b = node.introductionPage) === null || _b === void 0 ? void 0 : _b.description) !== undefined;
589
+ setDocStep(hasIntroduction ? 0 : 1);
590
+ return [2 /*return*/];
591
+ }
592
+ if (template) {
593
+ stepObject.goToNextStep(node.id, template);
594
+ }
595
+ else {
596
+ stepObject.setStep(stepObject.step + 1);
597
+ }
598
+ return [2 /*return*/];
599
+ }
600
+ });
601
+ }); };
527
602
  var handleBack = function () {
603
+ var _a, _b;
604
+ var hasIntroduction = ((_a = node.introductionPage) === null || _a === void 0 ? void 0 : _a.title) !== undefined ||
605
+ ((_b = node.introductionPage) === null || _b === void 0 ? void 0 : _b.description) !== undefined;
606
+ // Le questionnaire de fallback (-2) revient au gate (-1)
607
+ if (docStep === -2) {
608
+ setDocStep(-1);
609
+ return;
610
+ }
611
+ // En NFC, le premier écran réel (intro=0 sinon pays=1) revient au gate (-1)
612
+ if (node.nfcEnabled === true &&
613
+ docStep === (hasIntroduction ? 0 : 1)) {
614
+ setDocStep(-1);
615
+ return;
616
+ }
528
617
  if (docStep === 0) {
529
618
  stepObject.goBack();
530
619
  }
@@ -533,6 +622,15 @@ var DocumentCheck = function (_a) {
533
622
  }
534
623
  };
535
624
  switch (docStep) {
625
+ case -1: {
626
+ var hasIntroduction_1 = ((_f = node.introductionPage) === null || _f === void 0 ? void 0 : _f.title) !== undefined ||
627
+ ((_g = node.introductionPage) === null || _g === void 0 ? void 0 : _g.description) !== undefined;
628
+ return (jsxRuntime.jsx(NfcChipGate.default, { onConfirm: function () { return setDocStep(hasIntroduction_1 ? 0 : 1); },
629
+ // Pas de puce → questionnaire de fallback pour recueillir la raison
630
+ onNoChip: function () { return setDocStep(-2); } }));
631
+ }
632
+ case -2:
633
+ return jsxRuntime.jsx(NfcFallbackSurvey.default, { onSubmit: handleNfcFallback });
536
634
  case 0:
537
635
  if (!documentTypeId) {
538
636
  console.error("DocumentCheck: Missing documentTypeId in step 0");
@@ -540,15 +638,20 @@ var DocumentCheck = function (_a) {
540
638
  return stepObject.setStep(Math.max(0, stepObject.step - 1));
541
639
  }, children: t("document_check.config_error.back", "Retour") })] }));
542
640
  }
543
- return (jsxRuntime.jsx(JDIPreIntroduction.default, { documentTypeId: documentTypeId, onContinue: function () { return setDocStep(1); }, onBack: handleBack, introTitleText: ((_f = node.introductionPage) === null || _f === void 0 ? void 0 : _f.title) || t("jdi.pre_introduction.title"), introDescText: ((_g = node.introductionPage) === null || _g === void 0 ? void 0 : _g.description) ||
641
+ return (jsxRuntime.jsx(JDIPreIntroduction.default, { documentTypeId: documentTypeId, onContinue: function () { return setDocStep(1); }, onBack: handleBack, introTitleText: ((_h = node.introductionPage) === null || _h === void 0 ? void 0 : _h.title) || t("jdi.pre_introduction.title"), introDescText: ((_j = node.introductionPage) === null || _j === void 0 ? void 0 : _j.description) ||
544
642
  t("jdi.pre_introduction.description") }));
545
643
  case 1:
546
- return (jsxRuntime.jsx(JDICountrySelection.default, { onCountrySelect: handleCountrySelect, onBack: handleBack, documentTypeId: documentTypeId, acceptedCountries: finalAcceptedCountries, countryIntroText: ((_h = node.countrySelection) === null || _h === void 0 ? void 0 : _h.title) || t("jdi.country_selection.title"), countryDescText: ((_j = node.countrySelection) === null || _j === void 0 ? void 0 : _j.description) ||
644
+ return (jsxRuntime.jsx(JDICountrySelection.default, { onCountrySelect: handleCountrySelect, onBack: handleBack, documentTypeId: documentTypeId, acceptedCountries: finalAcceptedCountries, countryIntroText: ((_k = node.countrySelection) === null || _k === void 0 ? void 0 : _k.title) || t("jdi.country_selection.title"), countryDescText: ((_l = node.countrySelection) === null || _l === void 0 ? void 0 : _l.description) ||
547
645
  t("jdi.country_selection.description") }));
548
646
  case 2:
549
647
  return (jsxRuntime.jsx(JDIDocumentSelection.default, { onDocumentSelect: handleDocumentTypeSelect, onBack: handleBack, documentTypeId: documentTypeId, sessionId: sessionId, chosenCountry: (finalAcceptedCountries === null || finalAcceptedCountries === void 0 ? void 0 : finalAcceptedCountries.find(function (c) { return c.code === selectedCountry; })) ||
550
- undefined, documentSelectionTitle: ((_k = node.documentSelection) === null || _k === void 0 ? void 0 : _k.title) || t("jdi.document_selection.title"), documentSelectionDescription: ((_l = node.documentSelection) === null || _l === void 0 ? void 0 : _l.description) ||
551
- t("jdi.document_selection.description") }));
648
+ undefined, documentSelectionTitle: ((_m = node.documentSelection) === null || _m === void 0 ? void 0 : _m.title) || t("jdi.document_selection.title"), documentSelectionDescription:
649
+ // En NFC, on laisse JDIDocumentSelection choisir le wording adapté
650
+ // (subtitle_identity_nfc) plutôt que l'override "téléverser" du nœud.
651
+ node.nfcEnabled === true
652
+ ? undefined
653
+ : ((_o = node.documentSelection) === null || _o === void 0 ? void 0 : _o.description) ||
654
+ t("jdi.document_selection.description"), nfcEnabled: node.nfcEnabled === true }));
552
655
  case 3:
553
656
  if (!selectedDocumentType) {
554
657
  console.error("DocumentCheck: selectedDocumentType is null for step 3!");
@@ -611,7 +714,15 @@ var DocumentCheck = function (_a) {
611
714
  if (nfcPreparationError) {
612
715
  return (jsxRuntime.jsx(MobilePageLayout.default, { footer: jsxRuntime.jsx("div", { className: "w-full max-w-md mx-auto", children: jsxRuntime.jsx(ButtonDesktop.default, { type: "back", onClick: function () { return setDocStep(2); }, className: "w-full text-[#3C3C40] text-center font-poppins text-sm font-medium hover:underline py-2", children: t("buttons.back", "Retour") }) }), children: jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center h-full p-4 text-center", children: [jsxRuntime.jsx("div", { className: "text-red-500 text-4xl mb-4", children: "\u26A0\uFE0F" }), jsxRuntime.jsx("h2", { className: "text-xl font-bold text-red-600 mb-2", children: t("nfc_scan.preparation_error_title", "Erreur de préparation NFC") }), jsxRuntime.jsx("p", { className: "text-gray-600 mb-4", children: nfcPreparationError })] }) }));
613
716
  }
614
- return (jsxRuntime.jsx(NfcScanNode.default, { sessionId: sessionId, nodeId: node.id, stepObject: stepObject, template: template }));
717
+ return (jsxRuntime.jsx(NfcScanNode.default, { sessionId: sessionId, nodeId: node.id, stepObject: stepObject, template: template, onBack: function () {
718
+ var _a, _b;
719
+ // Retour vers la sélection du document (corriger un mauvais choix). Le démontage de
720
+ // NfcScanStep ferme le SSE via le cleanup du hook (pas d'appel backend nécessaire).
721
+ var hasIntroduction = ((_a = node.introductionPage) === null || _a === void 0 ? void 0 : _a.title) !== undefined ||
722
+ ((_b = node.introductionPage) === null || _b === void 0 ? void 0 : _b.description) !== undefined;
723
+ hasRestoredNfcStep.current = true; // ne pas re-restaurer l'étape QR après ce retour
724
+ setDocStep(hasIntroduction ? 0 : 1);
725
+ } }));
615
726
  default:
616
727
  console.error("Invalid docStep: ".concat(docStep));
617
728
  return (jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center h-full p-4 text-center", children: [jsxRuntime.jsx("div", { className: "text-red-500 text-4xl mb-4", children: "\u26A0\uFE0F" }), jsxRuntime.jsx("h2", { className: "text-xl font-bold text-red-600 mb-2", children: t("document_check.navigation_error.title", "Erreur de navigation") }), jsxRuntime.jsx("p", { className: "text-gray-600 mb-4", children: t("document_check.navigation_error.description", "Étape non valide. Veuillez recommencer.") }), jsxRuntime.jsx(ButtonDesktop.default, { className: "px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors", type: "back", onClick: function () { return setDocStep(0); }, children: t("document_check.navigation_error.back", "Retour au début") })] }));