@incodetech/core 2.3.0-rc.1 → 2.3.0-rc.10

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 (90) hide show
  1. package/dist/{BrowserDiagnosticsCryptoProvider-CU6kBvqv.esm.js → BrowserDiagnosticsCryptoProvider-BuzqvbhN.esm.js} +6 -24
  2. package/dist/{FaceDetectionProvider-BfhWkK90.esm.js → FaceDetectionProvider-BZYHujqz.esm.js} +8 -8
  3. package/dist/{MotionSensorProvider-BgTYwg9L.esm.js → MotionSensorProvider-DyhbM4Si.esm.js} +1 -1
  4. package/dist/ae-signature.esm.js +1 -1
  5. package/dist/{apiError-Budb6m6w.esm.js → apiError-iTFZ5fiI.esm.js} +1 -1
  6. package/dist/authentication.d.ts +2 -2
  7. package/dist/authentication.esm.js +2 -2
  8. package/dist/{authenticationManager-CjXBjC-c.d.ts → authenticationManager-B23V74p7.d.ts} +1 -1
  9. package/dist/{authenticationManager-cMXhG70r.esm.js → authenticationManager-D22ju23T.esm.js} +4 -4
  10. package/dist/{authenticationStateMachine-MOYz4HCf.esm.js → authenticationStateMachine-TyFaCegB.esm.js} +3 -3
  11. package/dist/{backCameraStream-BOtyQowf.esm.js → backCameraStream-B0-YgP_y.esm.js} +1 -0
  12. package/dist/camera.esm.js +1 -1
  13. package/dist/consent.d.ts +1 -1
  14. package/dist/{consentManager-BhYFeKiG.d.ts → consentManager-uhDPdU6i.d.ts} +8 -8
  15. package/dist/{createCameraCycleOwnership-CX3hJGKc.esm.js → createCameraCycleOwnership-DnwTl1ad.esm.js} +6 -1
  16. package/dist/{deepsightLoader-DDv3vhXU.esm.js → deepsightLoader-DamOBrBJ.esm.js} +6 -6
  17. package/dist/document-capture.d.ts +1 -1
  18. package/dist/document-capture.esm.js +2 -2
  19. package/dist/{documentCaptureManager-CwAiM9WY.esm.js → documentCaptureManager-BRPxqYD2.esm.js} +1 -1
  20. package/dist/{documentCaptureManager-DensIj5F.d.ts → documentCaptureManager-lEtCM320.d.ts} +14 -0
  21. package/dist/{documentCaptureStateMachine-DfGOBapD.esm.js → documentCaptureStateMachine-D312sSIu.esm.js} +13 -8
  22. package/dist/dynamic-forms.esm.js +2 -2
  23. package/dist/{dynamicFormsManager-BbS-XMFc.esm.js → dynamicFormsManager-DKgiusbF.esm.js} +1 -1
  24. package/dist/{dynamicFormsStateMachine-D8zHBCh4.esm.js → dynamicFormsStateMachine-BV8yR5iN.esm.js} +1 -1
  25. package/dist/ekyb.esm.js +3 -3
  26. package/dist/{ekybManager-5aiac8wL.esm.js → ekybManager-8VUBu8VW.esm.js} +1 -1
  27. package/dist/{ekybStateMachine-Bn2IE9rx.esm.js → ekybStateMachine-Bnsefu9M.esm.js} +1 -1
  28. package/dist/electronic-signature.esm.js +1 -1
  29. package/dist/{electronicSignatureManager-BJJH0Tvi.esm.js → electronicSignatureManager--YFXVldr.esm.js} +1 -1
  30. package/dist/extensibility.d.ts +7 -7
  31. package/dist/extensibility.esm.js +13 -13
  32. package/dist/{faceCaptureManagerFactory-B7Ms6pSs.esm.js → faceCaptureManagerFactory-Bk6pVs6E.esm.js} +3 -3
  33. package/dist/{faceCaptureManagerFactory-BeUl8fl1.d.ts → faceCaptureManagerFactory-DMLstvui.d.ts} +80 -40
  34. package/dist/{faceCaptureSetup-bkAlr5d8.esm.js → faceCaptureSetup-CGQDK97m.esm.js} +267 -45
  35. package/dist/{feature-management-E0mq0pMs.esm.js → feature-management-C8OAO_CZ.esm.js} +1 -1
  36. package/dist/feature-management.esm.js +1 -1
  37. package/dist/fiscal-qr.esm.js +1 -1
  38. package/dist/{fiscalQrManager-BunLVFbd.esm.js → fiscalQrManager-DbCVMIBx.esm.js} +1 -1
  39. package/dist/flow.esm.js +3 -3
  40. package/dist/{flowCompletionService-DJp1odGN.esm.js → flowCompletionService-C0zcPnqK.esm.js} +1 -1
  41. package/dist/{flowServices-DjPFGs_D.esm.js → flowServices-G1FDrkLd.esm.js} +5 -5
  42. package/dist/geolocation.esm.js +2 -2
  43. package/dist/{geolocationManager-D5906YXx.esm.js → geolocationManager-DNixQOgf.esm.js} +1 -1
  44. package/dist/{geolocationStateMachine-BVOduc3y.esm.js → geolocationStateMachine-D1aZJ6eR.esm.js} +1 -1
  45. package/dist/id-selfie-flow.esm.js +9 -9
  46. package/dist/id.d.ts +2 -2
  47. package/dist/id.esm.js +4 -4
  48. package/dist/idCaptureDefaults-sJahGQgV.esm.js +282 -0
  49. package/dist/{idCaptureManager-rfV9dIXy.esm.js → idCaptureManager-B8lo-ksK.esm.js} +5 -5
  50. package/dist/{idCaptureManager-DKESug0R.d.ts → idCaptureManager-BaHEyQyr.d.ts} +23 -5
  51. package/dist/{idCaptureServices-i1KxugN7.esm.js → idCaptureServices-DLqls7Xv.esm.js} +60 -13
  52. package/dist/{idCaptureStateMachine-Ne_PXth_.esm.js → idCaptureStateMachine-CCPGFPRF.esm.js} +221 -76
  53. package/dist/index.d.ts +1 -1
  54. package/dist/index.esm.js +1 -1
  55. package/dist/mandatory-consent.d.ts +1 -1
  56. package/dist/{mandatoryConsentManager-vhv1co_n.d.ts → mandatoryConsentManager-CJSyhTpi.d.ts} +4 -4
  57. package/dist/{multipartRecordingService-OEgIRvqC.esm.js → multipartRecordingService-YKu0Bd7S.esm.js} +490 -8
  58. package/dist/{permissionGuards-uYZYFu4J.esm.js → permissionGuards-D6TfVop2.esm.js} +1 -1
  59. package/dist/{permissionServices-Bj_fyWtv.esm.js → permissionServices-EY3_Vx6c.esm.js} +2 -2
  60. package/dist/qe-signature.esm.js +1 -1
  61. package/dist/{runChildModule-CI1gGWN1.esm.js → runChildModule-B3Z4iJnG.esm.js} +1 -1
  62. package/dist/{safeStorage-B-trhxg6.esm.js → safeStorage-BdU9_m2E.esm.js} +1 -1
  63. package/dist/{sdkVersion-BZh6dj53.esm.js → sdkVersion-CD9fJC2Y.esm.js} +1 -1
  64. package/dist/selfie.d.ts +2 -2
  65. package/dist/selfie.esm.js +7 -7
  66. package/dist/{selfieManager-4RRLi21P.d.ts → selfieManager-CDCTOrcg.d.ts} +1 -1
  67. package/dist/{selfieManager-B-2c1n_x.esm.js → selfieManager-DzOPNipB.esm.js} +4 -4
  68. package/dist/{selfieStateMachine-Bzx41R8d.esm.js → selfieStateMachine-CidiobBW.esm.js} +3 -3
  69. package/dist/{session-3LmvAU4S.esm.js → session-BABCfUhC.esm.js} +3 -3
  70. package/dist/session.esm.js +4 -4
  71. package/dist/{sessionInitializer-BFk33E67.esm.js → sessionInitializer-BK5NjMe0.esm.js} +4 -4
  72. package/dist/{setup-Cv-JM9QC.d.ts → setup-Cyko6cAn.d.ts} +6 -18
  73. package/dist/{setup-BWG-hivt.esm.js → setup-D4YCSH31.esm.js} +12 -200
  74. package/dist/{tri-4RsGrIt6.esm.js → tri-xzRLIIMN.esm.js} +0 -10
  75. package/dist/tri.esm.js +1 -1
  76. package/dist/{trueSightService-BN-Hzw82.esm.js → trueSightService-D8yZwF3G.esm.js} +189 -570
  77. package/dist/video-selfie.esm.js +5 -6
  78. package/dist/{videoSelfieCameraWarmer-B8PcYqmz.esm.js → videoSelfieCameraWarmer-C80ZPDZ8.esm.js} +6 -6
  79. package/dist/{warmup-CUUnwYxe.esm.js → warmup-ChDwHSel.esm.js} +5 -0
  80. package/dist/wasm.d.ts +1 -1
  81. package/dist/wasm.esm.js +3 -2
  82. package/dist/{wasmDsFlagSync-B2e8p268.esm.js → wasmDsFlagSync-DYrLUEII.esm.js} +1 -1
  83. package/dist/workflow.esm.js +15 -15
  84. package/package.json +1 -6
  85. package/dist/FaceDetectionProvider-LdZ47bWy.d.ts +0 -36
  86. package/dist/StreamCanvasProcessingSession-CBnbTnOr.esm.js +0 -42
  87. package/dist/idCaptureDefaults-CbPA-Auz.esm.js +0 -727
  88. package/dist/personhood.d.ts +0 -538
  89. package/dist/personhood.esm.js +0 -1574
  90. package/dist/types-BT_Oalip.d.ts +0 -1
