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

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 (69) hide show
  1. package/dist/{BrowserDiagnosticsCryptoProvider-CU6kBvqv.esm.js → BrowserDiagnosticsCryptoProvider-C2E4mGEX.esm.js} +1 -1
  2. package/dist/{FaceDetectionProvider-BfhWkK90.esm.js → FaceDetectionProvider-DAVK6BAe.esm.js} +4 -4
  3. package/dist/ae-signature.esm.js +1 -1
  4. package/dist/{apiError-Budb6m6w.esm.js → apiError-BArJSmSN.esm.js} +1 -1
  5. package/dist/authentication.d.ts +2 -2
  6. package/dist/authentication.esm.js +2 -2
  7. package/dist/{authenticationManager-cMXhG70r.esm.js → authenticationManager-DNciG_Ri.esm.js} +3 -3
  8. package/dist/{authenticationManager-CjXBjC-c.d.ts → authenticationManager-DcTHmYmL.d.ts} +1 -1
  9. package/dist/{authenticationStateMachine-MOYz4HCf.esm.js → authenticationStateMachine-BFOcuSH6.esm.js} +2 -2
  10. package/dist/consent.d.ts +1 -1
  11. package/dist/{consentManager-BhYFeKiG.d.ts → consentManager-uhDPdU6i.d.ts} +8 -8
  12. package/dist/{deepsightLoader-DDv3vhXU.esm.js → deepsightLoader-DPJZSnHo.esm.js} +3 -3
  13. package/dist/document-capture.d.ts +1 -1
  14. package/dist/{documentCaptureManager-DensIj5F.d.ts → documentCaptureManager-DD0qtFdE.d.ts} +1 -1
  15. package/dist/dynamic-forms.esm.js +2 -2
  16. package/dist/{dynamicFormsManager-BbS-XMFc.esm.js → dynamicFormsManager-BDi3ffWG.esm.js} +1 -1
  17. package/dist/{dynamicFormsStateMachine-D8zHBCh4.esm.js → dynamicFormsStateMachine-B7-mpYDT.esm.js} +1 -1
  18. package/dist/ekyb.esm.js +3 -3
  19. package/dist/{ekybManager-5aiac8wL.esm.js → ekybManager-BfpqWpNP.esm.js} +1 -1
  20. package/dist/{ekybStateMachine-Bn2IE9rx.esm.js → ekybStateMachine-BGnzaF__.esm.js} +1 -1
  21. package/dist/electronic-signature.esm.js +1 -1
  22. package/dist/{electronicSignatureManager-BJJH0Tvi.esm.js → electronicSignatureManager-Bc8MLmTL.esm.js} +1 -1
  23. package/dist/extensibility.d.ts +8 -8
  24. package/dist/extensibility.esm.js +10 -10
  25. package/dist/{faceCaptureManagerFactory-BeUl8fl1.d.ts → faceCaptureManagerFactory-Cx-8SqRy.d.ts} +45 -37
  26. package/dist/{faceCaptureManagerFactory-B7Ms6pSs.esm.js → faceCaptureManagerFactory-qPW__uXd.esm.js} +1 -1
  27. package/dist/{faceCaptureSetup-bkAlr5d8.esm.js → faceCaptureSetup-DpM1YYl9.esm.js} +264 -42
  28. package/dist/{feature-management-E0mq0pMs.esm.js → feature-management-Bzr9uaS4.esm.js} +1 -1
  29. package/dist/feature-management.esm.js +1 -1
  30. package/dist/flow.esm.js +3 -3
  31. package/dist/{flowCompletionService-DJp1odGN.esm.js → flowCompletionService-D0qKFy5Y.esm.js} +1 -1
  32. package/dist/{flowServices-DjPFGs_D.esm.js → flowServices-CnyFU9Bz.esm.js} +4 -4
  33. package/dist/geolocation.esm.js +2 -2
  34. package/dist/{geolocationManager-D5906YXx.esm.js → geolocationManager-BqM__4xb.esm.js} +1 -1
  35. package/dist/{geolocationStateMachine-BVOduc3y.esm.js → geolocationStateMachine-DpxY4O3h.esm.js} +1 -1
  36. package/dist/id-selfie-flow.esm.js +8 -7
  37. package/dist/id.d.ts +2 -2
  38. package/dist/id.esm.js +4 -4
  39. package/dist/idCaptureDefaults-Cd-qOMUt.esm.js +282 -0
  40. package/dist/{idCaptureManager-rfV9dIXy.esm.js → idCaptureManager-CO4WBQQN.esm.js} +3 -3
  41. package/dist/{idCaptureManager-DKESug0R.d.ts → idCaptureManager-De7O0TOD.d.ts} +23 -4
  42. package/dist/{idCaptureServices-i1KxugN7.esm.js → idCaptureServices-CFuKdAW7.esm.js} +58 -11
  43. package/dist/{idCaptureStateMachine-Ne_PXth_.esm.js → idCaptureStateMachine-CzyZ_21z.esm.js} +210 -66
  44. package/dist/identity-reuse.d.ts +1 -1
  45. package/dist/{identityReuseManager-v2TH5g7e.d.ts → identityReuseManager-BFDI7iFK.d.ts} +4 -4
  46. package/dist/index.esm.js +1 -1
  47. package/dist/mandatory-consent.d.ts +1 -1
  48. package/dist/{mandatoryConsentManager-vhv1co_n.d.ts → mandatoryConsentManager-Csfl7_XQ.d.ts} +4 -4
  49. package/dist/{multipartRecordingService-OEgIRvqC.esm.js → multipartRecordingService-CuXLH4tK.esm.js} +446 -1
  50. package/dist/personhood.esm.js +4 -4
  51. package/dist/qe-signature.esm.js +1 -1
  52. package/dist/{runChildModule-CI1gGWN1.esm.js → runChildModule-CTeh8a1T.esm.js} +1 -1
  53. package/dist/{sdkVersion-BZh6dj53.esm.js → sdkVersion-DYlnESxD.esm.js} +1 -1
  54. package/dist/selfie.d.ts +2 -2
  55. package/dist/selfie.esm.js +5 -5
  56. package/dist/{selfieManager-B-2c1n_x.esm.js → selfieManager-CFGf-DmP.esm.js} +3 -3
  57. package/dist/{selfieManager-4RRLi21P.d.ts → selfieManager-jXqwqosi.d.ts} +1 -1
  58. package/dist/{selfieStateMachine-Bzx41R8d.esm.js → selfieStateMachine-BJVwANex.esm.js} +2 -2
  59. package/dist/{session-3LmvAU4S.esm.js → session-Cs6z9Stj.esm.js} +3 -3
  60. package/dist/session.esm.js +4 -4
  61. package/dist/{sessionInitializer-BFk33E67.esm.js → sessionInitializer-DKCQfxZ2.esm.js} +3 -3
  62. package/dist/{setup-BWG-hivt.esm.js → setup-B-qr0dC6.esm.js} +4 -4
  63. package/dist/{trueSightService-BN-Hzw82.esm.js → trueSightService-De306VXK.esm.js} +3 -3
  64. package/dist/video-selfie.esm.js +4 -5
  65. package/dist/{videoSelfieCameraWarmer-B8PcYqmz.esm.js → videoSelfieCameraWarmer-BRz5aQPN.esm.js} +3 -3
  66. package/dist/wasm.esm.js +1 -1
  67. package/dist/workflow.esm.js +14 -14
  68. package/package.json +3 -3
  69. package/dist/idCaptureDefaults-CbPA-Auz.esm.js +0 -727
