@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,244 +1,330 @@
1
- import { n as e } from "../i18n-9s4OSqwi.js";
2
- import { _ as t, c as n, l as r, o as i, p as a, v as o } from "../vendor-preact-D6SntenC.js";
3
- import { t as s } from "../uiConfig-CwpQ-IM6.js";
4
- import { o as c } from "../hooks-BVnGysT7.js";
5
- import { t as l } from "../incodeComponent-C1o4M0ZK.js";
6
- import "../spinner-B4dcie2T.js";
7
- import { t as u } from "../transitionSpinner-PIEPU2Vx.js";
8
- import { t as d } from "../incodeModule-BqCjVgEI.js";
9
- import { a as f, g as p, i as m, m as h, s as g, t as _ } from "../useModuleLoader-BFiVA41N.js";
10
- import { resolveWasmConfig as v, upgradeToWasmHttpClient as y, warmupWasm as b } from "@incodetech/core/wasm";
11
- import { getDeviceClass as x } from "@incodetech/core/device";
12
- import { QrValidationError as S, refreshQrUrlUuid as C } from "@incodetech/core/session";
13
- import { createWorkflowManager as w } from "@incodetech/core/workflow";
1
+ import { n as useTranslation, o as readStoredLanguage } from "../i18n-CoCO2ZuN.js";
2
+ import { _ as y, c as z, 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 { a as resolveApiKey, g as setupSDK, i as HEADLESS_WORKFLOW_MODULE_KEYS, l as LAZY_UI_MODULES, o as extractIncodeStatus, s as UnsupportedModule, t as useModuleLoader, v as fetchAndApplyTheme, y as TerminalErrorPage } from "../useModuleLoader-CeJ2jL25.js";
9
+ import { resolveWasmConfig, upgradeToWasmHttpClient, warmupWasm } from "@incodetech/core/wasm";
10
+ import { getDeviceClass } from "@incodetech/core/device";
11
+ import { bootstrapSession, refreshQrUrlUuid } from "@incodetech/core/session";
12
+ import { createWorkflowManager } from "@incodetech/core/workflow";
14
13
  //#region src/modules/workflow/workflowInit.ts
15
- var T = {
16
- ...g,
17
- REDIRECT_TO_MOBILE: () => import("../redirectToMobile-C3k1gloW.js").then((e) => e.RedirectToMobile),
18
- ID: () => import("../id-verification/id-verification.es.js").then((e) => e.IdVerification)
14
+ var LAZY_WORKFLOW_MODULES = {
15
+ ...LAZY_UI_MODULES,
16
+ REDIRECT_TO_MOBILE: () => import("../redirect-to-mobile/redirect-to-mobile.es.js").then((m) => m.RedirectToMobile),
17
+ ID: () => import("../id-verification/id-verification.es.js").then((m) => m.IdVerification),
18
+ IDENTITY_REUSE: () => import("../identity-reuse/identity-reuse.es.js").then((m) => m.IdentityReuse)
19
19
  };
20
- async function E() {
20
+ async function fetchWorkflowTheme() {
21
21
  try {
22
- let e = await p();
22
+ const theme = await fetchAndApplyTheme();
23
23
  return {
24
- theme: e,
24
+ theme,
25
25
  uiConfig: {
26
- logoSrc: e.logo,
27
- hideFooterBranding: e.hideFooterBranding
26
+ logoSrc: theme.logo,
27
+ hideFooterBranding: theme.hideFooterBranding
28
28
  }
29
29
  };
30
30
  } catch {
31
31
  return {};
32
32
  }
33
33
  }
34
- function D(e = {}) {
35
- return w({
36
- customModuleCallback: e.customModuleCallback,
37
- interviewId: e.interviewId,
38
- isDesktop: e.isDesktop ?? x() === "desktop"
34
+ function createWorkflowUIManager(options = {}) {
35
+ return createWorkflowManager({
36
+ customModuleCallback: options.customModuleCallback,
37
+ interviewId: options.interviewId,
38
+ isDesktop: options.isDesktop ?? getDeviceClass() === "desktop"
39
39
  });
40
40
  }
41
- function O(e) {
42
- if (e === !1) return;
43
- let t = v({
44
- ...e,
45
- pipelines: e?.pipelines ?? ["selfie", "idCapture"]
46
- }), n = {
47
- ...t,
48
- pipelines: t.pipelines ? [...t.pipelines] : void 0
41
+ function warmupWorkflowWasm(wasmConfig) {
42
+ if (wasmConfig === false) return;
43
+ const resolved = resolveWasmConfig({
44
+ ...wasmConfig,
45
+ pipelines: wasmConfig?.pipelines ?? ["selfie", "idCapture"]
46
+ });
47
+ const upgradeConfig = {
48
+ ...resolved,
49
+ pipelines: resolved.pipelines ? [...resolved.pipelines] : void 0
49
50
  };
50
- b(t).then(() => y(n)).catch((e) => {
51
- console.error("Workflow WASM warmup failed:", e);
51
+ warmupWasm(resolved).then(() => upgradeToWasmHttpClient(upgradeConfig)).catch((error) => {
52
+ console.error("Workflow WASM warmup failed:", error);
52
53
  });
53
54
  }
54
55
  //#endregion
56
+ //#region src/modules/workflow/createWorkflowSession.ts
57
+ async function createWorkflowSession(config, signal) {
58
+ return bootstrapSession(await resolveApiKey(config), {
59
+ configurationId: config.configurationId,
60
+ externalId: config.externalId,
61
+ externalCustomerId: config.externalCustomerId,
62
+ language: config.lang,
63
+ customFields: config.customFields,
64
+ uuid: config.uuid,
65
+ urlUuid: config.urlUuid,
66
+ loginHint: config.loginHint,
67
+ onUrlUuidRefreshed: config.onUrlUuidRefreshed
68
+ }, signal);
69
+ }
70
+ //#endregion
71
+ //#region src/modules/workflow/workflowConfig.ts
72
+ function hasWorkflowToken(config) {
73
+ return typeof config.token === "string";
74
+ }
75
+ function isSelfLoadingWorkflowConfig(config) {
76
+ const bootstrapConfig = config;
77
+ return typeof bootstrapConfig.configurationId === "string" && (typeof bootstrapConfig.apiKey === "string" || typeof bootstrapConfig.clientId === "string");
78
+ }
79
+ //#endregion
55
80
  //#region src/modules/workflow/useWorkflowInitialization.ts
56
- function k(e) {
57
- let { token: n, lang: i, disableDashboardTheme: o, wasmConfig: c, customModuleCallback: l, interviewId: u, isDesktop: d, urlUuid: f, onError: p, onUrlUuidRefreshed: m } = e, g = r(null), [_, v] = a(() => {
58
- let e = D({
59
- customModuleCallback: l,
60
- interviewId: u,
61
- isDesktop: d
62
- });
63
- return g.current = e, {
64
- status: "initializing",
65
- workflowManager: e
66
- };
67
- }), y = r(!1);
68
- return t(() => {
69
- if (_.status !== "initializing" || y.current) return;
70
- y.current = !0;
71
- let e = g.current, t = new AbortController(), { signal: r } = t;
72
- return (async () => {
81
+ function useWorkflowInitialization(options) {
82
+ const { onError, onUrlUuidRefreshed } = options;
83
+ const [state, setState] = d({ status: "initializing" });
84
+ const managerRef = A(null);
85
+ y(() => {
86
+ if (state.status !== "initializing") return;
87
+ const abortController = new AbortController();
88
+ const { signal } = abortController;
89
+ const initialize = async () => {
73
90
  try {
74
- await h({
75
- token: n,
76
- lang: i
77
- }), f && await C({
78
- urlUuid: f,
79
- onboardingId: null,
80
- onRefreshed: m
81
- }, r);
82
- let t = o ? Promise.resolve() : E().then((e) => {
83
- e.uiConfig && s(e.uiConfig);
91
+ let resolvedToken;
92
+ let resolvedInterviewId;
93
+ if (hasWorkflowToken(options)) {
94
+ resolvedToken = options.token;
95
+ resolvedInterviewId = options.interviewId;
96
+ if (options.urlUuid) await refreshQrUrlUuid({
97
+ urlUuid: options.urlUuid,
98
+ onboardingId: null,
99
+ onRefreshed: onUrlUuidRefreshed
100
+ }, signal);
101
+ } else if (isSelfLoadingWorkflowConfig(options)) {
102
+ const session = await createWorkflowSession(options, signal);
103
+ resolvedToken = session.token;
104
+ resolvedInterviewId = session.interviewId;
105
+ } else throw new Error("Workflow requires token, or configurationId with apiKey or clientId");
106
+ if (signal.aborted) return;
107
+ await setupSDK({
108
+ token: resolvedToken,
109
+ lang: options.lang
84
110
  });
85
- O(c), e.load(), await t, v({
111
+ if (signal.aborted) return;
112
+ const themePromise = options.disableDashboardTheme ? Promise.resolve() : fetchWorkflowTheme().then((result) => {
113
+ if (result.uiConfig) setUiConfig(result.uiConfig);
114
+ });
115
+ warmupWorkflowWasm(options.wasmConfig);
116
+ if (signal.aborted) return;
117
+ managerRef.current = createWorkflowUIManager({
118
+ customModuleCallback: options.customModuleCallback,
119
+ interviewId: resolvedInterviewId,
120
+ isDesktop: options.isDesktop
121
+ });
122
+ managerRef.current.load();
123
+ await themePromise;
124
+ if (signal.aborted) return;
125
+ setState({
86
126
  status: "ready",
87
- workflowManager: e
127
+ workflowManager: managerRef.current
88
128
  });
89
- } catch (t) {
90
- if (r.aborted) return;
91
- let n = t instanceof Error ? t.message : "Failed to initialize SDK", i = t instanceof S ? t.status : void 0;
92
- v({
129
+ } catch (error) {
130
+ if (signal.aborted) return;
131
+ const errorMessage = error instanceof Error ? error.message : "Failed to initialize SDK";
132
+ const errorCode = extractIncodeStatus(error);
133
+ setState({
93
134
  status: "error",
94
- error: n,
95
- errorCode: i,
96
- workflowManager: e
97
- }), p?.(n, i);
135
+ error: errorMessage,
136
+ errorCode
137
+ });
138
+ onError?.(errorMessage, errorCode);
98
139
  }
99
- })(), () => {
100
- t.abort(), e?.stop();
101
140
  };
102
- }, [
103
- n,
104
- i,
105
- o,
106
- c,
107
- f,
108
- p,
109
- m
110
- ]), _;
141
+ initialize();
142
+ return () => {
143
+ abortController.abort();
144
+ managerRef.current?.stop();
145
+ managerRef.current = null;
146
+ };
147
+ }, []);
148
+ return state;
111
149
  }
112
150
  //#endregion
113
151
  //#region src/modules/workflow/workflow.tsx
114
- var A = n(() => import("../homeScreen-DnP1jw9A.js").then((e) => ({ default: e.HomeScreen })));
115
- function j(e) {
116
- let { moduleKey: t, config: n, workflowId: r, authHint: i, lang: a, mergeSessionRecordings: o, ageAssurance: s } = e;
117
- switch (t) {
152
+ var LazyHomeScreen = z(() => import("../homeScreen-BZnIEDrV.js").then((module) => ({ default: module.HomeScreen })));
153
+ function mapModuleConfig(options) {
154
+ const { moduleKey, config, workflowId, authHint, lang, mergeSessionRecordings, ageAssurance } = options;
155
+ switch (moduleKey) {
118
156
  case "AUTHENTICATION": return {
119
- ...n,
120
- authHint: i
157
+ ...config,
158
+ authHint
121
159
  };
122
160
  case "REDIRECT_TO_MOBILE": return {
123
- ...n,
124
- flowId: r,
125
- authHint: i,
126
- lang: a
161
+ ...config,
162
+ flowId: workflowId,
163
+ authHint,
164
+ lang
127
165
  };
128
166
  case "ID_CAPTURE":
129
167
  case "TUTORIAL_ID": return {
130
- ...n,
131
- mergeSessionRecordings: n.mergeSessionRecordings ?? o,
132
- ageAssurance: n.ageAssurance ?? s,
133
- skipProcessId: !0
168
+ ...config,
169
+ mergeSessionRecordings: config.mergeSessionRecordings ?? mergeSessionRecordings,
170
+ ageAssurance: config.ageAssurance ?? ageAssurance,
171
+ skipProcessId: true
134
172
  };
135
- case "ID": return n;
173
+ case "ID": return config;
136
174
  case "SELFIE": return {
137
- ...n,
138
- ageAssurance: n.ageAssurance ?? s
175
+ ...config,
176
+ ageAssurance: config.ageAssurance ?? ageAssurance
139
177
  };
140
178
  case "ADDRESS": return {
141
- ...n,
179
+ ...config,
142
180
  processingType: "addressStatement"
143
181
  };
144
182
  case "SECOND_ID": return {
145
- ...n,
146
- isSecondId: !0
183
+ ...config,
184
+ isSecondId: true
185
+ };
186
+ case "MANDATORY_CONSENT": return {
187
+ ...config,
188
+ type: "MANDATORY"
147
189
  };
148
- default: return n;
190
+ default: return config;
149
191
  }
150
192
  }
151
- var M = ({ config: n, onFinish: a, onError: s }) => {
152
- let { i18n: l } = e(), d = k({
153
- token: n.token,
154
- lang: n.lang,
155
- disableDashboardTheme: n.disableDashboardTheme,
156
- wasmConfig: n.wasmConfig,
157
- customModuleCallback: n.customModuleCallback,
158
- interviewId: n.interviewId,
159
- isDesktop: n.isDesktop,
160
- urlUuid: n.urlUuid,
161
- onError: s,
162
- onUrlUuidRefreshed: n.onUrlUuidRefreshed
163
- }), [p, h] = c(() => d.workflowManager, { autoLoad: !1 }), g = _({
164
- moduleKey: p?.status === "ready" ? p.currentNode.moduleKey : void 0,
165
- modules: T,
166
- headlessModuleKeys: m,
167
- onModuleLoading: n.onModuleLoading,
168
- onModuleLoaded: n.onModuleLoaded,
169
- onError: s
193
+ /**
194
+ * Inner component mounted only after `useWorkflowInitialization` has resolved
195
+ * the session and constructed the manager. Splitting this out keeps the
196
+ * `useManager` factory call out of the init path — token-mode and
197
+ * self-loading mode both arrive here with a fully-constructed manager.
198
+ */
199
+ var IncodeWorkflowReady = ({ config, workflowManager: initialManager, onFinish, onError }) => {
200
+ const [workflowState, workflowManager] = useManager(() => initialManager, {
201
+ autoLoad: false,
202
+ manageLifecycle: false
170
203
  });
171
- t(() => {
172
- n.lang && l.language !== n.lang && l.changeLanguage(n.lang);
173
- }, [n.lang, l]);
174
- let v = r(!1);
175
- t(() => {
176
- v.current || (p?.status === "finished" ? (v.current = !0, a?.(p.finishStatus)) : p?.status === "asyncResolution" && (v.current = !0, a?.()));
177
- }, [
178
- p?.status,
179
- a,
180
- p
181
- ]), t(() => {
182
- p?.status === "error" && s && s(p.error, p.errorCode);
204
+ const moduleLoaderState = useModuleLoader({
205
+ moduleKey: workflowState?.status === "ready" ? workflowState.currentNode.moduleKey : void 0,
206
+ modules: LAZY_WORKFLOW_MODULES,
207
+ headlessModuleKeys: HEADLESS_WORKFLOW_MODULE_KEYS,
208
+ onModuleLoading: config.onModuleLoading,
209
+ onModuleLoaded: config.onModuleLoaded,
210
+ onError
211
+ });
212
+ const terminalFiredRef = A(false);
213
+ y(() => {
214
+ if (terminalFiredRef.current) return;
215
+ if (workflowState?.status === "finished") {
216
+ terminalFiredRef.current = true;
217
+ const finishStatus = workflowState.finishStatus;
218
+ queueMicrotask(() => onFinish?.(finishStatus));
219
+ return;
220
+ }
221
+ if (workflowState?.status === "asyncResolution") {
222
+ terminalFiredRef.current = true;
223
+ queueMicrotask(() => onFinish?.());
224
+ return;
225
+ }
226
+ if (workflowState?.status === "error" && onError) {
227
+ terminalFiredRef.current = true;
228
+ const { error, errorCode } = workflowState;
229
+ queueMicrotask(() => onError(error, errorCode));
230
+ }
183
231
  }, [
184
- p?.status,
185
- s,
186
- p
232
+ workflowState?.status,
233
+ onFinish,
234
+ onError,
235
+ workflowState
187
236
  ]);
188
- let y = !(n.spinnerConfig?.title || n.spinnerConfig?.subtitle), b = () => /* @__PURE__ */ o("div", {
237
+ const hideSpinnerText = !(config.spinnerConfig?.title || config.spinnerConfig?.subtitle);
238
+ const renderSpinner = () => /* @__PURE__ */ u("div", {
189
239
  class: "IncodeWorkflow",
190
- children: /* @__PURE__ */ o(u, {
191
- spinnerConfig: n.spinnerConfig,
192
- hideText: y
240
+ children: /* @__PURE__ */ u(TransitionSpinner, {
241
+ spinnerConfig: config.spinnerConfig,
242
+ hideText: hideSpinnerText
193
243
  })
194
- }), x = (e) => {
195
- h.errorModule(e ?? "Module error"), s?.(e ?? "Module error");
244
+ });
245
+ const handleModuleError = (error, _errorCode, moduleErrorCode) => {
246
+ workflowManager.errorModule(error ?? "Module error", moduleErrorCode);
196
247
  };
197
- if (d.status === "error") return null;
198
- if (d.status === "initializing") return b();
199
- if (p && "homeScreen" in p && p.homeScreen.visible) return /* @__PURE__ */ o("div", {
248
+ if (workflowState && "homeScreen" in workflowState && workflowState.homeScreen.visible) return /* @__PURE__ */ u("div", {
200
249
  class: "IncodeWorkflow",
201
- children: /* @__PURE__ */ o(i, {
250
+ children: /* @__PURE__ */ u(P, {
202
251
  fallback: null,
203
- children: /* @__PURE__ */ o(A, {
204
- isContinueLoading: p.homeScreen.isContinueLoading,
205
- onContinue: () => h.continueFromHome()
252
+ children: /* @__PURE__ */ u(LazyHomeScreen, {
253
+ isContinueLoading: workflowState.homeScreen.isContinueLoading,
254
+ onContinue: () => workflowManager.continueFromHome()
206
255
  })
207
256
  })
208
257
  });
209
- if (!p || p.status === "idle" || p.status === "loading") return b();
210
- if (p.status === "finished" || p.status === "error" || p.status === "asyncResolution" || p.status === "closed") return null;
211
- if (g.status === "unsupported") return /* @__PURE__ */ o("div", {
258
+ if (!workflowState || workflowState.status === "idle" || workflowState.status === "loading") return renderSpinner();
259
+ if (workflowState.status === "error") return /* @__PURE__ */ u("div", {
260
+ class: "IncodeWorkflow",
261
+ children: /* @__PURE__ */ u(TerminalErrorPage, { message: workflowState.error })
262
+ });
263
+ if (workflowState.status === "finished" || workflowState.status === "asyncResolution" || workflowState.status === "closed") return null;
264
+ if (moduleLoaderState.status === "unsupported") return /* @__PURE__ */ u("div", {
212
265
  class: "IncodeWorkflow",
213
- children: /* @__PURE__ */ o(f, {
214
- moduleKey: p.currentNode.moduleKey,
215
- onNext: () => h.completeModule()
266
+ children: /* @__PURE__ */ u(UnsupportedModule, {
267
+ moduleKey: workflowState.currentNode.moduleKey,
268
+ onNext: () => workflowManager.completeModule()
216
269
  })
217
270
  });
218
- if (g.status === "idle" || g.status === "loading" || g.status === "error") return b();
219
- let { Component: S } = g;
220
- return /* @__PURE__ */ o("div", {
271
+ if (moduleLoaderState.status === "idle" || moduleLoaderState.status === "loading" || moduleLoaderState.status === "error") return renderSpinner();
272
+ const { Component } = moduleLoaderState;
273
+ const moduleConfig = mapModuleConfig({
274
+ moduleKey: workflowState.currentNode.moduleKey,
275
+ config: workflowState.config,
276
+ workflowId: workflowState.workflowConfig.id,
277
+ authHint: config.authHint,
278
+ lang: config.lang,
279
+ mergeSessionRecordings: workflowState.workflowConfig.mergeSessionRecordings,
280
+ ageAssurance: workflowState.workflowConfig.ageAssurance
281
+ });
282
+ let extraProps = {};
283
+ if (workflowState.currentNode.moduleKey === "REDIRECT_TO_MOBILE") extraProps = { onContinue: () => workflowManager.completeModule() };
284
+ return /* @__PURE__ */ u("div", {
285
+ class: "IncodeWorkflow",
286
+ children: /* @__PURE__ */ u(Component, {
287
+ config: moduleConfig,
288
+ onFinish: () => workflowManager.completeModule(),
289
+ onError: handleModuleError,
290
+ ...extraProps
291
+ }, workflowState.currentNode.id)
292
+ });
293
+ };
294
+ var IncodeWorkflowContent = ({ config, onFinish, onError }) => {
295
+ const { i18n } = useTranslation();
296
+ const initState = useWorkflowInitialization({
297
+ ...config,
298
+ onError
299
+ });
300
+ y(() => {
301
+ if (readStoredLanguage()) return;
302
+ if (config.lang && i18n.language !== config.lang) i18n.changeLanguage(config.lang);
303
+ }, [config.lang, i18n]);
304
+ const hideSpinnerText = !(config.spinnerConfig?.title || config.spinnerConfig?.subtitle);
305
+ if (initState.status === "error") return /* @__PURE__ */ u("div", {
221
306
  class: "IncodeWorkflow",
222
- children: /* @__PURE__ */ o(S, {
223
- config: j({
224
- moduleKey: p.currentNode.moduleKey,
225
- config: p.config,
226
- workflowId: p.workflowConfig.id,
227
- authHint: n.authHint,
228
- lang: n.lang,
229
- mergeSessionRecordings: p.workflowConfig.mergeSessionRecordings,
230
- ageAssurance: p.workflowConfig.ageAssurance
231
- }),
232
- onFinish: () => h.completeModule(),
233
- onError: x,
234
- ...p.currentNode.moduleKey === "REDIRECT_TO_MOBILE" ? { onContinue: () => h.completeModule() } : {}
235
- }, p.currentNode.id)
307
+ children: /* @__PURE__ */ u(TerminalErrorPage, { message: initState.error })
236
308
  });
237
- }, N = ({ config: e, onFinish: t, onError: n }) => /* @__PURE__ */ o(l, { children: e ? /* @__PURE__ */ o(M, {
238
- config: e,
239
- onFinish: t,
240
- onError: n
309
+ if (initState.status === "initializing") return /* @__PURE__ */ u("div", {
310
+ class: "IncodeWorkflow",
311
+ children: /* @__PURE__ */ u(TransitionSpinner, {
312
+ spinnerConfig: config.spinnerConfig,
313
+ hideText: hideSpinnerText
314
+ })
315
+ });
316
+ return /* @__PURE__ */ u(IncodeWorkflowReady, {
317
+ config,
318
+ workflowManager: initState.workflowManager,
319
+ onFinish,
320
+ onError
321
+ });
322
+ };
323
+ var IncodeWorkflow = ({ config, onFinish, onError }) => /* @__PURE__ */ u(IncodeComponent, { children: config ? /* @__PURE__ */ u(IncodeWorkflowContent, {
324
+ config,
325
+ onFinish,
326
+ onError
241
327
  }) : null });
242
- d(N, "incode-workflow");
328
+ registerIncodeModuleElement(IncodeWorkflow, "incode-workflow");
243
329
  //#endregion
244
- export { N as IncodeWorkflow, j as mapModuleConfig };
330
+ export { IncodeWorkflow, mapModuleConfig };
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "2.0.1",
3
+ "version": "2.1.0-rc.1",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/IncodeTechnologies/incode-web-sdk.git"
7
+ },
4
8
  "type": "module",
5
9
  "main": "./dist/index.es.js",
6
10
  "types": "./dist/types/index.d.ts",
@@ -154,7 +158,7 @@
154
158
  "import": "./dist/extensibility.es.js"
155
159
  },
156
160
  "./redirect-to-mobile": {
157
- "source": "./src/modules/redirect-to-mobile/redirectToMobile.tsx",
161
+ "source": "./src/modules/redirect-to-mobile/redirect-to-mobile.tsx",
158
162
  "types": "./dist/types/redirect-to-mobile.d.ts",
159
163
  "import": "./dist/redirect-to-mobile/redirect-to-mobile.es.js"
160
164
  },
@@ -180,6 +184,15 @@
180
184
  "source": "./src/modules/antifraud/styles.css",
181
185
  "default": "./dist/antifraud/styles.css"
182
186
  },
187
+ "./field-comparison": {
188
+ "source": "./src/modules/field-comparison/fieldComparison.tsx",
189
+ "types": "./dist/types/field-comparison.d.ts",
190
+ "import": "./dist/field-comparison/field-comparison.es.js"
191
+ },
192
+ "./field-comparison/styles.css": {
193
+ "source": "./src/modules/field-comparison/styles.css",
194
+ "default": "./dist/field-comparison/styles.css"
195
+ },
183
196
  "./electronic-signature": {
184
197
  "source": "./src/modules/electronic-signature/electronic-signature.tsx",
185
198
  "types": "./dist/types/electronic-signature.d.ts",
@@ -226,12 +239,15 @@
226
239
  "dist"
227
240
  ],
228
241
  "dependencies": {
242
+ "@fontsource/dm-sans": "^5.2.8",
243
+ "@fontsource/rethink-sans": "^5.2.8",
229
244
  "@tailwindcss/vite": "^4.2.2",
230
245
  "dompurify": "^3.3.3",
231
246
  "i18next": "^25.7.1",
232
247
  "i18next-browser-languagedetector": "^8.2.0",
233
248
  "i18next-http-backend": "^3.0.2",
234
249
  "libphonenumber-js": "^1.11.0",
250
+ "lottie-web": "5.13.0",
235
251
  "marked": "^17.0.5",
236
252
  "pdfjs-dist": "~5.4.624",
237
253
  "preact-custom-element": "^4.6.0",
@@ -239,30 +255,34 @@
239
255
  "qrcode": "^1.5.4",
240
256
  "signature_pad": "^5.1.3",
241
257
  "tailwindcss": "^4.1.17",
242
- "@incodetech/core": "2.0.1"
258
+ "@incodetech/core": "2.1.0-rc.1"
243
259
  },
244
260
  "devDependencies": {
245
261
  "@microsoft/api-extractor": "^7.53.3",
246
262
  "@preact/preset-vite": "^2.10.5",
247
- "@storybook/addon-a11y": "^8.6.14",
248
- "@storybook/addon-essentials": "^8.6.14",
249
- "@storybook/addon-themes": "^8.6.14",
250
- "@storybook/blocks": "^8.6.14",
251
- "@storybook/preact": "^8.6.14",
252
- "@storybook/preact-vite": "^8.6.14",
263
+ "@storybook/addon-a11y": "^10.4.1",
264
+ "@storybook/addon-themes": "^10.4.1",
265
+ "@storybook/addon-vitest": "^10.4.1",
266
+ "@storybook/preact": "^10.4.1",
267
+ "@storybook/preact-vite": "^10.4.1",
268
+ "@storybook/react-dom-shim": "^10.4.1",
253
269
  "@tailwindcss/postcss": "^4.1.17",
254
270
  "@testing-library/preact": "^3.2.4",
255
271
  "@types/node": "^22.10.5",
256
272
  "@types/qrcode": "^1.5.6",
257
273
  "@vitejs/plugin-basic-ssl": "^2.3.0",
274
+ "@vitest/browser": "4.0.13",
275
+ "@vitest/browser-playwright": "4.0.13",
258
276
  "@vitest/coverage-v8": "^4.0.13",
259
277
  "happy-dom": "^20.7.0",
278
+ "playwright": "^1.60.0",
260
279
  "postcss": "^8.5.6",
261
280
  "postcss-import": "^16.1.1",
262
281
  "preact": "^10.27.2",
263
282
  "rollup-plugin-visualizer": "^7.0.1",
264
- "storybook": "^8.6.14",
283
+ "storybook": "^10.4.1",
265
284
  "stylelint": "^17.5.0",
285
+ "terser": "^5.48.0",
266
286
  "typescript": "^5.9.3",
267
287
  "vite": "^8.0.0",
268
288
  "vite-plugin-dts": "^4.5.4",
@@ -272,9 +292,11 @@
272
292
  },
273
293
  "scripts": {
274
294
  "build": "rm -rf dist && vite build",
295
+ "build:cdn": "rm -rf dist && NODE_OPTIONS=--experimental-strip-types BUILD_TARGET=cdn vite build",
275
296
  "build:dev": "NODE_ENV=development vite build",
276
297
  "build:analyze": "rm -rf dist && ANALYZE=1 vite build && echo '\\nBundle report: packages/ui/dist/stats.html\\n'",
277
298
  "test": "vitest run",
299
+ "test:a11y": "VITE_STORYBOOK_A11Y=true vitest run",
278
300
  "coverage": "vitest run --coverage",
279
301
  "lint": "eslint . && pnpm lint:styles",
280
302
  "lint:fix": "eslint . --fix && pnpm lint:styles",