@incodetech/core 0.0.0-dev-20260403-eccc51c → 0.0.0-dev-20260407-4677d7f

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 (109) hide show
  1. package/dist/{BaseWasmProvider--AzPfwOm.esm.js → BaseWasmProvider-CQgeReKV.esm.js} +1 -785
  2. package/dist/MotionSensorProvider-BTDLt08l.esm.js +254 -0
  3. package/dist/StateMachine-8d441d6x.d.ts +2 -0
  4. package/dist/{WasmUtilProvider-BonqBWdj.esm.js → WasmUtilProvider-C45HStLj.esm.js} +1 -1
  5. package/dist/{addressSearch-DC5By0cC.esm.js → addressSearch-C5qzDvkN.esm.js} +15 -8
  6. package/dist/antifraud.d.ts +1 -1
  7. package/dist/antifraud.esm.js +3 -3
  8. package/dist/authentication.d.ts +11 -9
  9. package/dist/authentication.esm.js +18 -13
  10. package/dist/{authenticationManager-B4gSCgrO.esm.js → authenticationManager-CW4qxgcq.esm.js} +7 -6
  11. package/dist/{authenticationManager-Bd10YGSO.d.ts → authenticationManager-CiXsOTdM.d.ts} +2 -2
  12. package/dist/{backCameraStream-DF_d7hTz.esm.js → backCameraStream-CUo1USCT.esm.js} +2 -2
  13. package/dist/camera.d.ts +16 -0
  14. package/dist/camera.esm.js +5 -0
  15. package/dist/consent.d.ts +52 -52
  16. package/dist/consent.esm.js +3 -3
  17. package/dist/curp-validation.d.ts +5 -5
  18. package/dist/curp-validation.esm.js +3 -3
  19. package/dist/{deepsightLoader-DKgEdLIS.esm.js → deepsightLoader-Bs5jHgca.esm.js} +10 -7
  20. package/dist/deepsightService-C3gQ_9Ml.esm.js +493 -0
  21. package/dist/{deepsightService-Ciu0atv5.d.ts → deepsightService-CMAtxAC9.d.ts} +193 -197
  22. package/dist/device.d.ts +46 -0
  23. package/dist/device.esm.js +106 -0
  24. package/dist/document-capture.d.ts +78 -78
  25. package/dist/document-capture.esm.js +6 -6
  26. package/dist/document-upload.d.ts +53 -53
  27. package/dist/document-upload.esm.js +6 -6
  28. package/dist/ekyb.d.ts +3 -3
  29. package/dist/ekyb.esm.js +11 -10
  30. package/dist/ekyc.d.ts +3 -3
  31. package/dist/ekyc.esm.js +104 -22
  32. package/dist/email.d.ts +3 -3
  33. package/dist/email.esm.js +5 -5
  34. package/dist/{emailManager-CpAwvP3v.esm.js → emailManager-CZ2IGW0g.esm.js} +4 -4
  35. package/dist/{emailManager-BQPIJR_O.d.ts → emailManager-DEIxY7l6.d.ts} +2 -2
  36. package/dist/events-BlVGS-8F.esm.js +472 -0
  37. package/dist/events.d.ts +232 -0
  38. package/dist/events.esm.js +4 -0
  39. package/dist/extensibility.d.ts +15 -13
  40. package/dist/extensibility.esm.js +25 -20
  41. package/dist/face-match.d.ts +1 -1
  42. package/dist/face-match.esm.js +3 -3
  43. package/dist/{faceCaptureManagerFactory-CdwpYykv.d.ts → faceCaptureManagerFactory-CWj-nXdx.d.ts} +8 -6
  44. package/dist/{faceCaptureSetup-DbXgtcp7.esm.js → faceCaptureSetup-DIE5cftl.esm.js} +13 -10
  45. package/dist/flow.d.ts +7 -6
  46. package/dist/flow.esm.js +8 -8
  47. package/dist/{flowCompletionService-TnWijsSw.esm.js → flowCompletionService-N6-xypy-.esm.js} +2 -2
  48. package/dist/{flowServices-CO2sIR3D.esm.js → flowServices-xgqnJ64L.esm.js} +3 -3
  49. package/dist/geolocation.d.ts +2 -2
  50. package/dist/geolocation.esm.js +4 -4
  51. package/dist/getBrowser-B800KRAi.esm.js +41 -0
  52. package/dist/getDeviceClass-BKd2FOAf.esm.js +14 -0
  53. package/dist/government-validation.d.ts +2 -2
  54. package/dist/government-validation.esm.js +4 -4
  55. package/dist/http.d.ts +57 -0
  56. package/dist/http.esm.js +3 -0
  57. package/dist/id.d.ts +11 -10
  58. package/dist/id.esm.js +19 -15
  59. package/dist/{idCaptureManager-IdqsAASp.d.ts → idCaptureManager-H-rkXnbK.d.ts} +7 -6
  60. package/dist/{idCaptureManager-DaLU1ug7.esm.js → idCaptureManager-SHBRQ-X_.esm.js} +15 -11
  61. package/dist/index.d.ts +3 -611
  62. package/dist/index.esm.js +10 -562
  63. package/dist/{lib-i-4qLKdG.esm.js → lib-Cq5Wc-Hd.esm.js} +1 -1
  64. package/dist/mandatory-consent.d.ts +58 -58
  65. package/dist/mandatory-consent.esm.js +3 -3
  66. package/dist/permissionServices-CDqkkway.esm.js +50 -0
  67. package/dist/phone.d.ts +3 -3
  68. package/dist/phone.esm.js +5 -5
  69. package/dist/{phoneManager-DA8WUJtl.d.ts → phoneManager-Clfbrs6b.d.ts} +2 -2
  70. package/dist/{phoneManager-BAPHSXx8.esm.js → phoneManager-CscgaER2.esm.js} +4 -4
  71. package/dist/{StreamCanvasCapture-DkpkIgyL.esm.js → recordingsRepository-blYn-iKZ.esm.js} +157 -215
  72. package/dist/redirect-to-mobile.d.ts +2 -2
  73. package/dist/redirect-to-mobile.esm.js +4 -4
  74. package/dist/selfie.d.ts +11 -9
  75. package/dist/selfie.esm.js +18 -13
  76. package/dist/{selfieManager-BSkzncsa.esm.js → selfieManager-DeGqD5aN.esm.js} +5 -4
  77. package/dist/{selfieManager-Dft5wZQ_.d.ts → selfieManager-h_hhEefT.d.ts} +2 -2
  78. package/dist/{session-OglUYC9l.esm.js → session-PLjFj_T3.esm.js} +5 -19
  79. package/dist/session.d.ts +46 -2
  80. package/dist/session.esm.js +7 -4
  81. package/dist/setup-DJ3dFl5k.d.ts +120 -0
  82. package/dist/setup-fvDWE7f8.esm.js +450 -0
  83. package/dist/signature.d.ts +2 -2
  84. package/dist/signature.esm.js +3 -3
  85. package/dist/{stats-BVigf5Rn.esm.js → stats-BZ1kFW4p.esm.js} +1 -1
  86. package/dist/stats.esm.js +2 -2
  87. package/dist/{types-CiLyvJGb.d.ts → types-T0VjZW3T.d.ts} +1 -1
  88. package/dist/types-qhLxpptI.d.ts +5 -0
  89. package/dist/{types-D8Y1faI5.d.ts → types-zH5PDmSe.d.ts} +1 -1
  90. package/dist/{StateMachine-CM_aOfNL.d.ts → warmup-CEOVQKby.d.ts} +1 -4
  91. package/dist/wasm.d.ts +15 -0
  92. package/dist/wasm.esm.js +10 -0
  93. package/dist/{Manager-C6AGXEq_.esm.js → xstate.esm-BXrcOcSC.esm.js} +103 -507
  94. package/package.json +18 -2
  95. package/dist/endpoints-CI5-28jT.esm.js +0 -69
  96. package/dist/id-CzDAG_kM.esm.js +0 -0
  97. package/dist/index-BuVKc9bv.d.ts +0 -1
  98. /package/dist/{Actor-By8WNHi-.d.ts → Actor-C-jivmFF.d.ts} +0 -0
  99. /package/dist/{BrowserEnvironmentProvider-BECjyw3_.esm.js → BrowserEnvironmentProvider--xQUs3sg.esm.js} +0 -0
  100. /package/dist/{BrowserTimerProvider-CIqH6hJp.esm.js → BrowserTimerProvider-CkHEwJFa.esm.js} +0 -0
  101. /package/dist/{Manager-CCT_-HuZ.d.ts → Manager-BqFybBV-.d.ts} +0 -0
  102. /package/dist/{api-C2uzxrpN.esm.js → api-CyI8qTie.esm.js} +0 -0
  103. /package/dist/{browserSimulation-DYAk0Ipe.esm.js → browserSimulation-yzDdWSBf.esm.js} +0 -0
  104. /package/dist/{camera-6XJdOeBF.d.ts → camera-CKsQVNlH.d.ts} +0 -0
  105. /package/dist/{camera-DAuRUvnp.esm.js → camera-CsT06Zqy.esm.js} +0 -0
  106. /package/dist/{chunk-D6hkk-hd.esm.js → chunk-BcQWkoAq.esm.js} +0 -0
  107. /package/dist/{displayErrors-CGJwvrTl.d.ts → displayErrors-CjMXlBnu.d.ts} +0 -0
  108. /package/dist/{flowCompletionService-BOd4Rk8n.d.ts → flowCompletionService-BV6ThEJ1.d.ts} +0 -0
  109. /package/dist/{platform-DdhkonXk.esm.js → platform-Dcuv6w60.esm.js} +0 -0
