@incodetech/web 0.0.0-dev-20260608-c8c427ca → 0.0.0-dev-20260609-11ba3e8a

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 (211) hide show
  1. package/dist/ae-signature/ae-signature.es.js +15 -13
  2. package/dist/aligndevicelottie-DY_bX_p8.js +12769 -0
  3. package/dist/antifraud/antifraud.es.js +22 -19
  4. package/dist/authentication/authentication.es.js +42 -33
  5. package/dist/autoFocusTitle-DM6PvgcP.js +29 -0
  6. package/dist/{back-horizontal-hint-DsPhKbR4.js → back-horizontal-hint-BXYix0Wj.js} +26 -26
  7. package/dist/back-tutorial-vb1MxlrT.js +14597 -0
  8. package/dist/{back-vertical-hint-BFJbYQrX.js → back-vertical-hint-DNSh6JNH.js} +27 -27
  9. package/dist/backdevicelottie-HypPqBz7.js +16690 -0
  10. package/dist/base.css +5 -0
  11. package/dist/blurdevicelottie-CBXtBFiJ.js +15951 -0
  12. package/dist/bottomSheet-BuzqNQtG.js +39 -0
  13. package/dist/browser-ponyfill-CLLvZCVg.js +441 -0
  14. package/dist/button-B-qlr4iI.js +35 -0
  15. package/dist/checkbox-CTPETqo5.js +96 -0
  16. package/dist/consent/consent.es.js +75 -64
  17. package/dist/countrySelector-CzyuaDIs.js +60 -0
  18. package/dist/cpf-ocr/cpf-ocr.es.js +2 -2
  19. package/dist/cpfOcr-DQVs3r8N.js +92 -0
  20. package/dist/cpfOcr-WNklFuxT.js +2 -0
  21. package/dist/cross-document-data-match/cross-document-data-match.es.js +20 -17
  22. package/dist/curp-validation/curp-validation.es.js +246 -211
  23. package/dist/customFields-B4MqqDI6.js +140 -0
  24. package/dist/customWatchlist-Dfqw1DQP.js +36 -0
  25. package/dist/dateInputComposed-BsPQHG5o.js +1 -0
  26. package/dist/dateInputComposed-DY97tQVK.js +69 -0
  27. package/dist/defineProperty-mefzVtTv.js +39 -0
  28. package/dist/document-capture/document-capture.es.js +2 -2
  29. package/dist/documentCapture-BE78MIlR.js +876 -0
  30. package/dist/documentCapture-BVfNZL29.js +2 -0
  31. package/dist/dropdownComposed-BF4L-7mJ.js +380 -0
  32. package/dist/dropdownComposed-mvHuRFHn.js +1 -0
  33. package/dist/dynamicForms-BYGGAQoc.js +352 -0
  34. package/dist/ekyb/ekyb.es.js +2 -2
  35. package/dist/ekybModule-BUPX0QhW.js +2 -0
  36. package/dist/ekybModule-CkTXu-4u.js +279 -0
  37. package/dist/ekyc/ekyc.es.js +2 -2
  38. package/dist/ekycModule-BWsVX39d.js +257 -0
  39. package/dist/ekycModule-DNDPqvUc.js +2 -0
  40. package/dist/electronic-signature/electronic-signature.es.js +2 -2
  41. package/dist/electronic-signature-BJSyzex9.js +426 -0
  42. package/dist/email/email.es.js +198 -78
  43. package/dist/emailInput-BHp4Apt4.js +39 -0
  44. package/dist/errorIcon-B0rmz3rw.js +26 -0
  45. package/dist/expiredId-C105HVKv.js +85 -0
  46. package/dist/extensibility-DJwVxojG.js +3070 -0
  47. package/dist/extensibility.es.js +26 -26
  48. package/dist/face-match/face-match.es.js +2 -2
  49. package/dist/faceMatch-BOFGxzzx.js +343 -0
  50. package/dist/faceMatch-CDMcFQwR.js +2 -0
  51. package/dist/field-comparison/field-comparison.es.js +2 -2
  52. package/dist/fieldComparison-BMDmQ8eA.js +88 -0
  53. package/dist/fieldComparison-Z1NleSxD.js +2 -0
  54. package/dist/{flip-animation-CuQ57qTn.js → flip-animation-BGRvygw9.js} +4221 -4221
  55. package/dist/flow/flow.es.js +597 -493
  56. package/dist/flow/styles.css +0 -8
  57. package/dist/{front-horizontal-hint-CKm7PnmS.js → front-horizontal-hint-CLSU0iVo.js} +70 -70
  58. package/dist/{front-vertical-hint-CLHC2qoH.js → front-vertical-hint-BWq-yWQ8.js} +81 -81
  59. package/dist/frontdevicelottie-CLqitJhG.js +17314 -0
  60. package/dist/geolocation/geolocation.es.js +485 -395
  61. package/dist/glaredevicelottie-BS04U6Fc.js +14478 -0
  62. package/dist/governmentValidation/governmentValidation.es.js +145 -64
  63. package/dist/governmentValidation/styles.css +0 -36
  64. package/dist/homeScreen-BsEYyiDB.js +264 -0
  65. package/dist/hooks-BtgmGvba.js +149 -0
  66. package/dist/i18n-gTHArCl9.js +2971 -0
  67. package/dist/icons-DKY3xDkf.js +360 -0
  68. package/dist/id/id.es.js +565 -413
  69. package/dist/id-laser-h-DX8UbVNH.js +467 -0
  70. package/dist/id-laser-v-DhnHdjlB.js +490 -0
  71. package/dist/id-tutorial-lj4iKtYT.js +13165 -0
  72. package/dist/id-verification/id-verification.es.js +21 -18
  73. package/dist/idOcr-BS77o1VC.js +123 -0
  74. package/dist/identity-reuse/identity-reuse.es.js +168 -130
  75. package/dist/incode-logo-57XFniXU.js +4 -0
  76. package/dist/incodeComponent-CDJxFZvS.js +63 -0
  77. package/dist/incodeModule-DkA_yd0X.js +13 -0
  78. package/dist/index.es.js +16 -14
  79. package/dist/inputComposed-5V2nLTqH.js +99 -0
  80. package/dist/inputComposed-BPOYwUBl.js +1 -0
  81. package/dist/loadingIcon-DN62ugKs.js +148 -0
  82. package/dist/lottie_light-Dp9Bz3mf.js +9031 -0
  83. package/dist/mandatoryConsent-DP189TUn.js +107 -0
  84. package/dist/modal-B5QeulDu.js +153 -0
  85. package/dist/modal.hooks-C7K9k_pY.js +202 -0
  86. package/dist/numberedStep-DVAyTPv1.js +13 -0
  87. package/dist/optionAccessibleLabel-Czc2YC8z.js +202 -0
  88. package/dist/otpInput-2IQ-JCK8.js +195 -0
  89. package/dist/page-BZ-0eNWq.js +71 -0
  90. package/dist/{passport-horizontal-hint-C_le0HVU.js → passport-horizontal-hint-DfVsf4Cc.js} +55 -55
  91. package/dist/{passport-tutorial-BYN4T_TE.js → passport-tutorial-zT1ZoA-D.js} +7096 -7084
  92. package/dist/{passport-vertical-hint-H-pyICSv.js → passport-vertical-hint-DVxbTyQp.js} +49 -49
  93. package/dist/pdf-BZA70WbM.js +22398 -0
  94. package/dist/pdfViewer-Dr63sJ51.js +114 -0
  95. package/dist/phone/phone.es.js +214 -87
  96. package/dist/phoneInputComposed-D_IabWKJ.js +12142 -0
  97. package/dist/processing-B_u8wUB7.js +8 -0
  98. package/dist/qe-signature/qe-signature.es.js +15 -13
  99. package/dist/radioGroupComposed-DwYW-Ld-.js +215 -0
  100. package/dist/redirect-to-mobile/redirect-to-mobile.es.js +2099 -859
  101. package/dist/registerIncodeElement-BJJGzVdq.js +11 -0
  102. package/dist/requiredLabelHint-DEadtiwx.js +17 -0
  103. package/dist/richText-C7GUm0WL.js +3153 -0
  104. package/dist/rolldown-runtime--E5BIlTp.js +33 -0
  105. package/dist/selfie/selfie.es.js +54 -42
  106. package/dist/selfieTutorial-CtruLyO2.js +2689 -0
  107. package/dist/signature/signature.es.js +765 -406
  108. package/dist/snackbar-Dz9crm39.js +16 -0
  109. package/dist/spinner-BfBIZkDQ.js +42 -0
  110. package/dist/spinner-DEDtE7Pz.js +1 -0
  111. package/dist/statusPage-CVCoieyd.js +28 -0
  112. package/dist/successIcon-rmzr-pxu.js +30 -0
  113. package/dist/tabs--UMd6eEB.js +103 -0
  114. package/dist/transitionSpinner-CWhGcr7c.js +26 -0
  115. package/dist/{tutorial-QzQ536BL.js → tutorial-Jv0noW4z.js} +832 -578
  116. package/dist/types/extensibility.d.ts +3 -1
  117. package/dist/types/index.d.ts +13 -4
  118. package/dist/typography-BK4AmfKX.js +45 -0
  119. package/dist/uiConfig-sgEkFuuA.js +25 -0
  120. package/dist/useModuleLoader-CuhHtmgr.js +670 -0
  121. package/dist/vendor-preact-BH7vOa2r.js +957 -0
  122. package/dist/verificationResult-CJ0JyV6A.js +64 -0
  123. package/dist/verifiedByIncode-8QBn-kgZ.js +103 -0
  124. package/dist/watchlist/watchlist.es.js +31 -26
  125. package/dist/watchlistForBusiness-RZcnjVDb.js +80 -0
  126. package/dist/workflow/styles.css +0 -8
  127. package/dist/workflow/workflow.es.js +251 -209
  128. package/package.json +4 -2
  129. package/dist/aligndevicelottie-D8KsO77t.js +0 -12757
  130. package/dist/autoFocusTitle-BpYdaSUM.js +0 -16
  131. package/dist/back-tutorial-DhSE2FJo.js +0 -14585
  132. package/dist/backdevicelottie-CJWGVMdw.js +0 -16678
  133. package/dist/blurdevicelottie-Dxt2deEB.js +0 -15939
  134. package/dist/bottomSheet-QrpyatOD.js +0 -31
  135. package/dist/browser-ponyfill-Crda_c5R.js +0 -299
  136. package/dist/button-DcCUEn2n.js +0 -24
  137. package/dist/checkbox-DCCzBAuF.js +0 -86
  138. package/dist/countrySelector-CJ8egQ4C.js +0 -58
  139. package/dist/cpfOcr-Db06i-Lm.js +0 -2
  140. package/dist/cpfOcr-FixhUeMQ.js +0 -79
  141. package/dist/customFields-C1G9xHNX.js +0 -125
  142. package/dist/customWatchlist-IKEblz7u.js +0 -31
  143. package/dist/dateInputComposed-Cg8BvYSK.js +0 -1
  144. package/dist/dateInputComposed-Ddd7HLyM.js +0 -58
  145. package/dist/defineProperty-xczUyn-m.js +0 -39
  146. package/dist/documentCapture-D9I7FjGe.js +0 -2
  147. package/dist/documentCapture-b61wlala.js +0 -765
  148. package/dist/dropdownComposed-B4U0AIak.js +0 -1
  149. package/dist/dropdownComposed-CS2pyn-g.js +0 -293
  150. package/dist/dynamicForms-tYQog0kw.js +0 -298
  151. package/dist/ekybModule-C33C4JES.js +0 -237
  152. package/dist/ekybModule-LON6G2Bz.js +0 -2
  153. package/dist/ekycModule-BJOgtTAh.js +0 -225
  154. package/dist/ekycModule-BSf_DIG7.js +0 -2
  155. package/dist/electronic-signature-OdgTyso4.js +0 -406
  156. package/dist/emailInput-CU7mLB21.js +0 -37
  157. package/dist/errorIcon-DpHzAoAo.js +0 -24
  158. package/dist/expiredId-nfVAZgTL.js +0 -70
  159. package/dist/extensibility-BbNy3mVG.js +0 -2602
  160. package/dist/faceMatch-BIila4kf.js +0 -2
  161. package/dist/faceMatch-DJ7Mqujx.js +0 -206
  162. package/dist/fieldComparison-D2RSFYl-.js +0 -84
  163. package/dist/fieldComparison-DbUyouFd.js +0 -2
  164. package/dist/frontdevicelottie-65Vyfpff.js +0 -17302
  165. package/dist/glaredevicelottie-BEyaqtc6.js +0 -14466
  166. package/dist/homeScreen-CyPddxWl.js +0 -227
  167. package/dist/hooks-MxHtZWTS.js +0 -112
  168. package/dist/i18n-Kzzvkz94.js +0 -2019
  169. package/dist/icons-9I5g9-_1.js +0 -292
  170. package/dist/id-laser-h-iCPbFixz.js +0 -467
  171. package/dist/id-laser-v-CNzwliP2.js +0 -483
  172. package/dist/id-tutorial-CF4nO4oX.js +0 -13153
  173. package/dist/idOcr-DlMLMDqa.js +0 -97
  174. package/dist/incode-logo-DX016usY.js +0 -4
  175. package/dist/incodeComponent-BoFhgK7G.js +0 -50
  176. package/dist/incodeModule-BiCoAJ5k.js +0 -13
  177. package/dist/inputComposed-DAEey9xm.js +0 -94
  178. package/dist/inputComposed-eS4B0Mkh.js +0 -1
  179. package/dist/loadingIcon-BN5YRQUb.js +0 -104
  180. package/dist/lottie_light-DLqSnziX.js +0 -4419
  181. package/dist/mandatoryConsent-DNz2jZ43.js +0 -98
  182. package/dist/modal-ZqAhwiRF.js +0 -135
  183. package/dist/modal.hooks-LdusROLW.js +0 -126
  184. package/dist/numberedStep-CdLWASwL.js +0 -11
  185. package/dist/optionAccessibleLabel-DcygPaME.js +0 -140
  186. package/dist/otpInput-C4pk4BJU.js +0 -157
  187. package/dist/page-DA3R7q0J.js +0 -69
  188. package/dist/pdf-51QeiFSx.js +0 -14967
  189. package/dist/pdfViewer-rKzTHket.js +0 -64
  190. package/dist/phoneInputComposed-CjAxk2Gj.js +0 -11230
  191. package/dist/processing-DPktVde2.js +0 -6
  192. package/dist/radioGroupComposed-DRRxVk9Z.js +0 -178
  193. package/dist/registerIncodeElement-BHWOwdSS.js +0 -7
  194. package/dist/requiredLabelHint-B6FN3v88.js +0 -13
  195. package/dist/richText-6pIbydcz.js +0 -1973
  196. package/dist/rolldown-runtime-CYMK-g2i.js +0 -20
  197. package/dist/selfieTutorial-Yo9AlUoT.js +0 -2677
  198. package/dist/snackbar-CQiiWO4p.js +0 -14
  199. package/dist/spinner-B4dcie2T.js +0 -1
  200. package/dist/spinner-CKnjVHxw.js +0 -39
  201. package/dist/statusPage-B8b3Jg6N.js +0 -28
  202. package/dist/successIcon-SlKgTSty.js +0 -28
  203. package/dist/tabs-D7lGst3Q.js +0 -78
  204. package/dist/transitionSpinner-Di3bOyOu.js +0 -17
  205. package/dist/typography-CxjaknHN.js +0 -28
  206. package/dist/uiConfig-CwpQ-IM6.js +0 -20
  207. package/dist/useModuleLoader-Bqs7fglI.js +0 -517
  208. package/dist/vendor-preact-D6SntenC.js +0 -958
  209. package/dist/verificationResult-DhT3hH1b.js +0 -90
  210. package/dist/verifiedByIncode-DpbxzO0y.js +0 -101
  211. package/dist/watchlistForBusiness-CRXVbH4l.js +0 -75
