@incodetech/web 2.0.1 → 2.1.0-rc.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 (253) hide show
  1. package/dist/ae-signature/ae-signature.es.js +15 -13
  2. package/dist/ae-signature/styles.css +3 -17
  3. package/dist/ae-signature/styles2.css +15 -5
  4. package/dist/aligndevicelottie-DY_bX_p8.js +12769 -0
  5. package/dist/antifraud/antifraud.es.js +23 -16
  6. package/dist/authentication/authentication.es.js +42 -27
  7. package/dist/autoFocusTitle-BzkUiELM.js +29 -0
  8. package/dist/{back-horizontal-hint-B8Brxh3U.js → back-horizontal-hint-D_8LptLm.js} +26 -26
  9. package/dist/back-tutorial-vb1MxlrT.js +14597 -0
  10. package/dist/{back-vertical-hint-BBo36dxn.js → back-vertical-hint-C1evxxq2.js} +27 -27
  11. package/dist/backdevicelottie-HypPqBz7.js +16690 -0
  12. package/dist/base.css +1258 -104
  13. package/dist/blurdevicelottie-CBXtBFiJ.js +15951 -0
  14. package/dist/bottomSheet-F1GJfQx_.js +39 -0
  15. package/dist/browser-ponyfill-CLLvZCVg.js +441 -0
  16. package/dist/button-CM_hgyIP.js +35 -0
  17. package/dist/checkbox-BoeLHKgp.js +96 -0
  18. package/dist/consent/consent.es.js +89 -73
  19. package/dist/consent/styles.css +35 -22
  20. package/dist/countrySelector-mSWyHSy4.js +60 -0
  21. package/dist/cpf-ocr/cpf-ocr.es.js +2 -0
  22. package/dist/cpfOcr-MtpRztkG.js +92 -0
  23. package/dist/cpfOcr-jJkYCfsX.js +2 -0
  24. package/dist/cross-document-data-match/cross-document-data-match.es.js +20 -16
  25. package/dist/curp-validation/curp-validation.es.js +247 -203
  26. package/dist/customFields-DXXt9HGM.js +140 -0
  27. package/dist/customWatchlist-DsW04UF6.js +36 -0
  28. package/dist/dateInputComposed-C_mh4XBg.js +69 -0
  29. package/dist/dateInputComposed-Cy6a7ymh.js +1 -0
  30. package/dist/defineProperty-mefzVtTv.js +39 -0
  31. package/dist/document-capture/document-capture.es.js +2 -0
  32. package/dist/document-capture/styles.css +2 -5
  33. package/dist/documentCapture-8ypBJehw.js +2 -0
  34. package/dist/documentCapture-BDV_921m.js +880 -0
  35. package/dist/dropdownComposed-CEWBSdGl.js +1 -0
  36. package/dist/dropdownComposed-_fgAlo_C.js +380 -0
  37. package/dist/dynamic-forms/styles.css +25 -13
  38. package/dist/dynamicForms-DyfnsS7E.js +352 -0
  39. package/dist/ekyb/ekyb.es.js +2 -2
  40. package/dist/ekyb/styles.css +2 -0
  41. package/dist/ekybModule-CIPGmCvD.js +279 -0
  42. package/dist/ekybModule-DFoYpheB.js +2 -0
  43. package/dist/ekyc/ekyc.es.js +2 -2
  44. package/dist/ekyc/styles.css +9 -7
  45. package/dist/ekycModule-BGzwgjl1.js +2 -0
  46. package/dist/ekycModule-BuTaC5ct.js +257 -0
  47. package/dist/electronic-signature/electronic-signature.es.js +2 -2
  48. package/dist/electronic-signature-B-Q7M0wK.js +430 -0
  49. package/dist/email/email.es.js +199 -66
  50. package/dist/emailInput-KZmhjOdZ.js +39 -0
  51. package/dist/errorIcon-DJRZpd8j.js +26 -0
  52. package/dist/expiredId-Q1t6aVpk.js +85 -0
  53. package/dist/extensibility-Cs3KQQdC.js +3070 -0
  54. package/dist/extensibility.es.js +26 -25
  55. package/dist/face-match/face-match.es.js +2 -2
  56. package/dist/face-match/styles.css +0 -4
  57. package/dist/faceMatch--RDHJe4t.js +343 -0
  58. package/dist/faceMatch-yEKPYaym.js +2 -0
  59. package/dist/field-comparison/field-comparison.es.js +2 -0
  60. package/dist/field-comparison/styles.css +16 -0
  61. package/dist/fieldComparison-CAF86bTC.js +88 -0
  62. package/dist/fieldComparison-D0an7T_g.js +2 -0
  63. package/dist/fiscal-qr/fiscal-qr.es.js +224 -0
  64. package/dist/fiscal-qr/styles.css +71 -0
  65. package/dist/{flip-animation-CgwRsEmK.js → flip-animation-BGRvygw9.js} +4221 -4221
  66. package/dist/flow/flow.es.js +619 -484
  67. package/dist/flow/styles.css +378 -418
  68. package/dist/{front-horizontal-hint-DGGGi8e1.js → front-horizontal-hint-Uf5bHCsd.js} +70 -70
  69. package/dist/{front-vertical-hint-CNr5mE6Q.js → front-vertical-hint-DdWNA45v.js} +81 -81
  70. package/dist/frontdevicelottie-CLqitJhG.js +17314 -0
  71. package/dist/geolocation/geolocation.es.js +486 -395
  72. package/dist/glaredevicelottie-BS04U6Fc.js +14478 -0
  73. package/dist/governmentValidation/governmentValidation.es.js +166 -93
  74. package/dist/governmentValidation/styles.css +0 -17
  75. package/dist/homeScreen-BZnIEDrV.js +264 -0
  76. package/dist/hooks-Da_yP_Dr.js +149 -0
  77. package/dist/i18n-CoCO2ZuN.js +2971 -0
  78. package/dist/icons-Dbs9ZfYM.js +360 -0
  79. package/dist/id/id.es.js +583 -414
  80. package/dist/id/styles.css +59 -43
  81. package/dist/id-laser-h-DX8UbVNH.js +467 -0
  82. package/dist/id-laser-v-DhnHdjlB.js +490 -0
  83. package/dist/id-tutorial-lj4iKtYT.js +13165 -0
  84. package/dist/id-verification/id-verification.es.js +21 -17
  85. package/dist/idOcr-CjGbb4dB.js +123 -0
  86. package/dist/identity-reuse/identity-reuse.es.js +311 -182
  87. package/dist/identity-reuse/styles.css +134 -80
  88. package/dist/incode-logo-57XFniXU.js +4 -0
  89. package/dist/incodeComponent-wfnHlnXx.js +63 -0
  90. package/dist/incodeModule-BUDoTwT9.js +13 -0
  91. package/dist/index.es.js +17 -13
  92. package/dist/inputComposed-BEn7_nZd.js +1 -0
  93. package/dist/inputComposed-CQ4AsvZg.js +99 -0
  94. package/dist/loadingIcon-B0ysgiNq.js +148 -0
  95. package/dist/lottie_light-Dp9Bz3mf.js +9031 -0
  96. package/dist/mandatoryConsent-r0PQHmv-.js +107 -0
  97. package/dist/modal-nTSaG7nB.js +139 -0
  98. package/dist/modal.hooks-D2xhIuHA.js +195 -0
  99. package/dist/numberedStep-CEtwZqLp.js +13 -0
  100. package/dist/optionAccessibleLabel-CnA-mNAU.js +202 -0
  101. package/dist/otpInput-_JmtVwa0.js +195 -0
  102. package/dist/page-DxGQj7Gk.js +71 -0
  103. package/dist/{passport-horizontal-hint-Bgquwtac.js → passport-horizontal-hint-Bbm2mvSn.js} +55 -55
  104. package/dist/{passport-tutorial-DwRwtPVX.js → passport-tutorial-zT1ZoA-D.js} +7096 -7084
  105. package/dist/{passport-vertical-hint-BT1D5BrW.js → passport-vertical-hint-DJbCtBiM.js} +49 -49
  106. package/dist/pdf-BZA70WbM.js +22398 -0
  107. package/dist/pdfViewer-BK-yVIve.js +114 -0
  108. package/dist/phone/phone.es.js +214 -70
  109. package/dist/phoneInputComposed-DjNdsmPE.js +12142 -0
  110. package/dist/processing-BM-wT-1W.js +8 -0
  111. package/dist/qe-signature/qe-signature.es.js +15 -13
  112. package/dist/radioGroupComposed-BNuaopVr.js +215 -0
  113. package/dist/redirect-to-mobile/redirect-to-mobile.es.js +2774 -0
  114. package/dist/redirect-to-mobile/styles.css +19 -269
  115. package/dist/registerIncodeElement-77NGCDsy.js +11 -0
  116. package/dist/requiredLabelHint-DEadtiwx.js +17 -0
  117. package/dist/richText-Cf9aMOCk.js +3153 -0
  118. package/dist/rolldown-runtime--E5BIlTp.js +33 -0
  119. package/dist/selfie/selfie.es.js +54 -37
  120. package/dist/selfie/styles.css +0 -4
  121. package/dist/selfieTutorial-CtruLyO2.js +2689 -0
  122. package/dist/signature/signature.es.js +778 -405
  123. package/dist/snackbar-CxepGC3e.js +16 -0
  124. package/dist/spinner-B6RxGFrI.js +1 -0
  125. package/dist/spinner-D8a_2LvW.js +42 -0
  126. package/dist/statusPage-DMYPUwRZ.js +28 -0
  127. package/dist/successIcon-BAyDPT7I.js +30 -0
  128. package/dist/tabs-C8npVBbk.js +103 -0
  129. package/dist/themes/dark.css +5 -0
  130. package/dist/themes/light.css +4 -0
  131. package/dist/transitionSpinner-DRRz-NV8.js +26 -0
  132. package/dist/{tutorial-9vHAHvMK.js → tutorial-D1qaY2Tm.js} +1105 -856
  133. package/dist/types/ae-signature.d.ts +4 -1
  134. package/dist/types/antifraud.d.ts +9 -3
  135. package/dist/types/authentication.d.ts +4 -1
  136. package/dist/types/consent.d.ts +4 -1
  137. package/dist/types/cpf-ocr.d.ts +12 -0
  138. package/dist/types/cross-document-data-match.d.ts +4 -1
  139. package/dist/types/curp-validation.d.ts +9 -3
  140. package/dist/types/document-capture.d.ts +37 -0
  141. package/dist/types/ekyb.d.ts +4 -1
  142. package/dist/types/ekyc.d.ts +4 -1
  143. package/dist/types/electronic-signature.d.ts +4 -1
  144. package/dist/types/email.d.ts +4 -1
  145. package/dist/types/extensibility.d.ts +40 -15
  146. package/dist/types/face-match.d.ts +4 -1
  147. package/dist/types/field-comparison.d.ts +38 -0
  148. package/dist/types/fiscal-qr.d.ts +43 -0
  149. package/dist/types/flow.d.ts +5 -2
  150. package/dist/types/geolocation.d.ts +4 -1
  151. package/dist/types/governmentValidation.d.ts +4 -1
  152. package/dist/types/id-verification.d.ts +4 -1
  153. package/dist/types/id.d.ts +4 -1
  154. package/dist/types/identity-reuse.d.ts +4 -1
  155. package/dist/types/index.d.ts +26 -2
  156. package/dist/types/phone.d.ts +4 -1
  157. package/dist/types/qe-signature.d.ts +4 -1
  158. package/dist/types/redirect-to-mobile.d.ts +17 -0
  159. package/dist/types/selfie.d.ts +4 -1
  160. package/dist/types/signature.d.ts +4 -1
  161. package/dist/types/watchlist.d.ts +4 -1
  162. package/dist/types/workflow.d.ts +55 -11
  163. package/dist/typography-YLgHHuao.js +45 -0
  164. package/dist/uiConfig-D2_wawvr.js +25 -0
  165. package/dist/useModuleLoader-CeJ2jL25.js +672 -0
  166. package/dist/vendor-preact-DThS2ZQ_.js +955 -0
  167. package/dist/verificationResult-Do5SpZ6X.js +64 -0
  168. package/dist/verifiedByIncode-DjXOdCml.js +103 -0
  169. package/dist/watchlist/watchlist.es.js +31 -28
  170. package/dist/watchlistForBusiness-BFFXC9d-.js +80 -0
  171. package/dist/workflow/styles.css +449 -427
  172. package/dist/workflow/workflow.es.js +268 -182
  173. package/package.json +32 -10
  174. package/dist/aligndevicelottie-DoV8xKjh.js +0 -12757
  175. package/dist/autoFocusTitle-QexamZ4i.js +0 -16
  176. package/dist/back-tutorial-1NOQobGO.js +0 -14585
  177. package/dist/backdevicelottie-C_ceuqY7.js +0 -16678
  178. package/dist/blurdevicelottie-UO14Y0WC.js +0 -15939
  179. package/dist/bottomSheet-DE_8TFEC.js +0 -31
  180. package/dist/browser-ponyfill-jOkuz57z.js +0 -299
  181. package/dist/button-DcCUEn2n.js +0 -24
  182. package/dist/checkbox-Cl57ltq_.js +0 -85
  183. package/dist/countrySelector-CE-JgIsv.js +0 -58
  184. package/dist/cpfOcr-D_tbwbvh.js +0 -78
  185. package/dist/customFields-CW38fQUv.js +0 -127
  186. package/dist/customWatchlist-D9_yjEQd.js +0 -33
  187. package/dist/dateInputComposed-BpAGsjN6.js +0 -55
  188. package/dist/dateInputComposed-DU3o6PAV.js +0 -1
  189. package/dist/defineProperty-Dh8nSJpJ.js +0 -39
  190. package/dist/documentCapture-xX-JT7ZY.js +0 -763
  191. package/dist/dropdownComposed-DFRBG22E.js +0 -284
  192. package/dist/dropdownComposed-DwTzc2YU.js +0 -1
  193. package/dist/dynamicForms-CJP1Ia6Q.js +0 -262
  194. package/dist/ekybModule-BSs7mndb.js +0 -280
  195. package/dist/ekybModule-D9M3E2Gm.js +0 -2
  196. package/dist/ekycModule-CU9pt5YN.js +0 -246
  197. package/dist/ekycModule-CZw9cLno.js +0 -2
  198. package/dist/electronic-signature-COYXjGdd.js +0 -410
  199. package/dist/emailInput-DppGf9pv.js +0 -37
  200. package/dist/expiredId-BnmzE8T3.js +0 -70
  201. package/dist/extensibility-CzEJfRwo.js +0 -2586
  202. package/dist/faceMatch-B8j0g0Yo.js +0 -2
  203. package/dist/faceMatch-BV8UD7tj.js +0 -201
  204. package/dist/frontdevicelottie-Bu6f9fDE.js +0 -17302
  205. package/dist/glaredevicelottie-B10axYs_.js +0 -14466
  206. package/dist/homeScreen-DnP1jw9A.js +0 -227
  207. package/dist/hooks-BVnGysT7.js +0 -80
  208. package/dist/i18n-9s4OSqwi.js +0 -2010
  209. package/dist/icons-Cc7zwchP.js +0 -310
  210. package/dist/id-laser-h-mBAzHVOK.js +0 -467
  211. package/dist/id-laser-v-CrFg4bcJ.js +0 -483
  212. package/dist/id-tutorial-BCr42Pnn.js +0 -13153
  213. package/dist/idOcr-CCjfWQvH.js +0 -94
  214. package/dist/incode-logo-DX016usY.js +0 -4
  215. package/dist/incodeComponent-C1o4M0ZK.js +0 -50
  216. package/dist/incodeModule-BqCjVgEI.js +0 -18
  217. package/dist/inputComposed-APSw8C7o.js +0 -89
  218. package/dist/inputComposed-XYrarFxS.js +0 -1
  219. package/dist/loadingIcon-BN5YRQUb.js +0 -104
  220. package/dist/mandatoryConsent-DssKMC3v.js +0 -100
  221. package/dist/modal-NMxsQHAO.js +0 -135
  222. package/dist/modal.hooks-CAjcIFZK.js +0 -126
  223. package/dist/numberedStep-CT-alrK5.js +0 -11
  224. package/dist/optionAccessibleLabel-CzEeX3Q4.js +0 -140
  225. package/dist/otpInput-DqRA_egd.js +0 -145
  226. package/dist/page-C1yT4DLb.js +0 -69
  227. package/dist/pdf-BurGZ08w.js +0 -14967
  228. package/dist/pdfViewer-BGBNL1Ea.js +0 -63
  229. package/dist/phoneInputComposed-bvWhGLFZ.js +0 -11206
  230. package/dist/processing-G_y3o32b.js +0 -6
  231. package/dist/radioGroupComposed-BbmvxmD2.js +0 -177
  232. package/dist/redirectToMobile-C3k1gloW.js +0 -1514
  233. package/dist/requiredLabelHint-BLwgqozE.js +0 -13
  234. package/dist/richText-DbJ5sl2n.js +0 -1973
  235. package/dist/rolldown-runtime-CYMK-g2i.js +0 -20
  236. package/dist/selfieTutorial-BgrlUMXP.js +0 -2677
  237. package/dist/snackbar-BDp8x7Cv.js +0 -14
  238. package/dist/spinner-B4dcie2T.js +0 -1
  239. package/dist/spinner-CKnjVHxw.js +0 -39
  240. package/dist/statusPage-CUI7ApcU.js +0 -28
  241. package/dist/successIcon-DbILeIz_.js +0 -28
  242. package/dist/tabs-DaPyP71c.js +0 -78
  243. package/dist/transitionSpinner-PIEPU2Vx.js +0 -17
  244. package/dist/types/cpf-ocr/styles.d.ts +0 -1
  245. package/dist/types/document-capture/styles.d.ts +0 -1
  246. package/dist/types/redirect-to-mobile/styles.d.ts +0 -1
  247. package/dist/typography-CxjaknHN.js +0 -28
  248. package/dist/uiConfig-CwpQ-IM6.js +0 -20
  249. package/dist/useModuleLoader-BFiVA41N.js +0 -432
  250. package/dist/vendor-preact-D6SntenC.js +0 -958
  251. package/dist/verificationResult-BrVbUJ4U.js +0 -97
  252. package/dist/verifiedByIncode-ChZBpqNy.js +0 -101
  253. package/dist/watchlistForBusiness-BcSNtHCV.js +0 -77
