@incodetech/web 2.0.0-alpha.8 → 2.0.0-rc.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 (182) hide show
  1. package/dist/ae-signature/ae-signature.es.js +15 -0
  2. package/dist/ae-signature/styles.css +348 -0
  3. package/dist/ae-signature/styles2.css +107 -0
  4. package/dist/aligndevicelottie-DoV8xKjh.js +12757 -0
  5. package/dist/antifraud/antifraud.es.js +18 -0
  6. package/dist/antifraud/styles.css +2 -0
  7. package/dist/authentication/authentication.es.js +29 -0
  8. package/dist/autoFocusTitle-QexamZ4i.js +16 -0
  9. package/dist/back-horizontal-hint-B8Brxh3U.js +137 -0
  10. package/dist/back-tutorial-1NOQobGO.js +14585 -0
  11. package/dist/back-vertical-hint-BBo36dxn.js +128 -0
  12. package/dist/backdevicelottie-C_ceuqY7.js +16678 -0
  13. package/dist/base.css +5218 -639
  14. package/dist/blurdevicelottie-UO14Y0WC.js +15939 -0
  15. package/dist/bottomSheet-DE_8TFEC.js +31 -0
  16. package/dist/browser-ponyfill-jOkuz57z.js +299 -0
  17. package/dist/button-DcCUEn2n.js +24 -0
  18. package/dist/checkbox-Cl57ltq_.js +85 -0
  19. package/dist/consent/consent.es.js +90 -0
  20. package/dist/consent/styles.css +116 -0
  21. package/dist/countrySelector-CE-JgIsv.js +58 -0
  22. package/dist/cpf-ocr/styles.css +45 -0
  23. package/dist/cpfOcr-D_tbwbvh.js +78 -0
  24. package/dist/cross-document-data-match/cross-document-data-match.es.js +18 -0
  25. package/dist/curp-validation/curp-validation.es.js +279 -0
  26. package/dist/curp-validation/styles.css +82 -0
  27. package/dist/custom-fields/styles.css +22 -0
  28. package/dist/customFields-CW38fQUv.js +127 -0
  29. package/dist/customWatchlist-D9_yjEQd.js +33 -0
  30. package/dist/dateInputComposed-BpAGsjN6.js +55 -0
  31. package/dist/dateInputComposed-DU3o6PAV.js +1 -0
  32. package/dist/defineProperty-Dh8nSJpJ.js +39 -0
  33. package/dist/document-capture/styles.css +367 -0
  34. package/dist/documentCapture-xX-JT7ZY.js +763 -0
  35. package/dist/dropdownComposed-DFRBG22E.js +284 -0
  36. package/dist/dropdownComposed-DwTzc2YU.js +1 -0
  37. package/dist/dynamic-forms/styles.css +36 -0
  38. package/dist/dynamicForms-CJP1Ia6Q.js +262 -0
  39. package/dist/ekyb/ekyb.es.js +2 -0
  40. package/dist/ekyb/styles.css +137 -0
  41. package/dist/ekybModule-BSs7mndb.js +280 -0
  42. package/dist/ekybModule-D9M3E2Gm.js +2 -0
  43. package/dist/ekyc/ekyc.es.js +2 -0
  44. package/dist/ekyc/styles.css +106 -0
  45. package/dist/ekycModule-CU9pt5YN.js +246 -0
  46. package/dist/ekycModule-CZw9cLno.js +2 -0
  47. package/dist/electronic-signature/electronic-signature.es.js +2 -0
  48. package/dist/electronic-signature-COYXjGdd.js +410 -0
  49. package/dist/email/email.es.js +87 -145
  50. package/dist/email/styles.css +5 -116
  51. package/dist/emailInput-DppGf9pv.js +37 -0
  52. package/dist/expiredId-BnmzE8T3.js +70 -0
  53. package/dist/extensibility-CzEJfRwo.js +2586 -0
  54. package/dist/extensibility.es.js +25 -0
  55. package/dist/face-match/face-match.es.js +2 -0
  56. package/dist/face-match/styles.css +910 -0
  57. package/dist/faceMatch-B8j0g0Yo.js +2 -0
  58. package/dist/faceMatch-BV8UD7tj.js +201 -0
  59. package/dist/flip-animation-CgwRsEmK.js +6983 -0
  60. package/dist/flow/flow.es.js +646 -542
  61. package/dist/flow/styles.css +4524 -440
  62. package/dist/front-horizontal-hint-DGGGi8e1.js +380 -0
  63. package/dist/front-vertical-hint-CNr5mE6Q.js +420 -0
  64. package/dist/frontdevicelottie-Bu6f9fDE.js +17302 -0
  65. package/dist/geolocation/geolocation.es.js +857 -0
  66. package/dist/geolocation/styles.css +158 -0
  67. package/dist/glaredevicelottie-B10axYs_.js +14466 -0
  68. package/dist/governmentValidation/governmentValidation.es.js +98 -0
  69. package/dist/governmentValidation/styles.css +58 -0
  70. package/dist/homeScreen-DnP1jw9A.js +227 -0
  71. package/dist/hooks-BVnGysT7.js +80 -0
  72. package/dist/i18n-9s4OSqwi.js +2010 -0
  73. package/dist/icons-Cc7zwchP.js +310 -0
  74. package/dist/id/id.es.js +832 -0
  75. package/dist/id/styles.css +1287 -0
  76. package/dist/id-laser-h-mBAzHVOK.js +467 -0
  77. package/dist/id-laser-v-CrFg4bcJ.js +483 -0
  78. package/dist/id-ocr/styles.css +46 -0
  79. package/dist/id-tutorial-BCr42Pnn.js +13153 -0
  80. package/dist/id-verification/id-verification.es.js +20 -0
  81. package/dist/idOcr-CCjfWQvH.js +94 -0
  82. package/dist/identity-reuse/identity-reuse.es.js +198 -0
  83. package/dist/identity-reuse/styles.css +163 -0
  84. package/dist/incode-logo-DX016usY.js +4 -0
  85. package/dist/incodeComponent-C1o4M0ZK.js +50 -0
  86. package/dist/incodeModule-BqCjVgEI.js +18 -0
  87. package/dist/index.es.js +16 -6
  88. package/dist/inputComposed-APSw8C7o.js +89 -0
  89. package/dist/inputComposed-XYrarFxS.js +1 -0
  90. package/dist/loadingIcon-BN5YRQUb.js +104 -0
  91. package/dist/mandatoryConsent-DssKMC3v.js +100 -0
  92. package/dist/modal-NMxsQHAO.js +135 -0
  93. package/dist/modal.hooks-CAjcIFZK.js +126 -0
  94. package/dist/numberedStep-CT-alrK5.js +11 -0
  95. package/dist/optionAccessibleLabel-CzEeX3Q4.js +140 -0
  96. package/dist/otpInput-DqRA_egd.js +145 -0
  97. package/dist/page-C1yT4DLb.js +69 -0
  98. package/dist/passport-horizontal-hint-Bgquwtac.js +293 -0
  99. package/dist/passport-tutorial-DwRwtPVX.js +11689 -0
  100. package/dist/passport-vertical-hint-BT1D5BrW.js +267 -0
  101. package/dist/pdf-BurGZ08w.js +14967 -0
  102. package/dist/pdfViewer-BGBNL1Ea.js +63 -0
  103. package/dist/phone/phone.es.js +98 -3441
  104. package/dist/phone/styles.css +3 -297
  105. package/dist/phoneInputComposed-bvWhGLFZ.js +11206 -0
  106. package/dist/processing-G_y3o32b.js +6 -0
  107. package/dist/qe-signature/qe-signature.es.js +15 -0
  108. package/dist/radioGroupComposed-BbmvxmD2.js +177 -0
  109. package/dist/redirect-to-mobile/styles.css +588 -0
  110. package/dist/redirectToMobile-C3k1gloW.js +1514 -0
  111. package/dist/requiredLabelHint-BLwgqozE.js +13 -0
  112. package/dist/richText-DbJ5sl2n.js +1973 -0
  113. package/dist/rolldown-runtime-CYMK-g2i.js +20 -0
  114. package/dist/selfie/selfie.es.js +42 -892
  115. package/dist/selfie/styles.css +298 -184
  116. package/dist/selfieTutorial-BgrlUMXP.js +2677 -0
  117. package/dist/signature/signature.es.js +546 -0
  118. package/dist/snackbar-BDp8x7Cv.js +14 -0
  119. package/dist/spinner-B4dcie2T.js +1 -0
  120. package/dist/spinner-CKnjVHxw.js +39 -0
  121. package/dist/statusPage-CUI7ApcU.js +28 -0
  122. package/dist/successIcon-DbILeIz_.js +28 -0
  123. package/dist/tabs-DaPyP71c.js +78 -0
  124. package/dist/themes/dark.css +846 -151
  125. package/dist/themes/light.css +798 -116
  126. package/dist/transitionSpinner-PIEPU2Vx.js +17 -0
  127. package/dist/tutorial-9vHAHvMK.js +2587 -0
  128. package/dist/types/ae-signature.d.ts +40 -0
  129. package/dist/types/antifraud.d.ts +40 -0
  130. package/dist/types/authentication.d.ts +45 -0
  131. package/dist/types/consent.d.ts +41 -0
  132. package/dist/types/cpf-ocr/styles.d.ts +1 -0
  133. package/dist/types/cross-document-data-match.d.ts +34 -0
  134. package/dist/types/curp-validation.d.ts +40 -0
  135. package/dist/types/custom-fields/styles.d.ts +1 -0
  136. package/dist/types/document-capture/styles.d.ts +1 -0
  137. package/dist/types/dynamic-forms/styles.d.ts +1 -0
  138. package/dist/types/ekyb.d.ts +34 -0
  139. package/dist/types/ekyc.d.ts +34 -0
  140. package/dist/types/electronic-signature.d.ts +43 -0
  141. package/dist/types/email.d.ts +14 -4
  142. package/dist/types/extensibility.d.ts +981 -0
  143. package/dist/types/face-match.d.ts +59 -0
  144. package/dist/types/flow.d.ts +81 -13
  145. package/dist/types/geolocation.d.ts +41 -0
  146. package/dist/types/governmentValidation.d.ts +34 -0
  147. package/dist/types/id-ocr/styles.d.ts +1 -0
  148. package/dist/types/id-verification.d.ts +40 -0
  149. package/dist/types/id.d.ts +41 -0
  150. package/dist/types/identity-reuse.d.ts +43 -0
  151. package/dist/types/index.d.ts +6 -12
  152. package/dist/types/mandatory-consent/styles.d.ts +1 -0
  153. package/dist/types/phone.d.ts +14 -4
  154. package/dist/types/qe-signature.d.ts +40 -0
  155. package/dist/types/redirect-to-mobile/styles.d.ts +1 -0
  156. package/dist/types/selfie.d.ts +14 -4
  157. package/dist/types/signature.d.ts +40 -0
  158. package/dist/types/watchlist-for-business/styles.d.ts +1 -0
  159. package/dist/types/watchlist.d.ts +40 -0
  160. package/dist/types/workflow.d.ts +91 -0
  161. package/dist/typography-CxjaknHN.js +28 -0
  162. package/dist/uiConfig-CwpQ-IM6.js +20 -0
  163. package/dist/useModuleLoader-BFiVA41N.js +432 -0
  164. package/dist/vendor-preact-D6SntenC.js +958 -0
  165. package/dist/verificationResult-BrVbUJ4U.js +97 -0
  166. package/dist/verifiedByIncode-ChZBpqNy.js +101 -0
  167. package/dist/watchlist/watchlist.es.js +33 -0
  168. package/dist/watchlist-for-business/styles.css +18 -0
  169. package/dist/watchlistForBusiness-BcSNtHCV.js +77 -0
  170. package/dist/workflow/styles.css +4612 -0
  171. package/dist/workflow/workflow.es.js +244 -0
  172. package/package.json +211 -15
  173. package/dist/browser-ponyfill-B6W6hHVY.js +0 -344
  174. package/dist/incodeModule-Dv8Qllrv.js +0 -254
  175. package/dist/instance-B-q0ZREN.js +0 -2140
  176. package/dist/otpInput-BtoZe0Wz.js +0 -151
  177. package/dist/page-D9ijzlSn.js +0 -234
  178. package/dist/selfieTutorial-C-u5GufD.js +0 -29
  179. package/dist/setup-wNL83jmW.js +0 -20
  180. package/dist/title-BfO5Dlzk.js +0 -25
  181. package/dist/uiConfig-CQ1W9cUD.js +0 -23
  182. package/dist/vendor-preact-CK0WeTOR.js +0 -584
