datakeen-session-react 1.1.195-dev.4 → 1.1.195-dev.6

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 (48) hide show
  1. package/dist/cjs/components/jdi/JDIProcessing.js +3 -3
  2. package/dist/cjs/components/jdi/JDIProcessing.js.map +1 -1
  3. package/dist/cjs/components/selfie/Video.js +2 -2
  4. package/dist/cjs/components/selfie/Video.js.map +1 -1
  5. package/dist/cjs/components/selfie/selfie-flow/SelfieFlow.js +2 -2
  6. package/dist/cjs/components/selfie/selfie-flow/SelfieFlow.js.map +1 -1
  7. package/dist/cjs/components/selfie/selfie-flow/SelfieProcessing.js +5 -1
  8. package/dist/cjs/components/selfie/selfie-flow/SelfieProcessing.js.map +1 -1
  9. package/dist/cjs/components/selfie/selfie-flow/SelfieRecorder.js +123 -13
  10. package/dist/cjs/components/selfie/selfie-flow/SelfieRecorder.js.map +1 -1
  11. package/dist/cjs/components/session/Selfie.js +1 -1
  12. package/dist/cjs/components/session/Selfie.js.map +1 -1
  13. package/dist/cjs/i18n/en.json.js +2 -1
  14. package/dist/cjs/i18n/en.json.js.map +1 -1
  15. package/dist/cjs/i18n/es.json.js +2 -1
  16. package/dist/cjs/i18n/es.json.js.map +1 -1
  17. package/dist/cjs/i18n/fr.json.js +2 -1
  18. package/dist/cjs/i18n/fr.json.js.map +1 -1
  19. package/dist/cjs/services/analysis.js +40 -26
  20. package/dist/cjs/services/analysis.js.map +1 -1
  21. package/dist/cjs/services/iadService.js +30 -0
  22. package/dist/cjs/services/iadService.js.map +1 -0
  23. package/dist/cjs/types/session.js.map +1 -1
  24. package/dist/esm/components/jdi/JDIProcessing.js +3 -3
  25. package/dist/esm/components/jdi/JDIProcessing.js.map +1 -1
  26. package/dist/esm/components/selfie/Video.js +2 -2
  27. package/dist/esm/components/selfie/Video.js.map +1 -1
  28. package/dist/esm/components/selfie/selfie-flow/SelfieFlow.js +2 -2
  29. package/dist/esm/components/selfie/selfie-flow/SelfieFlow.js.map +1 -1
  30. package/dist/esm/components/selfie/selfie-flow/SelfieProcessing.js +5 -1
  31. package/dist/esm/components/selfie/selfie-flow/SelfieProcessing.js.map +1 -1
  32. package/dist/esm/components/selfie/selfie-flow/SelfieRecorder.js +124 -14
  33. package/dist/esm/components/selfie/selfie-flow/SelfieRecorder.js.map +1 -1
  34. package/dist/esm/components/session/Selfie.js +1 -1
  35. package/dist/esm/components/session/Selfie.js.map +1 -1
  36. package/dist/esm/i18n/en.json.js +2 -1
  37. package/dist/esm/i18n/en.json.js.map +1 -1
  38. package/dist/esm/i18n/es.json.js +2 -1
  39. package/dist/esm/i18n/es.json.js.map +1 -1
  40. package/dist/esm/i18n/fr.json.js +2 -1
  41. package/dist/esm/i18n/fr.json.js.map +1 -1
  42. package/dist/esm/services/analysis.js +40 -26
  43. package/dist/esm/services/analysis.js.map +1 -1
  44. package/dist/esm/services/iadService.js +28 -0
  45. package/dist/esm/services/iadService.js.map +1 -0
  46. package/dist/esm/types/session.js.map +1 -1
  47. package/docs/multi-runs.md +15 -8
  48. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { __assign, __awaiter, __generator } from '../../../node_modules/tslib/tslib.es6.js';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { useRef, useState, useCallback, useEffect } from 'react';
3
+ import { useRef, useState, useEffect, useMemo, useCallback } from 'react';
4
4
  import { VideoRecorder, AcquisitionPreset } from '@unissey-web/sdk-react';
5
5
  import Button from '../../ui/Button.js';
6
6
  import Title from '../../ui/Title.js';
@@ -12,21 +12,118 @@ import { useLiveFrameCapture } from '../hooks/useLiveFrameCapture.js';
12
12
  import { useI18n } from '../../../hooks/useI18n.js';
13
13
  import useIsMobile from '../../../hooks/useIsMobile.js';
14
14
  import { getUnisseyStrings } from '../utils/unisseyStrings.js';
15
+ import { prepareIadCapture } from '../../../services/iadService.js';
15
16
 