@@ -1,683 +1,787 @@
1
- import { n as e, o as t } from "../i18n-Kzzvkz94.js";
2
- import { _ as n, c as r, d as i, l as a, o, p as s, v as c } from "../vendor-preact-D6SntenC.js";
3
- import { t as l } from "../uiConfig-CwpQ-IM6.js";
4
- import { c as u } from "../hooks-MxHtZWTS.js";
5
- import { t as d } from "../incodeComponent-BoFhgK7G.js";
6
- import { t as f } from "../transitionSpinner-Di3bOyOu.js";
7
- import { t as p } from "../incodeModule-BiCoAJ5k.js";
8
- import { _ as m, a as h, c as g, d as _, f as v, h as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, y as k } from "../useModuleLoader-Bqs7fglI.js";
9
- import { getDeviceClass as A } from "@incodetech/core/device";
10
- import { getRequiredWasmPipelines as j } from "@incodetech/core/flow";
11
- import { bootstrapSession as M, refreshQrUrlUuid as N } from "@incodetech/core/session";
1
+ import { n as useTranslation, o as readStoredLanguage } from "../i18n-gTHArCl9.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-BH7vOa2r.js";
3
+ import { t as setUiConfig } from "../uiConfig-sgEkFuuA.js";
4
+ import { c as useManager } from "../hooks-BtgmGvba.js";
5
+ import { t as IncodeComponent } from "../incodeComponent-CDJxFZvS.js";
6
+ import { t as TransitionSpinner } from "../transitionSpinner-CWhGcr7c.js";
7
+ import { t as registerIncodeModuleElement } from "../incodeModule-DkA_yd0X.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-CuhHtmgr.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 P(e, t) {
14
- let [r, i] = s(!1);
15
- return n(() => {
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 n = window.setTimeout(() => {
21
- i(!0);
22
- }, t);
27
+ const timeoutId = window.setTimeout(() => {
28
+ setDelayed(true);
29
+ }, delayMs);
23
30
  return () => {
24
- window.clearTimeout(n);
31
+ window.clearTimeout(timeoutId);
25
32
  };
26
- }, [e, t]), r;
33
+ }, [isTrue, delayMs]);
34
+ return delayed;
27
35
  }
