@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,279 +1,323 @@
1
- import { n as e } from "../i18n-9s4OSqwi.js";
2
- import { S as t, d as n, v as r } from "../vendor-preact-D6SntenC.js";
3
- import { o as i } from "../hooks-BVnGysT7.js";
4
- import { t as a } from "../incodeComponent-C1o4M0ZK.js";
5
- import { r as o } from "../loadingIcon-BN5YRQUb.js";
6
- import { t as s } from "../page-C1yT4DLb.js";
7
- import { t as c } from "../transitionSpinner-PIEPU2Vx.js";
8
- import { t as l } from "../button-DcCUEn2n.js";
9
- import { g as u } from "../icons-Cc7zwchP.js";
10
- import { t as d } from "../successIcon-DbILeIz_.js";
11
- import { t as f } from "../inputComposed-APSw8C7o.js";
12
- import { t as p } from "../dropdownComposed-DFRBG22E.js";
13
- import "../dropdownComposed-DwTzc2YU.js";
14
- import { t as m } from "../dateInputComposed-BpAGsjN6.js";
15
- import "../dateInputComposed-DU3o6PAV.js";
16
- import { t as h } from "../incodeModule-BqCjVgEI.js";
17
- import { n as g, t as _ } from "../requiredLabelHint-BLwgqozE.js";
18
- import { t as v } from "../autoFocusTitle-QexamZ4i.js";
19
- import { GENERATE_CURP_FIELDS as y, createCurpValidationManager as b, mexicanStates as x } from "@incodetech/core/curp-validation";
1
+ import { n as useTranslation } from "../i18n-CoCO2ZuN.js";
2
+ import { d as T, v as u, x as k } from "../vendor-preact-DThS2ZQ_.js";
3
+ import { c as useManager, o as useModuleTerminalCallbacks } from "../hooks-Da_yP_Dr.js";
4
+ import { t as IncodeComponent } from "../incodeComponent-wfnHlnXx.js";
5
+ import { r as Spacer } from "../loadingIcon-B0ysgiNq.js";
6
+ import { t as Page } from "../page-DxGQj7Gk.js";
7
+ import { t as TransitionSpinner } from "../transitionSpinner-DRRz-NV8.js";
8
+ import { t as Button } from "../button-CM_hgyIP.js";
9
+ import { t as ErrorIcon } from "../errorIcon-DJRZpd8j.js";
10
+ import "../icons-Dbs9ZfYM.js";
11
+ import { t as SuccessIcon } from "../successIcon-BAyDPT7I.js";
12
+ import { t as AutoFocusTitle } from "../autoFocusTitle-BzkUiELM.js";
13
+ import { t as InputComposed } from "../inputComposed-CQ4AsvZg.js";
14
+ import { t as DropdownComposed } from "../dropdownComposed-_fgAlo_C.js";
15
+ import "../dropdownComposed-CEWBSdGl.js";
16
+ import { t as DateInputComposed } from "../dateInputComposed-C_mh4XBg.js";
17
+ import "../dateInputComposed-Cy6a7ymh.js";
18
+ import { t as registerIncodeModuleElement } from "../incodeModule-BUDoTwT9.js";
19
+ import { n as getRequiredHintMode, t as getFieldHint } from "../requiredLabelHint-DEadtiwx.js";
20
+ import { GENERATE_CURP_FIELDS, createCurpValidationManager, mexicanStates } from "@incodetech/core/curp-validation";
20
21
  //#region src/modules/curp-validation/curpInput.tsx