@@ -1,20 +1,8 @@
1
- import { a as __toDynamicImportESM } from "./chunk-D6hkk-hd.esm.js";
2
- import { a as getDeviceInfo, i as IncodeCanvas, n as MotionSensorProvider } from "./BaseWasmProvider--AzPfwOm.esm.js";
3
- import { t as api } from "./api-C2uzxrpN.esm.js";
4
- import { t as endpoints } from "./endpoints-CI5-28jT.esm.js";
5
- import { i as stopCameraStream, r as requestCameraAccess } from "./camera-DAuRUvnp.esm.js";
1
+ import { a as __toDynamicImportESM } from "./chunk-BcQWkoAq.esm.js";
2
+ import { t as api } from "./api-CyI8qTie.esm.js";
3
+ import { _ as endpoints } from "./events-BlVGS-8F.esm.js";
4
+ import { n as IncodeCanvas } from "./deepsightService-C3gQ_9Ml.esm.js";
6
5
 
7
- //#region src/internal/device/getDeviceClass.ts
8
- function getDeviceClass() {
9
- const { userAgent, platform, maxTouchPoints } = getDeviceInfo();
10
- if (!userAgent) return "desktop";
11
- const ua = userAgent.toLowerCase();
12
- if (/iphone|ipad|ipod/.test(ua) || platform === "MacIntel" && maxTouchPoints > 1) return "ios";
13
- if (/android/.test(ua)) return "android";
14
- return "desktop";
15
- }
16
-
17
- //#endregion
18
6
  //#region ../infra/src/providers/browser/BrowserStorageProvider.ts