28
36
  //#endregion
29
37
  //#region src/modules/flow/createFlowSession.ts
30
- async function F(e, t) {
31
- return M(await h(e), {
32
- configurationId: e.configurationId,
33
- externalId: e.externalId,
34
- externalCustomerId: e.externalCustomerId,
35
- language: e.lang,
36
- customFields: e.customFields,
37
- uuid: e.uuid,
38
- urlUuid: e.urlUuid,
39
- interviewId: e.interviewId,
40
- loginHint: e.loginHint,
41
- onUrlUuidRefreshed: e.onUrlUuidRefreshed
42
- }, 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);
43
51
  }
44
52
  //#endregion
45
53
  //#region src/modules/flow/flowConfig.ts
46
- function I(e) {
47
- return typeof e.token == "string";
54
+ function hasFlowToken(config) {
55
+ return typeof config.token === "string";
48
56
  }
49
- function L(e) {
50
- let t = e;
51
- 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");
52
60
  }
53
61
  //#endregion
54
62
  //#region src/modules/flow/preloadFlow.ts
55
- var R = /* @__PURE__ */ new Map();
56
- function z(e) {
57
- let t = R.get(e);
58
- 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");
59
67
  return {
60
68
  get isReady() {
61
- return t.status === "ready";
69
+ return state.status === "ready";
62
70
  },
63
71
  get error() {
64
- return t.status === "error" ? t.error ?? null : null;
72
+ return state.status === "error" ? state.error ?? null : null;
65
73
  },
66
74
  async waitUntilReady() {
67
- if (t.status !== "ready") {
68
- if (t.status === "error") throw Error(t.error ?? "Preload failed");
69
- return t.readyPromise;
70
- }
75
+ if (state.status === "ready") return;
76
+ if (state.status === "error") throw new Error(state.error ?? "Preload failed");
77
+ return state.readyPromise;
71
78
  },
72
79
  cancel() {
73
- 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
+ }
74
86
  }
75
87
  };
76
88
  }
77
- function B(e) {
78
- let { token: t } = e;
79
- if (e.urlUuid) throw Error("preloadIncodeFlow does not support urlUuid; pass it to <IncodeFlow> directly so the SDK can rotate it on mount.");
80
- if (R.has(t)) return z(t);
81
- let n, r, i = new Promise((e, t) => {
82
- n = e, r = t;
83
- }), a = O(e);
84
- a.getState().presentation.shouldPrefetchHome && x();
85
- 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 = {
86
102
  status: "loading",
87
- flowManager: a,
88
- config: e,
89
- readyPromise: i,
90
- readyResolve: n,
91
- readyReject: r
103
+ flowManager,
104
+ config,
105
+ readyPromise,
106
+ readyResolve,
107
+ readyReject
92
108
  };
93
- return R.set(t, o), (async () => {
109
+ preloadCache.set(token, state);
110
+ const preload = async () => {
94
111
  try {
95
- await v({
96
- token: e.token,
97
- lang: e.lang,
98
- flowManager: a
112
+ await initializeFlowManager({
113
+ token: config.token,
114
+ lang: config.lang,
115
+ flowManager
99
116
  });
100
- let t = e.disableDashboardTheme ? Promise.resolve({}) : _().then((e) => {
101
- o.theme = e.theme, o.uiConfig = e.uiConfig;
117
+ const themePromise = config.disableDashboardTheme ? Promise.resolve({}) : fetchTheme().then((result) => {
118
+ state.theme = result.theme;
119
+ state.uiConfig = result.uiConfig;
120
+ });
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
+ }
102
137
  });
103
- o.unsubscribe = a.subscribe((t) => {
104
- if (t.status === "ready") {
105
- let n = t;
106
- m(n, e.wasmConfig), w(n), o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "ready", o.readyResolve();
107
- } else t.status === "error" && (o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "error", o.error = t.error, o.readyReject(Error(t.error)));
108
- }), await t;
109
- } catch (e) {
110
- 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);
111
144
  }
112
- })(), z(t);
145
+ };
146
+ preload();
147
+ return createPreloadHandle(token);
113
148
  }
