@incodetech/core 0.0.0-dev-20260407-4677d7f → 0.0.0-dev-20260407-2c382da

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-CQgeReKV.esm.js → BaseWasmProvider--AzPfwOm.esm.js} +785 -1
  2. package/dist/{xstate.esm-BXrcOcSC.esm.js → Manager-C6AGXEq_.esm.js} +507 -103
  3. package/dist/{warmup-CEOVQKby.d.ts → StateMachine-CM_aOfNL.d.ts} +4 -1
  4. package/dist/{recordingsRepository-blYn-iKZ.esm.js → StreamCanvasCapture-DkpkIgyL.esm.js} +215 -157
  5. package/dist/{WasmUtilProvider-C45HStLj.esm.js → WasmUtilProvider-BonqBWdj.esm.js} +1 -1
  6. package/dist/{addressSearch-C5qzDvkN.esm.js → addressSearch-B8Fo4v9V.esm.js} +4 -4
  7. package/dist/antifraud.d.ts +1 -1
  8. package/dist/antifraud.esm.js +3 -3
  9. package/dist/authentication.d.ts +9 -11
  10. package/dist/authentication.esm.js +13 -18
  11. package/dist/{authenticationManager-CW4qxgcq.esm.js → authenticationManager-B4gSCgrO.esm.js} +6 -7
  12. package/dist/{authenticationManager-CiXsOTdM.d.ts → authenticationManager-Bd10YGSO.d.ts} +2 -2
  13. package/dist/{backCameraStream-CUo1USCT.esm.js → backCameraStream-DF_d7hTz.esm.js} +2 -2
  14. package/dist/consent.d.ts +52 -52
  15. package/dist/consent.esm.js +3 -3
  16. package/dist/curp-validation.d.ts +5 -5
  17. package/dist/curp-validation.esm.js +3 -3
  18. package/dist/{deepsightLoader-Bs5jHgca.esm.js → deepsightLoader-DKgEdLIS.esm.js} +7 -10
  19. package/dist/{deepsightService-CMAtxAC9.d.ts → deepsightService-Ciu0atv5.d.ts} +197 -193
  20. package/dist/document-capture.d.ts +70 -70
  21. package/dist/document-capture.esm.js +6 -6
  22. package/dist/document-upload.d.ts +4 -4
  23. package/dist/document-upload.esm.js +6 -6
  24. package/dist/ekyb.d.ts +3 -3
  25. package/dist/ekyb.esm.js +9 -9
  26. package/dist/ekyc.d.ts +3 -3
  27. package/dist/ekyc.esm.js +5 -5
  28. package/dist/email.d.ts +3 -3
  29. package/dist/email.esm.js +5 -5
  30. package/dist/{emailManager-DEIxY7l6.d.ts → emailManager-BQPIJR_O.d.ts} +2 -2
  31. package/dist/{emailManager-CZ2IGW0g.esm.js → emailManager-CpAwvP3v.esm.js} +4 -4
  32. package/dist/endpoints-CI5-28jT.esm.js +69 -0
  33. package/dist/extensibility.d.ts +13 -15
  34. package/dist/extensibility.esm.js +20 -25
  35. package/dist/face-match.d.ts +1 -1
  36. package/dist/face-match.esm.js +3 -3
  37. package/dist/{faceCaptureManagerFactory-CWj-nXdx.d.ts → faceCaptureManagerFactory-CdwpYykv.d.ts} +6 -8
  38. package/dist/{faceCaptureSetup-DIE5cftl.esm.js → faceCaptureSetup-DbXgtcp7.esm.js} +10 -13
  39. package/dist/flow.d.ts +6 -7
  40. package/dist/flow.esm.js +8 -8
  41. package/dist/{flowCompletionService-N6-xypy-.esm.js → flowCompletionService-TnWijsSw.esm.js} +2 -2
  42. package/dist/{flowServices-xgqnJ64L.esm.js → flowServices-CO2sIR3D.esm.js} +3 -3
  43. package/dist/geolocation.d.ts +2 -2
  44. package/dist/geolocation.esm.js +4 -4
  45. package/dist/government-validation.d.ts +2 -2
  46. package/dist/government-validation.esm.js +4 -4
  47. package/dist/id-CzDAG_kM.esm.js +0 -0
  48. package/dist/id.d.ts +10 -11
  49. package/dist/id.esm.js +15 -19
  50. package/dist/{idCaptureManager-SHBRQ-X_.esm.js → idCaptureManager-DaLU1ug7.esm.js} +11 -15
  51. package/dist/{idCaptureManager-H-rkXnbK.d.ts → idCaptureManager-IdqsAASp.d.ts} +6 -7
  52. package/dist/index-BuVKc9bv.d.ts +1 -0
  53. package/dist/index.d.ts +611 -3
  54. package/dist/index.esm.js +562 -10
  55. package/dist/{lib-Cq5Wc-Hd.esm.js → lib-i-4qLKdG.esm.js} +1 -1
  56. package/dist/mandatory-consent.d.ts +55 -55
  57. package/dist/mandatory-consent.esm.js +3 -3
  58. package/dist/phone.d.ts +3 -3
  59. package/dist/phone.esm.js +5 -5
  60. package/dist/{phoneManager-CscgaER2.esm.js → phoneManager-BAPHSXx8.esm.js} +4 -4
  61. package/dist/{phoneManager-Clfbrs6b.d.ts → phoneManager-DA8WUJtl.d.ts} +2 -2
  62. package/dist/redirect-to-mobile.d.ts +2 -2
  63. package/dist/redirect-to-mobile.esm.js +4 -4
  64. package/dist/selfie.d.ts +9 -11
  65. package/dist/selfie.esm.js +13 -18
  66. package/dist/{selfieManager-DeGqD5aN.esm.js → selfieManager-BSkzncsa.esm.js} +4 -5
  67. package/dist/{selfieManager-h_hhEefT.d.ts → selfieManager-Dft5wZQ_.d.ts} +2 -2
  68. package/dist/{session-PLjFj_T3.esm.js → session-OglUYC9l.esm.js} +19 -5
  69. package/dist/session.d.ts +2 -46
  70. package/dist/session.esm.js +4 -7
  71. package/dist/signature.d.ts +2 -2
  72. package/dist/signature.esm.js +3 -3
  73. package/dist/{stats-BZ1kFW4p.esm.js → stats-BVigf5Rn.esm.js} +1 -1
  74. package/dist/stats.esm.js +2 -2
  75. package/dist/{types-T0VjZW3T.d.ts → types-CiLyvJGb.d.ts} +1 -1
  76. package/dist/{types-zH5PDmSe.d.ts → types-D8Y1faI5.d.ts} +1 -1
  77. package/package.json +2 -18
  78. package/dist/MotionSensorProvider-BTDLt08l.esm.js +0 -254
  79. package/dist/StateMachine-8d441d6x.d.ts +0 -2
  80. package/dist/camera.d.ts +0 -16
  81. package/dist/camera.esm.js +0 -5
  82. package/dist/deepsightService-C3gQ_9Ml.esm.js +0 -493
  83. package/dist/device.d.ts +0 -46
  84. package/dist/device.esm.js +0 -106
  85. package/dist/events-BlVGS-8F.esm.js +0 -472
  86. package/dist/events.d.ts +0 -232
  87. package/dist/events.esm.js +0 -4
  88. package/dist/getBrowser-B800KRAi.esm.js +0 -41
  89. package/dist/getDeviceClass-BKd2FOAf.esm.js +0 -14
  90. package/dist/http.d.ts +0 -57
  91. package/dist/http.esm.js +0 -3
  92. package/dist/permissionServices-CDqkkway.esm.js +0 -50
  93. package/dist/setup-DJ3dFl5k.d.ts +0 -120
  94. package/dist/setup-fvDWE7f8.esm.js +0 -450
  95. package/dist/types-qhLxpptI.d.ts +0 -5
  96. package/dist/wasm.d.ts +0 -15
  97. package/dist/wasm.esm.js +0 -10
  98. /package/dist/{Actor-C-jivmFF.d.ts → Actor-By8WNHi-.d.ts} +0 -0
  99. /package/dist/{BrowserEnvironmentProvider--xQUs3sg.esm.js → BrowserEnvironmentProvider-BECjyw3_.esm.js} +0 -0
  100. /package/dist/{BrowserTimerProvider-CkHEwJFa.esm.js → BrowserTimerProvider-CIqH6hJp.esm.js} +0 -0
  101. /package/dist/{Manager-BqFybBV-.d.ts → Manager-CCT_-HuZ.d.ts} +0 -0
  102. /package/dist/{api-CyI8qTie.esm.js → api-C2uzxrpN.esm.js} +0 -0
  103. /package/dist/{browserSimulation-yzDdWSBf.esm.js → browserSimulation-DYAk0Ipe.esm.js} +0 -0
  104. /package/dist/{camera-CKsQVNlH.d.ts → camera-6XJdOeBF.d.ts} +0 -0
  105. /package/dist/{camera-CsT06Zqy.esm.js → camera-DAuRUvnp.esm.js} +0 -0
  106. /package/dist/{chunk-BcQWkoAq.esm.js → chunk-D6hkk-hd.esm.js} +0 -0
  107. /package/dist/{displayErrors-CjMXlBnu.d.ts → displayErrors-CGJwvrTl.d.ts} +0 -0
  108. /package/dist/{flowCompletionService-BV6ThEJ1.d.ts → flowCompletionService-BOd4Rk8n.d.ts} +0 -0
  109. /package/dist/{platform-Dcuv6w60.esm.js → platform-DdhkonXk.esm.js} +0 -0
