@incodetech/core 0.0.0-dev-20260409-a38d5e8 → 0.0.0-dev-20260409-09dfd52

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 (134) hide show
  1. package/dist/BrowserStorageProvider-CXaS5Ooj.esm.js +55 -0
  2. package/dist/{OpenViduRecordingProvider-Bn2meybK.esm.js → OpenViduRecordingProvider-D_cVAwYQ.esm.js} +1 -1
  3. package/dist/{WasmUtilProvider-BpZSvZbg.esm.js → WasmUtilProvider-mWSXzp7b.esm.js} +1 -1
  4. package/dist/{addressSearch-DOFI7lwy.esm.js → addressSearch-C26OZIx0.esm.js} +4 -4
  5. package/dist/antifraud.d.ts +1 -1
  6. package/dist/antifraud.esm.js +4 -37
  7. package/dist/antifraudStateMachine-B74mO8vr.esm.js +39 -0
  8. package/dist/authentication.d.ts +11 -11
  9. package/dist/authentication.esm.js +22 -19
  10. package/dist/authenticationManager-BBQHippG.esm.js +67 -0
  11. package/dist/{authenticationManager-C2mk36yK.d.ts → authenticationManager-DOTo1EYF.d.ts} +2 -2
  12. package/dist/{authenticationManager-C7dL_avf.esm.js → authenticationStateMachine-DCJ0ArAt.esm.js} +7 -67
  13. package/dist/{backCameraStream-tabTmwDS.esm.js → backCameraStream-D9g2wyil.esm.js} +3 -3
  14. package/dist/camera.d.ts +1 -1
  15. package/dist/camera.esm.js +3 -3
  16. package/dist/consent.d.ts +55 -55
  17. package/dist/consent.esm.js +4 -149
  18. package/dist/consentStateMachine-DIdJXJW0.esm.js +151 -0
  19. package/dist/cross-document-data-match.d.ts +1 -1
  20. package/dist/cross-document-data-match.esm.js +4 -4
  21. package/dist/curp-validation.d.ts +5 -5
  22. package/dist/curp-validation.esm.js +4 -417
  23. package/dist/curpValidationStateMachine-Dp5WB6__.esm.js +419 -0
  24. package/dist/{deepsightLoader-Cj6SyUQ-.esm.js → deepsightLoader-CaULV07H.esm.js} +10 -10
  25. package/dist/{deepsightService-ByD6uIs7.d.ts → deepsightService-S-tU77m-.d.ts} +2 -2
  26. package/dist/{deepsightService-BjgXl5hs.esm.js → deepsightService-rPGLH8Xp.esm.js} +5 -5
  27. package/dist/device.esm.js +3 -3
  28. package/dist/document-capture.d.ts +80 -78
  29. package/dist/document-capture.esm.js +8 -403
  30. package/dist/document-upload.d.ts +53 -53
  31. package/dist/document-upload.esm.js +7 -7
  32. package/dist/documentCaptureStateMachine-ByYOCKz5.esm.js +403 -0
  33. package/dist/ekyb.d.ts +3 -3
  34. package/dist/ekyb.esm.js +10 -655
  35. package/dist/ekybStateMachine-DRku_YmR.esm.js +653 -0
  36. package/dist/ekyc.d.ts +3 -3
  37. package/dist/ekyc.esm.js +6 -10614
  38. package/dist/ekycStateMachine-CSWaaWVl.esm.js +10615 -0
  39. package/dist/email.d.ts +3 -3
  40. package/dist/email.esm.js +6 -5
  41. package/dist/{emailManager-CU_hzrsl.d.ts → emailManager-D6CHM2QO.d.ts} +4 -3
  42. package/dist/emailManager-DByjyeY8.esm.js +238 -0
  43. package/dist/{emailManager-_9R4vm6g.esm.js → emailStateMachine-BoIkeCw5.esm.js} +6 -239
  44. package/dist/{events-DlHrOIRc.esm.js → events-W91zLpx4.esm.js} +5 -1
  45. package/dist/events.esm.js +2 -2
  46. package/dist/extensibility.d.ts +15 -15
  47. package/dist/extensibility.esm.js +33 -26
  48. package/dist/face-match.d.ts +7 -6
  49. package/dist/face-match.esm.js +8 -129
  50. package/dist/faceCaptureManagerFactory-Bspg2Tyf.esm.js +117 -0
  51. package/dist/{faceCaptureManagerFactory-Da_-ohdg.d.ts → faceCaptureManagerFactory-P2yy30KU.d.ts} +8 -8
  52. package/dist/{faceCaptureSetup-CaVWkjvE.esm.js → faceCaptureSetup-CQevz86q.esm.js} +5 -119
  53. package/dist/faceMatchStateMachine-CLterVEC.esm.js +127 -0
  54. package/dist/flow.d.ts +8 -13
  55. package/dist/flow.esm.js +10 -29
  56. package/dist/{flowCompletionService-B5JemmC6.esm.js → flowCompletionService-DZSDUXus.esm.js} +2 -2
  57. package/dist/{flowServices-p22wrYPf.esm.js → flowServices-YATk0fgY.esm.js} +3 -3
  58. package/dist/geolocation.d.ts +7 -6
  59. package/dist/geolocation.esm.js +7 -105
  60. package/dist/geolocationStateMachine-CRRUCl9K.esm.js +105 -0
  61. package/dist/{getDeviceClass-DEzz4cmY.esm.js → getDeviceClass-DBF-ExLR.esm.js} +1 -1
  62. package/dist/government-validation.d.ts +2 -2
  63. package/dist/government-validation.esm.js +5 -269
  64. package/dist/governmentValidationStateMachine-C_iPX9VE.esm.js +271 -0
  65. package/dist/http.esm.js +1 -1
  66. package/dist/id.d.ts +10 -10
  67. package/dist/id.esm.js +22 -20
  68. package/dist/idCaptureManager-CJfatzuY.esm.js +335 -0
  69. package/dist/{idCaptureManager-CV08v1e3.d.ts → idCaptureManager-CbZvdr9y.d.ts} +7 -7
  70. package/dist/{idCaptureManager-dyZzKv8L.esm.js → idCaptureStateMachine-gf-Q9piu.esm.js} +17 -346
  71. package/dist/index.d.ts +2 -2
  72. package/dist/index.esm.js +8 -8
  73. package/dist/{lib-Bavz2qmt.esm.js → lib-BzVJ-zxG.esm.js} +1 -1
  74. package/dist/mandatory-consent.d.ts +55 -55
  75. package/dist/mandatory-consent.esm.js +4 -124
  76. package/dist/mandatoryConsentStateMachine-BZNBJ1fK.esm.js +126 -0
  77. package/dist/{openviduLazy-vhrVZCr_.esm.js → openviduLazy-CLg_-u0m.esm.js} +2 -2
  78. package/dist/openviduLazy-rFXBtZVZ.esm.js +3 -0
  79. package/dist/{permissionServices-Cskq32Yd.esm.js → permissionServices-Cisv73eQ.esm.js} +2 -2
  80. package/dist/phone.d.ts +3 -3
  81. package/dist/phone.esm.js +6 -5
  82. package/dist/phoneManager-DhC4obPF.esm.js +258 -0
  83. package/dist/{phoneManager-ulJuGvJ8.d.ts → phoneManager-Zwr-qCnC.d.ts} +2 -2
  84. package/dist/{phoneManager-DerdUfd4.esm.js → phoneStateMachine-Cc_w4tC0.esm.js} +5 -258
  85. package/dist/{recordingService-483wQ6kR.esm.js → recordingService-CCfxUY7-.esm.js} +14 -68
  86. package/dist/redirect-to-mobile.d.ts +2 -2
  87. package/dist/redirect-to-mobile.esm.js +5 -247
  88. package/dist/redirectToMobileStateMachine-vOe27Ufw.esm.js +249 -0
  89. package/dist/runChildModule-DVC4JEjp.esm.js +27 -0
  90. package/dist/selfie.d.ts +11 -11
  91. package/dist/selfie.esm.js +22 -19
  92. package/dist/selfieManager-CorEST5h.esm.js +60 -0
  93. package/dist/{selfieManager-DCRP7X75.d.ts → selfieManager-DNwfxieF.d.ts} +2 -2
  94. package/dist/selfieStateMachine-3b19ON1z.esm.js +56 -0
  95. package/dist/{session-CUh77zj3.esm.js → session-B_rKSRql.esm.js} +4 -4
  96. package/dist/session.d.ts +1 -1
  97. package/dist/session.esm.js +6 -6
  98. package/dist/{setup-DpHakxsC.d.ts → setup-BYqwVLiv.d.ts} +1 -1
  99. package/dist/{setup-XpxfZgKn.esm.js → setup-DLvhsDol.esm.js} +6 -5
  100. package/dist/signature.d.ts +4 -3
  101. package/dist/signature.esm.js +6 -189
  102. package/dist/signatureStateMachine-CU92zCXU.esm.js +189 -0
  103. package/dist/{stats-DHDoqSBV.esm.js → stats-gFD2351t.esm.js} +1 -1
  104. package/dist/stats.esm.js +2 -2
  105. package/dist/{types-2OPf1pyv.d.ts → types-CYJ0Ish6.d.ts} +1 -1
  106. package/dist/types-CjsEZRcz.d.ts +35 -0
  107. package/dist/{types-CVJVQ7fp.d.ts → types-DU8HmI5U.d.ts} +1 -1
  108. package/dist/wasm.d.ts +2 -2
  109. package/dist/wasm.esm.js +8 -8
  110. package/dist/workflow.d.ts +813 -0
  111. package/dist/workflow.esm.js +600 -0
  112. package/package.json +7 -3
  113. package/dist/openviduLazy-BIPHozOu.esm.js +0 -3
  114. package/dist/selfieManager-DeOcNel4.esm.js +0 -110
  115. /package/dist/{Actor-Ba71-_30.d.ts → Actor-DbWH1K6E.d.ts} +0 -0
  116. /package/dist/{BaseWasmProvider-D-s_6M5H.esm.js → BaseWasmProvider-DoYDYH1z.esm.js} +0 -0
  117. /package/dist/{BrowserEnvironmentProvider-DaHeLJQw.esm.js → BrowserEnvironmentProvider-BtKLxTx4.esm.js} +0 -0
  118. /package/dist/{BrowserTimerProvider-BhD2MlHg.esm.js → BrowserTimerProvider-v7bpbrAk.esm.js} +0 -0
  119. /package/dist/{ITimerCapability-oixwa6nj.esm.js → ITimerCapability-BZO_FsCo.esm.js} +0 -0
  120. /package/dist/{Manager-BN2g_I8W.d.ts → Manager-DcPMRgTm.d.ts} +0 -0
  121. /package/dist/{MotionSensorProvider-CodM3e0E.esm.js → MotionSensorProvider-D90R4qwV.esm.js} +0 -0
  122. /package/dist/{StateMachine-BoJsfMvg.d.ts → StateMachine-BBuIgsHT.d.ts} +0 -0
  123. /package/dist/{api-DzpnV6O7.esm.js → api-aa9Mx20l.esm.js} +0 -0
  124. /package/dist/{browserSimulation-B4ubb2OL.esm.js → browserSimulation-DFqGKQAD.esm.js} +0 -0
  125. /package/dist/{camera-1eeGnAaL.d.ts → camera-DATT31my.d.ts} +0 -0
  126. /package/dist/{camera-DmkFpf5N.esm.js → camera-DpPQS_-5.esm.js} +0 -0
  127. /package/dist/{chunk-DsxENsBR.esm.js → chunk-YGHKo4MY.esm.js} +0 -0
  128. /package/dist/{displayErrors-BZLX7idb.d.ts → displayErrors-xrg0ejaS.d.ts} +0 -0
  129. /package/dist/{flowCompletionService-D-3YCHyO.d.ts → flowCompletionService-gxt5reFV.d.ts} +0 -0
  130. /package/dist/{getBrowser-Dtyt9J_h.esm.js → getBrowser-DCcD7H-M.esm.js} +0 -0
  131. /package/dist/{platform-Dv7a2fv-.esm.js → platform-DctkySJU.esm.js} +0 -0
  132. /package/dist/{types-D_QfFKxT.d.ts → types-CIjb0FKu.d.ts} +0 -0
  133. /package/dist/{warmup-CIj_wEV_.d.ts → warmup-Ckb1hN85.d.ts} +0 -0
  134. /package/dist/{xstate.esm-Bv55-lJ4.esm.js → xstate.esm-B7FPE6br.esm.js} +0 -0
package/dist/flow.esm.js CHANGED
@@ -1,11 +1,12 @@
1
- import "./api-DzpnV6O7.esm.js";
2
- import { o as createManagerInstrumentation } from "./events-DlHrOIRc.esm.js";
3
- import "./session-CUh77zj3.esm.js";
4
- import "./BrowserEnvironmentProvider-DaHeLJQw.esm.js";
5
- import "./browserSimulation-B4ubb2OL.esm.js";
6
- import { a as createActor, i as fromPromise, n as assign, o as createManager, r as fromCallback, t as setup } from "./xstate.esm-Bv55-lJ4.esm.js";
7
- import { n as getRequiredWasmPipelines, r as normalizeFlowModules, t as getFlow } from "./flowServices-p22wrYPf.esm.js";
8
- import { t as getFinishStatus } from "./flowCompletionService-B5JemmC6.esm.js";
1
+ import "./api-aa9Mx20l.esm.js";
2
+ import { o as createManagerInstrumentation } from "./events-W91zLpx4.esm.js";
3
+ import "./session-B_rKSRql.esm.js";
4
+ import "./BrowserEnvironmentProvider-BtKLxTx4.esm.js";
5
+ import "./browserSimulation-DFqGKQAD.esm.js";
6
+ import { a as createActor, i as fromPromise, n as assign, o as createManager, t as setup } from "./xstate.esm-B7FPE6br.esm.js";
7
+ import { n as getRequiredWasmPipelines, r as normalizeFlowModules, t as getFlow } from "./flowServices-YATk0fgY.esm.js";
8
+ import { t as getFinishStatus } from "./flowCompletionService-DZSDUXus.esm.js";
9
+ import { t as runChildModule } from "./runChildModule-DVC4JEjp.esm.js";
9
10
 
