@incodetech/core 0.0.0-dev-20260716-5050af5d → 0.0.0-dev-20260716-bd78addb

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 (51) hide show
  1. package/dist/authentication.esm.js +2 -2
  2. package/dist/{authenticationManager-hbFeWTah.esm.js → authenticationManager-CIaoJXwH.esm.js} +2 -2
  3. package/dist/{authenticationStateMachine-BvaI9u5k.esm.js → authenticationStateMachine-CJfWsO79.esm.js} +2 -2
  4. package/dist/consent.d.ts +1 -1
  5. package/dist/{consentManager-DLOyIZzt.d.ts → consentManager-2h_w6wFc.d.ts} +4 -4
  6. package/dist/cpf-ocr.d.ts +1 -1
  7. package/dist/{cpfOcrManager-DRye5wCj.d.ts → cpfOcrManager-CmPyqpAK.d.ts} +4 -4
  8. package/dist/{deepsightLoader-Cw7akhz-.esm.js → deepsightLoader-CO6FgzSm.esm.js} +1 -1
  9. package/dist/document-capture.d.ts +1 -1
  10. package/dist/document-upload.d.ts +8 -8
  11. package/dist/{documentCaptureManager-zMtVz5_U.d.ts → documentCaptureManager-DBqK5ner.d.ts} +4 -4
  12. package/dist/ekyb.esm.js +2 -2
  13. package/dist/{ekybManager-B-YDjrD3.esm.js → ekybManager-B3pVjBve.esm.js} +1 -1
  14. package/dist/{ekybStateMachine-DgvXRzv4.esm.js → ekybStateMachine-CLf8elav.esm.js} +1 -1
  15. package/dist/extensibility.d.ts +6 -6
  16. package/dist/extensibility.esm.js +7 -7
  17. package/dist/face-match.d.ts +1 -1
  18. package/dist/face-match.esm.js +2 -2
  19. package/dist/{faceCaptureManagerFactory-Cq78g5Tm.esm.js → faceCaptureManagerFactory--1VcHUzl.esm.js} +1 -1
  20. package/dist/{faceCaptureSetup-80H-Ypj3.esm.js → faceCaptureSetup-BeNVVdRP.esm.js} +2 -2
  21. package/dist/{faceMatchManager-B7jlv77Q.esm.js → faceMatchManager-9rtJXjS-.esm.js} +1 -1
  22. package/dist/{faceMatchManager-CJQG1W1u.d.ts → faceMatchManager-BnvrZM2F.d.ts} +10 -0
  23. package/dist/{faceMatchStateMachine-DD7FxtUj.esm.js → faceMatchStateMachine-BfzusGo1.esm.js} +8 -1
  24. package/dist/flow.d.ts +2 -1
  25. package/dist/flow.esm.js +20 -6
  26. package/dist/{flowServices-B_vQAdNr.esm.js → flowServices-zxA2NPMQ.esm.js} +2 -2
  27. package/dist/id.d.ts +2 -2
  28. package/dist/id.esm.js +2 -2
  29. package/dist/{idCaptureManager-Bu2d3Faa.esm.js → idCaptureManager-BhzliFq5.esm.js} +5 -2
  30. package/dist/{idCaptureManager-CSGbGORT.d.ts → idCaptureManager-Cmcwu1iM.d.ts} +31 -1
  31. package/dist/{idCaptureStateMachine-B8SEdOB3.esm.js → idCaptureStateMachine-CrQ8hp5D.esm.js} +34 -6
  32. package/dist/index.esm.js +1 -1
  33. package/dist/mandatory-consent.d.ts +1 -1
  34. package/dist/{mandatoryConsentManager-BlB4bX6_.d.ts → mandatoryConsentManager-B2gRcE_x.d.ts} +4 -4
  35. package/dist/{onDeviceFaceResults-DtFYhiCI.esm.js → onDeviceFaceResults-CJZ9-0gT.esm.js} +1 -1
  36. package/dist/personhood.esm.js +2 -2
  37. package/dist/{recordingService-CRkr18oy.esm.js → recordingService-R1TlO0fT.esm.js} +1 -1
  38. package/dist/selfie.esm.js +4 -4
  39. package/dist/{selfieManager-DW2UOX6K.esm.js → selfieManager-sVQTErpj.esm.js} +2 -2
  40. package/dist/{selfieStateMachine-UkyBCYne.esm.js → selfieStateMachine-BsNEWEbc.esm.js} +2 -2
  41. package/dist/session-DoM7iyf7.esm.js +1 -0
  42. package/dist/session.esm.js +2 -2
  43. package/dist/{sessionInitializer-CSKqpdKw.esm.js → sessionInitializer-BZVkwhRG.esm.js} +1 -1
  44. package/dist/{setup-DoygBzUq.esm.js → setup-Dg12--fg.esm.js} +1 -1
  45. package/dist/video-selfie.d.ts +5 -4
  46. package/dist/video-selfie.esm.js +119 -57
  47. package/dist/wasm.esm.js +1 -1
  48. package/dist/workflow.d.ts +4 -4
  49. package/dist/workflow.esm.js +6 -6
  50. package/package.json +1 -1
  51. package/dist/session-CrhnsgB6.esm.js +0 -1
@@ -3,20 +3,20 @@ import { r as getToken, t as api } from "./api-BDTZNnca.esm.js";
3
3
  import { x as revokeObjectURL } from "./events-Dy8PyVO5.esm.js";
4
4
  import { t as endpoints } from "./endpoints-DLQ0g4-R.esm.js";
