@incodetech/core 2.0.0 → 2.0.1

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 (178) hide show
  1. package/dist/Actor-CI32dTbG.d.ts +2 -0
  2. package/dist/BaseWasmProvider-C_DLEI40.esm.js +1118 -0
  3. package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +55 -0
  4. package/dist/BrowserTimerProvider-DhNc_x02.esm.js +22 -0
  5. package/dist/ITimerCapability-C67ZRskg.esm.js +7 -0
  6. package/dist/IpifyProvider-D7jx52AL.esm.js +139 -0
  7. package/dist/Manager-C8PrhBOx.d.ts +19 -0
  8. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +254 -0
  9. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +87 -0
  10. package/dist/StateMachine-BCQrZJhf.d.ts +2 -0
  11. package/dist/WasmUtilProvider-j98OJf-S.esm.js +114 -0
  12. package/dist/addressSearch-BpTbTWCa.esm.js +430 -0
  13. package/dist/ae-signature-DDDZmWXj.esm.js +12 -0
  14. package/dist/ae-signature.d.ts +25 -0
  15. package/dist/ae-signature.esm.js +8 -0
  16. package/dist/antifraud.d.ts +57 -0
  17. package/dist/antifraud.esm.js +45 -0
  18. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +39 -0
  19. package/dist/api-CESGtpbH.esm.js +53 -0
  20. package/dist/authentication.d.ts +12 -0
  21. package/dist/authentication.esm.js +25 -0
  22. package/dist/authenticationManager-5M-fKzXx.esm.js +67 -0
  23. package/dist/authenticationManager-C83GNIhl.d.ts +66 -0
  24. package/dist/authenticationStateMachine-BMZqatiF.esm.js +139 -0
  25. package/dist/backCameraStream-DMdMeGk2.esm.js +346 -0
  26. package/dist/browserSimulation-gxD8cSpM.esm.js +20 -0
  27. package/dist/camera-DBSxa6ML.d.ts +4 -0
  28. package/dist/camera-PA2Ljri3.esm.js +22 -0
  29. package/dist/camera.d.ts +15 -0
  30. package/dist/camera.esm.js +5 -0
  31. package/dist/chunk-CRF6K_H_.esm.js +49 -0
  32. package/dist/consent.d.ts +398 -0
  33. package/dist/consent.esm.js +79 -0
  34. package/dist/consentStateMachine-CCT-B60O.esm.js +151 -0
  35. package/dist/cpf-PPz2Njto.esm.js +38 -0
  36. package/dist/cpf-ocr.d.ts +204 -0
  37. package/dist/cpf-ocr.esm.js +177 -0
  38. package/dist/cross-document-data-match.d.ts +34 -0
  39. package/dist/cross-document-data-match.esm.js +71 -0
  40. package/dist/curp-validation.d.ts +188 -0
  41. package/dist/curp-validation.esm.js +110 -0
  42. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +595 -0
  43. package/dist/custom-fields.d.ts +115 -0
  44. package/dist/custom-fields.esm.js +177 -0
  45. package/dist/custom-watchlist.d.ts +66 -0
  46. package/dist/custom-watchlist.esm.js +86 -0
  47. package/dist/dateUtils-UoN5xswP.esm.js +23 -0
  48. package/dist/deepsightLoader-Cm4JIT_z.esm.js +52 -0
  49. package/dist/deepsightService-CEVxzehb.d.ts +412 -0
  50. package/dist/deepsightService-O74l4Y__.esm.js +489 -0
  51. package/dist/device.d.ts +46 -0
  52. package/dist/device.esm.js +106 -0
  53. package/dist/displayErrors-DqJ_IbsG.d.ts +39 -0
  54. package/dist/document-capture.d.ts +906 -0
  55. package/dist/document-capture.esm.js +156 -0
  56. package/dist/document-upload.d.ts +331 -0
  57. package/dist/document-upload.esm.js +203 -0
  58. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +394 -0
  59. package/dist/dynamic-forms.d.ts +178 -0
  60. package/dist/dynamic-forms.esm.js +323 -0
  61. package/dist/ekyb.d.ts +148 -0
  62. package/dist/ekyb.esm.js +127 -0
  63. package/dist/ekybStateMachine-CyMx_kg-.esm.js +674 -0
  64. package/dist/ekyc.d.ts +164 -0
  65. package/dist/ekyc.esm.js +104 -0
  66. package/dist/ekycStateMachine-oeO0Iekd.esm.js +10626 -0
  67. package/dist/electronic-signature.d.ts +4 -0
  68. package/dist/electronic-signature.esm.js +7 -0
  69. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +428 -0
  70. package/dist/email.d.ts +4 -0
  71. package/dist/email.esm.js +9 -0
  72. package/dist/emailManager-DIfnS5g1.d.ts +352 -0
  73. package/dist/emailManager-wAV0LE-H.esm.js +238 -0
  74. package/dist/emailStateMachine-DOf4j58N.esm.js +292 -0
  75. package/dist/endpoints-CnN3SyDa.esm.js +87 -0
  76. package/dist/events-D6-e4vok.esm.js +596 -0
  77. package/dist/events.d.ts +265 -0
  78. package/dist/events.esm.js +4 -0
  79. package/dist/extensibility.d.ts +122 -0
  80. package/dist/extensibility.esm.js +43 -0
  81. package/dist/face-match.d.ts +228 -0
  82. package/dist/face-match.esm.js +173 -0
  83. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +290 -0
  84. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +690 -0
  85. package/dist/faceCaptureSetup-B3faSpYA.esm.js +873 -0
  86. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +127 -0
  87. package/dist/flow-events.d.ts +6 -0
  88. package/dist/flow-events.esm.js +0 -0
  89. package/dist/flow.d.ts +358 -0
  90. package/dist/flow.esm.js +825 -0
  91. package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
  92. package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
  93. package/dist/flowServices-PiNsxLfK.esm.js +188 -0
  94. package/dist/geolocation.d.ts +127 -0
  95. package/dist/geolocation.esm.js +89 -0
  96. package/dist/geolocationStateMachine-asasuHY2.esm.js +105 -0
  97. package/dist/getBrowser-BSXUTWXw.esm.js +41 -0
  98. package/dist/getDeviceClass-BSntT9_j.esm.js +14 -0
  99. package/dist/government-validation.d.ts +67 -0
  100. package/dist/government-validation.esm.js +81 -0
  101. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +271 -0
  102. package/dist/home.d.ts +99 -0
  103. package/dist/home.esm.js +61 -0
  104. package/dist/http.d.ts +68 -0
  105. package/dist/http.esm.js +3 -0
  106. package/dist/id-ocr.d.ts +635 -0
  107. package/dist/id-ocr.esm.js +86 -0
  108. package/dist/id-verification.d.ts +190 -0
  109. package/dist/id-verification.esm.js +43 -0
  110. package/dist/id.d.ts +24 -0
  111. package/dist/id.esm.js +164 -0
  112. package/dist/idCaptureManager-D0ktk7Hh.esm.js +581 -0
  113. package/dist/idCaptureManager-Fyd0eam-.d.ts +958 -0
  114. package/dist/idCaptureStateMachine-dwlBUjbC.esm.js +2963 -0
  115. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +388 -0
  116. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +71 -0
  117. package/dist/identity-reuse.d.ts +530 -0
  118. package/dist/identity-reuse.esm.js +274 -0
  119. package/dist/index-BcRG8rtJ.d.ts +97 -0
  120. package/dist/index-ChHWNH48.d.ts +1177 -0
  121. package/dist/index.d.ts +3 -0
  122. package/dist/index.esm.js +12 -0
  123. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
  124. package/dist/lib-BB0B_qQX.esm.js +12499 -0
  125. package/dist/mandatory-consent.d.ts +412 -0
  126. package/dist/mandatory-consent.esm.js +78 -0
  127. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +126 -0
  128. package/dist/openviduLazy-Cm0XFh_v.esm.js +3 -0
  129. package/dist/openviduLazy-Cok70ZSg.esm.js +12 -0
  130. package/dist/permissionServices-D_i6nzEw.esm.js +50 -0
  131. package/dist/phone.d.ts +4 -0
  132. package/dist/phone.esm.js +9 -0
  133. package/dist/phoneManager-B6M30hKE.d.ts +397 -0
  134. package/dist/phoneManager-DAJbGhlY.esm.js +256 -0
  135. package/dist/phoneStateMachine-CuPARRaT.esm.js +351 -0
  136. package/dist/platform-CfrjKhmi.esm.js +83 -0
  137. package/dist/qe-signature-DFo_Cc-I.esm.js +12 -0
  138. package/dist/qe-signature.d.ts +25 -0
  139. package/dist/qe-signature.esm.js +8 -0
  140. package/dist/recordingService-Ig2UgbLv.esm.js +1003 -0
  141. package/dist/redirect-to-mobile.d.ts +107 -0
  142. package/dist/redirect-to-mobile.esm.js +102 -0
  143. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +249 -0
  144. package/dist/runChildModule-CqqwqAkW.esm.js +219 -0
  145. package/dist/selfie.d.ts +26 -0
  146. package/dist/selfie.esm.js +146 -0
  147. package/dist/selfieManager-D0lSgd-J.d.ts +68 -0
  148. package/dist/selfieManager-Duisl7qN.esm.js +60 -0
  149. package/dist/selfieStateMachine-D76whWEf.esm.js +68 -0
  150. package/dist/session-CrkWAs-q.esm.js +3206 -0
  151. package/dist/session.d.ts +217 -0
  152. package/dist/session.esm.js +9 -0
  153. package/dist/setup-C5AITV8m.d.ts +254 -0
  154. package/dist/setup-DPPAxmXf.esm.js +887 -0
  155. package/dist/signature.d.ts +94 -0
  156. package/dist/signature.esm.js +66 -0
  157. package/dist/signatureStateMachine-B5-QVUve.esm.js +132 -0
  158. package/dist/stats-CIfiPzb1.esm.js +16 -0
  159. package/dist/stats.d.ts +16 -0
  160. package/dist/stats.esm.js +4 -0
  161. package/dist/trust-graph.d.ts +54 -0
  162. package/dist/trust-graph.esm.js +56 -0
  163. package/dist/types-B06Ypu2F.d.ts +49 -0
  164. package/dist/types-BP1m8VRw.d.ts +340 -0
  165. package/dist/types-CAD4va6a.d.ts +5 -0
  166. package/dist/types-CFV9G_7j.d.ts +24 -0
  167. package/dist/warmup-CEcppFiS.d.ts +63 -0
  168. package/dist/wasm.d.ts +15 -0
  169. package/dist/wasm.esm.js +12 -0
  170. package/dist/watchlist-for-business.d.ts +79 -0
  171. package/dist/watchlist-for-business.esm.js +148 -0
  172. package/dist/watchlist.d.ts +62 -0
  173. package/dist/watchlist.esm.js +86 -0
  174. package/dist/watchlistServices-DMbUhkBX.esm.js +12 -0
  175. package/dist/workflow.d.ts +907 -0
  176. package/dist/workflow.esm.js +702 -0
  177. package/dist/xstate.esm-B70JrNqo.esm.js +3404 -0
  178. package/package.json +1 -1