19
7
  /**
20
8
  * Browser-based storage provider wrapping localStorage.
@@ -69,104 +57,131 @@ var BrowserStorageProvider = class {
69
57
  };
70
58
 
71
59
  //#endregion
72
- //#region src/internal/manualReview/manualReviewService.ts
73
- async function flagFaceManualReview() {
74
- try {
75
- await api.put(endpoints.updateSession, { manualSelfieCheckNeeded: true });
76
- } catch {}
77
- }
78
- async function flagIdManualReview() {
79
- try {
80
- await api.put(endpoints.updateSession, { manualIdCheckNeeded: true });
81
- } catch {}
82
- }
83
-
84
- //#endregion
85
- //#region ../infra/src/media/StreamCanvasProcessingSession.ts
86
- var StreamCanvasProcessingSession = class {
60
+ //#region ../infra/src/media/StreamCanvasCapture.ts
61
+ var StreamCanvasCapture = class {
62
+ constructor(stream, options) {
63
+ this.hasFrame = false;
64
+ this.disposed = false;
65
+ this.eventTarget = new EventTarget();
66
+ this.video = document.createElement("video");
67
+ this.video.srcObject = stream;
68
+ this.video.autoplay = true;
69
+ this.video.playsInline = true;
70
+ this.video.muted = true;
71
+ const settings = stream.getVideoTracks()[0]?.getSettings();
72
+ const initialWidth = options?.width ?? settings?.width ?? 1280;
73
+ const initialHeight = options?.height ?? settings?.height ?? 720;
74
+ this.canvas = document.createElement("canvas");
75
+ this.canvas.width = initialWidth;
76
+ this.canvas.height = initialHeight;
77
+ this.ctx = this.canvas.getContext("2d", { willReadFrequently: true });
78
+ const fps = options?.fps ?? 10;
79
+ const intervalMs = fps > 0 ? Math.max(16, Math.floor(1e3 / fps)) : 0;
80
+ this.video.addEventListener("loadedmetadata", () => {
81
+ if (this.video.videoWidth > 0 && this.video.videoHeight > 0) {
82
+ this.canvas.width = this.video.videoWidth;
83
+ this.canvas.height = this.video.videoHeight;
84
+ }
85
+ });
86
+ try {
87
+ this.video.play();
88
+ } catch {}
89
+ this.rafLoop(intervalMs);
90
+ }
91
+ addEventListener(type, listener, options) {
92
+ this.eventTarget.addEventListener(type, listener, options);
93
+ }
94
+ removeEventListener(type, listener, options) {
95
+ this.eventTarget.removeEventListener(type, listener, options);
96
+ }
87
97
  /**
88
- * Creates a processing session that reacts to `StreamCanvasCapture` frame events
89
- * and drives a provider's `processFrame()` method with backpressure.
98
+ * Returns the latest cached frame as an {@link IncodeCanvas}.
90
99
  */