114
- function V(e) {
115
- return R.get(e) ?? null;
149
+ function getPreloadedData(token) {
150
+ return preloadCache.get(token) ?? null;
116
151
  }
117
- function H(e) {
118
- let t = V(e);
119
- return t && R.delete(e), t;
152
+ function consumePreloadedData(token) {
153
+ const state = getPreloadedData(token);
154
+ if (state) preloadCache.delete(token);
155
+ return state;
120
156
  }
121
157
  //#endregion
122
158
  //#region src/modules/flow/useFlowInitialization.ts
123
- function U(e) {
124
- e.getState().presentation.shouldPrefetchHome && x();
159
+ function maybePreloadHomeScreen(flowManager) {
160
+ if (flowManager.getState().presentation.shouldPrefetchHome) preloadHomeScreen();
125
161
  }
126
- function W() {
127
- A() === "desktop" && y();
162
+ function maybePreloadRedirectToMobile() {
163
+ if (getDeviceClass() === "desktop") preloadRedirectToMobile();
128
164
  }
129
- function G(e) {
130
- let { lang: t, disableDashboardTheme: r, enableHome: i, onError: o, useCPF: c } = e, u = I(e) ? e.token : void 0, d = a(null), [f, p] = s(() => {
131
- let t = u ? V(u) : null;
132
- if (u && t?.status === "ready") {
133
- let e = H(u);
134
- if (e) return d.current = e.flowManager, U(e.flowManager), W(), e.uiConfig && l(e.uiConfig), {
135
- status: "ready",
136
- flowManager: e.flowManager
137
- };
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
+ }
138
185
  }
139
- let n = O({
140
- authHint: e.authHint,
141
- lang: e.lang,
142
- enableHome: e.enableHome,
143
- useCPF: e.useCPF
186
+ const flowManager = createFlowManager({
187
+ authHint: options.authHint,
188
+ lang: options.lang,
189
+ enableHome: options.enableHome,
190
+ useCPF: options.useCPF
144
191
  });
145
- 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 {
146
196
  status: "error",
147
- error: t.error ?? "Preload failed",
148
- flowManager: n
149
- } : {
197
+ error: preloaded.error ?? "Preload failed",
198
+ flowManager
199
+ };
200
+ return {
150
201
  status: "initializing",
151
- flowManager: n
202
+ flowManager
152
203
  };
153
- }), m = a(!1);
154
- return n(() => {
155
- if (f.status !== "initializing") return;
156
- let n = u ? V(u) : null;
157
- if (u && n?.status === "loading") {
158
- n.readyPromise.then(() => {
159
- let e = H(u);
160
- e && (d.current = e.flowManager, U(e.flowManager), W(), e.uiConfig && l(e.uiConfig), p({
161
- status: "ready",
162
- flowManager: e.flowManager
163
- }));
164
- }).catch((e) => {
165
- let t = e instanceof Error ? e.message : "Preload failed", n = C(e);
166
- 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({
167
226
  status: "error",
168
- error: t,
169
- errorCode: n,
170
- flowManager: f.flowManager
171
- }), o?.(t, n);
227
+ error: errorMessage,
228
+ errorCode,
229
+ flowManager: state.flowManager
230
+ });
231
+ onError?.(errorMessage, errorCode);
172
232
  });
173
233
  return;
174
234
  }
175
- if (m.current) return;
176
- m.current = !0;
177
- let i = new AbortController(), { signal: a } = i;
178
- return (async () => {
235
+ if (initStartedRef.current) return;
236
+ initStartedRef.current = true;
237
+ const abortController = new AbortController();
238
+ const { signal } = abortController;
239
+ const initialize = async () => {
179
240
  try {
180
- let n;
181
- if (I(e)) n = e.token, e.urlUuid && await N({
182
- urlUuid: e.urlUuid,
183
- onboardingId: null,
184
- onRefreshed: e.onUrlUuidRefreshed
185
- }, a);
186
- else if (L(e)) {
187
- let t = await F(e, a);
188
- n = t.token, f.flowManager.setEndScreenTexts(t.endScreenTitle ?? null, t.endScreenText ?? null);
189
- } else throw Error("Flow requires token, or configurationId with apiKey or clientId");
190
- await v({
191
- token: n,
192
- lang: t,
193
- 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
194
258
  });
195
- let i = r ? Promise.resolve() : _().then((e) => {
196
- e.uiConfig && l(e.uiConfig);
197
- }), o = f.flowManager.waitForReady();
198
- 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({
199
265
  status: "ready",
200
- flowManager: f.flowManager
266
+ flowManager: state.flowManager
201
267
  });
202
- } catch (e) {
203
- if (a.aborted) return;
204
- let t = e instanceof Error ? e.message : "Failed to initialize SDK", n = C(e);
205
- 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({
206
273
  status: "error",
207
- error: t,
208
- errorCode: n,
209
- flowManager: f.flowManager
210
- }), o?.(t, n);
274
+ error: errorMessage,
275
+ errorCode,
276
+ flowManager: state.flowManager
277
+ });
278
+ onError?.(errorMessage, errorCode);
211
279
  }
212
- })(), () => i.abort();
280
+ };
281
+ initialize();
282
+ return () => abortController.abort();
213
283
  }, [
214
- u,
215
- t,
216
- r,
217
- i,
218
- c,
219
- o,
220
- e,
221
- f
222
- ]), f;
284
+ token,
285
+ lang,
286
+ disableDashboardTheme,
287
+ enableHome,
288
+ useCPF,
289
+ onError,
290
+ options,
291
+ state
292
+ ]);
293
+ return state;
223
294
  }
224
295
  //#endregion
225
296
  //#region src/modules/flow/flow.tsx