@@ -1,106 +1,6 @@
1
- //#region ../infra/src/manager/Manager.ts
2
- /**
3
- * Creates a manager that wraps a state machine actor with a clean public API.
4
- *
5
- * The manager provides:
6
- * - `getState()` - Returns the mapped public state
7
- * - `subscribe()` - Listen to state changes
8
- * - `stop()` - Stop the actor
9
- * - Plus any custom API methods from `createApi`
10
- *
11
- * @template TMachine - The state machine type
12
- * @template TMapState - Function type that maps raw snapshot to public state
13
- * @template TCreateApi - Function type that creates the custom API
14
- *
15
- * @param options - Configuration options
16
- * @param options.actor - The started actor instance
17
- * @param options.mapState - Function to transform raw snapshot into public state
18
- * @param options.createApi - Factory function to create custom API methods
19
- *
20
- * @returns Combined manager with base methods and custom API
21
- *
22
- * @example
23
- * ```ts
24
- * const manager = createManager({
25
- * actor: createActor(myMachine).start(),
26
- * mapState: (snapshot) => ({ status: snapshot.value }),
27
- * createApi: ({ actor }) => ({
28
- * doSomething() { actor.send({ type: 'DO_IT' }); }
29
- * }),
30
- * });
31
- * ```
32
- */
33
- function createManager(options) {
34
- const { actor, mapState, createApi, instrumentation } = options;
35
- function getSnapshot() {
36
- return actor.getSnapshot();
37
- }
38
- function getState() {
39
- return mapState(getSnapshot());
40
- }
41
- function subscribe(listener) {
42
- const subscription = actor.subscribe(() => {
43
- listener(getState());
44
- });
45
- return () => subscription.unsubscribe();
46
- }
47
- let currentScreenName = instrumentation.getScreenName(getSnapshot());
48
- let currentErrorName = instrumentation.getErrorName(getSnapshot());
49
- let currentErrorPayload = instrumentation.getErrorPayload(getSnapshot());
50
- const api = createApi({
51
- actor,
52
- getSnapshot,
53
- trackElementClicked: (elementName, payload) => {
54
- instrumentation.onElementClicked?.(instrumentation.moduleName, currentScreenName, {
55
- element: elementName,
56
- action: payload?.action,
57
- metadata: payload?.metadata
58
- });
59
- },
60
- trackCaptureAttemptFinished: (payload) => {
61
- instrumentation.onCaptureAttemptFinished?.(instrumentation.moduleName, currentScreenName, { logs: payload.logs });
62
- }
63
- });
64
- instrumentation.onModuleOpened(instrumentation.moduleName);
65
- if (currentScreenName !== void 0) instrumentation.onScreenOpened(instrumentation.moduleName, currentScreenName);
66
- if (currentErrorName !== void 0) instrumentation.onErrorTriggered(instrumentation.moduleName, currentErrorName, currentErrorPayload);
67
- const actorSubscription = actor.subscribe((snapshot) => {
68
- const nextScreenName = instrumentation.getScreenName(snapshot);
69
- const nextErrorName = instrumentation.getErrorName(snapshot);
70
- const nextErrorPayload = instrumentation.getErrorPayload(snapshot);
71
- if (currentScreenName === nextScreenName) {
72
- if (nextErrorName !== void 0 && nextErrorName !== currentErrorName) instrumentation.onErrorTriggered(instrumentation.moduleName, nextErrorName, nextErrorPayload);
73
- currentErrorName = nextErrorName;
74
- currentErrorPayload = nextErrorPayload;
75
- return;
76
- }
77
- if (currentScreenName !== void 0) instrumentation.onScreenClosed(instrumentation.moduleName, currentScreenName);
78
- if (nextScreenName !== void 0) instrumentation.onScreenOpened(instrumentation.moduleName, nextScreenName);
79
- currentScreenName = nextScreenName;
80
- if (nextErrorName !== void 0 && nextErrorName !== currentErrorName) instrumentation.onErrorTriggered(instrumentation.moduleName, nextErrorName, nextErrorPayload);
81
- currentErrorName = nextErrorName;
82
- currentErrorPayload = nextErrorPayload;
83
- });
84
- let isStopped = false;
85
- const base = {
86
- getState,
87
- subscribe,
88
- stop() {
89
- if (isStopped) return;
90
- isStopped = true;
91
- actorSubscription.unsubscribe();
92
- if (currentScreenName !== void 0) instrumentation.onScreenClosed(instrumentation.moduleName, currentScreenName);
93
- currentScreenName = void 0;
94
- currentErrorName = void 0;
95
- currentErrorPayload = void 0;
96
- instrumentation.onModuleClosed(instrumentation.moduleName);
97
- actor.stop();
98
- }
99
- };
100
- return Object.defineProperties(base, Object.getOwnPropertyDescriptors(api));
101
- }
1
+ import { i as isApiConfigured, r as getToken, t as api } from "./api-C2uzxrpN.esm.js";
2
+ import { t as endpoints } from "./endpoints-CI5-28jT.esm.js";
102
3
 