@@ -0,0 +1,107 @@
1
+ import { t as Manager } from "./Manager-C8PrhBOx.js";
2
+ import "./Actor-CI32dTbG.js";
3
+
4
+ //#region src/modules/redirect-to-mobile/types.d.ts
5
+ type RedirectToMobileConfig = {
6
+ flowId?: string;
7
+ url?: string;
8
+ disableSmsOption?: boolean;
9
+ addContinueToDesktop?: boolean;
10
+ qrPhishingResistance?: boolean;
11
+ authHint?: string;
12
+ externalId?: string;
13
+ lang?: string;
14
+ };
15
+ //#endregion
16
+ //#region src/modules/redirect-to-mobile/redirectToMobileStateMachine.d.ts
17
+
18
+ declare const redirectToMobileMachine: any;
19
+ //#endregion
20
+ //#region src/modules/redirect-to-mobile/redirectToMobileActor.d.ts
21
+ type CreateRedirectToMobileActorOptions = {
22
+ config: RedirectToMobileConfig;
23
+ };
24
+ //#endregion
25
+ //#region src/modules/redirect-to-mobile/redirectToMobileManager.d.ts
26
+ type RedirectToMobileIdleState = {
27
+ status: 'idle';
28
+ };
29
+ type RedirectToMobileLoadingState = {
30
+ status: 'loading';
31
+ };
32
+ type RedirectToMobileRedirectingState = {
33
+ status: 'redirecting';
34
+ redirectUrl: string;
35
+ phonePrefix: string;
36
+ smsSent: boolean;
37
+ error: string | undefined;
38
+ };
39
+ type RedirectToMobileFinishedState = {
40
+ status: 'finished';
41
+ };
42
+ type RedirectToMobileClosedState = {
43
+ status: 'closed';
44
+ };
45
+ type RedirectToMobileErrorState = {
46
+ status: 'error';
47
+ error: string;
48
+ };
49
+ type RedirectToMobileState = RedirectToMobileIdleState | RedirectToMobileLoadingState | RedirectToMobileRedirectingState | RedirectToMobileFinishedState | RedirectToMobileClosedState | RedirectToMobileErrorState;
50
+ /**
51
+ * Creates a redirect-to-mobile manager for cross-device onboarding flows.
52
+ *
53
+ * On desktop, displays a QR code (and optional SMS input) so the user can
54
+ * continue on their mobile device. Polls the backend until the mobile
55
+ * session completes, then transitions to `finished`.
56
+ *
57
+ * @param options - Configuration for the redirect module
58
+ * @returns A manager instance with state subscription and API methods
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const manager = createRedirectToMobileManager({
63
+ * config: { disableSmsOption: false, addContinueToDesktop: true },
64
+ * });
65
+ *
66
+ * manager.subscribe((state) => {
67
+ * if (state.status === 'redirecting') {
68
+ * renderQrCode(state.redirectUrl);
69
+ * }
70
+ * if (state.status === 'finished') {
71
+ * console.log('Mobile onboarding complete');
72
+ * }
73
+ * });
74
+ *
75
+ * manager.load();
76
+ * ```
77
+ */
78
+ declare function createRedirectToMobileManager(options: CreateRedirectToMobileActorOptions): Manager<RedirectToMobileState> & {
79
+ /**
80
+ * Starts the redirect-to-mobile flow by fetching the redirect URL.
81
+ */
82
+ load(): void;
83
+ /**
84
+ * Sends an SMS with the redirect link to the given phone number.
85
+ * @param phone - Full phone number with country code
86
+ */
87
+ sendSms(phone: string): void;
88
+ /**
89
+ * Skips the redirect and allows the user to continue on desktop.
90
+ */
91
+ continueOnDesktop(): void;
92
+ /**
93
+ * Resets the SMS state so the user can re-enter their phone number.
94
+ */
95
+ resetSms(): void;
96
+ /**
97
+ * Closes/dismisses the redirect screen.
98
+ */
99
+ close(): void;
100
+ /**
101
+ * Retries generating the redirect URL after an error.
102
+ */
103
+ retry(): void;
104
+ };
105
+ type RedirectToMobileManager = ReturnType<typeof createRedirectToMobileManager>;
106
+ //#endregion
107
+ export { type RedirectToMobileConfig, type RedirectToMobileManager, type RedirectToMobileState, createRedirectToMobileManager, redirectToMobileMachine };
@@ -0,0 +1,102 @@
1
+ import "./BrowserTimerProvider-DhNc_x02.esm.js";
2
+ import "./api-CESGtpbH.esm.js";
3
+ import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-D6-e4vok.esm.js";
4
+ import "./endpoints-CnN3SyDa.esm.js";
5
+ import { c as createManager, s as createActor } from "./xstate.esm-B70JrNqo.esm.js";
6
+ import { t as redirectToMobileMachine } from "./redirectToMobileStateMachine-BOEqe46A.esm.js";
7
+
8
+ //#region src/modules/redirect-to-mobile/redirectToMobileActor.ts
9
+ function createRedirectToMobileActor(options) {
10
+ return createActor(redirectToMobileMachine, { input: { config: options.config } }).start();
11
+ }
12
+
13
+ //#endregion
14
+ //#region src/modules/redirect-to-mobile/redirectToMobileManager.ts
15
+ function mapState(snapshot) {
16
+ const typedSnapshot = snapshot;
17
+ const { context } = typedSnapshot;
18
+ if (typedSnapshot.matches("idle")) return { status: "idle" };
19
+ if (typedSnapshot.matches("generatingUrl") || typedSnapshot.matches("loadingStartInfo")) return { status: "loading" };
20
+ if (typedSnapshot.matches("showingQr")) return {
21
+ status: "redirecting",
22
+ redirectUrl: context.redirectUrl,
23
+ phonePrefix: context.phonePrefix,
24
+ smsSent: context.smsSent,
25
+ error: context.error
26
+ };
27
+ if (typedSnapshot.matches("finished")) return { status: "finished" };
28
+ if (typedSnapshot.matches("closed")) return { status: "closed" };
29
+ if (typedSnapshot.matches("error")) return {
30
+ status: "error",
31
+ error: context.error ?? "An error occurred"
32
+ };
33
+ return { status: "idle" };
34
+ }
35
+ function createApi({ actor, trackElementClicked }) {
36
+ return {
37
+ load() {
38
+ actor.send({ type: "LOAD" });
39
+ },
40
+ sendSms(phone) {
41
+ trackElementClicked?.("sendSms");
42
+ actor.send({
43
+ type: "SEND_SMS",
44
+ phone
45
+ });
46
+ },
47
+ continueOnDesktop() {
48
+ trackElementClicked?.("continueOnDesktop");
49
+ actor.send({ type: "CONTINUE_ON_DESKTOP" });
50
+ },
51
+ resetSms() {
52
+ actor.send({ type: "RESET_SMS" });
53
+ },
54
+ close() {
55
+ trackElementClicked?.("close");
56
+ actor.send({ type: "CLOSE" });
57
+ },
58
+ retry() {
59
+ trackElementClicked?.("retry");
60
+ actor.send({ type: "RETRY" });
61
+ }
62
+ };
63
+ }
64
+ /**
65
+ * Creates a redirect-to-mobile manager for cross-device onboarding flows.
66
+ *
67
+ * On desktop, displays a QR code (and optional SMS input) so the user can
68
+ * continue on their mobile device. Polls the backend until the mobile
69
+ * session completes, then transitions to `finished`.
70
+ *
71
+ * @param options - Configuration for the redirect module
72
+ * @returns A manager instance with state subscription and API methods
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const manager = createRedirectToMobileManager({
77
+ * config: { disableSmsOption: false, addContinueToDesktop: true },
78
+ * });
79
+ *
80
+ * manager.subscribe((state) => {
81
+ * if (state.status === 'redirecting') {
82
+ * renderQrCode(state.redirectUrl);
83
+ * }
84
+ * if (state.status === 'finished') {
85
+ * console.log('Mobile onboarding complete');
86
+ * }
87
+ * });
88
+ *
89
+ * manager.load();
90
+ * ```
91
+ */
92
+ function createRedirectToMobileManager(options) {
93
+ return createManager({
94
+ actor: createRedirectToMobileActor(options),
95
+ mapState,
96
+ createApi,
97
+ instrumentation: createManagerInstrumentation(eventModuleNames.qr)
98
+ });
99
+ }
100
+
101
+ //#endregion
102
+ export { createRedirectToMobileManager, redirectToMobileMachine };
@@ -0,0 +1,249 @@
1
+ import { t as BrowserTimerProvider } from "./BrowserTimerProvider-DhNc_x02.esm.js";
2
+ import { t as api } from "./api-CESGtpbH.esm.js";
3
+ import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
4
+ import { a as fromPromise, i as fromCallback, r as assign, t as setup } from "./xstate.esm-B70JrNqo.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,219 @@
1
+ import { b as createEventBus, x as getTimestamp } from "./events-D6-e4vok.esm.js";
2
+ import { i as fromCallback, s as createActor } from "./xstate.esm-B70JrNqo.esm.js";
3
+
4
+ //#region src/internal/flow-events/flowEvents.ts
5
+ function createFlowEventBus() {
6
+ const eventBus = createEventBus();
7
+ return {
8
+ clear: eventBus.clear,
9
+ emit(event) {
10
+ eventBus.emit({
11
+ ...event,
12
+ timestamp: getTimestamp()
13
+ });
14
+ },
15
+ subscribe: eventBus.subscribe
16
+ };
17
+ }
18
+
19
+ //#endregion
20
+ //#region src/internal/flow-events/attachFlowEventEmitter.ts
21
+ function getFlowId(state) {
22
+ return state.flow?.flowId;
23
+ }
24
+ function getReadyPayload(state) {
25
+ const payload = {
26
+ flow: state.flow,
27
+ steps: state.steps ?? [],
28
+ currentStepIndex: state.currentStepIndex ?? -1
29
+ };
30
+ if (state.currentStep === void 0) return payload;
31
+ return {
32
+ ...payload,
33
+ currentStep: state.currentStep
34
+ };
35
+ }
36
+ function getCompletedPayload(state) {
37
+ return state.finishStatus;
38
+ }
39
+ function getActiveModule(state, includeHomeModule) {
40
+ const includesHome = state.homeScreen?.visible === true;
41
+ const hasHomeModule = includeHomeModule || includesHome;
42
+ const totalModules = state.steps !== void 0 ? state.steps.length + (hasHomeModule ? 1 : 0) : void 0;
43
+ if (includesHome) return {
44
+ key: "0:HOME",
45
+ module: "HOME",
46
+ payload: {
47
+ moduleIndex: 0,
48
+ totalModules
49
+ }
50
+ };
51
+ if (state.currentStep === void 0 || state.currentStep === "") return;
52
+ const moduleIndex = state.currentStepIndex !== void 0 ? state.currentStepIndex + (hasHomeModule ? 1 : 0) : void 0;
53
+ return {
54
+ key: `${moduleIndex ?? -1}:${state.currentStep}`,
55
+ module: state.currentStep,
56
+ payload: {
57
+ moduleIndex,
58
+ totalModules
59
+ }
60
+ };
61
+ }
62
+ function attachFlowEventEmitter(manager, options = {}) {
63
+ const flowEventBus = createFlowEventBus();
64
+ let hasStartedCurrentRun = false;
65
+ let hasReadyCurrentRun = false;
66
+ let hasCompletedCurrentRun = false;
67
+ let hasErrorCurrentRun = false;
68
+ let hasClosedCurrentRun = false;
69
+ let hasHomeModuleCurrentRun = false;
70
+ let activeModule;
71
+ let completedModuleKeys = /* @__PURE__ */ new Set();
72
+ function resetRunFlags() {
73
+ hasStartedCurrentRun = false;
74
+ hasReadyCurrentRun = false;
75
+ hasCompletedCurrentRun = false;
76
+ hasErrorCurrentRun = false;
77
+ hasClosedCurrentRun = false;
78
+ hasHomeModuleCurrentRun = false;
79
+ activeModule = void 0;
80
+ completedModuleKeys = /* @__PURE__ */ new Set();
81
+ }
82
+ function emitModuleStarted(state) {
83
+ if (state.homeScreen?.visible === true) hasHomeModuleCurrentRun = true;
84
+ const nextModule = getActiveModule(state, hasHomeModuleCurrentRun);
85
+ if (nextModule === void 0) return;
86
+ if (nextModule.key === activeModule?.key) return;
87
+ activeModule = nextModule;
88
+ flowEventBus.emit({
89
+ type: "flow.module.started",
90
+ interviewId: options.interviewId,
91
+ flowId: getFlowId(state),
92
+ module: nextModule.module,
93
+ payload: nextModule.payload
94
+ });
95
+ }
96
+ function emitActiveModuleCompleted(state) {
97
+ if (activeModule === void 0 || completedModuleKeys.has(activeModule.key)) return;
98
+ completedModuleKeys.add(activeModule.key);
99
+ flowEventBus.emit({
100
+ type: "flow.module.completed",
101
+ interviewId: options.interviewId,
102
+ flowId: getFlowId(state),
103
+ module: activeModule.module,
104
+ payload: activeModule.payload
105
+ });
106
+ }
107
+ function handleState(state) {
108
+ if (state.status === "idle") {
109
+ resetRunFlags();
110
+ return;
111
+ }
112
+ if (state.status === "loading" && hasStartedCurrentRun === false) {
113
+ hasStartedCurrentRun = true;
114
+ flowEventBus.emit({
115
+ type: "flow.started",
116
+ interviewId: options.interviewId
117
+ });
118
+ return;
119
+ }
120
+ const flow = state.flow;
121
+ if (state.status === "ready" && flow !== void 0) {
122
+ const readyState = {
123
+ ...state,
124
+ flow
125
+ };
126
+ const nextModule = getActiveModule(readyState, hasHomeModuleCurrentRun);
127
+ if (activeModule !== void 0 && nextModule !== void 0 && activeModule.key !== nextModule.key) emitActiveModuleCompleted(readyState);
128
+ if (hasReadyCurrentRun === false) {
129
+ hasReadyCurrentRun = true;
130
+ flowEventBus.emit({
131
+ type: "flow.ready",
132
+ interviewId: options.interviewId,
133
+ flowId: getFlowId(readyState),
134
+ payload: getReadyPayload(readyState)
135
+ });
136
+ }
137
+ emitModuleStarted(readyState);
138
+ return;
139
+ }
140
+ if (state.status === "finished" && hasCompletedCurrentRun === false) {
141
+ emitActiveModuleCompleted(state);
142
+ const payload = getCompletedPayload(state);
143
+ hasCompletedCurrentRun = true;
144
+ flowEventBus.emit({
145
+ type: "flow.completed",
146
+ interviewId: options.interviewId,
147
+ flowId: getFlowId(state),
148
+ ...payload !== void 0 ? { payload } : {}
149
+ });
150
+ return;
151
+ }
152
+ if (state.status === "error" && hasErrorCurrentRun === false) {
153
+ hasErrorCurrentRun = true;
154
+ flowEventBus.emit({
155
+ type: "flow.error",
156
+ interviewId: options.interviewId,
157
+ flowId: getFlowId(state),
158
+ error: state.error ?? "Unknown error"
159
+ });
160
+ return;
161
+ }
162
+ if (state.status === "closed" && hasClosedCurrentRun === false) {
163
+ hasClosedCurrentRun = true;
164
+ flowEventBus.emit({
165
+ type: "flow.closed",
166
+ interviewId: options.interviewId,
167
+ flowId: getFlowId(state)
168
+ });
169
+ }
170
+ }
171
+ const unsubscribe = manager.subscribe(handleState);
172
+ const stop = manager.stop.bind(manager);
173
+ let isStopped = false;
174
+ Object.defineProperty(manager, "subscribeFlowEvent", {
175
+ configurable: true,
176
+ enumerable: true,
177
+ value: flowEventBus.subscribe,
178
+ writable: true
179
+ });
180
+ Object.defineProperty(manager, "stop", {
181
+ configurable: true,
182
+ enumerable: true,
183
+ value() {
184
+ if (isStopped) return;
185
+ isStopped = true;
186
+ unsubscribe();
187
+ stop();
188
+ },
189
+ writable: true
190
+ });
191
+ return manager;
192
+ }
193
+
194
+ //#endregion
195
+ //#region src/internal/orchestration/runChildModule.ts
196
+ const runChildModule = fromCallback(({ sendBack, input }) => {
197
+ const { machine, config } = input;
198
+ if (!machine) return () => {};
199
+ const actor = createActor(machine, { input: { config } });
200
+ const subscription = actor.subscribe({
201
+ complete: () => {
202
+ sendBack({ type: "MODULE_COMPLETE" });
203
+ },
204
+ error: (err) => {
205
+ sendBack({
206
+ type: "MODULE_ERROR",
207
+ error: err
208
+ });
209
+ }
210
+ });
211
+ actor.start();
212
+ return () => {
213
+ subscription.unsubscribe();
214
+ actor.stop();
215
+ };
216
+ });
217
+
218
+ //#endregion
219
+ export { attachFlowEventEmitter as n, runChildModule as t };
@@ -0,0 +1,26 @@
1
+ import "./warmup-CEcppFiS.js";
2
+ import "./Manager-C8PrhBOx.js";
3
+ import "./Actor-CI32dTbG.js";
4
+ import "./StateMachine-BCQrZJhf.js";
5
+ import { C as DetectionStatus, E as FaceErrorCode, T as FaceCapturedImageData, a as SelfieCaptureOnlyMachine, g as SelfieConfig, h as SelfieCaptureOnlyConfig, i as SelfieCaptureOnlyActor, l as SelfieMachine, n as FaceCaptureManagerState, o as selfieCaptureOnlyMachine, r as CreateSelfieCaptureOnlyActorOptions, t as FaceCaptureManager, u as selfieMachine, w as FaceCaptureOnlyResponse } from "./faceCaptureManagerFactory-yqtpxjnN.js";
6
+ import { t as CameraStream } from "./camera-DBSxa6ML.js";
7
+ import "./types-CFV9G_7j.js";
8
+ import "./types-BP1m8VRw.js";
9
+ import { t as DeepsightService } from "./deepsightService-CEVxzehb.js";
10
+ import { n as PermissionStatus, t as PermissionResult } from "./types-CAD4va6a.js";
11
+ import { a as ProcessFaceResponse, n as SelfieState, o as processFace, r as createSelfieManager, t as SelfieManager } from "./selfieManager-D0lSgd-J.js";
12
+
13
+ //#region src/modules/selfie/selfieCaptureOnlyManager.d.ts
14
+ type SelfieCaptureOnlyState = FaceCaptureManagerState;
15
+ type SelfieCaptureOnlyManager = FaceCaptureManager;
16
+ declare function createSelfieCaptureOnlyManagerFromActor(actor: SelfieCaptureOnlyActor, config: SelfieCaptureOnlyConfig): SelfieCaptureOnlyManager;
17
+ /**
18
+ * Creates a captureOnly selfie manager.
19
+ *
20
+ * Unlike {@link createSelfieManager}, the captured face image is delivered
21
+ * locally to the integrator's `onCapture` callback instead of being uploaded
22
+ * to the Incode backend. `onCapture` is required.
23
+ */
24
+ declare function createSelfieCaptureOnlyManager(options: CreateSelfieCaptureOnlyActorOptions): SelfieCaptureOnlyManager;
25
+ //#endregion
26
+ export { type CameraStream, type DeepsightService, type DetectionStatus, type FaceCaptureOnlyResponse, type FaceCapturedImageData, type FaceErrorCode, type PermissionResult, type PermissionStatus, type ProcessFaceResponse, type SelfieCaptureOnlyConfig, type SelfieCaptureOnlyMachine, type SelfieCaptureOnlyManager, type SelfieCaptureOnlyState, type SelfieConfig, type SelfieMachine, type SelfieManager, type SelfieState, createSelfieCaptureOnlyManager, createSelfieCaptureOnlyManagerFromActor, createSelfieManager, processFace, selfieCaptureOnlyMachine, selfieMachine };