datakeen-session-react 1.1.202-dev.17 → 1.1.202-dev.19

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 (60) 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/id-check/Photo.js +230 -122
  12. package/dist/cjs/components/id-check/card-capture/CardCapture.js +270 -0
  13. package/dist/cjs/components/id-check/card-capture/DynamicCardMask.js +85 -0
  14. package/dist/cjs/components/id-check/card-capture/geometry.js +119 -0
  15. package/dist/cjs/components/id-check/card-capture/guideTone.js +15 -0
  16. package/dist/cjs/components/jdi/JDIDocumentSelection.js +9 -0
  17. package/dist/cjs/components/session/DocumentCheck.js +19 -2
  18. package/dist/cjs/components/start-flow/Start.js +4 -0
  19. package/dist/cjs/context/CardCaptureGuideContext.js +16 -0
  20. package/dist/cjs/i18n/en.json.js +29 -0
  21. package/dist/cjs/i18n/es.json.js +29 -0
  22. package/dist/cjs/i18n/fr.json.js +29 -0
  23. package/dist/cjs/index.css.js +1 -1
  24. package/dist/cjs/index.js +13 -0
  25. package/dist/cjs/services/sessionService.js +43 -0
  26. package/dist/esm/components/DatakeenSession.js +17 -16
  27. package/dist/esm/components/card-capture-guide/CardCaptureGuide.js +135 -0
  28. package/dist/esm/components/card-capture-guide/captureTelemetry.js +78 -0
  29. package/dist/esm/components/card-capture-guide/guidance.js +44 -0
  30. package/dist/esm/components/card-capture-guide/guideCore.js +372 -0
  31. package/dist/esm/components/card-capture-guide/guideRuntime.js +115 -0
  32. package/dist/esm/components/card-capture-guide/modelLoader.js +42 -0
  33. package/dist/esm/components/card-capture-guide/useCaptureGuideThresholds.js +31 -0
  34. package/dist/esm/components/card-capture-guide/useCardCaptureGuide.js +115 -0
  35. package/dist/esm/components/card-capture-guide/useMinDisplay.js +28 -0
  36. package/dist/esm/components/id-check/Photo.js +232 -124
  37. package/dist/esm/components/id-check/card-capture/CardCapture.js +266 -0
  38. package/dist/esm/components/id-check/card-capture/DynamicCardMask.js +81 -0
  39. package/dist/esm/components/id-check/card-capture/geometry.js +110 -0
  40. package/dist/esm/components/id-check/card-capture/guideTone.js +13 -0
  41. package/dist/esm/components/jdi/JDIDocumentSelection.js +9 -0
  42. package/dist/esm/components/session/DocumentCheck.js +19 -2
  43. package/dist/esm/components/start-flow/Start.js +4 -0
  44. package/dist/esm/context/CardCaptureGuideContext.js +13 -0
  45. package/dist/esm/i18n/en.json.js +28 -1
  46. package/dist/esm/i18n/es.json.js +28 -1
  47. package/dist/esm/i18n/fr.json.js +28 -1
  48. package/dist/esm/index.css.js +1 -1
  49. package/dist/esm/index.js +5 -0
  50. package/dist/esm/services/sessionService.js +42 -1
  51. package/dist/types/components/card-capture-guide/CardCaptureGuide.d.ts +46 -0
  52. package/dist/types/components/card-capture-guide/guidance.d.ts +45 -0
  53. package/dist/types/components/card-capture-guide/guideCore.d.ts +96 -0
  54. package/dist/types/components/card-capture-guide/guideRuntime.d.ts +13 -0
  55. package/dist/types/components/card-capture-guide/modelLoader.d.ts +13 -0
  56. package/dist/types/components/card-capture-guide/useCardCaptureGuide.d.ts +38 -0
  57. package/dist/types/index.d.ts +6 -0
  58. package/dist/types/types/camera.d.ts +3 -0
  59. package/dist/types/types/session.d.ts +15 -1
  60. 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);
@@ -16,6 +16,9 @@ var JDIError = require('../jdi/JDIError.js');
16
16
  var BeforePhoto = require('../id-check/BeforePhoto.js');
17
17
  var BeforeVersoPhoto = require('../id-check/BeforeVersoPhoto.js');
18
18
  var Photo = require('../id-check/Photo.js');
19
+ var CardCapture = require('../id-check/card-capture/CardCapture.js');
20
+ var CardCaptureGuideContext = require('../../context/CardCaptureGuideContext.js');
21
+ var useCaptureGuideThresholds = require('../card-capture-guide/useCaptureGuideThresholds.js');
19
22
  var PhotoConfirmation = require('../id-check/PhotoConfirmation.js');
20
23
  var DocumentVideoCapture = require('../document-video/DocumentVideoCapture.js');
21
24
  var lucideReact = require('lucide-react');
@@ -40,6 +43,8 @@ var PreviewCaptureDisabled = require('../../preview/PreviewCaptureDisabled.js');
40
43
  var controleJdiPolicy = require('./controleJdiPolicy.js');
41
44
  var europeanCountries = require('../../utils/europeanCountries.js');
42
45
 