@@ -0,0 +1,282 @@
1
+ import { b as resolveWasmSource, p as WASM_MODEL_FILES } from "./wasmWebClient-B7baE-Wf.esm.js";
2
+ import { p as getBarcodeEnhanceModelUrl } from "./setup-B-qr0dC6.esm.js";
3
+ import { s as wasmRuntime, t as getResolvedModelSource } from "./warmup-CUUnwYxe.esm.js";
4
+ import { i as BaseWasmProvider } from "./safeStorage-B-trhxg6.esm.js";
5
+ import { t as IncodeCanvas } from "./canvas-BxFzWTt-.esm.js";
6
+ //#region ../infra/src/wasm/idCaptureWasmApi.ts
7
+ var IdCaptureWasmApi = class {
8
+ constructor(runtime = wasmRuntime) {
9
+ this.runtime = runtime;
10
+ }
11
+ async setIdCaptureThresholds(type, blurThreshold, blurChangeThreshold, glareThreshold, clsThreshold, sideThreshold, iouThreshold, idDetectedTimeout, autocaptureTimeout, framesAggregationInterval) {
12
+ this.runtime.requireIdCaptureApi("Unable to set thresholds, cpp API hasn't been initialized").setIdCaptureThresholds(this.runtime.pipelineTypeToWasmEnum(type), blurThreshold, blurChangeThreshold, glareThreshold, clsThreshold, sideThreshold, iouThreshold, idDetectedTimeout, autocaptureTimeout, framesAggregationInterval);
13
+ }
14
+ async setIdCaptureCallbacks(type, onFarAway, onDetectionStarted, onMaskChange, onBlur, onGlare, onCapturing, onCapture, onBestFrame, onIDNotDetected, onSwitchToManualCapture, onIDTypeChange, onIDSideChange, onCapturingCounterValueChange) {
15
+ this.runtime.requireIdCaptureApi("Unable to set callbacks, cpp API hasn't been initialized").setIdCaptureCallbacks(this.runtime.pipelineTypeToWasmEnum(type), onFarAway, onDetectionStarted, onMaskChange, onBlur, onGlare, onCapturing, onCapture, onBestFrame, onIDNotDetected, onSwitchToManualCapture, onIDTypeChange, onIDSideChange, onCapturingCounterValueChange);
16
+ }
17
+ async setIdCaptureGeometryParams(type, areaDown, areaUp, areaIOSPassportUp, areaIOSPassportDown, widthIOSUp, widthIOSDown, widthDown, widthUp, windowOuterWidth, windowOuterHeight, windowInnerWidth, windowInnerHeight) {
18
+ this.runtime.requireIdCaptureApi("Unable to set geometry params, cpp API hasn't been initialized").setIdCaptureGeometryParams(this.runtime.pipelineTypeToWasmEnum(type), areaDown, areaUp, areaIOSPassportUp, areaIOSPassportDown, widthIOSUp, widthIOSDown, widthDown, widthUp, windowOuterWidth, windowOuterHeight, windowInnerWidth, windowInnerHeight);
19
+ }
20
+ async setIdCaptureConfigParams(type, isFixedMask, isIPhone14OrHigher, idType, isBlurCheckEnabled, isGlareCheckEnabled, _isIdFaceQualityCheckEnabled, isIouCheckEnabled, _isFPSLimitEnabled) {
21
+ this.runtime.requireIdCaptureApi("Unable to set config params, cpp API hasn't been initialized").setIdCaptureConfigParams(this.runtime.pipelineTypeToWasmEnum(type), isFixedMask, isIPhone14OrHigher, idType, isBlurCheckEnabled, isGlareCheckEnabled, isIouCheckEnabled);
22
+ }
23
+ setIdCaptureModelType(pipelineType, modelType) {
24
+ this.runtime.requireIdCaptureApi("Unable to set model type, cpp API hasn't been initialized").setIdCaptureModelType(this.runtime.pipelineTypeToWasmEnum(pipelineType), this.runtime.IdCaptureModelTypeToWasmEnum(modelType));
25
+ }
26
+ setIdBarcodeCaptureEnabled(pipelineType, enabled) {
27
+ this.runtime.requireIdCaptureApi("Unable to set barcode capture enabled, cpp API hasn't been initialized").setIdBarcodeCaptureEnabled(this.runtime.pipelineTypeToWasmEnum(pipelineType), enabled);
28
+ }
29
+ setIdBarcodeAutoCaptureOnDecode(pipelineType, enabled) {
30
+ this.runtime.requireIdCaptureApi("Unable to set barcode auto-capture-on-decode, cpp API hasn't been initialized").setIdBarcodeAutoCaptureOnDecode(this.runtime.pipelineTypeToWasmEnum(pipelineType), enabled);
31
+ }
32
+ setIdBarcodeDecodedCallback(pipelineType, onBarcodeDecoded) {
33
+ this.runtime.requireIdCaptureApi("Unable to set barcode decoded callback, cpp API hasn't been initialized").setIdBarcodeDecodedCallback(this.runtime.pipelineTypeToWasmEnum(pipelineType), onBarcodeDecoded);
34
+ }
35
+ async setIdBarcodeEnhancementModel(pipelineType, modelPath) {
36
+ const message = "Unable to set barcode enhancement model, cpp API hasn't been initialized";
37
+ this.runtime.requireIdCaptureApi(message);
38
+ const buffer = await resolveWasmSource(modelPath, "barcode model");
39
+ return this.runtime.requireIdCaptureApi(message).setBarcodeEnhancementModel(this.runtime.pipelineTypeToWasmEnum(pipelineType), buffer);
40
+ }
41
+ IdPerspectiveTransform(image, frameRect) {
42
+ return this.runtime.requireIdCaptureApi("Unable to perform perspective transform, cpp API hasn't been initialized").IdPerspectiveTransform(image, frameRect);
43
+ }
44
+ /**
45
+ * Kept-dead: mirrors upstream `wasmApi.runIdCapture`. Nothing in the SDK calls
46
+ * it; it exists so the mirror stays 1:1 with upstream at the pinned tag.
47
+ */
48
+ async runIdCapture(image) {
49
+ const idCaptureWasmApi = this.runtime.requireIdCaptureApi("Unable to run Id Capture, cpp API hasn't been initialized");
50
+ if (image) {
51
+ await this.runtime.allocateImageBuffers(image.width, image.height);
52
+ this.runtime.writeFrame(image);
53
+ }
54
+ return idCaptureWasmApi.runIdCapture();
55
+ }
56
+ };
57
+ const idCaptureWasmApi = new IdCaptureWasmApi();
58
+ //#endregion
59
+ //#region ../infra/src/providers/wasm/IdCaptureProvider.ts
60
+ var IdCaptureProvider = class extends BaseWasmProvider {
61
+ constructor(protectedWorkflow) {
62
+ super(protectedWorkflow ?? 0);
63
+ this.lastProcessResult = null;
64
+ this.capturedCanvas = null;
65
+ this.originalCapturedCanvas = null;
66
+ this.lastDecodedBarcode = null;
67
+ this.barcodeEnhancementModelLoaded = false;
68
+ }
69
+ async initialize(config) {
70
+ if (config.videoSelfie === true) {
71
+ if (this.pipelineType !== 0) throw new Error("[Incode SDK] Protected ID workflows are unavailable for video selfie.");
72
+ this.pipelineType = 2;
73
+ await this.initializeBase(config, "videoSelfieId");
74
+ } else await this.initializeBase(config, "idCapture");
75
+ }
76
+ setCallbacks(callbacks) {
77
+ this.ensureInitialized();
78
+ const onCaptureWrapper = (canvas) => {
79
+ callbacks.onCapture?.(canvas);
80
+ };
81
+ idCaptureWasmApi.setIdCaptureCallbacks(this.getPipelineType(), callbacks.onFarAway ?? (() => {}), callbacks.onDetectionStarted ?? (() => {}), callbacks.onMaskChange ? (show, mask, top, orientation) => callbacks.onMaskChange?.(show, mask, top, orientation) : () => {}, callbacks.onBlur ?? (() => {}), callbacks.onGlare ?? (() => {}), callbacks.onCapturing ?? (() => {}), callbacks.onCapture ? onCaptureWrapper : () => {}, callbacks.onBestFrame ? (blur, glare, orientation) => callbacks.onBestFrame?.(blur, glare, orientation) : () => {}, callbacks.onIdNotDetected ?? (() => {}), callbacks.onSwitchToManualCapture ?? (() => {}), callbacks.onIdTypeChange ? (idType) => callbacks.onIdTypeChange?.(idType) : () => {}, callbacks.onIdSideChange ? (side) => callbacks.onIdSideChange?.(side) : () => {}, callbacks.onCapturingCounterValueChange ? (value) => callbacks.onCapturingCounterValueChange?.(value) : () => {});
82
+ if (callbacks.onBarcodeDecoded) {
83
+ const onBarcodeDecoded = callbacks.onBarcodeDecoded;
84
+ idCaptureWasmApi.setIdBarcodeDecodedCallback(this.getPipelineType(), (decoded) => {
85
+ this.lastDecodedBarcode = decoded;
86
+ onBarcodeDecoded(decoded);
87
+ });
88
+ } else idCaptureWasmApi.setIdBarcodeDecodedCallback(this.getPipelineType(), () => {});
89
+ }
90
+ setThresholds(thresholds) {
91
+ this.ensureInitialized();
92
+ idCaptureWasmApi.setIdCaptureThresholds(this.getPipelineType(), thresholds.blurThreshold, thresholds.blurChangeThreshold, thresholds.glareThreshold, thresholds.clsThreshold, thresholds.sideThreshold, thresholds.iouThreshold, thresholds.idDetectedTimeout, thresholds.autocaptureTimeout, thresholds.framesAggregationInterval);
93
+ }
94
+ setGeometry(geometry) {
95
+ this.ensureInitialized();
96
+ idCaptureWasmApi.setIdCaptureGeometryParams(this.getPipelineType(), geometry.areaDown, geometry.areaUp, geometry.areaIOSPassportUp, geometry.areaIOSPassportDown, geometry.widthIOSUp, geometry.widthIOSDown, geometry.widthDown, geometry.widthUp, geometry.windowOuterWidth, geometry.windowOuterHeight, geometry.windowInnerWidth, geometry.windowInnerHeight);
97
+ }
98
+ setSettings(settings) {
99
+ this.ensureInitialized();
100
+ idCaptureWasmApi.setIdCaptureConfigParams(this.getPipelineType(), settings.isFixedMask, settings.isIPhone14OrHigher, settings.idType, settings.blurCheckEnabled, settings.glareCheckEnabled, settings.faceQualityCheckEnabled, settings.iouCheckEnabled, settings.fpsLimitEnabled);
101
+ }
102
+ setModelType(modelType) {
103
+ this.ensureInitialized();
104
+ let wasmModelType;
105
+ switch (modelType) {
106
+ case "v1":
107
+ wasmModelType = 0;
108
+ break;
109
+ case "v2":
110
+ wasmModelType = 1;
111
+ break;
112
+ case "v3":
113
+ wasmModelType = 2;
114
+ break;
115
+ default: throw new Error(`Unknown model type: ${modelType}`);
116
+ }
117
+ idCaptureWasmApi.setIdCaptureModelType(this.getPipelineType(), wasmModelType);
118
+ }
119
+ setBarcodeCaptureEnabled(enabled) {
120
+ this.ensureInitialized();
121
+ idCaptureWasmApi.setIdBarcodeCaptureEnabled(this.getPipelineType(), enabled);
122
+ }
123
+ setBarcodeAutoCaptureOnDecode(enabled) {
124
+ this.ensureInitialized();
125
+ idCaptureWasmApi.setIdBarcodeAutoCaptureOnDecode(this.getPipelineType(), enabled);
126
+ }
127
+ async setBarcodeEnhancementModel() {
128
+ this.ensureInitialized();
129
+ if (this.barcodeEnhancementModelLoaded) return true;
130
+ const modelUrl = getResolvedModelSource(WASM_MODEL_FILES.barcode, "idCapture") ?? getBarcodeEnhanceModelUrl();
131
+ const applied = await idCaptureWasmApi.setIdBarcodeEnhancementModel(this.getPipelineType(), modelUrl);
132
+ this.barcodeEnhancementModelLoaded = applied;
133
+ return applied;
134
+ }
135
+ getLastDecodedBarcode() {
136
+ return this.lastDecodedBarcode;
137
+ }
138
+ /**
139
+ * Processes a frame through the WASM pipeline and stores the result.
140
+ */
141
+ async processFrame(image) {
142
+ const result = await this.processFrameWasm(image);
143
+ const pipelineType = this.getPipelineType();
144
+ if (result && (pipelineType === 0 || pipelineType === 2)) this.lastProcessResult = result;
145
+ else this.lastProcessResult = null;
146
+ }
147
+ /**
148
+ * Gets the last process result from the most recent frame processing.
149
+ * @returns The last process result with quad coordinates, or null if not available
150
+ */
151
+ getLastProcessResult() {
152
+ return this.lastProcessResult;
153
+ }
154
+ transformPerspective(canvas, frameRect) {
155
+ this.ensureInitialized();
156
+ const originalWidth = canvas.width();
157
+ const originalHeight = canvas.height();
158
+ try {
159
+ const imageData = canvas.getImageData();
160
+ if (!imageData) return canvas;
161
+ const transformedCanvas = idCaptureWasmApi.IdPerspectiveTransform(imageData, frameRect);
162
+ if (transformedCanvas) {
163
+ const wrappedCanvas = new IncodeCanvas(transformedCanvas);
164
+ const wrappedWidth = wrappedCanvas.width();
165
+ const wrappedHeight = wrappedCanvas.height();
166
+ if (wrappedWidth === originalWidth && wrappedHeight === originalHeight) {
167
+ const croppedCanvas = this.cropCanvasToRect(wrappedCanvas, {
168
+ x: Math.round(frameRect.x),
169
+ y: Math.round(frameRect.y),
170
+ w: Math.round(frameRect.w),
171
+ h: Math.round(frameRect.h)
172
+ });
173
+ if (croppedCanvas) return croppedCanvas;
174
+ }
175
+ return wrappedCanvas;
176
+ }
177
+ return canvas;
178
+ } catch (_error) {
179
+ return canvas;
180
+ }
181
+ }
182
+ /**
183
+ * Crops a canvas to the specified rectangle region.
184
+ * @param canvas - The canvas to crop
185
+ * @param rect - The rectangle to crop to (x, y, w, h)
186
+ * @returns A new IncodeCanvas with the cropped region, or null if cropping fails
187
+ */
188
+ cropCanvasToRect(canvas, rect) {
189
+ const canvasWidth = canvas.width();
190
+ const canvasHeight = canvas.height();
191
+ if (!canvasWidth || !canvasHeight) return null;
192
+ const x = Math.max(0, Math.min(rect.x, canvasWidth));
193
+ const y = Math.max(0, Math.min(rect.y, canvasHeight));
194
+ const w = Math.max(1, Math.min(rect.w, canvasWidth - x));
195
+ const h = Math.max(1, Math.min(rect.h, canvasHeight - y));
196
+ const croppedCanvasElement = document.createElement("canvas");
197
+ croppedCanvasElement.width = w;
198
+ croppedCanvasElement.height = h;
199
+ const ctx = croppedCanvasElement.getContext("2d");
200
+ if (!ctx) return null;
201
+ ctx.drawImage(canvas.canvas, x, y, w, h, 0, 0, w, h);
202
+ return new IncodeCanvas(croppedCanvasElement);
203
+ }
204
+ /**
205
+ * Gets the captured canvas (transformed for preview).
206
+ * @returns The captured canvas, or null if not available
207
+ */
208
+ getCapturedCanvas() {
209
+ return this.capturedCanvas;
210
+ }
211
+ /**
212
+ * Gets the original captured canvas (full frame for upload).
213
+ * @returns The original captured canvas, or null if not available
214
+ */
215
+ getOriginalCapturedCanvas() {
216
+ return this.originalCapturedCanvas;
217
+ }
218
+ /**
219
+ * Sets the captured canvases (original and transformed).
220
+ * @param original - The original full-frame canvas (for upload)
221
+ * @param transformed - The transformed canvas (for preview)
222
+ */
223
+ setCapturedCanvases(original, transformed) {
224
+ this.originalCapturedCanvas = original;
225
+ this.capturedCanvas = transformed;
226
+ }
227
+ /**
228
+ * Re-arms WASM detection without discarding the captured result.
229
+ *
230
+ * Detection-session teardown runs immediately after a successful capture.
231
+ * The captured canvases must remain available for the subsequent upload and
232
+ * are only replaced by `setCapturedCanvases()` or cleared by a full reset.
233
+ */
234
+ resetDetectionState() {
235
+ super.reset();
236
+ this.lastProcessResult = null;
237
+ this.lastDecodedBarcode = null;
238
+ }
239
+ reset() {
240
+ this.resetDetectionState();
241
+ this.capturedCanvas = null;
242
+ this.originalCapturedCanvas = null;
243
+ }
244
+ async dispose() {
245
+ await super.dispose();
246
+ this.barcodeEnhancementModelLoaded = false;
247
+ }
248
+ };
249
+ //#endregion
250
+ //#region ../infra/src/wasm/idCaptureDefaults.ts
251
+ /**
252
+ * Default WASM thresholds for ID capture quality checks.
253
+ * Matches SDK 1's `wasmWorkflowsConfig.ts` production ID profile. Explicit
254
+ * consumer and experiment overrides still take precedence in Core.
255
+ */
256
+ const DEFAULT_ID_CAPTURE_THRESHOLDS = {
257
+ blurThreshold: .2,
258
+ blurChangeThreshold: .2,
259
+ glareThreshold: .3,
260
+ clsThreshold: .98,
261
+ sideThreshold: .8,
262
+ iouThreshold: .8,
263
+ idDetectedTimeout: 1e4,
264
+ autocaptureTimeout: 5e3,
265
+ framesAggregationInterval: 1700
266
+ };
267
+ /**
268
+ * Default geometry parameters for ID detection.
269
+ * Window dimensions must be provided at runtime.
270
+ */
271
+ const DEFAULT_ID_CAPTURE_GEOMETRY = {
272
+ areaDown: 25e3,
273
+ areaUp: 55e3,
274
+ areaIOSPassportUp: 3e4,
275
+ areaIOSPassportDown: 2e4,
276
+ widthIOSUp: 160,
277
+ widthIOSDown: 85,
278
+ widthDown: 110,
279
+ widthUp: 205
280
+ };
281
+ //#endregion
282
+ export { DEFAULT_ID_CAPTURE_THRESHOLDS as n, IdCaptureProvider as r, DEFAULT_ID_CAPTURE_GEOMETRY as t };
@@ -1,12 +1,12 @@
1
- import { l as BrowserStorageProvider } from "./setup-BWG-hivt.esm.js";
1
+ import { l as BrowserStorageProvider } from "./setup-B-qr0dC6.esm.js";
2
2
  import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-ijlbX_Wx.esm.js";