@@ -1,661 +1,796 @@
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";
1
+ import { n as useTranslation, o as readStoredLanguage } from "../i18n-CoCO2ZuN.js";
2
+ import { _ as y, c as z, d as T, l as A, o as P, p as d, v as u } from "../vendor-preact-DThS2ZQ_.js";
3
+ import { t as setUiConfig } from "../uiConfig-D2_wawvr.js";
4
+ import { c as useManager } from "../hooks-Da_yP_Dr.js";
5
+ import { t as IncodeComponent } from "../incodeComponent-wfnHlnXx.js";
6
+ import { t as TransitionSpinner } from "../transitionSpinner-DRRz-NV8.js";
7
+ import { t as registerIncodeModuleElement } from "../incodeModule-BUDoTwT9.js";
8
+ import { _ as warmupWasmIfNeeded, a as resolveApiKey, c as HEADLESS_FLOW_MODULE_KEYS, d as fetchTheme, f as initializeFlowManager, h as preloadRedirectToMobile, l as LAZY_UI_MODULES, m as preloadHomeScreen, n as useModulePreloader, o as extractIncodeStatus, p as preloadFirstModule, r as usePrefetchNextModule, s as UnsupportedModule, t as useModuleLoader, u as createFlowManager, y as TerminalErrorPage } from "../useModuleLoader-CeJ2jL25.js";
9
+ import { getDeviceClass } from "@incodetech/core/device";
10
+ import { getRequiredWasmPipelines } from "@incodetech/core/flow";
11
+ import { bootstrapSession, refreshQrUrlUuid } from "@incodetech/core/session";
12
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);
13
+ /**
14
+ * Returns `true` only once `isTrue` has stayed `true` continuously for
15
+ * `delayMs`. Resets to `false` immediately when `isTrue` flips back.
16
+ *
17
+ * Useful to suppress transient loading indicators when an operation
18
+ * completes faster than the given threshold.
19
+ */
20
+ function useDelayedFlag(isTrue, delayMs) {
21
+ const [delayed, setDelayed] = d(false);
22
+ y(() => {
23
+ if (isTrue === false) {
24
+ setDelayed(false);
18
25
  return;
19
26
  }
20
- let t = window.setTimeout(() => {
21
- i(!0);
22
- }, n);
27
+ const timeoutId = window.setTimeout(() => {
28
+ setDelayed(true);
29
+ }, delayMs);
23
30
  return () => {
24
- window.clearTimeout(t);
31
+ window.clearTimeout(timeoutId);
25
32
  };
26
- }, [e, n]), r;
33
+ }, [isTrue, delayMs]);
34
+ return delayed;
27
35
  }
