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