3
3
  import { t as topLevelStateName } from "./topLevelStateName-B5i2avbh.esm.js";
4
4
  import { s as createActor, u as createManager } from "./xstate.esm-BuFLFuzz.esm.js";
5
5
  import { t as setWasmDsFlagSync } from "./wasmDsFlagSync-B2e8p268.esm.js";
6
6
  import { t as BrowserVisibilityObserverProvider } from "./BrowserVisibilityObserverProvider-BrJN1B8A.esm.js";
7
7
  import { o as resetWasmMotionPrimedForModule, r as primeMotionFromUserGestureIfNeeded } from "./permissionServices-Bj_fyWtv.esm.js";
8
- import { a as createIdProtectedCaptureController, n as provideIdProtectedCaptureController, o as findIdProtectedCaptureController, s as getManualUploadTabs, t as idCaptureMachine } from "./idCaptureStateMachine-Ne_PXth_.esm.js";
9
- import { _ as resolveCaptureOptimizingTreatment, v as resolveIdCaptureThresholds } from "./idCaptureServices-i1KxugN7.esm.js";
8
+ import { a as createIdProtectedCaptureController, n as provideIdProtectedCaptureController, o as findIdProtectedCaptureController, s as getManualUploadTabs, t as idCaptureMachine } from "./idCaptureStateMachine-CzyZ_21z.esm.js";
9
+ import { b as resolveIdCaptureThresholds, y as resolveCaptureOptimizingTreatment } from "./idCaptureServices-CFuKdAW7.esm.js";
10
10
  //#region src/modules/id/digitalUpload/instrumentation.ts