28
36
  //#endregion
29
37
  //#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("");
32
- }
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)));
37
- }
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");
42
- }
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);
38
+ async function createFlowSession(config, signal) {
39
+ return bootstrapSession(await resolveApiKey(config), {
40
+ configurationId: config.configurationId,
41
+ externalId: config.externalId,
42
+ externalCustomerId: config.externalCustomerId,
43
+ language: config.lang,
44
+ customFields: config.customFields,
45
+ uuid: config.uuid,
46
+ urlUuid: config.urlUuid,
47
+ interviewId: config.interviewId,
48
+ loginHint: config.loginHint,
49
+ onUrlUuidRefreshed: config.onUrlUuidRefreshed
50
+ }, signal);
55
51
  }
56
52
  //#endregion
57
53
  //#region src/modules/flow/flowConfig.ts
58
- function I(e) {
59
- return typeof e.token == "string";
54
+ function hasFlowToken(config) {
55
+ return typeof config.token === "string";
60
56
  }
61
- function L(e) {
62
- let t = e;
63
- return typeof t.configurationId == "string" && (typeof t.apiKey == "string" || typeof t.clientId == "string");
57
+ function isSelfLoadingFlowConfig(config) {
58
+ const bootstrapConfig = config;
59
+ return typeof bootstrapConfig.configurationId === "string" && (typeof bootstrapConfig.apiKey === "string" || typeof bootstrapConfig.clientId === "string");
64
60
  }
65
61
  //#endregion
66
62
  //#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");
63
+ var preloadCache = /* @__PURE__ */ new Map();
64
+ function createPreloadHandle(token) {
65
+ const state = preloadCache.get(token);
66
+ if (!state) throw new Error("Preload state not found");
71
67
  return {
72
68
  get isReady() {
73
- return t.status === "ready";
69
+ return state.status === "ready";
74
70
  },
75
71
  get error() {
76
- return t.status === "error" ? t.error ?? null : null;
72
+ return state.status === "error" ? state.error ?? null : null;
77
73
  },
78
74
  async waitUntilReady() {
79
- if (t.status !== "ready") {
80
- if (t.status === "error") throw Error(t.error ?? "Preload failed");
81
- return t.readyPromise;
82
- }
75
+ if (state.status === "ready") return;
76
+ if (state.status === "error") throw new Error(state.error ?? "Preload failed");
77
+ return state.readyPromise;
83
78
  },
84
79
  cancel() {
85
- t.status === "loading" && (t.unsubscribe && t.unsubscribe(), t.flowManager.stop(), t.readyReject(/* @__PURE__ */ Error("Preload cancelled")), R.delete(e));
80
+ if (state.status === "loading") {
81
+ if (state.unsubscribe) state.unsubscribe();
82
+ state.flowManager.stop();
83
+ state.readyReject(/* @__PURE__ */ new Error("Preload cancelled"));
84
+ preloadCache.delete(token);
85
+ }
86
86
  }
87
87
  };
88
88
  }
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 = {
89
+ function preloadIncodeFlow(config) {
90
+ const { token } = config;
91
+ if (config.urlUuid) throw new Error("preloadIncodeFlow does not support urlUuid; pass it to <IncodeFlow> directly so the SDK can rotate it on mount.");
92
+ if (preloadCache.has(token)) return createPreloadHandle(token);
93
+ let readyResolve;
94
+ let readyReject;
95
+ const readyPromise = new Promise((resolve, reject) => {
96
+ readyResolve = resolve;
97
+ readyReject = reject;
98
+ });
99
+ const flowManager = createFlowManager(config);
100
+ if (flowManager.getState().presentation.shouldPrefetchHome) preloadHomeScreen();
101
+ const state = {
98
102
  status: "loading",
99
- flowManager: a,
100
- config: e,
101
- readyPromise: i,
102
- readyResolve: n,
103
- readyReject: r
103
+ flowManager,
104
+ config,
105
+ readyPromise,
106
+ readyResolve,
107
+ readyReject
104
108
  };
105
- return R.set(t, o), (async () => {
109
+ preloadCache.set(token, state);
110
+ const preload = async () => {
106
111
  try {
107
- await T({
108
- token: e.token,
109
- lang: e.lang,
110
- flowManager: a
112
+ await initializeFlowManager({
113
+ token: config.token,
114
+ lang: config.lang,
115
+ flowManager
116
+ });
117
+ const themePromise = config.disableDashboardTheme ? Promise.resolve({}) : fetchTheme().then((result) => {
118
+ state.theme = result.theme;
119
+ state.uiConfig = result.uiConfig;
111
120
  });
112
- let t = e.disableDashboardTheme ? Promise.resolve({}) : v().then((e) => {
113
- o.theme = e.theme, o.uiConfig = e.uiConfig;
121
+ state.unsubscribe = flowManager.subscribe((managerState) => {
122
+ if (managerState.status === "ready") {
123
+ const readyState = managerState;
124
+ warmupWasmIfNeeded(readyState, config.wasmConfig);
125
+ preloadFirstModule(readyState);
126
+ state.unsubscribe?.();
127
+ state.unsubscribe = void 0;
128
+ state.status = "ready";
129
+ state.readyResolve();
130
+ } else if (managerState.status === "error") {
131
+ state.unsubscribe?.();
132
+ state.unsubscribe = void 0;
133
+ state.status = "error";
134
+ state.error = managerState.error;
135
+ state.readyReject(new Error(managerState.error));
136
+ }
114
137
  });
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);
138
+ await themePromise;
139
+ } catch (error) {
140
+ state.status = "error";
141
+ state.error = error instanceof Error ? error.message : "Failed to preload";
142
+ state.readyReject(error instanceof Error ? error : /* @__PURE__ */ new Error("Failed to preload"));
143
+ preloadCache.delete(token);
123
144
  }
124
- })(), z(t);
145
+ };
146
+ preload();
147
+ return createPreloadHandle(token);
125
148
  }
126
- function V(e) {
127
- return R.get(e) ?? null;
149
+ function getPreloadedData(token) {
150
+ return preloadCache.get(token) ?? null;
128
151
  }
129
- function H(e) {
130
- let t = V(e);
131
- return t && R.delete(e), t;
152
+ function consumePreloadedData(token) {
153
+ const state = getPreloadedData(token);
154
+ if (state) preloadCache.delete(token);
155
+ return state;
132
156
  }
133
157
  //#endregion
134
158
  //#region src/modules/flow/useFlowInitialization.ts
135
- function U(e) {
136
- e.getState().presentation.shouldPrefetchHome && g();
159
+ function maybePreloadHomeScreen(flowManager) {
160
+ if (flowManager.getState().presentation.shouldPrefetchHome) preloadHomeScreen();
137
161
  }
138
- function W() {
139
- E() === "desktop" && x();
162
+ function maybePreloadRedirectToMobile() {
163
+ if (getDeviceClass() === "desktop") preloadRedirectToMobile();
140
164
  }
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
- };
165
+ function useFlowInitialization(options) {
166
+ const { lang, disableDashboardTheme, enableHome, onError, useCPF } = options;
167
+ const token = hasFlowToken(options) ? options.token : void 0;
168
+ const flowManagerRef = A(null);
169
+ const [state, setState] = d(() => {
170
+ const preloaded = token ? getPreloadedData(token) : null;
171
+ if (token) {
172
+ if (preloaded?.status === "ready") {
173
+ const consumed = consumePreloadedData(token);
174
+ if (consumed) {
175
+ flowManagerRef.current = consumed.flowManager;
176
+ maybePreloadHomeScreen(consumed.flowManager);
177
+ maybePreloadRedirectToMobile();
178
+ if (consumed.uiConfig) setUiConfig(consumed.uiConfig);
179
+ return {
180
+ status: "ready",
181
+ flowManager: consumed.flowManager
182
+ };
183
+ }
184
+ }
150
185
  }
151
- let n = m({
152
- authHint: e.authHint,
153
- lang: e.lang,
154
- enableHome: e.enableHome,
155
- useCPF: e.useCPF
186
+ const flowManager = createFlowManager({
187
+ authHint: options.authHint,
188
+ lang: options.lang,
189
+ enableHome: options.enableHome,
190
+ useCPF: options.useCPF
156
191
  });
157
- return d.current = n, U(n), W(), t?.status === "error" ? {
192
+ flowManagerRef.current = flowManager;
193
+ maybePreloadHomeScreen(flowManager);
194
+ maybePreloadRedirectToMobile();
195
+ if (preloaded?.status === "error") return {
158
196
  status: "error",
159
- error: t.error ?? "Preload failed",
160
- flowManager: n
161
- } : {
197
+ error: preloaded.error ?? "Preload failed",
198
+ flowManager
199
+ };
200
+ return {
162
201
  status: "initializing",
163
- flowManager: n
202
+ flowManager
164
203
  };
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({
204
+ });
205
+ const initStartedRef = A(false);
206
+ y(() => {
207
+ if (state.status !== "initializing") return;
208
+ const preloaded = token ? getPreloadedData(token) : null;
209
+ if (token && preloaded?.status === "loading") {
210
+ preloaded.readyPromise.then(() => {
211
+ const consumed = consumePreloadedData(token);
212
+ if (consumed) {
213
+ flowManagerRef.current = consumed.flowManager;
214
+ maybePreloadHomeScreen(consumed.flowManager);
215
+ maybePreloadRedirectToMobile();
216
+ if (consumed.uiConfig) setUiConfig(consumed.uiConfig);
217
+ setState({
218
+ status: "ready",
219
+ flowManager: consumed.flowManager
220
+ });
221
+ }
222
+ }).catch((error) => {
223
+ const errorMessage = error instanceof Error ? error.message : "Preload failed";
224
+ const errorCode = extractIncodeStatus(error);
225
+ setState({
179
226
  status: "error",
180
- error: t,
181
- errorCode: n,
182
- flowManager: f.flowManager
183
- }), s?.(t, n);
227
+ error: errorMessage,
228
+ errorCode,
229
+ flowManager: state.flowManager
230
+ });
231
+ onError?.(errorMessage, errorCode);
184
232
  });
185
233
  return;
186
234
  }
187
- if (h.current) return;
188
- h.current = !0;
189
- let i = new AbortController(), { signal: a } = i;
190
- return (async () => {
235
+ if (initStartedRef.current) return;
236
+ initStartedRef.current = true;
237
+ const abortController = new AbortController();
238
+ const { signal } = abortController;
239
+ const initialize = async () => {
191
240
  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
241
+ let resolvedToken;
242
+ if (hasFlowToken(options)) {
243
+ resolvedToken = options.token;
244
+ if (options.urlUuid) await refreshQrUrlUuid({
245
+ urlUuid: options.urlUuid,
246
+ onboardingId: null,
247
+ onRefreshed: options.onUrlUuidRefreshed
248
+ }, signal);
249
+ } else if (isSelfLoadingFlowConfig(options)) {
250
+ const session = await createFlowSession(options, signal);
251
+ resolvedToken = session.token;
252
+ state.flowManager.setEndScreenTexts(session.endScreenTitle ?? null, session.endScreenText ?? null);
253
+ } else throw new Error("Flow requires token, or configurationId with apiKey or clientId");
254
+ await initializeFlowManager({
255
+ token: resolvedToken,
256
+ lang,
257
+ flowManager: state.flowManager
204
258
  });
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({
259
+ const themePromise = disableDashboardTheme ? Promise.resolve() : fetchTheme().then((result) => {
260
+ if (result.uiConfig) setUiConfig(result.uiConfig);
261
+ });
262
+ const flowReadyPromise = state.flowManager.waitForReady();
263
+ await Promise.all([flowReadyPromise, themePromise]);
264
+ setState({
209
265
  status: "ready",
210
- flowManager: f.flowManager
266
+ flowManager: state.flowManager
211
267
  });
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({
268
+ } catch (error) {
269
+ if (signal.aborted) return;
270
+ const errorMessage = error instanceof Error ? error.message : "Failed to initialize SDK";
271
+ const errorCode = extractIncodeStatus(error);
272
+ setState({
216
273
  status: "error",
217
- error: t,
218
- errorCode: n,
219
- flowManager: f.flowManager
220
- }), s?.(t, n);
274
+ error: errorMessage,
275
+ errorCode,
276
+ flowManager: state.flowManager
277
+ });
278
+ onError?.(errorMessage, errorCode);
221
279
  }
222
- })(), () => i.abort();
280
+ };
281
+ initialize();
282
+ return () => abortController.abort();
223
283
  }, [
224
- u,
225
- n,
226
- r,
227
- a,
228
- l,
229
- s,
230
- e,
231
- f
232
- ]), f;
284
+ token,
285
+ lang,
286
+ disableDashboardTheme,
287
+ enableHome,
288
+ useCPF,
289
+ onError,
290
+ options,
291
+ state
292
+ ]);
293
+ return state;
233
294
  }
234
295
  //#endregion
235
296
  //#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
297
+ var LazyHomeScreen = z(() => import("../homeScreen-BZnIEDrV.js").then((module) => ({ default: module.HomeScreen })));
298
+ var IncodeFlowContent = ({ config, onFinish, onError }) => {
299
+ const { i18n } = useTranslation();
300
+ const initState = useFlowInitialization(T(() => ({
301
+ ...config,
302
+ onError
303
+ }), [config, onError]));
304
+ const [flowState, flowManager] = useManager(() => initState.flowManager, { autoLoad: false });
305
+ const lazyModuleKey = flowState.presentation.lazyModuleKey;
306
+ const currentModuleKey = flowState.status === "ready" ? flowState.currentStep : void 0;
307
+ const moduleLoaderState = useModuleLoader({
308
+ moduleKey: lazyModuleKey,
309
+ modules: LAZY_UI_MODULES,
310
+ onModuleLoading: config.onModuleLoading,
311
+ onModuleLoaded: config.onModuleLoaded,
312
+ onError
246
313
  });
247
- y({
248
- moduleKey: f.status === "ready" && f.homeScreen.visible ? v : void 0,
249
- modules: C
314
+ useModulePreloader({
315
+ moduleKey: flowState.status === "ready" && flowState.homeScreen.visible ? currentModuleKey : void 0,
316
+ modules: LAZY_UI_MODULES
250
317
  });
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);
318
+ const currentModuleLoaded = moduleLoaderState.status === "loaded";
319
+ const showHomeLoadingScreen = config.enableHome === true && flowState.status === "ready" && flowState.flow.disableLaunchScreen !== true && flowState.currentStepIndex === 0 && flowState.homeScreen.visible === false && moduleLoaderState.status === "loading";
320
+ const isAwaitingReadyDelayed = useDelayedFlag(flowState.presentation.isAwaitingReady === true, 150);
321
+ const isModuleLoadingDelayed = useDelayedFlag(flowState.status === "ready" && (moduleLoaderState.status === "idle" || moduleLoaderState.status === "loading" || moduleLoaderState.status === "error"), 150);
322
+ usePrefetchNextModule(flowState?.status === "ready" ? flowState.steps : [], flowState?.status === "ready" ? flowState.currentStepIndex : -1, LAZY_UI_MODULES, currentModuleLoaded);
323
+ y(() => {
324
+ if (!config.onFlowEvent) return;
325
+ return flowManager.subscribeFlowEvent(config.onFlowEvent);
326
+ }, [flowManager, config.onFlowEvent]);
327
+ y(() => {
328
+ if (flowState.presentation.shouldPrefetchHome) preloadHomeScreen();
329
+ }, [flowState.presentation.shouldPrefetchHome]);
330
+ y(() => {
331
+ if (readStoredLanguage()) return;
332
+ if (config.lang && i18n.language !== config.lang) i18n.changeLanguage(config.lang);
333
+ }, [config.lang, i18n]);
334
+ y(() => {
335
+ if (flowState?.status !== "ready") return;
336
+ if (flowState.currentStep === "REDIRECT_TO_MOBILE") return;
337
+ const readyState = flowState;
338
+ const requiredPipelines = getRequiredWasmPipelines(readyState.flow);
339
+ if (requiredPipelines.length > 0) {
340
+ config.onWasmWarmup?.(requiredPipelines);
341
+ warmupWasmIfNeeded(readyState, config.wasmConfig);
342
+ }
343
+ }, [flowState, config]);
344
+ const terminalFiredRef = A(false);
345
+ y(() => {
346
+ if (terminalFiredRef.current) return;
347
+ if (flowState?.status === "finished") {
348
+ terminalFiredRef.current = true;
349
+ const finishStatus = flowState.finishStatus;
350
+ queueMicrotask(() => onFinish(finishStatus));
351
+ return;
352
+ }
353
+ if (flowState?.status === "error" && onError) {
354
+ terminalFiredRef.current = true;
355
+ const { error, errorCode } = flowState;
356
+ queueMicrotask(() => onError(error, errorCode));
357
+ }
270
358
  }, [
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", {
359
+ flowState?.status,
360
+ onFinish,
361
+ onError,
362
+ flowState
363
+ ]);
364
+ y(() => {
365
+ if (flowState?.status === "ready" && flowState.currentStep === "ID" && flowState.steps.includes("TUTORIAL_ID")) flowManager.completeModule();
366
+ }, [flowState, flowManager]);
367
+ const hideSpinnerText = !(config.spinnerConfig?.title || config.spinnerConfig?.subtitle);
368
+ if (initState.status === "error") return /* @__PURE__ */ u("div", {
279
369
  class: "IncodeFlow",
280
- children: /* @__PURE__ */ s("div", { children: ["Error: ", u.error] })
370
+ children: /* @__PURE__ */ u(TerminalErrorPage, { message: initState.error })
281
371
  });
282
- if (f.homeScreen.visible || E) return /* @__PURE__ */ s("div", {
372
+ if (flowState.homeScreen.visible || showHomeLoadingScreen) return /* @__PURE__ */ u("div", {
283
373
  class: "IncodeFlow",
284
- children: /* @__PURE__ */ s(a, {
374
+ children: /* @__PURE__ */ u(P, {
285
375
  fallback: null,
286
- children: /* @__PURE__ */ s(K, {
287
- isContinueLoading: f.homeScreen.isContinueLoading || E,
288
- onContinue: () => m.continueFromHome()
376
+ children: /* @__PURE__ */ u(LazyHomeScreen, {
377
+ isContinueLoading: flowState.homeScreen.isContinueLoading || showHomeLoadingScreen,
378
+ onContinue: () => flowManager.continueFromHome()
289
379
  })
290
380
  })
291
381
  });
292
- if (u.status === "initializing") return /* @__PURE__ */ s("div", {
382
+ if (initState.status === "initializing") return /* @__PURE__ */ u("div", {
293
383
  class: "IncodeFlow",
294
- children: /* @__PURE__ */ s(d, {
295
- spinnerConfig: n.spinnerConfig,
296
- hideText: A
384
+ children: /* @__PURE__ */ u(TransitionSpinner, {
385
+ spinnerConfig: config.spinnerConfig,
386
+ hideText: hideSpinnerText
297
387
  })
298
388
  });
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", {
389
+ if (flowState.presentation.isAwaitingReady) {
390
+ if (!isAwaitingReadyDelayed) return /* @__PURE__ */ u("div", { class: "IncodeFlow" });
391
+ return /* @__PURE__ */ u("div", {
314
392
  class: "IncodeFlow",
315
- children: /* @__PURE__ */ s(d, {
316
- spinnerConfig: n.spinnerConfig,
317
- hideText: A
393
+ children: /* @__PURE__ */ u(TransitionSpinner, {
394
+ spinnerConfig: config.spinnerConfig,
395
+ hideText: hideSpinnerText
318
396
  })
319
397
  });
320
- if (b.has(e)) return /* @__PURE__ */ s("div", { class: "IncodeFlow" });
321
- if (x.status === "unsupported") return /* @__PURE__ */ s("div", {
398
+ }
399
+ if (flowState.status === "error") return /* @__PURE__ */ u("div", {
400
+ class: "IncodeFlow",
401
+ children: /* @__PURE__ */ u(TerminalErrorPage, { message: flowState.error })
402
+ });
403
+ if (flowState.status === "finished") return null;
404
+ if (flowState?.status === "ready") {
405
+ const { currentStep, config: flowConfig, flow } = flowState;
406
+ const { flowId } = flow;
407
+ if (!currentStep || !flowConfig) return /* @__PURE__ */ u("div", {
322
408
  class: "IncodeFlow",
323
- children: /* @__PURE__ */ s(p, {
324
- moduleKey: e,
325
- onNext: () => m.completeModule()
409
+ children: /* @__PURE__ */ u(TransitionSpinner, {
410
+ spinnerConfig: config.spinnerConfig,
411
+ hideText: hideSpinnerText
326
412
  })
327
413
  });
328
- if (x.status === "idle" || x.status === "loading" || x.status === "error") return k ? /* @__PURE__ */ s("div", {
414
+ if (HEADLESS_FLOW_MODULE_KEYS.has(currentStep)) return /* @__PURE__ */ u("div", { class: "IncodeFlow" });
415
+ if (moduleLoaderState.status === "unsupported") return /* @__PURE__ */ u("div", {
329
416
  class: "IncodeFlow",
330
- children: /* @__PURE__ */ s(d, {
331
- spinnerConfig: n.spinnerConfig,
332
- hideText: A
417
+ children: /* @__PURE__ */ u(UnsupportedModule, {
418
+ moduleKey: currentStep,
419
+ onNext: () => flowManager.completeModule()
333
420
  })
334
- }) : /* @__PURE__ */ s("div", { class: "IncodeFlow" });
335
- let { Component: a } = x;
336
- if (e === "REDIRECT_TO_MOBILE") return /* @__PURE__ */ s("div", {
421
+ });
422
+ if (moduleLoaderState.status === "idle" || moduleLoaderState.status === "loading" || moduleLoaderState.status === "error") {
423
+ if (!isModuleLoadingDelayed) return /* @__PURE__ */ u("div", { class: "IncodeFlow" });
424
+ return /* @__PURE__ */ u("div", {
425
+ class: "IncodeFlow",
426
+ children: /* @__PURE__ */ u(TransitionSpinner, {
427
+ spinnerConfig: config.spinnerConfig,
428
+ hideText: hideSpinnerText
429
+ })
430
+ });
431
+ }
432
+ const { Component } = moduleLoaderState;
433
+ if (currentStep === "REDIRECT_TO_MOBILE") return /* @__PURE__ */ u("div", {
337
434
  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}`)
435
+ children: /* @__PURE__ */ u(Component, {
436
+ config: flowConfig,
437
+ onFinish: () => flowManager.completeFlow(),
438
+ onContinue: () => flowManager.completeModule(),
439
+ onError
440
+ }, `redirect-to-mobile-${flowState.currentStepIndex}`)
344
441
  });
345
- if (e === "SELFIE") return /* @__PURE__ */ s("div", {
442
+ if (currentStep === "SELFIE") return /* @__PURE__ */ u("div", {
346
443
  class: "IncodeFlow",
347
- children: /* @__PURE__ */ s(a, {
348
- config: t,
349
- onFinish: () => m.completeModule(),
350
- onError: (e) => {
351
- o?.(e ?? "Selfie verification error");
444
+ children: /* @__PURE__ */ u(Component, {
445
+ config: flowConfig,
446
+ onFinish: () => flowManager.completeModule(),
447
+ onError: (error) => {
448
+ onError?.(error ?? "Selfie verification error");
352
449
  }
353
- }, `selfie-${f.currentStepIndex}`)
450
+ }, `selfie-${flowState.currentStepIndex}`)
354
451
  });
355
- if (e === "AUTHENTICATION") return /* @__PURE__ */ s("div", {
452
+ if (currentStep === "AUTHENTICATION") return /* @__PURE__ */ u("div", {
356
453
  class: "IncodeFlow",
357
- children: /* @__PURE__ */ s(a, {
454
+ children: /* @__PURE__ */ u(Component, {
358
455
  config: {
359
- ...t,
360
- authHint: n.authHint
456
+ ...flowConfig,
457
+ authHint: config.authHint
361
458
  },
362
- onFinish: () => m.completeModule(),
363
- onError: (e) => {
364
- o?.(e ?? "Authentication error");
365
- }
366
- }, `authentication-${f.currentStepIndex}`)
459
+ onFinish: () => flowManager.completeModule(),
460
+ onError: (error, _errorCode, moduleErrorCode) => flowManager.errorModule(error ?? "Authentication error", moduleErrorCode)
461
+ }, `authentication-${flowState.currentStepIndex}`)
367
462
  });
368
- if (e === "PHONE") return /* @__PURE__ */ s("div", {
463
+ if (currentStep === "PHONE") return /* @__PURE__ */ u("div", {
369
464
  class: "IncodeFlow",
370
- children: /* @__PURE__ */ s(a, {
371
- config: t,
372
- onFinish: () => m.completeModule(),
373
- onError: (e) => {
374
- o?.(e ?? "Phone verification error");
465
+ children: /* @__PURE__ */ u(Component, {
466
+ config: flowConfig,
467
+ onFinish: () => flowManager.completeModule(),
468
+ onError: (error) => {
469
+ onError?.(error ?? "Phone verification error");
375
470
  }
376
- }, `phone-${f.currentStepIndex}`)
471
+ }, `phone-${flowState.currentStepIndex}`)
377
472
  });
378
- if (e === "EMAIL") {
379
- let e = t;
380
- return !e || typeof e.otpVerification != "boolean" || typeof e.otpExpirationInMinutes != "number" ? /* @__PURE__ */ s("div", {
473
+ if (currentStep === "EMAIL") {
474
+ const emailConfig = flowConfig;
475
+ if (!emailConfig || typeof emailConfig.otpVerification !== "boolean" || typeof emailConfig.otpExpirationInMinutes !== "number") return /* @__PURE__ */ u("div", {
381
476
  class: "IncodeFlow",
382
- children: /* @__PURE__ */ s("div", { children: "Error: Invalid email configuration" })
383
- }) : /* @__PURE__ */ s("div", {
477
+ children: /* @__PURE__ */ u("div", { children: "Error: Invalid email configuration" })
478
+ });
479
+ return /* @__PURE__ */ u("div", {
384
480
  class: "IncodeFlow",
385
- children: /* @__PURE__ */ s(a, {
386
- config: e,
387
- onFinish: () => m.completeModule(),
388
- onError: (e) => {
389
- o?.(e ?? "Email verification error");
481
+ children: /* @__PURE__ */ u(Component, {
482
+ config: emailConfig,
483
+ onFinish: () => flowManager.completeModule(),
484
+ onError: (error) => {
485
+ onError?.(error ?? "Email verification error");
390
486
  }
391
- }, `email-${f.currentStepIndex}`)
487
+ }, `email-${flowState.currentStepIndex}`)
392
488
  });
393
489
  }
394
- if (e === "ID" || e === "SECOND_ID") {
395
- let n = t;
396
- return /* @__PURE__ */ s("div", {
490
+ if (currentStep === "ID" || currentStep === "SECOND_ID") {
491
+ const idConfig = flowConfig;
492
+ return /* @__PURE__ */ u("div", {
397
493
  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");
494
+ children: /* @__PURE__ */ u(Component, {
495
+ config: currentStep === "SECOND_ID" ? {
496
+ ...idConfig,
497
+ isSecondId: true
498
+ } : idConfig,
499
+ onFinish: () => flowManager.completeModule(),
500
+ onError: (error) => {
501
+ onError?.(error ?? "ID capture error");
406
502
  }
407
- }, `id-${f.currentStepIndex}`)
503
+ }, `id-${flowState.currentStepIndex}`)
408
504
  });
409
505
  }
410
- if (e === "ID_OCR") {
411
- let e = t, n = f.steps.includes("SECOND_ID");
412
- return /* @__PURE__ */ s("div", {
506
+ if (currentStep === "ID_OCR") {
507
+ const idOcrConfig = flowConfig;
508
+ const isSecondId = flowState.steps.includes("SECOND_ID");
509
+ return /* @__PURE__ */ u("div", {
413
510
  class: "IncodeFlow",
414
- children: /* @__PURE__ */ s(a, {
511
+ children: /* @__PURE__ */ u(Component, {
415
512
  config: {
416
- ...e,
417
- secondId: e.secondId ?? n,
418
- flowId: i
513
+ ...idOcrConfig,
514
+ secondId: idOcrConfig.secondId ?? isSecondId,
515
+ flowId
419
516
  },
420
- onFinish: () => m.completeModule(),
421
- onError: (e) => {
422
- o?.(e ?? "ID OCR error");
517
+ onFinish: () => flowManager.completeModule(),
518
+ onError: (error) => {
519
+ onError?.(error ?? "ID OCR error");
423
520
  }
424
- }, `id-ocr-${f.currentStepIndex}`)
521
+ }, `id-ocr-${flowState.currentStepIndex}`)
425
522
  });
426
523
  }
427
- if (e === "CPF_OCR") return /* @__PURE__ */ s("div", {
524
+ if (currentStep === "CPF_OCR") return /* @__PURE__ */ u("div", {
428
525
  class: "IncodeFlow",
429
- children: /* @__PURE__ */ s(a, {
430
- onFinish: () => m.completeModule(),
431
- onError: (e) => {
432
- o?.(e ?? "CPF OCR error");
526
+ children: /* @__PURE__ */ u(Component, {
527
+ onFinish: () => flowManager.completeModule(),
528
+ onError: (error) => {
529
+ onError?.(error ?? "CPF OCR error");
433
530
  }
434
- }, `cpf-ocr-${f.currentStepIndex}`)
531
+ }, `cpf-ocr-${flowState.currentStepIndex}`)
435
532
  });
436
- if (e === "FACE_MATCH") return /* @__PURE__ */ s("div", {
533
+ if (currentStep === "FACE_MATCH") return /* @__PURE__ */ u("div", {
437
534
  class: "IncodeFlow",
438
- children: /* @__PURE__ */ s(a, {
439
- config: t,
440
- onFinish: () => m.completeModule(),
441
- onError: (e) => {
442
- o?.(e ?? "Face match error");
535
+ children: /* @__PURE__ */ u(Component, {
536
+ config: flowConfig,
537
+ onFinish: () => flowManager.completeModule(),
538
+ onError: (error) => {
539
+ onError?.(error ?? "Face match error");
443
540
  }
444
- }, `face-match-${f.currentStepIndex}`)
541
+ }, `face-match-${flowState.currentStepIndex}`)
445
542
  });
446
- if (e === "CURP_VALIDATION") return /* @__PURE__ */ s("div", {
543
+ if (currentStep === "CURP_VALIDATION") return /* @__PURE__ */ u("div", {
447
544
  class: "IncodeFlow",
448
- children: /* @__PURE__ */ s(a, {
449
- config: t,
450
- onFinish: () => m.completeModule(),
451
- onError: (e) => {
452
- o?.(e ?? "CURP validation error");
545
+ children: /* @__PURE__ */ u(Component, {
546
+ config: flowConfig,
547
+ onFinish: () => flowManager.completeModule(),
548
+ onError: (error) => {
549
+ onError?.(error ?? "CURP validation error");
453
550
  }
454
- }, `curp-validation-${f.currentStepIndex}`)
551
+ }, `curp-validation-${flowState.currentStepIndex}`)
455
552
  });
456
- if (e === "GOVT_VALIDATION_PROVISIONING") return /* @__PURE__ */ s("div", {
553
+ if (currentStep === "GOVT_VALIDATION_PROVISIONING") return /* @__PURE__ */ u("div", {
457
554
  class: "IncodeFlow",
458
- children: /* @__PURE__ */ s(a, {
459
- config: t,
460
- onFinish: () => m.completeModule(),
461
- onError: (e) => {
462
- o?.(e ?? "Government validation error");
555
+ children: /* @__PURE__ */ u(Component, {
556
+ config: flowConfig,
557
+ onFinish: () => flowManager.completeModule(),
558
+ onError: (error) => {
559
+ onError?.(error ?? "Government validation error");
463
560
  }
464
- }, `govt-validation-${f.currentStepIndex}`)
561
+ }, `govt-validation-${flowState.currentStepIndex}`)
465
562
  });
466
- if (e === "GEOLOCATION") return /* @__PURE__ */ s("div", {
563
+ if (currentStep === "INE_VALIDATION") return /* @__PURE__ */ u("div", {
467
564
  class: "IncodeFlow",
468
- children: /* @__PURE__ */ s(a, {
469
- config: t,
470
- onFinish: () => m.completeModule(),
471
- onError: (e) => {
472
- o?.(e ?? "Geolocation error");
565
+ children: /* @__PURE__ */ u(Component, {
566
+ config: flowConfig,
567
+ onFinish: () => flowManager.completeModule(),
568
+ onError: (error) => {
569
+ onError?.(error ?? "INE validation error");
473
570
  }
474
- }, `geolocation-${f.currentStepIndex}`)
571
+ }, `ine-validation-${flowState.currentStepIndex}`)
475
572
  });
476
- if (e === "EXTERNAL_VERIFICATION") return /* @__PURE__ */ s("div", {
573
+ if (currentStep === "GEOLOCATION") return /* @__PURE__ */ u("div", {
477
574
  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");
575
+ children: /* @__PURE__ */ u(Component, {
576
+ config: flowConfig,
577
+ onFinish: () => flowManager.completeModule(),
578
+ onError: (error) => {
579
+ onError?.(error ?? "Geolocation error");
483
580
  }
484
- }, `ekyc-${f.currentStepIndex}`)
581
+ }, `geolocation-${flowState.currentStepIndex}`)
485
582
  });
486
- if (e === "DOCUMENT_CAPTURE") return /* @__PURE__ */ s("div", {
583
+ if (currentStep === "EXTERNAL_VERIFICATION") return /* @__PURE__ */ u("div", {
487
584
  class: "IncodeFlow",
488
- children: /* @__PURE__ */ s(a, {
489
- config: t,
490
- onFinish: () => m.completeModule(),
491
- onError: (e) => {
492
- o?.(e ?? "Document capture error");
585
+ children: /* @__PURE__ */ u(Component, {
586
+ config: { flowId: flowState.flow.flowId },
587
+ onFinish: () => flowManager.completeModule(),
588
+ onError: (error) => {
589
+ onError?.(error ?? "External verification error");
493
590
  }
494
- }, `document-capture-${f.currentStepIndex}`)
591
+ }, `ekyc-${flowState.currentStepIndex}`)
495
592
  });
496
- if (e === "ADDRESS") return /* @__PURE__ */ s("div", {
593
+ if (currentStep === "DOCUMENT_CAPTURE") return /* @__PURE__ */ u("div", {
497
594
  class: "IncodeFlow",
498
- children: /* @__PURE__ */ s(a, {
595
+ children: /* @__PURE__ */ u(Component, {
596
+ config: flowConfig,
597
+ onFinish: () => flowManager.completeModule(),
598
+ onError: (error) => {
599
+ onError?.(error ?? "Document capture error");
600
+ }
601
+ }, `document-capture-${flowState.currentStepIndex}`)
602
+ });
603
+ if (currentStep === "ADDRESS") return /* @__PURE__ */ u("div", {
604
+ class: "IncodeFlow",
605
+ children: /* @__PURE__ */ u(Component, {
499
606
  config: {
500
- ...t,
607
+ ...flowConfig,
501
608
  processingType: "addressStatement"
502
609
  },
503
- onFinish: () => m.completeModule(),
504
- onError: (e) => {
505
- o?.(e ?? "Address capture error");
610
+ onFinish: () => flowManager.completeModule(),
611
+ onError: (error) => {
612
+ onError?.(error ?? "Address capture error");
506
613
  }
507
- }, `address-${f.currentStepIndex}`)
614
+ }, `address-${flowState.currentStepIndex}`)
508
615
  });
509
- if (e === "SIGNATURE") return /* @__PURE__ */ s("div", {
616
+ if (currentStep === "SIGNATURE") return /* @__PURE__ */ u("div", {
510
617
  class: "IncodeFlow",
511
- children: /* @__PURE__ */ s(a, {
512
- config: t,
513
- onFinish: () => m.completeModule(),
514
- onError: (e) => {
515
- o?.(e ?? "Signature capture error");
618
+ children: /* @__PURE__ */ u(Component, {
619
+ config: flowConfig,
620
+ onFinish: () => flowManager.completeModule(),
621
+ onError: (error) => {
622
+ onError?.(error ?? "Signature capture error");
516
623
  }
517
- }, `signature-${f.currentStepIndex}`)
624
+ }, `signature-${flowState.currentStepIndex}`)
518
625
  });
519
- if (e === "EKYB") {
520
- let e = t;
521
- return /* @__PURE__ */ s("div", {
626
+ if (currentStep === "EKYB") {
627
+ const ekybFlowConfig = flowConfig;
628
+ return /* @__PURE__ */ u("div", {
522
629
  class: "IncodeFlow",
523
- children: /* @__PURE__ */ s(a, {
630
+ children: /* @__PURE__ */ u(Component, {
524
631
  config: {
525
- flowId: i,
526
- checkBusinessName: e.checkBusinessName,
527
- checkAddress: e.checkAddress,
528
- checkTaxId: e.checkTaxId,
529
- checkUniqueBeneficialOwner: e.checkUniqueBeneficialOwner
632
+ flowId,
633
+ checkBusinessName: ekybFlowConfig.checkBusinessName,
634
+ checkAddress: ekybFlowConfig.checkAddress,
635
+ checkTaxId: ekybFlowConfig.checkTaxId,
636
+ checkUniqueBeneficialOwner: ekybFlowConfig.checkUniqueBeneficialOwner
530
637
  },
531
- onFinish: () => m.completeModule(),
532
- onError: (e) => {
533
- o?.(e ?? "eKYB verification error");
638
+ onFinish: () => flowManager.completeModule(),
639
+ onError: (error) => {
640
+ onError?.(error ?? "eKYB verification error");
534
641
  }
535
- }, `ekyb-${f.currentStepIndex}`)
642
+ }, `ekyb-${flowState.currentStepIndex}`)
536
643
  });
537
644
  }
538
- if (e === "COMBINED_CONSENT") return /* @__PURE__ */ s("div", {
645
+ if (currentStep === "COMBINED_CONSENT") return /* @__PURE__ */ u("div", {
539
646
  class: "IncodeFlow",
540
- children: /* @__PURE__ */ s(a, {
541
- config: t,
542
- onFinish: () => m.completeModule(),
543
- onError: (e) => {
544
- o?.(e ?? "Combined consent error");
647
+ children: /* @__PURE__ */ u(Component, {
648
+ config: flowConfig,
649
+ onFinish: () => flowManager.completeModule(),
650
+ onError: (error) => {
651
+ onError?.(error ?? "Combined consent error");
545
652
  }
546
- }, `combined-consent-${f.currentStepIndex}`)
653
+ }, `combined-consent-${flowState.currentStepIndex}`)
547
654
  });
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", {
655
+ if (currentStep === "MANDATORY_CONSENT" || currentStep === "ML_CONSENT") {
656
+ const isMlConsent = currentStep === "ML_CONSENT";
657
+ return /* @__PURE__ */ u("div", {
658
+ class: "IncodeFlow",
659
+ children: /* @__PURE__ */ u(Component, {
660
+ config: {
661
+ ...flowConfig,
662
+ type: isMlConsent ? "ML" : "MANDATORY"
663
+ },
664
+ onFinish: () => flowManager.completeModule(),
665
+ onError: (error) => {
666
+ onError?.(error ?? (isMlConsent ? "ML consent error" : "Mandatory consent error"));
667
+ }
668
+ }, `${isMlConsent ? "ml" : "mandatory"}-consent-${flowState.currentStepIndex}`)
669
+ });
670
+ }
671
+ if (currentStep === "AE_SIGNATURE" || currentStep === "QE_SIGNATURE") {
672
+ const sigConfig = flowConfig;
673
+ const label = currentStep === "QE_SIGNATURE" ? "qe" : "ae";
674
+ return /* @__PURE__ */ u("div", {
561
675
  class: "IncodeFlow",
562
- children: /* @__PURE__ */ s(a, {
676
+ children: /* @__PURE__ */ u(Component, {
563
677
  config: {
564
- uploadDocument: n.uploadDocument,
565
- downloadDocument: n.downloadDocument
678
+ uploadDocument: sigConfig.uploadDocument,
679
+ downloadDocument: sigConfig.downloadDocument
566
680
  },
567
- onFinish: () => m.completeModule(),
568
- onError: (e) => {
569
- o?.(e ?? `${r.toUpperCase()} Signature error`);
681
+ onFinish: () => flowManager.completeModule(),
682
+ onError: (error) => {
683
+ onError?.(error ?? `${label.toUpperCase()} Signature error`);
570
684
  }
571
- }, `${r}-signature-${f.currentStepIndex}`)
685
+ }, `${label}-signature-${flowState.currentStepIndex}`)
572
686
  });
573
687
  }
574
- if (e === "ANTIFRAUD") return /* @__PURE__ */ s("div", {
688
+ if (currentStep === "ANTIFRAUD") return /* @__PURE__ */ u("div", {
575
689
  class: "IncodeFlow",
576
- children: /* @__PURE__ */ s(a, {
577
- onFinish: () => m.completeModule(),
578
- onError: (e) => {
579
- o?.(e ?? "Antifraud check error");
690
+ children: /* @__PURE__ */ u(Component, {
691
+ onFinish: () => flowManager.completeModule(),
692
+ onError: (error) => {
693
+ onError?.(error ?? "Antifraud check error");
580
694
  }
581
- }, `antifraud-${f.currentStepIndex}`)
695
+ }, `antifraud-${flowState.currentStepIndex}`)
582
696
  });
583
- if (e === "CUSTOM_FIELDS") return /* @__PURE__ */ s("div", {
697
+ if (currentStep === "CUSTOM_FIELDS") return /* @__PURE__ */ u("div", {
584
698
  class: "IncodeFlow",
585
- children: /* @__PURE__ */ s(a, {
586
- config: t,
587
- onFinish: () => m.completeModule(),
588
- onError: (e) => {
589
- o?.(e ?? "Custom fields error");
699
+ children: /* @__PURE__ */ u(Component, {
700
+ config: flowConfig,
701
+ onFinish: () => flowManager.completeModule(),
702
+ onError: (error) => {
703
+ onError?.(error ?? "Custom fields error");
590
704
  }
591
- }, `custom-fields-${f.currentStepIndex}`)
705
+ }, `custom-fields-${flowState.currentStepIndex}`)
592
706
  });
593
- if (e === "WATCHLIST") return /* @__PURE__ */ s("div", {
707
+ if (currentStep === "WATCHLIST") return /* @__PURE__ */ u("div", {
594
708
  class: "IncodeFlow",
595
- children: /* @__PURE__ */ s(a, {
596
- onFinish: () => m.completeModule(),
597
- onError: (e) => {
598
- o?.(e ?? "Watchlist check error");
709
+ children: /* @__PURE__ */ u(Component, {
710
+ onFinish: () => flowManager.completeModule(),
711
+ onError: (error) => {
712
+ onError?.(error ?? "Watchlist check error");
599
713
  }
600
- }, `watchlist-${f.currentStepIndex}`)
714
+ }, `watchlist-${flowState.currentStepIndex}`)
601
715
  });
602
- if (e === "WATCHLIST_BUSINESS") return /* @__PURE__ */ s("div", {
716
+ if (currentStep === "WATCHLIST_BUSINESS") return /* @__PURE__ */ u("div", {
603
717
  class: "IncodeFlow",
604
- children: /* @__PURE__ */ s(a, {
605
- onFinish: () => m.completeModule(),
606
- onError: (e) => {
607
- o?.(e ?? "Watchlist for business check error");
718
+ children: /* @__PURE__ */ u(Component, {
719
+ onFinish: () => flowManager.completeModule(),
720
+ onError: (error) => {
721
+ onError?.(error ?? "Watchlist for business check error");
608
722
  }
609
- }, `watchlist-for-business-${f.currentStepIndex}`)
723
+ }, `watchlist-for-business-${flowState.currentStepIndex}`)
610
724
  });
611
- if (e === "INCODE_WATCHLIST") return /* @__PURE__ */ s("div", {
725
+ if (currentStep === "INCODE_WATCHLIST") return /* @__PURE__ */ u("div", {
612
726
  class: "IncodeFlow",
613
- children: /* @__PURE__ */ s(a, {
614
- config: t,
615
- onFinish: () => m.completeModule(),
616
- onError: (e) => {
617
- o?.(e ?? "Custom watchlist check error");
727
+ children: /* @__PURE__ */ u(Component, {
728
+ config: flowConfig,
729
+ onFinish: () => flowManager.completeModule(),
730
+ onError: (error) => {
731
+ onError?.(error ?? "Custom watchlist check error");
618
732
  }
619
- }, `incode-watchlist-${f.currentStepIndex}`)
733
+ }, `incode-watchlist-${flowState.currentStepIndex}`)
620
734
  });
621
- if (e === "CROSS_DOCUMENT_DATA_MATCH") return /* @__PURE__ */ s("div", {
735
+ if (currentStep === "CROSS_DOCUMENT_DATA_MATCH") return /* @__PURE__ */ u("div", {
622
736
  class: "IncodeFlow",
623
- children: /* @__PURE__ */ s(a, {
624
- onFinish: () => m.completeModule(),
625
- onError: (e) => {
626
- o?.(e ?? "Cross document data match error");
737
+ children: /* @__PURE__ */ u(Component, {
738
+ onFinish: () => flowManager.completeModule(),
739
+ onError: (error) => {
740
+ onError?.(error ?? "Cross document data match error");
627
741
  }
628
- }, `cross-document-data-match-${f.currentStepIndex}`)
742
+ }, `cross-document-data-match-${flowState.currentStepIndex}`)
629
743
  });
630
- if (e === "DYNAMIC_FORMS") return /* @__PURE__ */ s("div", {
744
+ if (currentStep === "FIELD_COMPARISON") return /* @__PURE__ */ u("div", {
631
745
  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
746
+ children: /* @__PURE__ */ u(Component, {
747
+ onFinish: () => flowManager.completeModule(),
748
+ onError: (error) => {
749
+ onError?.(error ?? "Field comparison error");
750
+ }
751
+ }, `field-comparison-${flowState.currentStepIndex}`)
752
+ });
753
+ if (currentStep === "DYNAMIC_FORMS") return /* @__PURE__ */ u("div", {
754
+ class: "IncodeFlow",
755
+ children: /* @__PURE__ */ u(Component, {
756
+ config: { screens: flowConfig.screens.map((s) => ({
757
+ title: s.title,
758
+ hideTitle: s.hideTitle,
759
+ questions: s.questions.map((q) => ({
760
+ questionId: q.questionId,
761
+ question: q.question,
762
+ inputType: q.inputType,
763
+ isOptional: q.isOptional,
764
+ overrides: q.overrides ?? void 0,
765
+ isPredefined: q.isPredefined,
766
+ options: q.options
644
767
  }))
645
768
  })) },
646
- onFinish: () => m.completeModule(),
647
- onError: (e) => {
648
- o?.(e ?? "Dynamic forms error");
769
+ onFinish: () => flowManager.completeModule(),
770
+ onError: (error) => {
771
+ onError?.(error ?? "Dynamic forms error");
772
+ }
773
+ }, `dynamic-forms-${flowState.currentStepIndex}`)
774
+ });
775
+ if (currentStep === "FISCAL_QR") return /* @__PURE__ */ u("div", {
776
+ class: "IncodeFlow",
777
+ children: /* @__PURE__ */ u(Component, {
778
+ onFinish: () => flowManager.completeModule(),
779
+ onError: (error) => {
780
+ onError?.(error ?? "Fiscal QR error");
649
781
  }
650
- }, `dynamic-forms-${f.currentStepIndex}`)
782
+ }, `fiscal-qr-${flowState.currentStepIndex}`)
651
783
  });
652
784
  }
653
785
  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");
786
+ };
787
+ var IncodeFlow = ({ config, onFinish = () => {}, onError }) => {
788
+ return /* @__PURE__ */ u(IncodeComponent, { children: config ? /* @__PURE__ */ u(IncodeFlowContent, {
789
+ config,
790
+ onFinish,
791
+ onError
792
+ }) : null });
793
+ };
794
+ registerIncodeModuleElement(IncodeFlow, "incode-flow");
660
795
  //#endregion
661
- export { J as IncodeFlow, B as preloadIncodeFlow };
796
+ export { IncodeFlow, preloadIncodeFlow };