@@ -1,15 +1,15 @@
1
- import { t as ensureWasmPipelines } from "./setup-BWG-hivt.esm.js";
2
- import { i as numberParam, n as defineExperimentParams, t as booleanParam, u as resolveExperimentOnce } from "./feature-management-E0mq0pMs.esm.js";
1
+ import { t as ensureWasmPipelines } from "./setup-D4YCSH31.esm.js";
2
+ import { i as numberParam, n as defineExperimentParams, t as booleanParam, u as resolveExperimentOnce } from "./feature-management-C8OAO_CZ.esm.js";
3
3
  import { t as api } from "./api-Bx3gKW_y.esm.js";
4
4
  import { t as endpoints } from "./endpoints-B-3Q-LUw.esm.js";
5
5
  import { i as isDesktop } from "./platform-DkcRc9JV.esm.js";
6
6
  import { i as assign, t as setup } from "./xstate.esm-BuFLFuzz.esm.js";
7
7
  import { n as fromPromise } from "./xstate-actors.esm-BXeQ-Ucz.esm.js";
8
- import { s as queryCameraPermission } from "./permissionServices-Bj_fyWtv.esm.js";
9
- import { a as isBackFacingTrack, n as getBackCameraStream } from "./backCameraStream-BOtyQowf.esm.js";
8
+ import { s as queryCameraPermission } from "./permissionServices-EY3_Vx6c.esm.js";
9
+ import { n as CameraCompositor, t as MultipartRecordingService } from "./multipartRecordingService-YKu0Bd7S.esm.js";
10
+ import { a as isBackFacingTrack, n as getBackCameraStream } from "./backCameraStream-B0-YgP_y.esm.js";
10
11
  import { t as getDeviceClass } from "./getDeviceClass-5NYZg9s6.esm.js";