@@ -1,557 +1,661 @@
1
- import { c as D, u as a, L as W, S as E, B as j, r as H, a as B } from "../incodeModule-Dv8Qllrv.js";
2
- import { createOrchestratedFlowManager as O, getRequiredWasmPipelines as R } from "@incodetech/core/flow";
3
- import { k as F, A as I, d as x, y as M } from "../vendor-preact-CK0WeTOR.js";
4
- import "../instance-B-q0ZREN.js";
5
- import { T as K, u as $ } from "../title-BfO5Dlzk.js";
6
- import { api as z, warmupWasm as q } from "@incodetech/core";
7
- import { emailMachine as _ } from "@incodetech/core/email";
8
- import { phoneMachine as V } from "@incodetech/core/phone";
9
- import { selfieMachine as Y } from "@incodetech/core/selfie";
10
- import { s as Z } from "../setup-wNL83jmW.js";
11
- import { s as y } from "../uiConfig-CQ1W9cUD.js";
12
- const G = {
13
- small: 24,
14
- medium: 48,
15
- large: 64
16
- }, b = ({
17
- title: e,
18
- subtitle: t,
19
- size: n = "medium",
20
- fullScreen: s = !0,
21
- className: i
22
- }) => {
23
- const r = G[n], o = D(
24
- "IncodeSpinner",
25
- s && "IncodeSpinnerFullScreen",
26
- i
27
- );
28
- return /* @__PURE__ */ a(
29
- "div",
30
- {
31
- class: o,
32
- "data-testid": "spinner",
33
- "data-title": e,
34
- "data-subtitle": t,
35
- "data-size": n,
36
- children: /* @__PURE__ */ a("div", { class: "IncodeSpinnerContent", children: [
37
- /* @__PURE__ */ a(W, { size: r }),
38
- (e || t) && /* @__PURE__ */ a(F, { children: [
39
- /* @__PURE__ */ a(E, { size: 16 }),
40
- /* @__PURE__ */ a("div", { class: "IncodeSpinnerText", children: [
41
- e && /* @__PURE__ */ a(K, { className: "IncodeSpinnerTitle", children: e }),
42
- t && /* @__PURE__ */ a(F, { children: [
43
- e && /* @__PURE__ */ a(E, { size: 12 }),
44
- /* @__PURE__ */ a("p", { class: "IncodeSpinnerSubtitle", children: t })
45
- ] })
46
- ] })
47
- ] })
48
- ] })
49
- }
50
- );
51
- };
52
- function J(e) {
53
- let t = e.replace("#", "");
54
- t.length === 3 && (t = t.split("").map((d) => d + d).join(""));
55
- const n = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
56
- if (!n) return null;
57
- const s = Number.parseInt(n[1], 16) / 255, i = Number.parseInt(n[2], 16) / 255, r = Number.parseInt(n[3], 16) / 255, o = Math.max(s, i, r), c = Math.min(s, i, r);
58
- let l = 0, p = 0;
59
- const u = (o + c) / 2;
60
- if (o !== c) {
61
- const d = o - c;
62
- switch (p = u > 0.5 ? d / (2 - o - c) : d / (o + c), o) {
63
- case s:
64
- l = ((i - r) / d + (i < r ? 6 : 0)) / 6;
65
- break;
66
- case i:
67
- l = ((r - s) / d + 2) / 6;
68
- break;
69
- case r:
70
- l = ((s - i) / d + 4) / 6;
71
- break;
72
- }
73
- }
74
- return { h: l * 360, s: p * 100, l: u * 100 };
1
+ import { n as e } from "../i18n-9s4OSqwi.js";
2
+ import { _ as t, c as n, d as r, l as i, o as a, p as o, v as s } from "../vendor-preact-D6SntenC.js";
3
+ import { t as c } from "../uiConfig-CwpQ-IM6.js";
4
+ import { o as l } from "../hooks-BVnGysT7.js";
5
+ import { t as u } from "../incodeComponent-C1o4M0ZK.js";
6
+ import { t as d } from "../transitionSpinner-PIEPU2Vx.js";
7
+ import { t as f } from "../incodeModule-BqCjVgEI.js";
8
+ import { a as p, c as m, d as h, f as g, h as _, l as v, n as y, o as b, p as x, r as S, s as C, t as w, u as T } from "../useModuleLoader-BFiVA41N.js";
9
+ import { getDeviceClass as E } from "@incodetech/core/device";
10
+ import { getRequiredWasmPipelines as D } from "@incodetech/core/flow";
11
+ import { QrValidationError as O, bootstrapSession as k, refreshQrUrlUuid as A } from "@incodetech/core/session";
12
+ //#region src/shared/processing/useDelayedFlag.ts
13
+ function j(e, n) {
14
+ let [r, i] = o(!1);
15
+ return t(() => {
16
+ if (e === !1) {
17
+ i(!1);
18
+ return;
19
+ }
20
+ let t = window.setTimeout(() => {
21
+ i(!0);
22
+ }, n);
23
+ return () => {
24
+ window.clearTimeout(t);
25
+ };
26
+ }, [e, n]), r;
75
27
  }
76
- function w(e, t, n) {
77
- const s = e / 360, i = t / 100, r = n / 100;
78
- let o, c, l;
79
- if (i === 0)
80
- o = c = l = r;
81
- else {
82
- const u = (h, C, m) => (m < 0 && (m += 1), m > 1 && (m -= 1), m < 0.16666666666666666 ? h + (C - h) * 6 * m : m < 0.5 ? C : m < 0.6666666666666666 ? h + (C - h) * (0.6666666666666666 - m) * 6 : h), d = r < 0.5 ? r * (1 + i) : r + i - r * i, f = 2 * r - d;
83
- o = u(f, d, s + 1 / 3), c = u(f, d, s), l = u(f, d, s - 1 / 3);
84
- }
85
- const p = (u) => {
86
- const d = Math.round(u * 255).toString(16);
87
- return d.length === 1 ? `0${d}` : d;
88
- };
89
- return `#${p(o)}${p(c)}${p(l)}`;
28
+ //#endregion
29
+ //#region src/modules/flow/createFlowSession.ts
30
+ function M(e) {
31
+ return Array.from(new Uint8Array(e), (e) => e.toString(16).padStart(2, "0")).join("");
90
32
  }
91
- function Q(e) {
92
- const t = J(e);
93
- if (!t)
94
- throw new Error(`Invalid color format: ${e}`);
95
- return {
96
- 50: w(t.h, t.s, 95),
97
- 200: w(t.h, t.s, 80),
98
- 300: w(t.h, t.s, 65),
99
- 400: w(t.h, t.s, Math.min(100, t.l + 10)),
100
- 500: e,
101
- 600: w(t.h, t.s, Math.max(0, t.l - 10)),
102
- 900: w(t.h, t.s, 20)
103
- };
104
- }
105
- function X(e, t) {
106
- if (typeof document > "u")
107
- return;
108
- const n = Q(e);
109
- let s = document.getElementById(
110
- "incode-theme"
111
- );
112
- s || (s = document.createElement("style"), s.id = "incode-theme", document.head.appendChild(s));
113
- const i = t || "#ffffff", r = `
114
- :root,
115
- :host {
116
- --primitive-color-brand-50: ${n[50]};
117
- --primitive-color-brand-200: ${n[200]};
118
- --primitive-color-brand-300: ${n[300]};
119
- --primitive-color-brand-400: ${n[400]};
120
- --primitive-color-brand-500: ${n[500]};
121
- --primitive-color-brand-600: ${n[600]};
122
- --primitive-color-brand-900: ${n[900]};
123
- --button-primary-text-default: ${i};
124
- }
125
- `;
126
- s.textContent = r;
127
- }
128
- async function ee() {
129
- return (await z.get("/omni/asset/fetch-all")).data;
33
+ async function N(e) {
34
+ let t = globalThis.crypto?.subtle;
35
+ if (!t) throw Error("SHA-1 is not available in this environment");
36
+ return M(await t.digest("SHA-1", new TextEncoder().encode(e)));
130
37
  }
131
- const L = /* @__PURE__ */ new Map();
132
- async function te(e) {
133
- if (e.startsWith("data:"))
134
- return e;
135
- const t = L.get(e);
136
- if (t)
137
- return t;
138
- const s = await (await fetch(e)).blob(), i = await new Promise((r, o) => {
139
- const c = new FileReader();
140
- c.onloadend = () => r(c.result), c.onerror = o, c.readAsDataURL(s);
141
- });
142
- return L.set(e, i), i;
38
+ async function P(e) {
39
+ if (typeof e.apiKey == "string") return e.apiKey;
40
+ if (typeof e.clientId == "string") return N(e.clientId);
41
+ throw Error("Flow self-loading mode requires apiKey or clientId");
143
42
  }
144
- async function re() {
145
- const e = await ee();
146
- if (!e.theme)
147
- throw new Error("Theme URL not found in assets response");
148
- const t = e.theme, n = t.startsWith("http://") || t.startsWith("https://");
149
- let s;
150
- if (n) {
151
- const o = await fetch(t);
152
- if (!o.ok)
153
- throw new Error(`Failed to fetch theme: ${o.statusText}`);
154
- s = await o.json();
155
- } else
156
- s = (await z.get(t)).data;
157
- const i = e["logo.png"] || e["logo.svg"] || e["logo.jpg"] || e["logo.jpeg"] || e["logo.webp"] || s.logo;
158
- let r = i;
159
- return i && (r = await te(i)), {
160
- ...s,
161
- logo: r
162
- };
43
+ async function F(e, t) {
44
+ return k(await P(e), {
45
+ configurationId: e.configurationId,
46
+ externalId: e.externalId,
47
+ externalCustomerId: e.externalCustomerId,
48
+ language: e.lang,
49
+ customFields: e.customFields,
50
+ uuid: e.uuid,
51
+ urlUuid: e.urlUuid,
52
+ interviewId: e.interviewId,
53
+ onUrlUuidRefreshed: e.onUrlUuidRefreshed
54
+ }, t);
163
55
  }
164
- async function ne() {
165
- const e = await re();
166
- return e.main && X(e.main, e.buttonColor), e;
56
+ //#endregion
57
+ //#region src/modules/flow/flowConfig.ts
58
+ function I(e) {
59
+ return typeof e.token == "string";
167
60
  }
168
- const S = {
169
- PHONE: () => import("../phone/phone.es.js").then((e) => e.Phone),
170
- EMAIL: () => import("../email/email.es.js").then((e) => e.Email),
171
- SELFIE: () => import("../selfie/selfie.es.js").then((e) => e.Selfie)
172
- };
173
- function T() {
174
- return O({
175
- modules: {
176
- PHONE: V,
177
- EMAIL: _,
178
- SELFIE: Y
179
- }
180
- });
61
+ function L(e) {
62
+ let t = e;
63
+ return typeof t.configurationId == "string" && (typeof t.apiKey == "string" || typeof t.clientId == "string");
181
64
  }
182
- async function N(e) {
183
- await Z({
184
- apiURL: e.apiURL,
185
- token: e.token,
186
- i18n: { lang: e.lang ?? "en" }
187
- });
65
+ //#endregion
66
+ //#region src/modules/flow/preloadFlow.ts
67
+ var R = /* @__PURE__ */ new Map();
68
+ function z(e) {
69
+ let t = R.get(e);
70
+ if (!t) throw Error("Preload state not found");
71
+ return {
72
+ get isReady() {
73
+ return t.status === "ready";
74
+ },
75
+ get error() {
76
+ return t.status === "error" ? t.error ?? null : null;
77
+ },
78
+ async waitUntilReady() {
79
+ if (t.status !== "ready") {
80
+ if (t.status === "error") throw Error(t.error ?? "Preload failed");
81
+ return t.readyPromise;
82
+ }
83
+ },
84
+ cancel() {
85
+ t.status === "loading" && (t.unsubscribe && t.unsubscribe(), t.flowManager.stop(), t.readyReject(/* @__PURE__ */ Error("Preload cancelled")), R.delete(e));
86
+ }
87
+ };
188
88
  }
189
- async function k() {
190
- try {
191
- const e = await ne(), t = {
192
- logoSrc: e.logo,
193
- hideFooterBranding: e.hideFooterBranding
194
- };
195
- return y(t), { theme: e, uiConfig: t };
196
- } catch (e) {
197
- return console.warn("Failed to fetch dashboard theme:", e), {};
198
- }
89
+ function B(e) {
90
+ let { token: t } = e;
91
+ if (e.urlUuid) throw Error("preloadIncodeFlow does not support urlUuid; pass it to <IncodeFlow> directly so the SDK can rotate it on mount.");
92
+ if (R.has(t)) return z(t);
93
+ let n, r, i = new Promise((e, t) => {
94
+ n = e, r = t;
95
+ }), a = m(e);
96
+ a.getState().presentation.shouldPrefetchHome && g();
97
+ let o = {
98
+ status: "loading",
99
+ flowManager: a,
100
+ config: e,
101
+ readyPromise: i,
102
+ readyResolve: n,
103
+ readyReject: r
104
+ };
105
+ return R.set(t, o), (async () => {
106
+ try {
107
+ await T({
108
+ token: e.token,
109
+ lang: e.lang,
110
+ flowManager: a
111
+ });
112
+ let t = e.disableDashboardTheme ? Promise.resolve({}) : v().then((e) => {
113
+ o.theme = e.theme, o.uiConfig = e.uiConfig;
114
+ });
115
+ o.unsubscribe = a.subscribe((t) => {
116
+ if (t.status === "ready") {
117
+ let n = t;
118
+ _(n, e.wasmConfig), h(n), o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "ready", o.readyResolve();
119
+ } else t.status === "error" && (o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "error", o.error = t.error, o.readyReject(Error(t.error)));
120
+ }), await t;
121
+ } catch (e) {
122
+ o.status = "error", o.error = e instanceof Error ? e.message : "Failed to preload", o.readyReject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to preload")), R.delete(t);
123
+ }
124
+ })(), z(t);
199
125
  }
200
- function A(e, t) {
201
- const n = R(e.flow);
202
- n.length > 0 && q({
203
- ...t,
204
- pipelines: n
205
- }).catch((s) => {
206
- console.error("WASM warmup failed:", s);
207
- });
126
+ function V(e) {
127
+ return R.get(e) ?? null;
208
128
  }
209
- function oe(e) {
210
- const t = e.currentStep;
211
- if (t) {
212
- const n = S[t];
213
- n && n().catch(() => {
214
- });
215
- }
129
+ function H(e) {
130
+ let t = V(e);
131
+ return t && R.delete(e), t;
216
132
  }
217
- const se = ({
218
- moduleKey: e,
219
- onNext: t
220
- }) => {
221
- const { t: n } = $();
222
- return /* @__PURE__ */ a("section", { class: "IncodeUnsupportedModule", "aria-live": "polite", children: /* @__PURE__ */ a("div", { class: "IncodeUnsupportedModuleContent", children: [
223
- /* @__PURE__ */ a("h2", { class: "IncodeUnsupportedModuleTitle", children: n("unsupportedModule.title", "Module not available") }),
224
- /* @__PURE__ */ a("p", { class: "IncodeUnsupportedModuleMessage", children: n(
225
- "unsupportedModule.message",
226
- `The "${e}" module is not yet supported in this version.`
227
- ) }),
228
- /* @__PURE__ */ a(
229
- j,
230
- {
231
- onClick: t,
232
- class: "IncodeUnsupportedModuleButton",
233
- "data-testid": "unsupported-module-next-button",
234
- children: n("unsupportedModule.next", "Next")
235
- }
236
- )
237
- ] }) });
238
- }, g = /* @__PURE__ */ new Map();
133
+ //#endregion
134
+ //#region src/modules/flow/useFlowInitialization.ts
239
135
  function U(e) {
240
- const t = g.get(e);
241
- if (!t)
242
- throw new Error("Preload state not found");
243
- return {
244
- get isReady() {
245
- return t.status === "ready";
246
- },
247
- get error() {
248
- return t.status === "error" ? t.error ?? null : null;
249
- },
250
- async waitUntilReady() {
251
- if (t.status !== "ready") {
252
- if (t.status === "error")
253
- throw new Error(t.error ?? "Preload failed");
254
- return t.readyPromise;
255
- }
256
- },
257
- cancel() {
258
- t.status === "loading" && (t.unsubscribe && t.unsubscribe(), t.flowManager.stop(), t.readyReject(new Error("Preload cancelled")), g.delete(e));
259
- }
260
- };
261
- }
262
- function Ie(e) {
263
- const { token: t } = e;
264
- if (g.has(t))
265
- return U(t);
266
- let n, s;
267
- const i = new Promise((l, p) => {
268
- n = l, s = p;
269
- }), r = T(), o = {
270
- status: "loading",
271
- flowManager: r,
272
- config: e,
273
- readyPromise: i,
274
- readyResolve: n,
275
- readyReject: s
276
- };
277
- return g.set(t, o), (async () => {
278
- try {
279
- await N({
280
- apiURL: e.apiURL,
281
- token: e.token,
282
- lang: e.lang
283
- });
284
- const l = e.disableDashboardTheme ? Promise.resolve({}) : k().then((u) => {
285
- o.theme = u.theme, o.uiConfig = u.uiConfig;
286
- }), p = r.subscribe((u) => {
287
- if (u.status === "ready") {
288
- const d = u;
289
- e.wasmConfig && A(d, e.wasmConfig), oe(d), o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "ready", o.readyResolve();
290
- } else u.status === "error" && (o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "error", o.error = u.error, o.readyReject(new Error(u.error)));
291
- });
292
- o.unsubscribe = p, r.load(), await l;
293
- } catch (l) {
294
- o.status = "error", o.error = l instanceof Error ? l.message : "Failed to preload", o.readyReject(
295
- l instanceof Error ? l : new Error("Failed to preload")
296
- ), g.delete(t);
297
- }
298
- })(), U(t);
299
- }
300
- function v(e) {
301
- return g.get(e) ?? null;
302
- }
303
- function P(e) {
304
- const t = v(e);
305
- return t && g.delete(e), t;
306
- }
307
- function ae(e) {
308
- const { apiURL: t, token: n, lang: s, disableDashboardTheme: i, onError: r } = e, o = I(null), [c, l] = x(() => {
309
- const u = v(n);
310
- if (u?.status === "ready") {
311
- const f = P(n);
312
- if (f)
313
- return o.current = f.flowManager, f.uiConfig && y(f.uiConfig), { status: "ready", flowManager: f.flowManager };
314
- }
315
- const d = T();
316
- return o.current = d, u?.status === "error" ? {
317
- status: "error",
318
- error: u.error ?? "Preload failed",
319
- flowManager: d
320
- } : { status: "initializing", flowManager: d };
321
- }), p = I(!1);
322
- return M(() => {
323
- if (c.status !== "initializing")
324
- return;
325
- const u = v(n);
326
- if (u?.status === "loading") {
327
- u.readyPromise.then(() => {
328
- const f = P(n);
329
- f && (o.current = f.flowManager, f.uiConfig && y(f.uiConfig), l({ status: "ready", flowManager: f.flowManager }));
330
- }).catch((f) => {
331
- const h = f instanceof Error ? f.message : "Preload failed";
332
- l({
333
- status: "error",
334
- error: h,
335
- flowManager: c.flowManager
336
- }), r?.(h);
337
- });
338
- return;
339
- }
340
- if (p.current)
341
- return;
342
- p.current = !0, (async () => {
343
- try {
344
- await N({ apiURL: t, token: n, lang: s });
345
- const f = i ? Promise.resolve() : k().then((h) => {
346
- h.uiConfig && y(h.uiConfig);
347
- });
348
- c.flowManager.load(), await f, l({ status: "ready", flowManager: c.flowManager });
349
- } catch (f) {
350
- const h = f instanceof Error ? f.message : "Failed to initialize SDK";
351
- l({
352
- status: "error",
353
- error: h,
354
- flowManager: c.flowManager
355
- }), r?.(h);
356
- }
357
- })();
358
- }, [t, n, s, i, r, c]), c;
136
+ e.getState().presentation.shouldPrefetchHome && g();
359
137
  }
360
- function ie(e) {
361
- const { moduleKey: t, onModuleLoading: n, onModuleLoaded: s, onError: i } = e, [r, o] = x({ status: "idle" });
362
- return M(() => {
363
- if (!t) {
364
- o({ status: "idle" });
365
- return;
366
- }
367
- const c = S[t];
368
- if (!c) {
369
- o({ status: "unsupported", moduleKey: t });
370
- return;
371
- }
372
- o({ status: "loading", moduleKey: t }), n?.(t);
373
- let l = !1;
374
- return c().then((p) => {
375
- l || (o({ status: "loaded", moduleKey: t, Component: p }), s?.(t));
376
- }).catch((p) => {
377
- if (!l) {
378
- const u = p instanceof Error ? p.message : "Failed to load module";
379
- o({ status: "error", moduleKey: t, error: u }), i?.(`Failed to load ${t}: ${u}`);
380
- }
381
- }), () => {
382
- l = !0;
383
- };
384
- }, [t, n, s, i]), r;
138
+ function W() {
139
+ E() === "desktop" && x();
385
140
  }
386
- function le(e, t) {
387
- const n = I(/* @__PURE__ */ new Set());
388
- M(() => {
389
- if (t < e.length - 1) {
390
- const s = e[t + 1];
391
- if (s && !n.current.has(s)) {
392
- n.current.add(s);
393
- const i = S[s];
394
- i && i().catch(() => {
395
- n.current.delete(s);
396
- });
397
- }
398
- }
399
- }, [e, t]);
141
+ function G(e) {
142
+ let { lang: n, disableDashboardTheme: r, enableHome: a, onError: s, useCPF: l } = e, u = I(e) ? e.token : void 0, d = i(null), [f, p] = o(() => {
143
+ let t = u ? V(u) : null;
144
+ if (u && t?.status === "ready") {
145
+ let e = H(u);
146
+ if (e) return d.current = e.flowManager, U(e.flowManager), W(), e.uiConfig && c(e.uiConfig), {
147
+ status: "ready",
148
+ flowManager: e.flowManager
149
+ };
150
+ }
151
+ let n = m({
152
+ authHint: e.authHint,
153
+ lang: e.lang,
154
+ enableHome: e.enableHome,
155
+ useCPF: e.useCPF
156
+ });
157
+ return d.current = n, U(n), W(), t?.status === "error" ? {
158
+ status: "error",
159
+ error: t.error ?? "Preload failed",
160
+ flowManager: n
161
+ } : {
162
+ status: "initializing",
163
+ flowManager: n
164
+ };
165
+ }), h = i(!1);
166
+ return t(() => {
167
+ if (f.status !== "initializing") return;
168
+ let t = u ? V(u) : null;
169
+ if (u && t?.status === "loading") {
170
+ t.readyPromise.then(() => {
171
+ let e = H(u);
172
+ e && (d.current = e.flowManager, U(e.flowManager), W(), e.uiConfig && c(e.uiConfig), p({
173
+ status: "ready",
174
+ flowManager: e.flowManager
175
+ }));
176
+ }).catch((e) => {
177
+ let t = e instanceof Error ? e.message : "Preload failed", n = e instanceof O ? e.status : void 0;
178
+ p({
179
+ status: "error",
180
+ error: t,
181
+ errorCode: n,
182
+ flowManager: f.flowManager
183
+ }), s?.(t, n);
184
+ });
185
+ return;
186
+ }
187
+ if (h.current) return;
188
+ h.current = !0;
189
+ let i = new AbortController(), { signal: a } = i;
190
+ return (async () => {
191
+ try {
192
+ let t;
193
+ if (I(e)) t = e.token, e.urlUuid && await A({
194
+ urlUuid: e.urlUuid,
195
+ onboardingId: null,
196
+ onRefreshed: e.onUrlUuidRefreshed
197
+ }, a);
198
+ else if (L(e)) t = (await F(e, a)).token;
199
+ else throw Error("Flow requires token, or configurationId with apiKey or clientId");
200
+ await T({
201
+ token: t,
202
+ lang: n,
203
+ flowManager: f.flowManager
204
+ });
205
+ let i = r ? Promise.resolve() : v().then((e) => {
206
+ e.uiConfig && c(e.uiConfig);
207
+ }), o = f.flowManager.waitForReady();
208
+ await Promise.all([o, i]), p({
209
+ status: "ready",
210
+ flowManager: f.flowManager
211
+ });
212
+ } catch (e) {
213
+ if (a.aborted) return;
214
+ let t = e instanceof Error ? e.message : "Failed to initialize SDK", n = e instanceof O ? e.status : void 0;
215
+ p({
216
+ status: "error",
217
+ error: t,
218
+ errorCode: n,
219
+ flowManager: f.flowManager
220
+ }), s?.(t, n);
221
+ }
222
+ })(), () => i.abort();
223
+ }, [
224
+ u,
225
+ n,
226
+ r,
227
+ a,
228
+ l,
229
+ s,
230
+ e,
231
+ f
232
+ ]), f;
400
233
  }
401
- const de = ({
402
- config: e,
403
- onFinish: t,
404
- onError: n
405
- }) => {
406
- const { t: s } = $();
407
- console.log("[debug] IncodeFlowContent", { config: e, onFinish: t, onError: n });
408
- const i = ae({
409
- apiURL: e.apiURL,
410
- token: e.token,
411
- lang: e.lang,
412
- disableDashboardTheme: e.disableDashboardTheme,
413
- onError: n
414
- }), [r, o] = B(() => i.flowManager, {
415
- autoLoad: !1
416
- }), c = ie({
417
- moduleKey: r?.status === "ready" ? r.currentStep : void 0,
418
- onModuleLoading: e.onModuleLoading,
419
- onModuleLoaded: e.onModuleLoaded,
420
- onError: n
421
- });
422
- if (le(
423
- r?.status === "ready" ? r.steps : [],
424
- r?.status === "ready" ? r.currentStepIndex : -1
425
- ), M(() => {
426
- if (r?.status === "ready" && e.wasmConfig) {
427
- const l = r, p = R(l.flow);
428
- p.length > 0 && (e.onWasmWarmup?.(p), A(l, e.wasmConfig));
429
- }
430
- }, [r, e]), M(() => {
431
- r?.status === "finished" && t(r.finishStatus);
432
- }, [r?.status, t, r]), M(() => {
433
- r?.status === "error" && n && n(r.error);
434
- }, [r?.status, n, r]), i.status === "error")
435
- return /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a("div", { children: [
436
- "Error: ",
437
- i.error
438
- ] }) });
439
- if (i.status === "initializing")
440
- return /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a(
441
- b,
442
- {
443
- title: e.spinnerConfig?.title ?? s("home.settingUp"),
444
- subtitle: e.spinnerConfig?.subtitle,
445
- size: e.spinnerConfig?.size,
446
- fullScreen: !0
447
- }
448
- ) });
449
- if (!r || r.status === "idle" || r.status === "loading")
450
- return /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a(
451
- b,
452
- {
453
- title: e.spinnerConfig?.title ?? s("home.settingUp"),
454
- subtitle: e.spinnerConfig?.subtitle,
455
- size: e.spinnerConfig?.size,
456
- fullScreen: !0
457
- }
458
- ) });
459
- if (r.status === "error")
460
- return /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a("div", { children: [
461
- "Error: ",
462
- r.error
463
- ] }) });
464
- if (r.status === "finished")
465
- return null;
466
- if (r.status === "ready") {
467
- const { currentStep: l, config: p } = r;
468
- if (!l || !p)
469
- return /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a(
470
- b,
471
- {
472
- title: e.spinnerConfig?.title ?? s("loadingCircle.hangOn"),
473
- subtitle: e.spinnerConfig?.subtitle ?? s("loadingCircle.validating"),
474
- size: e.spinnerConfig?.size,
475
- fullScreen: !0
476
- }
477
- ) });
478
- if (c.status === "unsupported")
479
- return /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a(
480
- se,
481
- {
482
- moduleKey: l,
483
- onNext: () => o.completeModule()
484
- }
485
- ) });
486
- if (c.status === "idle" || c.status === "loading" || c.status === "error")
487
- return /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a(
488
- b,
489
- {
490
- title: e.spinnerConfig?.title ?? s("loadingCircle.hangOn"),
491
- subtitle: e.spinnerConfig?.subtitle ?? s("loadingCircle.validating"),
492
- size: e.spinnerConfig?.size,
493
- fullScreen: !0
494
- }
495
- ) });
496
- const { Component: u } = c;
497
- if (l === "SELFIE")
498
- return /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a(
499
- u,
500
- {
501
- config: p,
502
- onFinish: () => o.completeModule(),
503
- onError: (f) => {
504
- n?.(f ?? "Selfie verification error");
505
- }
506
- },
507
- `selfie-${r.currentStepIndex}`
508
- ) });
509
- if (l === "PHONE")
510
- return /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a(
511
- u,
512
- {
513
- config: p,
514
- onFinish: () => o.completeModule(),
515
- onError: (f) => {
516
- n?.(f ?? "Phone verification error");
517
- }
518
- },
519
- `phone-${r.currentStepIndex}`
520
- ) });
521
- if (l === "EMAIL") {
522
- const d = p;
523
- return !d || typeof d.otpVerification != "boolean" || typeof d.otpExpirationInMinutes != "number" ? /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a("div", { children: "Error: Invalid email configuration" }) }) : /* @__PURE__ */ a("div", { class: "IncodeFlow", children: /* @__PURE__ */ a(
524
- u,
525
- {
526
- config: {
527
- ...d,
528
- prefill: d.prefill ?? !1
529
- },
530
- onFinish: () => o.completeModule(),
531
- onError: (f) => {
532
- n?.(f ?? "Email verification error");
533
- }
534
- },
535
- `email-${r.currentStepIndex}`
536
- ) });
537
- }
538
- }
539
- return null;
540
- }, ce = ({
541
- config: e,
542
- onFinish: t = () => {
543
- },
544
- onError: n
545
- }) => /* @__PURE__ */ a("div", { class: "IncodeComponent", children: e ? /* @__PURE__ */ a(
546
- de,
547
- {
548
- config: e,
549
- onFinish: t,
550
- onError: n
551
- }
552
- ) : null });
553
- H(ce, "incode-flow");
554
- export {
555
- ce as IncodeFlow,
556
- Ie as preloadIncodeFlow
557
- };
234
+ //#endregion
235
+ //#region src/modules/flow/flow.tsx
236
+ var K = n(() => import("../homeScreen-DnP1jw9A.js").then((e) => ({ default: e.HomeScreen }))), q = ({ config: n, onFinish: i, onError: o }) => {
237
+ let { i18n: c } = e(), u = G(r(() => ({
238
+ ...n,
239
+ onError: o
240
+ }), [n, o])), [f, m] = l(() => u.flowManager, { autoLoad: !1 }), h = f.presentation.lazyModuleKey, v = f.status === "ready" ? f.currentStep : void 0, x = w({
241
+ moduleKey: h,
242
+ modules: C,
243
+ onModuleLoading: n.onModuleLoading,
244
+ onModuleLoaded: n.onModuleLoaded,
245
+ onError: o
246
+ });
247
+ y({
248
+ moduleKey: f.status === "ready" && f.homeScreen.visible ? v : void 0,
249
+ modules: C
250
+ });
251
+ let T = x.status === "loaded", E = n.enableHome === !0 && f.status === "ready" && f.flow.disableLaunchScreen !== !0 && f.currentStepIndex === 0 && f.homeScreen.visible === !1 && x.status === "loading", O = j(f.presentation.isAwaitingReady === !0, 150), k = j(f.status === "ready" && (x.status === "idle" || x.status === "loading" || x.status === "error"), 150);
252
+ S(f?.status === "ready" ? f.steps : [], f?.status === "ready" ? f.currentStepIndex : -1, C, T), t(() => {
253
+ if (n.onFlowEvent) return m.subscribeFlowEvent(n.onFlowEvent);
254
+ }, [m, n.onFlowEvent]), t(() => {
255
+ f.presentation.shouldPrefetchHome && g();
256
+ }, [f.presentation.shouldPrefetchHome]), t(() => {
257
+ n.lang && c.language !== n.lang && c.changeLanguage(n.lang);
258
+ }, [n.lang, c]), t(() => {
259
+ if (f?.status !== "ready" || f.currentStep === "REDIRECT_TO_MOBILE") return;
260
+ let e = f, t = D(e.flow);
261
+ t.length > 0 && (n.onWasmWarmup?.(t), _(e, n.wasmConfig));
262
+ }, [f, n]), t(() => {
263
+ f?.status === "finished" && i(f.finishStatus);
264
+ }, [
265
+ f?.status,
266
+ i,
267
+ f
268
+ ]), t(() => {
269
+ f?.status === "error" && o && o(f.error, f.errorCode);
270
+ }, [
271
+ f?.status,
272
+ o,
273
+ f
274
+ ]), t(() => {
275
+ f?.status === "ready" && f.currentStep === "ID" && f.steps.includes("TUTORIAL_ID") && m.completeModule();
276
+ }, [f, m]);
277
+ let A = !(n.spinnerConfig?.title || n.spinnerConfig?.subtitle);
278
+ if (u.status === "error") return /* @__PURE__ */ s("div", {
279
+ class: "IncodeFlow",
280
+ children: /* @__PURE__ */ s("div", { children: ["Error: ", u.error] })
281
+ });
282
+ if (f.homeScreen.visible || E) return /* @__PURE__ */ s("div", {
283
+ class: "IncodeFlow",
284
+ children: /* @__PURE__ */ s(a, {
285
+ fallback: null,
286
+ children: /* @__PURE__ */ s(K, {
287
+ isContinueLoading: f.homeScreen.isContinueLoading || E,
288
+ onContinue: () => m.continueFromHome()
289
+ })
290
+ })
291
+ });
292
+ if (u.status === "initializing") return /* @__PURE__ */ s("div", {
293
+ class: "IncodeFlow",
294
+ children: /* @__PURE__ */ s(d, {
295
+ spinnerConfig: n.spinnerConfig,
296
+ hideText: A
297
+ })
298
+ });
299
+ if (f.presentation.isAwaitingReady) return O ? /* @__PURE__ */ s("div", {
300
+ class: "IncodeFlow",
301
+ children: /* @__PURE__ */ s(d, {
302
+ spinnerConfig: n.spinnerConfig,
303
+ hideText: A
304
+ })
305
+ }) : /* @__PURE__ */ s("div", { class: "IncodeFlow" });
306
+ if (f.status === "error") return /* @__PURE__ */ s("div", {
307
+ class: "IncodeFlow",
308
+ children: /* @__PURE__ */ s("div", { children: ["Error: ", f.error] })
309
+ });
310
+ if (f.status === "finished") return null;
311
+ if (f?.status === "ready") {
312
+ let { currentStep: e, config: t, flow: r } = f, { flowId: i } = r;
313
+ if (!e || !t) return /* @__PURE__ */ s("div", {
314
+ class: "IncodeFlow",
315
+ children: /* @__PURE__ */ s(d, {
316
+ spinnerConfig: n.spinnerConfig,
317
+ hideText: A
318
+ })
319
+ });
320
+ if (b.has(e)) return /* @__PURE__ */ s("div", { class: "IncodeFlow" });
321
+ if (x.status === "unsupported") return /* @__PURE__ */ s("div", {
322
+ class: "IncodeFlow",
323
+ children: /* @__PURE__ */ s(p, {
324
+ moduleKey: e,
325
+ onNext: () => m.completeModule()
326
+ })
327
+ });
328
+ if (x.status === "idle" || x.status === "loading" || x.status === "error") return k ? /* @__PURE__ */ s("div", {
329
+ class: "IncodeFlow",
330
+ children: /* @__PURE__ */ s(d, {
331
+ spinnerConfig: n.spinnerConfig,
332
+ hideText: A
333
+ })
334
+ }) : /* @__PURE__ */ s("div", { class: "IncodeFlow" });
335
+ let { Component: a } = x;
336
+ if (e === "REDIRECT_TO_MOBILE") return /* @__PURE__ */ s("div", {
337
+ class: "IncodeFlow",
338
+ children: /* @__PURE__ */ s(a, {
339
+ config: t,
340
+ onFinish: () => m.completeFlow(),
341
+ onContinue: () => m.completeModule(),
342
+ onError: o
343
+ }, `redirect-to-mobile-${f.currentStepIndex}`)
344
+ });
345
+ if (e === "SELFIE") return /* @__PURE__ */ s("div", {
346
+ class: "IncodeFlow",
347
+ children: /* @__PURE__ */ s(a, {
348
+ config: t,
349
+ onFinish: () => m.completeModule(),
350
+ onError: (e) => {
351
+ o?.(e ?? "Selfie verification error");
352
+ }
353
+ }, `selfie-${f.currentStepIndex}`)
354
+ });
355
+ if (e === "AUTHENTICATION") return /* @__PURE__ */ s("div", {
356
+ class: "IncodeFlow",
357
+ children: /* @__PURE__ */ s(a, {
358
+ config: {
359
+ ...t,
360
+ authHint: n.authHint
361
+ },
362
+ onFinish: () => m.completeModule(),
363
+ onError: (e) => {
364
+ o?.(e ?? "Authentication error");
365
+ }
366
+ }, `authentication-${f.currentStepIndex}`)
367
+ });
368
+ if (e === "PHONE") return /* @__PURE__ */ s("div", {
369
+ class: "IncodeFlow",
370
+ children: /* @__PURE__ */ s(a, {
371
+ config: t,
372
+ onFinish: () => m.completeModule(),
373
+ onError: (e) => {
374
+ o?.(e ?? "Phone verification error");
375
+ }
376
+ }, `phone-${f.currentStepIndex}`)
377
+ });
378
+ if (e === "EMAIL") {
379
+ let e = t;
380
+ return !e || typeof e.otpVerification != "boolean" || typeof e.otpExpirationInMinutes != "number" ? /* @__PURE__ */ s("div", {
381
+ class: "IncodeFlow",
382
+ children: /* @__PURE__ */ s("div", { children: "Error: Invalid email configuration" })
383
+ }) : /* @__PURE__ */ s("div", {
384
+ class: "IncodeFlow",
385
+ children: /* @__PURE__ */ s(a, {
386
+ config: e,
387
+ onFinish: () => m.completeModule(),
388
+ onError: (e) => {
389
+ o?.(e ?? "Email verification error");
390
+ }
391
+ }, `email-${f.currentStepIndex}`)
392
+ });
393
+ }
394
+ if (e === "ID" || e === "SECOND_ID") {
395
+ let n = t;
396
+ return /* @__PURE__ */ s("div", {
397
+ class: "IncodeFlow",
398
+ children: /* @__PURE__ */ s(a, {
399
+ config: e === "SECOND_ID" ? {
400
+ ...n,
401
+ isSecondId: !0
402
+ } : n,
403
+ onFinish: () => m.completeModule(),
404
+ onError: (e) => {
405
+ o?.(e ?? "ID capture error");
406
+ }
407
+ }, `id-${f.currentStepIndex}`)
408
+ });
409
+ }
410
+ if (e === "ID_OCR") {
411
+ let e = t, n = f.steps.includes("SECOND_ID");
412
+ return /* @__PURE__ */ s("div", {
413
+ class: "IncodeFlow",
414
+ children: /* @__PURE__ */ s(a, {
415
+ config: {
416
+ ...e,
417
+ secondId: e.secondId ?? n,
418
+ flowId: i
419
+ },
420
+ onFinish: () => m.completeModule(),
421
+ onError: (e) => {
422
+ o?.(e ?? "ID OCR error");
423
+ }
424
+ }, `id-ocr-${f.currentStepIndex}`)
425
+ });
426
+ }
427
+ if (e === "CPF_OCR") return /* @__PURE__ */ s("div", {
428
+ class: "IncodeFlow",
429
+ children: /* @__PURE__ */ s(a, {
430
+ onFinish: () => m.completeModule(),
431
+ onError: (e) => {
432
+ o?.(e ?? "CPF OCR error");
433
+ }
434
+ }, `cpf-ocr-${f.currentStepIndex}`)
435
+ });
436
+ if (e === "FACE_MATCH") return /* @__PURE__ */ s("div", {
437
+ class: "IncodeFlow",
438
+ children: /* @__PURE__ */ s(a, {
439
+ config: t,
440
+ onFinish: () => m.completeModule(),
441
+ onError: (e) => {
442
+ o?.(e ?? "Face match error");
443
+ }
444
+ }, `face-match-${f.currentStepIndex}`)
445
+ });
446
+ if (e === "CURP_VALIDATION") return /* @__PURE__ */ s("div", {
447
+ class: "IncodeFlow",
448
+ children: /* @__PURE__ */ s(a, {
449
+ config: t,
450
+ onFinish: () => m.completeModule(),
451
+ onError: (e) => {
452
+ o?.(e ?? "CURP validation error");
453
+ }
454
+ }, `curp-validation-${f.currentStepIndex}`)
455
+ });
456
+ if (e === "GOVT_VALIDATION_PROVISIONING") return /* @__PURE__ */ s("div", {
457
+ class: "IncodeFlow",
458
+ children: /* @__PURE__ */ s(a, {
459
+ config: t,
460
+ onFinish: () => m.completeModule(),
461
+ onError: (e) => {
462
+ o?.(e ?? "Government validation error");
463
+ }
464
+ }, `govt-validation-${f.currentStepIndex}`)
465
+ });
466
+ if (e === "GEOLOCATION") return /* @__PURE__ */ s("div", {
467
+ class: "IncodeFlow",
468
+ children: /* @__PURE__ */ s(a, {
469
+ config: t,
470
+ onFinish: () => m.completeModule(),
471
+ onError: (e) => {
472
+ o?.(e ?? "Geolocation error");
473
+ }
474
+ }, `geolocation-${f.currentStepIndex}`)
475
+ });
476
+ if (e === "EXTERNAL_VERIFICATION") return /* @__PURE__ */ s("div", {
477
+ class: "IncodeFlow",
478
+ children: /* @__PURE__ */ s(a, {
479
+ config: { flowId: f.flow.flowId },
480
+ onFinish: () => m.completeModule(),
481
+ onError: (e) => {
482
+ o?.(e ?? "External verification error");
483
+ }
484
+ }, `ekyc-${f.currentStepIndex}`)
485
+ });
486
+ if (e === "DOCUMENT_CAPTURE") return /* @__PURE__ */ s("div", {
487
+ class: "IncodeFlow",
488
+ children: /* @__PURE__ */ s(a, {
489
+ config: t,
490
+ onFinish: () => m.completeModule(),
491
+ onError: (e) => {
492
+ o?.(e ?? "Document capture error");
493
+ }
494
+ }, `document-capture-${f.currentStepIndex}`)
495
+ });
496
+ if (e === "ADDRESS") return /* @__PURE__ */ s("div", {
497
+ class: "IncodeFlow",
498
+ children: /* @__PURE__ */ s(a, {
499
+ config: {
500
+ ...t,
501
+ processingType: "addressStatement"
502
+ },
503
+ onFinish: () => m.completeModule(),
504
+ onError: (e) => {
505
+ o?.(e ?? "Address capture error");
506
+ }
507
+ }, `address-${f.currentStepIndex}`)
508
+ });
509
+ if (e === "SIGNATURE") return /* @__PURE__ */ s("div", {
510
+ class: "IncodeFlow",
511
+ children: /* @__PURE__ */ s(a, {
512
+ config: t,
513
+ onFinish: () => m.completeModule(),
514
+ onError: (e) => {
515
+ o?.(e ?? "Signature capture error");
516
+ }
517
+ }, `signature-${f.currentStepIndex}`)
518
+ });
519
+ if (e === "EKYB") {
520
+ let e = t;
521
+ return /* @__PURE__ */ s("div", {
522
+ class: "IncodeFlow",
523
+ children: /* @__PURE__ */ s(a, {
524
+ config: {
525
+ flowId: i,
526
+ checkBusinessName: e.checkBusinessName,
527
+ checkAddress: e.checkAddress,
528
+ checkTaxId: e.checkTaxId,
529
+ checkUniqueBeneficialOwner: e.checkUniqueBeneficialOwner
530
+ },
531
+ onFinish: () => m.completeModule(),
532
+ onError: (e) => {
533
+ o?.(e ?? "eKYB verification error");
534
+ }
535
+ }, `ekyb-${f.currentStepIndex}`)
536
+ });
537
+ }
538
+ if (e === "COMBINED_CONSENT") return /* @__PURE__ */ s("div", {
539
+ class: "IncodeFlow",
540
+ children: /* @__PURE__ */ s(a, {
541
+ config: t,
542
+ onFinish: () => m.completeModule(),
543
+ onError: (e) => {
544
+ o?.(e ?? "Combined consent error");
545
+ }
546
+ }, `combined-consent-${f.currentStepIndex}`)
547
+ });
548
+ if (e === "MANDATORY_CONSENT") return /* @__PURE__ */ s("div", {
549
+ class: "IncodeFlow",
550
+ children: /* @__PURE__ */ s(a, {
551
+ config: t,
552
+ onFinish: () => m.completeModule(),
553
+ onError: (e) => {
554
+ o?.(e ?? "Mandatory consent error");
555
+ }
556
+ }, `mandatory-consent-${f.currentStepIndex}`)
557
+ });
558
+ if (e === "AE_SIGNATURE" || e === "QE_SIGNATURE") {
559
+ let n = t, r = e === "QE_SIGNATURE" ? "qe" : "ae";
560
+ return /* @__PURE__ */ s("div", {
561
+ class: "IncodeFlow",
562
+ children: /* @__PURE__ */ s(a, {
563
+ config: {
564
+ uploadDocument: n.uploadDocument,
565
+ downloadDocument: n.downloadDocument
566
+ },
567
+ onFinish: () => m.completeModule(),
568
+ onError: (e) => {
569
+ o?.(e ?? `${r.toUpperCase()} Signature error`);
570
+ }
571
+ }, `${r}-signature-${f.currentStepIndex}`)
572
+ });
573
+ }
574
+ if (e === "ANTIFRAUD") return /* @__PURE__ */ s("div", {
575
+ class: "IncodeFlow",
576
+ children: /* @__PURE__ */ s(a, {
577
+ onFinish: () => m.completeModule(),
578
+ onError: (e) => {
579
+ o?.(e ?? "Antifraud check error");
580
+ }
581
+ }, `antifraud-${f.currentStepIndex}`)
582
+ });
583
+ if (e === "CUSTOM_FIELDS") return /* @__PURE__ */ s("div", {
584
+ class: "IncodeFlow",
585
+ children: /* @__PURE__ */ s(a, {
586
+ config: t,
587
+ onFinish: () => m.completeModule(),
588
+ onError: (e) => {
589
+ o?.(e ?? "Custom fields error");
590
+ }
591
+ }, `custom-fields-${f.currentStepIndex}`)
592
+ });
593
+ if (e === "WATCHLIST") return /* @__PURE__ */ s("div", {
594
+ class: "IncodeFlow",
595
+ children: /* @__PURE__ */ s(a, {
596
+ onFinish: () => m.completeModule(),
597
+ onError: (e) => {
598
+ o?.(e ?? "Watchlist check error");
599
+ }
600
+ }, `watchlist-${f.currentStepIndex}`)
601
+ });
602
+ if (e === "WATCHLIST_BUSINESS") return /* @__PURE__ */ s("div", {
603
+ class: "IncodeFlow",
604
+ children: /* @__PURE__ */ s(a, {
605
+ onFinish: () => m.completeModule(),
606
+ onError: (e) => {
607
+ o?.(e ?? "Watchlist for business check error");
608
+ }
609
+ }, `watchlist-for-business-${f.currentStepIndex}`)
610
+ });
611
+ if (e === "INCODE_WATCHLIST") return /* @__PURE__ */ s("div", {
612
+ class: "IncodeFlow",
613
+ children: /* @__PURE__ */ s(a, {
614
+ config: t,
615
+ onFinish: () => m.completeModule(),
616
+ onError: (e) => {
617
+ o?.(e ?? "Custom watchlist check error");
618
+ }
619
+ }, `incode-watchlist-${f.currentStepIndex}`)
620
+ });
621
+ if (e === "CROSS_DOCUMENT_DATA_MATCH") return /* @__PURE__ */ s("div", {
622
+ class: "IncodeFlow",
623
+ children: /* @__PURE__ */ s(a, {
624
+ onFinish: () => m.completeModule(),
625
+ onError: (e) => {
626
+ o?.(e ?? "Cross document data match error");
627
+ }
628
+ }, `cross-document-data-match-${f.currentStepIndex}`)
629
+ });
630
+ if (e === "DYNAMIC_FORMS") return /* @__PURE__ */ s("div", {
631
+ class: "IncodeFlow",
632
+ children: /* @__PURE__ */ s(a, {
633
+ config: { screens: t.screens.map((e) => ({
634
+ title: e.title,
635
+ hideTitle: e.hideTitle,
636
+ questions: e.questions.map((e) => ({
637
+ questionId: e.questionId,
638
+ question: e.question,
639
+ inputType: e.inputType,
640
+ isOptional: e.isOptional,
641
+ overrides: e.overrides ?? void 0,
642
+ isPredefined: e.isPredefined,
643
+ options: e.options
644
+ }))
645
+ })) },
646
+ onFinish: () => m.completeModule(),
647
+ onError: (e) => {
648
+ o?.(e ?? "Dynamic forms error");
649
+ }
650
+ }, `dynamic-forms-${f.currentStepIndex}`)
651
+ });
652
+ }
653
+ return null;
654
+ }, J = ({ config: e, onFinish: t = () => {}, onError: n }) => /* @__PURE__ */ s(u, { children: e ? /* @__PURE__ */ s(q, {
655
+ config: e,
656
+ onFinish: t,
657
+ onError: n
658
+ }) : null });
659
+ f(J, "incode-flow");
660
+ //#endregion
661
+ export { J as IncodeFlow, B as preloadIncodeFlow };