21
- var S = ({ curp: t, errorKey: n, onCurpChange: i, onCurpBlur: a, onVerify: s, onSwitchToGenerate: c, disabled: u = !1, placeholder: d, continueLabel: p, dontHaveLabel: m }) => {
22
- let { t: h } = e(), g = d ?? h("curp.placeholder.curp") ?? "CURP", _ = p ?? h("curp.continue") ?? "Continue", v = m ?? h("curp.dontHave") ?? "I don't have my CURP", y = n ? h(n) : void 0, b = t.length === 0 || !!y || u;
23
- return /* @__PURE__ */ r("div", {
22
+ var CurpInput = ({ curp, errorKey, onCurpChange, onCurpBlur, onVerify, onSwitchToGenerate, disabled = false, placeholder, continueLabel, dontHaveLabel }) => {
23
+ const { t } = useTranslation();
24
+ const displayPlaceholder = placeholder ?? t("curp.placeholder.curp") ?? "CURP";
25
+ const displayContinueLabel = continueLabel ?? t("curp.continue") ?? "Continue";
26
+ const displayDontHaveLabel = dontHaveLabel ?? t("curp.dontHave") ?? "I don't have my CURP";
27
+ const errorMessage = errorKey ? t(errorKey) : void 0;
28
+ const isContinueDisabled = curp.length === 0 || !!errorMessage || disabled;
29
+ const handleInput = (e) => {
30
+ const target = e.target;
31
+ onCurpChange(target.value.toUpperCase());
32
+ };
33
+ return /* @__PURE__ */ u("div", {
24
34
  class: "IncodeCurpValidation IncodeCurpInput",
25
35
  children: [
26
- /* @__PURE__ */ r(f, {
36
+ /* @__PURE__ */ u(InputComposed, {
27
37
  id: "curp-input",
28
- value: t,
29
- onInput: (e) => {
30
- let t = e.target;
31
- i(t.value.toUpperCase());
32
- },
33
- onBlur: a,
34
- placeholder: g,
35
- disabled: u,
36
- required: !0,
38
+ value: curp,
39
+ onInput: handleInput,
40
+ onBlur: onCurpBlur,
41
+ placeholder: displayPlaceholder,
42
+ disabled,
43
+ required: true,
37
44
  maxLength: 18,
38
- "aria-label": h("curp.placeholder.curp") ?? "CURP",
39
- error: y,
40
- showErrorIcon: !!y
45
+ "aria-label": t("curp.placeholder.curp") ?? "CURP",
46
+ error: errorMessage,
47
+ showErrorIcon: !!errorMessage
41
48
  }),
42
- /* @__PURE__ */ r(o, {}),
43
- /* @__PURE__ */ r(l, {
49
+ /* @__PURE__ */ u(Spacer, {}),
50
+ /* @__PURE__ */ u(Button, {
44
51
  type: "button",
45
- onClick: s,
46
- disabled: b,
52
+ onClick: onVerify,
53
+ disabled: isContinueDisabled,
47
54
  "data-testid": "curp-verify",
48
- children: _
55
+ children: displayContinueLabel
49
56
  }),
50
- /* @__PURE__ */ r(l, {
57
+ /* @__PURE__ */ u(Button, {
51
58
  type: "button",
52
59
  variant: "secondary",
53
- onClick: c,
54
- disabled: u,
60
+ onClick: onSwitchToGenerate,
61
+ disabled,
55
62
  "data-testid": "curp-switch-to-generate",
56
- children: v
63
+ children: displayDontHaveLabel
57
64
  })
58
65
  ]
59
66
  });
60
- }, C = ({ form: t, validationErrors: i, onFormChange: a, onValidateField: s, onGenerate: c, disabled: u = !1, labels: d }) => {
61
- let { t: h } = e(), v = {
62
- firstName: h("curp.labels.firstName") ?? "Your First name",
63
- firstLast: h("curp.labels.firstLast") ?? "Your First last name",
64
- secondLast: h("curp.labels.secondLast") ?? "Your Second last name",
65
- gender: h("curp.labels.genderV2") ?? "Gender",
66
- genderPlaceholder: h("curp.placeholder.gender") ?? "Choose gender",
67
- male: h("curp.labels.maleV2") ?? "Male",
68
- female: h("curp.labels.femaleV2") ?? "Female",
69
- other: h("curp.labels.other") ?? "Other",
70
- dob: h("curp.labels.dob") ?? "Date of birth",
71
- birthState: h("curp.labels.birthState") ?? "State of birth",
72
- statePlaceholder: h("curp.placeholder.state") ?? "Select state",
73
- generate: h("curp.generateCta") ?? "Generate CURP",
74
- ...d
75
- }, b = n(() => g(y.map((e) => e.required)), []), S = !!i && Object.keys(i).length > 0, C = (e) => (t) => {
76
- let n = t.target;
77
- a({ [e]: n.value });
78
- }, w = (e) => () => {
79
- s(e);
80
- }, T = [
67
+ };
68
+ //#endregion
69
+ //#region src/modules/curp-validation/generateCurpForm.tsx
70
+ var GenerateCurpFormComponent = ({ form, validationErrors, onFormChange, onValidateField, onGenerate, disabled = false, labels: customLabels }) => {
71
+ const { t } = useTranslation();
72
+ const labels = {
73
+ firstName: t("curp.labels.firstName") ?? "Your First name",
74
+ firstLast: t("curp.labels.firstLast") ?? "Your First last name",
75
+ secondLast: t("curp.labels.secondLast") ?? "Your Second last name",
76
+ gender: t("curp.labels.genderV2") ?? "Gender",
77
+ genderPlaceholder: t("curp.placeholder.gender") ?? "Choose gender",
78
+ male: t("curp.labels.maleV2") ?? "Male",
79
+ female: t("curp.labels.femaleV2") ?? "Female",
80
+ other: t("curp.labels.other") ?? "Other",
81
+ dob: t("curp.labels.dob") ?? "Date of birth",
82
+ birthState: t("curp.labels.birthState") ?? "State of birth",
83
+ statePlaceholder: t("curp.placeholder.state") ?? "Select state",
84
+ generate: t("curp.generateCta") ?? "Generate CURP",
85
+ ...customLabels
86
+ };
87
+ const mode = T(() => getRequiredHintMode(GENERATE_CURP_FIELDS.map((f) => f.required)), []);
88
+ const hasValidationErrors = !!validationErrors && Object.keys(validationErrors).length > 0;
89
+ const handleTextChange = (field) => (e) => {
90
+ const target = e.target;
91
+ onFormChange({ [field]: target.value });
92
+ };
93
+ const handleBlur = (field) => () => {
94
+ onValidateField(field);
95
+ };
96
+ const genderOptions = [
81
97
  {
82
98
  value: "H",
83
- label: v.male
99
+ label: labels.male
84
100
  },
85
101
  {
86
102
  value: "M",
87
- label: v.female
103
+ label: labels.female
88
104
  },
89
105
  {
90
106
  value: "X",
91
- label: v.other
107
+ label: labels.other
92
108
  }
93
- ], E = x.map((e) => ({
94
- value: e.value,
95
- label: e.label
96
- })), D = (e) => {
97
- switch (e) {
98
- case "name": return v.firstName;
99
- case "firstLastName": return v.firstLast;
100
- case "secondLastName": return v.secondLast;
101
- case "gender": return v.gender;
102
- case "birthDate": return v.dob;
103
- case "birthState": return v.birthState;
109
+ ];
110
+ const stateOptions = mexicanStates.map((s) => ({
111
+ value: s.value,
112
+ label: s.label
113
+ }));
114
+ const labelForField = (key) => {
115
+ switch (key) {
116
+ case "name": return labels.firstName;
117
+ case "firstLastName": return labels.firstLast;
118
+ case "secondLastName": return labels.secondLast;
119
+ case "gender": return labels.gender;
120
+ case "birthDate": return labels.dob;
121
+ case "birthState": return labels.birthState;
104
122
  }
105
123
  };
106
- return /* @__PURE__ */ r("div", {
124
+ const renderField = (field) => {
125
+ const hint = getFieldHint(mode, field.required);
126
+ const labelHint = hint ? t(`forms.label.${hint}`) ?? void 0 : void 0;
127
+ const errorKey = validationErrors?.[field.key];
128
+ const errorMessage = errorKey ? t(errorKey) ?? void 0 : void 0;
129
+ const label = labelForField(field.key);
130
+ if (field.type === "dropdown") {
131
+ const options = field.key === "gender" ? genderOptions : stateOptions;
132
+ const placeholder = field.key === "gender" ? labels.genderPlaceholder : labels.statePlaceholder;
133
+ return /* @__PURE__ */ u(DropdownComposed, {
134
+ id: `curp-${field.key === "birthState" ? "birth-state" : "gender"}`,
135
+ label,
136
+ labelHint,
137
+ placeholder,
138
+ value: form[field.key],
139
+ options,
140
+ disabled,
141
+ required: field.required,
142
+ onChange: (value) => {
143
+ if (field.key === "gender") onFormChange({ gender: value });
144
+ else onFormChange({ [field.key]: value });
145
+ },
146
+ onBlur: handleBlur(field.key),
147
+ error: errorMessage,
148
+ showErrorIcon: !!errorMessage,
149
+ "data-testid": field.key === "gender" ? "curp-gender" : "curp-birth-state",
150
+ ...field.key === "birthState" ? { searchable: true } : {}
151
+ }, field.key);
152
+ }
153
+ if (field.type === "date") return /* @__PURE__ */ u(DateInputComposed, {
154
+ id: "curp-birth-date",
155
+ label,
156
+ labelHint,
157
+ value: form.birthDate,
158
+ onInput: handleTextChange("birthDate"),
159
+ onBlur: handleBlur("birthDate"),
160
+ max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
161
+ disabled,
162
+ required: field.required,
163
+ error: errorMessage,
164
+ showErrorIcon: !!errorMessage,
165
+ "data-testid": "curp-birth-date",
166
+ ...field.autoComplete ? { autoComplete: field.autoComplete } : {}
167
+ }, field.key);
168
+ return /* @__PURE__ */ u(InputComposed, {
169
+ id: field.key === "name" ? "curp-first-name" : field.key === "firstLastName" ? "curp-first-last" : "curp-second-last",
170
+ label,
171
+ labelHint,
172
+ value: form[field.key],
173
+ onInput: handleTextChange(field.key),
174
+ onBlur: handleBlur(field.key),
175
+ placeholder: label,
176
+ disabled,
177
+ required: field.required,
178
+ error: errorMessage,
179
+ showErrorIcon: !!errorMessage,
180
+ ...field.autoComplete ? { autoComplete: field.autoComplete } : {}
181
+ }, field.key);
182
+ };
183
+ return /* @__PURE__ */ u("div", {
107
184
  class: "IncodeCurpValidation IncodeGenerateCurpForm",
108
185
  children: [
109
- y.map((e) => {
110
- let n = _(b, e.required), o = n ? h(`forms.label.${n}`) ?? void 0 : void 0, s = i?.[e.key], c = s ? h(s) ?? void 0 : void 0, l = D(e.key);
111
- if (e.type === "dropdown") {
112
- let n = e.key === "gender" ? T : E, i = e.key === "gender" ? v.genderPlaceholder : v.statePlaceholder;
113
- return /* @__PURE__ */ r(p, {
114
- id: `curp-${e.key === "birthState" ? "birth-state" : "gender"}`,
115
- label: l,
116
- labelHint: o,
117
- placeholder: i,
118
- value: t[e.key],
119
- options: n,
120
- disabled: u,
121
- required: e.required,
122
- onChange: (t) => {
123
- e.key === "gender" ? a({ gender: t }) : a({ [e.key]: t });
124
- },
125
- onBlur: w(e.key),
126
- error: c,
127
- showErrorIcon: !!c,
128
- "data-testid": e.key === "gender" ? "curp-gender" : "curp-birth-state",
129
- ...e.key === "birthState" ? { searchable: !0 } : {}
130
- }, e.key);
131
- }
132
- return e.type === "date" ? /* @__PURE__ */ r(m, {
133
- id: "curp-birth-date",
134
- label: l,
135
- labelHint: o,
136
- value: t.birthDate,
137
- onInput: C("birthDate"),
138
- onBlur: w("birthDate"),
139
- max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
140
- placeholder: h("curp.placeholder.dob") ?? "mm/dd/yyyy",
141
- disabled: u,
142
- required: e.required,
143
- error: c,
144
- showErrorIcon: !!c,
145
- "data-testid": "curp-birth-date"
146
- }, e.key) : /* @__PURE__ */ r(f, {
147
- id: e.key === "name" ? "curp-first-name" : e.key === "firstLastName" ? "curp-first-last" : "curp-second-last",
148
- label: l,
149
- labelHint: o,
150
- value: t[e.key],
151
- onInput: C(e.key),
152
- onBlur: w(e.key),
153
- placeholder: l,
154
- disabled: u,
155
- required: e.required,
156
- error: c,
157
- showErrorIcon: !!c,
158
- ...e.autoComplete ? { autoComplete: e.autoComplete } : {}
159
- }, e.key);
160
- }),
161
- /* @__PURE__ */ r(o, { size: 16 }),
162
- /* @__PURE__ */ r(l, {
186
+ GENERATE_CURP_FIELDS.map(renderField),
187
+ /* @__PURE__ */ u(Spacer, { size: 16 }),
188
+ /* @__PURE__ */ u(Button, {
163
189
  type: "button",
164
- onClick: c,
165
- disabled: S || u,
190
+ onClick: onGenerate,
191
+ disabled: hasValidationErrors || disabled,
166
192
  "data-testid": "curp-generate",
167
- children: v.generate
193
+ children: labels.generate
168
194
  })
169
195
  ]
170
196
  });
171
- }, w = ({ config: n, onFinish: a, onError: p }) => {
172
- let { t: m } = e(), [h, g] = i(() => {
173
- if (!n) throw Error("CURP validation config is required");
174
- return b({ config: n });
197
+ };
198
+ //#endregion
199
+ //#region src/modules/curp-validation/curp-validation.tsx
200
+ var CurpValidationContent = ({ config, manager: externalManager, onFinish, onError }) => {
201
+ const { t } = useTranslation();
202
+ const [state, manager] = useManager(() => {
203
+ if (externalManager) return externalManager;
204
+ if (!config) throw new Error("CurpValidation config is required when no manager is provided");
205
+ return createCurpValidationManager({ config });
206
+ }, { manageLifecycle: !externalManager });
207
+ useModuleTerminalCallbacks({
208
+ status: state.status,
209
+ onFinish,
210
+ onError
175
211
  });
176
- if (h.status === "idle" || h.status === "loading" || h.status === "verifying" || h.status === "generating") return /* @__PURE__ */ r(c, { spinnerConfig: { title: h.status === "generating" ? m("curp.status.generating") ?? "Generating..." : m("curp.status.verifying") ?? "Verifying..." } });
177
- if (h.status === "enterCurp") return /* @__PURE__ */ r(s, {
212
+ if (state.status === "idle" || state.status === "loading") return /* @__PURE__ */ u(TransitionSpinner, { hideText: true });
213
+ if (state.status === "verifying" || state.status === "generating") return /* @__PURE__ */ u(TransitionSpinner, { spinnerConfig: { title: state.status === "generating" ? t("curp.status.generating") ?? "Generating..." : t("curp.status.verifying") ?? "Verifying..." } });
214
+ if (state.status === "enterCurp") return /* @__PURE__ */ u(Page, {
178
215
  className: "IncodeCurpValidationPage",
179
- title: m("curp.enterCurp") ?? "Enter your CURP",
180
- children: /* @__PURE__ */ r(S, {
181
- curp: h.curp,
182
- errorKey: h.validationErrors?.curp,
183
- onCurpChange: (e) => g.setCurp(e),
184
- onCurpBlur: () => g.validateField("curp"),
185
- onVerify: () => g.verify(),
186
- onSwitchToGenerate: () => g.switchToGenerate(),
187
- placeholder: m("curp.placeholder.curp") ?? "CURP",
188
- continueLabel: m("curp.continue") ?? "Continue",
189
- dontHaveLabel: m("curp.dontHave") ?? "I don't have my CURP"
216
+ title: t("curp.enterCurp") ?? "Enter your CURP",
217
+ children: /* @__PURE__ */ u(CurpInput, {
218
+ curp: state.curp,
219
+ errorKey: state.validationErrors?.curp,
220
+ onCurpChange: (curp) => manager.setCurp(curp),
221
+ onCurpBlur: () => manager.validateField("curp"),
222
+ onVerify: () => manager.verify(),
223
+ onSwitchToGenerate: () => manager.switchToGenerate(),
224
+ placeholder: t("curp.placeholder.curp") ?? "CURP",
225
+ continueLabel: t("curp.continue") ?? "Continue",
226
+ dontHaveLabel: t("curp.dontHave") ?? "I don't have my CURP"
190
227
  })
191
228
  });
192
- if (h.status === "generateCurp") return /* @__PURE__ */ r(s, {
229
+ if (state.status === "generateCurp") return /* @__PURE__ */ u(Page, {
193
230
  className: "IncodeCurpValidationPage",
194
- title: m("curp.generate") ?? "Generate your CURP",
195
- hideFooterBranding: !0,
196
- children: /* @__PURE__ */ r(C, {
197
- form: h.form,
198
- validationErrors: h.validationErrors,
199
- onFormChange: (e) => g.setGenerateForm(e),
200
- onValidateField: (e) => g.validateField(e),
201
- onGenerate: () => g.generate()
231
+ title: t("curp.generate") ?? "Generate your CURP",
232
+ hideFooterBranding: true,
233
+ children: /* @__PURE__ */ u(GenerateCurpFormComponent, {
234
+ form: state.form,
235
+ validationErrors: state.validationErrors,
236
+ onFormChange: (form) => manager.setGenerateForm(form),
237
+ onValidateField: (field) => manager.validateField(field),
238
+ onGenerate: () => manager.generate()
202
239
  })
203
240
  });
204
- if (h.status === "confirmCurp") return /* @__PURE__ */ r(s, {
241
+ if (state.status === "confirmCurp") return /* @__PURE__ */ u(Page, {
205
242
  className: "IncodeCurpValidationPage",
206
- title: m("curp.status.confirm") ?? "Confirm your CURP",
207
- children: /* @__PURE__ */ r("div", {
243
+ title: t("curp.status.confirm") ?? "Confirm your CURP",
244
+ children: /* @__PURE__ */ u("div", {
208
245
  class: "IncodeCurpValidation IncodeCurpConfirm",
209
246
  children: [
210
- /* @__PURE__ */ r(f, {
247
+ /* @__PURE__ */ u(InputComposed, {
211
248
  id: "curp-confirm-input",
212
- value: h.curp,
213
- readOnly: !0,
214
- "aria-label": m("curp.status.generatedCurp") ?? "Generated CURP",
249
+ value: state.curp,
250
+ readOnly: true,
251
+ "aria-label": t("curp.status.generatedCurp") ?? "Generated CURP",
215
252
  "data-testid": "curp-confirm-input"
216
253
  }),
217
- /* @__PURE__ */ r(o, {}),
218
- /* @__PURE__ */ r(l, {
254
+ /* @__PURE__ */ u(Spacer, {}),
255
+ /* @__PURE__ */ u(Button, {
219
256
  type: "button",
220
- onClick: () => g.confirmGenerated(),
257
+ onClick: () => manager.confirmGenerated(),
221
258
  "data-testid": "curp-confirm",
222
- children: m("curp.continue") ?? "Continue"
259
+ children: t("curp.continue") ?? "Continue"
223
260
  })
224
261
  ]
225
262
  })
226
263
  });
227
- if (h.status === "success") return /* @__PURE__ */ r(s, {
264
+ if (state.status === "success") return /* @__PURE__ */ u(Page, {
228
265
  className: "IncodeCurpValidationPage",
229
- children: /* @__PURE__ */ r("div", {
266
+ children: /* @__PURE__ */ u("div", {
230
267
  class: "IncodeCurpValidation IncodeCurpSuccess",
231
268
  children: [
232
- /* @__PURE__ */ r(d, { size: 64 }),
233
- /* @__PURE__ */ r(o, { size: 16 }),
234
- /* @__PURE__ */ r(v, {
269
+ /* @__PURE__ */ u(SuccessIcon, { size: 64 }),
270
+ /* @__PURE__ */ u(Spacer, { size: 16 }),
271
+ /* @__PURE__ */ u(AutoFocusTitle, {
235
272
  className: "IncodeCurpSuccessTitle",
236
- children: m("curp.status.verified") ?? "Verified"
273
+ children: t("curp.status.verified") ?? "Verified"
237
274
  })
238
275
  ]
239
276
  })
240
277
  });
241
- if (h.status === "failure" || h.status === "generateError") {
242
- let e = h.retriesLeft > 0, n = h.status === "failure" ? m("curp.status.notVerified") ?? "Not verified" : m("curp.status.couldntGenerate") ?? "Couldn't generate CURP";
243
- return /* @__PURE__ */ r(s, {
278
+ if (state.status === "failure" || state.status === "generateError") {
279
+ const canRetry = state.retriesLeft > 0;
280
+ const title = state.status === "failure" ? t("curp.status.notVerified") ?? "Not verified" : t("curp.status.couldntGenerate") ?? "Couldn't generate CURP";
281
+ const failureRetryLabel = state.status === "failure" && state.fromAutoVerify ? t("curp.verifyManually") : t("curp.status.tryAgain");
282
+ return /* @__PURE__ */ u(Page, {
244
283
  className: "IncodeCurpValidationPage",
245
- children: /* @__PURE__ */ r("div", {
284
+ children: /* @__PURE__ */ u("div", {
246
285
  class: "IncodeCurpValidation IncodeCurpFailure",
247
286
  children: [
248
- /* @__PURE__ */ r(o, {}),
249
- /* @__PURE__ */ r(u, { size: 64 }),
250
- /* @__PURE__ */ r(o, { size: 16 }),
251
- /* @__PURE__ */ r(v, {
287
+ /* @__PURE__ */ u(Spacer, {}),
288
+ /* @__PURE__ */ u(ErrorIcon, { size: 64 }),
289
+ /* @__PURE__ */ u(Spacer, { size: 16 }),
290
+ /* @__PURE__ */ u(AutoFocusTitle, {
252
291
  className: "IncodeCurpFailureTitle",
253
- children: n
292
+ children: title
254
293
  }),
255
- h.status === "generateError" && e && /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ r(o, { size: 12 }), /* @__PURE__ */ r("p", {
294
+ state.status === "generateError" && canRetry && /* @__PURE__ */ u(k, { children: [/* @__PURE__ */ u(Spacer, { size: 12 }), /* @__PURE__ */ u("p", {
256
295
  class: "IncodeCurpFailureHint",
257
296
  role: "alert",
258
- children: m("curp.status.checkInfo") ?? "Please check your information"
297
+ children: t("curp.status.checkInfo") ?? "Please check your information"
259
298
  })] }),
260
- /* @__PURE__ */ r(o, {}),
261
- e && /* @__PURE__ */ r(t, { children: /* @__PURE__ */ r(l, {
299
+ /* @__PURE__ */ u(Spacer, {}),
300
+ canRetry && /* @__PURE__ */ u(k, { children: /* @__PURE__ */ u(Button, {
262
301
  type: "button",
263
- onClick: () => g.retry(),
302
+ onClick: () => manager.retry(),
264
303
  "data-testid": "curp-retry",
265
- children: h.status === "failure" ? m("curp.status.tryAgain") ?? "Try again" : m("curp.status.edit") ?? "Edit information"
304
+ children: state.status === "failure" ? failureRetryLabel : t("curp.status.edit") ?? "Edit information"
266
305
  }) })
267
306
  ]
268
307
  })
269
308
  });
270
309
  }
271
- return h.status === "finished" ? (a?.(), null) : (h.status === "closed" && p?.(void 0), null);
272
- }, T = ({ config: e, onFinish: t, onError: n }) => /* @__PURE__ */ r(a, { children: e ? /* @__PURE__ */ r(w, {
273
- config: e,
274
- onFinish: t,
275
- onError: n
276
- }) : null });
277
- h(T, "incode-curp-validation");
310
+ if (state.status === "finished" || state.status === "closed") return null;
311
+ return null;
312
+ };
313
+ var CurpValidation = ({ config, manager, onFinish, onError }) => {
314
+ return /* @__PURE__ */ u(IncodeComponent, { children: config || manager ? /* @__PURE__ */ u(CurpValidationContent, {
315
+ config,
316
+ manager,
317
+ onFinish,
318
+ onError
319
+ }) : null });
320
+ };
321
+ registerIncodeModuleElement(CurpValidation, "incode-curp-validation");
278
322
  //#endregion
279
- export { T as CurpValidation };
323
+ export { CurpValidation };