datakeen-session-react 1.1.205 → 1.1.207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/document-collection/DocumentCollection.js +2 -2
- package/dist/cjs/components/document-collection/DocumentProcessing.js +3 -1
- package/dist/cjs/components/id-check/Photo.js +42 -36
- package/dist/cjs/components/jdi/JDIProcessing.js +6 -1
- package/dist/cjs/components/nfc-scan/NfcScanNode.js +3 -4
- package/dist/cjs/components/session/DocumentCheck.js +2 -2
- package/dist/cjs/components/signature-electronic/SignatureElectronic.js +13 -30
- package/dist/cjs/hooks/useUserInputForm.js +57 -0
- package/dist/cjs/i18n/en.json.js +10 -0
- package/dist/cjs/i18n/es.json.js +10 -0
- package/dist/cjs/i18n/fr.json.js +10 -0
- package/dist/cjs/index.css.js +1 -1
- package/dist/cjs/services/analysis.js +7 -0
- package/dist/cjs/services/cameraService.js +44 -23
- package/dist/cjs/services/pollingService.js +4 -1
- package/dist/cjs/services/sessionService.js +16 -6
- package/dist/cjs/utils/analysisErrors.js +11 -0
- package/dist/cjs/utils/cameraResolution.js +12 -0
- package/dist/cjs/utils/extractedCopy.js +38 -0
- package/dist/cjs/utils/sessionStatus.js +3 -2
- package/dist/esm/components/document-collection/DocumentCollection.js +2 -2
- package/dist/esm/components/document-collection/DocumentProcessing.js +4 -2
- package/dist/esm/components/id-check/Photo.js +42 -36
- package/dist/esm/components/jdi/JDIProcessing.js +7 -2
- package/dist/esm/components/nfc-scan/NfcScanNode.js +3 -4
- package/dist/esm/components/session/DocumentCheck.js +2 -2
- package/dist/esm/components/signature-electronic/SignatureElectronic.js +13 -30
- package/dist/esm/hooks/useUserInputForm.js +58 -1
- package/dist/esm/i18n/en.json.js +10 -0
- package/dist/esm/i18n/es.json.js +10 -0
- package/dist/esm/i18n/fr.json.js +10 -0
- package/dist/esm/index.css.js +1 -1
- package/dist/esm/services/analysis.js +7 -0
- package/dist/esm/services/cameraService.js +44 -23
- package/dist/esm/services/pollingService.js +4 -1
- package/dist/esm/services/sessionService.js +16 -7
- package/dist/esm/utils/analysisErrors.js +10 -1
- package/dist/esm/utils/cameraResolution.js +9 -0
- package/dist/esm/utils/extractedCopy.js +36 -0
- package/dist/esm/utils/sessionStatus.js +3 -2
- package/package.json +2 -1
|
@@ -308,7 +308,7 @@ var DocumentCollection = function (_a) {
|
|
|
308
308
|
case "before-recto":
|
|
309
309
|
return jsxRuntime.jsx(BeforePhoto.default, { setStep: function () { return setPhotoSubStep("recto"); }, isSingleSided: !requiresTwoSides_1, onBack: handleBack });
|
|
310
310
|
case "recto":
|
|
311
|
-
return jsxRuntime.jsx(Photo.default, { onCapture: function (img) { return handlePhotoCapture(img, "recto"); }, automaticCapture: false, maskType: "document" });
|
|
311
|
+
return jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (img) { return handlePhotoCapture(img, "recto"); }, automaticCapture: false, maskType: "document" });
|
|
312
312
|
case "preview-recto":
|
|
313
313
|
return (jsxRuntime.jsx(PhotoPreview.default, { imageUrl: capturedImages.recto, side: "recto", isSingleSided: !requiresTwoSides_1, onValidate: function () { return setPhotoSubStep(requiresTwoSides_1 ? "before-verso" : "confirmation"); }, onRetake: function () {
|
|
314
314
|
setCapturedImages(function (prev) { var next = tslib_es6.__assign({}, prev); delete next.recto; return next; });
|
|
@@ -317,7 +317,7 @@ var DocumentCollection = function (_a) {
|
|
|
317
317
|
case "before-verso":
|
|
318
318
|
return jsxRuntime.jsx(BeforeVersoPhoto.default, { setStep: function () { return setPhotoSubStep("verso"); } });
|
|
319
319
|
case "verso":
|
|
320
|
-
return jsxRuntime.jsx(Photo.default, { onCapture: function (img) { return handlePhotoCapture(img, "verso"); }, automaticCapture: false, maskType: "document" });
|
|
320
|
+
return jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (img) { return handlePhotoCapture(img, "verso"); }, automaticCapture: false, maskType: "document" });
|
|
321
321
|
case "preview-verso":
|
|
322
322
|
return (jsxRuntime.jsx(PhotoPreview.default, { imageUrl: capturedImages.verso, side: "verso", onValidate: function () { return setPhotoSubStep("confirmation"); }, onRetake: function () {
|
|
323
323
|
setCapturedImages(function (prev) { var next = tslib_es6.__assign({}, prev); delete next.verso; return next; });
|
|
@@ -234,7 +234,9 @@ var DocumentProcessing = React.memo(function (_a) {
|
|
|
234
234
|
},
|
|
235
235
|
]
|
|
236
236
|
: undefined,
|
|
237
|
-
canRetry: isUploadNotConfirmed ||
|
|
237
|
+
canRetry: isUploadNotConfirmed ||
|
|
238
|
+
!!serviceErrorCode ||
|
|
239
|
+
analysisErrors.isAnalysisFailedError(error_1),
|
|
238
240
|
blockContinue: isUploadNotConfirmed,
|
|
239
241
|
});
|
|
240
242
|
setIsComplete(true);
|
|
@@ -11,27 +11,31 @@ var CameraError = require('./CameraError.js');
|
|
|
11
11
|
var CameraMask = require('./CameraMask.js');
|
|
12
12
|
var OrientationToggle = require('./OrientationToggle.js');
|
|
13
13
|
var useI18n = require('../../hooks/useI18n.js');
|
|
14
|
+
var cameraResolution = require('../../utils/cameraResolution.js');
|
|
15
|
+
var sessionService = require('../../services/sessionService.js');
|
|
14
16
|
var useIsMobile = require('../../hooks/useIsMobile.js');
|
|
15
17
|
|
|
16
18
|
var Photo = function (_a) {
|
|
17
|
-
var onCapture = _a.onCapture, _b = _a.automaticCapture, automaticCapture = _b === void 0 ? false : _b, _c = _a.maskType, maskType = _c === void 0 ? "id" : _c;
|
|
19
|
+
var onCapture = _a.onCapture, sessionId = _a.sessionId, nodeId = _a.nodeId, _b = _a.automaticCapture, automaticCapture = _b === void 0 ? false : _b, _c = _a.maskType, maskType = _c === void 0 ? "id" : _c;
|
|
18
20
|
var isMobile = useIsMobile.default(768);
|
|
19
21
|
var videoRef = React.useRef(null);
|
|
20
|
-
var _d = React.useState(false),
|
|
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
|
};
|
|
@@ -320,7 +320,12 @@ var JDIProcessing = React.memo(function (_a) {
|
|
|
320
320
|
},
|
|
321
321
|
]
|
|
322
322
|
: undefined,
|
|
323
|
-
|
|
323
|
+
// Analyse en erreur côté moteur : nouvel essai possible (dans la
|
|
324
|
+
// limite de resoumission du nœud), jamais un passage silencieux.
|
|
325
|
+
canRetry: isNetworkError ||
|
|
326
|
+
isUploadNotConfirmed ||
|
|
327
|
+
!!serviceErrorCode ||
|
|
328
|
+
analysisErrors.isAnalysisFailedError(error_2),
|
|
324
329
|
blockContinue: isUploadNotConfirmed,
|
|
325
330
|
});
|
|
326
331
|
setIsComplete(true);
|
|
@@ -35,11 +35,10 @@ var NfcScanStep = function (_a) {
|
|
|
35
35
|
// Sur mobile, on ouvre directement l'app de scan au lieu d'afficher un QR code inutile.
|
|
36
36
|
var isMobile = React.useMemo(function () { return isMobileDevice.isMobileDevice(); }, []);
|
|
37
37
|
var isIOS = React.useMemo(function () { return isMobileDevice.isIOSDevice(); }, []);
|
|
38
|
-
var nfcUrl = React.useMemo(function () {
|
|
39
|
-
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
40
|
-
return "".concat(origin, "/scan/").concat(sessionId);
|
|
41
|
-
}, [sessionId]);
|
|
42
38
|
var apiBaseUrl = React.useMemo(function () { return api.getBaseURL(); }, []);
|
|
39
|
+
// Domaine Datakeen (celui de l'API), pas celui de la page hôte : seul lui sert l'AASA qui
|
|
40
|
+
// déclenche l'App Clip iOS. Sur un site intégrateur, l'origine de la page ouvrait le navigateur.
|
|
41
|
+
var nfcUrl = React.useMemo(function () { return "".concat(new URL(apiBaseUrl, window.location.href).origin, "/scan/").concat(sessionId); }, [apiBaseUrl, sessionId]);
|
|
43
42
|
var iosAppLinks = React.useMemo(function () {
|
|
44
43
|
var host = new URL(apiBaseUrl, window.location.href).host;
|
|
45
44
|
// `return` : l'app rouvre exactement cette URL en fin de scan, ce qui ramène Safari sur cet
|
|
@@ -780,13 +780,13 @@ var DocumentCheck = function (_a) {
|
|
|
780
780
|
return (jsxRuntime.jsx(BeforePhoto.default, { setStep: function () { return setCurrentPhotoStep("recto"); }, isSingleSided: isSingleSided, onBack: function () { return setDocStep(2); } }));
|
|
781
781
|
}
|
|
782
782
|
if (currentPhotoStep === "recto") {
|
|
783
|
-
return (jsxRuntime.jsx(Photo.default, { onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }));
|
|
783
|
+
return (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }));
|
|
784
784
|
}
|
|
785
785
|
if (currentPhotoStep === "before-verso") {
|
|
786
786
|
return (jsxRuntime.jsx(BeforeVersoPhoto.default, { setStep: function () { return setCurrentPhotoStep("verso"); } }));
|
|
787
787
|
}
|
|
788
788
|
if (currentPhotoStep === "verso") {
|
|
789
|
-
return (jsxRuntime.jsx(Photo.default, { onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }));
|
|
789
|
+
return (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }));
|
|
790
790
|
}
|
|
791
791
|
if (currentPhotoStep === "confirmation") {
|
|
792
792
|
return (jsxRuntime.jsx(PhotoConfirmation.default, { imageUrl: capturedImages.recto || "", versoImageUrl: capturedImages.verso, requiresTwoSides: !!capturedImages.verso, onConfirm: onConfirm, onRetry: function () { return setCurrentPhotoStep("before-recto"); }, onRetryAfterProcessing: function () { return setCurrentPhotoStep("before-recto"); }, fileUploaded: fileUploaded, isSingleSided: isSingleSided }));
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var reactI18next = require('react-i18next');
|
|
@@ -10,7 +9,6 @@ var index = require('../../i18n/index.js');
|
|
|
10
9
|
var SignatureElectronicIntroduction = require('./SignatureElectronicIntroduction.js');
|
|
11
10
|
var DocusealSignature = require('./DocusealSignature.js');
|
|
12
11
|
var SignedDocumentPreview = require('./SignedDocumentPreview.js');
|
|
13
|
-
var sessionService = require('../../services/sessionService.js');
|
|
14
12
|
|
|
15
13
|
/**
|
|
16
14
|
* Maps an InformationFieldKey (journey field) to the corresponding UserInput key.
|
|
@@ -90,34 +88,19 @@ var SignatureElectronic = function (_a) {
|
|
|
90
88
|
var handleContinue = function () {
|
|
91
89
|
setShowSignature(true);
|
|
92
90
|
};
|
|
93
|
-
var handleComplete = function () {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
_a.sent();
|
|
107
|
-
return [3 /*break*/, 4];
|
|
108
|
-
case 3:
|
|
109
|
-
err_1 = _a.sent();
|
|
110
|
-
console.error("[SignatureElectronic] Failed to update session status:", err_1);
|
|
111
|
-
return [3 /*break*/, 4];
|
|
112
|
-
case 4:
|
|
113
|
-
// Toujours montrer le document réellement signé avant de continuer
|
|
114
|
-
// (rassure l'utilisateur — pas de bascule directe vers l'étape suivante).
|
|
115
|
-
setSignedAt(new Date().toISOString());
|
|
116
|
-
setShowSignedDocumentPreview(true);
|
|
117
|
-
return [2 /*return*/];
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}); };
|
|
91
|
+
var handleComplete = function () {
|
|
92
|
+
if (typeof window !== "undefined") {
|
|
93
|
+
window.sessionStorage.removeItem(signatureViewStorageKey);
|
|
94
|
+
}
|
|
95
|
+
// La signature ne modifie PLUS le statut de la session (APP3-1996) : seul le
|
|
96
|
+
// nœud « end » le fait (PATCH `ended`). Poser `conform` ici affichait « Conforme »
|
|
97
|
+
// dans le backoffice, en vert, entre la signature et la fin du parcours, alors
|
|
98
|
+
// que le verdict n'était pas encore rendu.
|
|
99
|
+
// Toujours montrer le document réellement signé avant de continuer
|
|
100
|
+
// (rassure l'utilisateur — pas de bascule directe vers l'étape suivante).
|
|
101
|
+
setSignedAt(new Date().toISOString());
|
|
102
|
+
setShowSignedDocumentPreview(true);
|
|
103
|
+
};
|
|
121
104
|
var handleContinueFromPreview = function () {
|
|
122
105
|
// Progress to the next step via graph edges (pas d'arithmétique — évite de sauter dans la mauvaise branche)
|
|
123
106
|
stepObject.goToNextStep(node.id, session.template);
|
|
@@ -14,6 +14,7 @@ var session = require('../types/session.js');
|
|
|
14
14
|
var useI18n = require('./useI18n.js');
|
|
15
15
|
var auditTrailService = require('../services/auditTrailService.js');
|
|
16
16
|
var sessionService = require('../services/sessionService.js');
|
|
17
|
+
var extractedCopy = require('../utils/extractedCopy.js');
|
|
17
18
|
|
|
18
19
|
var useUserInputForm = function (_a) {
|
|
19
20
|
var stepObject = _a.stepObject, setUserInput = _a.setUserInput, initialUserInput = _a.initialUserInput, node = _a.node, template = _a.template, contactInfo = _a.contactInfo, setContactInfo = _a.setContactInfo, onContinueCallback = _a.onContinueCallback, sessionId = _a.sessionId;
|
|
@@ -324,6 +325,62 @@ var useUserInputForm = function (_a) {
|
|
|
324
325
|
cancelled = true;
|
|
325
326
|
};
|
|
326
327
|
}, []); // Une seule relecture à l'ouverture du nœud.
|
|
328
|
+
// APP3-2142 — même principe pour la collecte de documents : le serveur pré-remplit à la
|
|
329
|
+
// racine les champs de formulaire standard reportés depuis un document (ex. raison sociale
|
|
330
|
+
// du KBIS). On relit la session à l'ouverture si un de ces champs manque en mémoire, et on
|
|
331
|
+
// ne complète que les clés vides.
|
|
332
|
+
React.useEffect(function () {
|
|
333
|
+
var _a;
|
|
334
|
+
if (!sessionId || informationType === "custom")
|
|
335
|
+
return;
|
|
336
|
+
var targets = new Set(((_a = template === null || template === void 0 ? void 0 : template.nodes) !== null && _a !== void 0 ? _a : [])
|
|
337
|
+
.filter(function (n) { return n.type === "document-collection"; })
|
|
338
|
+
.flatMap(function (n) { var _a; return ((_a = n.extractedToUserInput) !== null && _a !== void 0 ? _a : []).map(function (rule) { return extractedCopy.extractedRootTarget(rule.field); }); })
|
|
339
|
+
.filter(function (target) { return !!target; }));
|
|
340
|
+
var missing = tslib_es6.__spreadArray([], targets, true).filter(function (key) { return !(initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput[key]); });
|
|
341
|
+
if (!missing.length)
|
|
342
|
+
return;
|
|
343
|
+
var cancelled = false;
|
|
344
|
+
sessionService.fetchSessionById(sessionId)
|
|
345
|
+
.then(function (fresh) {
|
|
346
|
+
var _a;
|
|
347
|
+
var server = ((_a = fresh === null || fresh === void 0 ? void 0 : fresh.userInput) !== null && _a !== void 0 ? _a : {});
|
|
348
|
+
var fill = missing.filter(function (key) { return typeof server[key] === "string" && server[key]; });
|
|
349
|
+
if (cancelled || !fill.length)
|
|
350
|
+
return;
|
|
351
|
+
setUserInput(function (prev) {
|
|
352
|
+
var next = tslib_es6.__assign({}, prev);
|
|
353
|
+
for (var _i = 0, fill_2 = fill; _i < fill_2.length; _i++) {
|
|
354
|
+
var key = fill_2[_i];
|
|
355
|
+
if (!next[key])
|
|
356
|
+
next[key] = server[key];
|
|
357
|
+
}
|
|
358
|
+
return next;
|
|
359
|
+
});
|
|
360
|
+
setForm(function (prev) {
|
|
361
|
+
var next = tslib_es6.__assign({}, prev);
|
|
362
|
+
for (var _i = 0, fill_3 = fill; _i < fill_3.length; _i++) {
|
|
363
|
+
var key = fill_3[_i];
|
|
364
|
+
if (key === "birthDate") {
|
|
365
|
+
if (!prev.birthDate && !prev.day && !prev.month && !prev.year) {
|
|
366
|
+
next.birthDate = server.birthDate;
|
|
367
|
+
Object.assign(next, userInputForm.parseBirthDate(next.birthDate));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
else if (key in prev && !next[key]) {
|
|
371
|
+
next[key] = server[key];
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return next;
|
|
375
|
+
});
|
|
376
|
+
})
|
|
377
|
+
.catch(function (error) {
|
|
378
|
+
console.warn("[UserInputForm] Champs extraits reportés indisponibles", error);
|
|
379
|
+
});
|
|
380
|
+
return function () {
|
|
381
|
+
cancelled = true;
|
|
382
|
+
};
|
|
383
|
+
}, []); // Une seule relecture à l'ouverture du nœud.
|
|
327
384
|
// Re-synchronise customFormData depuis initialUserInput quand on (ré)affiche un
|
|
328
385
|
// nœud DIFFÉRENT sur une instance réutilisée (retour arrière sans remount).
|
|
329
386
|
// Le champ form standard a déjà son propre effet de re-sync ci-dessus ; le
|
package/dist/cjs/i18n/en.json.js
CHANGED
|
@@ -785,11 +785,21 @@ var id_check = {
|
|
|
785
785
|
alt_verso: "Before taking the verso photo"
|
|
786
786
|
},
|
|
787
787
|
camera: {
|
|
788
|
+
low_resolution: {
|
|
789
|
+
title: "Limited camera resolution",
|
|
790
|
+
body: "Your camera resolution is below HD. The photo may be blurry, but you can continue.",
|
|
791
|
+
tips: "Close other apps using the camera, choose another camera or switch to mobile, and improve the lighting.",
|
|
792
|
+
retry: "Try again"
|
|
793
|
+
},
|
|
788
794
|
error_title: "Camera error",
|
|
789
795
|
retry: "Retry",
|
|
790
796
|
document_detected: "Document detected"
|
|
791
797
|
},
|
|
792
798
|
photo: {
|
|
799
|
+
hint: {
|
|
800
|
+
too_dark: "Too dark, find more light",
|
|
801
|
+
too_bright: "Too much glare, avoid direct light"
|
|
802
|
+
},
|
|
793
803
|
capture_failed: "Capture failed. Please try again.",
|
|
794
804
|
mode_autocapture: "Autocapture enabled",
|
|
795
805
|
mode_manual: "Manual mode",
|
package/dist/cjs/i18n/es.json.js
CHANGED
|
@@ -785,11 +785,21 @@ var id_check = {
|
|
|
785
785
|
alt_verso: "Antes de tomar la foto del reverso"
|
|
786
786
|
},
|
|
787
787
|
camera: {
|
|
788
|
+
low_resolution: {
|
|
789
|
+
title: "Resolución de cámara limitada",
|
|
790
|
+
body: "La resolución de la cámara es inferior a HD. La foto puede salir borrosa, pero puede continuar.",
|
|
791
|
+
tips: "Cierre otras aplicaciones que usen la cámara, elija otra cámara o pase al móvil y mejore la iluminación.",
|
|
792
|
+
retry: "Reintentar"
|
|
793
|
+
},
|
|
788
794
|
error_title: "Error de cámara",
|
|
789
795
|
retry: "Reintentar",
|
|
790
796
|
document_detected: "Documento detectado"
|
|
791
797
|
},
|
|
792
798
|
photo: {
|
|
799
|
+
hint: {
|
|
800
|
+
too_dark: "Demasiado oscuro, busque más luz",
|
|
801
|
+
too_bright: "Demasiados reflejos, evite la luz directa"
|
|
802
|
+
},
|
|
793
803
|
capture_failed: "La captura ha fallado. Inténtalo de nuevo.",
|
|
794
804
|
mode_autocapture: "Captura automática activada",
|
|
795
805
|
mode_manual: "Modo manual",
|
package/dist/cjs/i18n/fr.json.js
CHANGED
|
@@ -785,11 +785,21 @@ var id_check = {
|
|
|
785
785
|
alt_verso: "Avant de prendre la photo du verso"
|
|
786
786
|
},
|
|
787
787
|
camera: {
|
|
788
|
+
low_resolution: {
|
|
789
|
+
title: "Résolution de la caméra limitée",
|
|
790
|
+
body: "La résolution de votre caméra est inférieure à la HD. La photo risque d’être floue, mais vous pouvez continuer.",
|
|
791
|
+
tips: "Fermez les autres applications utilisant la caméra, choisissez une autre caméra ou passez sur mobile, et améliorez l’éclairage.",
|
|
792
|
+
retry: "Réessayer"
|
|
793
|
+
},
|
|
788
794
|
error_title: "Erreur de caméra",
|
|
789
795
|
retry: "Réessayer",
|
|
790
796
|
document_detected: "Document détecté"
|
|
791
797
|
},
|
|
792
798
|
photo: {
|
|
799
|
+
hint: {
|
|
800
|
+
too_dark: "Trop sombre, cherchez plus de lumière",
|
|
801
|
+
too_bright: "Trop de reflets, évitez la lumière directe"
|
|
802
|
+
},
|
|
793
803
|
capture_failed: "La capture a échoué. Veuillez réessayer.",
|
|
794
804
|
mode_autocapture: "Autocapture activée",
|
|
795
805
|
mode_manual: "Mode manuel",
|