datakeen-session-react 1.1.202-dev.16 → 1.1.202-dev.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/cjs/components/DatakeenSession.js +17 -16
  2. package/dist/cjs/components/card-capture-guide/CardCaptureGuide.js +139 -0
  3. package/dist/cjs/components/card-capture-guide/captureTelemetry.js +81 -0
  4. package/dist/cjs/components/card-capture-guide/guidance.js +48 -0
  5. package/dist/cjs/components/card-capture-guide/guideCore.js +389 -0
  6. package/dist/cjs/components/card-capture-guide/guideRuntime.js +118 -0
  7. package/dist/cjs/components/card-capture-guide/modelLoader.js +46 -0
  8. package/dist/cjs/components/card-capture-guide/useCaptureGuideThresholds.js +33 -0
  9. package/dist/cjs/components/card-capture-guide/useCardCaptureGuide.js +117 -0
  10. package/dist/cjs/components/card-capture-guide/useMinDisplay.js +30 -0
  11. package/dist/cjs/components/document-collection/DocumentCollection.js +9 -0
  12. package/dist/cjs/components/id-check/Photo.js +230 -122
  13. package/dist/cjs/components/id-check/card-capture/CardCapture.js +270 -0
  14. package/dist/cjs/components/id-check/card-capture/DynamicCardMask.js +85 -0
  15. package/dist/cjs/components/id-check/card-capture/geometry.js +119 -0
  16. package/dist/cjs/components/id-check/card-capture/guideTone.js +15 -0
  17. package/dist/cjs/components/jdi/JDIDocumentSelection.js +9 -0
  18. package/dist/cjs/components/selfie/Video.js +2 -2
  19. package/dist/cjs/components/selfie/selfie-flow/SelfieFlow.js +4 -2
  20. package/dist/cjs/components/session/DocumentCheck.js +37 -2
  21. package/dist/cjs/components/session/EndFlow.js +4 -0
  22. package/dist/cjs/components/session/Selfie.js +1 -1
  23. package/dist/cjs/components/signature-electronic/SignatureElectronic.js +9 -2
  24. package/dist/cjs/components/start-flow/Start.js +4 -0
  25. package/dist/cjs/components/template/TemplateNodeRenderer.js +3 -1
  26. package/dist/cjs/components/ui/Button.js +3 -3
  27. package/dist/cjs/context/CardCaptureGuideContext.js +16 -0
  28. package/dist/cjs/hooks/useClientInfo.js +7 -0
  29. package/dist/cjs/hooks/useUserInputForm.js +3 -1
  30. package/dist/cjs/i18n/en.json.js +57 -1
  31. package/dist/cjs/i18n/es.json.js +57 -1
  32. package/dist/cjs/i18n/fr.json.js +57 -1
  33. package/dist/cjs/index.css.js +1 -1
  34. package/dist/cjs/index.js +15 -0
  35. package/dist/cjs/preview/DatakeenJourneyPreview.js +257 -0
  36. package/dist/cjs/preview/PreviewAutomaticStep.js +23 -0
  37. package/dist/cjs/preview/PreviewBranchPicker.js +54 -0
  38. package/dist/cjs/preview/PreviewCaptureDisabled.js +19 -0
  39. package/dist/cjs/preview/previewAdapter.js +27 -0
  40. package/dist/cjs/preview/previewMode.js +21 -0
  41. package/dist/cjs/preview/previewNavigation.js +105 -0
  42. package/dist/cjs/services/api.js +5 -0
  43. package/dist/cjs/services/cameraService.js +6 -0
  44. package/dist/cjs/services/realtime/sseClient.js +4 -0
  45. package/dist/cjs/services/sessionService.js +50 -0
  46. package/dist/cjs/utils/cssLoader.js +6 -4
  47. package/dist/cjs/utils/isMobileDevice.js +8 -0
  48. package/dist/esm/components/DatakeenSession.js +17 -16
  49. package/dist/esm/components/card-capture-guide/CardCaptureGuide.js +135 -0
  50. package/dist/esm/components/card-capture-guide/captureTelemetry.js +78 -0
  51. package/dist/esm/components/card-capture-guide/guidance.js +44 -0
  52. package/dist/esm/components/card-capture-guide/guideCore.js +372 -0
  53. package/dist/esm/components/card-capture-guide/guideRuntime.js +115 -0
  54. package/dist/esm/components/card-capture-guide/modelLoader.js +42 -0
  55. package/dist/esm/components/card-capture-guide/useCaptureGuideThresholds.js +31 -0
  56. package/dist/esm/components/card-capture-guide/useCardCaptureGuide.js +115 -0
  57. package/dist/esm/components/card-capture-guide/useMinDisplay.js +28 -0
  58. package/dist/esm/components/document-collection/DocumentCollection.js +10 -1
  59. package/dist/esm/components/id-check/Photo.js +232 -124
  60. package/dist/esm/components/id-check/card-capture/CardCapture.js +266 -0
  61. package/dist/esm/components/id-check/card-capture/DynamicCardMask.js +81 -0
  62. package/dist/esm/components/id-check/card-capture/geometry.js +110 -0
  63. package/dist/esm/components/id-check/card-capture/guideTone.js +13 -0
  64. package/dist/esm/components/jdi/JDIDocumentSelection.js +9 -0
  65. package/dist/esm/components/selfie/Video.js +2 -2
  66. package/dist/esm/components/selfie/selfie-flow/SelfieFlow.js +4 -2
  67. package/dist/esm/components/session/DocumentCheck.js +37 -2
  68. package/dist/esm/components/session/EndFlow.js +4 -0
  69. package/dist/esm/components/session/Selfie.js +1 -1
  70. package/dist/esm/components/signature-electronic/SignatureElectronic.js +9 -2
  71. package/dist/esm/components/start-flow/Start.js +4 -0
  72. package/dist/esm/components/template/TemplateNodeRenderer.js +3 -1
  73. package/dist/esm/components/ui/Button.js +3 -3
  74. package/dist/esm/context/CardCaptureGuideContext.js +13 -0
  75. package/dist/esm/hooks/useClientInfo.js +7 -0
  76. package/dist/esm/hooks/useUserInputForm.js +3 -1
  77. package/dist/esm/i18n/en.json.js +55 -2
  78. package/dist/esm/i18n/es.json.js +55 -2
  79. package/dist/esm/i18n/fr.json.js +55 -2
  80. package/dist/esm/index.css.js +1 -1
  81. package/dist/esm/index.js +6 -0
  82. package/dist/esm/preview/DatakeenJourneyPreview.js +253 -0
  83. package/dist/esm/preview/PreviewAutomaticStep.js +19 -0
  84. package/dist/esm/preview/PreviewBranchPicker.js +48 -0
  85. package/dist/esm/preview/PreviewCaptureDisabled.js +15 -0
  86. package/dist/esm/preview/previewAdapter.js +25 -0
  87. package/dist/esm/preview/previewMode.js +15 -0
  88. package/dist/esm/preview/previewNavigation.js +98 -0
  89. package/dist/esm/services/api.js +5 -0
  90. package/dist/esm/services/cameraService.js +6 -0
  91. package/dist/esm/services/realtime/sseClient.js +4 -0
  92. package/dist/esm/services/sessionService.js +49 -1
  93. package/dist/esm/utils/cssLoader.js +6 -4
  94. package/dist/esm/utils/isMobileDevice.js +8 -0
  95. package/dist/types/components/card-capture-guide/CardCaptureGuide.d.ts +46 -0
  96. package/dist/types/components/card-capture-guide/guidance.d.ts +45 -0
  97. package/dist/types/components/card-capture-guide/guideCore.d.ts +96 -0
  98. package/dist/types/components/card-capture-guide/guideRuntime.d.ts +13 -0
  99. package/dist/types/components/card-capture-guide/modelLoader.d.ts +13 -0
  100. package/dist/types/components/card-capture-guide/useCardCaptureGuide.d.ts +38 -0
  101. package/dist/types/index.d.ts +8 -0
  102. package/dist/types/preview/DatakeenJourneyPreview.d.ts +6 -0
  103. package/dist/types/preview/types.d.ts +77 -0
  104. package/dist/types/services/documentTemplate.d.ts +13 -0
  105. package/dist/types/types/camera.d.ts +3 -0
  106. package/dist/types/types/session.d.ts +268 -1
  107. package/dist/types/utils/cssLoader.d.ts +0 -4
  108. package/package.json +2 -1