16
17
  var SelfieRecorder = function (_a) {
17
18
  var _b;
18
- var handleSelfie = _a.handleSelfie, _c = _a.onBeginCapture, onBeginCapture = _c === void 0 ? function () { } : _c, btnBg = _a.btnBg, btnText = _a.btnText;
19
+ var handleSelfie = _a.handleSelfie, _c = _a.onBeginCapture, onBeginCapture = _c === void 0 ? function () { } : _c, sessionId = _a.sessionId, iad = _a.iad, btnBg = _a.btnBg, btnText = _a.btnText;
19
20
  var t = useI18n().t;
20
21
  var isMobile = useIsMobile(768);
21
22
  var recorderRef = useRef(null);
22
23
  var _d = useState(false), disableButton = _d[0], setDisableButton = _d[1];
23
24
  var _e = useState(false), recorderReady = _e[0], setRecorderReady = _e[1];
24
25
  var _f = useState("idle"), recordingState = _f[0], setRecordingState = _f[1];
26
+ var _g = useState(), iadConfig = _g[0], setIadConfig = _g[1];
27
+ var _h = useState((iad === null || iad === void 0 ? void 0 : iad.enabled) !== true), iadPreparationDone = _h[0], setIadPreparationDone = _h[1];
28
+ var _j = useState(), captureError = _j[0], setCaptureError = _j[1];
29
+ /**
30
+ * Préparation IAD déjà demandée pour une session, avec son résultat.
31
+ * `preparation` reste indéfini tant que la requête n'a pas abouti.
32
+ */
33
+ var preparedSessionRef = useRef();
25
34
  var recordingStateRef = useRef("idle");
26
35
  var lastRecorderStatusRef = useRef();
27
36
  var capturedThumbnailRef = useRef(null);
28
- var _g = useLiveFrameCapture(), captureFrame = _g.captureFrame, cleanup = _g.cleanup;
37
+ var _k = useLiveFrameCapture(), captureFrame = _k.captureFrame, cleanup = _k.cleanup;
29
38
  useVideoRecorderStyles(btnBg, btnText);
39
+ useEffect(function () {
40
+ var cancelled = false;
41
+ if ((iad === null || iad === void 0 ? void 0 : iad.enabled) !== true || !sessionId) {
42
+ setIadConfig(undefined);
43
+ setIadPreparationDone(true);
44
+ return function () {
45
+ cancelled = true;
46
+ };
47
+ }
48
+ /**
49
+ * La donnée de préparation est à USAGE UNIQUE : une seconde requête invalide
50
+ * la première et provoque des suspicions d'injection systématiques (doc
51
+ * Unissey, « False rejections possible root causes »). On ne prépare donc
52
+ * qu'une fois par session — ce garde neutralise aussi le double montage du
53
+ * StrictMode en développement.
54
+ */
55
+ /**
56
+ * La préparation est mémorisée par session : on ne redemande pas de donnée
57
+ * (usage unique côté Unissey), mais on réapplique le résultat déjà obtenu.
58
+ *
59
+ * C'est indispensable avec le double montage du StrictMode : au premier
60
+ * montage la requête part puis le démontage annule l'application du
61
+ * résultat ; sans réapplication ici, `iadPreparationDone` resterait
62
+ * définitivement `false` et le recorder ne serait jamais monté.
63
+ */
64
+ var cached = preparedSessionRef.current;
65
+ if ((cached === null || cached === void 0 ? void 0 : cached.sessionId) === sessionId) {
66
+ if (cached.preparation)
67
+ setIadConfig(cached.preparation);
68
+ setIadPreparationDone(true);
69
+ return function () {
70
+ cancelled = true;
71
+ };
72
+ }
73
+ var entry = { sessionId: sessionId };
74
+ preparedSessionRef.current = entry;
75
+ setIadConfig(undefined);
76
+ setIadPreparationDone(false);
77
+ void prepareIadCapture(sessionId)
78
+ .then(function (preparation) {
79
+ var config = {
80
+ mode: preparation.mode,
81
+ data: preparation.data,
82
+ };
83
+ // Mémorisé même si ce montage est annulé : le montage suivant le
84
+ // réappliquera sans consommer une nouvelle donnée.
85
+ entry.preparation = config;
86
+ if (!cancelled)
87
+ setIadConfig(config);
88
+ })
89
+ .catch(function (error) {
90
+ // Seul le message est loggué : l'objet d'erreur Axios embarque la
91
+ // requête (en-têtes d'authentification, URL avec identifiant de session).
92
+ console.warn("[IAD prepare failed]", error instanceof Error ? error.message : "unknown error");
93
+ // Fail open for capture: the backend will keep the IAD verdict
94
+ // inconclusive if a trustworthy signal cannot be produced.
95
+ // Aucune donnée n'a été consommée : on libère le garde pour permettre
96
+ // une nouvelle tentative au prochain montage.
97
+ if (preparedSessionRef.current === entry) {
98
+ preparedSessionRef.current = undefined;
99
+ }
100
+ })
101
+ .finally(function () {
102
+ // Volontairement sans garde `cancelled` : le drapeau doit passer à
103
+ // `true` même si ce montage est annulé, sinon le recorder reste bloqué.
104
+ setIadPreparationDone(true);
105
+ });
106
+ return function () {
107
+ cancelled = true;
108
+ };
109
+ }, [iad === null || iad === void 0 ? void 0 : iad.enabled, sessionId]);
110
+ /**
111
+ * La prop `config` doit être STABLE entre les rendus.
112
+ *
113
+ * `VideoRecorder` est un web-component Lit : un nouvel objet à chaque rendu
114
+ * est vu comme une prop modifiée, ce qui réinitialise le recorder — il
115
+ * recharge alors ses modules WASM et redemande une préparation IAD, en
116
+ * boucle. Sans ce mémo, l'écran de capture ne devient jamais prêt.
117
+ */
118
+ /**
119
+ * L'IAD est-elle attendue pour cette capture ET techniquement obtenable ?
120
+ *
121
+ * Sert à retarder le montage du recorder jusqu'à ce que `iadConfig` soit
122
+ * prête. Repasse à `false` si la préparation a échoué (`preparedSessionRef`
123
+ * libéré par le `catch`) : la capture démarre alors sans IAD plutôt que de
124
+ * rester bloquée — le backend produira un verdict `inconclusive`.
125
+ */
126
+ var recorderConfig = useMemo(function () { return (iadConfig ? { iadConfig: iadConfig } : undefined); }, [iadConfig]);
30
127
  var updateRecordingState = useCallback(function (state) {
31
128
  recordingStateRef.current = state;
32
129
  setRecordingState(state);
@@ -51,14 +148,6 @@ var SelfieRecorder = function (_a) {
51
148
  useEffect(function () {
52
149
  document.body.classList.add("recording-selfie");
53
150
  var cleanupObserver = setupVideoElementsObserver();
54
- // Les traducteurs automatiques (Safari iOS notamment) réécrivent le DOM et
55
- // détruisent les marqueurs de template Lit du web component Unissey : la capture
56
- // ne redémarre alors plus jamais. React sérialise `translate` en propriété DOM sur
57
- // un custom element (d'où un translate="yes" parasite), il faut poser l'attribut
58
- // impérativement.
59
- document
60
- .querySelectorAll("uni-video-recorder")
61
- .forEach(function (el) { return el.setAttribute("translate", "no"); });
62
151
  // iOS-specific fix: Add required attributes to video elements after mount
63
152
  if (isIOS()) {
64
153
  var addIOSVideoAttributes = function () {
@@ -107,10 +196,24 @@ var SelfieRecorder = function (_a) {
107
196
  cleanup();
108
197
  };
109
198
  }, [cleanup]);
199
+ // Les traducteurs automatiques (Safari iOS notamment) réécrivent le DOM et
200
+ // détruisent les marqueurs de template Lit du web component Unissey : la capture
201
+ // ne redémarre alors plus jamais. React sérialise `translate` en propriété DOM sur
202
+ // un custom element (d'où un translate="yes" parasite), il faut poser l'attribut
203
+ // impérativement. Le recorder n'étant monté qu'une fois la préparation IAD
204
+ // terminée, l'attribut est posé à ce moment-là (et non au montage du composant).
205
+ useEffect(function () {
206
+ if (!iadPreparationDone)
207
+ return;
208
+ document
209
+ .querySelectorAll("uni-video-recorder")
210
+ .forEach(function (el) { return el.setAttribute("translate", "no"); });
211
+ }, [iadPreparationDone]);
110
212
  var recordStarting = function () {
111
213
  if (!recorderReady || recordingState !== "idle")
112
214
  return;
113
215
  onBeginCapture();
216
+ setCaptureError(undefined);
114
217
  updateRecordingState("preparing");
115
218
  setDisableButton(true);
116
219
  var triggerCapture = function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -167,10 +270,14 @@ var SelfieRecorder = function (_a) {
167
270
  return function () { return clearInterval(interval); };
168
271
  }, [resetCaptureControlsFromPolling]);
169
272
  var handleRecorderReady = function () {
273
+ setCaptureError(undefined);
170
274
  setRecorderReady(true);
171
275
  resetCaptureControls();
172
276
  };
173
277
  var handleRecordInterrupted = function () {
278
+ var _a;
279
+ var recorderError = (_a = recorderRef.current) === null || _a === void 0 ? void 0 : _a.error;
280
+ setCaptureError(recorderError || t("unissey.forbiddenActionMessages.default"));
174
281
  resetCaptureControls();
175
282
  };
176
283
  var handleRecordCompleted = function (e) {
@@ -213,11 +320,14 @@ var SelfieRecorder = function (_a) {
213
320
  _b.zIndex = isMobile ? 50 : "auto",
214
321
  _b.height = "100%",
215
322
  _b.width = "100%",
216
- _b), children: [jsxs("div", { className: "p-4 text-center bg-white shrink-0", children: [jsx(Title, { className: "text-lg md:text-xl mb-1", children: t("selfie.recorder.title") }), jsx(Subtitle, { className: "text-xs text-gray-600 md:text-sm", children: t("selfie.recorder.subtitle") })] }), jsx("div", { className: "video-container flex-1 relative overflow-hidden", children: jsx(VideoRecorder, __assign({ ref: recorderRef, preset: AcquisitionPreset.SELFIE_OPTIMIZED, hideCaptureBtn: true, faceChecker: (typeof window !== 'undefined' && window.__E2E_DISABLE_FACE_CHECKER__) ? 'disabled' : 'enabled', disableDebugMode: true, onRecorderReady: handleRecorderReady, onRecordInterrupted: handleRecordInterrupted, onRecordCompleted: handleRecordCompleted, style: { width: "100%", height: "100%" }, className: "video-recorder-no-radius notranslate w-full h-full" }, (isIOS() && {
323
+ _b), children: [jsxs("div", { className: "p-4 text-center bg-white shrink-0", children: [jsx(Title, { className: "text-lg md:text-xl mb-1", children: t("selfie.recorder.title") }), jsx(Subtitle, { className: "text-xs text-gray-600 md:text-sm", children: t("selfie.recorder.subtitle") })] }), jsx("div", { className: "video-container flex-1 relative overflow-hidden", children: iadPreparationDone && (jsx(VideoRecorder, __assign({ ref: recorderRef, preset: AcquisitionPreset.SELFIE_OPTIMIZED, hideCaptureBtn: true, faceChecker: typeof window !== "undefined" &&
324
+ window.__E2E_DISABLE_FACE_CHECKER__
325
+ ? "disabled"
326
+ : "enabled", disableDebugMode: true }, (recorderConfig ? { config: recorderConfig } : {}), { onRecorderReady: handleRecorderReady, onRecordInterrupted: handleRecordInterrupted, onRecordCompleted: handleRecordCompleted, style: { width: "100%", height: "100%" }, className: "video-recorder-no-radius notranslate w-full h-full" }, (isIOS() && {
217
327
  "data-playsinline": "true",
218
328
  "data-autoplay": "true",
219
- "data-muted": "true"
220
- }), { strings: getUnisseyStrings(t) })) }), jsx("div", { className: "shrink-0 bg-white border-t border-gray-200 p-4 md:p-6 relative", style: { zIndex: 9999 }, children: jsxs("div", { className: "max-w-md mx-auto", children: [jsx("div", { className: "text-center text-xs text-gray-400 mt-3", children: t("selfie.recorder.note") }), jsxs(Button, { onClick: recordStarting, className: "w-full py-3 md:py-4 relative selfie-button", disabled: disableButton || !recorderReady, style: { backgroundColor: btnBg !== null && btnBg !== void 0 ? btnBg : "#11E5C5", color: btnText !== null && btnText !== void 0 ? btnText : "#3C3C40" }, children: [recordingState === "idle" && t("selfie.recorder.start"), recordingState === "preparing" && t("selfie.recorder.preparing"), recordingState === "recording" && (jsxs("span", { className: "flex items-center justify-center", children: [jsx("span", { className: "mr-2", children: t("selfie.recorder.recording_label") }), jsxs("span", { className: "flex space-x-1 loading-dots", children: [jsx("span", { className: "h-1 w-1 bg-white rounded-full" }), jsx("span", { className: "h-1 w-1 bg-white rounded-full" }), jsx("span", { className: "h-1 w-1 bg-white rounded-full" })] })] })), recordingState === "processing" && t("selfie.recorder.processing")] })] }) })] }));
329
+ "data-muted": "true",
330
+ }), { strings: getUnisseyStrings(t) }))) }), captureError && (jsx("div", { role: "alert", className: "shrink-0 bg-red-50 px-4 py-2 text-center text-sm text-red-700", children: captureError })), jsx("div", { className: "shrink-0 bg-white border-t border-gray-200 p-4 md:p-6 relative", style: { zIndex: 9999 }, children: jsxs("div", { className: "max-w-md mx-auto", children: [jsx("div", { className: "text-center text-xs text-gray-400 mt-3", children: t("selfie.recorder.note") }), jsxs(Button, { onClick: recordStarting, className: "w-full py-3 md:py-4 relative selfie-button", disabled: disableButton || !recorderReady, style: { backgroundColor: btnBg !== null && btnBg !== void 0 ? btnBg : "#11E5C5", color: btnText !== null && btnText !== void 0 ? btnText : "#3C3C40" }, children: [recordingState === "idle" && t("selfie.recorder.start"), recordingState === "preparing" && t("selfie.recorder.preparing"), recordingState === "recording" && (jsxs("span", { className: "flex items-center justify-center", children: [jsx("span", { className: "mr-2", children: t("selfie.recorder.recording_label") }), jsxs("span", { className: "flex space-x-1 loading-dots", children: [jsx("span", { className: "h-1 w-1 bg-white rounded-full" }), jsx("span", { className: "h-1 w-1 bg-white rounded-full" }), jsx("span", { className: "h-1 w-1 bg-white rounded-full" })] })] })), recordingState === "processing" && t("selfie.recorder.processing")] })] }) })] }));
221
331
  };
