datakeen-session-react 1.1.202-dev.1 → 1.1.202-rc.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.
@@ -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, { sessionId: sessionId, nodeId: node.id, onCapture: function (img) { return handlePhotoCapture(img, "recto"); }, automaticCapture: false, maskType: "document" });
311
+ return jsxRuntime.jsx(Photo.default, { 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, { sessionId: sessionId, nodeId: node.id, onCapture: function (img) { return handlePhotoCapture(img, "verso"); }, automaticCapture: false, maskType: "document" });
320
+ return jsxRuntime.jsx(Photo.default, { 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; });
@@ -11,31 +11,27 @@ 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');
16
14
  var useIsMobile = require('../../hooks/useIsMobile.js');
17
15
 
18
16
  var Photo = function (_a) {
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;
17
+ var onCapture = _a.onCapture, _b = _a.automaticCapture, automaticCapture = _b === void 0 ? false : _b, _c = _a.maskType, maskType = _c === void 0 ? "id" : _c;
20
18
  var isMobile = useIsMobile.default(768);
21
19
  var videoRef = React.useRef(null);
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];
20
+ var _d = React.useState(false), isDetecting = _d[0], setIsDetecting = _d[1];
21
+ var _e = React.useState("environment"), facingMode = _e[0], setFacingMode = _e[1];
22
+ var _f = React.useState(null), cameraError = _f[0], setCameraError = _f[1];
23
+ var _g = React.useState(window.matchMedia("(orientation: portrait)").matches), isPortrait = _g[0], setIsPortrait = _g[1];
24
+ var _h = React.useState(false), isCountingDown = _h[0], setIsCountingDown = _h[1];
25
+ var _j = React.useState(0), countdown = _j[0], setCountdown = _j[1];
26
+ var _k = React.useState(false), documentDetected = _k[0], setDocumentDetected = _k[1];
27
+ var _l = React.useState(undefined), qualityHint = _l[0], setQualityHint = _l[1];
28
+ var _m = React.useState(true), isInitializing = _m[0], setIsInitializing = _m[1];
29
+ var _o = React.useState(false), isProcessing = _o[0], setIsProcessing = _o[1];
30
+ var _p = React.useState(null), captureError = _p[0], setCaptureError = _p[1];
31
+ var _q = React.useState(false), showCaptureFlash = _q[0], setShowCaptureFlash = _q[1];
36
32
  var t = useI18n.useI18n().t;
37
- var _t = React.useState(null); _t[0]; var setLastCaptureMeta = _t[1];
38
- var _u = React.useState(null), maskRect = _u[0], setMaskRect = _u[1];
33
+ var _r = React.useState(null); _r[0]; var setLastCaptureMeta = _r[1];
34
+ var _s = React.useState(null), maskRect = _s[0], setMaskRect = _s[1];
39
35
  var countdownIntervalRef = React.useRef(null);
40
36
  var detectionHandlerRef = React.useRef(null);
41
37
  var flashTimeoutRef = React.useRef(null);
@@ -224,13 +220,11 @@ var Photo = function (_a) {
224
220
  React.useEffect(function () {
225
221
  var isCancelled = false;
226
222
  var initCamera = function () { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
227
- var result, belowHd;
228
- var _a, _b, _c, _d;
229
- return tslib_es6.__generator(this, function (_e) {
230
- switch (_e.label) {
223
+ var result;
224
+ return tslib_es6.__generator(this, function (_a) {
225
+ switch (_a.label) {
231
226
  case 0:
232
227
  setCameraError(null);
233
- setLowResolution(false);
234
228
  setIsInitializing(true);
235
229
  return [4 /*yield*/, cameraService.cameraService.startCamera(videoRef.current, {
236
230
  facingMode: facingMode,
@@ -238,25 +232,11 @@ var Photo = function (_a) {
238
232
  preferImageCapture: true,
239
233
  })];
240
234
  case 1:
241
- result = _e.sent();
235
+ result = _a.sent();
242
236
  if (isCancelled)
243
237
  return [2 /*return*/];
244
238
  setIsInitializing(false);
245
239
  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
- }
260
240
  setLastCaptureMeta(null);
261
241
  // Detection also runs in manual mode: it only drives the visual
262
242
  // feedback on the mask (documentDetected), it never starts the
@@ -284,7 +264,7 @@ var Photo = function (_a) {
284
264
  flashTimeoutRef.current = null;
285
265
  }
286
266
  };
287
- }, [facingMode, cameraAttempt, sessionId, nodeId, clearCountdown, stopDetection]);
267
+ }, [facingMode, clearCountdown, stopDetection]);
288
268
  React.useEffect(function () {
289
269
  if (!isDetecting || !videoRef.current) {
290
270
  return;
@@ -327,7 +307,21 @@ var Photo = function (_a) {
327
307
  setIsInitializing(true);
328
308
  stopDetection();
329
309
  cameraService.cameraService.stopCamera();
330
- setCameraAttempt(function (attempt) { return attempt + 1; });
310
+ cameraService.cameraService
311
+ .startCamera(videoRef.current, {
312
+ facingMode: facingMode,
313
+ idealResolution: { width: 4096, height: 3072 },
314
+ preferImageCapture: true,
315
+ })
316
+ .then(function (result) {
317
+ setIsInitializing(false);
318
+ if (result.success) {
319
+ setIsDetecting(true);
320
+ }
321
+ else if (result.error) {
322
+ setCameraError(result.error);
323
+ }
324
+ });
331
325
  };
332
326
  var handleManualCapture = function () {
333
327
  if (isProcessing) {
@@ -351,7 +345,7 @@ var Photo = function (_a) {
351
345
  zIndex: isMobile ? 50 : "auto",
352
346
  height: "100%",
353
347
  width: "100%",
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
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
355
349
  ? "bg-[#11E5C5] animate-pulse"
356
350
  : "bg-orange-500") }), jsxRuntime.jsx("span", { children: statusMessage })] }), captureError && (jsxRuntime.jsx("p", { className: "text-red-400 text-xs mt-2 text-center", children: captureError }))] })] }) })] }));