5
5
  import { t as addDeviceStats } from "./stats-Bu6bL_CX.esm.js";
6
- import { t as getDisableIpify } from "./sessionInitializer-CSKqpdKw.esm.js";
6
+ import { t as getDisableIpify } from "./sessionInitializer-BZVkwhRG.esm.js";
7
7
  import { n as isDesktop } from "./platform-wmV7oTAJ.esm.js";
8
8
  import { a as and, n as sendTo, r as assign, s as not, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
9
9
  import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-CtI5S0f4.esm.js";
10
10
  import { n as invokeRequestPermissionActor, t as checkPermission } from "./permissionServices-DwNCUB2I.esm.js";
11
- import { _ as StreamCanvasProcessingSession, h as stopRecording$1, m as startRecording, p as createRecordingSession } from "./onDeviceFaceResults-DtFYhiCI.esm.js";
11
+ import { _ as StreamCanvasProcessingSession, h as stopRecording$1, m as startRecording, p as createRecordingSession } from "./onDeviceFaceResults-CJZ9-0gT.esm.js";
12
12
  import { t as IncodeCanvas } from "./canvas-E1zGkel4.esm.js";
13
13
  import { n as getBackCameraStream } from "./backCameraStream-Heg6vA1j.esm.js";
14
14
  import { n as getWindowDimensions } from "./getDeviceClass-CeBiEayS.esm.js";
15
15
  import { t as getDeviceClass } from "./getDeviceClass-CkgnSJel.esm.js";
16
16
  import { t as StreamCanvasCapture } from "./StreamCanvasCapture-D2XcXCZ4.esm.js";
17
17
  import { n as needsMotionPrimeOnlyFromPermission, r as resolveStoredPermissionResult, t as isReadyForCaptureFromPermission } from "./permissionGuards-DguX5vFY.esm.js";
18
- import { i as flagIdManualReview, n as preloadOpenViduProvider } from "./recordingService-CRkr18oy.esm.js";
19
- import "./session-CrhnsgB6.esm.js";
18
+ import { i as flagIdManualReview, n as preloadOpenViduProvider } from "./recordingService-R1TlO0fT.esm.js";
19
+ import "./session-DoM7iyf7.esm.js";
20
20
  import { n as DEFAULT_ID_CAPTURE_THRESHOLDS$1, r as IdCaptureProvider } from "./idCaptureDefaults-Dzfws4i0.esm.js";
21
21
  //#region src/modules/id/digitalUpload/digitalUploadErrors.ts
22
22
  const TERMINAL_FAIL_REASONS = /* @__PURE__ */ new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
@@ -1220,6 +1220,32 @@ function getManualUploadTabs(config) {
1220
1220
  showPassportTab
1221
1221
  };
1222
1222
  }
1223
+ /**
1224
+ * Computes `idCaptureMachine`'s terminal output — the downstream module-skip
1225
+ * signal read by the Flow orchestrator (via `runChildModule`'s `MODULE_COMPLETE`).
1226
+ *
1227
+ * `skipFaceMatch` is set ONLY for the US Smart Capture *camera back-only* path:
1228
+ * a back image was captured on-device (`capturedImages.back`) and no front was
1229
+ * (`!capturedImages.front`) — "no front, no ID face, no match".
1230
+ *
1231
+ * Requiring a captured back is deliberate and load-bearing: the manual-upload
1232
+ * and digital-ID-upload paths submit a full ID (front face present) but do NOT
1233
+ * populate `capturedImages` (only the camera path does). Gating on a captured
1234
+ * back excludes those upload paths so a real ID-vs-selfie match is never
1235
+ * silently skipped. `capturedImages.front`/`forceFrontIdCapture` alone are not
1236
+ * enough (a later front upload clears the request; uploads set neither field).
1237
+ *
1238
+ * Always `false` outside US Smart Capture. The selfie/face capture itself is
1239
+ * unaffected — only the ID-vs-selfie match is skipped.
1240
+ */
1241
+ function computeIdCaptureOutput(context) {
1242
+ const frontIdCaptured = Boolean(context.capturedImages.front);
1243
+ const backIdCaptured = Boolean(context.capturedImages.back);
1244
+ return {
1245
+ frontIdCaptured,
1246
+ skipFaceMatch: context.config.usSmartCapture === true && backIdCaptured && !frontIdCaptured
1247
+ };
1248
+ }
1223
1249
  //#endregion
1224
1250
  //#region src/modules/id/idCaptureActors.ts