222
332
 
223
333
  export { SelfieRecorder as default };
@@ -1 +1 @@
1
- {"version":3,"file":"SelfieRecorder.js","sources":["../../../../../../src/components/selfie/selfie-flow/SelfieRecorder.tsx"],"sourcesContent":["import {\n useCallback,\n useRef,\n useState,\n useEffect,\n type ElementRef,\n} from \"react\";\nimport { AcquisitionPreset, VideoRecorder } from \"@unissey-web/sdk-react\";\nimport Button from \"../../ui/Button\";\nimport Title from \"../../ui/Title\";\nimport Subtitle from \"../../ui/Subtitle\";\nimport useVideoRecorderStyles from \"../hooks/useVideoRecorderStyles\";\nimport { setupVideoElementsObserver } from \"../utils/videoElementStyles\";\nimport { delay, isIOS, waitForVideoFrame, getRecorderVideoElement } from \"../utils/selfieCaptureUtils\";\nimport { useLiveFrameCapture } from \"../hooks/useLiveFrameCapture\";\nimport { useI18n } from \"../../../hooks/useI18n\";\nimport useIsMobile from \"../../../hooks/useIsMobile\";\nimport { getUnisseyStrings } from \"../utils/unisseyStrings\";\n\ntype RecordingState = \"idle\" | \"preparing\" | \"recording\" | \"processing\";\n\ninterface SelfieRecorderProps {\n handleSelfie: (e: Event) => void;\n onBeginCapture?: () => void;\n isCapturing?: boolean;\n btnBg?: string;\n btnText?: string;\n}\n\ntype VideoRecorderElement = ElementRef<typeof VideoRecorder>;\n\nconst SelfieRecorder = ({\n handleSelfie,\n onBeginCapture = () => { },\n btnBg,\n btnText,\n}: SelfieRecorderProps) => {\n const { t } = useI18n();\n const isMobile = useIsMobile(768);\n const recorderRef = useRef<VideoRecorderElement | null>(null);\n const [disableButton, setDisableButton] = useState(false);\n const [recorderReady, setRecorderReady] = useState(false);\n const [recordingState, setRecordingState] = useState<RecordingState>(\"idle\");\n const recordingStateRef = useRef<RecordingState>(\"idle\");\n const lastRecorderStatusRef = useRef<string | undefined>();\n const capturedThumbnailRef = useRef<string | null>(null);\n const { captureFrame, cleanup } = useLiveFrameCapture();\n\n useVideoRecorderStyles(btnBg, btnText);\n\n const updateRecordingState = useCallback((state: RecordingState) => {\n recordingStateRef.current = state;\n setRecordingState(state);\n }, []);\n\n const resetCaptureControls = useCallback(() => {\n capturedThumbnailRef.current = null;\n updateRecordingState(\"idle\");\n setDisableButton(false);\n }, [updateRecordingState]);\n\n // Réinitialisation déclenchée par le polling de statut Unissey.\n // Pendant une capture en cours (preparing/recording/processing), les transitions\n // internes du cycle d'enregistrement (starting → running → ready) ne doivent PAS\n // réactiver le bouton. Seule une perte réelle de la caméra (passage par\n // \"no-session\") justifie un reset pendant la capture (scénario retry caméra).\n const resetCaptureControlsFromPolling = useCallback(\n (previousStatus: string | undefined) => {\n if (\n recordingStateRef.current !== \"idle\" &&\n previousStatus !== \"no-session\"\n ) {\n return;\n }\n resetCaptureControls();\n },\n [resetCaptureControls]\n );\n\n useEffect(() => {\n document.body.classList.add(\"recording-selfie\");\n const cleanupObserver = setupVideoElementsObserver();\n\n // Les traducteurs automatiques (Safari iOS notamment) réécrivent le DOM et\n // détruisent les marqueurs de template Lit du web component Unissey : la capture\n // ne redémarre alors plus jamais. React sérialise `translate` en propriété DOM sur\n // un custom element (d'où un translate=\"yes\" parasite), il faut poser l'attribut\n // impérativement.\n document\n .querySelectorAll(\"uni-video-recorder\")\n .forEach((el) => el.setAttribute(\"translate\", \"no\"));\n\n // iOS-specific fix: Add required attributes to video elements after mount\n if (isIOS()) {\n const addIOSVideoAttributes = () => {\n const videoRecorders = document.querySelectorAll(\"uni-video-recorder\");\n videoRecorders.forEach((recorder) => {\n // Try to access shadow DOM and video elements\n try {\n const shadowRoot = recorder.shadowRoot;\n if (shadowRoot) {\n const videoElements = shadowRoot.querySelectorAll(\"video\");\n videoElements.forEach((video: HTMLVideoElement) => {\n video.setAttribute(\"playsinline\", \"true\");\n video.setAttribute(\"autoplay\", \"true\");\n video.setAttribute(\"muted\", \"true\");\n // Ensure video plays inline and autoplays\n video.playsInline = true;\n video.autoplay = true;\n video.muted = true;\n });\n }\n } catch (error) {\n console.log(\"Could not access shadow DOM:\", error);\n }\n\n // Also set attributes on the component itself\n recorder.setAttribute(\"playsinline\", \"true\");\n recorder.setAttribute(\"autoplay\", \"true\");\n recorder.setAttribute(\"muted\", \"true\");\n });\n };\n\n // Apply immediately and also after a delay to catch dynamically created elements\n addIOSVideoAttributes();\n const iosTimeout = setTimeout(addIOSVideoAttributes, 500);\n const iosInterval = setInterval(addIOSVideoAttributes, 1000);\n\n return () => {\n document.body.classList.remove(\"recording-selfie\");\n cleanupObserver();\n cleanup();\n clearTimeout(iosTimeout);\n clearInterval(iosInterval);\n };\n }\n\n return () => {\n document.body.classList.remove(\"recording-selfie\");\n cleanupObserver();\n cleanup();\n };\n }, [cleanup]);\n\n const recordStarting = () => {\n if (!recorderReady || recordingState !== \"idle\") return;\n onBeginCapture();\n updateRecordingState(\"preparing\");\n setDisableButton(true);\n\n const triggerCapture = async () => {\n try {\n await waitForVideoFrame(recorderRef.current);\n await delay(200);\n updateRecordingState(\"recording\");\n\n // Capture a frame from the live video during recording (after a short delay)\n setTimeout(() => {\n const videoElement = getRecorderVideoElement(recorderRef.current);\n if (videoElement) {\n const thumbnail = captureFrame(videoElement);\n capturedThumbnailRef.current = thumbnail;\n }\n }, 1000); // Capture frame 1 second into recording\n\n recorderRef.current?.capture();\n } catch (error) {\n console.error(\"SelfieRecorder: failed to capture frame\", error);\n updateRecordingState(\"idle\");\n setDisableButton(false);\n }\n };\n\n void triggerCapture();\n };\n\n useEffect(() => {\n const interval = setInterval(() => {\n const status = recorderRef.current?.sdkJsStatus;\n const isReady = status === \"ready\" || status === \"running\";\n setRecorderReady((prev) => (prev !== isReady ? isReady : prev));\n\n const previousStatus = lastRecorderStatusRef.current;\n const wasReady = previousStatus === \"ready\" || previousStatus === \"running\";\n if (status !== previousStatus) {\n lastRecorderStatusRef.current = status;\n if (isReady && previousStatus !== undefined && !wasReady) {\n resetCaptureControlsFromPolling(previousStatus);\n }\n }\n }, 500);\n return () => clearInterval(interval);\n }, [resetCaptureControlsFromPolling]);\n\n const handleRecorderReady = () => {\n setRecorderReady(true);\n resetCaptureControls();\n };\n\n const handleRecordInterrupted = () => {\n resetCaptureControls();\n };\n\n const handleRecordCompleted = (e: Event) => {\n const customEvent = e as CustomEvent<{ media?: Blob; metadata?: string }>;\n if (!customEvent.detail?.media || customEvent.detail.media.size === 0) {\n console.error(\"❌ No valid media captured\");\n\n // iOS-specific debugging\n if (isIOS()) {\n console.log(\"🍎 iOS detected - checking video elements for proper attributes\");\n const videoRecorders = document.querySelectorAll(\"uni-video-recorder\");\n videoRecorders.forEach((recorder, index) => {\n console.log(`VideoRecorder ${index}:`, {\n playsinline: recorder.getAttribute(\"playsinline\"),\n autoplay: recorder.getAttribute(\"autoplay\"),\n muted: recorder.getAttribute(\"muted\")\n });\n });\n }\n\n updateRecordingState(\"idle\");\n setDisableButton(false);\n return;\n }\n\n // Attach the captured thumbnail to the event\n const enhancedEvent = new CustomEvent('record-completed', {\n detail: {\n media: customEvent.detail.media,\n metadata: customEvent.detail.metadata || '',\n thumbnail: capturedThumbnailRef.current || undefined,\n }\n });\n\n updateRecordingState(\"processing\");\n handleSelfie(enhancedEvent);\n };\n\n return (\n <div\n className=\"selfie selfie-recorder-root notranslate flex flex-col\"\n translate=\"no\"\n style={{\n [\"--dk-btn-bg\" as string]: btnBg ?? \"#11E5C5\",\n [\"--dk-btn-text\" as string]: btnText ?? \"#3C3C40\",\n position: isMobile ? \"fixed\" : \"relative\",\n inset: isMobile ? 0 : \"auto\",\n zIndex: isMobile ? 50 : \"auto\",\n height: \"100%\",\n width: \"100%\",\n }}\n >\n <div className=\"p-4 text-center bg-white shrink-0\">\n <Title className=\"text-lg md:text-xl mb-1\">{t(\"selfie.recorder.title\")}</Title>\n <Subtitle className=\"text-xs text-gray-600 md:text-sm\">{t(\"selfie.recorder.subtitle\")}</Subtitle>\n </div>\n\n <div className=\"video-container flex-1 relative overflow-hidden\">\n <VideoRecorder\n ref={recorderRef}\n preset={AcquisitionPreset.SELFIE_OPTIMIZED}\n hideCaptureBtn\n faceChecker={(typeof window !== 'undefined' && window.__E2E_DISABLE_FACE_CHECKER__) ? 'disabled' : 'enabled'}\n disableDebugMode\n onRecorderReady={handleRecorderReady}\n onRecordInterrupted={handleRecordInterrupted}\n onRecordCompleted={handleRecordCompleted}\n style={{ width: \"100%\", height: \"100%\" }}\n className=\"video-recorder-no-radius notranslate w-full h-full\"\n {...(isIOS() && {\n \"data-playsinline\": \"true\",\n \"data-autoplay\": \"true\",\n \"data-muted\": \"true\"\n })}\n strings={getUnisseyStrings(t)}\n />\n </div>\n\n <div className=\"shrink-0 bg-white border-t border-gray-200 p-4 md:p-6 relative\" style={{ zIndex: 9999 }}>\n <div className=\"max-w-md mx-auto\">\n <div className=\"text-center text-xs text-gray-400 mt-3\">\n {t(\"selfie.recorder.note\")}\n </div>\n\n <Button\n onClick={recordStarting}\n className=\"w-full py-3 md:py-4 relative selfie-button\"\n disabled={disableButton || !recorderReady}\n style={{ backgroundColor: btnBg ?? \"#11E5C5\", color: btnText ?? \"#3C3C40\" }}\n >\n {recordingState === \"idle\" && t(\"selfie.recorder.start\")}\n {recordingState === \"preparing\" && t(\"selfie.recorder.preparing\")}\n {recordingState === \"recording\" && (\n <span className=\"flex items-center justify-center\">\n <span className=\"mr-2\">{t(\"selfie.recorder.recording_label\")}</span>\n <span className=\"flex space-x-1 loading-dots\">\n <span className=\"h-1 w-1 bg-white rounded-full\"></span>\n <span className=\"h-1 w-1 bg-white rounded-full\"></span>\n <span className=\"h-1 w-1 bg-white rounded-full\"></span>\n </span>\n </span>\n )}\n {recordingState === \"processing\" && t(\"selfie.recorder.processing\")}\n </Button>\n </div>\n </div>\n </div>\n );\n};\n\nexport default SelfieRecorder;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;AA+BA,IAAM,cAAc,GAAG,UAAC,EAKF,EAAA;;AAJpB,IAAA,IAAA,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,EAAA,GAAA,EAAA,CAAA,cAA0B,EAA1B,cAAc,GAAA,EAAA,KAAA,MAAA,GAAG,YAAA,EAAQ,CAAC,GAAA,EAAA,EAC1B,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,OAAO,GAAA,EAA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ACA,cAAc,KAAK,YAAY,IAAI,CAAC,CAAC,4BAA4B,CAAC,CAAA,EAAA,CAC5D,IACL,EAAA,CACF,CAAA,EAAA,CACF;AAEV;;;;"}
1
+ {"version":3,"file":"SelfieRecorder.js","sources":["../../../../../../src/components/selfie/selfie-flow/SelfieRecorder.tsx"],"sourcesContent":["import {\n useCallback,\n useMemo,\n useRef,\n useState,\n useEffect,\n type ElementRef,\n} from \"react\";\nimport {\n AcquisitionPreset,\n VideoRecorder,\n type IadConfig,\n} from \"@unissey-web/sdk-react\";\nimport Button from \"../../ui/Button\";\nimport Title from \"../../ui/Title\";\nimport Subtitle from \"../../ui/Subtitle\";\nimport useVideoRecorderStyles from \"../hooks/useVideoRecorderStyles\";\nimport { setupVideoElementsObserver } from \"../utils/videoElementStyles\";\nimport { delay, isIOS, waitForVideoFrame, getRecorderVideoElement } from \"../utils/selfieCaptureUtils\";\nimport { useLiveFrameCapture } from \"../hooks/useLiveFrameCapture\";\nimport { useI18n } from \"../../../hooks/useI18n\";\nimport useIsMobile from \"../../../hooks/useIsMobile\";\nimport { getUnisseyStrings } from \"../utils/unisseyStrings\";\nimport { prepareIadCapture } from \"../../../services/iadService\";\n\ntype RecordingState = \"idle\" | \"preparing\" | \"recording\" | \"processing\";\n\ninterface SelfieRecorderProps {\n handleSelfie: (e: Event) => void;\n onBeginCapture?: () => void;\n sessionId?: string;\n iad?: { enabled: boolean; level?: \"basic\" | \"reinforced\" };\n isCapturing?: boolean;\n btnBg?: string;\n btnText?: string;\n}\n\ntype VideoRecorderElement = ElementRef<typeof VideoRecorder>;\ntype VideoRecorderWithError = VideoRecorderElement & { error?: string };\n\n/** Préparation IAD mémorisée pour une session (donnée à usage unique). */\ntype PreparedIadSession = {\n sessionId: string;\n preparation?: IadConfig;\n};\n\nconst SelfieRecorder = ({\n handleSelfie,\n onBeginCapture = () => { },\n sessionId,\n iad,\n btnBg,\n btnText,\n}: SelfieRecorderProps) => {\n const { t } = useI18n();\n const isMobile = useIsMobile(768);\n const recorderRef = useRef<VideoRecorderElement | null>(null);\n const [disableButton, setDisableButton] = useState(false);\n const [recorderReady, setRecorderReady] = useState(false);\n const [recordingState, setRecordingState] = useState<RecordingState>(\"idle\");\n const [iadConfig, setIadConfig] = useState<IadConfig>();\n const [iadPreparationDone, setIadPreparationDone] = useState(\n iad?.enabled !== true,\n );\n const [captureError, setCaptureError] = useState<string>();\n /**\n * Préparation IAD déjà demandée pour une session, avec son résultat.\n * `preparation` reste indéfini tant que la requête n'a pas abouti.\n */\n const preparedSessionRef = useRef<PreparedIadSession>();\n const recordingStateRef = useRef<RecordingState>(\"idle\");\n const lastRecorderStatusRef = useRef<string | undefined>();\n const capturedThumbnailRef = useRef<string | null>(null);\n const { captureFrame, cleanup } = useLiveFrameCapture();\n\n useVideoRecorderStyles(btnBg, btnText);\n\n useEffect(() => {\n let cancelled = false;\n\n if (iad?.enabled !== true || !sessionId) {\n setIadConfig(undefined);\n setIadPreparationDone(true);\n return () => {\n cancelled = true;\n };\n }\n\n /**\n * La donnée de préparation est à USAGE UNIQUE : une seconde requête invalide\n * la première et provoque des suspicions d'injection systématiques (doc\n * Unissey, « False rejections possible root causes »). On ne prépare donc\n * qu'une fois par session — ce garde neutralise aussi le double montage du\n * StrictMode en développement.\n */\n /**\n * La préparation est mémorisée par session : on ne redemande pas de donnée\n * (usage unique côté Unissey), mais on réapplique le résultat déjà obtenu.\n *\n * C'est indispensable avec le double montage du StrictMode : au premier\n * montage la requête part puis le démontage annule l'application du\n * résultat ; sans réapplication ici, `iadPreparationDone` resterait\n * définitivement `false` et le recorder ne serait jamais monté.\n */\n const cached = preparedSessionRef.current;\n if (cached?.sessionId === sessionId) {\n if (cached.preparation) setIadConfig(cached.preparation);\n setIadPreparationDone(true);\n return () => {\n cancelled = true;\n };\n }\n\n const entry: PreparedIadSession = { sessionId };\n preparedSessionRef.current = entry;\n\n setIadConfig(undefined);\n setIadPreparationDone(false);\n void prepareIadCapture(sessionId)\n .then((preparation) => {\n const config: IadConfig = {\n mode: preparation.mode,\n data: preparation.data,\n };\n // Mémorisé même si ce montage est annulé : le montage suivant le\n // réappliquera sans consommer une nouvelle donnée.\n entry.preparation = config;\n if (!cancelled) setIadConfig(config);\n })\n .catch((error: unknown) => {\n // Seul le message est loggué : l'objet d'erreur Axios embarque la\n // requête (en-têtes d'authentification, URL avec identifiant de session).\n console.warn(\n \"[IAD prepare failed]\",\n error instanceof Error ? error.message : \"unknown error\",\n );\n // Fail open for capture: the backend will keep the IAD verdict\n // inconclusive if a trustworthy signal cannot be produced.\n // Aucune donnée n'a été consommée : on libère le garde pour permettre\n // une nouvelle tentative au prochain montage.\n if (preparedSessionRef.current === entry) {\n preparedSessionRef.current = undefined;\n }\n })\n .finally(() => {\n // Volontairement sans garde `cancelled` : le drapeau doit passer à\n // `true` même si ce montage est annulé, sinon le recorder reste bloqué.\n setIadPreparationDone(true);\n });\n\n return () => {\n cancelled = true;\n };\n }, [iad?.enabled, sessionId]);\n\n /**\n * La prop `config` doit être STABLE entre les rendus.\n *\n * `VideoRecorder` est un web-component Lit : un nouvel objet à chaque rendu\n * est vu comme une prop modifiée, ce qui réinitialise le recorder — il\n * recharge alors ses modules WASM et redemande une préparation IAD, en\n * boucle. Sans ce mémo, l'écran de capture ne devient jamais prêt.\n */\n /**\n * L'IAD est-elle attendue pour cette capture ET techniquement obtenable ?\n *\n * Sert à retarder le montage du recorder jusqu'à ce que `iadConfig` soit\n * prête. Repasse à `false` si la préparation a échoué (`preparedSessionRef`\n * libéré par le `catch`) : la capture démarre alors sans IAD plutôt que de\n * rester bloquée — le backend produira un verdict `inconclusive`.\n */\n const recorderConfig = useMemo(\n () => (iadConfig ? { iadConfig } : undefined),\n [iadConfig],\n );\n\n const updateRecordingState = useCallback((state: RecordingState) => {\n recordingStateRef.current = state;\n setRecordingState(state);\n }, []);\n\n const resetCaptureControls = useCallback(() => {\n capturedThumbnailRef.current = null;\n updateRecordingState(\"idle\");\n setDisableButton(false);\n }, [updateRecordingState]);\n\n // Réinitialisation déclenchée par le polling de statut Unissey.\n // Pendant une capture en cours (preparing/recording/processing), les transitions\n // internes du cycle d'enregistrement (starting → running → ready) ne doivent PAS\n // réactiver le bouton. Seule une perte réelle de la caméra (passage par\n // \"no-session\") justifie un reset pendant la capture (scénario retry caméra).\n const resetCaptureControlsFromPolling = useCallback(\n (previousStatus: string | undefined) => {\n if (\n recordingStateRef.current !== \"idle\" &&\n previousStatus !== \"no-session\"\n ) {\n return;\n }\n resetCaptureControls();\n },\n [resetCaptureControls]\n );\n\n useEffect(() => {\n document.body.classList.add(\"recording-selfie\");\n const cleanupObserver = setupVideoElementsObserver();\n\n // iOS-specific fix: Add required attributes to video elements after mount\n if (isIOS()) {\n const addIOSVideoAttributes = () => {\n const videoRecorders = document.querySelectorAll(\"uni-video-recorder\");\n videoRecorders.forEach((recorder) => {\n // Try to access shadow DOM and video elements\n try {\n const shadowRoot = recorder.shadowRoot;\n if (shadowRoot) {\n const videoElements = shadowRoot.querySelectorAll(\"video\");\n videoElements.forEach((video: HTMLVideoElement) => {\n video.setAttribute(\"playsinline\", \"true\");\n video.setAttribute(\"autoplay\", \"true\");\n video.setAttribute(\"muted\", \"true\");\n // Ensure video plays inline and autoplays\n video.playsInline = true;\n video.autoplay = true;\n video.muted = true;\n });\n }\n } catch (error) {\n console.log(\"Could not access shadow DOM:\", error);\n }\n\n // Also set attributes on the component itself\n recorder.setAttribute(\"playsinline\", \"true\");\n recorder.setAttribute(\"autoplay\", \"true\");\n recorder.setAttribute(\"muted\", \"true\");\n });\n };\n\n // Apply immediately and also after a delay to catch dynamically created elements\n addIOSVideoAttributes();\n const iosTimeout = setTimeout(addIOSVideoAttributes, 500);\n const iosInterval = setInterval(addIOSVideoAttributes, 1000);\n\n return () => {\n document.body.classList.remove(\"recording-selfie\");\n cleanupObserver();\n cleanup();\n clearTimeout(iosTimeout);\n clearInterval(iosInterval);\n };\n }\n\n return () => {\n document.body.classList.remove(\"recording-selfie\");\n cleanupObserver();\n cleanup();\n };\n }, [cleanup]);\n\n // Les traducteurs automatiques (Safari iOS notamment) réécrivent le DOM et\n // détruisent les marqueurs de template Lit du web component Unissey : la capture\n // ne redémarre alors plus jamais. React sérialise `translate` en propriété DOM sur\n // un custom element (d'où un translate=\"yes\" parasite), il faut poser l'attribut\n // impérativement. Le recorder n'étant monté qu'une fois la préparation IAD\n // terminée, l'attribut est posé à ce moment-là (et non au montage du composant).\n useEffect(() => {\n if (!iadPreparationDone) return;\n document\n .querySelectorAll(\"uni-video-recorder\")\n .forEach((el) => el.setAttribute(\"translate\", \"no\"));\n }, [iadPreparationDone]);\n\n const recordStarting = () => {\n if (!recorderReady || recordingState !== \"idle\") return;\n onBeginCapture();\n setCaptureError(undefined);\n updateRecordingState(\"preparing\");\n setDisableButton(true);\n\n const triggerCapture = async () => {\n try {\n await waitForVideoFrame(recorderRef.current);\n await delay(200);\n updateRecordingState(\"recording\");\n\n // Capture a frame from the live video during recording (after a short delay)\n setTimeout(() => {\n const videoElement = getRecorderVideoElement(recorderRef.current);\n if (videoElement) {\n const thumbnail = captureFrame(videoElement);\n capturedThumbnailRef.current = thumbnail;\n }\n }, 1000); // Capture frame 1 second into recording\n\n recorderRef.current?.capture();\n } catch (error) {\n console.error(\"SelfieRecorder: failed to capture frame\", error);\n updateRecordingState(\"idle\");\n setDisableButton(false);\n }\n };\n\n void triggerCapture();\n };\n\n useEffect(() => {\n const interval = setInterval(() => {\n const status = recorderRef.current?.sdkJsStatus;\n const isReady = status === \"ready\" || status === \"running\";\n setRecorderReady((prev) => (prev !== isReady ? isReady : prev));\n\n const previousStatus = lastRecorderStatusRef.current;\n const wasReady = previousStatus === \"ready\" || previousStatus === \"running\";\n if (status !== previousStatus) {\n lastRecorderStatusRef.current = status;\n if (isReady && previousStatus !== undefined && !wasReady) {\n resetCaptureControlsFromPolling(previousStatus);\n }\n }\n }, 500);\n return () => clearInterval(interval);\n }, [resetCaptureControlsFromPolling]);\n\n const handleRecorderReady = () => {\n setCaptureError(undefined);\n setRecorderReady(true);\n resetCaptureControls();\n };\n\n const handleRecordInterrupted = () => {\n const recorderError = (recorderRef.current as VideoRecorderWithError | null)?.error;\n setCaptureError(\n recorderError || t(\"unissey.forbiddenActionMessages.default\"),\n );\n resetCaptureControls();\n };\n\n const handleRecordCompleted = (e: Event) => {\n const customEvent = e as CustomEvent<{ media?: Blob; metadata?: string }>;\n if (!customEvent.detail?.media || customEvent.detail.media.size === 0) {\n console.error(\"❌ No valid media captured\");\n\n // iOS-specific debugging\n if (isIOS()) {\n console.log(\"🍎 iOS detected - checking video elements for proper attributes\");\n const videoRecorders = document.querySelectorAll(\"uni-video-recorder\");\n videoRecorders.forEach((recorder, index) => {\n console.log(`VideoRecorder ${index}:`, {\n playsinline: recorder.getAttribute(\"playsinline\"),\n autoplay: recorder.getAttribute(\"autoplay\"),\n muted: recorder.getAttribute(\"muted\")\n });\n });\n }\n\n updateRecordingState(\"idle\");\n setDisableButton(false);\n return;\n }\n\n // Attach the captured thumbnail to the event\n const enhancedEvent = new CustomEvent('record-completed', {\n detail: {\n media: customEvent.detail.media,\n metadata: customEvent.detail.metadata || '',\n thumbnail: capturedThumbnailRef.current || undefined,\n }\n });\n\n updateRecordingState(\"processing\");\n handleSelfie(enhancedEvent);\n };\n\n return (\n <div\n className=\"selfie selfie-recorder-root notranslate flex flex-col\"\n translate=\"no\"\n style={{\n [\"--dk-btn-bg\" as string]: btnBg ?? \"#11E5C5\",\n [\"--dk-btn-text\" as string]: btnText ?? \"#3C3C40\",\n position: isMobile ? \"fixed\" : \"relative\",\n inset: isMobile ? 0 : \"auto\",\n zIndex: isMobile ? 50 : \"auto\",\n height: \"100%\",\n width: \"100%\",\n }}\n >\n <div className=\"p-4 text-center bg-white shrink-0\">\n <Title className=\"text-lg md:text-xl mb-1\">{t(\"selfie.recorder.title\")}</Title>\n <Subtitle className=\"text-xs text-gray-600 md:text-sm\">{t(\"selfie.recorder.subtitle\")}</Subtitle>\n </div>\n\n <div className=\"video-container flex-1 relative overflow-hidden\">\n {/* Le recorder ne doit monter QU'UNE FOIS la config IAD disponible.\n Unissey réinitialise sa session interne dès que la prop `config`\n change (`updated()` → `callInitSession()`). Monter sans config puis\n l'injecter créerait une première session SANS IAD — donc sans\n `selfie-metadata` — avant de la recréer. On attend donc que la\n préparation soit terminée ET, quand l'IAD est active, que sa config\n soit prête. */}\n {iadPreparationDone && (\n <VideoRecorder\n ref={recorderRef}\n preset={AcquisitionPreset.SELFIE_OPTIMIZED}\n hideCaptureBtn\n faceChecker={\n typeof window !== \"undefined\" &&\n window.__E2E_DISABLE_FACE_CHECKER__\n ? \"disabled\"\n : \"enabled\"\n }\n disableDebugMode\n {...(recorderConfig ? { config: recorderConfig } : {})}\n onRecorderReady={handleRecorderReady}\n onRecordInterrupted={handleRecordInterrupted}\n onRecordCompleted={handleRecordCompleted}\n style={{ width: \"100%\", height: \"100%\" }}\n className=\"video-recorder-no-radius notranslate w-full h-full\"\n {...(isIOS() && {\n \"data-playsinline\": \"true\",\n \"data-autoplay\": \"true\",\n \"data-muted\": \"true\",\n })}\n strings={getUnisseyStrings(t)}\n />\n )}\n </div>\n\n {captureError && (\n <div role=\"alert\" className=\"shrink-0 bg-red-50 px-4 py-2 text-center text-sm text-red-700\">\n {captureError}\n </div>\n )}\n\n <div className=\"shrink-0 bg-white border-t border-gray-200 p-4 md:p-6 relative\" style={{ zIndex: 9999 }}>\n <div className=\"max-w-md mx-auto\">\n <div className=\"text-center text-xs text-gray-400 mt-3\">\n {t(\"selfie.recorder.note\")}\n </div>\n\n <Button\n onClick={recordStarting}\n className=\"w-full py-3 md:py-4 relative selfie-button\"\n disabled={disableButton || !recorderReady}\n style={{ backgroundColor: btnBg ?? \"#11E5C5\", color: btnText ?? \"#3C3C40\" }}\n >\n {recordingState === \"idle\" && t(\"selfie.recorder.start\")}\n {recordingState === \"preparing\" && t(\"selfie.recorder.preparing\")}\n {recordingState === \"recording\" && (\n <span className=\"flex items-center justify-center\">\n <span className=\"mr-2\">{t(\"selfie.recorder.recording_label\")}</span>\n <span className=\"flex space-x-1 loading-dots\">\n <span className=\"h-1 w-1 bg-white rounded-full\"></span>\n <span className=\"h-1 w-1 bg-white rounded-full\"></span>\n <span className=\"h-1 w-1 bg-white rounded-full\"></span>\n </span>\n </span>\n )}\n {recordingState === \"processing\" && t(\"selfie.recorder.processing\")}\n </Button>\n </div>\n </div>\n </div>\n );\n};\n\nexport default SelfieRecorder;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;AA8CA,IAAM,cAAc,GAAG,UAAC,EAOF,EAAA;;QANpB,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,EAAA,GAAA,EAAA,CAAA,cAA0B,EAA1B,cAAc,GAAA,EAAA,KAAA,MAAA,GAAG,YAAA,EAAQ,CAAC,GAAA,EAAA,EAC1B,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,GAAG,GAAA,EAAA,CAAA,GAAA,EACH,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,OAAO,GAAA,EAAA,CAAA,OAAA;AAEC,IAAA,IAAA,CAAC,GAAK,OAAO,EAAE,EAAd;AACT,IAAA,IAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC;AACjC,IAAA,IAAM,WAAW,GAAG,MAAM,CAA8B,IAAI,CAAC;IACvD,IAAA,EAAA,GAAoC,QAAQ,CAAC,KAAK,CAAC,EAAlD,aAAa,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,gBAAgB,GAAA,EAAA,CAAA,CAAA,CAAmB;IACnD,IAAA,EAAA,GAAoC,QAAQ,CAAC,KAAK,CAAC,EAAlD,aAAa,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,gBAAgB,GAAA,EAAA,CAAA,CAAA,CAAmB;IACnD,IAAA,EAAA,GAAsC,QAAQ,CAAiB,MAAM,CAAC,EAArE,cAAc,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,iBAAiB,GAAA,EAAA,CAAA,CAAA,CAAoC;IACtE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@ var Selfie = function (_a) {
45
45
  var handleRetakeSelfie = function () {
46
46
  setInternalStep(0);
47
47
  };
48
- return (jsxs("div", { className: "h-full w-full transition-opacity duration-500 ".concat(isTransitioning ? "opacity-50" : "opacity-100"), children: [internalStep === 0 && (jsx(Video, { setSelfieData: setSelfieData, setStep: setInternalStep, btnBg: (_b = template.buttonBgColor) !== null && _b !== void 0 ? _b : "#11E5C5", btnText: (_c = template.buttonTextColor) !== null && _c !== void 0 ? _c : "#3C3C40" })), internalStep === 1 && selfieData && (jsx(SelfieConfirmation, { selfieData: selfieData, onConfirm: handleConfirmSelfie, onRetake: handleRetakeSelfie, setSelfiePhoto: setSelfiePhoto })), internalStep === 2 && selfieData && (jsx(SelfieProcessing, { onProcessingComplete: selfieProcessed, selfieVideo: selfieData, selfiePhoto: selfiePhoto, onRetake: onRetake, nodeId: node.id, onContinueAnyway: node.allowContinueOnFailure === false
48
+ return (jsxs("div", { className: "h-full w-full transition-opacity duration-500 ".concat(isTransitioning ? "opacity-50" : "opacity-100"), children: [internalStep === 0 && (jsx(Video, { setSelfieData: setSelfieData, setStep: setInternalStep, sessionId: sessionId, iad: node.iad, btnBg: (_b = template.buttonBgColor) !== null && _b !== void 0 ? _b : "#11E5C5", btnText: (_c = template.buttonTextColor) !== null && _c !== void 0 ? _c : "#3C3C40" })), internalStep === 1 && selfieData && (jsx(SelfieConfirmation, { selfieData: selfieData, onConfirm: handleConfirmSelfie, onRetake: handleRetakeSelfie, setSelfiePhoto: setSelfiePhoto })), internalStep === 2 && selfieData && (jsx(SelfieProcessing, { onProcessingComplete: selfieProcessed, selfieVideo: selfieData, selfiePhoto: selfiePhoto, onRetake: onRetake, nodeId: node.id, onContinueAnyway: node.allowContinueOnFailure === false
49
49
  ? undefined
50
50
  : handleContinueAnyway }))] }));
51
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Selfie.js","sources":["../../../../../src/components/session/Selfie.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport {\n SessionTemplate,\n SessionTemplateNode,\n stepObject,\n} from \"../../types/session\";\nimport Video from \"../selfie/Video\";\nimport SelfieConfirmation from \"../selfie/SelfieConfirmation\";\nimport type { SelfieCaptureData } from \"../../types/selfie\";\nimport SelfieProcessing from \"../selfie/selfie-flow/SelfieProcessing\";\nimport { reportSelfieFailure } from \"../../services/sessionService\";\n\n/**\n * Composant de gestion du flux selfie.\n * Gère les étapes internes de capture et confirmation du selfie.\n */\nconst Selfie = ({\n stepObject,\n sessionId,\n node,\n template,\n}: {\n stepObject: stepObject;\n sessionId: string;\n node: SessionTemplateNode;\n template: SessionTemplate;\n}) => {\n const [internalStep, setInternalStep] = useState(0);\n const [selfieData, setSelfieData] = useState<SelfieCaptureData | null>(null);\n const [selfiePhoto, setSelfiePhoto] = useState<string | null>(null);\n const [isTransitioning, setIsTransitioning] = useState(false);\n\n const handleConfirmSelfie = () => {\n // Ajouter une transition visuelle avant de passer à l'étape suivante\n setIsTransitioning(true);\n\n // Attendre un peu pour l'animation avant de passer à l'étape suivante\n setTimeout(() => {\n setInternalStep(2); // Passer à l'étape de traitement du selfie\n setIsTransitioning(false);\n }, 500);\n };\n\n const selfieProcessed = (processed: boolean) => {\n // Callback pour indiquer que le selfie a été traité\n if (processed) {\n stepObject.goToNextStepCommitted(node.id, template);\n }\n };\n\n const handleContinueAnyway = () => {\n void reportSelfieFailure(sessionId, {\n nodeId: node.id,\n reason: \"user_bypassed\",\n bypassed: true,\n }).catch(() => undefined);\n stepObject.goToNextStepCommitted(node.id, template);\n };\n\n const onRetake = () => {\n setInternalStep(0);\n };\n\n const handleRetakeSelfie = () => {\n setInternalStep(0);\n };\n\n return (\n <div\n className={`h-full w-full transition-opacity duration-500 ${isTransitioning ? \"opacity-50\" : \"opacity-100\"\n }`}\n >\n {internalStep === 0 && (\n <Video\n setSelfieData={setSelfieData}\n setStep={setInternalStep}\n btnBg={template.buttonBgColor ?? \"#11E5C5\"}\n btnText={template.buttonTextColor ?? \"#3C3C40\"}\n />\n )}\n {internalStep === 1 && selfieData && (\n <SelfieConfirmation\n selfieData={selfieData}\n onConfirm={handleConfirmSelfie}\n onRetake={handleRetakeSelfie}\n setSelfiePhoto={setSelfiePhoto}\n />\n )}\n {internalStep === 2 && selfieData && (\n <SelfieProcessing\n onProcessingComplete={selfieProcessed}\n selfieVideo={selfieData}\n selfiePhoto={selfiePhoto}\n onRetake={onRetake}\n nodeId={node.id}\n onContinueAnyway={\n node.allowContinueOnFailure === false\n ? undefined\n : handleContinueAnyway\n }\n />\n )}\n </div>\n );\n};\n\nexport default Selfie;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;AAYA;;;AAGG;AACH,IAAM,MAAM,GAAG,UAAC,EAUf,EAAA;;QATC,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,QAAQ,GAAA,EAAA,CAAA,QAAA;IAOF,IAAA,EAAA,GAAkC,QAAQ,CAAC,CAAC,CAAC,EAA5C,YAAY,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,eAAe,GAAA,EAAA,CAAA,CAAA,CAAe;IAC7C,IAAA,EAAA,GAA8B,QAAQ,CAA2B,IAAI,CAAC,EAArE,UAAU,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,aAAa,GAAA,EAAA,CAAA,CAAA,CAA4C;IACtE,IAAA,EAAA,GAAgC,QAAQ,CAAgB,IAAI,CAAC,EAA5D,WAAW,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,cAAc,GAAA,EAAA,CAAA,CAAA,CAAiC;IAC7D,IAAA,EAAA,GAAwC,QAAQ,CAAC,KAAK,CAAC,EAAtD,eAAe,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,kBAAkB,GAAA,EAAA,CAAA,CAAA,CAAmB;AAE7D,IAAA,IAAM,mBAAmB,GAAG,YAAA;;QAE1B,kBAAkB,CAAC,IAAI,CAAC;;AAGxB,QAAA,UAAU,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,KAAA,MAAA,GAAA,EAAA,GAAI,SAAS,EAAA,CAC9C,CACH,EACA,YAAY,KAAK,CAAC,IAAI,UAAU,KAC/BA,IAAC,kBAAkB,EAAA,EACjB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAAA,CAC9B,CACH,EACA,YAAY,KAAK,CAAC,IAAI,UAAU,KAC/BA,GAAA,CAAC,gBAAgB,IACf,oBAAoB,EAAE,eAAe,EACrC,WAAW,EAAE,UAAU,EACvB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,IAAI,CAAC,EAAE,EACf,gBAAgB,EACd,IAAI,CAAC,sBAAsB,KAAK;AAC9B,sBAAE;AACF,sBAAE,oBAAoB,EAAA,CAE1B,CACH,CAAA,EAAA,CACG;AAEV;;;;"}
1
+ {"version":3,"file":"Selfie.js","sources":["../../../../../src/components/session/Selfie.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport {\n SessionTemplate,\n SessionTemplateNode,\n stepObject,\n} from \"../../types/session\";\nimport Video from \"../selfie/Video\";\nimport SelfieConfirmation from \"../selfie/SelfieConfirmation\";\nimport type { SelfieCaptureData } from \"../../types/selfie\";\nimport SelfieProcessing from \"../selfie/selfie-flow/SelfieProcessing\";\nimport { reportSelfieFailure } from \"../../services/sessionService\";\n\n/**\n * Composant de gestion du flux selfie.\n * Gère les étapes internes de capture et confirmation du selfie.\n */\nconst Selfie = ({\n stepObject,\n sessionId,\n node,\n template,\n}: {\n stepObject: stepObject;\n sessionId: string;\n node: SessionTemplateNode;\n template: SessionTemplate;\n}) => {\n const [internalStep, setInternalStep] = useState(0);\n const [selfieData, setSelfieData] = useState<SelfieCaptureData | null>(null);\n const [selfiePhoto, setSelfiePhoto] = useState<string | null>(null);\n const [isTransitioning, setIsTransitioning] = useState(false);\n\n const handleConfirmSelfie = () => {\n // Ajouter une transition visuelle avant de passer à l'étape suivante\n setIsTransitioning(true);\n\n // Attendre un peu pour l'animation avant de passer à l'étape suivante\n setTimeout(() => {\n setInternalStep(2); // Passer à l'étape de traitement du selfie\n setIsTransitioning(false);\n }, 500);\n };\n\n const selfieProcessed = (processed: boolean) => {\n // Callback pour indiquer que le selfie a été traité\n if (processed) {\n stepObject.goToNextStepCommitted(node.id, template);\n }\n };\n\n const handleContinueAnyway = () => {\n void reportSelfieFailure(sessionId, {\n nodeId: node.id,\n reason: \"user_bypassed\",\n bypassed: true,\n }).catch(() => undefined);\n stepObject.goToNextStepCommitted(node.id, template);\n };\n\n const onRetake = () => {\n setInternalStep(0);\n };\n\n const handleRetakeSelfie = () => {\n setInternalStep(0);\n };\n\n return (\n <div\n className={`h-full w-full transition-opacity duration-500 ${isTransitioning ? \"opacity-50\" : \"opacity-100\"\n }`}\n >\n {internalStep === 0 && (\n <Video\n setSelfieData={setSelfieData}\n setStep={setInternalStep}\n sessionId={sessionId}\n iad={node.iad}\n btnBg={template.buttonBgColor ?? \"#11E5C5\"}\n btnText={template.buttonTextColor ?? \"#3C3C40\"}\n />\n )}\n {internalStep === 1 && selfieData && (\n <SelfieConfirmation\n selfieData={selfieData}\n onConfirm={handleConfirmSelfie}\n onRetake={handleRetakeSelfie}\n setSelfiePhoto={setSelfiePhoto}\n />\n )}\n {internalStep === 2 && selfieData && (\n <SelfieProcessing\n onProcessingComplete={selfieProcessed}\n selfieVideo={selfieData}\n selfiePhoto={selfiePhoto}\n onRetake={onRetake}\n nodeId={node.id}\n onContinueAnyway={\n node.allowContinueOnFailure === false\n ? undefined\n : handleContinueAnyway\n }\n />\n )}\n </div>\n );\n};\n\nexport default Selfie;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;AAYA;;;AAGG;AACH,IAAM,MAAM,GAAG,UAAC,EAUf,EAAA;;QATC,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,IAAI,GAAA,EAAA,CAAA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AI,CAAC,sBAAsB,KAAK;AAC9B,sBAAE;AACF,sBAAE,oBAAoB,EAAA,CAE1B,CACH,CAAA,EAAA,CACG;AAEV;;;;"}
@@ -128,7 +128,8 @@ var user_guidance = {
128
128
  "2.1": "The photo is not clear. Avoid any blur or reflection",
129
129
  "2.2": "The photo is not clear. Avoid any blur or reflection",
130
130
  "2.4": "The photo is not clear. Avoid any blur or reflection",
131
- "2.6": "The document submitted is not the expected one"
131
+ "2.6": "The document submitted is not the expected one",
132
+ QUOTA_EXCEEDED: "Your organisation has reached its verification quota. Please try again later or contact the organisation that sent you this link."
132
133
  };
133
134
  var validation_points = {
134
135
  "1.0": {
@@ -1 +1 @@
1
- {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -128,7 +128,8 @@ var user_guidance = {
128
128
  "2.1": "La foto no es clara. Evita desenfoques y reflejos",
129
129
  "2.2": "La foto no es clara. Evita desenfoques y reflejos",
130
130
  "2.4": "La foto no es clara. Evita desenfoques y reflejos",
131
- "2.6": "El documento enviado no es el esperado"
131
+ "2.6": "El documento enviado no es el esperado",
132
+ QUOTA_EXCEEDED: "Su organización ha alcanzado su cuota de verificaciones. Inténtelo de nuevo más tarde o póngase en contacto con la organización que le envió este enlace."
132
133
  };
133
134
  var validation_points = {
134
135
  "1.0": {
@@ -1 +1 @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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -128,7 +128,8 @@ var user_guidance = {
128
128
  "2.1": "La photo n'est pas nette. Évitez tout flou ou reflet",
129
129
  "2.2": "La photo n'est pas nette. Évitez tout flou ou reflet",
130
130
  "2.4": "La photo n'est pas nette. Évitez tout flou ou reflet",
131
- "2.6": "Le document déposé n'est pas celui attendu"
131
+ "2.6": "Le document déposé n'est pas celui attendu",
132
+ QUOTA_EXCEEDED: "Le quota de vérifications de votre organisation est atteint. Veuillez réessayer plus tard ou contacter l'organisation qui vous a envoyé ce lien."
132
133
  };
133
134
  var validation_points = {
134
135
  "1.0": {
@@ -1 +1 @@
1
- {"version":3,"file":"fr.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -273,28 +273,30 @@ function analyzeFiles(sessionId_1, nodeId_1, files_1, documentTypeId_1) {
273
273
  }
274
274
  function analyzeSelfie(sessionId, selfieFile, selfiePhoto, nodeId) {
275
275
  return __awaiter(this, void 0, void 0, function () {
276
- var formData, response, unisseyResponse, unisseyData, faceComparison, isHighConfidence, isMatch, isGenuine, analysisResponse, err_1, errorMessage, error_3;
277
- var _a, _b, _c, _d;
278
- return __generator(this, function (_e) {
279
- switch (_e.label) {
276
+ var formData, response, unisseyResponse, unisseyData, faceComparison, faceComparisonDisabled, isHighConfidence, isMatch, isGenuine, analysisResponse, err_1, errorMessage, error_3;
277
+ var _a, _b, _c, _d, _e;
278
+ return __generator(this, function (_f) {
279
+ switch (_f.label) {
280
280
  case 0:
281
281
  console.log("🤳 Starting selfie analysis for session:", sessionId);
282
282
  console.log("� File size:", selfieFile.media.size, "bytes");
283
283
  formData = new FormData();
284
284
  formData.append("file", selfieFile.media, "selfie.mp4");
285
285
  formData.append("photo", selfiePhoto);
286
+ if ((_a = selfieFile.metadata) === null || _a === void 0 ? void 0 : _a.trim()) {
287
+ formData.append("selfie-metadata", selfieFile.metadata);
288
+ }
286
289
  if (nodeId)
287
290
  formData.append("nodeId", nodeId);
288
- _e.label = 1;
291
+ _f.label = 1;
289
292
  case 1:
290
- _e.trys.push([1, 13, , 14]);
293
+ _f.trys.push([1, 13, , 14]);
291
294
  console.log("🚀 Sending selfie to UNISSEY API...");
292
295
  return [4 /*yield*/, apiService.post("/session/unissey/".concat(sessionId, "/analyze"), formData, {
293
296
  timeout: SELFIE_ANALYSIS_TIMEOUT,
294
297
  })];
295
298
  case 2:
296
- response = _e.sent();
297
- console.log("✅ Analysis response:", response);
299
+ response = _f.sent();
298
300
  if (!(response.success && response.data)) return [3 /*break*/, 12];
299
301
  console.log("🎉 Unissey analysis completed - checking results...");
300
302
  unisseyResponse = response.data;
@@ -303,40 +305,52 @@ function analyzeSelfie(sessionId, selfieFile, selfiePhoto, nodeId) {
303
305
  unisseyResponse.message === "ok"))) return [3 /*break*/, 11];
304
306
  console.log("✅ Unissey returned success status");
305
307
  unisseyData = unisseyResponse.data;
306
- faceComparison = (_a = unisseyData.details) === null || _a === void 0 ? void 0 : _a.face_comparison;
308
+ faceComparison = (_b = unisseyData.details) === null || _b === void 0 ? void 0 : _b.face_comparison;
309
+ faceComparisonDisabled = unisseyData.face_comparison_disabled === true;
307
310
  isHighConfidence = (faceComparison === null || faceComparison === void 0 ? void 0 : faceComparison.confidence_level) === "high";
308
- isMatch = unisseyData.is_match && (faceComparison === null || faceComparison === void 0 ? void 0 : faceComparison.result) === "match";
309
- isGenuine = isHighConfidence && isMatch;
310
- _e.label = 3;
311
+ isMatch = !faceComparisonDisabled &&
312
+ unisseyData.is_match && (faceComparison === null || faceComparison === void 0 ? void 0 : faceComparison.result) === "match";
313
+ isGenuine = faceComparisonDisabled
314
+ ? unisseyData.is_genuine !== false
315
+ : isHighConfidence && isMatch;
316
+ _f.label = 3;
311
317
  case 3:
312
- _e.trys.push([3, 9, , 10]);
318
+ _f.trys.push([3, 9, , 10]);
313
319
  return [4 /*yield*/, apiService.get("/session/sdk/".concat(sessionId))];
314
320
  case 4:
315
- analysisResponse = _e.sent();
321
+ analysisResponse = _f.sent();
316
322
  if (!(analysisResponse.data && analysisResponse.data.analysisId)) return [3 /*break*/, 8];
317
323
  return [4 /*yield*/, logSelfieCaptured(sessionId, analysisResponse.data.clientInfoId || undefined)];
318
324
  case 5:
319
- _e.sent();
325
+ _f.sent();
320
326
  // Log AI control with selfie analysis results
321
327
  return [4 /*yield*/, logAiControlled(sessionId, {
322
328
  selfieAnalysisResult: isGenuine ? "genuine" : "not_genuine",
323
- isMatch: isMatch ? "match" : "no_match",
329
+ isMatch: faceComparisonDisabled
330
+ ? "not_performed"
331
+ : isMatch
332
+ ? "match"
333
+ : "no_match",
324
334
  confidenceLevel: (faceComparison === null || faceComparison === void 0 ? void 0 : faceComparison.confidence_level) || "unknown",
325
335
  }, analysisResponse.data.clientInfoId || undefined)];
326
336
  case 6:
327
337
  // Log AI control with selfie analysis results
328
- _e.sent();
338
+ _f.sent();
329
339
  return [4 /*yield*/, logStatusModified(sessionId, {
330
340
  selfieAnalysisResult: isGenuine ? "genuine" : "not_genuine",
331
- isMatch: isMatch ? "match" : "no_match",
341
+ isMatch: faceComparisonDisabled
342
+ ? "not_performed"
343
+ : isMatch
344
+ ? "match"
345
+ : "no_match",
332
346
  confidenceLevel: (faceComparison === null || faceComparison === void 0 ? void 0 : faceComparison.confidence_level) || "unknown",
333
347
  }, analysisResponse.data.clientInfoId || undefined)];
334
348
  case 7:
335
- _e.sent();
336
- _e.label = 8;
349
+ _f.sent();
350
+ _f.label = 8;
337
351
  case 8: return [3 /*break*/, 10];
338
352
  case 9:
339
- err_1 = _e.sent();
353
+ err_1 = _f.sent();
340
354
  console.error("Failed to log selfie capture in audit trail:", err_1);
341
355
  return [3 /*break*/, 10];
342
356
  case 10:
@@ -349,14 +363,14 @@ function analyzeSelfie(sessionId, selfieFile, selfiePhoto, nodeId) {
349
363
  console.error("❌ Unissey returned error status:", unisseyResponse.status, unisseyResponse.message);
350
364
  throw new Error("Unissey analysis failed: ".concat(unisseyResponse.message || "Unknown Unissey error"));
351
365
  case 12:
352
- errorMessage = ((_b = response.data) === null || _b === void 0 ? void 0 : _b.message) || response.data || "Unknown error";
366
+ errorMessage = ((_c = response.data) === null || _c === void 0 ? void 0 : _c.message) || response.data || "Unknown error";
353
367
  console.error("❌ API call failed:", errorMessage);
354
368
  throw new Error("Face comparison analysis failed: ".concat(errorMessage));
355
369
  case 13:
356
- error_3 = _e.sent();
370
+ error_3 = _f.sent();
357
371
  console.error("💥 Analysis error:", error_3);
358
372
  // Améliorer le message d'erreur pour l'UI
359
- if ((_d = (_c = error_3.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message) {
373
+ if ((_e = (_d = error_3.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.message) {
360
374
  throw new Error("Analysis failed: ".concat(error_3.response.data.message));
361
375
  }
362
376
  else if (error_3.message) {
@@ -370,7 +384,7 @@ function analyzeSelfie(sessionId, selfieFile, selfiePhoto, nodeId) {
370
384
  });
371
385
  });
372
386
  }
373
- function uploadConvertedIdCardImage(sessionId, file) {
387
+ function uploadConvertedIdCardImage(sessionId, file, nodeId) {
374
388
  return __awaiter(this, void 0, void 0, function () {
375
389
  var renamedFile, formData, response, error_4;
376
390
  return __generator(this, function (_a) {
@@ -388,7 +402,7 @@ function uploadConvertedIdCardImage(sessionId, file) {
388
402
  case 1:
389
403
  _a.trys.push([1, 3, , 4]);
390
404
  console.log("\uD83D\uDE80 Uploading converted ID card image for session: ".concat(sessionId));
391
- return [4 /*yield*/, apiService.post("/session/sdk/".concat(sessionId, "/converted_id_card.png"), formData, {
405
+ return [4 /*yield*/, apiService.post("/session/sdk/".concat(sessionId, "/converted_id_card.png").concat(nodeId ? "?nodeId=".concat(encodeURIComponent(nodeId)) : ''), formData, {
392
406
  timeout: UPLOAD_TIMEOUT,
393
407
  })];
394
408
  case 2: