@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
@@ -1,251 +1,9 @@
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, 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 { 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 "./BrowserTimerProvider-v7bpbrAk.esm.js";
5
+ import { t as redirectToMobileMachine } from "./redirectToMobileStateMachine-vOe27Ufw.esm.js";
5
6
 
6
- //#region ../infra/src/url/urlUtils.ts
7
- function getUrlSearchParam(url, param) {
8
- try {
9
- return new URL(url).searchParams.get(param);
10
- } catch {
11
- return null;
12
- }
13
- }
14
- function buildUrlWithSearchParams(baseUrl, params) {
15
- const url = new URL(baseUrl);
16
- for (const [key, value] of Object.entries(params)) if (value !== void 0) url.searchParams.set(key, value);
17
- return url.href;
18
- }
19
-
20
- //#endregion
21
- //#region src/modules/redirect-to-mobile/redirectToMobileServices.ts
22
- async function fetchRedirectUrl(signal) {
23
- const res = await api.get(endpoints.onboardingUrl, { signal });
24
- if (!res.ok) throw new Error(`GET ${endpoints.onboardingUrl} failed: ${res.status} ${res.statusText}`);
25
- return res.data;
26
- }
27
- async function fetchOnboardingStatus(signal) {
28
- const res = await api.get(endpoints.onboardingStatus, { signal });
29
- if (!res.ok) throw new Error(`GET ${endpoints.onboardingStatus} failed: ${res.status} ${res.statusText}`);
30
- return res.data;
31
- }
32
- async function sendRedirectSms(params, signal) {
33
- const res = await api.post(endpoints.sendRedirectSms, params, { signal });
34
- if (!res.ok) throw new Error(`POST ${endpoints.sendRedirectSms} failed: ${res.status} ${res.statusText}`);
35
- }
36
- async function addPhoneForRedirect(phone, signal) {
37
- const res = await api.post(endpoints.phone, { phone }, { signal });
38
- if (!res.ok) throw new Error(`POST ${endpoints.phone} failed: ${res.status} ${res.statusText}`);
39
- }
40
- async function refreshQrUuid(onboardingId, signal) {
41
- const res = await api.post(endpoints.qrRefreshUuid, { onboardingId }, { signal });
42
- if (!res.ok) throw new Error(`POST ${endpoints.qrRefreshUuid} failed: ${res.status} ${res.statusText}`);
43
- return res.data;
44
- }
45
- async function fetchStartInfo(signal) {
46
- const res = await api.get(endpoints.startInfo, { signal });
47
- if (!res.ok) throw new Error(`GET ${endpoints.startInfo} failed: ${res.status} ${res.statusText}`);
48
- return res.data;
49
- }
50
-
51
- //#endregion
52
- //#region src/modules/redirect-to-mobile/redirectToMobileStateMachine.ts
53
- const POLL_INTERVAL_MS = 5e3;
54
- const QR_REFRESH_INTERVAL_MS = 5e3;
55
- function buildRedirectUrl(baseUrl, customUrl, config, urlUuid) {
56
- const uuid = getUrlSearchParam(baseUrl, "uuid") ?? "";
57
- return buildUrlWithSearchParams(customUrl ?? baseUrl, {
58
- uuid,
59
- isRedirect: "true",
60
- lang: config.lang,
61
- externalId: config.externalId,
62
- auth_hint: config.authHint,
63
- url_uuid: urlUuid || void 0
64
- });
65
- }
66
- function extractUuidFromUrl(url) {
67
- return getUrlSearchParam(url, "uuid") ?? "";
68
- }
69
- const redirectToMobileMachine = setup({
70
- types: {
71
- context: {},
72
- events: {},
73
- input: {}
74
- },
75
- actors: {
76
- fetchRedirectUrl: fromPromise(async ({ signal }) => {
77
- return fetchRedirectUrl(signal);
78
- }),
79
- fetchStartInfo: fromPromise(async ({ signal }) => {
80
- return fetchStartInfo(signal);
81
- }),
82
- pollOnboardingStatus: fromCallback(({ sendBack }) => {
83
- const timer = BrowserTimerProvider.getInstance();
84
- const interval = timer.setInterval(async () => {
85
- try {
86
- if ((await fetchOnboardingStatus()).onboardingStatus === "ONBOARDING_FINISHED") sendBack({ type: "POLL_TICK" });
87
- } catch {}
88
- }, POLL_INTERVAL_MS);
89
- return () => timer.clearInterval(interval);
90
- }),
91
- refreshQrUuid: fromCallback(({ sendBack, input }) => {
92
- const timer = BrowserTimerProvider.getInstance();
93
- const interval = timer.setInterval(async () => {
94
- try {
95
- const res = await refreshQrUuid(input.uuid);
96
- if (res.urlUuid) sendBack({
97
- type: "QR_REFRESHED",
98
- urlUuid: res.urlUuid
99
- });
100
- } catch {}
101
- }, QR_REFRESH_INTERVAL_MS);
102
- return () => timer.clearInterval(interval);
103
- }),
104
- sendSms: fromPromise(async ({ input, signal }) => {
105
- await addPhoneForRedirect(input.phone, signal);
106
- const params = input.lang ? [`lang=${input.lang}`] : [];
107
- await sendRedirectSms({
108
- smsType: "DESKTOP_ONBOARDING",
109
- uuid: input.uuid,
110
- params
111
- }, signal);
112
- })
113
- },
114
- actions: {
115
- setBaseUrl: assign(({ context, event }) => {
116
- const baseUrl = event.output.url;
117
- return {
118
- fetchedBaseUrl: baseUrl,
119
- uuid: extractUuidFromUrl(baseUrl),
120
- redirectUrl: buildRedirectUrl(baseUrl, context.config.url, context.config, context.urlUuid)
121
- };
122
- }),
123
- setStartInfo: assign(({ event }) => {
124
- return { phonePrefix: event.output.phonePrefix };
125
- }),
126
- setError: assign(({ event }) => ({ error: String(event.error) })),
127
- setSmsSent: assign({ smsSent: () => true }),
128
- resetSmsSent: assign({
129
- smsSent: () => false,
130
- error: () => void 0
131
- }),
132
- setSmsError: assign(({ event }) => ({ error: String(event.error) })),
133
- updateQrUrl: assign(({ context, event }) => {
134
- const { urlUuid } = event;
135
- return {
136
- urlUuid,
137
- redirectUrl: buildRedirectUrl(context.fetchedBaseUrl, context.config.url, context.config, urlUuid)
138
- };
139
- })
140
- },
141
- guards: { hasPhishingResistance: ({ context }) => context.config.qrPhishingResistance === true }
142
- }).createMachine({
143
- id: "redirectToMobile",
144
- initial: "idle",
145
- context: ({ input }) => ({
146
- config: input.config,
147
- redirectUrl: "",
148
- fetchedBaseUrl: "",
149
- uuid: "",
150
- urlUuid: "",
151
- phonePrefix: "",
152
- smsSent: false,
153
- error: void 0
154
- }),
155
- states: {
156
- idle: { on: { LOAD: "generatingUrl" } },
157
- generatingUrl: { invoke: {
158
- id: "fetchRedirectUrl",
159
- src: "fetchRedirectUrl",
160
- onDone: {
161
- target: "loadingStartInfo",
162
- actions: "setBaseUrl"
163
- },
164
- onError: {
165
- target: "error",
166
- actions: "setError"
167
- }
168
- } },
169
- loadingStartInfo: { invoke: {
170
- id: "fetchStartInfo",
171
- src: "fetchStartInfo",
172
- onDone: {
173
- target: "showingQr",
174
- actions: "setStartInfo"
175
- },
176
- onError: { target: "showingQr" }
177
- } },
178
- showingQr: {
179
- type: "parallel",
180
- states: {
181
- polling: {
182
- invoke: {
183
- id: "pollOnboardingStatus",
184
- src: "pollOnboardingStatus"
185
- },
186
- on: { POLL_TICK: { target: "#redirectToMobile.finished" } }
187
- },
188
- qrRefresh: {
189
- initial: "checking",
190
- states: {
191
- checking: { always: [{
192
- target: "refreshing",
193
- guard: "hasPhishingResistance"
194
- }, { target: "inactive" }] },
195
- refreshing: {
196
- invoke: {
197
- id: "refreshQrUuid",
198
- src: "refreshQrUuid",
199
- input: ({ context }) => ({ uuid: context.uuid })
200
- },
201
- on: { QR_REFRESHED: { actions: "updateQrUrl" } }
202
- },
203
- inactive: { type: "final" }
204
- }
205
- },
206
- sms: {
207
- initial: "idle",
208
- states: {
209
- idle: { on: { SEND_SMS: "sending" } },
210
- sending: { invoke: {
211
- id: "sendSms",
212
- src: "sendSms",
213
- input: ({ context, event }) => ({
214
- phone: event.phone,
215
- uuid: context.uuid,
216
- lang: context.config.lang
217
- }),
218
- onDone: {
219
- target: "sent",
220
- actions: "setSmsSent"
221
- },
222
- onError: {
223
- target: "idle",
224
- actions: "setSmsError"
225
- }
226
- } },
227
- sent: { on: {
228
- SEND_SMS: "sending",
229
- RESET_SMS: {
230
- target: "idle",
231
- actions: "resetSmsSent"
232
- }
233
- } }
234
- }
235
- }
236
- },
237
- on: {
238
- CONTINUE_ON_DESKTOP: "closed",
239
- CLOSE: "closed"
240
- }
241
- },
242
- finished: { type: "final" },
243
- closed: { type: "final" },
244
- error: { on: { RETRY: "generatingUrl" } }
245
- }
246
- });
247
-
248
- //#endregion
249
7
  //#region src/modules/redirect-to-mobile/redirectToMobileActor.ts
250
8
  function createRedirectToMobileActor(options) {
251
9
  return createActor(redirectToMobileMachine, { input: { config: options.config } }).start();
@@ -0,0 +1,249 @@
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, r as fromCallback, t as setup } from "./xstate.esm-B7FPE6br.esm.js";
4
+ import { t as BrowserTimerProvider } from "./BrowserTimerProvider-v7bpbrAk.esm.js";
5
+
6
+ //#region ../infra/src/url/urlUtils.ts
7
+ function getUrlSearchParam(url, param) {
8
+ try {
9
+ return new URL(url).searchParams.get(param);
10
+ } catch {
11
+ return null;
12
+ }
13
+ }
14
+ function buildUrlWithSearchParams(baseUrl, params) {
15
+ const url = new URL(baseUrl);
16
+ for (const [key, value] of Object.entries(params)) if (value !== void 0) url.searchParams.set(key, value);
17
+ return url.href;
18
+ }
19
+
20
+ //#endregion
21
+ //#region src/modules/redirect-to-mobile/redirectToMobileServices.ts
22
+ async function fetchRedirectUrl(signal) {
23
+ const res = await api.get(endpoints.onboardingUrl, { signal });
24
+ if (!res.ok) throw new Error(`GET ${endpoints.onboardingUrl} failed: ${res.status} ${res.statusText}`);
25
+ return res.data;
26
+ }
27
+ async function fetchOnboardingStatus(signal) {
28
+ const res = await api.get(endpoints.onboardingStatus, { signal });
29
+ if (!res.ok) throw new Error(`GET ${endpoints.onboardingStatus} failed: ${res.status} ${res.statusText}`);
30
+ return res.data;
31
+ }
32
+ async function sendRedirectSms(params, signal) {
33
+ const res = await api.post(endpoints.sendRedirectSms, params, { signal });
34
+ if (!res.ok) throw new Error(`POST ${endpoints.sendRedirectSms} failed: ${res.status} ${res.statusText}`);
35
+ }
36
+ async function addPhoneForRedirect(phone, signal) {
37
+ const res = await api.post(endpoints.phone, { phone }, { signal });
38
+ if (!res.ok) throw new Error(`POST ${endpoints.phone} failed: ${res.status} ${res.statusText}`);
39
+ }
40
+ async function refreshQrUuid(onboardingId, signal) {
41
+ const res = await api.post(endpoints.qrRefreshUuid, { onboardingId }, { signal });
42
+ if (!res.ok) throw new Error(`POST ${endpoints.qrRefreshUuid} failed: ${res.status} ${res.statusText}`);
43
+ return res.data;
44
+ }
45
+ async function fetchStartInfo(signal) {
46
+ const res = await api.get(endpoints.startInfo, { signal });
47
+ if (!res.ok) throw new Error(`GET ${endpoints.startInfo} failed: ${res.status} ${res.statusText}`);
48
+ return res.data;
49
+ }
50
+
51
+ //#endregion
52
+ //#region src/modules/redirect-to-mobile/redirectToMobileStateMachine.ts
53
+ const POLL_INTERVAL_MS = 5e3;
54
+ const QR_REFRESH_INTERVAL_MS = 5e3;
55
+ function buildRedirectUrl(baseUrl, customUrl, config, urlUuid) {
56
+ const uuid = getUrlSearchParam(baseUrl, "uuid") ?? "";
57
+ return buildUrlWithSearchParams(customUrl ?? baseUrl, {
58
+ uuid,
59
+ isRedirect: "true",
60
+ lang: config.lang,
61
+ externalId: config.externalId,
62
+ auth_hint: config.authHint,
63
+ url_uuid: urlUuid || void 0
64
+ });
65
+ }
66
+ function extractUuidFromUrl(url) {
67
+ return getUrlSearchParam(url, "uuid") ?? "";
68
+ }
69
+ const redirectToMobileMachine = setup({
70
+ types: {
71
+ context: {},
72
+ events: {},
73
+ input: {}
74
+ },
75
+ actors: {
76
+ fetchRedirectUrl: fromPromise(async ({ signal }) => {
77
+ return fetchRedirectUrl(signal);
78
+ }),
79
+ fetchStartInfo: fromPromise(async ({ signal }) => {
80
+ return fetchStartInfo(signal);
81
+ }),
82
+ pollOnboardingStatus: fromCallback(({ sendBack }) => {
83
+ const timer = BrowserTimerProvider.getInstance();
84
+ const interval = timer.setInterval(async () => {
85
+ try {
86
+ if ((await fetchOnboardingStatus()).onboardingStatus === "ONBOARDING_FINISHED") sendBack({ type: "POLL_TICK" });
87
+ } catch {}
88
+ }, POLL_INTERVAL_MS);
89
+ return () => timer.clearInterval(interval);
90
+ }),
91
+ refreshQrUuid: fromCallback(({ sendBack, input }) => {
92
+ const timer = BrowserTimerProvider.getInstance();
93
+ const interval = timer.setInterval(async () => {
94
+ try {
95
+ const res = await refreshQrUuid(input.uuid);
96
+ if (res.urlUuid) sendBack({
97
+ type: "QR_REFRESHED",
98
+ urlUuid: res.urlUuid
99
+ });
100
+ } catch {}
101
+ }, QR_REFRESH_INTERVAL_MS);
102
+ return () => timer.clearInterval(interval);
103
+ }),
104
+ sendSms: fromPromise(async ({ input, signal }) => {
105
+ await addPhoneForRedirect(input.phone, signal);
106
+ const params = input.lang ? [`lang=${input.lang}`] : [];
107
+ await sendRedirectSms({
108
+ smsType: "DESKTOP_ONBOARDING",
109
+ uuid: input.uuid,
110
+ params
111
+ }, signal);
112
+ })
113
+ },
114
+ actions: {
115
+ setBaseUrl: assign(({ context, event }) => {
116
+ const baseUrl = event.output.url;
117
+ return {
118
+ fetchedBaseUrl: baseUrl,
119
+ uuid: extractUuidFromUrl(baseUrl),
120
+ redirectUrl: buildRedirectUrl(baseUrl, context.config.url, context.config, context.urlUuid)
121
+ };
122
+ }),
123
+ setStartInfo: assign(({ event }) => {
124
+ return { phonePrefix: event.output.phonePrefix };
125
+ }),
126
+ setError: assign(({ event }) => ({ error: String(event.error) })),
127
+ setSmsSent: assign({ smsSent: () => true }),
128
+ resetSmsSent: assign({
129
+ smsSent: () => false,
130
+ error: () => void 0
131
+ }),
132
+ setSmsError: assign(({ event }) => ({ error: String(event.error) })),
133
+ updateQrUrl: assign(({ context, event }) => {
134
+ const { urlUuid } = event;
135
+ return {
136
+ urlUuid,
137
+ redirectUrl: buildRedirectUrl(context.fetchedBaseUrl, context.config.url, context.config, urlUuid)
138
+ };
139
+ })
140
+ },
141
+ guards: { hasPhishingResistance: ({ context }) => context.config.qrPhishingResistance === true }
142
+ }).createMachine({
143
+ id: "redirectToMobile",
144
+ initial: "idle",
145
+ context: ({ input }) => ({
146
+ config: input.config,
147
+ redirectUrl: "",
148
+ fetchedBaseUrl: "",
149
+ uuid: "",
150
+ urlUuid: "",
151
+ phonePrefix: "",
152
+ smsSent: false,
153
+ error: void 0
154
+ }),
155
+ states: {
156
+ idle: { on: { LOAD: "generatingUrl" } },
157
+ generatingUrl: { invoke: {
158
+ id: "fetchRedirectUrl",
159
+ src: "fetchRedirectUrl",
160
+ onDone: {
161
+ target: "loadingStartInfo",
162
+ actions: "setBaseUrl"
163
+ },
164
+ onError: {
165
+ target: "error",
166
+ actions: "setError"
167
+ }
168
+ } },
169
+ loadingStartInfo: { invoke: {
170
+ id: "fetchStartInfo",
171
+ src: "fetchStartInfo",
172
+ onDone: {
173
+ target: "showingQr",
174
+ actions: "setStartInfo"
175
+ },
176
+ onError: { target: "showingQr" }
177
+ } },
178
+ showingQr: {
179
+ type: "parallel",
180
+ states: {
181
+ polling: {
182
+ invoke: {
183
+ id: "pollOnboardingStatus",
184
+ src: "pollOnboardingStatus"
185
+ },
186
+ on: { POLL_TICK: { target: "#redirectToMobile.finished" } }
187
+ },
188
+ qrRefresh: {
189
+ initial: "checking",
190
+ states: {
191
+ checking: { always: [{
192
+ target: "refreshing",
193
+ guard: "hasPhishingResistance"
194
+ }, { target: "inactive" }] },
195
+ refreshing: {
196
+ invoke: {
197
+ id: "refreshQrUuid",
198
+ src: "refreshQrUuid",
199
+ input: ({ context }) => ({ uuid: context.uuid })
200
+ },
201
+ on: { QR_REFRESHED: { actions: "updateQrUrl" } }
202
+ },
203
+ inactive: { type: "final" }
204
+ }
205
+ },
206
+ sms: {
207
+ initial: "idle",
208
+ states: {
209
+ idle: { on: { SEND_SMS: "sending" } },
210
+ sending: { invoke: {
211
+ id: "sendSms",
212
+ src: "sendSms",
213
+ input: ({ context, event }) => ({
214
+ phone: event.phone,
215
+ uuid: context.uuid,
216
+ lang: context.config.lang
217
+ }),
218
+ onDone: {
219
+ target: "sent",
220
+ actions: "setSmsSent"
221
+ },
222
+ onError: {
223
+ target: "idle",
224
+ actions: "setSmsError"
225
+ }
226
+ } },
227
+ sent: { on: {
228
+ SEND_SMS: "sending",
229
+ RESET_SMS: {
230
+ target: "idle",
231
+ actions: "resetSmsSent"
232
+ }
233
+ } }
234
+ }
235
+ }
236
+ },
237
+ on: {
238
+ CONTINUE_ON_DESKTOP: "closed",
239
+ CLOSE: "closed"
240
+ }
241
+ },
242
+ finished: { type: "final" },
243
+ closed: { type: "final" },
244
+ error: { on: { RETRY: "generatingUrl" } }
245
+ }
246
+ });
247
+
248
+ //#endregion
249
+ export { redirectToMobileMachine as t };
@@ -0,0 +1,27 @@
1
+ import { a as createActor, r as fromCallback } from "./xstate.esm-B7FPE6br.esm.js";
2
+
3
+ //#region src/internal/orchestration/runChildModule.ts
4
+ const runChildModule = fromCallback(({ sendBack, input }) => {
5
+ const { machine, config } = input;
6
+ if (!machine) return () => {};
7
+ const actor = createActor(machine, { input: { config } });
8
+ const subscription = actor.subscribe({
9
+ complete: () => {
10
+ sendBack({ type: "MODULE_COMPLETE" });
11
+ },
12
+ error: (err) => {
13
+ sendBack({
14
+ type: "MODULE_ERROR",
15
+ error: err
16
+ });
17
+ }
18
+ });
19
+ actor.start();
20
+ return () => {
21
+ subscription.unsubscribe();
22
+ actor.stop();
23
+ };
24
+ });
25
+
26
+ //#endregion
27
+ export { runChildModule as t };
package/dist/selfie.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import "./warmup-CIj_wEV_.js";
2
- import "./Manager-BN2g_I8W.js";
3
- import "./Actor-Ba71-_30.js";
4
- import "./StateMachine-BoJsfMvg.js";
5
- import { a as SelfieMachine, d as SelfieConfig, o as selfieMachine, v as DetectionStatus, y as FaceErrorCode } from "./faceCaptureManagerFactory-Da_-ohdg.js";
6
- import { t as CameraStream } from "./camera-1eeGnAaL.js";
7
- import "./types-2OPf1pyv.js";
8
- import "./types-CVJVQ7fp.js";
9
- import { t as DeepsightService } from "./deepsightService-ByD6uIs7.js";
10
- import { n as PermissionStatus, t as PermissionResult } from "./types-D_QfFKxT.js";
11
- import { a as ProcessFaceResponse, n as SelfieState, o as processFace, r as createSelfieManager, t as SelfieManager } from "./selfieManager-DCRP7X75.js";
1
+ import "./warmup-Ckb1hN85.js";
2
+ import "./Manager-DcPMRgTm.js";
3
+ import "./Actor-DbWH1K6E.js";
4
+ import "./StateMachine-BBuIgsHT.js";
5
+ import { a as SelfieMachine, d as SelfieConfig, o as selfieMachine, v as DetectionStatus, y as FaceErrorCode } from "./faceCaptureManagerFactory-P2yy30KU.js";
6
+ import { t as CameraStream } from "./camera-DATT31my.js";
7
+ import "./types-CYJ0Ish6.js";
8
+ import "./types-DU8HmI5U.js";
9
+ import { t as DeepsightService } from "./deepsightService-S-tU77m-.js";
10
+ import { n as PermissionStatus, t as PermissionResult } from "./types-CIjb0FKu.js";
11
+ import { a as ProcessFaceResponse, n as SelfieState, o as processFace, r as createSelfieManager, t as SelfieManager } from "./selfieManager-DNwfxieF.js";
12
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,21 +1,24 @@
1
- import "./BaseWasmProvider-D-s_6M5H.esm.js";
2
- import "./WasmUtilProvider-BpZSvZbg.esm.js";
3
- import "./api-DzpnV6O7.esm.js";
4
- import "./events-DlHrOIRc.esm.js";
5
- import "./browserSimulation-B4ubb2OL.esm.js";
6
- import "./xstate.esm-Bv55-lJ4.esm.js";
7
- import "./faceCaptureSetup-CaVWkjvE.esm.js";
8
- import { l as processFace } from "./recordingService-483wQ6kR.esm.js";
9
- import "./deepsightService-BjgXl5hs.esm.js";
10
- import "./camera-DmkFpf5N.esm.js";
11
- import "./getBrowser-Dtyt9J_h.esm.js";
12
- import "./stats-DHDoqSBV.esm.js";
13
- import "./MotionSensorProvider-CodM3e0E.esm.js";
14
- import "./permissionServices-Cskq32Yd.esm.js";
15
- import "./platform-Dv7a2fv-.esm.js";
16
- import "./ITimerCapability-oixwa6nj.esm.js";
17
- import "./backCameraStream-tabTmwDS.esm.js";
18
- import "./getDeviceClass-DEzz4cmY.esm.js";
19
- import { r as selfieMachine, t as createSelfieManager } from "./selfieManager-DeOcNel4.esm.js";
1
+ import "./BaseWasmProvider-DoYDYH1z.esm.js";
2
+ import "./WasmUtilProvider-mWSXzp7b.esm.js";
3
+ import "./api-aa9Mx20l.esm.js";
4
+ import "./events-W91zLpx4.esm.js";
5
+ import "./browserSimulation-DFqGKQAD.esm.js";
6
+ import "./xstate.esm-B7FPE6br.esm.js";
7
+ import "./faceCaptureManagerFactory-Bspg2Tyf.esm.js";
8
+ import "./BrowserStorageProvider-CXaS5Ooj.esm.js";
9
+ import { l as processFace } from "./recordingService-CCfxUY7-.esm.js";
10
+ import "./deepsightService-rPGLH8Xp.esm.js";
11
+ import "./camera-DpPQS_-5.esm.js";
12
+ import "./getBrowser-DCcD7H-M.esm.js";
13
+ import "./stats-gFD2351t.esm.js";
14
+ import "./MotionSensorProvider-D90R4qwV.esm.js";
15
+ import "./permissionServices-Cisv73eQ.esm.js";
16
+ import "./platform-DctkySJU.esm.js";
17
+ import "./ITimerCapability-BZO_FsCo.esm.js";
18
+ import "./backCameraStream-D9g2wyil.esm.js";
19
+ import "./getDeviceClass-DBF-ExLR.esm.js";
20
+ import "./faceCaptureSetup-CQevz86q.esm.js";
21
+ import { t as selfieMachine } from "./selfieStateMachine-3b19ON1z.esm.js";
22
+ import { t as createSelfieManager } from "./selfieManager-CorEST5h.esm.js";
20
23
 
21
24
  export { createSelfieManager, processFace, selfieMachine };
@@ -0,0 +1,60 @@
1
+ import { t as WasmUtilProvider } from "./WasmUtilProvider-mWSXzp7b.esm.js";
2
+ import { n as eventModuleNames } from "./events-W91zLpx4.esm.js";
3
+ import { a as createActor } from "./xstate.esm-B7FPE6br.esm.js";
4
+ import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-Bspg2Tyf.esm.js";
5
+ import { t as BrowserStorageProvider } from "./BrowserStorageProvider-CXaS5Ooj.esm.js";
6
+ import { t as selfieMachine } from "./selfieStateMachine-3b19ON1z.esm.js";
7
+
8
+ //#region src/modules/selfie/selfieActor.ts
9
+ function createSelfieActor(options) {
10
+ const dependencies = options.dependencies ?? {
11
+ storage: new BrowserStorageProvider(),
12
+ getWasmUtil: () => WasmUtilProvider.getInstance()
13
+ };
14
+ return createActor(selfieMachine, { input: {
15
+ config: options.config,
16
+ dependencies,
17
+ authHint: options.authHint
18
+ } }).start();
19
+ }
20
+
21
+ //#endregion
22
+ //#region src/modules/selfie/selfieManager.ts
23
+ function createSelfieManagerFromActor(actor) {
24
+ return createFaceCaptureManagerFromActor(actor, eventModuleNames.selfie);
25
+ }
26
+ /**
27
+ * Creates a selfie manager instance for handling selfie capture flow.
28
+ *
29
+ * The selfie manager provides:
30
+ * - State management with statuses: `idle`, `loading`, `tutorial`, `permissions`, `capture`, `finished`, `closed`, `error`
31
+ * - Permission handling with nested states: `idle`, `requesting`, `denied`, `learnMore`
32
+ * - Capture handling with nested states: `initializing`, `startingRecorder`, `recordingActive`, `detecting`, `capturing`, `uploading`, `uploadError`, `success`
33
+ * - Camera stream access when in `capture` state
34
+ * - Detection status feedback during face detection
35
+ * - Attempt tracking with `attemptsRemaining`
36
+ *
37
+ * @param options - Configuration for the selfie actor
38
+ * @param options.config - The selfie module configuration from the flow
39
+ * @returns A manager instance with state subscription, API methods, and lifecycle controls
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const selfieManager = createSelfieManager({ config: selfieConfig });
44
+ *
45
+ * selfieManager.subscribe((state) => {
46
+ * if (state.status === 'capture') {
47
+ * console.log('Camera ready:', state.stream);
48
+ * console.log('Detection status:', state.detectionStatus);
49
+ * }
50
+ * });
51
+ *
52
+ * selfieManager.load();
53
+ * ```
54
+ */
55
+ function createSelfieManager(options) {
56
+ return createFaceCaptureManagerFromActor(createSelfieActor(options), eventModuleNames.selfie);
57
+ }
58
+
59
+ //#endregion
60
+ export { createSelfieManagerFromActor as n, createSelfieManager as t };
@@ -1,5 +1,5 @@
1
- import { t as Manager } from "./Manager-BN2g_I8W.js";
2
- import { i as SelfieActor, n as FaceCaptureManagerState, r as CreateSelfieActorOptions, t as FaceCaptureManager } from "./faceCaptureManagerFactory-Da_-ohdg.js";
1
+ import { t as Manager } from "./Manager-DcPMRgTm.js";
2
+ import { i as SelfieActor, n as FaceCaptureManagerState, r as CreateSelfieActorOptions, t as FaceCaptureManager } from "./faceCaptureManagerFactory-P2yy30KU.js";
3
3
 
4
4
  //#region src/modules/selfie/selfieUploadService.d.ts
5
5
  type ProcessFaceImageType = 'selfie' | 'videoSelfie';