11
- import { t as MultipartRecordingService } from "./multipartRecordingService-OEgIRvqC.esm.js";
12
- import { i as CameraCompositor, n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider } from "./idCaptureDefaults-CbPA-Auz.esm.js";
12
+ import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider } from "./idCaptureDefaults-sJahGQgV.esm.js";
13
13
  //#region src/internal/camera/cameraServices.ts
14
14
  function createCameraServices(camera) {
15
15
  return {
@@ -577,6 +577,7 @@ function createMultipartSessionHandle(service, compositor, recordingSource) {
577
577
  needsVideoSourceReplacement: false,
578
578
  recorderPaused: false,
579
579
  recordingSource,
580
+ audioSource: recordingSource.getAudioTracks(),
580
581
  service
581
582
  });
582
583
  return session;
@@ -620,21 +621,62 @@ function prepareRecordingForCameraRetry(session) {
620
621
  const multipartSession = multipartIdSessions.get(session);
621
622
  if (!multipartSession) return;
622
623
  if (!multipartSession.recorderPaused) multipartSession.recorderPaused = multipartSession.service.pause();
623
- multipartSession.compositor.pause();
624
- multipartSession.recordingSource.getVideoTracks().forEach((track) => track.stop());
624
+ releaseCameraClone(multipartSession, { keepAudio: true });
625
625
  multipartSession.needsVideoSourceReplacement = true;
626
626
  }
627
627
  /**
628
- * Fully drains an ID recording before the protected camera cycle runs POC.
629
- * Every recorder clone is stopped before this promise settles.
628
+ * Resumes a recording paused with `pauseRecordingForAttempt` while its camera
629
+ * clone is still attached (no source replacement pending). Returns whether the
630
+ * recorder is recording again.
631
+ */
632
+ function resumeRecordingAfterPause(session) {
633
+ const multipartSession = multipartIdSessions.get(session);
634
+ if (!multipartSession || multipartSession.needsVideoSourceReplacement) return false;
635
+ if (!multipartSession.recorderPaused) return true;
636
+ if (!multipartSession.service.resume()) return false;
637
+ multipartSession.recorderPaused = false;
638
+ return true;
639
+ }
640
+ /**
641
+ * True only for a live SDK-managed multipart session. A session that has
642
+ * already been finalized or disposed is no longer in the registry, so callers
643
+ * use this to avoid resuming or re-pausing a torn-down recording.
644
+ */
645
+ function isSuspendableRecordingSession(session) {
646
+ return multipartIdSessions.has(session);
647
+ }
648
+ /**
649
+ * Ends the compositor's camera clone on the calling thread. The composite
650
+ * stream and its upload stay alive; only the tracks that pin the physical
651
+ * camera end. `keepAudio` preserves the compositor's audio track across a
652
+ * video-source swap. Every release path must call this before any async work
653
+ * so no camera clone can overlap a PRC or POC camera switch (ENG-47407) or pin
654
+ * the device for the next module (ENG-56648).
655
+ */
656
+ function releaseCameraClone(multipartSession, options) {
657
+ try {
658
+ multipartSession.compositor.pause();
659
+ } catch {}
660
+ const tracks = options.keepAudio ? multipartSession.recordingSource.getVideoTracks() : /* @__PURE__ */ new Set([...multipartSession.recordingSource.getTracks(), ...multipartSession.audioSource]);
661
+ for (const track of tracks) try {
662
+ track.stop();
663
+ } catch {}
664
+ }
665
+ /**
666
+ * Completes an ID recording: drains the multipart upload and releases the
667
+ * compositor. The camera clone ends synchronously, before this function
668
+ * returns its promise, so a step that ends mid-attempt never pins the camera
669
+ * while the upload finishes (ENG-56648). The composite canvas stays alive until
670
+ * the recorder has emitted its final chunk.
630
671
  */
631
672
  async function finalizeRecordingSession(session) {
632
673
  const existing = idRecordingFinalizations.get(session);
633
674
  if (existing) return existing;
634
675
  const multipartSession = multipartIdSessions.get(session);
635
676
  if (!multipartSession) return {};
677
+ multipartIdSessions.delete(session);
678
+ releaseCameraClone(multipartSession, { keepAudio: false });
636
679
  const finalization = (async () => {
637
- multipartIdSessions.delete(session);
638
680
  try {
639
681
  return await multipartSession.service.stop();
640
682
  } finally {
@@ -644,11 +686,16 @@ async function finalizeRecordingSession(session) {
644
686
  idRecordingFinalizations.set(session, finalization);
645
687
  return finalization;
646
688
  }
647
- /** Synchronous teardown used when an attempt is cancelled before finalization. */
689
+ /**
690
+ * Teardown for an attempt released before finalization. The camera clone ends
691
+ * synchronously, before this function returns; the upload completes in the
692
+ * background with whatever was recorded.
693
+ */
648
694
  function disposeRecordingSession(session) {
649
695
  const multipartSession = multipartIdSessions.get(session);
650
696
  if (multipartSession) {
651
697
  multipartIdSessions.delete(session);
698
+ releaseCameraClone(multipartSession, { keepAudio: false });
652
699
  const finalization = multipartSession.service.stop().finally(() => multipartSession.compositor.stop());
653
700
  idRecordingFinalizations.set(session, finalization);
654
701
  finalization.catch(() => {});
@@ -732,4 +779,4 @@ async function addBarcode(params) {
732
779
  return res.data;
733
780
  }
734
781
  //#endregion
735
- export { resolveCaptureOptimizingTreatment as _, getRealQualityValue as a, OPTIMIZING_WATCHDOG_MARGIN_MS as b, prepareRecordingForCameraRetry as c, stopRecording as d, stopStream as f, ID_ERROR_CODES as g, validateUploadResponse as h, finalizeRecordingSession as i, processId as l, uploadManualIdFile as m, barcodeToBase64 as n, initializeIdCapture as o, uploadIdImage as p, disposeRecordingSession as r, pauseRecordingForAttempt as s, addBarcode as t, startRecordingSession as u, resolveIdCaptureThresholds as v, getIdCameraStream as x, CAPTURE_OPTIMIZING as y };
782
+ export { getIdCameraStream as C, OPTIMIZING_WATCHDOG_MARGIN_MS as S, validateUploadResponse as _, getRealQualityValue as a, resolveIdCaptureThresholds as b, pauseRecordingForAttempt as c, resumeRecordingAfterPause as d, startRecordingSession as f, uploadManualIdFile as g, uploadIdImage as h, finalizeRecordingSession as i, prepareRecordingForCameraRetry as l, stopStream as m, barcodeToBase64 as n, initializeIdCapture as o, stopRecording as p, disposeRecordingSession as r, isSuspendableRecordingSession as s, addBarcode as t, processId as u, ID_ERROR_CODES as v, CAPTURE_OPTIMIZING as x, resolveCaptureOptimizingTreatment as y };
@@ -1,31 +1,31 @@
1
- import { l as BrowserStorageProvider } from "./setup-BWG-hivt.esm.js";
2
- import { r as WasmUtilProvider } from "./safeStorage-B-trhxg6.esm.js";
1
+ import { c as trueSightHintTransition, l as trueSightLog, m as isTrueSightTesting, r as noteTrueSightCaptureActivity } from "./trueSightService-D8yZwF3G.esm.js";
2
+ import { r as WasmUtilProvider } from "./safeStorage-BdU9_m2E.esm.js";
3
+ import { l as BrowserStorageProvider } from "./setup-D4YCSH31.esm.js";
3
4
  import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
4
- import { s as exposeExperimentOnce } from "./feature-management-E0mq0pMs.esm.js";
5
+ import { s as exposeExperimentOnce } from "./feature-management-C8OAO_CZ.esm.js";
5
6
  import { n as revokeObjectURL, t as getTimestamp } from "./IBrowserEnvironmentCapability-DEaRRk-R.esm.js";
6
7
  import { r as getToken, t as api } from "./api-Bx3gKW_y.esm.js";
7
- import { c as trueSightHintTransition, l as trueSightLog, m as isTrueSightTesting, r as noteTrueSightCaptureActivity } from "./trueSightService-BN-Hzw82.esm.js";
8
8
  import { n as eventModuleNames, s as recordExperimentAssignmentOnce } from "./events-ijlbX_Wx.esm.js";
9
- import { t as getDisableIpify } from "./sessionInitializer-BFk33E67.esm.js";
9
+ import { t as getDisableIpify } from "./sessionInitializer-BK5NjMe0.esm.js";
10
10
  import { t as endpoints } from "./endpoints-B-3Q-LUw.esm.js";
11
11
  import { t as addDeviceStats } from "./stats-CZcy2J53.esm.js";
12
12
  import { a as isIOS, s as isIPad, t as isAndroid, u as isMacOsSafari } from "./platform-DkcRc9JV.esm.js";
13
- import "./session-3LmvAU4S.esm.js";
13
+ import "./session-BABCfUhC.esm.js";
14
14
  import { c as not, i as assign, l as raise, n as enqueueActions, o as and, r as sendTo, t as setup } from "./xstate.esm-BuFLFuzz.esm.js";
15
15
  import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-BXeQ-Ucz.esm.js";
16
16
  import { n as getUrlSearchParam, t as buildUrlWithSearchParams } from "./urlUtils-D6phjq1-.esm.js";
17
17
  import { r as getCameraReacquisitionConstraints } from "./camera-sIa9ceW2.esm.js";
18
- import { n as invokeRequestPermissionActor, t as checkPermission } from "./permissionServices-Bj_fyWtv.esm.js";
19
- import { i as imageFileToDataUrl, n as runProtectedAttempt, o as flagIdManualReview, r as cameraCycleProvider, s as PROTECTED_CAPTURE_TARGET, t as createCameraCycleOwnership } from "./createCameraCycleOwnership-CX3hJGKc.esm.js";
18
+ import { n as invokeRequestPermissionActor, t as checkPermission } from "./permissionServices-EY3_Vx6c.esm.js";
19
+ import { i as imageFileToDataUrl, n as runProtectedAttempt, o as flagIdManualReview, r as cameraCycleProvider, s as PROTECTED_CAPTURE_TARGET, t as createCameraCycleOwnership } from "./createCameraCycleOwnership-DnwTl1ad.esm.js";
20
20
  import { t as IncodeCanvas } from "./canvas-BxFzWTt-.esm.js";
21
- import { n as needsMotionPrimeOnlyFromPermission, r as resolveStoredPermissionResult, t as isReadyForCaptureFromPermission } from "./permissionGuards-uYZYFu4J.esm.js";
22
- import { t as StreamCanvasProcessingSession } from "./StreamCanvasProcessingSession-CBnbTnOr.esm.js";
21
+ import { n as needsMotionPrimeOnlyFromPermission, r as resolveStoredPermissionResult, t as isReadyForCaptureFromPermission } from "./permissionGuards-D6TfVop2.esm.js";
22
+ import { i as StreamCanvasProcessingSession } from "./multipartRecordingService-YKu0Bd7S.esm.js";
23
23
  import { t as sleep } from "./ITimerCapability-DgdDzp8G.esm.js";
24
24
  import { t as getBrowser } from "./getBrowser-Cbe1C4Tn.esm.js";
25
25
  import { n as getWindowDimensions } from "./getDeviceClass-CeBiEayS.esm.js";
26
26
  import { n as runVirtualCameraCheck, t as frameSources } from "./virtualCameraCheck-Cjab7FTI.esm.js";
27
- import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider } from "./idCaptureDefaults-CbPA-Auz.esm.js";
28
- import { a as getRealQualityValue, b as OPTIMIZING_WATCHDOG_MARGIN_MS, c as prepareRecordingForCameraRetry, d as stopRecording, f as stopStream, g as ID_ERROR_CODES, h as validateUploadResponse, i as finalizeRecordingSession, l as processId, m as uploadManualIdFile, o as initializeIdCapture, p as uploadIdImage, r as disposeRecordingSession, t as addBarcode, u as startRecordingSession, v as resolveIdCaptureThresholds, x as getIdCameraStream, y as CAPTURE_OPTIMIZING } from "./idCaptureServices-i1KxugN7.esm.js";
27
+ import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider } from "./idCaptureDefaults-sJahGQgV.esm.js";
28
+ import { C as getIdCameraStream, S as OPTIMIZING_WATCHDOG_MARGIN_MS, _ as validateUploadResponse, a as getRealQualityValue, b as resolveIdCaptureThresholds, c as pauseRecordingForAttempt, d as resumeRecordingAfterPause, f as startRecordingSession, g as uploadManualIdFile, h as uploadIdImage, i as finalizeRecordingSession, l as prepareRecordingForCameraRetry, m as stopStream, o as initializeIdCapture, p as stopRecording, r as disposeRecordingSession, s as isSuspendableRecordingSession, t as addBarcode, u as processId, v as ID_ERROR_CODES, x as CAPTURE_OPTIMIZING } from "./idCaptureServices-DLqls7Xv.esm.js";
29
29
  import { t as StreamCanvasCapture } from "./StreamCanvasCapture-C9jtgBdT.esm.js";
30
30
  //#region src/modules/id/digitalUpload/digitalUploadErrors.ts
31
31
  const TERMINAL_FAIL_REASONS = /* @__PURE__ */ new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
@@ -1781,7 +1781,7 @@ fromPromise(async ({ input }) => {
1781
1781
  });
1782
1782
  fromPromise(async ({ input }) => {
1783
1783
  if (!input.dependencies) return;
1784
- const { loadDeepsightSession } = await import("./deepsightLoader-DDv3vhXU.esm.js");
1784
+ const { loadDeepsightSession } = await import("./deepsightLoader-DamOBrBJ.esm.js");
1785
1785
  return loadDeepsightSession({
1786
1786
  ds: input.ds,
1787
1787
  storage: input.dependencies.storage,
@@ -2224,7 +2224,7 @@ function cleanup(service) {
2224
2224
  service.cleanup();
2225
2225
  } catch {}
2226
2226
  }
2227
- function createIdMetadataPreparationCoordinator(load = async (input) => (await import("./deepsightLoader-DDv3vhXU.esm.js")).loadDeepsightSession(input)) {
2227
+ function createIdMetadataPreparationCoordinator(load = async (input) => (await import("./deepsightLoader-DamOBrBJ.esm.js")).loadDeepsightSession(input)) {
2228
2228
  let disposed = false;
2229
2229
  let preparation;
2230
2230
  let service;
@@ -2325,6 +2325,16 @@ function createIdProtectedCaptureController(dependencies = {}) {
2325
2325
  let attemptContext;
2326
2326
  let attemptSend;
2327
2327
  let diagnosticAttempt;
2328
+ const stepRecording = { retryPending: false };
2329
+ const recordingScopeFor = (context) => context.currentMode === "back" ? "backId" : "frontId";
2330
+ const completeStepRecording = () => {
2331
+ const session = stepRecording.session;
2332
+ stepRecording.session = void 0;
2333
+ stepRecording.scope = void 0;
2334
+ stepRecording.retryPending = false;
2335
+ if (!session) return;
2336
+ finalizeRecordingSession(session).catch(() => {});
2337
+ };
2328
2338
  const logDiagnostic = (event, fields = {}) => {
2329
2339
  if (!diagnosticAttempt) return;
2330
2340
  logIdCameraDiagnostic(event, {
@@ -2455,6 +2465,7 @@ function createIdProtectedCaptureController(dependencies = {}) {
2455
2465
  beginAttempt(context, send) {
2456
2466
  if (disposed) throw new Error("ID protected capture controller is disposed");
2457
2467
  clearAttempt();
2468
+ if (stepRecording.session && stepRecording.scope !== recordingScopeFor(context)) completeStepRecording();
2458
2469
  diagnosticAttempt = {
2459
2470
  attempt: ++protectedIdAttemptSequence,
2460
2471
  side: context.currentMode === "back" ? "back" : "front",
@@ -2462,7 +2473,7 @@ function createIdProtectedCaptureController(dependencies = {}) {
2462
2473
  };
2463
2474
  attemptContext = context;
2464
2475
  attemptSend = send;
2465
- provider = (dependencies.createProvider ?? createProtectedIdProvider)(context.config);
2476
+ provider = (dependencies.createProvider ?? createProtectedIdProvider)(context.config, context.currentMode);
2466
2477
  cycleOwnership = createCameraCycleOwnership(cameraCycleProvider);
2467
2478
  logDiagnostic("attempt-start", { aggregationMs: context.config?.thresholds?.framesAggregationInterval ?? DEFAULT_ID_CAPTURE_THRESHOLDS.framesAggregationInterval });
2468
2479
  },
@@ -2492,6 +2503,27 @@ function createIdProtectedCaptureController(dependencies = {}) {
2492
2503
  metadataCoordinator.dispose();
2493
2504
  releasePreAcquired();
2494
2505
  clearAttempt();
2506
+ completeStepRecording();
2507
+ },
2508
+ getStepRecording() {
2509
+ return stepRecording;
2510
+ },
2511
+ keepRecordingForRetry() {
2512
+ stepRecording.retryPending = true;
2513
+ },
2514
+ completeStepRecording,
2515
+ endRecordingStep() {
2516
+ if (stepRecording.retryPending) {
2517
+ stepRecording.retryPending = false;
2518
+ return;
2519
+ }
2520
+ completeStepRecording();
2521
+ },
2522
+ pauseStepRecording() {
2523
+ if (stepRecording.session) pauseRecordingForAttempt(stepRecording.session);
2524
+ },
2525
+ resumeStepRecording() {
2526
+ if (stepRecording.session) resumeRecordingAfterPause(stepRecording.session);
2495
2527
  },
2496
2528
  preAcquire,
2497
2529
  setVisible(nextVisible) {
@@ -2722,7 +2754,8 @@ function createIdCaptureOnlyDeliveryActor(ownedController) {
2722
2754
  });
2723
2755
  }
2724
2756
  let protectedIdAttemptSequence = 0;
2725
- function resolveProtectedIdWorkflow(config) {
2757
+ function resolveProtectedIdWorkflow(config, currentMode) {
2758
+ if (config.usSmartCapture === true && (currentMode === "back" || currentMode === "front" && config.modelVersion !== "v3")) return 0;
2726
2759
  if (config.modelVersion === "v3" || config.usSmartCapture === true) return 7;
2727
2760
  if (config.settings?.faceQualityCheckEnabled === true) return 8;
2728
2761
  if (config.settings?.faceQualityCheckEnabled === false) return 6;
@@ -2734,37 +2767,122 @@ function resolveProtectedIdTarget(config, currentMode) {
2734
2767
  if (config.isSecondId === true) return back ? PROTECTED_CAPTURE_TARGET.backSecondId : PROTECTED_CAPTURE_TARGET.frontSecondId;
2735
2768
  return back ? PROTECTED_CAPTURE_TARGET.backId : PROTECTED_CAPTURE_TARGET.frontId;
2736
2769
  }
2737
- function createProtectedIdProvider(config) {
2738
- const workflow = resolveProtectedIdWorkflow(config);
2770
+ function createProtectedIdProvider(config, currentMode) {
2771
+ const workflow = resolveProtectedIdWorkflow(config, currentMode);
2739
2772
  return workflow === 0 ? new IdCaptureProvider() : new IdCaptureProvider(workflow);
2740
2773
  }
2774
+ /**
2775
+ * Recorder hooks for one protected ID attempt over a step-scoped recording.
2776
+ *
2777
+ * The attempt never completes the scoped upload. It starts or resumes the held
2778
+ * session after PRC, pauses it and ends its camera clone synchronously when the
2779
+ * capture is committed (before POC), and suspends it the same way on release.
2780
+ * The controller completes the upload when the backend accepts the capture or
2781
+ * when the step ends without a retry (ENG-56648). A session that is no longer
2782
+ * live — already finalized or disposed — cannot be paused, so it is dropped and
2783
+ * torn down instead.
2784
+ */
2741
2785
  function createProtectedIdRecorderHooks(input) {
2742
- let session;
2786
+ const holder = input.stepRecording ?? { retryPending: false };
2787
+ const scope = input.currentMode === "back" ? "backId" : "frontId";
2743
2788
  const enabled = input.enabled !== false && input.config.enableIdRecording === true;
2789
+ let disposed = false;
2790
+ const dropHeldSession = () => {
2791
+ const session = holder.session;
2792
+ holder.session = void 0;
2793
+ holder.scope = void 0;
2794
+ return session;
2795
+ };
2796
+ /**
2797
+ * Ends the camera clone on the calling thread and keeps the paused upload for
2798
+ * the next attempt. Idempotent; never finalizes a multipart session.
2799
+ */
2800
+ const suspend = () => {
2801
+ const session = holder.session;
2802
+ if (!session) return;
2803
+ if (!isSuspendableRecordingSession(session)) {
2804
+ dropHeldSession();
2805
+ disposeRecordingSession(session);
2806
+ return;
2807
+ }
2808
+ try {
2809
+ prepareRecordingForCameraRetry(session);
2810
+ } catch {}
2811
+ };
2812
+ const warn = (message) => {
2813
+ trueSightLog("warning", "recording", "idScan", message);
2814
+ };
2744
2815
  return {
2745
2816
  mode: enabled ? "finalizeBeforePoc" : "none",
2746
2817
  async start(stream) {
2747
2818
  if (!enabled) return;
2748
- session = await startRecordingSession({
2749
- config: input.config,
2750
- stream,
2751
- type: input.currentMode === "back" ? "backId" : "frontId"
2752
- });
2819
+ if (holder.session && holder.scope !== scope) {
2820
+ const stale = dropHeldSession();
2821
+ if (stale) disposeRecordingSession(stale);
2822
+ }
2823
+ const existing = holder.session;
2824
+ let session;
2825
+ try {
2826
+ session = await startRecordingSession({
2827
+ config: input.config,
2828
+ stream,
2829
+ type: scope,
2830
+ existing
2831
+ });
2832
+ } catch (error) {
2833
+ if (existing) {
2834
+ suspend();
2835
+ warn("ID recording did not resume for this attempt");
2836
+ return;
2837
+ }
2838
+ throw error;
2839
+ }
2840
+ if (disposed) {
2841
+ if (session && session !== existing) disposeRecordingSession(session);
2842
+ else suspend();
2843
+ return;
2844
+ }
2845
+ if (session) {
2846
+ holder.session = session;
2847
+ holder.scope = scope;
2848
+ }
2753
2849
  },
2754
2850
  async prepareForPoc() {
2851
+ const session = holder.session;
2755
2852
  if (!session) return {};
2756
- const currentSession = session;
2757
- session = void 0;
2758
- return finalizeRecordingSession(currentSession);
2853
+ if (!isSuspendableRecordingSession(session)) {
2854
+ dropHeldSession();
2855
+ return finalizeRecordingSession(session);
2856
+ }
2857
+ suspend();
2858
+ return {};
2759
2859
  },
2760
2860
  async resumeAfterPoc() {},
2761
- pauseForBackground() {},
2762
- async resumeFromBackground() {},
2861
+ pauseForBackground() {
2862
+ suspend();
2863
+ },
2864
+ async resumeFromBackground(stream) {
2865
+ const existing = holder.session;
2866
+ if (!enabled || disposed || !existing || holder.scope !== scope || !isSuspendableRecordingSession(existing)) return;
2867
+ try {
2868
+ await startRecordingSession({
2869
+ config: input.config,
2870
+ stream,
2871
+ type: scope,
2872
+ existing
2873
+ });
2874
+ } catch {
2875
+ suspend();
2876
+ warn("ID recording did not resume after foreground");
2877
+ }
2878
+ },
2763
2879
  dispose() {
2764
- input.disposeCaptureCallbacks();
2765
- if (!session) return;
2766
- disposeRecordingSession(session);
2767
- session = void 0;
2880
+ disposed = true;
2881
+ try {
2882
+ input.disposeCaptureCallbacks();
2883
+ } finally {
2884
+ suspend();
2885
+ }
2768
2886
  }
2769
2887
  };
2770
2888
  }
@@ -2939,7 +3057,7 @@ function createProtectedIdAttemptInput(input) {
2939
3057
  const { context, controller } = input;
2940
3058
  const provider = controller.getProvider();
2941
3059
  if (!provider) throw new Error("Protected ID provider is unavailable");
2942
- const workflow = resolveProtectedIdWorkflow(context.config);
3060
+ const workflow = resolveProtectedIdWorkflow(context.config, context.currentMode);
2943
3061
  const target = resolveProtectedIdTarget(context.config, context.currentMode);
2944
3062
  const callbackSession = createProtectedIdCallbackSession(input);
2945
3063
  let wasmUtil;
@@ -2995,7 +3113,8 @@ function createProtectedIdAttemptInput(input) {
2995
3113
  config: context.config,
2996
3114
  currentMode: context.currentMode,
2997
3115
  disposeCaptureCallbacks: callbackSession.dispose,
2998
- enabled: !captureOnly
3116
+ enabled: !captureOnly,
3117
+ stepRecording: controller.getStepRecording()
2999
3118
  }),
3000
3119
  releaseUnadoptedStream: stopStream,
3001
3120
  beforeAdopt: captureOnly ? void 0 : async (stream) => {
@@ -3788,6 +3907,21 @@ const idCaptureMachine = setup({
3788
3907
  clearProtectedAttempt: ({ self }) => {
3789
3908
  getIdProtectedCaptureController(self).clearAttempt();
3790
3909
  },
3910
+ keepProtectedRecordingForRetry: ({ self }) => {
3911
+ getIdProtectedCaptureController(self).keepRecordingForRetry();
3912
+ },
3913
+ completeProtectedRecording: ({ self }) => {
3914
+ getIdProtectedCaptureController(self).completeStepRecording();
3915
+ },
3916
+ endProtectedRecordingStep: ({ self }) => {
3917
+ getIdProtectedCaptureController(self).endRecordingStep();
3918
+ },
3919
+ pauseProtectedRecording: ({ self }) => {
3920
+ getIdProtectedCaptureController(self).pauseStepRecording();
3921
+ },
3922
+ resumeProtectedRecording: ({ self }) => {
3923
+ getIdProtectedCaptureController(self).resumeStepRecording();
3924
+ },
3791
3925
  disposeProvider: ({ context }) => {
3792
3926
  performDisposeProvider(context);
3793
3927
  },
@@ -4553,6 +4687,7 @@ const idCaptureMachine = setup({
4553
4687
  exit: [
4554
4688
  "stopMediaRecording",
4555
4689
  "clearRecordingSession",
4690
+ "endProtectedRecordingStep",
4556
4691
  "clearProtectedAttempt"
4557
4692
  ],
4558
4693
  invoke: {
@@ -4592,7 +4727,7 @@ const idCaptureMachine = setup({
4592
4727
  always: "#idCapture.closed"
4593
4728
  },
4594
4729
  releasingForRetry: {
4595
- entry: "releaseProtectedForRetry",
4730
+ entry: ["keepProtectedRecordingForRetry", "releaseProtectedForRetry"],
4596
4731
  always: {
4597
4732
  target: "#idCapture.capture",
4598
4733
  reenter: true
@@ -4760,21 +4895,27 @@ const idCaptureMachine = setup({
4760
4895
  onError: { target: "uploading" }
4761
4896
  } },
4762
4897
  capturingBarcode: { always: [{ target: "submittingBarcodePreCapture" }] },
4763
- submittingBarcodePreCapture: { invoke: {
4764
- id: "submitBarcode",
4765
- src: "submitBarcode",
4766
- input: ({ context }) => ({
4767
- rawBarcode: context.decodedBarcode?.text ?? "",
4768
- metrics: context.decodedBarcode,
4769
- processId: context.config.skipProcessId !== true,
4770
- minDurationMs: 1e3
4771
- }),
4772
- onDone: {
4773
- target: "success",
4774
- actions: ["storeBarcodeResponse", "markBarcodeFastPathCaptured"]
4775
- },
4776
- onError: { target: "choosingDetectionStrategy" }
4777
- } },
4898
+ submittingBarcodePreCapture: {
4899
+ entry: "pauseProtectedRecording",
4900
+ invoke: {
4901
+ id: "submitBarcode",
4902
+ src: "submitBarcode",
4903
+ input: ({ context }) => ({
4904
+ rawBarcode: context.decodedBarcode?.text ?? "",
4905
+ metrics: context.decodedBarcode,
4906
+ processId: context.config.skipProcessId !== true,
4907
+ minDurationMs: 1e3
4908
+ }),
4909
+ onDone: {
4910
+ target: "success",
4911
+ actions: ["storeBarcodeResponse", "markBarcodeFastPathCaptured"]
4912
+ },
4913
+ onError: {
4914
+ target: "choosingDetectionStrategy",
4915
+ actions: "resumeProtectedRecording"
4916
+ }
4917
+ }
4918
+ },
4778
4919
  capturingManual: {
4779
4920
  entry: "finalizeProtectedAttempt",
4780
4921
  on: { PROTECTED_ATTEMPT_FINALIZED_SIGNAL: [
@@ -4888,32 +5029,36 @@ const idCaptureMachine = setup({
4888
5029
  },
4889
5030
  { target: "success" }
4890
5031
  ] },
4891
- uploadError: { on: { CONTINUE_FROM_ERROR: [
4892
- {
4893
- target: "releasingForRetry",
4894
- guard: "hasAttemptsRemaining",
4895
- actions: [
4896
- "resetDetection",
4897
- "clearUploadFailure",
4898
- "clearStreamForRetry"
4899
- ]
4900
- },
4901
- {
4902
- target: "#idCapture.frontFinished",
4903
- guard: "shouldContinueToBack",
4904
- actions: ["flagIdManualReview"]
4905
- },
4906
- {
4907
- target: "#idCapture.backFinished",
4908
- guard: "shouldContinueToFront",
4909
- actions: ["flagIdManualReview"]
4910
- },
4911
- {
4912
- target: "#idCapture.processing",
4913
- actions: ["flagIdManualReview"]
4914
- }
4915
- ] } },
5032
+ uploadError: {
5033
+ entry: "pauseProtectedRecording",
5034
+ on: { CONTINUE_FROM_ERROR: [
5035
+ {
5036
+ target: "releasingForRetry",
5037
+ guard: "hasAttemptsRemaining",
5038
+ actions: [
5039
+ "resetDetection",
5040
+ "clearUploadFailure",
5041
+ "clearStreamForRetry"
5042
+ ]
5043
+ },
5044
+ {
5045
+ target: "#idCapture.frontFinished",
5046
+ guard: "shouldContinueToBack",
5047
+ actions: ["flagIdManualReview"]
5048
+ },
5049
+ {
5050
+ target: "#idCapture.backFinished",
5051
+ guard: "shouldContinueToFront",
5052
+ actions: ["flagIdManualReview"]
5053
+ },
5054
+ {
5055
+ target: "#idCapture.processing",
5056
+ actions: ["flagIdManualReview"]
5057
+ }
5058
+ ] }
5059
+ },
4916
5060
  success: {
5061
+ entry: "completeProtectedRecording",
4917
5062
  exit: "clearBarcodeFastPathCaptured",
4918
5063
  on: { NEXT_STEP: [
4919
5064
  {
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as isConfigured, l as setup, o as reset, t as SetupOptions } from "./setup-Cv-JM9QC.js";
1
+ import { a as isConfigured, l as setup, o as reset, t as SetupOptions } from "./setup-Cyko6cAn.js";
2
2
  export { type SetupOptions, isConfigured, reset, setup };
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as reset, r as isConfigured, s as setup } from "./setup-BWG-hivt.esm.js";
1
+ import { i as reset, r as isConfigured, s as setup } from "./setup-D4YCSH31.esm.js";
2
2
  export { isConfigured, reset, setup };
@@ -1,3 +1,3 @@
1
1
  import { r as MandatoryConsentConfig } from "./types-9_esGTPj.js";
2
- import { a as MandatoryConsentActor, i as createMandatoryConsentManagerFromActor, n as MandatoryConsentState, o as mandatoryConsentMachine, r as createMandatoryConsentManager, t as MandatoryConsentManager } from "./mandatoryConsentManager-vhv1co_n.js";
2
+ import { a as MandatoryConsentActor, i as createMandatoryConsentManagerFromActor, n as MandatoryConsentState, o as mandatoryConsentMachine, r as createMandatoryConsentManager, t as MandatoryConsentManager } from "./mandatoryConsentManager-CJSyhTpi.js";
3
3
  export { type MandatoryConsentActor, type MandatoryConsentConfig, type MandatoryConsentManager, type MandatoryConsentState, createMandatoryConsentManager, createMandatoryConsentManagerFromActor, mandatoryConsentMachine };
@@ -57,6 +57,10 @@ declare const mandatoryConsentMachine: StateMachine<MandatoryConsentContext, {
57
57
  type: "setError";
58
58
  params: NonReducibleUnknown;
59
59
  };
60
+ toggleSigned: {
61
+ type: "toggleSigned";
62
+ params: NonReducibleUnknown;
63
+ };
60
64
  clearError: {
61
65
  type: "clearError";
62
66
  params: NonReducibleUnknown;
@@ -65,10 +69,6 @@ declare const mandatoryConsentMachine: StateMachine<MandatoryConsentContext, {
65
69
  type: "resetContext";
66
70
  params: NonReducibleUnknown;
67
71
  };
68
- toggleSigned: {
69
- type: "toggleSigned";
70
- params: NonReducibleUnknown;
71
- };
72
72
  }>, {
73
73
  type: "canSubmit";
74
74
  params: unknown;