1225
1251
  const checkPermissionActor = fromPromise(async () => {
@@ -1522,7 +1548,7 @@ const startRecordingActor = fromPromise(async ({ input }) => {
1522
1548
  });
1523
1549
  const initializeDeepsightSessionActor = fromPromise(async ({ input }) => {
1524
1550
  if (!input.dependencies) return;
1525
- const { loadDeepsightSession } = await import("./deepsightLoader-Cw7akhz-.esm.js");
1551
+ const { loadDeepsightSession } = await import("./deepsightLoader-CO6FgzSm.esm.js");
1526
1552
  return loadDeepsightSession({
1527
1553
  ds: input.ds,
1528
1554
  storage: input.dependencies.storage,
@@ -1791,7 +1817,8 @@ const idCaptureMachine = setup({
1791
1817
  types: {
1792
1818
  context: {},
1793
1819
  events: {},
1794
- input: {}
1820
+ input: {},
1821
+ output: {}
1795
1822
  },
1796
1823
  actors: {
1797
1824
  checkPermission: checkPermissionActor,
@@ -2028,6 +2055,7 @@ const idCaptureMachine = setup({
2028
2055
  }).createMachine({
2029
2056
  id: "idCapture",
2030
2057
  initial: "idle",
2058
+ output: ({ context }) => computeIdCaptureOutput(context),
2031
2059
  context: ({ input }) => {
2032
2060
  const currentMode = input.config.onlyBack ? "back" : !input.config.enableId && input.config.enablePassport ? "passport" : input.config.usSmartCapture ? "back" : "front";
2033
2061
  return {
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as reset, o as setup, r as isConfigured } from "./setup-DoygBzUq.esm.js";
1
+ import { i as reset, o as setup, r as isConfigured } from "./setup-Dg12--fg.esm.js";
2
2
  export { isConfigured, reset, setup };
@@ -1,2 +1,2 @@
1
- import { a as MandatoryConsentActor, i as createMandatoryConsentManagerFromActor, n as MandatoryConsentState, o as mandatoryConsentMachine, r as createMandatoryConsentManager, s as MandatoryConsentConfig, t as MandatoryConsentManager } from "./mandatoryConsentManager-BlB4bX6_.js";
1
+ import { a as MandatoryConsentActor, i as createMandatoryConsentManagerFromActor, n as MandatoryConsentState, o as mandatoryConsentMachine, r as createMandatoryConsentManager, s as MandatoryConsentConfig, t as MandatoryConsentManager } from "./mandatoryConsentManager-B2gRcE_x.js";
2
2
  export { type MandatoryConsentActor, type MandatoryConsentConfig, type MandatoryConsentManager, type MandatoryConsentState, createMandatoryConsentManager, createMandatoryConsentManagerFromActor, mandatoryConsentMachine };
@@ -80,14 +80,14 @@ declare const mandatoryConsentMachine: StateMachine<MandatoryConsentContext, {
80
80
  type: "clearError";
81
81
  params: NonReducibleUnknown;
82
82
  };
83
- toggleSigned: {
84
- type: "toggleSigned";
85
- params: NonReducibleUnknown;
86
- };
87
83
  resetContext: {
88
84
  type: "resetContext";
89
85
  params: NonReducibleUnknown;
90
86
  };
87
+ toggleSigned: {
88
+ type: "toggleSigned";
89
+ params: NonReducibleUnknown;
90
+ };
91
91
  }>, {
92
92
  type: "canSubmit";
93
93
  params: unknown;
@@ -516,7 +516,7 @@ async function stopRecording(session) {
516
516
  }
517
517
  }
518
518
  async function initializeDeepsightSession(options) {
519
- const { loadDeepsightSession } = await import("./deepsightLoader-Cw7akhz-.esm.js");
519
+ const { loadDeepsightSession } = await import("./deepsightLoader-CO6FgzSm.esm.js");
520
520
  return loadDeepsightSession({
521
521
  ds: options.ds,
522
522
  storage: options.storage
@@ -4,13 +4,13 @@ import { t as api } from "./api-BDTZNnca.esm.js";
4
4
  import { a as createApi$1, t as getStoredHttpConfig } from "./clientLifecycle-DzT65Fvf.esm.js";
5
5
  import { n as eventModuleNames } from "./events-Dy8PyVO5.esm.js";
6
6
  import { t as endpoints } from "./endpoints-DLQ0g4-R.esm.js";
7
- import { c as isBrowserSimulation, d as getThumbmarkId, f as getDeviceFingerprintInfo, n as getFingerprintEnabled, p as BrowserEnvironmentProvider } from "./sessionInitializer-CSKqpdKw.esm.js";
7
+ import { c as isBrowserSimulation, d as getThumbmarkId, f as getDeviceFingerprintInfo, n as getFingerprintEnabled, p as BrowserEnvironmentProvider } from "./sessionInitializer-BZVkwhRG.esm.js";
8
8
  import { c as createManager, o as createActor, r as assign, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
9
9
  import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-CtI5S0f4.esm.js";
10
10
  import { i as requestPermission, t as checkPermission } from "./permissionServices-DwNCUB2I.esm.js";
11
11
  import { a as stopCameraStream, r as requestCameraAccess } from "./camera-BmFEyPP_.esm.js";
12
12
  import { t as BrowserStorageProvider } from "./BrowserStorageProvider-P6aUarE9.esm.js";
13
- import { f as stopStream, l as startDetection, s as initializeDeepsightSession, v as FaceDetectionProvider } from "./onDeviceFaceResults-DtFYhiCI.esm.js";
13
+ import { f as stopStream, l as startDetection, s as initializeDeepsightSession, v as FaceDetectionProvider } from "./onDeviceFaceResults-CJZ9-0gT.esm.js";
14
14
  import { t as sleep } from "./ITimerCapability-DgdDzp8G.esm.js";
15
15
  import { t as StreamCanvasCapture } from "./StreamCanvasCapture-D2XcXCZ4.esm.js";
16
16
  //#region ../infra/src/crypto/randomUUID.ts
@@ -1,7 +1,7 @@
1
1
  import { t as api } from "./api-BDTZNnca.esm.js";
2
2
  import { t as endpoints } from "./endpoints-DLQ0g4-R.esm.js";
3
3
  import { t as isAndroid } from "./platform-wmV7oTAJ.esm.js";
4
- import { d as stopRecording, g as uploadDeepsightVideo, u as startRecordingSession } from "./onDeviceFaceResults-DtFYhiCI.esm.js";
4
+ import { d as stopRecording, g as uploadDeepsightVideo, u as startRecordingSession } from "./onDeviceFaceResults-CJZ9-0gT.esm.js";
5
5
  import { t as getAdaptiveMediaRecorderOptions } from "./mediaRecorderOptions-BhSZDDNb.esm.js";
6
6
  //#region src/internal/manualReview/manualReviewService.ts
7
7
  async function flagFaceManualReview() {
@@ -2,12 +2,12 @@ import { t as WasmUtilProvider } from "./WasmUtilProvider-DAshwHhX.esm.js";
2
2
  import { n as eventModuleNames } from "./events-Dy8PyVO5.esm.js";
3
3
  import { o as createActor, r as assign } from "./xstate.esm-Cf4e0Cfd.esm.js";
4
4
  import { n as fromPromise } from "./xstate-actors.esm-CtI5S0f4.esm.js";
5
- import { t as faceCaptureMachine } from "./faceCaptureSetup-80H-Ypj3.esm.js";
6
- import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-Cq78g5Tm.esm.js";
5
+ import { t as faceCaptureMachine } from "./faceCaptureSetup-BeNVVdRP.esm.js";
6
+ import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory--1VcHUzl.esm.js";
7
7
  import { t as BrowserStorageProvider } from "./BrowserStorageProvider-P6aUarE9.esm.js";
8
8
  import { t as processFace } from "./selfieUploadService-B4LnSIf6.esm.js";
9
- import { t as selfieMachine } from "./selfieStateMachine-UkyBCYne.esm.js";
10
- import { n as createSelfieManagerFromActor, t as createSelfieManager } from "./selfieManager-DW2UOX6K.esm.js";
9
+ import { t as selfieMachine } from "./selfieStateMachine-BsNEWEbc.esm.js";
10
+ import { n as createSelfieManagerFromActor, t as createSelfieManager } from "./selfieManager-sVQTErpj.esm.js";
11
11
  import { t as invokeOnCaptureCallback } from "./invokeOnCaptureCallback-B-QfsCQY.esm.js";
12
12
  //#region src/modules/selfie/selfieCaptureOnlyStateMachine.ts
13
13
  /**
@@ -1,9 +1,9 @@
1
1
  import { t as WasmUtilProvider } from "./WasmUtilProvider-DAshwHhX.esm.js";
2
2
  import { n as eventModuleNames } from "./events-Dy8PyVO5.esm.js";
3
3
  import { o as createActor } from "./xstate.esm-Cf4e0Cfd.esm.js";
4
- import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-Cq78g5Tm.esm.js";
4
+ import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory--1VcHUzl.esm.js";
5
5
  import { t as BrowserStorageProvider } from "./BrowserStorageProvider-P6aUarE9.esm.js";
6
- import { t as selfieMachine } from "./selfieStateMachine-UkyBCYne.esm.js";
6
+ import { t as selfieMachine } from "./selfieStateMachine-BsNEWEbc.esm.js";
7
7
  //#region src/modules/selfie/selfieActor.ts
8
8
  function createSelfieActor(options) {
9
9
  const dependencies = options.dependencies ?? {
@@ -1,7 +1,7 @@
1
1
  import { r as assign } from "./xstate.esm-Cf4e0Cfd.esm.js";
2
2
  import { n as fromPromise } from "./xstate-actors.esm-CtI5S0f4.esm.js";
3
- import { t as faceCaptureMachine } from "./faceCaptureSetup-80H-Ypj3.esm.js";
4
- import { i as prepareOnDeviceFaceUpload, n as isOnDeviceMode, r as postOnDeviceFaceResults, t as defaultPrepareFaceUpload } from "./onDeviceFaceResults-DtFYhiCI.esm.js";
3
+ import { t as faceCaptureMachine } from "./faceCaptureSetup-BeNVVdRP.esm.js";
4
+ import { i as prepareOnDeviceFaceUpload, n as isOnDeviceMode, r as postOnDeviceFaceResults, t as defaultPrepareFaceUpload } from "./onDeviceFaceResults-CJZ9-0gT.esm.js";
5
5
  import { t as FACE_ERROR_CODES } from "./types-BN5RPPIZ.esm.js";
6
6
  import { n as uploadSelfie, t as processFace } from "./selfieUploadService-B4LnSIf6.esm.js";
7
7
  Object.values(FACE_ERROR_CODES);
@@ -0,0 +1 @@
1
+ import "./sessionInitializer-BZVkwhRG.esm.js";
@@ -1,8 +1,8 @@
1
1
  import { n as getApi } from "./api-BDTZNnca.esm.js";
2
2
  import { t as endpoints } from "./endpoints-DLQ0g4-R.esm.js";
3
- import { i as initializeSession } from "./sessionInitializer-CSKqpdKw.esm.js";
3
+ import { i as initializeSession } from "./sessionInitializer-BZVkwhRG.esm.js";
4
4
  import { n as toIncodeApiError, t as IncodeApiError } from "./apiError-COvIGYWe.esm.js";
5
- import "./session-CrhnsgB6.esm.js";
5
+ import "./session-DoM7iyf7.esm.js";
6
6
  import { n as getFinishStatus } from "./flowCompletionService-DQSC7Kso.esm.js";
7
7
  //#region src/internal/session/sessionService.ts
8
8
  /**
@@ -1608,7 +1608,7 @@ function isBrowserSimulation(browserEnv) {
1608
1608
  }
1609
1609
  //#endregion
1610
1610
  //#region src/internal/version/sdkVersion.ts
1611
- const SDK_VERSION = "0.0.0-dev-20260716-5050af5d";
1611
+ const SDK_VERSION = "0.0.0-dev-20260716-bd78addb";
1612
1612
  //#endregion
1613
1613
  //#region src/internal/fingerprint/fingerprintService.ts
1614
1614
  function formatOsVersion(os) {
@@ -5,7 +5,7 @@ import { i as upgradeToWasmHttpClient$1, n as installFreshHttpClient, r as reset
5
5
  import { _ as setAnalyticsBatcher, g as resetAnalyticsBatcher, h as getAnalyticsBatcher } from "./events-Dy8PyVO5.esm.js";
6
6
  import { t as endpoints } from "./endpoints-DLQ0g4-R.esm.js";
7
7
  import { r as resetDeviceStatsQueue, t as addDeviceStats } from "./stats-Bu6bL_CX.esm.js";
8
- import { a as resetSessionInit, i as initializeSession, o as setClientFingerprintEnabled, s as setClientIpLookupEnabled } from "./sessionInitializer-CSKqpdKw.esm.js";
8
+ import { a as resetSessionInit, i as initializeSession, o as setClientFingerprintEnabled, s as setClientIpLookupEnabled } from "./sessionInitializer-BZVkwhRG.esm.js";
9
9
  import { a as resetTRI, n as initializeTRI, o as resetTRIProviderInstance } from "./tri-N-xlKhZK.esm.js";
10
10
  //#region ../infra/src/wasm/wasmDefaults.ts
11
11
  const WASM_CDN_BASE_URL = "https://cdn.incodesmile.com/ml-wasm-kit-release";
@@ -107,6 +107,7 @@ declare class MultipartRecordingService {
107
107
  }
108
108
  //#endregion
109
109
  //#region src/modules/video-selfie/videoSelfieStepDetector.d.ts
110
+ type VideoSelfieDetectionStatus = DetectionStatus | 'wrongSide';
110
111
  /**
111
112
  * Runs the WASM detection + backend validation for a single capture step over
112
113
  * the given camera stream. Resolves once the step is captured AND validated by
@@ -118,7 +119,7 @@ type StepDetector = (params: {
118
119
  step: VideoSelfieStep;
119
120
  stream: MediaStream;
120
121
  signal: AbortSignal;
121
- onStatus?: (status: DetectionStatus) => void;
122
+ onStatus?: (status: VideoSelfieDetectionStatus) => void;
122
123
  }) => Promise<void>;
123
124
  //#endregion
124
125
  //#region src/modules/video-selfie/videoSelfieRecordingMachine.d.ts
@@ -140,7 +141,7 @@ type CreateVideoSelfieRecordingActorOptions = {
140
141
  };
141
142
  //#endregion
142
143
  //#region src/modules/video-selfie/videoSelfieRecordingManager.d.ts
143
- type VideoSelfieRecordingStatus = 'idle' | 'starting' | 'recording' | 'switchingCamera' | 'finalizing' | 'finished' | 'error' | 'aborted';
144
+ type VideoSelfieRecordingStatus = 'idle' | 'starting' | 'recording' | 'flippingId' | 'switchingCamera' | 'finalizing' | 'success' | 'finished' | 'error' | 'aborted';
144
145
  type VideoSelfieRecordingState = {
145
146
  /** Current lifecycle status. */
146
147
  status: VideoSelfieRecordingStatus;
@@ -160,8 +161,8 @@ type VideoSelfieRecordingState = {
160
161
  */
161
162
  composite: MediaStream | undefined;
162
163
  /** Live per-step detection feedback (e.g. `tooFar`, `blur`, `detecting`). */
163
- detectionStatus: DetectionStatus | undefined;
164
- /** The completed upload id, available once `status === 'finished'`. */
164
+ detectionStatus: VideoSelfieDetectionStatus | undefined;
165
+ /** The completed upload id, available during `success` and `finished`. */
165
166
  recordingId: string | null;
166
167
  /** Failure detail, set when `status === 'error'`. */
167
168
  error: string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { t as WasmUtilProvider } from "./WasmUtilProvider-DAshwHhX.esm.js";
2
- import { t as ensureWasmPipelines } from "./setup-DoygBzUq.esm.js";
2
+ import { t as ensureWasmPipelines } from "./setup-Dg12--fg.esm.js";
3
3
  import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
4
4
  import { t as api } from "./api-BDTZNnca.esm.js";
5
5
  import { t as endpoints } from "./endpoints-DLQ0g4-R.esm.js";
@@ -7,7 +7,7 @@ import { c as createManager, o as createActor, r as assign, t as setup } from ".
7
7
  import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-CtI5S0f4.esm.js";
8
8
  import { t as checkPermission } from "./permissionServices-DwNCUB2I.esm.js";
9
9
  import { i as requestCameraWithFallback, r as requestCameraAccess } from "./camera-BmFEyPP_.esm.js";
10
- import { _ as StreamCanvasProcessingSession, a as encryptSelfieImage, l as startDetection, v as FaceDetectionProvider } from "./onDeviceFaceResults-DtFYhiCI.esm.js";
10
+ import { _ as StreamCanvasProcessingSession, a as encryptSelfieImage, l as startDetection, v as FaceDetectionProvider } from "./onDeviceFaceResults-CJZ9-0gT.esm.js";
11
11
  import { n as getBackCameraStream } from "./backCameraStream-Heg6vA1j.esm.js";
12
12
  import { n as getWindowDimensions } from "./getDeviceClass-CeBiEayS.esm.js";
13
13
  import { n as uploadSelfie, t as processFace } from "./selfieUploadService-B4LnSIf6.esm.js";
@@ -45,6 +45,7 @@ function isFaceRecognitionMatch(confidence) {
45
45
  * after this many tries the step rejects. Mirrors V1's `numberOfTries`.
46
46
  */
47
47
  const MAX_SELFIE_ATTEMPTS = 3;
48
+ const SELFIE_SUCCESS_DWELL_MS = 900;
48
49
  /**
49
50
  * How long the ID step holds on the "success" state (green check) after the
50
51
  * backend validates a side, before advancing. Gives the user a beat to see the
@@ -52,15 +53,15 @@ const MAX_SELFIE_ATTEMPTS = 3;
52
53
  * IdVideoSelfie success flash.
53
54
  */
54
55
  const ID_SUCCESS_DWELL_MS = 900;
55
- /**
56
- * How long an ID step holds the "show the front / back of your ID" instruction
57
- * before autocapture is armed. No frame is captured or validated during this
58
- * window, so the guidance can't be overwritten by capture feedback before the
59
- * user has read it. Mirrors the UI's `ID_INSTRUCTION_DWELL_MS` message pin.
60
- */
61
- const ID_INSTRUCTION_DWELL_MS = 3e3;
56
+ function abortError() {
57
+ return /* @__PURE__ */ new Error("aborted");
58
+ }
59
+ function throwIfAborted(signal) {
60
+ if (signal.aborted) throw abortError();
61
+ }
62
62
  /** Resolves after `ms`, or rejects early if `signal` aborts. */
63
63
  function delay(ms, signal) {
64
+ if (signal.aborted) return Promise.reject(abortError());
64
65
  const timerProvider = BrowserTimerProvider.getInstance();
65
66
  return new Promise((resolve, reject) => {
66
67
  const timer = timerProvider.setTimeout(() => {
@@ -69,11 +70,19 @@ function delay(ms, signal) {
69
70
  }, ms);
70
71
  const onAbort = () => {
71
72
  timerProvider.clearTimeout(timer);
72
- reject(/* @__PURE__ */ new Error("aborted"));
73
+ reject(abortError());
73
74
  };
74
75
  signal.addEventListener("abort", onAbort, { once: true });
76
+ if (signal.aborted) onAbort();
75
77
  });
76
78
  }
79
+ function isWrongVideoSelfieIdSide(step, reportedSide) {
80
+ const side = reportedSide.toLowerCase();
81
+ if (side === "wrong") return true;
82
+ const isFront = side.includes("front") && !side.includes("back");
83
+ const isBack = side.includes("back") && !side.includes("front");
84
+ return step === "frontId" ? isBack : isFront;
85
+ }
77
86
  /**
78
87
  * Builds the default per-step detector from the module config. Today it
79
88
  * auto-captures the `selfie` step (face detection → `add/face` → `process/face`);
@@ -107,6 +116,10 @@ async function detectSelfie(params) {
107
116
  useOnDeviceWorkflow: false,
108
117
  videoSelfie: true
109
118
  });
119
+ if (signal.aborted) {
120
+ provider.dispose();
121
+ throw abortError();
122
+ }
110
123
  provider.setChecksEnabled({
111
124
  lenses: config.validateLenses ?? false,
112
125
  mask: config.validateFaceMask ?? false,
@@ -126,32 +139,41 @@ async function detectSelfie(params) {
126
139
  autoCaptureTimeout: SELFIE_AUTOCAPTURE_MS / 1e3
127
140
  };
128
141
  const runAttempt = () => new Promise((resolve, reject) => {
129
- const onAbort = () => {
130
- detection.cleanup();
131
- reject(/* @__PURE__ */ new Error("aborted"));
132
- };
133
- const settle = (run) => {
142
+ if (signal.aborted) {
143
+ reject(abortError());
144
+ return;
145
+ }
146
+ let settled = false;
147
+ function settle(run) {
148
+ if (settled) return;
149
+ settled = true;
134
150
  signal.removeEventListener("abort", onAbort);
135
151
  run();
136
- };
137
- signal.addEventListener("abort", onAbort, { once: true });
152
+ }
138
153
  const detection = startDetection({
139
154
  config: detectionConfig,
140
155
  capturer,
141
156
  provider,
142
157
  onUpdate: (status) => onStatus?.(status),
143
158
  onSuccess: (canvas, faceCoordinates) => {
159
+ onStatus?.("capturing");
144
160
  (async () => {
145
161
  try {
162
+ const encryptedBase64Image = await encryptSelfieImage({
163
+ canvas,
164
+ dependencies: { getWasmUtil: async () => deps.getWasmUtil() }
165
+ });
166
+ throwIfAborted(signal);
146
167
  await uploadSelfie({
147
- encryptedBase64Image: await encryptSelfieImage({
148
- canvas,
149
- dependencies: { getWasmUtil: async () => deps.getWasmUtil() }
150
- }),
168
+ encryptedBase64Image,
151
169
  faceCoordinates,
152
170
  imageType
153
171
  });
172
+ throwIfAborted(signal);
154
173
  await processFace(imageType);
174
+ throwIfAborted(signal);
175
+ onStatus?.("success");
176
+ await delay(SELFIE_SUCCESS_DWELL_MS, signal);
155
177
  settle(resolve);
156
178
  } catch (error) {
157
179
  settle(() => reject(error instanceof Error ? error : new Error(String(error))));
@@ -159,6 +181,12 @@ async function detectSelfie(params) {
159
181
  })();
160
182
  }
161
183
  });
184
+ function onAbort() {
185
+ detection.cleanup();
186
+ settle(() => reject(abortError()));
187
+ }
188
+ signal.addEventListener("abort", onAbort, { once: true });
189
+ if (signal.aborted) onAbort();
162
190
  });
163
191
  try {
164
192
  for (let attempt = 1; attempt <= MAX_SELFIE_ATTEMPTS; attempt++) try {
@@ -179,6 +207,10 @@ async function detectId(params) {
179
207
  const { step, config, stream, signal, onStatus } = params;
180
208
  const provider = new IdCaptureProvider();
181
209
  await provider.initialize({ videoSelfie: true });
210
+ if (signal.aborted) {
211
+ provider.dispose();
212
+ throw abortError();
213
+ }
182
214
  const windowDimensions = getWindowDimensions();
183
215
  provider.setGeometry({
184
216
  ...DEFAULT_ID_CAPTURE_GEOMETRY,
@@ -202,16 +234,43 @@ async function detectId(params) {
202
234
  const capturer = new StreamCanvasCapture(stream);
203
235
  return new Promise((resolve, reject) => {
204
236
  let validating = false;
205
- let armed = false;
237
+ let wrongSide = false;
238
+ let settled = false;
239
+ let toreDown = false;
240
+ const session = new StreamCanvasProcessingSession({
241
+ capturer,
242
+ provider
243
+ });
244
+ function teardown() {
245
+ if (toreDown) return;
246
+ toreDown = true;
247
+ session.dispose();
248
+ capturer.dispose();
249
+ provider.dispose();
250
+ }
251
+ function settle(run) {
252
+ if (settled) return;
253
+ settled = true;
254
+ signal.removeEventListener("abort", onAbort);
255
+ teardown();
256
+ run();
257
+ }
258
+ function onAbort() {
259
+ settle(() => reject(abortError()));
260
+ }
206
261
  provider.setCallbacks({
207
262
  onFarAway: () => {
208
- if (armed && !validating) onStatus?.("tooFar");
263
+ if (!validating && !wrongSide) onStatus?.("tooFar");
209
264
  },
210
265
  onBlur: () => {
211
- if (armed && !validating) onStatus?.("blur");
266
+ if (!validating && !wrongSide) onStatus?.("blur");
267
+ },
268
+ onIdSideChange: (side) => {
269
+ wrongSide = isWrongVideoSelfieIdSide(step, side);
270
+ onStatus?.(wrongSide ? "wrongSide" : "detecting");
212
271
  },
213
272
  onCapturing: () => {
214
- if (!armed || validating) return;
273
+ if (validating || wrongSide) return;
215
274
  const base64Image = capturer.getLatestCanvas()?.getBase64Image();
216
275
  if (!base64Image) return;
217
276
  validating = true;
@@ -219,41 +278,22 @@ async function detectId(params) {
219
278
  (async () => {
220
279
  try {
221
280
  if (await validateIdFrame(step, config, base64Image)) {
281
+ throwIfAborted(signal);
222
282
  onStatus?.("success");
223
283
  await delay(ID_SUCCESS_DWELL_MS, signal);
224
- teardown();
225
- resolve();
284
+ settle(resolve);
226
285
  return;
227
286
  }
228
287
  validating = false;
229
288
  } catch (error) {
230
- teardown();
231
- reject(error instanceof Error ? error : new Error(String(error)));
289
+ settle(() => reject(error instanceof Error ? error : new Error(String(error))));
232
290
  }
233
291
  })();
234
292
  }
235
293
  });
236
- const session = new StreamCanvasProcessingSession({
237
- capturer,
238
- provider
239
- });
240
- let toreDown = false;
241
- const teardown = () => {
242
- if (toreDown) return;
243
- toreDown = true;
244
- session.dispose();
245
- capturer.dispose();
246
- provider.dispose();
247
- };
248
- signal.addEventListener("abort", () => {
249
- teardown();
250
- reject(/* @__PURE__ */ new Error("aborted"));
251
- }, { once: true });
252
- delay(ID_INSTRUCTION_DWELL_MS, signal).then(() => {
253
- if (toreDown || signal.aborted) return;
254
- armed = true;
255
- onStatus?.("detecting");
256
- }).catch(() => {});
294
+ onStatus?.("detecting");
295
+ signal.addEventListener("abort", onAbort, { once: true });
296
+ if (signal.aborted) onAbort();
257
297
  });
258
298
  }
259
299
  /** Runs the configured ID/OCR comparisons for a captured ID frame. */
@@ -700,6 +740,8 @@ function detectionErrorFromEvent(event) {
700
740
  return event.error;
701
741
  }
702
742
  const SWITCHING_CAMERA_MIN_DWELL_MS = 3e3;
743
+ const ID_FLIP_DWELL_MS = 4e3;
744
+ const FINAL_SUCCESS_DWELL_MS = 3e3;
703
745
  function waitForDwell(ms, signal) {
704
746
  const timerProvider = BrowserTimerProvider.getInstance();
705
747
  return new Promise((resolve) => {
@@ -728,9 +770,9 @@ function waitForDwell(ms, signal) {
728
770
  * validation; success advances the step (switching the camera when the next
729
771
  * step's facing differs), and the final step finalizes the multipart upload.
730
772
  *
731
- * Teardown: `ABORT` is accepted from ANY non-final state and every terminal
732
- * state runs `cleanup` on entry, so no settled path leaves camera or mic
733
- * tracks running. XState v5 executes NO exit actions on an external
773
+ * Teardown: `ABORT` is accepted from ANY non-final state and every settled
774
+ * path runs `cleanup`, so no path leaves camera or mic tracks running.
775
+ * XState v5 executes NO exit actions on an external
734
776
  * `actor.stop()`, so the manager sends `ABORT` before stopping the actor —
735
777
  * never stop this actor directly without aborting first.
736
778
  */
@@ -740,6 +782,10 @@ const videoSelfieRecordingSetup = setup({
740
782
  events: {},
741
783
  input: {}
742
784
  },
785
+ delays: {
786
+ ID_FLIP_DWELL: ID_FLIP_DWELL_MS,
787
+ FINAL_SUCCESS_DWELL: FINAL_SUCCESS_DWELL_MS
788
+ },
743
789
  actors: {
744
790
  acquireCamera: fromPromise(async ({ input, signal }) => {
745
791
  const stream = await input.acquire(input.facingMode, input.withAudio);
@@ -807,6 +853,7 @@ const videoSelfieRecordingSetup = setup({
807
853
  },
808
854
  guards: {
809
855
  isLastStep: ({ context }) => context.stepIndex >= context.steps.length - 1,
856
+ nextStepFlipsId: ({ context }) => context.steps[context.stepIndex] === "frontId" && context.steps[context.stepIndex + 1] === "backId",
810
857
  nextStepFlipsCamera: ({ context }) => facingModeForStep(context.steps[context.stepIndex]) !== facingModeForStep(context.steps[context.stepIndex + 1]),
811
858
  uploadReturnedNoRecordingId: ({ event }) => recordingIdFromEvent(event) === null
812
859
  }
@@ -816,6 +863,10 @@ const ADVANCE_TRANSITIONS = [
816
863
  target: "finalizing",
817
864
  guard: "isLastStep"
818
865
  },
866
+ {
867
+ target: "flippingId",
868
+ guard: "nextStepFlipsId"
869
+ },
819
870
  {
820
871
  target: "switchingCamera",
821
872
  guard: "nextStepFlipsCamera",
@@ -901,6 +952,16 @@ const videoSelfieRecordingMachine = videoSelfieRecordingSetup.createMachine({
901
952
  }
902
953
  }
903
954
  },
955
+ flippingId: {
956
+ after: { ID_FLIP_DWELL: {
957
+ target: "recording",
958
+ actions: "advanceStep"
959
+ } },
960
+ on: { NEXT_STEP: {
961
+ target: "recording",
962
+ actions: "advanceStep"
963
+ } }
964
+ },
904
965
  switchingCamera: { invoke: {
905
966
  src: "switchCamera",
906
967
  input: ({ context }) => ({
@@ -927,7 +988,7 @@ const videoSelfieRecordingMachine = videoSelfieRecordingSetup.createMachine({
927
988
  guard: "uploadReturnedNoRecordingId",
928
989
  actions: [assign({ recordingId: ({ event }) => recordingIdFromEvent(event) }), "setUploadFailedError"]
929
990
  }, {
930
- target: "finished",
991
+ target: "success",
931
992
  actions: assign({ recordingId: ({ event }) => recordingIdFromEvent(event) })
932
993
  }],
933
994
  onError: {
@@ -935,10 +996,11 @@ const videoSelfieRecordingMachine = videoSelfieRecordingSetup.createMachine({
935
996
  actions: assign({ error: ({ event }) => errorFromEvent(event) })
936
997
  }
937
998
  } },
938
- finished: {
939
- type: "final",
940
- entry: "cleanup"
999
+ success: {
1000
+ entry: "cleanup",
1001
+ after: { FINAL_SUCCESS_DWELL: "finished" }
941
1002
  },
1003
+ finished: { type: "final" },
942
1004
  error: {
943
1005
  type: "final",
944
1006
  entry: "cleanup"
package/dist/wasm.esm.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { i as warmupWasm } from "./WasmUtilProvider-DAshwHhX.esm.js";
2
- import { a as setWasmConfig, c as DEFAULT_WASM_VERSION, d as resolveWasmConfig, l as buildDefaultWasmConfig, n as initializeWasmUtil, s as upgradeToWasmHttpClient, t as ensureWasmPipelines, u as buildWasmConfigFromBasePath } from "./setup-DoygBzUq.esm.js";
2
+ import { a as setWasmConfig, c as DEFAULT_WASM_VERSION, d as resolveWasmConfig, l as buildDefaultWasmConfig, n as initializeWasmUtil, s as upgradeToWasmHttpClient, t as ensureWasmPipelines, u as buildWasmConfigFromBasePath } from "./setup-Dg12--fg.esm.js";
3
3
  export { DEFAULT_WASM_VERSION, buildDefaultWasmConfig, buildWasmConfigFromBasePath, ensureWasmPipelines, initializeWasmUtil, resolveWasmConfig, setWasmConfig, upgradeToWasmHttpClient, warmupWasm };
@@ -320,6 +320,10 @@ declare const workflowMachine: StateMachine<WorkflowContext, {
320
320
  id: string | undefined;
321
321
  };
322
322
  }>, Values<{
323
+ setError: {
324
+ type: "setError";
325
+ params: NonReducibleUnknown;
326
+ };
323
327
  setLoadingResult: {
324
328
  type: "setLoadingResult";
325
329
  params: NonReducibleUnknown;
@@ -348,10 +352,6 @@ declare const workflowMachine: StateMachine<WorkflowContext, {
348
352
  type: "setFinishStatusFailed";
349
353
  params: NonReducibleUnknown;
350
354
  };
351
- setError: {
352
- type: "setError";
353
- params: NonReducibleUnknown;
354
- };
355
355
  setModuleError: {
356
356
  type: "setModuleError";
357
357
  params: NonReducibleUnknown;