357
351
  };
@@ -139,7 +139,6 @@ 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"),
143
142
  t("jdi.document_selection.instructions.idCard.readable"),
144
143
  t("jdi.document_selection.instructions.idCard.valid"),
145
144
  ];
@@ -152,7 +151,6 @@ var JDIDocumentSelection = function (_a) {
152
151
  case "driverLicense":
153
152
  return [
154
153
  t("jdi.document_selection.instructions.driverLicense.recto_verso"),
155
- t("jdi.document_selection.instructions.two_sided_files"),
156
154
  t("jdi.document_selection.instructions.driverLicense.not_expired"),
157
155
  t("jdi.document_selection.instructions.driverLicense.all_visible"),
158
156
  ];
@@ -165,7 +163,6 @@ var JDIDocumentSelection = function (_a) {
165
163
  case "residencePermit":
166
164
  return [
167
165
  t("jdi.document_selection.instructions.residencePermit.recto_verso"),
168
- t("jdi.document_selection.instructions.two_sided_files"),
169
166
  t("jdi.document_selection.instructions.residencePermit.valid"),
170
167
  t("jdi.document_selection.instructions.residencePermit.readable"),
171
168
  ];
@@ -15,11 +15,8 @@ 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; var title = _a.title, description = _a.description;
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;
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; });
23
20
  // Helper functions for conditional text
24
21
  var getDropZoneText = function () {
25
22
  return t("jdi.document_upload.drop_zone", {
@@ -465,7 +462,7 @@ var JDIDocumentUpload = function (_a) {
465
462
  }
466
463
  });
467
464
  }); };
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
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
469
466
  ? "border-teal-500 bg-teal-100/50"
470
467
  : "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
471
468
  ? frontPreview
@@ -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, _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;
78
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
79
+ var stepObject = _a.stepObject, sessionId = _a.sessionId, node = _a.node, documentTypeId = _a.documentTypeId, acceptedCountries = _a.acceptedCountries, _p = _a.isMobileCapture, isMobileCapture = _p === void 0 ? false : _p, allowedAddingMethods = _a.allowedAddingMethods, template = _a.template, setUserInput = _a.setUserInput;
80
80
  var t = useI18n.useI18n().t;
81
81
  var session = SessionContext.getSession().session;
82
- var _s = React.useState(), documentTemplates = _s[0], setDocumentTemplates = _s[1];
83
- var _t = React.useState(true), loadingTemplates = _t[0], setLoadingTemplates = _t[1];
82
+ var _q = React.useState(), documentTemplates = _q[0], setDocumentTemplates = _q[1];
83
+ var _r = React.useState(true), loadingTemplates = _r[0], setLoadingTemplates = _r[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 _u = React.useState(null), selectedMethod = _u[0], setSelectedMethod = _u[1];
102
+ var _s = React.useState(null), selectedMethod = _s[0], setSelectedMethod = _s[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 _v = React.useState(function () {
121
+ var _t = 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 = _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];
126
+ }), docStep = _t[0], setDocStep = _t[1];
127
+ var _u = React.useState(((_e = (_d = acceptedCountries === null || acceptedCountries === void 0 ? void 0 : acceptedCountries[0]) === null || _d === void 0 ? void 0 : _d.code) === null || _e === void 0 ? void 0 : _e.toUpperCase()) || "FR"), selectedCountry = _u[0], setSelectedCountry = _u[1];
128
+ var _v = React.useState(null), fileUploaded = _v[0], setFileUploaded = _v[1];
129
+ var _w = React.useState(null), analysisData = _w[0], setAnalysisData = _w[1];
130
+ var _x = React.useState(null), errorCode = _x[0], setErrorCode = _x[1];
131
+ var _y = React.useState(false), blockContinue = _y[0], setBlockContinue = _y[1];
132
+ var _z = React.useState(null), nfcPreparationError = _z[0], setNfcPreparationError = _z[1];
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 _2 = React.useState(false), nfcSkipped = _2[0], setNfcSkipped = _2[1];
135
+ var _0 = React.useState(false), nfcSkipped = _0[0], setNfcSkipped = _0[1];
136
136
  // Initialize retry count from session data
137
- var _3 = React.useState(function () {
137
+ var _1 = React.useState(function () {
138
138
  return retryService.getNodeRetryCount(session, node.id);
139
- }), retryCount = _3[0], setRetryCount = _3[1];
139
+ }), retryCount = _1[0], setRetryCount = _1[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 _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;
234
+ var _2 = React.useState({}), capturedImages = _2[0], setCapturedImages = _2[1];
235
+ var _3 = React.useState("before-recto"), currentPhotoStep = _3[0], setCurrentPhotoStep = _3[1];
236
+ var _4 = React.useState("photo"), videoFlowPhase = _4[0], setVideoFlowPhase = _4[1];
237
+ var _5 = DocumentContext.useDocumentContext(), selectedDocumentType = _5.selectedDocumentType, setSelectedDocumentType = _5.setSelectedDocumentType;
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, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }));
767
+ return (jsxRuntime.jsx(Photo.default, { 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, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }));
773
+ return (jsxRuntime.jsx(Photo.default, { 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, { 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 () {
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 () {
782
782
  if (isPictureAllowed && isDownloadAllowed) {
783
783
  setSelectedMethod(null);
784
784
  }
@@ -502,7 +502,6 @@ var jdi = {
502
502
  error_select_document: "Please select a document type",
503
503
  info_title: "Important information",
504
504
  instructions: {
505
- two_sided_files: "• Ensure both sides of the document (front and back) are included, either in a single file or in two separate files.",
506
505
  jdd: {
507
506
  recent: "• The document must be recent (less than 3 months old).",
508
507
  name_address_visible: "• Your name and address must be clearly visible.",
@@ -785,21 +784,11 @@ var id_check = {
785
784
  alt_verso: "Before taking the verso photo"
786
785
  },
787
786
  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
- },
794
787
  error_title: "Camera error",
795
788
  retry: "Retry",
796
789
  document_detected: "Document detected"
797
790
  },
798
791
  photo: {
799
- hint: {
800
- too_dark: "Too dark, find more light",
801
- too_bright: "Too much glare, avoid direct light"
802
- },
803
792
  capture_failed: "Capture failed. Please try again.",
804
793
  mode_autocapture: "Autocapture enabled",
805
794
  mode_manual: "Manual mode",
@@ -502,7 +502,6 @@ var jdi = {
502
502
  error_select_document: "Selecciona un tipo de documento",
503
503
  info_title: "Información importante",
504
504
  instructions: {
505
- two_sided_files: "• Asegúrese de que ambas caras del documento (anverso y reverso) estén presentes, en un mismo archivo o en dos archivos distintos.",
506
505
  jdd: {
507
506
  recent: "• El documento debe ser reciente (menos de 3 meses).",
508
507
  name_address_visible: "• Tu nombre y dirección deben verse claramente.",
@@ -785,21 +784,11 @@ var id_check = {
785
784
  alt_verso: "Antes de tomar la foto del reverso"
786
785
  },
787
786
  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
- },
794
787
  error_title: "Error de cámara",
795
788
  retry: "Reintentar",
796
789
  document_detected: "Documento detectado"
797
790
  },
798
791
  photo: {
799
- hint: {
800
- too_dark: "Demasiado oscuro, busque más luz",
801
- too_bright: "Demasiados reflejos, evite la luz directa"
802
- },
803
792
  capture_failed: "La captura ha fallado. Inténtalo de nuevo.",
804
793
  mode_autocapture: "Captura automática activada",
805
794
  mode_manual: "Modo manual",
@@ -502,7 +502,6 @@ var jdi = {
502
502
  error_select_document: "Veuillez sélectionner un type de document",
503
503
  info_title: "Information importante",
504
504
  instructions: {
505
- two_sided_files: "• Assurez-vous que les deux faces du document (recto et verso) sont présentes, dans un même fichier ou dans deux fichiers distincts.",
506
505
  jdd: {
507
506
  recent: "• Le document doit être récent (moins de 3 mois).",
508
507
  name_address_visible: "• Votre nom et adresse doivent être clairement visibles.",
@@ -785,21 +784,11 @@ var id_check = {
785
784
  alt_verso: "Avant de prendre la photo du verso"
786
785
  },
787
786
  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
- },
794
787
  error_title: "Erreur de caméra",
795
788
  retry: "Réessayer",
796
789
  document_detected: "Document détecté"
797
790
  },
798
791
  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
- },
803
792
  capture_failed: "La capture a échoué. Veuillez réessayer.",
804
793
  mode_autocapture: "Autocapture activée",
805
794
  mode_manual: "Mode manuel",