@incodetech/core 2.0.0-rc.0 → 2.0.0

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/package.json +3 -3
  2. package/dist/Actor-CI32dTbG.d.ts +0 -2
  3. package/dist/BaseWasmProvider-C_DLEI40.esm.js +0 -1118
  4. package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +0 -55
  5. package/dist/BrowserTimerProvider-DhNc_x02.esm.js +0 -22
  6. package/dist/ITimerCapability-C67ZRskg.esm.js +0 -7
  7. package/dist/IpifyProvider-D7jx52AL.esm.js +0 -139
  8. package/dist/Manager-C8PrhBOx.d.ts +0 -19
  9. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +0 -254
  10. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +0 -87
  11. package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
  12. package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
  13. package/dist/addressSearch-BpTbTWCa.esm.js +0 -430
  14. package/dist/ae-signature-DDDZmWXj.esm.js +0 -12
  15. package/dist/ae-signature.d.ts +0 -25
  16. package/dist/ae-signature.esm.js +0 -8
  17. package/dist/antifraud.d.ts +0 -57
  18. package/dist/antifraud.esm.js +0 -45
  19. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +0 -39
  20. package/dist/api-CESGtpbH.esm.js +0 -53
  21. package/dist/authentication.d.ts +0 -12
  22. package/dist/authentication.esm.js +0 -25
  23. package/dist/authenticationManager-5M-fKzXx.esm.js +0 -67
  24. package/dist/authenticationManager-C83GNIhl.d.ts +0 -66
  25. package/dist/authenticationStateMachine-BMZqatiF.esm.js +0 -139
  26. package/dist/backCameraStream-DMdMeGk2.esm.js +0 -346
  27. package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
  28. package/dist/camera-DBSxa6ML.d.ts +0 -4
  29. package/dist/camera-PA2Ljri3.esm.js +0 -22
  30. package/dist/camera.d.ts +0 -15
  31. package/dist/camera.esm.js +0 -5
  32. package/dist/chunk-CRF6K_H_.esm.js +0 -49
  33. package/dist/consent.d.ts +0 -398
  34. package/dist/consent.esm.js +0 -79
  35. package/dist/consentStateMachine-CCT-B60O.esm.js +0 -151
  36. package/dist/cpf-PPz2Njto.esm.js +0 -38
  37. package/dist/cpf-ocr.d.ts +0 -204
  38. package/dist/cpf-ocr.esm.js +0 -177
  39. package/dist/cross-document-data-match.d.ts +0 -34
  40. package/dist/cross-document-data-match.esm.js +0 -71
  41. package/dist/curp-validation.d.ts +0 -188
  42. package/dist/curp-validation.esm.js +0 -110
  43. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +0 -595
  44. package/dist/custom-fields.d.ts +0 -115
  45. package/dist/custom-fields.esm.js +0 -177
  46. package/dist/custom-watchlist.d.ts +0 -66
  47. package/dist/custom-watchlist.esm.js +0 -86
  48. package/dist/dateUtils-UoN5xswP.esm.js +0 -23
  49. package/dist/deepsightLoader-Cm4JIT_z.esm.js +0 -52
  50. package/dist/deepsightService-CEVxzehb.d.ts +0 -412
  51. package/dist/deepsightService-O74l4Y__.esm.js +0 -489
  52. package/dist/device.d.ts +0 -46
  53. package/dist/device.esm.js +0 -106
  54. package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
  55. package/dist/document-capture.d.ts +0 -906
  56. package/dist/document-capture.esm.js +0 -156
  57. package/dist/document-upload.d.ts +0 -331
  58. package/dist/document-upload.esm.js +0 -203
  59. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +0 -394
  60. package/dist/dynamic-forms.d.ts +0 -178
  61. package/dist/dynamic-forms.esm.js +0 -323
  62. package/dist/ekyb.d.ts +0 -148
  63. package/dist/ekyb.esm.js +0 -127
  64. package/dist/ekybStateMachine-B59rQjgj.esm.js +0 -674
  65. package/dist/ekyc.d.ts +0 -164
  66. package/dist/ekyc.esm.js +0 -104
  67. package/dist/ekycStateMachine-oeO0Iekd.esm.js +0 -10626
  68. package/dist/electronic-signature.d.ts +0 -4
  69. package/dist/electronic-signature.esm.js +0 -7
  70. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +0 -428
  71. package/dist/email.d.ts +0 -4
  72. package/dist/email.esm.js +0 -9
  73. package/dist/emailManager-DIfnS5g1.d.ts +0 -352
  74. package/dist/emailManager-wAV0LE-H.esm.js +0 -238
  75. package/dist/emailStateMachine-DOf4j58N.esm.js +0 -292
  76. package/dist/endpoints-CnN3SyDa.esm.js +0 -87
  77. package/dist/events-D6-e4vok.esm.js +0 -596
  78. package/dist/events.d.ts +0 -265
  79. package/dist/events.esm.js +0 -4
  80. package/dist/extensibility.d.ts +0 -122
  81. package/dist/extensibility.esm.js +0 -43
  82. package/dist/face-match.d.ts +0 -228
  83. package/dist/face-match.esm.js +0 -173
  84. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +0 -290
  85. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +0 -690
  86. package/dist/faceCaptureSetup-B3faSpYA.esm.js +0 -873
  87. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +0 -127
  88. package/dist/flow-events.d.ts +0 -6
  89. package/dist/flow-events.esm.js +0 -0
  90. package/dist/flow.d.ts +0 -358
  91. package/dist/flow.esm.js +0 -825
  92. package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
  93. package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
  94. package/dist/flowServices-DTsm-Vf1.esm.js +0 -188
  95. package/dist/geolocation.d.ts +0 -127
  96. package/dist/geolocation.esm.js +0 -89
  97. package/dist/geolocationStateMachine-asasuHY2.esm.js +0 -105
  98. package/dist/getBrowser-BSXUTWXw.esm.js +0 -41
  99. package/dist/getDeviceClass-BSntT9_j.esm.js +0 -14
  100. package/dist/government-validation.d.ts +0 -67
  101. package/dist/government-validation.esm.js +0 -81
  102. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +0 -271
  103. package/dist/home.d.ts +0 -99
  104. package/dist/home.esm.js +0 -61
  105. package/dist/http.d.ts +0 -68
  106. package/dist/http.esm.js +0 -3
  107. package/dist/id-ocr.d.ts +0 -635
  108. package/dist/id-ocr.esm.js +0 -86
  109. package/dist/id-verification.d.ts +0 -190
  110. package/dist/id-verification.esm.js +0 -43
  111. package/dist/id.d.ts +0 -24
  112. package/dist/id.esm.js +0 -164
  113. package/dist/idCaptureManager-B9TGA5dq.d.ts +0 -956
  114. package/dist/idCaptureManager-DMK0GIt3.esm.js +0 -581
  115. package/dist/idCaptureStateMachine-Bq0fVZXl.esm.js +0 -2954
  116. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +0 -388
  117. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +0 -71
  118. package/dist/identity-reuse.d.ts +0 -530
  119. package/dist/identity-reuse.esm.js +0 -274
  120. package/dist/index-BLKtMA0g.d.ts +0 -1177
  121. package/dist/index-BcRG8rtJ.d.ts +0 -97
  122. package/dist/index.d.ts +0 -3
  123. package/dist/index.esm.js +0 -12
  124. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +0 -30
  125. package/dist/lib-BB0B_qQX.esm.js +0 -12499
  126. package/dist/mandatory-consent.d.ts +0 -412
  127. package/dist/mandatory-consent.esm.js +0 -78
  128. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +0 -126
  129. package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
  130. package/dist/openviduLazy-Cok70ZSg.esm.js +0 -12
  131. package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
  132. package/dist/phone.d.ts +0 -4
  133. package/dist/phone.esm.js +0 -9
  134. package/dist/phoneManager-B6M30hKE.d.ts +0 -397
  135. package/dist/phoneManager-DAJbGhlY.esm.js +0 -256
  136. package/dist/phoneStateMachine-CuPARRaT.esm.js +0 -351
  137. package/dist/platform-CfrjKhmi.esm.js +0 -83
  138. package/dist/qe-signature-DFo_Cc-I.esm.js +0 -12
  139. package/dist/qe-signature.d.ts +0 -25
  140. package/dist/qe-signature.esm.js +0 -8
  141. package/dist/recordingService-Ig2UgbLv.esm.js +0 -1003
  142. package/dist/redirect-to-mobile.d.ts +0 -107
  143. package/dist/redirect-to-mobile.esm.js +0 -102
  144. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +0 -249
  145. package/dist/runChildModule-CqqwqAkW.esm.js +0 -219
  146. package/dist/selfie.d.ts +0 -26
  147. package/dist/selfie.esm.js +0 -146
  148. package/dist/selfieManager-D0lSgd-J.d.ts +0 -68
  149. package/dist/selfieManager-Duisl7qN.esm.js +0 -60
  150. package/dist/selfieStateMachine-D76whWEf.esm.js +0 -68
  151. package/dist/session-BS-d_vuE.esm.js +0 -3206
  152. package/dist/session.d.ts +0 -217
  153. package/dist/session.esm.js +0 -9
  154. package/dist/setup-Buy-hyj4.esm.js +0 -887
  155. package/dist/setup-C5AITV8m.d.ts +0 -254
  156. package/dist/signature.d.ts +0 -94
  157. package/dist/signature.esm.js +0 -66
  158. package/dist/signatureStateMachine-B5-QVUve.esm.js +0 -132
  159. package/dist/stats-CIfiPzb1.esm.js +0 -16
  160. package/dist/stats.d.ts +0 -16
  161. package/dist/stats.esm.js +0 -4
  162. package/dist/trust-graph.d.ts +0 -54
  163. package/dist/trust-graph.esm.js +0 -56
  164. package/dist/types-B06Ypu2F.d.ts +0 -49
  165. package/dist/types-BP1m8VRw.d.ts +0 -340
  166. package/dist/types-CAD4va6a.d.ts +0 -5
  167. package/dist/types-CFV9G_7j.d.ts +0 -24
  168. package/dist/warmup-CEcppFiS.d.ts +0 -63
  169. package/dist/wasm.d.ts +0 -15
  170. package/dist/wasm.esm.js +0 -12
  171. package/dist/watchlist-for-business.d.ts +0 -79
  172. package/dist/watchlist-for-business.esm.js +0 -148
  173. package/dist/watchlist.d.ts +0 -62
  174. package/dist/watchlist.esm.js +0 -86
  175. package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
  176. package/dist/workflow.d.ts +0 -907
  177. package/dist/workflow.esm.js +0 -702
  178. package/dist/xstate.esm-B70JrNqo.esm.js +0 -3404
@@ -1,107 +0,0 @@
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 };
@@ -1,102 +0,0 @@
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 };
@@ -1,249 +0,0 @@
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 };
@@ -1,219 +0,0 @@
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 };
package/dist/selfie.d.ts DELETED
@@ -1,26 +0,0 @@
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 };