91
- constructor(params) {
92
- this.disposed = false;
93
- this.isProcessing = false;
94
- this.onFrameEvent = () => {
95
- if (this.disposed || this.isProcessing) return;
96
- const frame = this.capturer.getLatestFrame();
97
- if (!frame) return;
98
- this.onFrame?.(frame);
99
- this.isProcessing = true;
100
- this.provider.processFrame(frame).catch(() => {}).finally(() => {
101
- this.isProcessing = false;
102
- });
103
- };
104
- this.capturer = params.capturer;
105
- this.provider = params.provider;
106
- this.onFrame = params.onFrame;
107
- this.capturer.addEventListener("frame", this.onFrameEvent);
100
+ getLatestCanvas() {
101
+ if (!this.hasFrame) this.tick();
102
+ if (!this.hasFrame) return null;
103
+ return new IncodeCanvas(this.canvas);
108
104
  }
109
105
  /**
110
- * Unsubscribes from frame events and resets the provider.
106
+ * Returns the latest cached frame as raw {@link ImageData}.
107
+ */
108
+ getLatestFrame() {
109
+ if (!this.ctx) return null;
110
+ if (!this.hasFrame) this.tick();
111
+ if (!this.hasFrame) return null;
112
+ try {
113
+ return this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
114
+ } catch {
115
+ return null;
116
+ }
117
+ }
118
+ /**
119
+ * Disposes internal resources and stops the capture loop.
111
120
  */
112
121
  dispose() {
113
122
  if (this.disposed) return;
114
123
  this.disposed = true;
115
- this.capturer.removeEventListener("frame", this.onFrameEvent);
116
- this.provider.reset();
124
+ if (this.rafId !== void 0) {
125
+ window.cancelAnimationFrame(this.rafId);
126
+ this.rafId = void 0;
127
+ }
128
+ this.video.srcObject = null;
129
+ this.canvas.width = 0;
130
+ this.canvas.height = 0;
131
+ this.hasFrame = false;
117
132
  }
118
- /**
119
- * Returns whether the session has been disposed.
120
- */
121
- isDisposed() {
122
- return this.disposed;
133
+ rafLoop(intervalMs) {
134
+ const loop = (timeMs) => {
135
+ if (this.disposed) return;
136
+ if (intervalMs <= 0 || this.lastTickTimeMs === void 0 || timeMs - this.lastTickTimeMs >= intervalMs) {
137
+ this.lastTickTimeMs = timeMs;
138
+ const previousFrameTimeSeconds = this.lastFrameTimeSeconds;
139
+ this.tick();
140
+ const currentFrameTimeSeconds = this.video.currentTime;
141
+ if (previousFrameTimeSeconds === void 0) {
142
+ if (this.hasFrame) {
143
+ this.lastFrameTimeSeconds = currentFrameTimeSeconds;
144
+ this.eventTarget.dispatchEvent(new Event("frame"));
145
+ }
146
+ } else if (this.hasFrame && currentFrameTimeSeconds !== previousFrameTimeSeconds) {
147
+ this.lastFrameTimeSeconds = currentFrameTimeSeconds;
148
+ this.eventTarget.dispatchEvent(new Event("frame"));
149
+ }
150
+ }
151
+ this.rafId = window.requestAnimationFrame(loop);
152
+ };
153
+ this.rafId = window.requestAnimationFrame(loop);
154
+ }
155
+ tick() {
156
+ if (!this.ctx) return;
157
+ if (this.video.readyState < HTMLMediaElement.HAVE_CURRENT_DATA) return;
158
+ const videoWidth = this.video.videoWidth;
159
+ const videoHeight = this.video.videoHeight;
160
+ if (videoWidth === 0 || videoHeight === 0) return;
161
+ if (this.canvas.width !== videoWidth || this.canvas.height !== videoHeight) {
162
+ this.canvas.width = videoWidth;
163
+ this.canvas.height = videoHeight;
164
+ }
165
+ try {
166
+ this.ctx.drawImage(this.video, 0, 0);
167
+ this.hasFrame = true;
168
+ } catch {
169
+ this.hasFrame = false;
170
+ }
123
171
  }
124
172
  };
125
173
 
126
174
  //#endregion
127
- //#region ../infra/src/media/permissions.ts
128
- async function queryPermission(name) {
175
+ //#region src/internal/manualReview/manualReviewService.ts
176
+ async function flagFaceManualReview() {
129
177
  try {
130
- if (typeof navigator === "undefined" || !navigator.permissions) return "prompt";
131
- return (await navigator.permissions.query({ name })).state;
132
- } catch {
133
- return "prompt";
134
- }
135
- }
136
- async function queryCameraPermission() {
137
- return queryPermission("camera");
138
- }
139
-
140
- //#endregion
141
- //#region src/internal/permissions/permissionServices.ts
142
- /**
143
- * Checks the current camera permission state without prompting the user.
144
- */
145
- async function checkPermission() {
146
- return queryCameraPermission();
147
- }
148
- /**
149
- * Requests motion sensor permission. Must be called during a user gesture on iOS.
150
- * Returns the permission result.
151
- */
152
- async function requestMotionPermission() {
153
- return new MotionSensorProvider().requestPermission();
178
+ await api.put(endpoints.updateSession, { manualSelfieCheckNeeded: true });
179
+ } catch {}
154
180
  }
155
- /**
156
- * Requests camera permission by attempting to access the camera, then immediately
157
- * stops the obtained stream. Also requests motion sensor permission (required on iOS
158
- * to be called during a user gesture). This function does not keep or return the stream.
159
- */
160
- async function requestPermission() {
181
+ async function flagIdManualReview() {
161
182
  try {
162
- await requestMotionPermission();
163
- stopCameraStream(await requestCameraAccess({ video: true }));
164
- return "granted";
165
- } catch (error) {
166
- const name = error instanceof Error ? error.name : void 0;
167
- if (name === "NotAllowedError" || name === "PermissionDeniedError") return "denied";
168
- return "prompt";
169
- }
183
+ await api.put(endpoints.updateSession, { manualIdCheckNeeded: true });
184
+ } catch {}
170
185
  }
171
186
 
172
187
  //#endregion
@@ -174,7 +189,7 @@ async function requestPermission() {
174
189
  let openViduImport;
175
190
  async function loadOpenVidu() {
176
191
  if (openViduImport) return openViduImport;
177
- openViduImport = import("./lib-i-4qLKdG.esm.js").then(__toDynamicImportESM(1));
192
+ openViduImport = import("./lib-Cq5Wc-Hd.esm.js").then(__toDynamicImportESM(1));
178
193
  return openViduImport;
179
194
  }
180
195
 
@@ -262,6 +277,48 @@ var OpenViduRecordingProvider = class {
262
277
  }
263
278
  };
264
279
 
280
+ //#endregion
281
+ //#region ../infra/src/media/StreamCanvasProcessingSession.ts
282
+ var StreamCanvasProcessingSession = class {
283
+ /**
284
+ * Creates a processing session that reacts to `StreamCanvasCapture` frame events
285
+ * and drives a provider's `processFrame()` method with backpressure.
286
+ */
287
+ constructor(params) {
288
+ this.disposed = false;
289
+ this.isProcessing = false;
290
+ this.onFrameEvent = () => {
291
+ if (this.disposed || this.isProcessing) return;
292
+ const frame = this.capturer.getLatestFrame();
293
+ if (!frame) return;
294
+ this.onFrame?.(frame);
295
+ this.isProcessing = true;
296
+ this.provider.processFrame(frame).catch(() => {}).finally(() => {
297
+ this.isProcessing = false;
298
+ });
299
+ };
300
+ this.capturer = params.capturer;
301
+ this.provider = params.provider;
302
+ this.onFrame = params.onFrame;
303
+ this.capturer.addEventListener("frame", this.onFrameEvent);
304
+ }
305
+ /**
306
+ * Unsubscribes from frame events and resets the provider.
307
+ */
308
+ dispose() {
309
+ if (this.disposed) return;
310
+ this.disposed = true;
311
+ this.capturer.removeEventListener("frame", this.onFrameEvent);
312
+ this.provider.reset();
313
+ }
314
+ /**
315
+ * Returns whether the session has been disposed.
316
+ */
317
+ isDisposed() {
318
+ return this.disposed;
319
+ }
320
+ };
321
+
265
322
  //#endregion
266
323
  //#region src/internal/recordings/recordingsRepository.ts
267
324
  async function createRecordingSession(type) {
@@ -292,119 +349,4 @@ async function uploadDeepsightVideo(encryptedVideo, token) {
292
349
  }
293
350
 
294
351
  //#endregion
295
- //#region ../infra/src/media/StreamCanvasCapture.ts
296
- var StreamCanvasCapture = class {
297
- constructor(stream, options) {
298
- this.hasFrame = false;
299
- this.disposed = false;
300
- this.eventTarget = new EventTarget();
301
- this.video = document.createElement("video");
302
- this.video.srcObject = stream;
303
- this.video.autoplay = true;
304
- this.video.playsInline = true;
305
- this.video.muted = true;
306
- const settings = stream.getVideoTracks()[0]?.getSettings();
307
- const initialWidth = options?.width ?? settings?.width ?? 1280;
308
- const initialHeight = options?.height ?? settings?.height ?? 720;
309
- this.canvas = document.createElement("canvas");
310
- this.canvas.width = initialWidth;
311
- this.canvas.height = initialHeight;
312
- this.ctx = this.canvas.getContext("2d", { willReadFrequently: true });
313
- const fps = options?.fps ?? 10;
314
- const intervalMs = fps > 0 ? Math.max(16, Math.floor(1e3 / fps)) : 0;
315
- this.video.addEventListener("loadedmetadata", () => {
316
- if (this.video.videoWidth > 0 && this.video.videoHeight > 0) {
317
- this.canvas.width = this.video.videoWidth;
318
- this.canvas.height = this.video.videoHeight;
319
- }
320
- });
321
- try {
322
- this.video.play();
323
- } catch {}
324
- this.rafLoop(intervalMs);
325
- }
326
- addEventListener(type, listener, options) {
327
- this.eventTarget.addEventListener(type, listener, options);
328
- }
329
- removeEventListener(type, listener, options) {
330
- this.eventTarget.removeEventListener(type, listener, options);
331
- }
332
- /**
333
- * Returns the latest cached frame as an {@link IncodeCanvas}.
334
- */
335
- getLatestCanvas() {
336
- if (!this.hasFrame) this.tick();
337
- if (!this.hasFrame) return null;
338
- return new IncodeCanvas(this.canvas);
339
- }
340
- /**
341
- * Returns the latest cached frame as raw {@link ImageData}.
342
- */
343
- getLatestFrame() {
344
- if (!this.ctx) return null;
345
- if (!this.hasFrame) this.tick();
346
- if (!this.hasFrame) return null;
347
- try {
348
- return this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
349
- } catch {
350
- return null;
351
- }
352
- }
353
- /**
354
- * Disposes internal resources and stops the capture loop.
355
- */
356
- dispose() {
357
- if (this.disposed) return;
358
- this.disposed = true;
359
- if (this.rafId !== void 0) {
360
- window.cancelAnimationFrame(this.rafId);
361
- this.rafId = void 0;
362
- }
363
- this.video.srcObject = null;
364
- this.canvas.width = 0;
365
- this.canvas.height = 0;
366
- this.hasFrame = false;
367
- }
368
- rafLoop(intervalMs) {
369
- const loop = (timeMs) => {
370
- if (this.disposed) return;
371
- if (intervalMs <= 0 || this.lastTickTimeMs === void 0 || timeMs - this.lastTickTimeMs >= intervalMs) {
372
- this.lastTickTimeMs = timeMs;
373
- const previousFrameTimeSeconds = this.lastFrameTimeSeconds;
374
- this.tick();
375
- const currentFrameTimeSeconds = this.video.currentTime;
376
- if (previousFrameTimeSeconds === void 0) {
377
- if (this.hasFrame) {
378
- this.lastFrameTimeSeconds = currentFrameTimeSeconds;
379
- this.eventTarget.dispatchEvent(new Event("frame"));
380
- }
381
- } else if (this.hasFrame && currentFrameTimeSeconds !== previousFrameTimeSeconds) {
382
- this.lastFrameTimeSeconds = currentFrameTimeSeconds;
383
- this.eventTarget.dispatchEvent(new Event("frame"));
384
- }
385
- }
386
- this.rafId = window.requestAnimationFrame(loop);
387
- };
388
- this.rafId = window.requestAnimationFrame(loop);
389
- }
390
- tick() {
391
- if (!this.ctx) return;
392
- if (this.video.readyState < HTMLMediaElement.HAVE_CURRENT_DATA) return;
393
- const videoWidth = this.video.videoWidth;
394
- const videoHeight = this.video.videoHeight;
395
- if (videoWidth === 0 || videoHeight === 0) return;
396
- if (this.canvas.width !== videoWidth || this.canvas.height !== videoHeight) {
397
- this.canvas.width = videoWidth;
398
- this.canvas.height = videoHeight;
399
- }
400
- try {
401
- this.ctx.drawImage(this.video, 0, 0);
402
- this.hasFrame = true;
403
- } catch {
404
- this.hasFrame = false;
405
- }
406
- }
407
- };
408
-
409
- //#endregion
410
- export { uploadDeepsightVideo as a, requestPermission as c, flagIdManualReview as d, BrowserStorageProvider as f, stopRecording as i, StreamCanvasProcessingSession as l, createRecordingSession as n, OpenViduRecordingProvider as o, getDeviceClass as p, startRecording as r, checkPermission as s, StreamCanvasCapture as t, flagFaceManualReview as u };
352
+ export { StreamCanvasProcessingSession as a, flagIdManualReview as c, uploadDeepsightVideo as i, StreamCanvasCapture as l, startRecording as n, OpenViduRecordingProvider as o, stopRecording as r, flagFaceManualReview as s, createRecordingSession as t, BrowserStorageProvider as u };
@@ -1,5 +1,5 @@
1
- import "./Actor-By8WNHi-.js";
2
- import { t as Manager } from "./Manager-CCT_-HuZ.js";
1
+ import { t as Manager } from "./Manager-BqFybBV-.js";
2
+ import "./Actor-C-jivmFF.js";
3
3
 
4
4
  //#region src/modules/redirect-to-mobile/types.d.ts
5
5
  type RedirectToMobileConfig = {
@@ -1,7 +1,7 @@
1
- import { t as api } from "./api-C2uzxrpN.esm.js";
2
- import { C as createActor, S as fromPromise, b as assign, r as eventModuleNames, s as createManagerInstrumentation, t as createManager, x as fromCallback, y as setup } from "./Manager-C6AGXEq_.esm.js";
3
- import { t as endpoints } from "./endpoints-CI5-28jT.esm.js";
4
- import { t as BrowserTimerProvider } from "./BrowserTimerProvider-CIqH6hJp.esm.js";
1
+ import { t as api } from "./api-CyI8qTie.esm.js";
2
+ import { _ as endpoints, n as eventModuleNames, o as createManagerInstrumentation } from "./events-BlVGS-8F.esm.js";
3
+ import { a as createActor, i as fromPromise, n as assign, o as createManager, r as fromCallback, t as setup } from "./xstate.esm-BXrcOcSC.esm.js";
4
+ import { t as BrowserTimerProvider } from "./BrowserTimerProvider-CkHEwJFa.esm.js";
5
5
 
6
6
  //#region ../infra/src/url/urlUtils.ts
7
7
  function getUrlSearchParam(url, param) {
package/dist/selfie.d.ts CHANGED
@@ -1,10 +1,12 @@
1
- import "./StateMachine-CM_aOfNL.js";
2
- import "./Actor-By8WNHi-.js";
3
- import { c as PermissionResult, l as PermissionStatus, t as DeepsightService } from "./deepsightService-Ciu0atv5.js";
4
- import { t as CameraStream } from "./camera-6XJdOeBF.js";
5
- import "./types-CiLyvJGb.js";
6
- import "./types-D8Y1faI5.js";
7
- import "./Manager-CCT_-HuZ.js";
8
- import { a as SelfieMachine, d as SelfieConfig, o as selfieMachine, v as DetectionStatus, y as FaceErrorCode } from "./faceCaptureManagerFactory-CdwpYykv.js";
9
- import { a as ProcessFaceResponse, n as SelfieState, o as processFace, r as createSelfieManager, t as SelfieManager } from "./selfieManager-Dft5wZQ_.js";
1
+ import "./warmup-CEOVQKby.js";
2
+ import "./Manager-BqFybBV-.js";
3
+ import "./Actor-C-jivmFF.js";
4
+ import "./StateMachine-8d441d6x.js";
5
+ import { a as SelfieMachine, d as SelfieConfig, o as selfieMachine, v as DetectionStatus, y as FaceErrorCode } from "./faceCaptureManagerFactory-CWj-nXdx.js";
6
+ import { t as CameraStream } from "./camera-CKsQVNlH.js";
7
+ import "./types-T0VjZW3T.js";
8
+ import "./types-zH5PDmSe.js";
9
+ import { t as DeepsightService } from "./deepsightService-CMAtxAC9.js";
10
+ import { n as PermissionStatus, t as PermissionResult } from "./types-qhLxpptI.js";
11
+ import { a as ProcessFaceResponse, n as SelfieState, o as processFace, r as createSelfieManager, t as SelfieManager } from "./selfieManager-h_hhEefT.js";
10
12
  export { type CameraStream, type DeepsightService, type DetectionStatus, type FaceErrorCode, type PermissionResult, type PermissionStatus, type ProcessFaceResponse, type SelfieConfig, type SelfieMachine, type SelfieManager, type SelfieState, createSelfieManager, processFace, selfieMachine };
@@ -1,15 +1,20 @@
1
- import "./platform-DdhkonXk.esm.js";
2
- import "./BaseWasmProvider--AzPfwOm.esm.js";
3
- import "./StreamCanvasCapture-DkpkIgyL.esm.js";
4
- import "./browserSimulation-DYAk0Ipe.esm.js";
5
- import "./api-C2uzxrpN.esm.js";
6
- import "./Manager-C6AGXEq_.esm.js";
7
- import "./endpoints-CI5-28jT.esm.js";
8
- import "./camera-DAuRUvnp.esm.js";
9
- import "./stats-BVigf5Rn.esm.js";
10
- import "./backCameraStream-DF_d7hTz.esm.js";
11
- import "./WasmUtilProvider-BonqBWdj.esm.js";
12
- import { n as processFace } from "./faceCaptureSetup-DbXgtcp7.esm.js";
13
- import { r as selfieMachine, t as createSelfieManager } from "./selfieManager-BSkzncsa.esm.js";
1
+ import "./BaseWasmProvider-CQgeReKV.esm.js";
2
+ import "./WasmUtilProvider-C45HStLj.esm.js";
3
+ import "./api-CyI8qTie.esm.js";
4
+ import "./events-BlVGS-8F.esm.js";
5
+ import "./browserSimulation-yzDdWSBf.esm.js";
6
+ import "./xstate.esm-BXrcOcSC.esm.js";
7
+ import { n as processFace } from "./faceCaptureSetup-DIE5cftl.esm.js";
8
+ import "./recordingsRepository-blYn-iKZ.esm.js";
9
+ import "./deepsightService-C3gQ_9Ml.esm.js";
10
+ import "./camera-CsT06Zqy.esm.js";
11
+ import "./getBrowser-B800KRAi.esm.js";
12
+ import "./stats-BZ1kFW4p.esm.js";
13
+ import "./MotionSensorProvider-BTDLt08l.esm.js";
14
+ import "./permissionServices-CDqkkway.esm.js";
15
+ import "./platform-Dcuv6w60.esm.js";
16
+ import "./backCameraStream-CUo1USCT.esm.js";
17
+ import "./getDeviceClass-BKd2FOAf.esm.js";
18
+ import { r as selfieMachine, t as createSelfieManager } from "./selfieManager-DeGqD5aN.esm.js";
14
19
 
15
20
  export { createSelfieManager, processFace, selfieMachine };
@@ -1,7 +1,8 @@
1
- import { f as BrowserStorageProvider } from "./StreamCanvasCapture-DkpkIgyL.esm.js";
2
- import { C as createActor, S as fromPromise, b as assign, r as eventModuleNames } from "./Manager-C6AGXEq_.esm.js";
3
- import { t as WasmUtilProvider } from "./WasmUtilProvider-BonqBWdj.esm.js";
4
- import { a as createFaceCaptureManagerFromActor, i as FACE_ERROR_CODES, n as processFace, r as uploadSelfie, t as faceCaptureMachine } from "./faceCaptureSetup-DbXgtcp7.esm.js";
1
+ import { t as WasmUtilProvider } from "./WasmUtilProvider-C45HStLj.esm.js";
2
+ import { n as eventModuleNames } from "./events-BlVGS-8F.esm.js";
3
+ import { a as createActor, i as fromPromise, n as assign } from "./xstate.esm-BXrcOcSC.esm.js";
4
+ import { a as createFaceCaptureManagerFromActor, i as FACE_ERROR_CODES, n as processFace, r as uploadSelfie, t as faceCaptureMachine } from "./faceCaptureSetup-DIE5cftl.esm.js";
5
+ import { u as BrowserStorageProvider } from "./recordingsRepository-blYn-iKZ.esm.js";
5
6
 
6
7
  //#region src/modules/selfie/selfieErrorUtils.ts
7
8
  const FACE_ERROR_CODE_VALUES = Object.values(FACE_ERROR_CODES);
@@ -1,5 +1,5 @@
1
- import { t as Manager } from "./Manager-CCT_-HuZ.js";
2
- import { i as SelfieActor, n as FaceCaptureManagerState, r as CreateSelfieActorOptions, t as FaceCaptureManager } from "./faceCaptureManagerFactory-CdwpYykv.js";
1
+ import { t as Manager } from "./Manager-BqFybBV-.js";
2
+ import { i as SelfieActor, n as FaceCaptureManagerState, r as CreateSelfieActorOptions, t as FaceCaptureManager } from "./faceCaptureManagerFactory-CWj-nXdx.js";
3
3
 
4
4
  //#region src/modules/selfie/selfieUploadService.d.ts
5
5
  type ProcessFaceImageType = 'selfie' | 'videoSelfie';
@@ -1,8 +1,7 @@
1
- import { t as isBrowserSimulation } from "./browserSimulation-DYAk0Ipe.esm.js";
2
- import { n as getApi, t as api } from "./api-C2uzxrpN.esm.js";
3
- import { h as addEvent } from "./Manager-C6AGXEq_.esm.js";
4
- import { t as endpoints } from "./endpoints-CI5-28jT.esm.js";
5
- import { t as BrowserEnvironmentProvider } from "./BrowserEnvironmentProvider-BECjyw3_.esm.js";
1
+ import { n as getApi, t as api } from "./api-CyI8qTie.esm.js";
2
+ import { _ as endpoints, m as addEvent } from "./events-BlVGS-8F.esm.js";
3
+ import { t as BrowserEnvironmentProvider } from "./BrowserEnvironmentProvider--xQUs3sg.esm.js";
4
+ import { t as isBrowserSimulation } from "./browserSimulation-yzDdWSBf.esm.js";
6
5
 
7
6
  //#region src/internal/session/sessionService.ts
8
7
  /**
@@ -3090,13 +3089,6 @@ async function initializeSession(options = {}) {
3090
3089
  return sessionInitPromise;
3091
3090
  }
3092
3091
  /**
3093
- * Gets the cached feature configuration.
3094
- * Returns undefined if session hasn't been initialized.
3095
- */
3096
- function getSessionFeatures() {
3097
- return cachedFeatures ?? void 0;
3098
- }
3099
- /**
3100
3092
  * Gets the cached disableIpify flag.
3101
3093
  * Returns false if session hasn't been initialized.
3102
3094
  */
@@ -3107,12 +3099,6 @@ function getSessionFingerprintResult() {
3107
3099
  return cachedFingerprintResult;
3108
3100
  }
3109
3101
  /**
3110
- * Checks if the session has been initialized.
3111
- */
3112
- function isSessionInitialized() {
3113
- return sessionInitialized;
3114
- }
3115
- /**
3116
3102
  * Resets session initialization state.
3117
3103
  * Useful for testing or when starting a new session.
3118
3104
  */
@@ -3127,4 +3113,4 @@ function resetSessionInit() {
3127
3113
  }
3128
3114
 
3129
3115
  //#endregion
3130
- export { isSessionInitialized as a, FingerprintProvider as c, initializeSession as i, getDeviceFingerprintInfo as l, getSessionFeatures as n, resetSessionInit as o, getSessionFingerprintResult as r, IpifyProvider as s, getDisableIpify as t, createSession as u };
3116
+ export { IpifyProvider as a, createSession as c, resetSessionInit as i, getSessionFingerprintResult as n, FingerprintProvider as o, initializeSession as r, getDeviceFingerprintInfo as s, getDisableIpify as t };
package/dist/session.d.ts CHANGED
@@ -1,2 +1,46 @@
1
- import { n as GetFinishStatusFn, r as getFinishStatus, t as FinishStatus } from "./flowCompletionService-BOd4Rk8n.js";
2
- export { type FinishStatus, type GetFinishStatusFn, getFinishStatus };
1
+ import { n as GetFinishStatusFn, r as getFinishStatus, t as FinishStatus } from "./flowCompletionService-BV6ThEJ1.js";
2
+
3
+ //#region src/internal/session/sessionService.d.ts
4
+ type CreateSessionOptions = {
5
+ /** The configuration/flow ID from the Incode dashboard */
6
+ configurationId: string;
7
+ /** External ID to associate with this session */
8
+ externalId?: string;
9
+ /** External customer ID */
10
+ externalCustomerId?: string;
11
+ /** Language for the session (e.g., 'en-US', 'es-MX') */
12
+ language?: string;
13
+ /** Custom fields to attach to the session */
14
+ customFields?: Record<string, unknown>;
15
+ /** UUID for continuing an existing session */
16
+ uuid?: string;
17
+ /** Interview ID for continuing an existing interview */
18
+ interviewId?: string;
19
+ };
20
+ type Session = {
21
+ token: string;
22
+ interviewId: string;
23
+ uuid?: string;
24
+ regulationType?: string;
25
+ showMandatoryConsent?: boolean;
26
+ };
27
+ /**
28
+ * Creates a new onboarding session.
29
+ *
30
+ * @param apiKey - The API key from the Incode dashboard
31
+ * @param options - Session creation options
32
+ * @param signal - Optional AbortSignal for request cancellation
33
+ * @returns The created session with token
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const session = await createSession('your-api-key', {
38
+ * configurationId: 'your-flow-id',
39
+ * language: 'en-US',
40
+ * });
41
+ * console.log(session.token); // Use this token for subsequent API calls
42
+ * ```
43
+ */
44
+ declare function createSession(apiKey: string, options: CreateSessionOptions, signal?: AbortSignal): Promise<Session>;
45
+ //#endregion
46
+ export { type CreateSessionOptions, type FinishStatus, type GetFinishStatusFn, type Session, createSession, getFinishStatus };
@@ -1,5 +1,8 @@
1
- import "./api-C2uzxrpN.esm.js";
2
- import "./endpoints-CI5-28jT.esm.js";
3
- import { t as getFinishStatus } from "./flowCompletionService-TnWijsSw.esm.js";
1
+ import "./api-CyI8qTie.esm.js";
2
+ import "./events-BlVGS-8F.esm.js";
3
+ import { c as createSession } from "./session-PLjFj_T3.esm.js";
4
+ import "./BrowserEnvironmentProvider--xQUs3sg.esm.js";
5
+ import "./browserSimulation-yzDdWSBf.esm.js";
6
+ import { t as getFinishStatus } from "./flowCompletionService-N6-xypy-.esm.js";
4
7
 
5
- export { getFinishStatus };
8
+ export { createSession, getFinishStatus };