11
11
  const TERMINAL_REASONS = /* @__PURE__ */ new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
12
12
  function isHoldingState(value) {
@@ -126,15 +126,34 @@ type StartRecordingParams = {
126
126
  declare function startRecordingSession(params: StartRecordingParams): Promise<object | undefined>;
127
127
  declare function pauseRecordingForAttempt(session: object): void;
128
128
  declare function prepareRecordingForCameraRetry(session: object): void;
129
+ /**
130
+ * Resumes a recording paused with `pauseRecordingForAttempt` while its camera
131
+ * clone is still attached (no source replacement pending). Returns whether the
132
+ * recorder is recording again.
133
+ */
134
+ declare function resumeRecordingAfterPause(session: object): boolean;
135
+ /**
136
+ * True only for a live SDK-managed multipart session. A session that has
137
+ * already been finalized or disposed is no longer in the registry, so callers
138
+ * use this to avoid resuming or re-pausing a torn-down recording.
139
+ */
140
+ declare function isSuspendableRecordingSession(session: object): boolean;
129
141
  type FinalizedIdRecording = Readonly<{
130
142
  recordingId?: string | null;
131
143
  }>;
132
144
  /**
133
- * Fully drains an ID recording before the protected camera cycle runs POC.
134
- * Every recorder clone is stopped before this promise settles.
145
+ * Completes an ID recording: drains the multipart upload and releases the
146
+ * compositor. The camera clone ends synchronously, before this function
147
+ * returns its promise, so a step that ends mid-attempt never pins the camera
148
+ * while the upload finishes (ENG-56648). The composite canvas stays alive until
149
+ * the recorder has emitted its final chunk.
135
150
  */
136
151
  declare function finalizeRecordingSession(session: object): Promise<FinalizedIdRecording>;
137
- /** Synchronous teardown used when an attempt is cancelled before finalization. */
152
+ /**
153
+ * Teardown for an attempt released before finalization. The camera clone ends
154
+ * synchronously, before this function returns; the upload completes in the
155
+ * background with whatever was recorded.
156
+ */
138
157
  declare function disposeRecordingSession(session: object): void;
139
158
  declare function stopRecording(session: object): void;
140
159
  declare function processId(isSecondId?: boolean, queueName?: string, signal?: AbortSignal): Promise<{
@@ -623,4 +642,4 @@ declare function createIdCaptureManager(options: CreateIdCaptureActorOptions): M
623
642
  deviceWalletUseAnotherMethod(): void;
624
643
  };
625
644
  //#endregion
626
- export { prepareRecordingForCameraRetry as A, addBarcode as C, getRealQualityValue as D, finalizeRecordingSession as E, uploadIdImage as F, uploadManualIdFile as I, validateUploadResponse as L, startRecordingSession as M, stopRecording as N, initializeIdCapture as O, stopStream as P, WasmUtilProvider as R, ValidationError as S, disposeRecordingSession as T, IdCaptureInitResult as _, CreateIdCaptureOnlyActorOptions as a, UploadIdImageParams as b, IdCaptureOnlyMachine as c, IdCaptureActor as d, createIdCaptureActor as f, FinalizedIdRecording as g, AddBarcodeParams as h, createIdCaptureManagerFromActor as i, processId as j, pauseRecordingForAttempt as k, idCaptureOnlyMachine as l, idCaptureMachine as m, IdCaptureManager as n, IdCaptureOnlyActor as o, IdCaptureMachine as p, IdCaptureState as r, createIdCaptureOnlyActor as s, createIdCaptureManager as t, CreateIdCaptureActorOptions as u, InitializeIdCaptureParams as v, barcodeToBase64 as w, UploadManualIdFileParams as x, StartRecordingParams as y };
645
+ export { pauseRecordingForAttempt as A, WasmUtilProvider as B, addBarcode as C, getRealQualityValue as D, finalizeRecordingSession as E, stopRecording as F, stopStream as I, uploadIdImage as L, processId as M, resumeRecordingAfterPause as N, initializeIdCapture as O, startRecordingSession as P, uploadManualIdFile as R, ValidationError as S, disposeRecordingSession as T, IdCaptureInitResult as _, CreateIdCaptureOnlyActorOptions as a, UploadIdImageParams as b, IdCaptureOnlyMachine as c, IdCaptureActor as d, createIdCaptureActor as f, FinalizedIdRecording as g, AddBarcodeParams as h, createIdCaptureManagerFromActor as i, prepareRecordingForCameraRetry as j, isSuspendableRecordingSession as k, idCaptureOnlyMachine as l, idCaptureMachine as m, IdCaptureManager as n, IdCaptureOnlyActor as o, IdCaptureMachine as p, IdCaptureState as r, createIdCaptureOnlyActor as s, createIdCaptureManager as t, CreateIdCaptureActorOptions as u, InitializeIdCaptureParams as v, barcodeToBase64 as w, UploadManualIdFileParams as x, StartRecordingParams as y, validateUploadResponse as z };
@@ -1,5 +1,5 @@
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-B-qr0dC6.esm.js";
2
+ import { i as numberParam, n as defineExperimentParams, t as booleanParam, u as resolveExperimentOnce } from "./feature-management-Bzr9uaS4.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";
@@ -8,8 +8,8 @@ import { n as fromPromise } from "./xstate-actors.esm-BXeQ-Ucz.esm.js";
8
8
  import { s as queryCameraPermission } from "./permissionServices-Bj_fyWtv.esm.js";
9
9
  import { a as isBackFacingTrack, n as getBackCameraStream } from "./backCameraStream-BOtyQowf.esm.js";
10
10
  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";
11
+ import { n as CameraCompositor, t as MultipartRecordingService } from "./multipartRecordingService-CuXLH4tK.esm.js";
12
+ import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider } from "./idCaptureDefaults-Cd-qOMUt.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 };