@@ -0,0 +1,270 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
8
+ var lucideReact = require('lucide-react');
9
+ var cameraService = require('../../../services/cameraService.js');
10
+ var sessionService = require('../../../services/sessionService.js');
11
+ var useI18n = require('../../../hooks/useI18n.js');
12
+ var useIsMobile = require('../../../hooks/useIsMobile.js');
13
+ var cameraResolution = require('../../../utils/cameraResolution.js');
14
+ var useCardCaptureGuide = require('../../card-capture-guide/useCardCaptureGuide.js');
15
+ var useMinDisplay = require('../../card-capture-guide/useMinDisplay.js');
16
+ var captureTelemetry = require('../../card-capture-guide/captureTelemetry.js');
17
+ var CameraError = require('../CameraError.js');
18
+ var DynamicCardMask = require('./DynamicCardMask.js');
19
+ var guideTone = require('./guideTone.js');
20
+ var geometry = require('./geometry.js');
21
+
22
+ // FR fallbacks, same as fr.json
23
+ var GUIDE_FALLBACK = {
24
+ no_card: "Placez votre pièce d'identité dans le cadre",
25
+ too_far: "Rapprochez la carte",
26
+ too_dark: "Augmenter la luminosité",
27
+ card_detected: "Carte détectée — gardez-la dans le cadre",
28
+ hold_still: "Ne bougez plus…",
29
+ too_blurry: "Ajuster la focalisation",
30
+ bright_spot: "Éviter les reflets",
31
+ ready: "Parfait — capture en cours",
32
+ };
33
+ var PILL_CLASS = {
34
+ loading: "bg-black/70 text-white",
35
+ neutral: "bg-black/70 text-white",
36
+ warning: "bg-amber-100 text-amber-900",
37
+ progress: "bg-teal-50 text-teal-900",
38
+ success: "bg-teal-50 text-teal-900",
39
+ };
40
+ var MESSAGE_MIN_MS = 700;
41
+ var NUDGE_AFTER_MS = 8000;
42
+ var FLASH_MS = 150;
43
+ /** The spinner stays at least this long, even when the capture is instant: no flicker, the user sees it saved. */
44
+ var MIN_SAVING_MS = 1000;
45
+ /** Success check shown before leaving the screen. */
46
+ var SAVED_CONFIRM_MS = 400;
47
+ var VIBRATION_MS = 60;
48
+ var DEFAULT_HOLD_MS = 600;
49
+ var RING_RADIUS = 33;
50
+ var RING_LENGTH = 2 * Math.PI * RING_RADIUS;
51
+ var ToneIcon = function (_a) {
52
+ var tone = _a.tone;
53
+ var props = { className: "h-4 w-4 shrink-0", "aria-hidden": true };
54
+ if (tone === "loading")
55
+ return jsxRuntime.jsx(lucideReact.LoaderCircle, tslib_es6.__assign({}, props, { className: "h-4 w-4 shrink-0 motion-safe:animate-spin" }));
56
+ if (tone === "warning")
57
+ return jsxRuntime.jsx(lucideReact.TriangleAlert, tslib_es6.__assign({}, props));
58
+ if (tone === "progress")
59
+ return jsxRuntime.jsx(lucideReact.Hand, tslib_es6.__assign({}, props));
60
+ if (tone === "success")
61
+ return jsxRuntime.jsx(lucideReact.Check, tslib_es6.__assign({}, props));
62
+ return jsxRuntime.jsx(lucideReact.Info, tslib_es6.__assign({}, props));
63
+ };
64
+ /**
65
+ * Live capture of a card-format identity document (APP3-2117): the mask follows the card detected by the
66
+ * on-device model, one guidance message at a time, automatic capture cropped to the card, manual capture
67
+ * always available, static ID-1 frame when the model is loading or unavailable.
68
+ */
69
+ var CardCapture = function (_a) {
70
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
71
+ var onCapture = _a.onCapture, sessionId = _a.sessionId, nodeId = _a.nodeId, _l = _a.captureSide, captureSide = _l === void 0 ? "recto" : _l, documentType = _a.documentType, guide = _a.guide;
72
+ var t = useI18n.useI18n().t;
73
+ var isMobile = useIsMobile.default(768);
74
+ var videoRef = React.useRef(null);
75
+ var boxRef = React.useRef(null);
76
+ var _m = React.useState("environment"), facingMode = _m[0], setFacingMode = _m[1];
77
+ var _o = React.useState(0), cameraAttempt = _o[0], setCameraAttempt = _o[1];
78
+ var _p = React.useState(false), cameraReady = _p[0], setCameraReady = _p[1];
79
+ var _q = React.useState(null), cameraError = _q[0], setCameraError = _q[1];
80
+ var _r = React.useState(false), lowResolution = _r[0], setLowResolution = _r[1];
81
+ var _s = React.useState(false), isProcessing = _s[0], setIsProcessing = _s[1];
82
+ var _t = React.useState(null), captureError = _t[0], setCaptureError = _t[1];
83
+ var _u = React.useState(false), showFlash = _u[0], setShowFlash = _u[1];
84
+ var _v = React.useState(false), showNudge = _v[0], setShowNudge = _v[1];
85
+ /** null = live camera; "saving" = frozen frame + spinner; "saved" = frozen frame + check. */
86
+ var _w = React.useState(null), savePhase = _w[0], setSavePhase = _w[1];
87
+ var _x = React.useState(null), frozenCorners = _x[0], setFrozenCorners = _x[1];
88
+ var frozenRef = React.useRef(null);
89
+ var mountedRef = React.useRef(true);
90
+ React.useEffect(function () {
91
+ mountedRef.current = true;
92
+ return function () {
93
+ mountedRef.current = false;
94
+ };
95
+ }, []);
96
+ var processingRef = React.useRef(false);
97
+ var autoFiredRef = React.useRef(false);
98
+ var telemetryRef = React.useRef(null);
99
+ React.useEffect(function () {
100
+ var cancelled = false;
101
+ setCameraReady(false);
102
+ setCameraError(null);
103
+ cameraService.cameraService
104
+ .startCamera(videoRef.current, { facingMode: facingMode, idealResolution: { width: 4096, height: 3072 }, preferImageCapture: true })
105
+ .then(function (result) {
106
+ var _a, _b, _c, _d, _e;
107
+ if (cancelled)
108
+ return;
109
+ if (!result.success) {
110
+ setCameraError((_a = result.error) !== null && _a !== void 0 ? _a : t("id_check.camera.error", "Impossible de démarrer la caméra"));
111
+ return;
112
+ }
113
+ var belowHd = cameraResolution.isBelowHd(result.settings);
114
+ setLowResolution(belowHd);
115
+ if (sessionId && nodeId) {
116
+ sessionService.reportCaptureDiagnostics(sessionId, nodeId, {
117
+ requested: result.requested,
118
+ obtained: { w: (_b = result.settings) === null || _b === void 0 ? void 0 : _b.width, h: (_c = result.settings) === null || _c === void 0 ? void 0 : _c.height, frameRate: (_d = result.settings) === null || _d === void 0 ? void 0 : _d.frameRate },
119
+ retriedWithHd: (_e = result.retriedWithHd) !== null && _e !== void 0 ? _e : false,
120
+ devicePixelRatio: window.devicePixelRatio,
121
+ cameraLabel: result.label,
122
+ lowResolutionWarningShown: belowHd,
123
+ facingMode: facingMode,
124
+ at: new Date().toISOString(),
125
+ }).catch(function () { });
126
+ if (!telemetryRef.current) {
127
+ telemetryRef.current = new captureTelemetry.CaptureTelemetryCollector({
128
+ nodeId: nodeId,
129
+ side: captureSide,
130
+ documentType: documentType,
131
+ deviceType: captureTelemetry.detectDeviceType(),
132
+ startedAt: performance.now(),
133
+ });
134
+ }
135
+ }
136
+ setCameraReady(true);
137
+ })
138
+ .catch(function () {
139
+ if (!cancelled)
140
+ setCameraError(t("id_check.camera.error", "Impossible de démarrer la caméra"));
141
+ });
142
+ return function () {
143
+ cancelled = true;
144
+ cameraService.cameraService.stopCamera();
145
+ };
146
+ // The camera restarts only when the user switches camera or retries.
147
+ // eslint-disable-next-line react-hooks/exhaustive-deps
148
+ }, [facingMode, cameraAttempt]);
149
+ React.useEffect(function () {
150
+ if (!cameraReady || isProcessing)
151
+ return;
152
+ var timer = setTimeout(function () { return setShowNudge(true); }, NUDGE_AFTER_MS);
153
+ return function () { return clearTimeout(timer); };
154
+ }, [cameraReady, isProcessing]);
155
+ var captureRef = React.useRef(function () { });
156
+ var guideState = useCardCaptureGuide.useCardCaptureGuide(videoRef, {
157
+ modelUrl: guide === null || guide === void 0 ? void 0 : guide.modelUrl,
158
+ wasmPaths: guide === null || guide === void 0 ? void 0 : guide.wasmPaths,
159
+ tracker: guide === null || guide === void 0 ? void 0 : guide.tracker,
160
+ enabled: cameraReady && !isProcessing,
161
+ onReady: function (update) {
162
+ if (autoFiredRef.current)
163
+ return;
164
+ autoFiredRef.current = true;
165
+ if (typeof navigator.vibrate === "function")
166
+ navigator.vibrate(VIBRATION_MS);
167
+ captureRef.current("auto", update.corners);
168
+ },
169
+ onGuidance: function (event) { var _a; return (_a = telemetryRef.current) === null || _a === void 0 ? void 0 : _a.guidance(event.code, performance.now()); },
170
+ onTiming: function (_a) {
171
+ var _b, _c;
172
+ var kind = _a.kind, ms = _a.ms;
173
+ if (kind === "load")
174
+ (_b = telemetryRef.current) === null || _b === void 0 ? void 0 : _b.modelLoaded(ms);
175
+ else
176
+ (_c = telemetryRef.current) === null || _c === void 0 ? void 0 : _c.inference(ms);
177
+ },
178
+ });
179
+ var guideFailed = !!guideState.error;
180
+ var guideActive = guideState.modelReady && !guideFailed;
181
+ var event = guideActive ? guideState.event : null;
182
+ var shownCode = useMinDisplay.useMinDisplay((_b = event === null || event === void 0 ? void 0 : event.code) !== null && _b !== void 0 ? _b : "no_card", MESSAGE_MIN_MS);
183
+ var trackedCorners = (_c = event === null || event === void 0 ? void 0 : event.corners) !== null && _c !== void 0 ? _c : null;
184
+ var tone = guideActive ? guideTone.guideTone(shownCode) : "neutral";
185
+ var holding = (event === null || event === void 0 ? void 0 : event.code) === "hold_still";
186
+ var holdMs = (_e = (_d = guide === null || guide === void 0 ? void 0 : guide.tracker) === null || _d === void 0 ? void 0 : _d.holdMs) !== null && _e !== void 0 ? _e : DEFAULT_HOLD_MS;
187
+ var staticFrameCrop = function () {
188
+ var video = videoRef.current;
189
+ var box = boxRef.current;
190
+ if (!video || !box)
191
+ return null;
192
+ var boxWidth = box.clientWidth;
193
+ var boxHeight = box.clientHeight;
194
+ return geometry.viewportRectToVideo(geometry.idCardFrameRect(boxWidth, boxHeight), {
195
+ videoWidth: video.videoWidth,
196
+ videoHeight: video.videoHeight,
197
+ boxWidth: boxWidth,
198
+ boxHeight: boxHeight,
199
+ mirrored: facingMode === "user",
200
+ });
201
+ };
202
+ captureRef.current = function (trigger, corners) {
203
+ var _a, _b;
204
+ var video = videoRef.current;
205
+ if (processingRef.current || !video || !video.videoWidth || !video.videoHeight)
206
+ return;
207
+ processingRef.current = true;
208
+ // Freeze what the user saw at the shutter (synchronous: before any await), the card stays highlighted.
209
+ var frozen = frozenRef.current;
210
+ if (frozen) {
211
+ frozen.width = video.videoWidth;
212
+ frozen.height = video.videoHeight;
213
+ (_a = frozen.getContext("2d")) === null || _a === void 0 ? void 0 : _a.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
214
+ }
215
+ setFrozenCorners(corners);
216
+ setSavePhase("saving");
217
+ setIsProcessing(true);
218
+ setCaptureError(null);
219
+ setShowFlash(true);
220
+ window.setTimeout(function () { return setShowFlash(false); }, FLASH_MS);
221
+ var crop = (_b = (corners ? geometry.cropRectFromCorners(corners, video.videoWidth, video.videoHeight) : null)) !== null && _b !== void 0 ? _b : staticFrameCrop();
222
+ var minimumWait = new Promise(function (resolve) { return window.setTimeout(resolve, MIN_SAVING_MS); });
223
+ Promise.all([
224
+ cameraService.cameraService.captureDocument(video, crop, { facingMode: facingMode, format: "jpeg", jpegQuality: 0.95, preferImageCapture: false }),
225
+ minimumWait,
226
+ ])
227
+ .then(function (_a) {
228
+ var result = _a[0];
229
+ if (!mountedRef.current)
230
+ return;
231
+ var collector = telemetryRef.current;
232
+ telemetryRef.current = null;
233
+ if (collector && sessionId) {
234
+ var payload = collector.build({ trigger: trigger, guideStatus: guideFailed ? "fallback" : "active", at: performance.now() });
235
+ sessionService.reportCaptureTelemetry(sessionId, payload).catch(function () { });
236
+ }
237
+ setSavePhase("saved");
238
+ window.setTimeout(function () {
239
+ if (mountedRef.current)
240
+ onCapture(result.dataUrl);
241
+ }, SAVED_CONFIRM_MS);
242
+ })
243
+ .catch(function () {
244
+ if (!mountedRef.current)
245
+ return;
246
+ processingRef.current = false;
247
+ autoFiredRef.current = false;
248
+ setIsProcessing(false);
249
+ setSavePhase(null);
250
+ setFrozenCorners(null);
251
+ setCaptureError(t("id_check.photo.capture_failed", "La capture a échoué. Veuillez réessayer."));
252
+ });
253
+ };
254
+ var handleManualCapture = React.useCallback(function () {
255
+ captureRef.current("manual", trackedCorners);
256
+ }, [trackedCorners]);
257
+ var statusTone = guideFailed ? "neutral" : guideActive ? tone : "loading";
258
+ var statusMessage = guideFailed
259
+ ? t("card_capture.fallback", "Placez la carte dans le cadre puis appuyez sur le bouton")
260
+ : guideActive
261
+ ? t("card_capture_guide.".concat(shownCode), GUIDE_FALLBACK[shownCode])
262
+ : t("card_capture_guide.loading", "Chargement du guide…");
263
+ var sideLabel = captureSide === "verso" ? t("card_capture.side.verso", "Verso") : t("card_capture.side.recto", "Recto");
264
+ var shutterLabel = t("card_capture.shutter", "Prendre la photo");
265
+ return (jsxRuntime.jsxs("div", { className: "flex flex-col bg-black ".concat(isMobile ? "fixed inset-0 z-50" : "relative h-full w-full"), children: [jsxRuntime.jsx("div", { ref: boxRef, className: "relative flex-1 overflow-hidden bg-black", children: cameraError ? (jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center px-4 py-6", children: jsxRuntime.jsx(CameraError.default, { errorMessage: cameraError, onRetry: function () { return setCameraAttempt(function (n) { return n + 1; }); } }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("video", { ref: videoRef, autoPlay: true, playsInline: true, muted: true, className: "absolute inset-0 h-full w-full object-cover ".concat(facingMode === "user" ? "scale-x-[-1]" : "") }), jsxRuntime.jsx("canvas", { ref: frozenRef, "data-testid": "frozen-frame", hidden: !savePhase, "aria-hidden": "true", className: "absolute inset-0 h-full w-full object-cover ".concat(facingMode === "user" ? "scale-x-[-1]" : "") }), jsxRuntime.jsx(DynamicCardMask.default, { corners: savePhase ? frozenCorners : trackedCorners, videoWidth: (_g = (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.videoWidth) !== null && _g !== void 0 ? _g : 0, videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0, mirrored: facingMode === "user", tone: savePhase ? "success" : tone }), jsxRuntime.jsxs("div", { className: "absolute inset-x-0 top-0 z-20 flex items-center justify-between px-4 pt-[max(env(safe-area-inset-top),16px)]", children: [jsxRuntime.jsx("span", { className: "rounded-full bg-black/60 px-3 py-1.5 text-sm font-medium text-white", children: sideLabel }), jsxRuntime.jsx("button", { type: "button", onClick: function () { return setFacingMode(function (m) { return (m === "environment" ? "user" : "environment"); }); }, "aria-label": t("card_capture.switch_camera", "Changer de caméra"), className: "flex h-11 w-11 cursor-pointer items-center justify-center rounded-full bg-black/60 text-white transition-transform active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-white", children: jsxRuntime.jsx(lucideReact.SwitchCamera, { className: "h-5 w-5", "aria-hidden": "true" }) })] }), savePhase ? null : (jsxRuntime.jsx("div", { className: "absolute inset-x-0 top-[calc(max(env(safe-area-inset-top),16px)+56px)] z-20 flex justify-center px-4", children: jsxRuntime.jsxs("p", { role: "status", "aria-live": "polite", "aria-atomic": "true", className: "flex max-w-md items-center gap-2 rounded-full px-4 py-2 text-sm font-medium shadow-sm transition-colors duration-200 ".concat(PILL_CLASS[statusTone]), children: [jsxRuntime.jsx(ToneIcon, { tone: statusTone }), jsxRuntime.jsx("span", { children: statusMessage })] }) })), lowResolution ? (jsxRuntime.jsx("div", { className: "absolute inset-x-4 bottom-36 z-20 rounded-xl bg-black/75 px-3 py-2 text-sm text-white", children: t("id_check.camera.low_resolution.title") })) : null, !cameraReady ? (jsxRuntime.jsxs("div", { className: "absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 bg-black", children: [jsxRuntime.jsx(lucideReact.LoaderCircle, { className: "h-10 w-10 text-white motion-safe:animate-spin", "aria-hidden": "true" }), jsxRuntime.jsx("span", { className: "text-sm text-white", children: t("id_check.photo.initializing", "Ouverture de la caméra…") })] })) : null, savePhase ? (jsxRuntime.jsx("div", { "data-testid": "capture-processing", "aria-busy": savePhase === "saving", className: "absolute inset-0 z-30 flex items-center justify-center px-6", children: jsxRuntime.jsxs("div", { role: "status", "aria-live": "polite", className: "flex min-w-[220px] flex-col items-center gap-3 rounded-2xl bg-black/75 px-6 py-5 text-white shadow-lg", children: [savePhase === "saving" ? (jsxRuntime.jsx(lucideReact.LoaderCircle, { className: "h-9 w-9 motion-safe:animate-spin", "aria-hidden": "true" })) : (jsxRuntime.jsx("span", { className: "flex h-9 w-9 items-center justify-center rounded-full bg-[#11E5C5] text-black", children: jsxRuntime.jsx(lucideReact.Check, { className: "h-6 w-6", "aria-hidden": "true" }) })), jsxRuntime.jsx("span", { className: "text-base font-medium", children: savePhase === "saving"
266
+ ? t("card_capture.saving", "Enregistrement de la photo…")
267
+ : t("card_capture.saved", "Photo enregistrée") })] }) })) : null, showFlash ? jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-0 z-40 bg-white/70 motion-reduce:hidden" }) : null] })) }), jsxRuntime.jsxs("div", { className: "relative z-20 flex flex-col items-center gap-3 bg-black px-4 pb-[max(env(safe-area-inset-bottom),20px)] pt-4", children: [captureError ? (jsxRuntime.jsx("p", { role: "alert", className: "text-center text-sm text-red-300", children: captureError })) : showNudge ? (jsxRuntime.jsx("p", { className: "text-center text-sm text-white", children: t("card_capture.nudge", "Vous pouvez aussi prendre la photo vous-même") })) : null, jsxRuntime.jsxs("button", { type: "button", "data-testid": "shutter", "data-holding": holding ? "true" : "false", onClick: handleManualCapture, "aria-label": shutterLabel, className: "relative flex h-[76px] w-[76px] cursor-pointer items-center justify-center rounded-full transition-transform active:scale-95 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white", children: [jsxRuntime.jsxs("svg", { className: "absolute inset-0 h-full w-full -rotate-90", viewBox: "0 0 76 76", "aria-hidden": "true", children: [jsxRuntime.jsx("circle", { cx: "38", cy: "38", r: RING_RADIUS, fill: "none", stroke: "white", strokeOpacity: 0.9, strokeWidth: "3" }), holding ? (jsxRuntime.jsx("circle", { cx: "38", cy: "38", r: RING_RADIUS, fill: "none", stroke: "#11E5C5", strokeWidth: "5", strokeLinecap: "round", strokeDasharray: RING_LENGTH, strokeDashoffset: 0, children: jsxRuntime.jsx("animate", { attributeName: "stroke-dashoffset", from: RING_LENGTH, to: "0", dur: "".concat(holdMs, "ms"), fill: "freeze" }) }, "hold-".concat((_k = event === null || event === void 0 ? void 0 : event.timestamp) !== null && _k !== void 0 ? _k : 0))) : null] }), jsxRuntime.jsx("span", { className: "h-[58px] w-[58px] rounded-full bg-white" })] })] })] }));
268
+ };
269
+
270
+ exports.default = CardCapture;
@@ -0,0 +1,85 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
+ var geometry = require('./geometry.js');
8
+
9
+ var TONE_CLASS = {
10
+ neutral: "text-white",
11
+ warning: "text-amber-400",
12
+ progress: "text-[#11E5C5]",
13
+ success: "text-[#11E5C5]",
14
+ };
15
+ /** Share of the remaining distance covered per animation frame: smooths the ~8 model updates per second. */
16
+ var FOLLOW = 0.3;
17
+ var BRACKET = 22;
18
+ var prefersReducedMotion = function () {
19
+ return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
20
+ };
21
+ /**
22
+ * Darkened camera with a hole that follows the detected card (or the static ID-1 frame). The quad is animated
23
+ * in a requestAnimationFrame loop that writes the SVG paths directly: no React render per frame.
24
+ */
25
+ var DynamicCardMask = function (_a) {
26
+ var corners = _a.corners, videoWidth = _a.videoWidth, videoHeight = _a.videoHeight, mirrored = _a.mirrored, tone = _a.tone;
27
+ var rootRef = React.useRef(null);
28
+ var scrimRef = React.useRef(null);
29
+ var outlineRef = React.useRef(null);
30
+ var _b = React.useState({ width: 0, height: 0 }), box = _b[0], setBox = _b[1];
31
+ React.useEffect(function () {
32
+ var el = rootRef.current;
33
+ if (!el)
34
+ return;
35
+ var measure = function () { return setBox({ width: el.clientWidth, height: el.clientHeight }); };
36
+ measure();
37
+ if (typeof ResizeObserver === "undefined") {
38
+ window.addEventListener("resize", measure);
39
+ return function () { return window.removeEventListener("resize", measure); };
40
+ }
41
+ var observer = new ResizeObserver(measure);
42
+ observer.observe(el);
43
+ return function () { return observer.disconnect(); };
44
+ }, []);
45
+ var frame = geometry.idCardFrameRect(box.width, box.height);
46
+ var tracked = corners
47
+ ? geometry.videoToViewport(corners, { videoWidth: videoWidth, videoHeight: videoHeight, boxWidth: box.width, boxHeight: box.height, mirrored: mirrored })
48
+ : [];
49
+ var target = tracked.length === 4 ? tracked : geometry.rectToQuad(frame);
50
+ var targetRef = React.useRef(target);
51
+ targetRef.current = target;
52
+ var boxRef = React.useRef(box);
53
+ boxRef.current = box;
54
+ React.useEffect(function () {
55
+ if (!box.width || !box.height)
56
+ return;
57
+ var reduced = prefersReducedMotion();
58
+ var shown = targetRef.current;
59
+ var frameId = 0;
60
+ var draw = function () {
61
+ var _a, _b;
62
+ shown = reduced ? targetRef.current : geometry.lerpQuad(shown, targetRef.current, FOLLOW);
63
+ var _c = boxRef.current, width = _c.width, height = _c.height;
64
+ var hole = geometry.quadPath(shown);
65
+ (_a = scrimRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute("d", "M0 0H".concat(width, "V").concat(height, "H0Z").concat(hole));
66
+ (_b = outlineRef.current) === null || _b === void 0 ? void 0 : _b.setAttribute("d", hole);
67
+ if (typeof requestAnimationFrame === "function")
68
+ frameId = requestAnimationFrame(draw);
69
+ };
70
+ draw();
71
+ return function () {
72
+ if (frameId && typeof cancelAnimationFrame === "function")
73
+ cancelAnimationFrame(frameId);
74
+ };
75
+ }, [box.width, box.height]);
76
+ // Mode follows the detection itself, not the projection (which needs a measured box).
77
+ var isTracking = !!corners && corners.length === 4;
78
+ var left = frame.left, top = frame.top, width = frame.width, height = frame.height;
79
+ var r = left + width;
80
+ var b = top + height;
81
+ var brackets = "M".concat(left, " ").concat(top + BRACKET, "V").concat(top, "H").concat(left + BRACKET, "M").concat(r - BRACKET, " ").concat(top, "H").concat(r, "V").concat(top + BRACKET, "M").concat(r, " ").concat(b - BRACKET, "V").concat(b, "H").concat(r - BRACKET, "M").concat(left + BRACKET, " ").concat(b, "H").concat(left, "V").concat(b - BRACKET);
82
+ return (jsxRuntime.jsx("div", { ref: rootRef, "data-testid": "card-mask", "data-mode": isTracking ? "tracking" : "frame", "data-tone": tone, "aria-hidden": "true", className: "pointer-events-none absolute inset-0 z-10 transition-colors duration-200 ".concat(TONE_CLASS[tone]), children: box.width > 0 && box.height > 0 ? (jsxRuntime.jsxs("svg", { className: "h-full w-full", viewBox: "0 0 ".concat(box.width, " ").concat(box.height), preserveAspectRatio: "none", children: [jsxRuntime.jsx("path", { ref: scrimRef, fill: "black", fillOpacity: 0.55, fillRule: "evenodd" }), jsxRuntime.jsx("path", { ref: outlineRef, fill: "none", stroke: "currentColor", strokeWidth: isTracking ? 3 : 1, strokeOpacity: isTracking ? 1 : 0.35, strokeLinejoin: "round" }), isTracking ? null : (jsxRuntime.jsx("path", { d: brackets, fill: "none", stroke: "currentColor", strokeWidth: 4, strokeLinecap: "round", strokeLinejoin: "round" }))] })) : null }));
83
+ };
84
+
85
+ exports.default = DynamicCardMask;
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ /** Pure geometry of the dynamic capture screen: video frame <-> on-screen box (object-cover) and the crop. */
4
+ /** ID-1 card (CNI, residence permit, licence): 85.6 × 54 mm. */
5
+ var ID1_RATIO = 85.6 / 54;
6
+ var FRAME_WIDTH_SHARE = 0.88;
7
+ var FRAME_MAX_HEIGHT_SHARE = 0.6;
8
+ var MIN_CROP_PX = 16;
9
+ function coverTransform(_a) {
10
+ var videoWidth = _a.videoWidth, videoHeight = _a.videoHeight, boxWidth = _a.boxWidth, boxHeight = _a.boxHeight;
11
+ if (!videoWidth || !videoHeight || !boxWidth || !boxHeight)
12
+ return null;
13
+ var scale = Math.max(boxWidth / videoWidth, boxHeight / videoHeight);
14
+ var displayedWidth = videoWidth * scale;
15
+ var displayedHeight = videoHeight * scale;
16
+ return {
17
+ scale: scale,
18
+ displayedWidth: displayedWidth,
19
+ displayedHeight: displayedHeight,
20
+ offsetX: (boxWidth - displayedWidth) / 2,
21
+ offsetY: (boxHeight - displayedHeight) / 2,
22
+ };
23
+ }
24
+ /** Normalized points of the video frame -> pixels of the box showing it with `object-fit: cover`. */
25
+ function videoToViewport(points, layout) {
26
+ var t = coverTransform(layout);
27
+ if (!t)
28
+ return [];
29
+ return points.map(function (_a) {
30
+ var x = _a[0], y = _a[1];
31
+ var px = t.offsetX + x * t.displayedWidth;
32
+ return [layout.mirrored ? layout.boxWidth - px : px, t.offsetY + y * t.displayedHeight];
33
+ });
34
+ }
35
+ /** Box rectangle -> pixels of the raw video frame (crop of a manual capture without detection). */
36
+ function viewportRectToVideo(rect, layout) {
37
+ var t = coverTransform(layout);
38
+ if (!t)
39
+ return null;
40
+ var left = layout.mirrored ? layout.boxWidth - (rect.left + rect.width) : rect.left;
41
+ var x0 = Math.max(0, Math.round((left - t.offsetX) / t.scale));
42
+ var y0 = Math.max(0, Math.round((rect.top - t.offsetY) / t.scale));
43
+ var x1 = Math.min(layout.videoWidth, Math.round((left + rect.width - t.offsetX) / t.scale));
44
+ var y1 = Math.min(layout.videoHeight, Math.round((rect.top + rect.height - t.offsetY) / t.scale));
45
+ if (x1 - x0 < MIN_CROP_PX || y1 - y0 < MIN_CROP_PX)
46
+ return null;
47
+ return { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
48
+ }
49
+ /**
50
+ * Crop around the detected card in video pixels, with a margin proportional to the card so an edge is never cut
51
+ * by a slightly late corner estimate. Null for degenerate corners (the caller falls back to the static frame).
52
+ */
53
+ function cropRectFromCorners(corners, videoWidth, videoHeight, margin) {
54
+ if (margin === void 0) { margin = 0.06; }
55
+ if (corners.length !== 4 || !videoWidth || !videoHeight)
56
+ return null;
57
+ var minX = Infinity;
58
+ var minY = Infinity;
59
+ var maxX = -Infinity;
60
+ var maxY = -Infinity;
61
+ for (var _i = 0, corners_1 = corners; _i < corners_1.length; _i++) {
62
+ var _a = corners_1[_i], x = _a[0], y = _a[1];
63
+ minX = Math.min(minX, x * videoWidth);
64
+ maxX = Math.max(maxX, x * videoWidth);
65
+ minY = Math.min(minY, y * videoHeight);
66
+ maxY = Math.max(maxY, y * videoHeight);
67
+ }
68
+ var width = maxX - minX;
69
+ var height = maxY - minY;
70
+ if (width < MIN_CROP_PX || height < MIN_CROP_PX)
71
+ return null;
72
+ var m = margin * Math.max(width, height);
73
+ var x0 = Math.max(0, Math.floor(minX - m));
74
+ var y0 = Math.max(0, Math.floor(minY - m));
75
+ var x1 = Math.min(videoWidth, Math.ceil(maxX + m));
76
+ var y1 = Math.min(videoHeight, Math.ceil(maxY + m));
77
+ return { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
78
+ }
79
+ /** Static ID-1 frame centered in the box: 88 % of the width, at most 60 % of the height (landscape). */
80
+ function idCardFrameRect(boxWidth, boxHeight) {
81
+ var width = boxWidth * FRAME_WIDTH_SHARE;
82
+ var height = width / ID1_RATIO;
83
+ if (height > boxHeight * FRAME_MAX_HEIGHT_SHARE) {
84
+ height = boxHeight * FRAME_MAX_HEIGHT_SHARE;
85
+ width = height * ID1_RATIO;
86
+ }
87
+ return { left: (boxWidth - width) / 2, top: (boxHeight - height) / 2, width: width, height: height };
88
+ }
89
+ function rectToQuad(_a) {
90
+ var left = _a.left, top = _a.top, width = _a.width, height = _a.height;
91
+ return [[left, top], [left + width, top], [left + width, top + height], [left, top + height]];
92
+ }
93
+ function lerpQuad(from, to, t) {
94
+ return to.map(function (_a, i) {
95
+ var _b;
96
+ var x = _a[0], y = _a[1];
97
+ var _c = (_b = from[i]) !== null && _b !== void 0 ? _b : [x, y], fx = _c[0], fy = _c[1];
98
+ return [fx + (x - fx) * t, fy + (y - fy) * t];
99
+ });
100
+ }
101
+ var round1 = function (n) { return String(Number(n.toFixed(1))); };
102
+ /** Closed SVG path, one decimal (enough for pixels, smaller DOM updates). */
103
+ function quadPath(quad) {
104
+ if (quad.length === 0)
105
+ return "";
106
+ return "".concat(quad.map(function (_a, i) {
107
+ var x = _a[0], y = _a[1];
108
+ return "".concat(i === 0 ? "M" : "L").concat(round1(x), " ").concat(round1(y));
109
+ }).join(""), "Z");
110
+ }
111
+
112
+ exports.ID1_RATIO = ID1_RATIO;
113
+ exports.cropRectFromCorners = cropRectFromCorners;
114
+ exports.idCardFrameRect = idCardFrameRect;
115
+ exports.lerpQuad = lerpQuad;
116
+ exports.quadPath = quadPath;
117
+ exports.rectToQuad = rectToQuad;
118
+ exports.videoToViewport = videoToViewport;
119
+ exports.viewportRectToVideo = viewportRectToVideo;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var TONES = {
4
+ no_card: "neutral",
5
+ card_detected: "neutral",
6
+ too_far: "warning",
7
+ too_dark: "warning",
8
+ too_blurry: "warning",
9
+ bright_spot: "warning",
10
+ hold_still: "progress",
11
+ ready: "success",
12
+ };
13
+ var guideTone = function (code) { return TONES[code]; };
14
+
15
+ exports.guideTone = guideTone;
@@ -12,6 +12,8 @@ var SelectComponent = require('../ui/SelectComponent.js');
12
12
  var useI18n = require('../../hooks/useI18n.js');
13
13
  var MobilePageLayout = require('../ui/MobilePageLayout.js');
14
14
  var NfcOnboardingNotice = require('../nfc-scan/NfcOnboardingNotice.js');
15
+ var modelLoader = require('../card-capture-guide/modelLoader.js');
16
+ var CardCaptureGuideContext = require('../../context/CardCaptureGuideContext.js');
15
17
 
16
18
  var DOCUMENT_KEYS = [
17
19
  {
@@ -51,6 +53,13 @@ var JDIDocumentSelection = function (_a) {
51
53
  var _d = React.useState(""), error = _d[0], setError = _d[1];
52
54
  var _e = React.useState([]), documentOptions = _e[0], setDocumentOptions = _e[1];
53
55
  var t = useI18n.useI18n().t;
56
+ // Start downloading the capture-guide model (13.5 MB) while the user picks the document.
57
+ var _f = CardCaptureGuideContext.useCardCaptureGuideConfig(), guideEnabled = _f.enabled, guideModelUrl = _f.modelUrl;
58
+ React.useEffect(function () {
59
+ if (guideEnabled === false)
60
+ return;
61
+ modelLoader.preloadCardGuideModel(guideModelUrl);
62
+ }, [guideEnabled, guideModelUrl]);
54
63
  // Récupérer les options de documents spécifiques à la session
55
64
  React.useEffect(function () {
56
65
  console.log("Retrieving document options for session:", sessionId);
@@ -10,7 +10,7 @@ var SelfieFlow = require('./selfie-flow/SelfieFlow.js');
10
10
  var VideoResetStyles = require('./VideoResetStyles.js');
11
11
 
12
12
  var Video = function (_a) {
13
- var setSelfieData = _a.setSelfieData, setStep = _a.setStep, sessionId = _a.sessionId, iad = _a.iad, btnBg = _a.btnBg, btnText = _a.btnText;
13
+ var setSelfieData = _a.setSelfieData, setStep = _a.setStep, sessionId = _a.sessionId, iad = _a.iad, btnBg = _a.btnBg, btnText = _a.btnText, onPreviewContinue = _a.onPreviewContinue;
14
14
  // Effet pour ajouter la classe au body lorsque le composant est monté
15
15
  React.useEffect(function () {
16
16
  // Empêcher le scroll sur le body lorsque la capture est active
@@ -32,7 +32,7 @@ var Video = function (_a) {
32
32
  setStep(1); // Move to the next step after selfie capture
33
33
  }, 300);
34
34
  };
35
- return (jsxRuntime.jsxs("div", { className: "w-full h-full overflow-hidden flex flex-col", children: [jsxRuntime.jsx(VideoResetStyles.default, {}), jsxRuntime.jsx(SelfieFlow.default, { handleSelfie: handleSelfie, sessionId: sessionId, iad: iad, btnBg: btnBg, btnText: btnText })] }));
35
+ return (jsxRuntime.jsxs("div", { className: "w-full h-full overflow-hidden flex flex-col", children: [jsxRuntime.jsx(VideoResetStyles.default, {}), jsxRuntime.jsx(SelfieFlow.default, { handleSelfie: handleSelfie, sessionId: sessionId, iad: iad, btnBg: btnBg, btnText: btnText, onPreviewContinue: onPreviewContinue })] }));
36
36
  };
37
37
 
38
38
  exports.default = Video;
@@ -7,16 +7,18 @@ var React = require('react');
7
7
  var SelfiePreIntroduction = require('./SelfiePreIntroduction.js');
8
8
  var InstructionsSelfie = require('./InstructionsSelfie.js');
9
9
  var LoadingState = require('../../states/LoadingState.js');
10
+ var previewMode = require('../../../preview/previewMode.js');
11
+ var PreviewCaptureDisabled = require('../../../preview/PreviewCaptureDisabled.js');
10
12
 
11
13
  var SelfieRecorder = React.lazy(function () { return Promise.resolve().then(function () { return require('./SelfieRecorder.js'); }); });
12
14
  var SelfieFlow = function (_a) {
13
15
  var _b;
14
- var handleSelfie = _a.handleSelfie, sessionId = _a.sessionId, iad = _a.iad, btnBg = _a.btnBg, btnText = _a.btnText;
16
+ var handleSelfie = _a.handleSelfie, sessionId = _a.sessionId, iad = _a.iad, btnBg = _a.btnBg, btnText = _a.btnText, onPreviewContinue = _a.onPreviewContinue;
15
17
  var _c = React.useState(-1), internalStep = _c[0], setInternalStep = _c[1]; // Commencer à -1 pour la pré-introduction
16
18
  return (jsxRuntime.jsxs("div", { className: "h-full w-full flex flex-col", style: (_b = {},
17
19
  _b["--dk-btn-bg"] = btnBg !== null && btnBg !== void 0 ? btnBg : "#11E5C5",
18
20
  _b["--dk-btn-text"] = btnText !== null && btnText !== void 0 ? btnText : "#3C3C40",
19
- _b), children: [internalStep === -1 && (jsxRuntime.jsx("div", { className: "flex-1 flex flex-col h-full", children: jsxRuntime.jsx(SelfiePreIntroduction.default, { onContinue: function () { return setInternalStep(0); } }) })), internalStep === 0 && (jsxRuntime.jsx("div", { className: "flex-1 flex flex-col h-full", children: jsxRuntime.jsx(InstructionsSelfie.default, { setStep: setInternalStep, onBack: function () { return setInternalStep(-1); } }) })), internalStep === 1 && (jsxRuntime.jsx("div", { className: "flex-1 flex flex-col h-full overflow-hidden", children: jsxRuntime.jsx(React.Suspense, { fallback: jsxRuntime.jsx(LoadingState.default, {}), children: jsxRuntime.jsx(SelfieRecorder, { handleSelfie: handleSelfie, sessionId: sessionId, iad: iad, btnBg: btnBg, btnText: btnText }) }) }))] }));
21
+ _b), children: [internalStep === -1 && (jsxRuntime.jsx("div", { className: "flex-1 flex flex-col h-full", children: jsxRuntime.jsx(SelfiePreIntroduction.default, { onContinue: function () { return setInternalStep(0); } }) })), internalStep === 0 && (jsxRuntime.jsx("div", { className: "flex-1 flex flex-col h-full", children: jsxRuntime.jsx(InstructionsSelfie.default, { setStep: setInternalStep, onBack: function () { return setInternalStep(-1); } }) })), internalStep === 1 && previewMode.isPreviewMode() && (jsxRuntime.jsx("div", { className: "flex-1 flex flex-col h-full", children: jsxRuntime.jsx(PreviewCaptureDisabled.default, { onContinue: onPreviewContinue }) })), internalStep === 1 && !previewMode.isPreviewMode() && (jsxRuntime.jsx("div", { className: "flex-1 flex flex-col h-full overflow-hidden", children: jsxRuntime.jsx(React.Suspense, { fallback: jsxRuntime.jsx(LoadingState.default, {}), children: jsxRuntime.jsx(SelfieRecorder, { handleSelfie: handleSelfie, sessionId: sessionId, iad: iad, btnBg: btnBg, btnText: btnText }) }) }))] }));
20
22
  };
21
23
 
22
24
  exports.default = SelfieFlow;