103
- //#endregion
104
4
  //#region ../../node_modules/.pnpm/xstate@5.24.0/node_modules/xstate/dev/dist/xstate-dev.esm.js
105
5
  function getGlobal() {
106
6
  if (typeof globalThis !== "undefined") return globalThis;
@@ -3361,4 +3261,508 @@ function setup({ schemas, actors, actions, guards, delays }) {
3361
3261
  }
3362
3262
 
3363
3263
  //#endregion
3364
- export { createActor as a, fromPromise as i, assign as n, createManager as o, fromCallback as r, setup as t };
3264
+ //#region ../infra/src/capabilities/IBrowserEnvironmentCapability.ts
3265
+ function getTimestamp() {
3266
+ return Date.now();
3267
+ }
3268
+ function revokeObjectURL(url) {
3269
+ URL.revokeObjectURL(url);
3270
+ }
3271
+
3272
+ //#endregion
3273
+ //#region src/internal/events/addEvent.ts
3274
+ const INTERVIEW_EVENTS_MAX_SCREEN_LENGTH = 50;
3275
+ function normalizeScreenForInterviewEventsApi(screenValue) {
3276
+ const limit = INTERVIEW_EVENTS_MAX_SCREEN_LENGTH;
3277
+ if (screenValue.length <= limit) return screenValue;
3278
+ const head = screenValue.slice(0, limit);
3279
+ const lastDot = head.lastIndexOf(".");
3280
+ const lastPlus = head.lastIndexOf("+");
3281
+ const lastBoundary = Math.max(lastDot, lastPlus);
3282
+ if (lastBoundary > 0) return head.slice(0, lastBoundary);
3283
+ return head;
3284
+ }
3285
+ const eventsQueue = [];
3286
+ const eventSubscribers = [];
3287
+ /**
3288
+ * Subscribes to all SDK events for logging, debugging, or custom analytics.
3289
+ * Returns an unsubscribe function.
3290
+ *
3291
+ * @param listener - Callback function that receives each event
3292
+ * @returns Unsubscribe function to remove the listener
3293
+ *
3294
+ * @example
3295
+ * ```typescript
3296
+ * const unsubscribe = subscribeEvent((event) => {
3297
+ * console.log('[Event]', event.code, event.module);
3298
+ * });
3299
+ *
3300
+ * // Later
3301
+ * unsubscribe();
3302
+ * ```
3303
+ */
3304
+ function subscribeEvent(listener) {
3305
+ eventSubscribers.push(listener);
3306
+ return () => {
3307
+ const index = eventSubscribers.indexOf(listener);
3308
+ if (index > -1) eventSubscribers.splice(index, 1);
3309
+ };
3310
+ }
3311
+ function notifySubscribers(event) {
3312
+ eventSubscribers.forEach((listener) => {
3313
+ try {
3314
+ listener(event);
3315
+ } catch (_error) {}
3316
+ });
3317
+ }
3318
+ /**
3319
+ * Sends an event to the dashboard for tracking.
3320
+ * Fire-and-forget: never blocks, never throws.
3321
+ * Events are queued if SDK is not configured yet.
3322
+ */
3323
+ function addEvent(event) {
3324
+ notifySubscribers(event);
3325
+ const token = getToken();
3326
+ if (!isApiConfigured() || !token) {
3327
+ eventsQueue.push(event);
3328
+ return;
3329
+ }
3330
+ const screenForApi = event.screen !== void 0 ? normalizeScreenForInterviewEventsApi(event.screen) : void 0;
3331
+ api.post(endpoints.events, [{
3332
+ code: event.code,
3333
+ module: event.module,
3334
+ screen: screenForApi,
3335
+ clientTimestamp: event.clientTimestamp ?? getTimestamp(),
3336
+ payload: event.payload ?? {}
3337
+ }]).catch(() => {});
3338
+ }
3339
+ /**
3340
+ * Flushes any queued events that were sent before SDK was configured.
3341
+ * Called automatically by setup() after token is set.
3342
+ */
3343
+ function flushEventQueue() {
3344
+ if (!isApiConfigured() || !getToken()) return;
3345
+ const queuedEvents = [...eventsQueue];
3346
+ eventsQueue.length = 0;
3347
+ for (const event of queuedEvents) addEvent(event);
3348
+ }
3349
+
3350
+ //#endregion
3351
+ //#region src/internal/events/helpers.ts
3352
+ function screenEvent(params) {
3353
+ addEvent({
3354
+ code: params.code,
3355
+ module: params.module,
3356
+ screen: params.screen,
3357
+ clientTimestamp: getTimestamp(),
3358
+ payload: params.payload
3359
+ });
3360
+ }
3361
+ function moduleOpened(module, screen, payload) {
3362
+ screenEvent({
3363
+ module,
3364
+ screen,
3365
+ code: "moduleOpened",
3366
+ payload
3367
+ });
3368
+ }
3369
+ function moduleClosed(module, screen, payload) {
3370
+ screenEvent({
3371
+ module,
3372
+ screen,
3373
+ code: "moduleClosed",
3374
+ payload
3375
+ });
3376
+ }
3377
+ function screenOpened(module, screen, payload) {
3378
+ screenEvent({
3379
+ module,
3380
+ screen,
3381
+ code: "screenOpened",
3382
+ payload
3383
+ });
3384
+ }
3385
+ function screenClosed(module, screen, payload) {
3386
+ screenEvent({
3387
+ module,
3388
+ screen,
3389
+ code: "screenClosed",
3390
+ payload
3391
+ });
3392
+ }
3393
+ function errorTriggered(module, screen, payload) {
3394
+ screenEvent({
3395
+ module,
3396
+ screen,
3397
+ code: "errorTriggered",
3398
+ payload
3399
+ });
3400
+ }
3401
+ function elementClicked(module, screen, payload) {
3402
+ screenEvent({
3403
+ module,
3404
+ screen,
3405
+ code: "elementClicked",
3406
+ payload
3407
+ });
3408
+ }
3409
+ function captureAttemptFinished(module, screen, payload) {
3410
+ screenEvent({
3411
+ module,
3412
+ screen,
3413
+ code: "captureAttemptFinished",
3414
+ payload
3415
+ });
3416
+ }
3417
+
3418
+ //#endregion
3419
+ //#region src/internal/events/managerInstrumentation.ts
3420
+ function normalizeSegment(segment) {
3421
+ if (typeof segment !== "string") return "";
3422
+ return segment.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
3423
+ }
3424
+ function normalizeDottedPath(path) {
3425
+ return path.split("+").map((branch) => branch.split(".").map((segment) => normalizeSegment(segment)).filter((segment) => segment.length > 0).join(".")).filter((branch) => branch.length > 0).join("+");
3426
+ }
3427
+ function stateValueToScreenSegment(value) {
3428
+ if (typeof value === "string" || typeof value === "number") {
3429
+ const segment = normalizeSegment(String(value));
3430
+ return segment.length > 0 ? segment : void 0;
3431
+ }
3432
+ if (typeof value !== "object" || value === null) return;
3433
+ const entries = Object.entries(value).sort(([left], [right]) => {
3434
+ if (left < right) return -1;
3435
+ if (left > right) return 1;
3436
+ return 0;
3437
+ });
3438
+ if (entries.length === 0) return;
3439
+ const branches = entries.map(([key, nestedValue]) => {
3440
+ const normalizedKey = normalizeSegment(key);
3441
+ const nestedSegment = stateValueToScreenSegment(nestedValue);
3442
+ if (normalizedKey.length === 0) return nestedSegment;
3443
+ if (nestedSegment === void 0) return normalizedKey;
3444
+ return `${normalizedKey}.${nestedSegment}`;
3445
+ }).filter((branch) => branch !== void 0 && branch.length > 0);
3446
+ if (branches.length === 0) return;
3447
+ return branches.join("+");
3448
+ }
3449
+ function buildScreenName(moduleName, screenName) {
3450
+ const normalizedModuleName = typeof moduleName === "string" ? moduleName.trim() : "";
3451
+ const normalizedScreen = normalizeDottedPath(screenName);
3452
+ if (normalizedModuleName.length === 0) return normalizedScreen;
3453
+ if (normalizedScreen.length === 0) return normalizedModuleName;
3454
+ return `${normalizedModuleName}.${normalizedScreen}`;
3455
+ }
3456
+ function getDefaultManagerScreenName(snapshot) {
3457
+ return stateValueToScreenSegment(snapshot.value);
3458
+ }
3459
+ function getManagerScreenName(moduleName, snapshot, options) {
3460
+ const mappedScreen = options?.getScreenName?.(snapshot) ?? getDefaultManagerScreenName(snapshot);
3461
+ if (mappedScreen === void 0) return;
3462
+ return buildScreenName(moduleName, mappedScreen);
3463
+ }
3464
+ function isErrorLikeSegment(segment) {
3465
+ return segment === "error" || segment.includes("error") || segment.includes("failed") || segment.includes("failure");
3466
+ }
3467
+ function getDefaultManagerErrorName(snapshot) {
3468
+ const screenSegment = stateValueToScreenSegment(snapshot.value);
3469
+ if (screenSegment === void 0) return;
3470
+ const normalizedSegment = normalizeDottedPath(screenSegment);
3471
+ if (normalizedSegment.length === 0) return;
3472
+ if (normalizedSegment === "error") return "error.unknown";
3473
+ if (!isErrorLikeSegment(normalizedSegment)) return;
3474
+ return `error.${normalizedSegment}`;
3475
+ }
3476
+ function createManagerInstrumentation(moduleName, options) {
3477
+ return {
3478
+ moduleName,
3479
+ onModuleOpened: moduleOpened,
3480
+ onModuleClosed: moduleClosed,
3481
+ onScreenOpened: screenOpened,
3482
+ onScreenClosed: screenClosed,
3483
+ onErrorTriggered: errorTriggered,
3484
+ onElementClicked: (moduleName$1, screenName, payload) => elementClicked(moduleName$1, screenName, payload),
3485
+ onCaptureAttemptFinished: (moduleName$1, screenName, payload) => captureAttemptFinished(moduleName$1, screenName, payload),
3486
+ getScreenName: (snapshot) => getManagerScreenName(moduleName, snapshot, { getScreenName: options?.getScreenName }),
3487
+ getErrorName: (snapshot) => {
3488
+ const mappedError = options?.getErrorName?.(snapshot) ?? getDefaultManagerErrorName(snapshot);
3489
+ if (mappedError === void 0) return;
3490
+ return buildScreenName(moduleName, mappedError);
3491
+ },
3492
+ getErrorPayload: (snapshot) => options?.getErrorPayload?.(snapshot)
3493
+ };
3494
+ }
3495
+
3496
+ //#endregion
3497
+ //#region src/internal/events/types.ts
3498
+ const eventModuleNames = {
3499
+ selfie: "SELFIE",
3500
+ authentication: "AUTHENTICATION",
3501
+ authFace: "AUTH_FACE",
3502
+ mlConsent: "ML_CONSENT",
3503
+ combinedConsent: "COMBINED_CONSENT",
3504
+ curpValidation: "CURP_VALIDATION",
3505
+ faceMatch: "FACE_MATCH",
3506
+ qr: "QR",
3507
+ videoSelfie: "VIDEO_ONBOARDING",
3508
+ passport: "ID",
3509
+ front: "ID",
3510
+ back: "ID",
3511
+ id: "ID",
3512
+ document: "DOCUMENT_CAPTURE",
3513
+ creditCard: "CREDIT_CARD_FRONT",
3514
+ creditCardBack: "CREDIT_CARD_BACK",
3515
+ conference: "CONFERENCE",
3516
+ otp: "OTP",
3517
+ signature: "SIGNATURE",
3518
+ ekyc: "EXTERNAL_VERIFICATION",
3519
+ globalWatchList: "GLOBAL_WATCHLIST",
3520
+ customWatchList: "CUSTOM_WATCHLIST",
3521
+ email: "EMAIL",
3522
+ phone: "PHONE",
3523
+ instantVerifyEmail: "INSTANT_VERIFY_EMAIL",
3524
+ instantVerifyConsent: "INSTANT_VERIFY_CONSENT",
3525
+ forms: "FORMS",
3526
+ customModule: "CUSTOM_MODULE",
3527
+ geolocation: "GEOLOCATION",
3528
+ ekyb: "EKYB",
3529
+ antifraud: "ANTIFRAUD"
3530
+ };
3531
+ const eventScreenNames = {
3532
+ faceMatch: "FACE_MATCH",
3533
+ faceCaptureTutorial: "SELFIE_CAPTURE_TUTORIAL",
3534
+ faceCaptureCamera: "SELFIE_CAMERA_CAPTURE",
3535
+ faceCaptureError: "SELFIE_ATTEMPT_FAILED",
3536
+ faceCaptureSuccess: "SELFIE_UPLOAD_SUCCEEDED",
3537
+ faceCaptureUpload: "SELFIE_UPLOAD_PROGRESS",
3538
+ mlConsent: "MACHINE_LEARNING_CONSENT",
3539
+ combinedConsent: "COMBINED_CONSENT",
3540
+ curpEnter: "ENTER_CURP",
3541
+ curpValidate: "VALIDATE_CURP",
3542
+ curpGenerate: "GENERATE_CURP",
3543
+ curpValidation: "CURP_VALIDATION_PROGRESS",
3544
+ curpValidationFailed: "CURP_VALIDATION_FAILED",
3545
+ curpValidationSuccess: "CURP_VALIDATION_SUCCEEDED",
3546
+ qrTutorial: "QR_TUTORIAL",
3547
+ qrScan: "QR_SCAN",
3548
+ smsOtp: "OTP",
3549
+ simpleOTP: "OTP",
3550
+ signatureInput: "SIGNATURE_INPUT",
3551
+ signatureInitialsInput: "INITIALS_INPUT",
3552
+ frontTutorial: "FRONT_ID_CAPTURE_TUTORIAL",
3553
+ frontCameraCapture: "FRONT_ID_CAMERA_CAPTURE",
3554
+ frontHelp: "FRONT_ID_HELP",
3555
+ frontReviewPhoto: "FRONT_ID_REVIEW_PHOTO",
3556
+ frontUploadProgress: "FRONT_ID_UPLOAD_PROGRESS",
3557
+ frontAttemptFailed: "FRONT_ID_ATTEMPT_FAILED",
3558
+ frontUploadSuccess: "FRONT_ID_UPLOAD_SUCCEEDED",
3559
+ backTutorial: "BACK_ID_CAPTURE_TUTORIAL",
3560
+ backCameraCapture: "BACK_ID_CAMERA_CAPTURE",
3561
+ backReviewPhoto: "BACK_ID_REVIEW_PHOTO",
3562
+ backUploadProgress: "BACK_ID_UPLOAD_PROGRESS",
3563
+ backAttemptFailed: "BACK_ID_ATTEMPT_FAILED",
3564
+ backUploadSuccess: "BACK_ID_UPLOAD_SUCCEEDED",
3565
+ backHelp: "BACK_ID_HELP",
3566
+ passportTutorial: "TUTORIAL_PASSPORT",
3567
+ documentTutorial: "DOCUMENT_CAPTURE_TUTORIAL",
3568
+ documentCameraCapture: "DOCUMENT_CAMERA_CAPTURE",
3569
+ documentHelp: "DOCUMENT_HELP",
3570
+ documentReviewPhoto: "DOCUMENT_REVIEW_PHOTO",
3571
+ documentUploadProgress: "DOCUMENT_UPLOAD_IN_PROGRESS",
3572
+ documentAttemptFailed: "DOCUMENT_ATTEMPT_FAILED",
3573
+ documentUploadSuccess: "DOCUMENT_UPLOAD_SUCCEEDED",
3574
+ conferenceWait: "CONFERENCE_WAIT",
3575
+ conferenceVideoChat: "CONFERENCE_VIDEO_CHAT",
3576
+ conferenceMessageChat: "CONFERENCE_MESSAGE_CHAT",
3577
+ videoSelfieTutorial: "VIDEO_SELFIE_TUTORIAL",
3578
+ videoSelfie: "VIDEO_SELFIE",
3579
+ videoSelfieFaceCapture: "VIDEO_SELFIE_FACE_CAPTURE",
3580
+ videoSelfieFaceUploadProgress: "VIDEO_SELFIE_FACE_UPLOAD_PROGRESS",
3581
+ videoSelfieFaceAttemptFailed: "VIDEO_SELFIE_FACE_ATTEMPT_FAILED",
3582
+ videoSelfieFaceUploadSucceeded: "VIDEO_SELFIE_FACE_UPLOAD_SUCCEEDED",
3583
+ videoSelfieFrontIdCapture: "VIDEO_SELFIE_FRONT_ID_CAPTURE",
3584
+ videoSelfieFrontIdUploadProgress: "VIDEO_SELFIE_FRONT_ID_UPLOAD_PROGRESS",
3585
+ videoSelfieFrontIdAttemptFailed: "VIDEO_SELFIE_FRONT_ID_ATTEMPT_FAILED",
3586
+ videoSelfieFrontIdUploadSucceeded: "VIDEO_SELFIE_FRONT_ID_UPLOAD_SUCCEEDED",
3587
+ videoSelfieBackIdCapture: "VIDEO_SELFIE_BACK_ID_CAPTURE",
3588
+ videoSelfieBackIdUploadProgress: "VIDEO_SELFIE_BACK_ID_UPLOAD_PROGRESS",
3589
+ videoSelfieBackIdAttemptFailed: "VIDEO_SELFIE_BACK_ID_ATTEMPT_FAILED",
3590
+ videoSelfieBackIdUploadSucceeded: "VIDEO_SELFIE_BACK_ID_UPLOAD_SUCCEEDED",
3591
+ videoSelfieDocumentCapture: "VIDEO_SELFIE_DOCUMENT_CAPTURE",
3592
+ videoSelfieVoiceQuestion: "VIDEO_SELFIE_VOICE_QUESTION",
3593
+ videoSelfieVoiceFinalQuestion: "VIDEO_SELFIE_VOICE_FINAL_QUESTION",
3594
+ videoSelfieVideoUpload: "VIDEO SELFIE VIDEO UPLOAD",
3595
+ ekycInput: "EKYC_INPUT",
3596
+ ekycProgress: "EKYC_PROGRESS",
3597
+ ekycSucceeded: "EKYC_SUCCEEDED",
3598
+ ekycFailed: "EKYC_FAILED",
3599
+ forms: "FORMS",
3600
+ globalWatchListInput: "GLOBAL_WATCHLIST_INPUT",
3601
+ globalWatchListProgress: "GLOBAL_WATCHLIST_PROGRESS",
3602
+ globalWatchListSuccess: "GLOBAL_WATCHLIST_SUCCEEDED",
3603
+ globalWatchListFailed: "GLOBAL_WATCHLIST_FAILED",
3604
+ customWatchListInput: "CUSTOM_WATCHLIST_INPUT",
3605
+ customWatchListProgress: "CUSTOM_WATCHLIST_PROGRESS",
3606
+ customWatchListSuccess: "CUSTOM_WATCHLIST_SUCCEEDED",
3607
+ customWatchListFailed: "CUSTOM_WATCHLIST_FAILED",
3608
+ emailInput: "EMAIL_INPUT",
3609
+ phoneInput: "PHONE_INPUT",
3610
+ instantVerify: "INSTANT_VERIFY",
3611
+ authFace: "AUTH_FACE",
3612
+ authFaceError: "AUTH_FACE_ATTEMPT_FAILED",
3613
+ authFaceUpload: "AUTH_FACE_UPLOAD_PROGRESS",
3614
+ authFaceUploadSuccess: "AUTH_FACE_UPLOAD_SUCCEEDED",
3615
+ authFaceUploadFailed: "AUTH_FACE_UPLOAD_FAILED",
3616
+ customModuleCallback: "CUSTOM_MODULE_CALLBACK",
3617
+ customModuleProcessing: "CUSTOM_MODULE_PROCESSING",
3618
+ digitalIdFileSelection: "DIGITAL_ID_FILE_SELECTION",
3619
+ digitalIdFileReview: "DIGITAL_ID_FILE_REVIEW",
3620
+ digitalIdUploadProgress: "DIGITAL_ID_UPLOAD_PROGRESS",
3621
+ digitalIdUploadSuccess: "DIGITAL_ID_UPLOAD_SUCCEEDED",
3622
+ digitalIdUploadFailed: "DIGITAL_ID_UPLOAD_FAILED",
3623
+ digitalIdAnalysisProgress: "DIGITAL_ID_ANALYSIS_PROGRESS",
3624
+ digitalIdVerificationSuccess: "DIGITAL_ID_VERIFICATION_SUCCESS",
3625
+ digitalIdVerificationFailed: "DIGITAL_ID_VERIFICATION_FAILED",
3626
+ ekybForm: "EKYB_FORM"
3627
+ };
3628
+ const videoSelfieEvents = {
3629
+ imageTooBlurry: "imageTooBlurry",
3630
+ fillFrame: "fillFrame",
3631
+ checkCameraOrLighting: "checkCameraOrLighting",
3632
+ frontIdCaptureStarted: "frontIdCaptureStarted",
3633
+ lookAtCamera: "lookAtCamera",
3634
+ moveCloser: "moveCloser",
3635
+ lookingForFrontId: "lookingForFrontId",
3636
+ lookingForBackId: "lookingForBackId",
3637
+ cameraSwitchToBack: "cameraSwitchToBack",
3638
+ cameraSwitchToFront: "cameraSwitchToFront",
3639
+ audioStreamOpened: "audioStreamOpened",
3640
+ audioStreamClosed: "audioStreamClosed",
3641
+ videoSelfieVideoUploadInProgress: "videoSelfieVideoUploadInProgress",
3642
+ videoSelfieTosNotAccepted: "videoSelfieTosNotAccepted",
3643
+ videoSelfieTosAccepted: "videoSelfieTosAccepted",
3644
+ videoSelfieStreamCreated: "videoSelfieStreamCreated",
3645
+ videoSelfieStreamDestroyed: "videoSelfieStreamDestroyed",
3646
+ videoSelfieReconnecting: "videoSelfieReconnecting",
3647
+ videoSelfieReconnected: "videoSelfieReconnected"
3648
+ };
3649
+ const tutorialScreenNamesMapper = {
3650
+ passport: eventScreenNames.passportTutorial,
3651
+ front: eventScreenNames.frontTutorial,
3652
+ back: eventScreenNames.backTutorial,
3653
+ selfie: eventScreenNames.faceCaptureTutorial
3654
+ };
3655
+ const cameraScreenNamesMapper = {
3656
+ front: "front",
3657
+ back: "back",
3658
+ passport: "passport",
3659
+ creditCard: "front",
3660
+ creditCardBack: "back",
3661
+ document: "document"
3662
+ };
3663
+
3664
+ //#endregion
3665
+ //#region ../infra/src/manager/Manager.ts
3666
+ /**
3667
+ * Creates a manager that wraps a state machine actor with a clean public API.
3668
+ *
3669
+ * The manager provides:
3670
+ * - `getState()` - Returns the mapped public state
3671
+ * - `subscribe()` - Listen to state changes
3672
+ * - `stop()` - Stop the actor
3673
+ * - Plus any custom API methods from `createApi`
3674
+ *
3675
+ * @template TMachine - The state machine type
3676
+ * @template TMapState - Function type that maps raw snapshot to public state
3677
+ * @template TCreateApi - Function type that creates the custom API
3678
+ *
3679
+ * @param options - Configuration options
3680
+ * @param options.actor - The started actor instance
3681
+ * @param options.mapState - Function to transform raw snapshot into public state
3682
+ * @param options.createApi - Factory function to create custom API methods
3683
+ *
3684
+ * @returns Combined manager with base methods and custom API
3685
+ *
3686
+ * @example
3687
+ * ```ts
3688
+ * const manager = createManager({
3689
+ * actor: createActor(myMachine).start(),
3690
+ * mapState: (snapshot) => ({ status: snapshot.value }),
3691
+ * createApi: ({ actor }) => ({
3692
+ * doSomething() { actor.send({ type: 'DO_IT' }); }
3693
+ * }),
3694
+ * });
3695
+ * ```
3696
+ */
3697
+ function createManager(options) {
3698
+ const { actor, mapState, createApi, instrumentation } = options;
3699
+ function getSnapshot() {
3700
+ return actor.getSnapshot();
3701
+ }
3702
+ function getState() {
3703
+ return mapState(getSnapshot());
3704
+ }
3705
+ function subscribe(listener) {
3706
+ const subscription = actor.subscribe(() => {
3707
+ listener(getState());
3708
+ });
3709
+ return () => subscription.unsubscribe();
3710
+ }
3711
+ let currentScreenName = instrumentation.getScreenName(getSnapshot());
3712
+ let currentErrorName = instrumentation.getErrorName(getSnapshot());
3713
+ let currentErrorPayload = instrumentation.getErrorPayload(getSnapshot());
3714
+ const api$1 = createApi({
3715
+ actor,
3716
+ getSnapshot,
3717
+ trackElementClicked: (elementName, payload) => {
3718
+ instrumentation.onElementClicked?.(instrumentation.moduleName, currentScreenName, {
3719
+ element: elementName,
3720
+ action: payload?.action,
3721
+ metadata: payload?.metadata
3722
+ });
3723
+ },
3724
+ trackCaptureAttemptFinished: (payload) => {
3725
+ instrumentation.onCaptureAttemptFinished?.(instrumentation.moduleName, currentScreenName, { logs: payload.logs });
3726
+ }
3727
+ });
3728
+ instrumentation.onModuleOpened(instrumentation.moduleName);
3729
+ if (currentScreenName !== void 0) instrumentation.onScreenOpened(instrumentation.moduleName, currentScreenName);
3730
+ if (currentErrorName !== void 0) instrumentation.onErrorTriggered(instrumentation.moduleName, currentErrorName, currentErrorPayload);
3731
+ const actorSubscription = actor.subscribe((snapshot) => {
3732
+ const nextScreenName = instrumentation.getScreenName(snapshot);
3733
+ const nextErrorName = instrumentation.getErrorName(snapshot);
3734
+ const nextErrorPayload = instrumentation.getErrorPayload(snapshot);
3735
+ if (currentScreenName === nextScreenName) {
3736
+ if (nextErrorName !== void 0 && nextErrorName !== currentErrorName) instrumentation.onErrorTriggered(instrumentation.moduleName, nextErrorName, nextErrorPayload);
3737
+ currentErrorName = nextErrorName;
3738
+ currentErrorPayload = nextErrorPayload;
3739
+ return;
3740
+ }
3741
+ if (currentScreenName !== void 0) instrumentation.onScreenClosed(instrumentation.moduleName, currentScreenName);
3742
+ if (nextScreenName !== void 0) instrumentation.onScreenOpened(instrumentation.moduleName, nextScreenName);
3743
+ currentScreenName = nextScreenName;
3744
+ if (nextErrorName !== void 0 && nextErrorName !== currentErrorName) instrumentation.onErrorTriggered(instrumentation.moduleName, nextErrorName, nextErrorPayload);
3745
+ currentErrorName = nextErrorName;
3746
+ currentErrorPayload = nextErrorPayload;
3747
+ });
3748
+ let isStopped = false;
3749
+ const base = {
3750
+ getState,
3751
+ subscribe,
3752
+ stop() {
3753
+ if (isStopped) return;
3754
+ isStopped = true;
3755
+ actorSubscription.unsubscribe();
3756
+ if (currentScreenName !== void 0) instrumentation.onScreenClosed(instrumentation.moduleName, currentScreenName);
3757
+ currentScreenName = void 0;
3758
+ currentErrorName = void 0;
3759
+ currentErrorPayload = void 0;
3760
+ instrumentation.onModuleClosed(instrumentation.moduleName);
3761
+ actor.stop();
3762
+ }
3763
+ };
3764
+ return Object.defineProperties(base, Object.getOwnPropertyDescriptors(api$1));
3765
+ }
3766
+
3767
+ //#endregion
3768
+ export { createActor as C, fromPromise as S, subscribeEvent as _, tutorialScreenNamesMapper as a, assign as b, captureAttemptFinished as c, moduleOpened as d, screenClosed as f, flushEventQueue as g, addEvent as h, eventScreenNames as i, elementClicked as l, screenOpened as m, cameraScreenNamesMapper as n, videoSelfieEvents as o, screenEvent as p, eventModuleNames as r, createManagerInstrumentation as s, createManager as t, moduleClosed as u, revokeObjectURL as v, fromCallback as x, setup as y };
@@ -1,4 +1,7 @@
1
+ import { AnyStateMachine, StateMachine, fromPromise } from "xstate";
2
+
1
3
  //#region ../infra/src/wasm/warmup.d.ts
4
+
2
5
  /**
3
6
  * All available ML pipelines in the SDK.
4
7
  * - 'selfie' - Face detection for selfie capture
@@ -52,4 +55,4 @@ interface WarmupConfig {
52
55
  */
53
56
  declare function warmupWasm(config: WarmupConfig): Promise<void>;
54
57
  //#endregion
55
- export { WasmPipeline as n, warmupWasm as r, WarmupConfig as t };
58
+ export { WasmPipeline as a, WarmupConfig as i, StateMachine as n, warmupWasm as o, fromPromise as r, AnyStateMachine as t };