226
- var K = r(() => import("../homeScreen-CyPddxWl.js").then((e) => ({ default: e.HomeScreen }))), q = ({ config: r, onFinish: s, onError: l }) => {
227
- let { i18n: d } = e(), p = G(i(() => ({
228
- ...r,
229
- onError: l
230
- }), [r, l])), [h, _] = u(() => p.flowManager, { autoLoad: !1 }), v = h.presentation.lazyModuleKey, y = h.status === "ready" ? h.currentStep : void 0, C = D({
231
- moduleKey: v,
232
- modules: b,
233
- onModuleLoading: r.onModuleLoading,
234
- onModuleLoaded: r.onModuleLoaded,
235
- onError: l
297
+ var LazyHomeScreen = z(() => import("../homeScreen-BsEYyiDB.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
236
313
  });
237
- S({
238
- moduleKey: h.status === "ready" && h.homeScreen.visible ? y : void 0,
239
- modules: b
314
+ useModulePreloader({
315
+ moduleKey: flowState.status === "ready" && flowState.homeScreen.visible ? currentModuleKey : void 0,
316
+ modules: LAZY_UI_MODULES
240
317
  });
241
- let w = C.status === "loaded", O = r.enableHome === !0 && h.status === "ready" && h.flow.disableLaunchScreen !== !0 && h.currentStepIndex === 0 && h.homeScreen.visible === !1 && C.status === "loading", A = P(h.presentation.isAwaitingReady === !0, 150), M = P(h.status === "ready" && (C.status === "idle" || C.status === "loading" || C.status === "error"), 150);
242
- T(h?.status === "ready" ? h.steps : [], h?.status === "ready" ? h.currentStepIndex : -1, b, w), n(() => {
243
- if (r.onFlowEvent) return _.subscribeFlowEvent(r.onFlowEvent);
244
- }, [_, r.onFlowEvent]), n(() => {
245
- h.presentation.shouldPrefetchHome && x();
246
- }, [h.presentation.shouldPrefetchHome]), n(() => {
247
- t() || r.lang && d.language !== r.lang && d.changeLanguage(r.lang);
248
- }, [r.lang, d]), n(() => {
249
- if (h?.status !== "ready" || h.currentStep === "REDIRECT_TO_MOBILE") return;
250
- let e = h, t = j(e.flow);
251
- t.length > 0 && (r.onWasmWarmup?.(t), m(e, r.wasmConfig));
252
- }, [h, r]);
253
- let N = a(!1);
254
- n(() => {
255
- if (!N.current) {
256
- if (h?.status === "finished") {
257
- N.current = !0;
258
- let e = h.finishStatus;
259
- queueMicrotask(() => s(e));
260
- return;
261
- }
262
- if (h?.status === "error" && l) {
263
- N.current = !0;
264
- let { error: e, errorCode: t } = h;
265
- queueMicrotask(() => l(e, t));
266
- }
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));
267
357
  }
268
358
  }, [
269
- h?.status,
270
- s,
271
- l,
272
- h
273
- ]), n(() => {
274
- h?.status === "ready" && h.currentStep === "ID" && h.steps.includes("TUTORIAL_ID") && _.completeModule();
275
- }, [h, _]);
276
- let F = !(r.spinnerConfig?.title || r.spinnerConfig?.subtitle);
277
- if (p.status === "error") return /* @__PURE__ */ c("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", {
278
369
  class: "IncodeFlow",
279
- children: /* @__PURE__ */ c(k, { message: p.error })
370
+ children: /* @__PURE__ */ u(TerminalErrorPage, { message: initState.error })
280
371
  });
281
- if (h.homeScreen.visible || O) return /* @__PURE__ */ c("div", {
372
+ if (flowState.homeScreen.visible || showHomeLoadingScreen) return /* @__PURE__ */ u("div", {
282
373
  class: "IncodeFlow",
283
- children: /* @__PURE__ */ c(o, {
374
+ children: /* @__PURE__ */ u(P, {
284
375
  fallback: null,
285
- children: /* @__PURE__ */ c(K, {
286
- isContinueLoading: h.homeScreen.isContinueLoading || O,
287
- onContinue: () => _.continueFromHome()
376
+ children: /* @__PURE__ */ u(LazyHomeScreen, {
377
+ isContinueLoading: flowState.homeScreen.isContinueLoading || showHomeLoadingScreen,
378
+ onContinue: () => flowManager.continueFromHome()
288
379
  })
289
380
  })
290
381
  });
291
- if (p.status === "initializing") return /* @__PURE__ */ c("div", {
382
+ if (initState.status === "initializing") return /* @__PURE__ */ u("div", {
292
383
  class: "IncodeFlow",
293
- children: /* @__PURE__ */ c(f, {
294
- spinnerConfig: r.spinnerConfig,
295
- hideText: F
384
+ children: /* @__PURE__ */ u(TransitionSpinner, {
385
+ spinnerConfig: config.spinnerConfig,
386
+ hideText: hideSpinnerText
296
387
  })
297
388
  });
298
- if (h.presentation.isAwaitingReady) return A ? /* @__PURE__ */ c("div", {
299
- class: "IncodeFlow",
300
- children: /* @__PURE__ */ c(f, {
301
- spinnerConfig: r.spinnerConfig,
302
- hideText: F
303
- })
304
- }) : /* @__PURE__ */ c("div", { class: "IncodeFlow" });
305
- if (h.status === "error") return /* @__PURE__ */ c("div", {
306
- class: "IncodeFlow",
307
- children: /* @__PURE__ */ c(k, { message: h.error })
308
- });
309
- if (h.status === "finished") return null;
310
- if (h?.status === "ready") {
311
- let { currentStep: e, config: t, flow: n } = h, { flowId: i } = n;
312
- if (!e || !t) return /* @__PURE__ */ c("div", {
389
+ if (flowState.presentation.isAwaitingReady) {
390
+ if (!isAwaitingReadyDelayed) return /* @__PURE__ */ u("div", { class: "IncodeFlow" });
391
+ return /* @__PURE__ */ u("div", {
313
392
  class: "IncodeFlow",
314
- children: /* @__PURE__ */ c(f, {
315
- spinnerConfig: r.spinnerConfig,
316
- hideText: F
393
+ children: /* @__PURE__ */ u(TransitionSpinner, {
394
+ spinnerConfig: config.spinnerConfig,
395
+ hideText: hideSpinnerText
317
396
  })
318
397
  });
319
- if (g.has(e)) return /* @__PURE__ */ c("div", { class: "IncodeFlow" });
320
- if (C.status === "unsupported") return /* @__PURE__ */ c("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", {
321
408
  class: "IncodeFlow",
322
- children: /* @__PURE__ */ c(E, {
323
- moduleKey: e,
324
- onNext: () => _.completeModule()
409
+ children: /* @__PURE__ */ u(TransitionSpinner, {
410
+ spinnerConfig: config.spinnerConfig,
411
+ hideText: hideSpinnerText
325
412
  })
326
413
  });
327
- if (C.status === "idle" || C.status === "loading" || C.status === "error") return M ? /* @__PURE__ */ c("div", {
414
+ if (HEADLESS_FLOW_MODULE_KEYS.has(currentStep)) return /* @__PURE__ */ u("div", { class: "IncodeFlow" });
415
+ if (moduleLoaderState.status === "unsupported") return /* @__PURE__ */ u("div", {
328
416
  class: "IncodeFlow",
329
- children: /* @__PURE__ */ c(f, {
330
- spinnerConfig: r.spinnerConfig,
331
- hideText: F
417
+ children: /* @__PURE__ */ u(UnsupportedModule, {
418
+ moduleKey: currentStep,
419
+ onNext: () => flowManager.completeModule()
332
420
  })
333
- }) : /* @__PURE__ */ c("div", { class: "IncodeFlow" });
334
- let { Component: a } = C;
335
- if (e === "REDIRECT_TO_MOBILE") return /* @__PURE__ */ c("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", {
336
434
  class: "IncodeFlow",
337
- children: /* @__PURE__ */ c(a, {
338
- config: t,
339
- onFinish: () => _.completeFlow(),
340
- onContinue: () => _.completeModule(),
341
- onError: l
342
- }, `redirect-to-mobile-${h.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}`)
343
441
  });
344
- if (e === "SELFIE") return /* @__PURE__ */ c("div", {
442
+ if (currentStep === "SELFIE") return /* @__PURE__ */ u("div", {
345
443
  class: "IncodeFlow",
346
- children: /* @__PURE__ */ c(a, {
347
- config: t,
348
- onFinish: () => _.completeModule(),
349
- onError: (e) => {
350
- l?.(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");
351
449
  }
352
- }, `selfie-${h.currentStepIndex}`)
450
+ }, `selfie-${flowState.currentStepIndex}`)
353
451
  });
354
- if (e === "AUTHENTICATION") return /* @__PURE__ */ c("div", {
452
+ if (currentStep === "AUTHENTICATION") return /* @__PURE__ */ u("div", {
355
453
  class: "IncodeFlow",
356
- children: /* @__PURE__ */ c(a, {
454
+ children: /* @__PURE__ */ u(Component, {
357
455
  config: {
358
- ...t,
359
- authHint: r.authHint
456
+ ...flowConfig,
457
+ authHint: config.authHint
360
458
  },
361
- onFinish: () => _.completeModule(),
362
- onError: (e, t, n) => _.errorModule(e ?? "Authentication error", n)
363
- }, `authentication-${h.currentStepIndex}`)
459
+ onFinish: () => flowManager.completeModule(),
460
+ onError: (error, _errorCode, moduleErrorCode) => flowManager.errorModule(error ?? "Authentication error", moduleErrorCode)
461
+ }, `authentication-${flowState.currentStepIndex}`)
364
462
  });
365
- if (e === "PHONE") return /* @__PURE__ */ c("div", {
463
+ if (currentStep === "PHONE") return /* @__PURE__ */ u("div", {
366
464
  class: "IncodeFlow",
367
- children: /* @__PURE__ */ c(a, {
368
- config: t,
369
- onFinish: () => _.completeModule(),
370
- onError: (e) => {
371
- l?.(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");
372
470
  }
373
- }, `phone-${h.currentStepIndex}`)
471
+ }, `phone-${flowState.currentStepIndex}`)
374
472
  });
375
- if (e === "EMAIL") {
376
- let e = t;
377
- return !e || typeof e.otpVerification != "boolean" || typeof e.otpExpirationInMinutes != "number" ? /* @__PURE__ */ c("div", {
473
+ if (currentStep === "EMAIL") {
474
+ const emailConfig = flowConfig;
475
+ if (!emailConfig || typeof emailConfig.otpVerification !== "boolean" || typeof emailConfig.otpExpirationInMinutes !== "number") return /* @__PURE__ */ u("div", {
378
476
  class: "IncodeFlow",
379
- children: /* @__PURE__ */ c("div", { children: "Error: Invalid email configuration" })
380
- }) : /* @__PURE__ */ c("div", {
477
+ children: /* @__PURE__ */ u("div", { children: "Error: Invalid email configuration" })
478
+ });
479
+ return /* @__PURE__ */ u("div", {
381
480
  class: "IncodeFlow",
382
- children: /* @__PURE__ */ c(a, {
383
- config: e,
384
- onFinish: () => _.completeModule(),
385
- onError: (e) => {
386
- l?.(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");
387
486
  }
388
- }, `email-${h.currentStepIndex}`)
487
+ }, `email-${flowState.currentStepIndex}`)
389
488
  });
390
489
  }
391
- if (e === "ID" || e === "SECOND_ID") {
392
- let n = t;
393
- return /* @__PURE__ */ c("div", {
490
+ if (currentStep === "ID" || currentStep === "SECOND_ID") {
491
+ const idConfig = flowConfig;
492
+ return /* @__PURE__ */ u("div", {
394
493
  class: "IncodeFlow",
395
- children: /* @__PURE__ */ c(a, {
396
- config: e === "SECOND_ID" ? {
397
- ...n,
398
- isSecondId: !0
399
- } : n,
400
- onFinish: () => _.completeModule(),
401
- onError: (e) => {
402
- l?.(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");
403
502
  }
404
- }, `id-${h.currentStepIndex}`)
503
+ }, `id-${flowState.currentStepIndex}`)
405
504
  });
406
505
  }
407
- if (e === "ID_OCR") {
408
- let e = t, n = h.steps.includes("SECOND_ID");
409
- return /* @__PURE__ */ c("div", {
506
+ if (currentStep === "ID_OCR") {
507
+ const idOcrConfig = flowConfig;
508
+ const isSecondId = flowState.steps.includes("SECOND_ID");
509
+ return /* @__PURE__ */ u("div", {
410
510
  class: "IncodeFlow",
411
- children: /* @__PURE__ */ c(a, {
511
+ children: /* @__PURE__ */ u(Component, {
412
512
  config: {
413
- ...e,
414
- secondId: e.secondId ?? n,
415
- flowId: i
513
+ ...idOcrConfig,
514
+ secondId: idOcrConfig.secondId ?? isSecondId,
515
+ flowId
416
516
  },
417
- onFinish: () => _.completeModule(),
418
- onError: (e) => {
419
- l?.(e ?? "ID OCR error");
517
+ onFinish: () => flowManager.completeModule(),
518
+ onError: (error) => {
519
+ onError?.(error ?? "ID OCR error");
420
520
  }
421
- }, `id-ocr-${h.currentStepIndex}`)
521
+ }, `id-ocr-${flowState.currentStepIndex}`)
422
522
  });
423
523
  }
424
- if (e === "CPF_OCR") return /* @__PURE__ */ c("div", {
524
+ if (currentStep === "CPF_OCR") return /* @__PURE__ */ u("div", {
425
525
  class: "IncodeFlow",
426
- children: /* @__PURE__ */ c(a, {
427
- onFinish: () => _.completeModule(),
428
- onError: (e) => {
429
- l?.(e ?? "CPF OCR error");
526
+ children: /* @__PURE__ */ u(Component, {
527
+ onFinish: () => flowManager.completeModule(),
528
+ onError: (error) => {
529
+ onError?.(error ?? "CPF OCR error");
430
530
  }
431
- }, `cpf-ocr-${h.currentStepIndex}`)
531
+ }, `cpf-ocr-${flowState.currentStepIndex}`)
432
532
  });
433
- if (e === "FACE_MATCH") return /* @__PURE__ */ c("div", {
533
+ if (currentStep === "FACE_MATCH") return /* @__PURE__ */ u("div", {
434
534
  class: "IncodeFlow",
435
- children: /* @__PURE__ */ c(a, {
436
- config: t,
437
- onFinish: () => _.completeModule(),
438
- onError: (e) => {
439
- l?.(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");
440
540
  }
441
- }, `face-match-${h.currentStepIndex}`)
541
+ }, `face-match-${flowState.currentStepIndex}`)
442
542
  });
443
- if (e === "CURP_VALIDATION") return /* @__PURE__ */ c("div", {
543
+ if (currentStep === "CURP_VALIDATION") return /* @__PURE__ */ u("div", {
444
544
  class: "IncodeFlow",
445
- children: /* @__PURE__ */ c(a, {
446
- config: t,
447
- onFinish: () => _.completeModule(),
448
- onError: (e) => {
449
- l?.(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");
450
550
  }
451
- }, `curp-validation-${h.currentStepIndex}`)
551
+ }, `curp-validation-${flowState.currentStepIndex}`)
452
552
  });
453
- if (e === "GOVT_VALIDATION_PROVISIONING") return /* @__PURE__ */ c("div", {
553
+ if (currentStep === "GOVT_VALIDATION_PROVISIONING") return /* @__PURE__ */ u("div", {
454
554
  class: "IncodeFlow",
455
- children: /* @__PURE__ */ c(a, {
456
- config: t,
457
- onFinish: () => _.completeModule(),
458
- onError: (e) => {
459
- l?.(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");
460
560
  }
461
- }, `govt-validation-${h.currentStepIndex}`)
561
+ }, `govt-validation-${flowState.currentStepIndex}`)
462
562
  });
463
- if (e === "INE_VALIDATION") return /* @__PURE__ */ c("div", {
563
+ if (currentStep === "INE_VALIDATION") return /* @__PURE__ */ u("div", {
464
564
  class: "IncodeFlow",
465
- children: /* @__PURE__ */ c(a, {
466
- config: t,
467
- onFinish: () => _.completeModule(),
468
- onError: (e) => {
469
- l?.(e ?? "INE validation error");
565
+ children: /* @__PURE__ */ u(Component, {
566
+ config: flowConfig,
567
+ onFinish: () => flowManager.completeModule(),
568
+ onError: (error) => {
569
+ onError?.(error ?? "INE validation error");
470
570
  }
471
- }, `ine-validation-${h.currentStepIndex}`)
571
+ }, `ine-validation-${flowState.currentStepIndex}`)
472
572
  });
473
- if (e === "GEOLOCATION") return /* @__PURE__ */ c("div", {
573
+ if (currentStep === "GEOLOCATION") return /* @__PURE__ */ u("div", {
474
574
  class: "IncodeFlow",
475
- children: /* @__PURE__ */ c(a, {
476
- config: t,
477
- onFinish: () => _.completeModule(),
478
- onError: (e) => {
479
- l?.(e ?? "Geolocation error");
575
+ children: /* @__PURE__ */ u(Component, {
576
+ config: flowConfig,
577
+ onFinish: () => flowManager.completeModule(),
578
+ onError: (error) => {
579
+ onError?.(error ?? "Geolocation error");
480
580
  }
481
- }, `geolocation-${h.currentStepIndex}`)
581
+ }, `geolocation-${flowState.currentStepIndex}`)
482
582
  });
483
- if (e === "EXTERNAL_VERIFICATION") return /* @__PURE__ */ c("div", {
583
+ if (currentStep === "EXTERNAL_VERIFICATION") return /* @__PURE__ */ u("div", {
484
584
  class: "IncodeFlow",
485
- children: /* @__PURE__ */ c(a, {
486
- config: { flowId: h.flow.flowId },
487
- onFinish: () => _.completeModule(),
488
- onError: (e) => {
489
- l?.(e ?? "External verification 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");
490
590
  }
491
- }, `ekyc-${h.currentStepIndex}`)
591
+ }, `ekyc-${flowState.currentStepIndex}`)
492
592
  });
493
- if (e === "DOCUMENT_CAPTURE") return /* @__PURE__ */ c("div", {
593
+ if (currentStep === "DOCUMENT_CAPTURE") return /* @__PURE__ */ u("div", {
494
594
  class: "IncodeFlow",
495
- children: /* @__PURE__ */ c(a, {
496
- config: t,
497
- onFinish: () => _.completeModule(),
498
- onError: (e) => {
499
- l?.(e ?? "Document capture error");
595
+ children: /* @__PURE__ */ u(Component, {
596
+ config: flowConfig,
597
+ onFinish: () => flowManager.completeModule(),
598
+ onError: (error) => {
599
+ onError?.(error ?? "Document capture error");
500
600
  }
501
- }, `document-capture-${h.currentStepIndex}`)
601
+ }, `document-capture-${flowState.currentStepIndex}`)
502
602
  });
503
- if (e === "ADDRESS") return /* @__PURE__ */ c("div", {
603
+ if (currentStep === "ADDRESS") return /* @__PURE__ */ u("div", {
504
604
  class: "IncodeFlow",
505
- children: /* @__PURE__ */ c(a, {
605
+ children: /* @__PURE__ */ u(Component, {
506
606
  config: {
507
- ...t,
607
+ ...flowConfig,
508
608
  processingType: "addressStatement"
509
609
  },
510
- onFinish: () => _.completeModule(),
511
- onError: (e) => {
512
- l?.(e ?? "Address capture error");
610
+ onFinish: () => flowManager.completeModule(),
611
+ onError: (error) => {
612
+ onError?.(error ?? "Address capture error");
513
613
  }
514
- }, `address-${h.currentStepIndex}`)
614
+ }, `address-${flowState.currentStepIndex}`)
515
615
  });
516
- if (e === "SIGNATURE") return /* @__PURE__ */ c("div", {
616
+ if (currentStep === "SIGNATURE") return /* @__PURE__ */ u("div", {
517
617
  class: "IncodeFlow",
518
- children: /* @__PURE__ */ c(a, {
519
- config: t,
520
- onFinish: () => _.completeModule(),
521
- onError: (e) => {
522
- l?.(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");
523
623
  }
524
- }, `signature-${h.currentStepIndex}`)
624
+ }, `signature-${flowState.currentStepIndex}`)
525
625
  });
526
- if (e === "EKYB") {
527
- let e = t;
528
- return /* @__PURE__ */ c("div", {
626
+ if (currentStep === "EKYB") {
627
+ const ekybFlowConfig = flowConfig;
628
+ return /* @__PURE__ */ u("div", {
529
629
  class: "IncodeFlow",
530
- children: /* @__PURE__ */ c(a, {
630
+ children: /* @__PURE__ */ u(Component, {
531
631
  config: {
532
- flowId: i,
533
- checkBusinessName: e.checkBusinessName,
534
- checkAddress: e.checkAddress,
535
- checkTaxId: e.checkTaxId,
536
- checkUniqueBeneficialOwner: e.checkUniqueBeneficialOwner
632
+ flowId,
633
+ checkBusinessName: ekybFlowConfig.checkBusinessName,
634
+ checkAddress: ekybFlowConfig.checkAddress,
635
+ checkTaxId: ekybFlowConfig.checkTaxId,
636
+ checkUniqueBeneficialOwner: ekybFlowConfig.checkUniqueBeneficialOwner
537
637
  },
538
- onFinish: () => _.completeModule(),
539
- onError: (e) => {
540
- l?.(e ?? "eKYB verification error");
638
+ onFinish: () => flowManager.completeModule(),
639
+ onError: (error) => {
640
+ onError?.(error ?? "eKYB verification error");
541
641
  }
542
- }, `ekyb-${h.currentStepIndex}`)
642
+ }, `ekyb-${flowState.currentStepIndex}`)
543
643
  });
544
644
  }
545
- if (e === "COMBINED_CONSENT") return /* @__PURE__ */ c("div", {
645
+ if (currentStep === "COMBINED_CONSENT") return /* @__PURE__ */ u("div", {
546
646
  class: "IncodeFlow",
547
- children: /* @__PURE__ */ c(a, {
548
- config: t,
549
- onFinish: () => _.completeModule(),
550
- onError: (e) => {
551
- l?.(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");
552
652
  }
553
- }, `combined-consent-${h.currentStepIndex}`)
653
+ }, `combined-consent-${flowState.currentStepIndex}`)
554
654
  });
555
- if (e === "MANDATORY_CONSENT" || e === "ML_CONSENT") {
556
- let n = e === "ML_CONSENT";
557
- return /* @__PURE__ */ c("div", {
655
+ if (currentStep === "MANDATORY_CONSENT" || currentStep === "ML_CONSENT") {
656
+ const isMlConsent = currentStep === "ML_CONSENT";
657
+ return /* @__PURE__ */ u("div", {
558
658
  class: "IncodeFlow",
559
- children: /* @__PURE__ */ c(a, {
659
+ children: /* @__PURE__ */ u(Component, {
560
660
  config: {
561
- ...t,
562
- type: n ? "ML" : "MANDATORY"
661
+ ...flowConfig,
662
+ type: isMlConsent ? "ML" : "MANDATORY"
563
663
  },
564
- onFinish: () => _.completeModule(),
565
- onError: (e) => {
566
- l?.(e ?? (n ? "ML consent error" : "Mandatory consent error"));
664
+ onFinish: () => flowManager.completeModule(),
665
+ onError: (error) => {
666
+ onError?.(error ?? (isMlConsent ? "ML consent error" : "Mandatory consent error"));
567
667
  }
568
- }, `${n ? "ml" : "mandatory"}-consent-${h.currentStepIndex}`)
668
+ }, `${isMlConsent ? "ml" : "mandatory"}-consent-${flowState.currentStepIndex}`)
569
669
  });
570
670
  }
571
- if (e === "AE_SIGNATURE" || e === "QE_SIGNATURE") {
572
- let n = t, r = e === "QE_SIGNATURE" ? "qe" : "ae";
573
- return /* @__PURE__ */ c("div", {
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", {
574
675
  class: "IncodeFlow",
575
- children: /* @__PURE__ */ c(a, {
676
+ children: /* @__PURE__ */ u(Component, {
576
677
  config: {
577
- uploadDocument: n.uploadDocument,
578
- downloadDocument: n.downloadDocument
678
+ uploadDocument: sigConfig.uploadDocument,
679
+ downloadDocument: sigConfig.downloadDocument
579
680
  },
580
- onFinish: () => _.completeModule(),
581
- onError: (e) => {
582
- l?.(e ?? `${r.toUpperCase()} Signature error`);
681
+ onFinish: () => flowManager.completeModule(),
682
+ onError: (error) => {
683
+ onError?.(error ?? `${label.toUpperCase()} Signature error`);
583
684
  }
584
- }, `${r}-signature-${h.currentStepIndex}`)
685
+ }, `${label}-signature-${flowState.currentStepIndex}`)
585
686
  });
586
687
  }
587
- if (e === "ANTIFRAUD") return /* @__PURE__ */ c("div", {
688
+ if (currentStep === "ANTIFRAUD") return /* @__PURE__ */ u("div", {
588
689
  class: "IncodeFlow",
589
- children: /* @__PURE__ */ c(a, {
590
- onFinish: () => _.completeModule(),
591
- onError: (e) => {
592
- l?.(e ?? "Antifraud check error");
690
+ children: /* @__PURE__ */ u(Component, {
691
+ onFinish: () => flowManager.completeModule(),
692
+ onError: (error) => {
693
+ onError?.(error ?? "Antifraud check error");
593
694
  }
594
- }, `antifraud-${h.currentStepIndex}`)
695
+ }, `antifraud-${flowState.currentStepIndex}`)
595
696
  });
596
- if (e === "CUSTOM_FIELDS") return /* @__PURE__ */ c("div", {
697
+ if (currentStep === "CUSTOM_FIELDS") return /* @__PURE__ */ u("div", {
597
698
  class: "IncodeFlow",
598
- children: /* @__PURE__ */ c(a, {
599
- config: t,
600
- onFinish: () => _.completeModule(),
601
- onError: (e) => {
602
- l?.(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");
603
704
  }
604
- }, `custom-fields-${h.currentStepIndex}`)
705
+ }, `custom-fields-${flowState.currentStepIndex}`)
605
706
  });
606
- if (e === "WATCHLIST") return /* @__PURE__ */ c("div", {
707
+ if (currentStep === "WATCHLIST") return /* @__PURE__ */ u("div", {
607
708
  class: "IncodeFlow",
608
- children: /* @__PURE__ */ c(a, {
609
- onFinish: () => _.completeModule(),
610
- onError: (e) => {
611
- l?.(e ?? "Watchlist check error");
709
+ children: /* @__PURE__ */ u(Component, {
710
+ onFinish: () => flowManager.completeModule(),
711
+ onError: (error) => {
712
+ onError?.(error ?? "Watchlist check error");
612
713
  }
613
- }, `watchlist-${h.currentStepIndex}`)
714
+ }, `watchlist-${flowState.currentStepIndex}`)
614
715
  });
615
- if (e === "WATCHLIST_BUSINESS") return /* @__PURE__ */ c("div", {
716
+ if (currentStep === "WATCHLIST_BUSINESS") return /* @__PURE__ */ u("div", {
616
717
  class: "IncodeFlow",
617
- children: /* @__PURE__ */ c(a, {
618
- onFinish: () => _.completeModule(),
619
- onError: (e) => {
620
- l?.(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");
621
722
  }
622
- }, `watchlist-for-business-${h.currentStepIndex}`)
723
+ }, `watchlist-for-business-${flowState.currentStepIndex}`)
623
724
  });
624
- if (e === "INCODE_WATCHLIST") return /* @__PURE__ */ c("div", {
725
+ if (currentStep === "INCODE_WATCHLIST") return /* @__PURE__ */ u("div", {
625
726
  class: "IncodeFlow",
626
- children: /* @__PURE__ */ c(a, {
627
- config: t,
628
- onFinish: () => _.completeModule(),
629
- onError: (e) => {
630
- l?.(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");
631
732
  }
632
- }, `incode-watchlist-${h.currentStepIndex}`)
733
+ }, `incode-watchlist-${flowState.currentStepIndex}`)
633
734
  });
634
- if (e === "CROSS_DOCUMENT_DATA_MATCH") return /* @__PURE__ */ c("div", {
735
+ if (currentStep === "CROSS_DOCUMENT_DATA_MATCH") return /* @__PURE__ */ u("div", {
635
736
  class: "IncodeFlow",
636
- children: /* @__PURE__ */ c(a, {
637
- onFinish: () => _.completeModule(),
638
- onError: (e) => {
639
- l?.(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");
640
741
  }
641
- }, `cross-document-data-match-${h.currentStepIndex}`)
742
+ }, `cross-document-data-match-${flowState.currentStepIndex}`)
642
743
  });
643
- if (e === "FIELD_COMPARISON") return /* @__PURE__ */ c("div", {
744
+ if (currentStep === "FIELD_COMPARISON") return /* @__PURE__ */ u("div", {
644
745
  class: "IncodeFlow",
645
- children: /* @__PURE__ */ c(a, {
646
- onFinish: () => _.completeModule(),
647
- onError: (e) => {
648
- l?.(e ?? "Field comparison error");
746
+ children: /* @__PURE__ */ u(Component, {
747
+ onFinish: () => flowManager.completeModule(),
748
+ onError: (error) => {
749
+ onError?.(error ?? "Field comparison error");
649
750
  }
650
- }, `field-comparison-${h.currentStepIndex}`)
751
+ }, `field-comparison-${flowState.currentStepIndex}`)
651
752
  });
652
- if (e === "DYNAMIC_FORMS") return /* @__PURE__ */ c("div", {
753
+ if (currentStep === "DYNAMIC_FORMS") return /* @__PURE__ */ u("div", {
653
754
  class: "IncodeFlow",
654
- children: /* @__PURE__ */ c(a, {
655
- config: { screens: t.screens.map((e) => ({
656
- title: e.title,
657
- hideTitle: e.hideTitle,
658
- questions: e.questions.map((e) => ({
659
- questionId: e.questionId,
660
- question: e.question,
661
- inputType: e.inputType,
662
- isOptional: e.isOptional,
663
- overrides: e.overrides ?? void 0,
664
- isPredefined: e.isPredefined,
665
- options: e.options
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
666
767
  }))
667
768
  })) },
668
- onFinish: () => _.completeModule(),
669
- onError: (e) => {
670
- l?.(e ?? "Dynamic forms error");
769
+ onFinish: () => flowManager.completeModule(),
770
+ onError: (error) => {
771
+ onError?.(error ?? "Dynamic forms error");
671
772
  }
672
- }, `dynamic-forms-${h.currentStepIndex}`)
773
+ }, `dynamic-forms-${flowState.currentStepIndex}`)
673
774
  });
674
775
  }
675
776
  return null;
676
- }, J = ({ config: e, onFinish: t = () => {}, onError: n }) => /* @__PURE__ */ c(d, { children: e ? /* @__PURE__ */ c(q, {
677
- config: e,
678
- onFinish: t,
679
- onError: n
680
- }) : null });
681
- p(J, "incode-flow");
777
+ };
778
+ var IncodeFlow = ({ config, onFinish = () => {}, onError }) => {
779
+ return /* @__PURE__ */ u(IncodeComponent, { children: config ? /* @__PURE__ */ u(IncodeFlowContent, {
780
+ config,
781
+ onFinish,
782
+ onError
783
+ }) : null });
784
+ };
785
+ registerIncodeModuleElement(IncodeFlow, "incode-flow");
682
786
  //#endregion
683
- export { J as IncodeFlow, B as preloadIncodeFlow };
787
+ export { IncodeFlow, preloadIncodeFlow };