datakeen-session-react 1.1.200 → 1.1.202-dev.1
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/README.md +11 -0
- package/dist/cjs/components/document-collection/DocumentCollection.js +2 -2
- package/dist/cjs/components/document-collection/DocumentError.js +4 -1
- package/dist/cjs/components/id-check/Photo.js +42 -36
- package/dist/cjs/components/jdi/JDIDocumentSelection.js +3 -0
- package/dist/cjs/components/jdi/JDIDocumentUpload.js +5 -2
- package/dist/cjs/components/jdi/JDIError.js +4 -1
- package/dist/cjs/components/nfc-scan/NfcScanNode.js +20 -2
- package/dist/cjs/components/session/DocumentCheck.js +23 -23
- package/dist/cjs/hooks/useNfcSseStatus.js +59 -24
- package/dist/cjs/i18n/en.json.js +11 -0
- package/dist/cjs/i18n/es.json.js +11 -0
- package/dist/cjs/i18n/fr.json.js +11 -0
- package/dist/cjs/index.css.js +1 -1
- package/dist/cjs/services/cameraService.js +44 -23
- package/dist/cjs/services/sessionCredentials.js +2 -1
- package/dist/cjs/services/sessionService.js +16 -6
- package/dist/cjs/utils/cameraResolution.js +12 -0
- package/dist/esm/components/document-collection/DocumentCollection.js +2 -2
- package/dist/esm/components/document-collection/DocumentError.js +4 -1
- package/dist/esm/components/id-check/Photo.js +42 -36
- package/dist/esm/components/jdi/JDIDocumentSelection.js +3 -0
- package/dist/esm/components/jdi/JDIDocumentUpload.js +5 -2
- package/dist/esm/components/jdi/JDIError.js +4 -1
- package/dist/esm/components/nfc-scan/NfcScanNode.js +20 -2
- package/dist/esm/components/session/DocumentCheck.js +23 -23
- package/dist/esm/hooks/useNfcSseStatus.js +59 -24
- package/dist/esm/i18n/en.json.js +11 -0
- package/dist/esm/i18n/es.json.js +11 -0
- package/dist/esm/i18n/fr.json.js +11 -0
- package/dist/esm/index.css.js +1 -1
- package/dist/esm/services/cameraService.js +44 -23
- package/dist/esm/services/sessionCredentials.js +2 -1
- package/dist/esm/services/sessionService.js +16 -7
- package/dist/esm/utils/cameraResolution.js +9 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -549,6 +549,17 @@ Voir [docs/JOURNEY_NODE_BUILDER.md](./docs/JOURNEY_NODE_BUILDER.md) pour la chec
|
|
|
549
549
|
|
|
550
550
|
---
|
|
551
551
|
|
|
552
|
+
## Conformité des licences et SBOM
|
|
553
|
+
|
|
554
|
+
La CI refuse toute dépendance de production sous licence AGPL (**bloquant**) ou GPL (warning) qui n'est pas listée avec justification dans `license-allowlist.json`, et archive un SBOM CycloneDX (`sbom.cdx.json`) à chaque release (`dev`, `staging`, `main`).
|
|
555
|
+
|
|
556
|
+
```bash
|
|
557
|
+
npm ci
|
|
558
|
+
node scripts/check-licenses.cjs # contrôle local
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
Procédure complète (ajouter une exception, régénérer le SBOM) : [docs/LICENSE_COMPLIANCE.md](docs/LICENSE_COMPLIANCE.md).
|
|
562
|
+
|
|
552
563
|
## Support
|
|
553
564
|
|
|
554
565
|
- **Email** : support@datakeen.co
|
|
@@ -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; });
|
|
@@ -14,6 +14,9 @@ var analysisErrors = require('../../utils/analysisErrors.js');
|
|
|
14
14
|
var DocumentError = function (_a) {
|
|
15
15
|
var documentType = _a.documentType, documentTypeLabel = _a.documentTypeLabel, onRetry = _a.onRetry, onContinueAnyway = _a.onContinueAnyway, onBackToUserInput = _a.onBackToUserInput, _b = _a.retryCount, retryCount = _b === void 0 ? 0 : _b, _c = _a.predictions, predictions = _c === void 0 ? [] : _c; _a.errorDetails; _a.allowResubmission; var maxResubmissionAttempts = _a.maxResubmissionAttempts, _d = _a.isRetryAllowed, isRetryAllowed = _d === void 0 ? true : _d, errorCode = _a.errorCode, _e = _a.blockContinue, blockContinue = _e === void 0 ? false : _e;
|
|
16
16
|
var t = useI18n.useI18n().t;
|
|
17
|
+
// APP3-1955: a service refusal (no credits / quota) blocks the journey,
|
|
18
|
+
// whatever node.allowContinueOnFailure says.
|
|
19
|
+
var continueAnyway = analysisErrors.isServiceErrorCode(errorCode) ? undefined : onContinueAnyway;
|
|
17
20
|
var _f = React.useState([]), validationPoints = _f[0], setValidationPoints = _f[1];
|
|
18
21
|
React.useEffect(function () {
|
|
19
22
|
// Use shared utility to get validation points
|
|
@@ -62,7 +65,7 @@ var DocumentError = function (_a) {
|
|
|
62
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)
|
|
63
66
|
? // Quota / out of credits: nothing for the end user to improve.
|
|
64
67
|
t("errors.service_refusal_title")
|
|
65
|
-
: "\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 &&
|
|
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") }))] })) }) })] }) })] }));
|
|
66
69
|
};
|
|
67
70
|
|
|
68
71
|
exports.default = DocumentError;
|
|
@@ -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),
|
|
21
|
-
var _e = React.useState(
|
|
22
|
-
var _f = React.useState(
|
|
23
|
-
var _g = React.useState(
|
|
24
|
-
var _h = React.useState(
|
|
25
|
-
var _j = React.useState(
|
|
26
|
-
var _k = React.useState(false),
|
|
27
|
-
var _l = React.useState(
|
|
28
|
-
var _m = React.useState(
|
|
29
|
-
var _o = React.useState(
|
|
30
|
-
var _p = React.useState(
|
|
31
|
-
var _q = React.useState(false),
|
|
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
|
|
34
|
-
var
|
|
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
|
-
|
|
225
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
@@ -18,6 +18,9 @@ var JDIError = function (_a) {
|
|
|
18
18
|
var _b;
|
|
19
19
|
_a.documentType; var onRetry = _a.onRetry, onContinueAnyway = _a.onContinueAnyway, onBackToUserInput = _a.onBackToUserInput, _c = _a.retryCount, retryCount = _c === void 0 ? 0 : _c, _d = _a.predictions, predictions = _d === void 0 ? DEFAULT_PREDICTIONS : _d, errorCode = _a.errorCode; _a.allowResubmission; var maxResubmissionAttempts = _a.maxResubmissionAttempts, _e = _a.isRetryAllowed, isRetryAllowed = _e === void 0 ? true : _e, _f = _a.blockContinue, blockContinue = _f === void 0 ? false : _f;
|
|
20
20
|
var t = useI18n.useI18n().t;
|
|
21
|
+
// APP3-1955: a service refusal (no credits / quota) blocks the journey,
|
|
22
|
+
// whatever node.allowContinueOnFailure says.
|
|
23
|
+
var continueAnyway = analysisErrors.isServiceErrorCode(errorCode) ? undefined : onContinueAnyway;
|
|
21
24
|
var _g = React.useState([]), validationPoints = _g[0], setValidationPoints = _g[1];
|
|
22
25
|
// Détail de mismatch d'identité (code 7.0), calculé côté backend et porté
|
|
23
26
|
// par la première prédiction. Absent pour tous les autres codes.
|
|
@@ -33,7 +36,7 @@ var JDIError = function (_a) {
|
|
|
33
36
|
var guidance = t("user_guidance.".concat(errorCode), "");
|
|
34
37
|
return guidance || null;
|
|
35
38
|
};
|
|
36
|
-
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 &&
|
|
39
|
+
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
|
|
37
40
|
? t("errors.upload_not_confirmed.title")
|
|
38
41
|
: t("errors.verification_failed") }), jsxRuntime.jsx(Subtitle.default, { className: "text-sm text-gray-600 leading-relaxed", children: blockContinue
|
|
39
42
|
? t("errors.upload_not_confirmed.subtitle")
|
|
@@ -24,6 +24,7 @@ var NfcSuccessAnimation = require('./NfcSuccessAnimation.js');
|
|
|
24
24
|
// choisir l'environnement (même rôle que `intent://<host>/scan/<id>` sur Android).
|
|
25
25
|
var IOS_APP_SCHEME = "datakeenscannerswift";
|
|
26
26
|
var IOS_APP_STORE_URL = "https://apps.apple.com/app/id6762505375";
|
|
27
|
+
var INSTALL_REVEAL_DELAY_MS = 2500;
|
|
27
28
|
var NfcScanStep = function (_a) {
|
|
28
29
|
var sessionId = _a.sessionId, nodeId = _a.nodeId, stepObject = _a.stepObject, template = _a.template, pageTitle = _a.pageTitle, pageDescription = _a.pageDescription, onBack = _a.onBack, onContinueWithoutChip = _a.onContinueWithoutChip;
|
|
29
30
|
var t = useI18n.useI18n().t;
|
|
@@ -41,8 +42,11 @@ var NfcScanStep = function (_a) {
|
|
|
41
42
|
var apiBaseUrl = React.useMemo(function () { return api.getBaseURL(); }, []);
|
|
42
43
|
var iosAppLinks = React.useMemo(function () {
|
|
43
44
|
var host = new URL(apiBaseUrl, window.location.href).host;
|
|
45
|
+
// `return` : l'app rouvre exactement cette URL en fin de scan, ce qui ramène Safari sur cet
|
|
46
|
+
// onglet (et non un nouvel onglet) quand l'URL est identique.
|
|
47
|
+
var returnUrl = encodeURIComponent(window.location.href);
|
|
44
48
|
return {
|
|
45
|
-
open: "".concat(IOS_APP_SCHEME, "://").concat(host, "/scan/").concat(sessionId),
|
|
49
|
+
open: "".concat(IOS_APP_SCHEME, "://").concat(host, "/scan/").concat(sessionId, "?return=").concat(returnUrl),
|
|
46
50
|
// Lu par le bouton « Reprendre ma session » de l'app au premier lancement après installation.
|
|
47
51
|
resume: "https://".concat(host, "/scan/").concat(sessionId),
|
|
48
52
|
};
|
|
@@ -53,6 +57,20 @@ var NfcScanStep = function (_a) {
|
|
|
53
57
|
var _a;
|
|
54
58
|
(_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(iosAppLinks.resume).catch(function () { return undefined; });
|
|
55
59
|
};
|
|
60
|
+
// iOS ne permet pas de savoir si l'app est installée. Un seul bouton « Ouvrir » ; si la page est
|
|
61
|
+
// toujours visible après le délai (app absente : Safari affiche « adresse invalide »), on révèle
|
|
62
|
+
// « Installer ». Pas de redirection automatique vers l'App Store : pendant la confirmation iOS
|
|
63
|
+
// « Ouvrir dans ID Scan ? » la page reste visible, une redirection y enverrait à tort.
|
|
64
|
+
var _e = React.useState(false), showInstall = _e[0], setShowInstall = _e[1];
|
|
65
|
+
var installRevealTimerRef = React.useRef();
|
|
66
|
+
React.useEffect(function () { return function () { return clearTimeout(installRevealTimerRef.current); }; }, []);
|
|
67
|
+
var revealInstallIfAppDidNotOpen = function () {
|
|
68
|
+
clearTimeout(installRevealTimerRef.current);
|
|
69
|
+
installRevealTimerRef.current = setTimeout(function () {
|
|
70
|
+
if (document.visibilityState === "visible")
|
|
71
|
+
setShowInstall(true);
|
|
72
|
+
}, INSTALL_REVEAL_DELAY_MS);
|
|
73
|
+
};
|
|
56
74
|
var status = useNfcSseStatus.useNfcSseStatus({
|
|
57
75
|
sessionId: sessionId,
|
|
58
76
|
apiBaseUrl: apiBaseUrl,
|
|
@@ -164,7 +182,7 @@ var NfcScanStep = function (_a) {
|
|
|
164
182
|
return (jsxRuntime.jsx(MobilePageLayout.default, { footer: footer, 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.jsxs("div", { className: "text-center space-y-4 mt-16 md:mt-20", children: [jsxRuntime.jsx(Title.default, { className: "text-xl md:text-2xl lg:text-3xl", children: title }), jsxRuntime.jsx(Subtitle.default, { className: "text-sm md:text-base text-gray-600 leading-relaxed whitespace-pre-line", children: subtitle })] }), jsxRuntime.jsx("div", { className: "flex-1 flex flex-col justify-center items-center gap-4", children: status === "success" ? (jsxRuntime.jsx(NfcSuccessAnimation.default, {})) : status === "completed" ? (jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 p-8", children: [jsxRuntime.jsx("div", { className: "animate-spin w-10 h-10 border-2 border-gray-300 border-t-blue-500 rounded-full" }), jsxRuntime.jsx("p", { className: "text-sm text-gray-600", children: t("nfc_scan.verifying", "Vérification en cours…") })] })) : status === "failed" ? (jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2 p-8 text-center", children: [jsxRuntime.jsx("p", { className: "text-base font-semibold text-red-600", children: t("nfc_scan.failed_title", "Le scan n'a pas pu être vérifié") }), jsxRuntime.jsx("p", { className: "text-sm text-gray-600 leading-relaxed", children: t("nfc_scan.failed_description", "Après plusieurs tentatives, la lecture de votre document n'a pas pu être validée.") }), resetError && (jsxRuntime.jsx("p", { className: "text-sm text-red-600", role: "alert", children: resetError }))] })) : (
|
|
165
183
|
// Contenu principal QR/mobile — reste monté pour "pending" ET "opened", pour ne
|
|
166
184
|
// jamais démonter le canvas déjà généré.
|
|
167
|
-
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [qrError ? (jsxRuntime.jsx("div", { className: "text-red-500 text-center p-4", children: qrError })) : isIOS ? (jsxRuntime.jsxs("div", { className: "flex w-full flex-col items-center gap-3 p-4 text-center", children: [jsxRuntime.jsx("a", { href: iosAppLinks.open, className: "flex h-[48px] w-full items-center justify-center rounded-[12px] text-sm font-medium hover:brightness-110 active:brightness-90", style: { backgroundColor: "var(--dk-btn-bg)", color: "var(--dk-btn-text)" }, children: t("nfc_scan.open_app_link", "Ouvrir l'application") }), jsxRuntime.jsx("a", { href: IOS_APP_STORE_URL, onClick: copyResumeLink, className: "flex h-[48px] w-full items-center justify-center rounded-[12px] border border-gray-300 text-sm font-medium text-gray-600 hover:bg-black/5", children: t("nfc_scan.install_app_link", "Installer l'application") }), jsxRuntime.jsx("p", { className: "text-xs text-gray-500 leading-relaxed", children: t("nfc_scan.install_app_hint", "Après l'installation, revenez sur cette page et appuyez sur « Ouvrir l'application ».") })] })) : isMobile ? (jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 p-8 text-center", children: [jsxRuntime.jsx("div", { className: "animate-spin w-10 h-10 border-2 border-gray-300 border-t-blue-500 rounded-full" }), jsxRuntime.jsx("p", { className: "text-sm text-gray-600", children: t("nfc_scan.opening_app", "Ouverture de l'application…") }), jsxRuntime.jsx("a", { href: nfcUrl, className: "text-sm font-medium text-blue-600 underline", children: t("nfc_scan.open_app_link", "Ouvrir l'application") })] })) : (jsxRuntime.jsx("div", { className: "bg-white p-4 rounded-lg shadow-lg border-2 border-gray-200", children: jsxRuntime.jsx("canvas", { ref: canvasRef }) })), status === "opened" && (jsxRuntime.jsxs("div", { className: "text-center space-y-1", children: [jsxRuntime.jsx("p", { className: "text-sm font-semibold", style: { color: "var(--uni-secondary-color, #0a9983)" }, children: t("nfc_scan.qr_opened_title", "QR code scanné") }), jsxRuntime.jsx("p", { className: "text-xs text-gray-500 leading-relaxed", children: t("nfc_scan.qr_opened_description", "L'expérience NFC est ouverte sur votre smartphone. Continuez le scan sur votre téléphone.") }), jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2 text-xs text-gray-500 pt-1", children: [jsxRuntime.jsx("span", { className: "h-2 w-2 rounded-full animate-pulse", style: { backgroundColor: "var(--uni-primary-color, #11e5c5)" } }), t("nfc_scan.waiting_completion", "En attente de la lecture NFC")] })] }))] })) })] }) }) }));
|
|
185
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [qrError ? (jsxRuntime.jsx("div", { className: "text-red-500 text-center p-4", children: qrError })) : isIOS ? (jsxRuntime.jsxs("div", { className: "flex w-full flex-col items-center gap-3 p-4 text-center", children: [jsxRuntime.jsx("a", { href: iosAppLinks.open, onClick: revealInstallIfAppDidNotOpen, className: "flex h-[48px] w-full items-center justify-center rounded-[12px] text-sm font-medium hover:brightness-110 active:brightness-90", style: { backgroundColor: "var(--dk-btn-bg)", color: "var(--dk-btn-text)" }, children: t("nfc_scan.open_app_link", "Ouvrir l'application") }), showInstall ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("a", { href: IOS_APP_STORE_URL, onClick: copyResumeLink, className: "flex h-[48px] w-full items-center justify-center rounded-[12px] border border-gray-300 text-sm font-medium text-gray-600 hover:bg-black/5", children: t("nfc_scan.install_app_link", "Installer l'application") }), jsxRuntime.jsx("p", { className: "text-xs text-gray-500 leading-relaxed", children: t("nfc_scan.install_app_hint", "Après l'installation, revenez sur cette page et appuyez sur « Ouvrir l'application ».") })] })) : null] })) : isMobile ? (jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 p-8 text-center", children: [jsxRuntime.jsx("div", { className: "animate-spin w-10 h-10 border-2 border-gray-300 border-t-blue-500 rounded-full" }), jsxRuntime.jsx("p", { className: "text-sm text-gray-600", children: t("nfc_scan.opening_app", "Ouverture de l'application…") }), jsxRuntime.jsx("a", { href: nfcUrl, className: "text-sm font-medium text-blue-600 underline", children: t("nfc_scan.open_app_link", "Ouvrir l'application") })] })) : (jsxRuntime.jsx("div", { className: "bg-white p-4 rounded-lg shadow-lg border-2 border-gray-200", children: jsxRuntime.jsx("canvas", { ref: canvasRef }) })), status === "opened" && (jsxRuntime.jsxs("div", { className: "text-center space-y-1", children: [jsxRuntime.jsx("p", { className: "text-sm font-semibold", style: { color: "var(--uni-secondary-color, #0a9983)" }, children: t("nfc_scan.qr_opened_title", "QR code scanné") }), jsxRuntime.jsx("p", { className: "text-xs text-gray-500 leading-relaxed", children: t("nfc_scan.qr_opened_description", "L'expérience NFC est ouverte sur votre smartphone. Continuez le scan sur votre téléphone.") }), jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2 text-xs text-gray-500 pt-1", children: [jsxRuntime.jsx("span", { className: "h-2 w-2 rounded-full animate-pulse", style: { backgroundColor: "var(--uni-primary-color, #11e5c5)" } }), t("nfc_scan.waiting_completion", "En attente de la lecture NFC")] })] }))] })) })] }) }) }));
|
|
168
186
|
};
|
|
169
187
|
|
|
170
188
|
exports.default = NfcScanStep;
|
|
@@ -75,12 +75,12 @@ var normalizeNfcMode = function (mode) {
|
|
|
75
75
|
* - Uses hooks for translation, retry navigation, and context management.
|
|
76
76
|
*/
|
|
77
77
|
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,
|
|
78
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
79
|
+
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
80
|
var t = useI18n.useI18n().t;
|
|
81
81
|
var session = SessionContext.getSession().session;
|
|
82
|
-
var
|
|
83
|
-
var
|
|
82
|
+
var _s = React.useState(), documentTemplates = _s[0], setDocumentTemplates = _s[1];
|
|
83
|
+
var _t = React.useState(true), loadingTemplates = _t[0], setLoadingTemplates = _t[1];
|
|
84
84
|
React.useEffect(function () {
|
|
85
85
|
(function () { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
|
|
86
86
|
var templates;
|
|
@@ -99,7 +99,7 @@ var DocumentCheck = function (_a) {
|
|
|
99
99
|
}); })();
|
|
100
100
|
}, []);
|
|
101
101
|
var initialRetryCount = retryService.getNodeRetryCount(session, node.id);
|
|
102
|
-
var
|
|
102
|
+
var _u = React.useState(null), selectedMethod = _u[0], setSelectedMethod = _u[1];
|
|
103
103
|
var isPictureAllowed = (_b = allowedAddingMethods === null || allowedAddingMethods === void 0 ? void 0 : allowedAddingMethods.includes("picture")) !== null && _b !== void 0 ? _b : true;
|
|
104
104
|
var isDownloadAllowed = (_c = allowedAddingMethods === null || allowedAddingMethods === void 0 ? void 0 : allowedAddingMethods.includes("download")) !== null && _c !== void 0 ? _c : true;
|
|
105
105
|
// Check if retry is allowed based on initial retry count
|
|
@@ -118,25 +118,25 @@ var DocumentCheck = function (_a) {
|
|
|
118
118
|
return true;
|
|
119
119
|
};
|
|
120
120
|
// Initialize docStep - if retries exhausted, start at error page (step 6)
|
|
121
|
-
var
|
|
121
|
+
var _v = React.useState(function () {
|
|
122
122
|
if (initialRetryCount > 0 && !isInitialRetryAllowed()) {
|
|
123
123
|
return 6; // Error page
|
|
124
124
|
}
|
|
125
125
|
return 0; // Normal flow - start with introduction
|
|
126
|
-
}), docStep =
|
|
127
|
-
var
|
|
128
|
-
var
|
|
129
|
-
var
|
|
130
|
-
var
|
|
131
|
-
var
|
|
132
|
-
var
|
|
126
|
+
}), docStep = _v[0], setDocStep = _v[1];
|
|
127
|
+
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];
|
|
128
|
+
var _x = React.useState(null), fileUploaded = _x[0], setFileUploaded = _x[1];
|
|
129
|
+
var _y = React.useState(null), analysisData = _y[0], setAnalysisData = _y[1];
|
|
130
|
+
var _z = React.useState(null), errorCode = _z[0], setErrorCode = _z[1];
|
|
131
|
+
var _0 = React.useState(false), blockContinue = _0[0], setBlockContinue = _0[1];
|
|
132
|
+
var _1 = React.useState(null), nfcPreparationError = _1[0], setNfcPreparationError = _1[1];
|
|
133
133
|
// Quand l'utilisateur déclare ne pas avoir de puce (questionnaire de fallback),
|
|
134
134
|
// on ne doit plus le réorienter vers le scan NFC (ni avant, ni après l'analyse API).
|
|
135
|
-
var
|
|
135
|
+
var _2 = React.useState(false), nfcSkipped = _2[0], setNfcSkipped = _2[1];
|
|
136
136
|
// Initialize retry count from session data
|
|
137
|
-
var
|
|
137
|
+
var _3 = React.useState(function () {
|
|
138
138
|
return retryService.getNodeRetryCount(session, node.id);
|
|
139
|
-
}), retryCount =
|
|
139
|
+
}), retryCount = _3[0], setRetryCount = _3[1];
|
|
140
140
|
// Update retry count when session loads/changes
|
|
141
141
|
React.useEffect(function () {
|
|
142
142
|
if (session) {
|
|
@@ -231,10 +231,10 @@ var DocumentCheck = function (_a) {
|
|
|
231
231
|
setDocStep(6);
|
|
232
232
|
}
|
|
233
233
|
}, [retryCount, node.allowResubmission, node.maxResubmissionAttempts]);
|
|
234
|
-
var
|
|
235
|
-
var
|
|
236
|
-
var
|
|
237
|
-
var
|
|
234
|
+
var _4 = React.useState({}), capturedImages = _4[0], setCapturedImages = _4[1];
|
|
235
|
+
var _5 = React.useState("before-recto"), currentPhotoStep = _5[0], setCurrentPhotoStep = _5[1];
|
|
236
|
+
var _6 = React.useState("photo"), videoFlowPhase = _6[0], setVideoFlowPhase = _6[1];
|
|
237
|
+
var _7 = DocumentContext.useDocumentContext(), selectedDocumentType = _7.selectedDocumentType, setSelectedDocumentType = _7.setSelectedDocumentType;
|
|
238
238
|
var finalAcceptedCountries = React.useMemo(function () {
|
|
239
239
|
if (loadingTemplates)
|
|
240
240
|
return acceptedCountries;
|
|
@@ -764,13 +764,13 @@ var DocumentCheck = function (_a) {
|
|
|
764
764
|
return (jsxRuntime.jsx(BeforePhoto.default, { setStep: function () { return setCurrentPhotoStep("recto"); }, isSingleSided: isSingleSided, onBack: function () { return setDocStep(2); } }));
|
|
765
765
|
}
|
|
766
766
|
if (currentPhotoStep === "recto") {
|
|
767
|
-
return (jsxRuntime.jsx(Photo.default, { onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }));
|
|
767
|
+
return (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }));
|
|
768
768
|
}
|
|
769
769
|
if (currentPhotoStep === "before-verso") {
|
|
770
770
|
return (jsxRuntime.jsx(BeforeVersoPhoto.default, { setStep: function () { return setCurrentPhotoStep("verso"); } }));
|
|
771
771
|
}
|
|
772
772
|
if (currentPhotoStep === "verso") {
|
|
773
|
-
return (jsxRuntime.jsx(Photo.default, { onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }));
|
|
773
|
+
return (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }));
|
|
774
774
|
}
|
|
775
775
|
if (currentPhotoStep === "confirmation") {
|
|
776
776
|
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 +778,7 @@ var DocumentCheck = function (_a) {
|
|
|
778
778
|
return (jsxRuntime.jsx(BeforePhoto.default, { setStep: function () { return setCurrentPhotoStep("recto"); }, isSingleSided: isSingleSided, onBack: function () { return setDocStep(2); } }));
|
|
779
779
|
}
|
|
780
780
|
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 () {
|
|
781
|
+
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
782
|
if (isPictureAllowed && isDownloadAllowed) {
|
|
783
783
|
setSelectedMethod(null);
|
|
784
784
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
|
|
5
5
|
var SUCCESS_DISPLAY_DURATION_MS = 2500;
|
|
6
|
+
var RECONNECT_DELAY_MS = 2000;
|
|
6
7
|
function useNfcSseStatus(_a) {
|
|
7
8
|
var sessionId = _a.sessionId, apiBaseUrl = _a.apiBaseUrl, onCompleted = _a.onCompleted;
|
|
8
9
|
var _b = React.useState("pending"), status = _b[0], setStatus = _b[1];
|
|
@@ -12,42 +13,76 @@ function useNfcSseStatus(_a) {
|
|
|
12
13
|
if (!sessionId || !apiBaseUrl)
|
|
13
14
|
return;
|
|
14
15
|
var url = "".concat(apiBaseUrl, "/session/sdk/").concat(sessionId, "/nfc-status");
|
|
15
|
-
var source =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
var source = null;
|
|
17
|
+
// Statut terminal reçu : plus aucune (re)connexion, et `onCompleted` n'est appelé qu'une fois.
|
|
18
|
+
var finished = false;
|
|
19
|
+
var reconnectTimer;
|
|
20
|
+
var open = function () {
|
|
21
|
+
clearTimeout(reconnectTimer);
|
|
22
|
+
source === null || source === void 0 ? void 0 : source.close();
|
|
23
|
+
var current = new EventSource(url);
|
|
24
|
+
source = current;
|
|
25
|
+
current.onmessage = function (event) {
|
|
26
|
+
if (finished)
|
|
27
|
+
return;
|
|
28
|
+
try {
|
|
29
|
+
var data = JSON.parse(event.data);
|
|
30
|
+
if (data.status === "completed") {
|
|
31
|
+
finished = true;
|
|
32
|
+
current.close();
|
|
33
|
+
setStatus("success");
|
|
34
|
+
setTimeout(function () {
|
|
35
|
+
setStatus("completed");
|
|
36
|
+
onCompletedRef.current();
|
|
37
|
+
}, SUCCESS_DISPLAY_DURATION_MS);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// `failed` est terminal : le serveur ferme le flux, inutile de le rouvrir en boucle.
|
|
41
|
+
if (data.status === "failed")
|
|
42
|
+
finished = true;
|
|
43
|
+
setStatus(data.status);
|
|
44
|
+
}
|
|
26
45
|
}
|
|
27
|
-
|
|
28
|
-
|
|
46
|
+
catch (_a) {
|
|
47
|
+
// message malformé, on ignore
|
|
29
48
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
};
|
|
50
|
+
// EventSource se reconnecte seul tant qu'il est CONNECTING. Mais iOS coupe le flux quand
|
|
51
|
+
// Safari passe en arrière-plan pendant le scan dans l'app, et une réponse non-200 à la
|
|
52
|
+
// reconnexion le ferme définitivement (CLOSED) : on le rouvre alors nous-mêmes.
|
|
53
|
+
current.onerror = function () {
|
|
54
|
+
if (!finished && current.readyState === EventSource.CLOSED) {
|
|
55
|
+
reconnectTimer = setTimeout(open, RECONNECT_DELAY_MS);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
34
58
|
};
|
|
35
|
-
|
|
36
|
-
|
|
59
|
+
// Retour sur la page (depuis l'app de scan, ou restauration bfcache) : le flux a pu mourir
|
|
60
|
+
// pendant la suspension et l'event `completed` être perdu. On rouvre : le serveur renvoie le
|
|
61
|
+
// statut courant dès la connexion, donc le parcours avance sans recharger la page.
|
|
62
|
+
var reopenIfVisible = function () {
|
|
63
|
+
if (!finished && document.visibilityState === "visible")
|
|
64
|
+
open();
|
|
37
65
|
};
|
|
38
66
|
// Fermer le flux uniquement quand la page se ferme réellement, sinon le SSE reste ouvert côté
|
|
39
67
|
// serveur (heartbeat + listener qui fuient). `pagehide` couvre la fermeture d'onglet/navigation
|
|
40
68
|
// (plus fiable que `beforeunload` sur mobile).
|
|
41
69
|
//
|
|
42
70
|
// NE PAS fermer sur `visibilitychange`/`hidden` : le passage en arrière-plan est le geste
|
|
43
|
-
// NORMAL de l'utilisateur qui bascule vers son téléphone pour scanner le QR.
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
71
|
+
// NORMAL de l'utilisateur qui bascule vers son téléphone pour scanner le QR. On se contente de
|
|
72
|
+
// ROUVRIR au retour (`visible`), ce qui ne coupe jamais un flux encore utile.
|
|
73
|
+
var closeSource = function () {
|
|
74
|
+
clearTimeout(reconnectTimer);
|
|
75
|
+
source === null || source === void 0 ? void 0 : source.close();
|
|
76
|
+
};
|
|
77
|
+
open();
|
|
47
78
|
window.addEventListener("pagehide", closeSource);
|
|
79
|
+
window.addEventListener("pageshow", reopenIfVisible);
|
|
80
|
+
document.addEventListener("visibilitychange", reopenIfVisible);
|
|
48
81
|
return function () {
|
|
49
82
|
window.removeEventListener("pagehide", closeSource);
|
|
50
|
-
|
|
83
|
+
window.removeEventListener("pageshow", reopenIfVisible);
|
|
84
|
+
document.removeEventListener("visibilitychange", reopenIfVisible);
|
|
85
|
+
closeSource();
|
|
51
86
|
};
|
|
52
87
|
}, [sessionId, apiBaseUrl]);
|
|
53
88
|
return { status: status };
|