10
11
  //#region src/modules/flow/flowStateMachine.ts
11
12
  const flowMachine = setup({
@@ -299,27 +300,7 @@ const orchestratedFlowMachine = setup({
299
300
  notifyBackend: fromPromise(async ({ input, signal }) => {
300
301
  return await input.getFinishStatus(input.flowId, signal);
301
302
  }),
302
- runChildModule: fromCallback(({ sendBack, input }) => {
303
- const { machine, config } = input;
304
- if (!machine) return () => {};
305
- const actor = createActor(machine, { input: { config } });
306
- const subscription = actor.subscribe({
307
- complete: () => {
308
- sendBack({ type: "MODULE_COMPLETE" });
309
- },
310
- error: (err) => {
311
- sendBack({
312
- type: "MODULE_ERROR",
313
- error: err
314
- });
315
- }
316
- });
317
- actor.start();
318
- return () => {
319
- subscription.unsubscribe();
320
- actor.stop();
321
- };
322
- }),
303
+ runChildModule,
323
304
  resolveCurrentModuleMachine: fromPromise(async ({ input }) => {
324
305
  if (!input.moduleKey) return;
325
306
  const eagerMachine = input.modules[input.moduleKey];
@@ -1,5 +1,5 @@
1
- import { t as api } from "./api-DzpnV6O7.esm.js";
2
- import { _ as endpoints } from "./events-DlHrOIRc.esm.js";
1
+ import { t as api } from "./api-aa9Mx20l.esm.js";
2
+ import { _ as endpoints } from "./events-W91zLpx4.esm.js";
3
3
 
4
4
  //#region src/modules/flow/flowCompletionService.ts
5
5
  const getFinishStatus = async (flowId, signal) => {
@@ -1,6 +1,6 @@
1
- import { t as api } from "./api-DzpnV6O7.esm.js";
2
- import { _ as endpoints } from "./events-DlHrOIRc.esm.js";
3
- import { n as getSessionFingerprintResult, r as initializeSession } from "./session-CUh77zj3.esm.js";
1
+ import { t as api } from "./api-aa9Mx20l.esm.js";
2
+ import { _ as endpoints } from "./events-W91zLpx4.esm.js";
3
+ import { n as getSessionFingerprintResult, r as initializeSession } from "./session-B_rKSRql.esm.js";
4
4
 
5
5
  //#region src/modules/flow/flowUtils.ts
6
6
  const WASM_MODULE_PIPELINES = {
@@ -1,5 +1,5 @@
1
- import { t as Manager } from "./Manager-BN2g_I8W.js";
2
- import "./Actor-Ba71-_30.js";
1
+ import { t as Manager } from "./Manager-DcPMRgTm.js";
2
+ import "./Actor-DbWH1K6E.js";
3
3
 
4
4
  //#region ../infra/src/capabilities/IGeolocationCapability.d.ts
5
5
  type GeolocationCoords = {
@@ -17,7 +17,7 @@ type IGeolocationCapability = {
17
17
  * @example
18
18
  * ```typescript
19
19
  * const config: GeolocationConfig = {
20
- * allowSkip: true,
20
+ * allowUserToSkipGeolocation: true,
21
21
  * };
22
22
  * ```
23
23
  */
@@ -25,9 +25,10 @@ type GeolocationConfig = {
25
25
  /**
26
26
  * Whether the user is allowed to skip geolocation capture.
27
27
  * When true, a skip button is shown on the permission-denied screen.
28
+ * Backend field name from flow/workflow configuration.
28
29
  * @default false
29
30
  */
30
- allowSkip?: boolean;
31
+ allowUserToSkipGeolocation?: boolean;
31
32
  };
32
33
  //#endregion
33
34
  //#region src/modules/geolocation/geolocationStateMachine.d.ts
@@ -95,7 +96,7 @@ type GeolocationState = GeolocationIdleState | GeolocationRequestingState | Geol
95
96
  *
96
97
  * @example Headless usage
97
98
  * ```typescript
98
- * const manager = createGeolocationManager({ config: { allowSkip: true } });
99
+ * const manager = createGeolocationManager({ config: { allowUserToSkipGeolocation: true } });
99
100
  * manager.subscribe((state) => console.log(state.status));
100
101
  * manager.request();
101
102
  * ```
@@ -113,7 +114,7 @@ declare function createGeolocationManager(options: CreateGeolocationActorOptions
113
114
  continue(): void;
114
115
  /**
115
116
  * Skips geolocation when the user has denied permission.
116
- * Only works when `config.allowSkip` is true.
117
+ * Only works when `config.allowUserToSkipGeolocation` is true.
117
118
  */
118
119
  skip(): void;
119
120
  /**
@@ -1,7 +1,8 @@
1
- import { t as api } from "./api-DzpnV6O7.esm.js";
2
- import { _ as endpoints, n as eventModuleNames, o as createManagerInstrumentation } from "./events-DlHrOIRc.esm.js";
3
- import { a as createActor, i as fromPromise, n as assign, o as createManager, t as setup } from "./xstate.esm-Bv55-lJ4.esm.js";
4
- import { r as isIOS, t as isAndroid } from "./platform-Dv7a2fv-.esm.js";
1
+ import "./api-aa9Mx20l.esm.js";
2
+ import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-W91zLpx4.esm.js";
3
+ import { a as createActor, o as createManager } from "./xstate.esm-B7FPE6br.esm.js";
4
+ import "./platform-DctkySJU.esm.js";
5
+ import { t as geolocationMachine } from "./geolocationStateMachine-CRRUCl9K.esm.js";
5
6
 
6
7
  //#region ../infra/src/providers/browser/BrowserGeolocationProvider.ts
7
8
  var BrowserGeolocationProvider = class {
@@ -15,105 +16,6 @@ var BrowserGeolocationProvider = class {
15
16
  }
16
17
  };
17
18
 
18
- //#endregion
19
- //#region src/modules/geolocation/geolocationServices.ts
20
- async function addGeolocation(params, signal) {
21
- const res = await api.post(endpoints.addGeolocation, {
22
- latitude: params.latitude,
23
- longitude: params.longitude
24
- }, { signal });
25
- if (!res.ok) throw new Error(`POST ${endpoints.addGeolocation} failed: ${res.status} ${res.statusText}`);
26
- return res.data;
27
- }
28
-
29
- //#endregion
30
- //#region src/modules/geolocation/geolocationStateMachine.ts
31
- function detectDeviceType() {
32
- if (isIOS()) return "ios";
33
- if (isAndroid()) return "android";
34
- return "desktop";
35
- }
36
- const geolocationMachine = setup({
37
- types: {
38
- context: {},
39
- events: {},
40
- input: {}
41
- },
42
- actors: {
43
- requestPosition: fromPromise(async ({ input }) => {
44
- return input.geolocation.getCurrentPosition();
45
- }),
46
- submitPosition: fromPromise(async ({ input, signal }) => {
47
- try {
48
- return await addGeolocation(input, signal);
49
- } catch {
50
- return { location: "Unknown" };
51
- }
52
- })
53
- },
54
- actions: {
55
- setCoords: assign(({ event }) => ({ coords: event.output })),
56
- setLocation: assign(({ event }) => ({ location: event.output.location })),
57
- setDeviceType: assign({ deviceType: () => detectDeviceType() }),
58
- resetContext: assign(({ context }) => ({
59
- config: context.config,
60
- geolocation: context.geolocation,
61
- coords: void 0,
62
- location: void 0,
63
- deviceType: detectDeviceType()
64
- }))
65
- },
66
- guards: { canSkip: ({ context }) => context.config.allowSkip === true }
67
- }).createMachine({
68
- id: "geolocation",
69
- initial: "idle",
70
- context: ({ input }) => ({
71
- config: input.config,
72
- geolocation: input.geolocation,
73
- coords: void 0,
74
- location: void 0,
75
- deviceType: detectDeviceType()
76
- }),
77
- states: {
78
- idle: { on: { REQUEST: { target: "requestingLocation" } } },
79
- requestingLocation: { invoke: {
80
- id: "requestPosition",
81
- src: "requestPosition",
82
- input: ({ context }) => ({ geolocation: context.geolocation }),
83
- onDone: {
84
- target: "submitting",
85
- actions: "setCoords"
86
- },
87
- onError: {
88
- target: "permissionDenied",
89
- actions: "setDeviceType"
90
- }
91
- } },
92
- submitting: { invoke: {
93
- id: "submitPosition",
94
- src: "submitPosition",
95
- input: ({ context }) => ({
96
- latitude: context.coords?.latitude ?? 0,
97
- longitude: context.coords?.longitude ?? 0
98
- }),
99
- onDone: {
100
- target: "locationAcquired",
101
- actions: "setLocation"
102
- },
103
- onError: {
104
- target: "locationAcquired",
105
- actions: assign({ location: () => "Unknown" })
106
- }
107
- } },
108
- locationAcquired: { on: { CONTINUE: { target: "finished" } } },
109
- permissionDenied: { on: { SKIP: {
110
- target: "finished",
111
- guard: "canSkip"
112
- } } },
113
- finished: { type: "final" }
114
- }
115
- });
116
-
117
19
  //#endregion
118
20
  //#region src/modules/geolocation/geolocationActor.ts
119
21
  function createGeolocationActor(options) {
@@ -139,7 +41,7 @@ function mapState(snapshot) {
139
41
  if (typedSnapshot.matches("permissionDenied")) return {
140
42
  status: "permissionDenied",
141
43
  deviceType: context.deviceType,
142
- canSkip: context.config.allowSkip === true
44
+ canSkip: context.config.allowUserToSkipGeolocation === true
143
45
  };
144
46
  if (typedSnapshot.matches("finished")) return { status: "finished" };
145
47
  return { status: "idle" };
@@ -168,7 +70,7 @@ function createApi({ actor, trackElementClicked }) {
168
70
  *
169
71
  * @example Headless usage
170
72
  * ```typescript
171
- * const manager = createGeolocationManager({ config: { allowSkip: true } });
73
+ * const manager = createGeolocationManager({ config: { allowUserToSkipGeolocation: true } });
172
74
  * manager.subscribe((state) => console.log(state.status));
173
75
  * manager.request();
174
76
  * ```
@@ -0,0 +1,105 @@
1
+ import { t as api } from "./api-aa9Mx20l.esm.js";
2
+ import { _ as endpoints } from "./events-W91zLpx4.esm.js";
3
+ import { i as fromPromise, n as assign, t as setup } from "./xstate.esm-B7FPE6br.esm.js";
4
+ import { r as isIOS, t as isAndroid } from "./platform-DctkySJU.esm.js";
5
+
6
+ //#region src/modules/geolocation/geolocationServices.ts
7
+ async function addGeolocation(params, signal) {
8
+ const res = await api.post(endpoints.addGeolocation, {
9
+ latitude: params.latitude,
10
+ longitude: params.longitude
11
+ }, { signal });
12
+ if (!res.ok) throw new Error(`POST ${endpoints.addGeolocation} failed: ${res.status} ${res.statusText}`);
13
+ return res.data;
14
+ }
15
+
16
+ //#endregion
17
+ //#region src/modules/geolocation/geolocationStateMachine.ts
18
+ function detectDeviceType() {
19
+ if (isIOS()) return "ios";
20
+ if (isAndroid()) return "android";
21
+ return "desktop";
22
+ }
23
+ const geolocationMachine = setup({
24
+ types: {
25
+ context: {},
26
+ events: {},
27
+ input: {}
28
+ },
29
+ actors: {
30
+ requestPosition: fromPromise(async ({ input }) => {
31
+ return input.geolocation.getCurrentPosition();
32
+ }),
33
+ submitPosition: fromPromise(async ({ input, signal }) => {
34
+ try {
35
+ return await addGeolocation(input, signal);
36
+ } catch {
37
+ return { location: "Unknown" };
38
+ }
39
+ })
40
+ },
41
+ actions: {
42
+ setCoords: assign(({ event }) => ({ coords: event.output })),
43
+ setLocation: assign(({ event }) => ({ location: event.output.location })),
44
+ setDeviceType: assign({ deviceType: () => detectDeviceType() }),
45
+ resetContext: assign(({ context }) => ({
46
+ config: context.config,
47
+ geolocation: context.geolocation,
48
+ coords: void 0,
49
+ location: void 0,
50
+ deviceType: detectDeviceType()
51
+ }))
52
+ },
53
+ guards: { canSkip: ({ context }) => context.config.allowUserToSkipGeolocation === true }
54
+ }).createMachine({
55
+ id: "geolocation",
56
+ initial: "idle",
57
+ context: ({ input }) => ({
58
+ config: input.config,
59
+ geolocation: input.geolocation,
60
+ coords: void 0,
61
+ location: void 0,
62
+ deviceType: detectDeviceType()
63
+ }),
64
+ states: {
65
+ idle: { on: { REQUEST: { target: "requestingLocation" } } },
66
+ requestingLocation: { invoke: {
67
+ id: "requestPosition",
68
+ src: "requestPosition",
69
+ input: ({ context }) => ({ geolocation: context.geolocation }),
70
+ onDone: {
71
+ target: "submitting",
72
+ actions: "setCoords"
73
+ },
74
+ onError: {
75
+ target: "permissionDenied",
76
+ actions: "setDeviceType"
77
+ }
78
+ } },
79
+ submitting: { invoke: {
80
+ id: "submitPosition",
81
+ src: "submitPosition",
82
+ input: ({ context }) => ({
83
+ latitude: context.coords?.latitude ?? 0,
84
+ longitude: context.coords?.longitude ?? 0
85
+ }),
86
+ onDone: {
87
+ target: "locationAcquired",
88
+ actions: "setLocation"
89
+ },
90
+ onError: {
91
+ target: "locationAcquired",
92
+ actions: assign({ location: () => "Unknown" })
93
+ }
94
+ } },
95
+ locationAcquired: { on: { CONTINUE: { target: "finished" } } },
96
+ permissionDenied: { on: { SKIP: {
97
+ target: "finished",
98
+ guard: "canSkip"
99
+ } } },
100
+ finished: { type: "final" }
101
+ }
102
+ });
103
+
104
+ //#endregion
105
+ export { geolocationMachine as t };
@@ -1,4 +1,4 @@
1
- import { n as getDeviceInfo } from "./getBrowser-Dtyt9J_h.esm.js";
1
+ import { n as getDeviceInfo } from "./getBrowser-DCcD7H-M.esm.js";
2
2
 
3
3
  //#region src/internal/device/getDeviceClass.ts
4
4
  function getDeviceClass() {
@@ -1,5 +1,5 @@
1
- import { t as Manager } from "./Manager-BN2g_I8W.js";
2
- import "./Actor-Ba71-_30.js";
1
+ import { t as Manager } from "./Manager-DcPMRgTm.js";
2
+ import "./Actor-DbWH1K6E.js";
3
3
 
4
4
  //#region src/modules/government-validation/types.d.ts
5
5
  type GovernmentValidationConfig = {
@@ -1,273 +1,9 @@
1
- import { t as api } from "./api-DzpnV6O7.esm.js";
2
- import { _ as endpoints, o as createManagerInstrumentation } from "./events-DlHrOIRc.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-Bv55-lJ4.esm.js";
4
- import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BhD2MlHg.esm.js";
1
+ import "./api-aa9Mx20l.esm.js";
2
+ import { o as createManagerInstrumentation } from "./events-W91zLpx4.esm.js";
3
+ import { a as createActor, o as createManager } from "./xstate.esm-B7FPE6br.esm.js";
4
+ import "./BrowserTimerProvider-v7bpbrAk.esm.js";
5
+ import { t as governmentValidationMachine } from "./governmentValidationStateMachine-C_iPX9VE.esm.js";
5
6
 
6
- //#region src/modules/government-validation/governmentValidationServices.ts
7
- async function processGovernmentValidation(signal) {
8
- const res = await api.post(endpoints.governmentValidation, {}, { signal });
9
- if (!res.ok) throw new Error(`POST ${endpoints.governmentValidation} failed: ${res.status} ${res.statusText}`);
10
- return res.data;
11
- }
12
- async function submitGovernmentValidationOtp(params, signal) {
13
- const res = await api.post(endpoints.governmentValidation, { otpCode: params.code }, { signal });
14
- if (!res.ok) throw new Error(`POST ${endpoints.governmentValidation} (OTP) failed: ${res.status} ${res.statusText}`);
15
- return res.data;
16
- }
17
-
18
- //#endregion
19
- //#region src/modules/government-validation/governmentValidationStateMachine.ts
20
- const RESEND_TIMER_SECONDS = 30;
21
- const POLL_INTERVAL_MS = 2e3;
22
- const MAX_POLL_COUNT = 60;
23
- const AUTO_PROCEED_DELAY_MS = 3e3;
24
- const governmentValidationMachine = setup({
25
- types: {
26
- context: {},
27
- events: {},
28
- input: {}
29
- },
30
- delays: { AUTO_PROCEED: AUTO_PROCEED_DELAY_MS },
31
- actors: {
32
- processValidation: fromPromise(async ({ signal }) => {
33
- return processGovernmentValidation(signal);
34
- }),
35
- submitOtp: fromPromise(async ({ input, signal }) => {
36
- return submitGovernmentValidationOtp({ code: input.code }, signal);
37
- }),
38
- pollingTimer: fromCallback(({ sendBack }) => {
39
- const timer = BrowserTimerProvider.getInstance();
40
- const interval = timer.setInterval(() => {
41
- sendBack({ type: "POLL" });
42
- }, POLL_INTERVAL_MS);
43
- return () => timer.clearInterval(interval);
44
- }),
45
- resendTimer: fromCallback(({ sendBack }) => {
46
- const timer = BrowserTimerProvider.getInstance();
47
- let seconds = RESEND_TIMER_SECONDS;
48
- const interval = timer.setInterval(() => {
49
- seconds -= 1;
50
- sendBack({ type: "TICK" });
51
- if (seconds <= 0) timer.clearInterval(interval);
52
- }, 1e3);
53
- return () => timer.clearInterval(interval);
54
- })
55
- },
56
- actions: {
57
- setError: assign(({ event }) => ({ error: String(event.error) })),
58
- setErrorFromResponse: assign({ error: () => "Government validation failed" }),
59
- setUnknownError: assign({ error: () => "Unknown validation status" }),
60
- clearError: assign({ error: () => void 0 }),
61
- setOtpCode: assign(({ event }) => ({
62
- otpCode: event.code,
63
- otpError: void 0
64
- })),
65
- setOtpError: assign(({ context }) => ({
66
- otpError: "Invalid OTP code",
67
- attemptsRemaining: context.attemptsRemaining - 1
68
- })),
69
- clearOtpError: assign({
70
- otpError: () => void 0,
71
- otpCode: () => ""
72
- }),
73
- startResendTimer: assign({
74
- resendTimer: () => RESEND_TIMER_SECONDS,
75
- resendTimerActive: () => true
76
- }),
77
- tickResendTimer: assign(({ context }) => {
78
- const newTimer = Math.max(0, context.resendTimer - 1);
79
- return {
80
- resendTimer: newTimer,
81
- resendTimerActive: newTimer > 0
82
- };
83
- }),
84
- incrementPollCount: assign(({ context }) => ({ pollCount: context.pollCount + 1 })),
85
- resetPollCount: assign({ pollCount: () => 0 }),
86
- resetContext: assign(({ context }) => ({
87
- config: context.config,
88
- error: void 0,
89
- otpCode: "",
90
- otpError: void 0,
91
- attemptsRemaining: context.config.maxOtpAttempts ?? 3,
92
- resendTimer: 0,
93
- resendTimerActive: false,
94
- pollCount: 0
95
- }))
96
- },
97
- guards: {
98
- isProcessing: (_, params) => params.response.statusCode === -1,
99
- isSuccess: (_, params) => params.response.statusCode === 0 && params.response.validationStatus?.status !== "UNKNOWN",
100
- isError: (_, params) => params.response.statusCode > 0,
101
- isOtpRequested: (_, params) => params.response.otpResponse?.authBridge?.otpCodeRequested === true,
102
- isUnknown: (_, params) => params.response.validationStatus?.status === "UNKNOWN",
103
- hasAttemptsRemaining: ({ context }) => context.attemptsRemaining > 0,
104
- canResend: ({ context }) => !context.resendTimerActive,
105
- hasReachedMaxPolls: ({ context }) => context.pollCount >= MAX_POLL_COUNT
106
- }
107
- }).createMachine({
108
- id: "governmentValidation",
109
- initial: "idle",
110
- context: ({ input }) => ({
111
- config: input.config,
112
- error: void 0,
113
- otpCode: "",
114
- otpError: void 0,
115
- attemptsRemaining: input.config.maxOtpAttempts ?? 3,
116
- resendTimer: 0,
117
- resendTimerActive: false,
118
- pollCount: 0
119
- }),
120
- states: {
121
- idle: { on: { LOAD: { target: "loading" } } },
122
- loading: { invoke: {
123
- id: "processValidation",
124
- src: "processValidation",
125
- onDone: [
126
- {
127
- target: "awaitingOtp",
128
- guard: {
129
- type: "isOtpRequested",
130
- params: ({ event }) => ({ response: event.output })
131
- }
132
- },
133
- {
134
- target: "displaySuccess",
135
- guard: {
136
- type: "isSuccess",
137
- params: ({ event }) => ({ response: event.output })
138
- }
139
- },
140
- {
141
- target: "polling",
142
- guard: {
143
- type: "isProcessing",
144
- params: ({ event }) => ({ response: event.output })
145
- }
146
- },
147
- {
148
- target: "displayUnknown",
149
- guard: {
150
- type: "isUnknown",
151
- params: ({ event }) => ({ response: event.output })
152
- },
153
- actions: "setUnknownError"
154
- },
155
- {
156
- target: "displayError",
157
- actions: "setErrorFromResponse"
158
- }
159
- ],
160
- onError: {
161
- target: "displayError",
162
- actions: "setError"
163
- }
164
- } },
165
- polling: {
166
- invoke: {
167
- id: "pollingTimer",
168
- src: "pollingTimer"
169
- },
170
- on: { POLL: [{
171
- target: "displayError",
172
- guard: "hasReachedMaxPolls",
173
- actions: assign({ error: () => "Validation timed out" })
174
- }, {
175
- target: "pollingRequest",
176
- actions: "incrementPollCount"
177
- }] }
178
- },
179
- pollingRequest: { invoke: {
180
- id: "pollValidation",
181
- src: "processValidation",
182
- onDone: [
183
- {
184
- target: "displaySuccess",
185
- guard: {
186
- type: "isSuccess",
187
- params: ({ event }) => ({ response: event.output })
188
- }
189
- },
190
- {
191
- target: "polling",
192
- guard: {
193
- type: "isProcessing",
194
- params: ({ event }) => ({ response: event.output })
195
- }
196
- },
197
- {
198
- target: "displayUnknown",
199
- guard: {
200
- type: "isUnknown",
201
- params: ({ event }) => ({ response: event.output })
202
- },
203
- actions: "setUnknownError"
204
- },
205
- {
206
- target: "displayError",
207
- actions: "setErrorFromResponse"
208
- }
209
- ],
210
- onError: {
211
- target: "displayError",
212
- actions: "setError"
213
- }
214
- } },
215
- awaitingOtp: {
216
- entry: "startResendTimer",
217
- invoke: {
218
- id: "resendTimer",
219
- src: "resendTimer"
220
- },
221
- on: {
222
- TICK: { actions: "tickResendTimer" },
223
- OTP_CHANGED: { actions: "setOtpCode" },
224
- SUBMIT_OTP: { target: "verifyingOtp" },
225
- RESEND_OTP: {
226
- target: "loading",
227
- guard: "canResend"
228
- }
229
- }
230
- },
231
- verifyingOtp: { invoke: {
232
- id: "submitOtp",
233
- src: "submitOtp",
234
- input: ({ context }) => ({ code: context.otpCode }),
235
- onDone: [
236
- {
237
- target: "displaySuccess",
238
- guard: {
239
- type: "isSuccess",
240
- params: ({ event }) => ({ response: event.output })
241
- }
242
- },
243
- {
244
- target: "awaitingOtp",
245
- guard: "hasAttemptsRemaining",
246
- actions: "setOtpError"
247
- },
248
- {
249
- target: "displayError",
250
- actions: assign({ error: () => "Maximum OTP attempts exceeded" })
251
- }
252
- ],
253
- onError: [{
254
- target: "awaitingOtp",
255
- guard: "hasAttemptsRemaining",
256
- actions: "setOtpError"
257
- }, {
258
- target: "displayError",
259
- actions: "setError"
260
- }]
261
- } },
262
- displaySuccess: { after: { AUTO_PROCEED: { target: "finished" } } },
263
- displayProcessing: { after: { AUTO_PROCEED: { target: "finished" } } },
264
- displayError: { after: { AUTO_PROCEED: { target: "finished" } } },
265
- displayUnknown: { after: { AUTO_PROCEED: { target: "finished" } } },
266
- finished: { type: "final" }
267
- }
268
- });
269
-
270
- //#endregion
271
7
  //#region src/modules/government-validation/governmentValidationActor.ts
272
8
  function createGovernmentValidationActor(options) {
273
9
  return createActor(governmentValidationMachine, { input: { config: options.config } }).start();