46
+ /** Documents that are not ID-1 cards: the on-device capture guide stays off for them. */
47
+ var NON_CARD_DOCUMENT_TYPES = new Set(["passport", "pinkDriverLicense"]);
43
48
  var NFC_ELIGIBLE_DOCUMENT_TYPES = new Set([
44
49
  "passport",
45
50
  "idCard",
@@ -238,6 +243,18 @@ var DocumentCheck = function (_a) {
238
243
  var _5 = React.useState("before-recto"), currentPhotoStep = _5[0], setCurrentPhotoStep = _5[1];
239
244
  var _6 = React.useState("photo"), videoFlowPhase = _6[0], setVideoFlowPhase = _6[1];
240
245
  var _7 = DocumentContext.useDocumentContext(), selectedDocumentType = _7.selectedDocumentType, setSelectedDocumentType = _7.setSelectedDocumentType;
246
+ // The on-device capture guide is trained on ID-1 cards only: not the passport or the old paper licence.
247
+ var isCardFormatDocument = !!(selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id) &&
248
+ !NON_CARD_DOCUMENT_TYPES.has(selectedDocumentType.id);
249
+ var cardGuideConfig = CardCaptureGuideContext.useCardCaptureGuideConfig();
250
+ // Read as soon as the node is shown, so the thresholds are there before the camera opens (APP3-2119).
251
+ var captureGuideThresholds = useCaptureGuideThresholds.useCaptureGuideThresholds(cardGuideConfig.enabled === false ? undefined : sessionId);
252
+ // Card-format identity documents use the dynamic capture screen; the others keep Photo (APP3-2117).
253
+ var photoCardGuide = React.useMemo(function () {
254
+ return isCardFormatDocument && cardGuideConfig.enabled !== false
255
+ ? { modelUrl: cardGuideConfig.modelUrl, wasmPaths: cardGuideConfig.wasmPaths, tracker: captureGuideThresholds }
256
+ : false;
257
+ }, [isCardFormatDocument, cardGuideConfig.enabled, cardGuideConfig.modelUrl, cardGuideConfig.wasmPaths, captureGuideThresholds]);
241
258
  var finalAcceptedCountries = React.useMemo(function () {
242
259
  if (loadingTemplates)
243
260
  return acceptedCountries;
@@ -796,13 +813,13 @@ var DocumentCheck = function (_a) {
796
813
  return (jsxRuntime.jsx(BeforePhoto.default, { setStep: function () { return setCurrentPhotoStep("recto"); }, isSingleSided: isSingleSided, onBack: function () { return setDocStep(2); } }));
797
814
  }
798
815
  if (currentPhotoStep === "recto") {
799
- return (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }));
816
+ return (photoCardGuide ? (jsxRuntime.jsx(CardCapture.default, { sessionId: sessionId, nodeId: node.id, guide: photoCardGuide, captureSide: "recto", documentType: selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }, "recto")) : (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, captureSide: "recto", documentType: selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }, "recto")));
800
817
  }
801
818
  if (currentPhotoStep === "before-verso") {
802
819
  return (jsxRuntime.jsx(BeforeVersoPhoto.default, { setStep: function () { return setCurrentPhotoStep("verso"); } }));
803
820
  }
804
821
  if (currentPhotoStep === "verso") {
805
- return (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }));
822
+ return (photoCardGuide ? (jsxRuntime.jsx(CardCapture.default, { sessionId: sessionId, nodeId: node.id, guide: photoCardGuide, captureSide: "verso", documentType: selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }, "verso")) : (jsxRuntime.jsx(Photo.default, { sessionId: sessionId, nodeId: node.id, captureSide: "verso", documentType: selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id, onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }, "verso")));
806
823
  }
807
824
  if (currentPhotoStep === "confirmation") {
808
825
  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 }));
@@ -13,6 +13,7 @@ require('../../utils/cssLoader.js');
13
13
  require('../../context/DocumentContext.js');
14
14
  require('../../services/api.js');
15
15
  require('../../config/env.js');
16
+ require('../../context/CardCaptureGuideContext.js');
16
17
  require('axios');
17
18
  require('../../services/auditTrailService.js');
18
19
  require('ua-parser-js');
@@ -38,6 +39,8 @@ require('../../assets/selfietake.svg.js');
38
39
  require('../../assets/before-passport.png.js');
39
40
  require('../../services/cameraService.js');
40
41
  require('../../services/documentEdgeDetectionService.js');
42
+ require('../card-capture-guide/guideCore.js');
43
+ require('../card-capture-guide/captureTelemetry.js');
41
44
  require('../document-video/document-video-flow/DocumentVideoFlow.js');
42
45
  require('../document-collection/DocumentProcessing.js');
43
46
  require('../../constants/userInputForm.js');
@@ -52,6 +55,7 @@ require('@radix-ui/react-checkbox');
52
55
  require('@radix-ui/react-icons');
53
56
  require('../../services/professionalImageQuality.js');
54
57
  require('../../providers/I18nProvider.js');
58
+ require('../card-capture-guide/CardCaptureGuide.js');
55
59
 
56
60
  var Start = function (_a) {
57
61
  var setStep = _a.setStep, welcomeTitle = _a.welcomeTitle, welcomeSubtitle = _a.welcomeSubtitle, welcomeDescription = _a.welcomeDescription, welcomeImage = _a.welcomeImage, session = _a.session;
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+
6
+ var EMPTY = {};
7
+ var CardCaptureGuideConfigContext = React.createContext(EMPTY);
8
+ /** Makes `sessionConfig.cardCaptureGuide` readable by the capture screens deep in the tree. */
9
+ var CardCaptureGuideConfigProvider = function (_a) {
10
+ var value = _a.value, children = _a.children;
11
+ return jsxRuntime.jsx(CardCaptureGuideConfigContext.Provider, { value: value !== null && value !== void 0 ? value : EMPTY, children: children });
12
+ };
13
+ var useCardCaptureGuideConfig = function () { return React.useContext(CardCaptureGuideConfigContext); };
14
+
15
+ exports.CardCaptureGuideConfigProvider = CardCaptureGuideConfigProvider;
16
+ exports.useCardCaptureGuideConfig = useCardCaptureGuideConfig;