@incodetech/web 0.0.0-dev-20260608-c8c427ca → 0.0.0-dev-20260608-fe5ac64f

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 (206) 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/blurdevicelottie-CBXtBFiJ.js +15951 -0
  11. package/dist/bottomSheet-BuzqNQtG.js +39 -0
  12. package/dist/browser-ponyfill-CLLvZCVg.js +441 -0
  13. package/dist/button-B-qlr4iI.js +35 -0
  14. package/dist/checkbox-CTPETqo5.js +96 -0
  15. package/dist/consent/consent.es.js +75 -64
  16. package/dist/countrySelector-CzyuaDIs.js +60 -0
  17. package/dist/cpf-ocr/cpf-ocr.es.js +2 -2
  18. package/dist/cpfOcr-7DkO3a4-.js +92 -0
  19. package/dist/cpfOcr-BrpGqevl.js +2 -0
  20. package/dist/cross-document-data-match/cross-document-data-match.es.js +20 -17
  21. package/dist/curp-validation/curp-validation.es.js +246 -211
  22. package/dist/customFields-CJxcEDgu.js +140 -0
  23. package/dist/customWatchlist-BvfsU7r-.js +36 -0
  24. package/dist/dateInputComposed-BsPQHG5o.js +1 -0
  25. package/dist/dateInputComposed-DY97tQVK.js +69 -0
  26. package/dist/defineProperty-mefzVtTv.js +39 -0
  27. package/dist/document-capture/document-capture.es.js +2 -2
  28. package/dist/documentCapture-CQSmWEdd.js +876 -0
  29. package/dist/documentCapture-r1zYPBgS.js +2 -0
  30. package/dist/dropdownComposed-BF4L-7mJ.js +380 -0
  31. package/dist/dropdownComposed-mvHuRFHn.js +1 -0
  32. package/dist/dynamicForms-DranXtuE.js +352 -0
  33. package/dist/ekyb/ekyb.es.js +2 -2
  34. package/dist/ekybModule-DOOUw8h0.js +2 -0
  35. package/dist/ekybModule-DSOvdViS.js +279 -0
  36. package/dist/ekyc/ekyc.es.js +2 -2
  37. package/dist/ekycModule-BYHmHRia.js +2 -0
  38. package/dist/ekycModule-DtzcD2wV.js +257 -0
  39. package/dist/electronic-signature/electronic-signature.es.js +2 -2
  40. package/dist/electronic-signature-B0SDITm5.js +426 -0
  41. package/dist/email/email.es.js +198 -78
  42. package/dist/emailInput-D8qiAdjn.js +39 -0
  43. package/dist/errorIcon-B0rmz3rw.js +26 -0
  44. package/dist/expiredId-Du3HsBaI.js +85 -0
  45. package/dist/extensibility-FK5oOsIJ.js +3070 -0
  46. package/dist/extensibility.es.js +26 -26
  47. package/dist/face-match/face-match.es.js +2 -2
  48. package/dist/faceMatch-C0UL_xA7.js +2 -0
  49. package/dist/faceMatch-DJMba1pt.js +343 -0
  50. package/dist/field-comparison/field-comparison.es.js +2 -2
  51. package/dist/fieldComparison-CcJA6KR5.js +88 -0
  52. package/dist/fieldComparison-CvnNOIWA.js +2 -0
  53. package/dist/{flip-animation-CuQ57qTn.js → flip-animation-BGRvygw9.js} +4221 -4221
  54. package/dist/flow/flow.es.js +597 -493
  55. package/dist/{front-horizontal-hint-CKm7PnmS.js → front-horizontal-hint-CLSU0iVo.js} +70 -70
  56. package/dist/{front-vertical-hint-CLHC2qoH.js → front-vertical-hint-BWq-yWQ8.js} +81 -81
  57. package/dist/frontdevicelottie-CLqitJhG.js +17314 -0
  58. package/dist/geolocation/geolocation.es.js +485 -395
  59. package/dist/glaredevicelottie-BS04U6Fc.js +14478 -0
  60. package/dist/governmentValidation/governmentValidation.es.js +67 -59
  61. package/dist/homeScreen-BsEYyiDB.js +264 -0
  62. package/dist/hooks-BtgmGvba.js +149 -0
  63. package/dist/i18n-gTHArCl9.js +2971 -0
  64. package/dist/icons-DKY3xDkf.js +360 -0
  65. package/dist/id/id.es.js +565 -413
  66. package/dist/id-laser-h-DX8UbVNH.js +467 -0
  67. package/dist/id-laser-v-DhnHdjlB.js +490 -0
  68. package/dist/id-tutorial-lj4iKtYT.js +13165 -0
  69. package/dist/id-verification/id-verification.es.js +21 -18
  70. package/dist/idOcr-CfqkKAZH.js +123 -0
  71. package/dist/identity-reuse/identity-reuse.es.js +168 -130
  72. package/dist/incode-logo-57XFniXU.js +4 -0
  73. package/dist/incodeComponent-CDJxFZvS.js +63 -0
  74. package/dist/incodeModule-DkA_yd0X.js +13 -0
  75. package/dist/index.es.js +16 -14
  76. package/dist/inputComposed-5V2nLTqH.js +99 -0
  77. package/dist/inputComposed-BPOYwUBl.js +1 -0
  78. package/dist/loadingIcon-DN62ugKs.js +148 -0
  79. package/dist/lottie_light-Dp9Bz3mf.js +9031 -0
  80. package/dist/mandatoryConsent-DxL7lmfQ.js +107 -0
  81. package/dist/modal-B5QeulDu.js +153 -0
  82. package/dist/modal.hooks-C7K9k_pY.js +202 -0
  83. package/dist/numberedStep-DVAyTPv1.js +13 -0
  84. package/dist/optionAccessibleLabel-Czc2YC8z.js +202 -0
  85. package/dist/otpInput-2IQ-JCK8.js +195 -0
  86. package/dist/page-6bCuq5Q6.js +70 -0
  87. package/dist/{passport-horizontal-hint-C_le0HVU.js → passport-horizontal-hint-DfVsf4Cc.js} +55 -55
  88. package/dist/{passport-tutorial-BYN4T_TE.js → passport-tutorial-zT1ZoA-D.js} +7096 -7084
  89. package/dist/{passport-vertical-hint-H-pyICSv.js → passport-vertical-hint-DVxbTyQp.js} +49 -49
  90. package/dist/pdf-BZA70WbM.js +22398 -0
  91. package/dist/pdfViewer-Dr63sJ51.js +114 -0
  92. package/dist/phone/phone.es.js +214 -87
  93. package/dist/phoneInputComposed-D_IabWKJ.js +12142 -0
  94. package/dist/processing-B_u8wUB7.js +8 -0
  95. package/dist/qe-signature/qe-signature.es.js +15 -13
  96. package/dist/radioGroupComposed-DwYW-Ld-.js +215 -0
  97. package/dist/redirect-to-mobile/redirect-to-mobile.es.js +2099 -859
  98. package/dist/registerIncodeElement-BJJGzVdq.js +11 -0
  99. package/dist/requiredLabelHint-DEadtiwx.js +17 -0
  100. package/dist/richText-C7GUm0WL.js +3153 -0
  101. package/dist/rolldown-runtime--E5BIlTp.js +33 -0
  102. package/dist/selfie/selfie.es.js +54 -42
  103. package/dist/selfieTutorial-CtruLyO2.js +2689 -0
  104. package/dist/signature/signature.es.js +765 -406
  105. package/dist/snackbar-Dz9crm39.js +16 -0
  106. package/dist/spinner-BfBIZkDQ.js +42 -0
  107. package/dist/spinner-DEDtE7Pz.js +1 -0
  108. package/dist/statusPage-B1Ef7J5K.js +28 -0
  109. package/dist/successIcon-rmzr-pxu.js +30 -0
  110. package/dist/tabs--UMd6eEB.js +103 -0
  111. package/dist/transitionSpinner-CWhGcr7c.js +26 -0
  112. package/dist/{tutorial-QzQ536BL.js → tutorial-y-nq6ZhF.js} +832 -578
  113. package/dist/types/index.d.ts +13 -4
  114. package/dist/typography-BK4AmfKX.js +45 -0
  115. package/dist/uiConfig-sgEkFuuA.js +25 -0
  116. package/dist/useModuleLoader-8LslB-YG.js +670 -0
  117. package/dist/vendor-preact-BH7vOa2r.js +957 -0
  118. package/dist/verificationResult-CbVRf6Kh.js +91 -0
  119. package/dist/verifiedByIncode-8QBn-kgZ.js +103 -0
  120. package/dist/watchlist/watchlist.es.js +31 -26
  121. package/dist/watchlistForBusiness-Dfn1UMow.js +80 -0
  122. package/dist/workflow/workflow.es.js +251 -209
  123. package/package.json +4 -2
  124. package/dist/aligndevicelottie-D8KsO77t.js +0 -12757
  125. package/dist/autoFocusTitle-BpYdaSUM.js +0 -16
  126. package/dist/back-tutorial-DhSE2FJo.js +0 -14585
  127. package/dist/backdevicelottie-CJWGVMdw.js +0 -16678
  128. package/dist/blurdevicelottie-Dxt2deEB.js +0 -15939
  129. package/dist/bottomSheet-QrpyatOD.js +0 -31
  130. package/dist/browser-ponyfill-Crda_c5R.js +0 -299
  131. package/dist/button-DcCUEn2n.js +0 -24
  132. package/dist/checkbox-DCCzBAuF.js +0 -86
  133. package/dist/countrySelector-CJ8egQ4C.js +0 -58
  134. package/dist/cpfOcr-Db06i-Lm.js +0 -2
  135. package/dist/cpfOcr-FixhUeMQ.js +0 -79
  136. package/dist/customFields-C1G9xHNX.js +0 -125
  137. package/dist/customWatchlist-IKEblz7u.js +0 -31
  138. package/dist/dateInputComposed-Cg8BvYSK.js +0 -1
  139. package/dist/dateInputComposed-Ddd7HLyM.js +0 -58
  140. package/dist/defineProperty-xczUyn-m.js +0 -39
  141. package/dist/documentCapture-D9I7FjGe.js +0 -2
  142. package/dist/documentCapture-b61wlala.js +0 -765
  143. package/dist/dropdownComposed-B4U0AIak.js +0 -1
  144. package/dist/dropdownComposed-CS2pyn-g.js +0 -293
  145. package/dist/dynamicForms-tYQog0kw.js +0 -298
  146. package/dist/ekybModule-C33C4JES.js +0 -237
  147. package/dist/ekybModule-LON6G2Bz.js +0 -2
  148. package/dist/ekycModule-BJOgtTAh.js +0 -225
  149. package/dist/ekycModule-BSf_DIG7.js +0 -2
  150. package/dist/electronic-signature-OdgTyso4.js +0 -406
  151. package/dist/emailInput-CU7mLB21.js +0 -37
  152. package/dist/errorIcon-DpHzAoAo.js +0 -24
  153. package/dist/expiredId-nfVAZgTL.js +0 -70
  154. package/dist/extensibility-BbNy3mVG.js +0 -2602
  155. package/dist/faceMatch-BIila4kf.js +0 -2
  156. package/dist/faceMatch-DJ7Mqujx.js +0 -206
  157. package/dist/fieldComparison-D2RSFYl-.js +0 -84
  158. package/dist/fieldComparison-DbUyouFd.js +0 -2
  159. package/dist/frontdevicelottie-65Vyfpff.js +0 -17302
  160. package/dist/glaredevicelottie-BEyaqtc6.js +0 -14466
  161. package/dist/homeScreen-CyPddxWl.js +0 -227
  162. package/dist/hooks-MxHtZWTS.js +0 -112
  163. package/dist/i18n-Kzzvkz94.js +0 -2019
  164. package/dist/icons-9I5g9-_1.js +0 -292
  165. package/dist/id-laser-h-iCPbFixz.js +0 -467
  166. package/dist/id-laser-v-CNzwliP2.js +0 -483
  167. package/dist/id-tutorial-CF4nO4oX.js +0 -13153
  168. package/dist/idOcr-DlMLMDqa.js +0 -97
  169. package/dist/incode-logo-DX016usY.js +0 -4
  170. package/dist/incodeComponent-BoFhgK7G.js +0 -50
  171. package/dist/incodeModule-BiCoAJ5k.js +0 -13
  172. package/dist/inputComposed-DAEey9xm.js +0 -94
  173. package/dist/inputComposed-eS4B0Mkh.js +0 -1
  174. package/dist/loadingIcon-BN5YRQUb.js +0 -104
  175. package/dist/lottie_light-DLqSnziX.js +0 -4419
  176. package/dist/mandatoryConsent-DNz2jZ43.js +0 -98
  177. package/dist/modal-ZqAhwiRF.js +0 -135
  178. package/dist/modal.hooks-LdusROLW.js +0 -126
  179. package/dist/numberedStep-CdLWASwL.js +0 -11
  180. package/dist/optionAccessibleLabel-DcygPaME.js +0 -140
  181. package/dist/otpInput-C4pk4BJU.js +0 -157
  182. package/dist/page-DA3R7q0J.js +0 -69
  183. package/dist/pdf-51QeiFSx.js +0 -14967
  184. package/dist/pdfViewer-rKzTHket.js +0 -64
  185. package/dist/phoneInputComposed-CjAxk2Gj.js +0 -11230
  186. package/dist/processing-DPktVde2.js +0 -6
  187. package/dist/radioGroupComposed-DRRxVk9Z.js +0 -178
  188. package/dist/registerIncodeElement-BHWOwdSS.js +0 -7
  189. package/dist/requiredLabelHint-B6FN3v88.js +0 -13
  190. package/dist/richText-6pIbydcz.js +0 -1973
  191. package/dist/rolldown-runtime-CYMK-g2i.js +0 -20
  192. package/dist/selfieTutorial-Yo9AlUoT.js +0 -2677
  193. package/dist/snackbar-CQiiWO4p.js +0 -14
  194. package/dist/spinner-B4dcie2T.js +0 -1
  195. package/dist/spinner-CKnjVHxw.js +0 -39
  196. package/dist/statusPage-B8b3Jg6N.js +0 -28
  197. package/dist/successIcon-SlKgTSty.js +0 -28
  198. package/dist/tabs-D7lGst3Q.js +0 -78
  199. package/dist/transitionSpinner-Di3bOyOu.js +0 -17
  200. package/dist/typography-CxjaknHN.js +0 -28
  201. package/dist/uiConfig-CwpQ-IM6.js +0 -20
  202. package/dist/useModuleLoader-Bqs7fglI.js +0 -517
  203. package/dist/vendor-preact-D6SntenC.js +0 -958
  204. package/dist/verificationResult-DhT3hH1b.js +0 -90
  205. package/dist/verifiedByIncode-DpbxzO0y.js +0 -101
  206. package/dist/watchlistForBusiness-CRXVbH4l.js +0 -75
@@ -1,286 +1,321 @@
1
- import { n as e } from "../i18n-Kzzvkz94.js";
2
- import { S as t, d as n, v as r } from "../vendor-preact-D6SntenC.js";
3
- import { c as i, o as a } from "../hooks-MxHtZWTS.js";
4
- import { t as o } from "../incodeComponent-BoFhgK7G.js";
5
- import { r as s } from "../loadingIcon-BN5YRQUb.js";
6
- import { t as c } from "../page-DA3R7q0J.js";
7
- import { t as l } from "../transitionSpinner-Di3bOyOu.js";
8
- import { t as u } from "../button-DcCUEn2n.js";
9
- import { t as d } from "../errorIcon-DpHzAoAo.js";
10
- import "../icons-9I5g9-_1.js";
11
- import { t as f } from "../successIcon-SlKgTSty.js";
12
- import { t as p } from "../autoFocusTitle-BpYdaSUM.js";
13
- import { t as m } from "../inputComposed-DAEey9xm.js";
14
- import { t as h } from "../dropdownComposed-CS2pyn-g.js";
15
- import "../dropdownComposed-B4U0AIak.js";
16
- import { t as g } from "../dateInputComposed-Ddd7HLyM.js";
17
- import "../dateInputComposed-Cg8BvYSK.js";
18
- import { t as _ } from "../incodeModule-BiCoAJ5k.js";
19
- import { n as v, t as y } from "../requiredLabelHint-B6FN3v88.js";
20
- import { GENERATE_CURP_FIELDS as b, createCurpValidationManager as x, mexicanStates as S } from "@incodetech/core/curp-validation";
1
+ import { n as useTranslation } from "../i18n-gTHArCl9.js";
2
+ import { S as k, d as T, v as u } from "../vendor-preact-BH7vOa2r.js";
3
+ import { c as useManager, o as useModuleTerminalCallbacks } from "../hooks-BtgmGvba.js";
4
+ import { t as IncodeComponent } from "../incodeComponent-CDJxFZvS.js";
5
+ import { r as Spacer } from "../loadingIcon-DN62ugKs.js";
6
+ import { t as Page } from "../page-6bCuq5Q6.js";
7
+ import { t as TransitionSpinner } from "../transitionSpinner-CWhGcr7c.js";
8
+ import { t as Button } from "../button-B-qlr4iI.js";
9
+ import { t as ErrorIcon } from "../errorIcon-B0rmz3rw.js";
10
+ import "../icons-DKY3xDkf.js";
11
+ import { t as SuccessIcon } from "../successIcon-rmzr-pxu.js";
12
+ import { t as AutoFocusTitle } from "../autoFocusTitle-DM6PvgcP.js";
13
+ import { t as InputComposed } from "../inputComposed-5V2nLTqH.js";
14
+ import { t as DropdownComposed } from "../dropdownComposed-BF4L-7mJ.js";
15
+ import "../dropdownComposed-mvHuRFHn.js";
16
+ import { t as DateInputComposed } from "../dateInputComposed-DY97tQVK.js";
17
+ import "../dateInputComposed-BsPQHG5o.js";
18
+ import { t as registerIncodeModuleElement } from "../incodeModule-DkA_yd0X.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";
21
21
  //#region src/modules/curp-validation/curpInput.tsx
22
- var C = ({ curp: t, errorKey: n, onCurpChange: i, onCurpBlur: a, onVerify: o, onSwitchToGenerate: c, disabled: l = !1, placeholder: d, continueLabel: f, dontHaveLabel: p }) => {
23
- let { t: h } = e(), g = d ?? h("curp.placeholder.curp") ?? "CURP", _ = f ?? h("curp.continue") ?? "Continue", v = p ?? h("curp.dontHave") ?? "I don't have my CURP", y = n ? h(n) : void 0, b = t.length === 0 || !!y || l;
24
- 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", {
25
34
  class: "IncodeCurpValidation IncodeCurpInput",
26
35
  children: [
27
- /* @__PURE__ */ r(m, {
36
+ /* @__PURE__ */ u(InputComposed, {
28
37
  id: "curp-input",
29
- value: t,
30
- onInput: (e) => {
31
- let t = e.target;
32
- i(t.value.toUpperCase());
33
- },
34
- onBlur: a,
35
- placeholder: g,
36
- disabled: l,
37
- required: !0,
38
+ value: curp,
39
+ onInput: handleInput,
40
+ onBlur: onCurpBlur,
41
+ placeholder: displayPlaceholder,
42
+ disabled,
43
+ required: true,
38
44
  maxLength: 18,
39
- "aria-label": h("curp.placeholder.curp") ?? "CURP",
40
- error: y,
41
- showErrorIcon: !!y
45
+ "aria-label": t("curp.placeholder.curp") ?? "CURP",
46
+ error: errorMessage,
47
+ showErrorIcon: !!errorMessage
42
48
  }),
43
- /* @__PURE__ */ r(s, {}),
44
- /* @__PURE__ */ r(u, {
49
+ /* @__PURE__ */ u(Spacer, {}),
50
+ /* @__PURE__ */ u(Button, {
45
51
  type: "button",
46
- onClick: o,
47
- disabled: b,
52
+ onClick: onVerify,
53
+ disabled: isContinueDisabled,
48
54
  "data-testid": "curp-verify",
49
- children: _
55
+ children: displayContinueLabel
50
56
  }),
51
- /* @__PURE__ */ r(u, {
57
+ /* @__PURE__ */ u(Button, {
52
58
  type: "button",
53
59
  variant: "secondary",
54
- onClick: c,
55
- disabled: l,
60
+ onClick: onSwitchToGenerate,
61
+ disabled,
56
62
  "data-testid": "curp-switch-to-generate",
57
- children: v
63
+ children: displayDontHaveLabel
58
64
  })
59
65
  ]
60
66
  });
61
- }, w = ({ form: t, validationErrors: i, onFormChange: a, onValidateField: o, onGenerate: c, disabled: l = !1, labels: d }) => {
62
- let { t: f } = e(), p = {
63
- firstName: f("curp.labels.firstName") ?? "Your First name",
64
- firstLast: f("curp.labels.firstLast") ?? "Your First last name",
65
- secondLast: f("curp.labels.secondLast") ?? "Your Second last name",
66
- gender: f("curp.labels.genderV2") ?? "Gender",
67
- genderPlaceholder: f("curp.placeholder.gender") ?? "Choose gender",
68
- male: f("curp.labels.maleV2") ?? "Male",
69
- female: f("curp.labels.femaleV2") ?? "Female",
70
- other: f("curp.labels.other") ?? "Other",
71
- dob: f("curp.labels.dob") ?? "Date of birth",
72
- birthState: f("curp.labels.birthState") ?? "State of birth",
73
- statePlaceholder: f("curp.placeholder.state") ?? "Select state",
74
- generate: f("curp.generateCta") ?? "Generate CURP",
75
- ...d
76
- }, _ = n(() => v(b.map((e) => e.required)), []), x = !!i && Object.keys(i).length > 0, C = (e) => (t) => {
77
- let n = t.target;
78
- a({ [e]: n.value });
79
- }, w = (e) => () => {
80
- o(e);
81
- }, 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 = [
82
97
  {
83
98
  value: "H",
84
- label: p.male
99
+ label: labels.male
85
100
  },
86
101
  {
87
102
  value: "M",
88
- label: p.female
103
+ label: labels.female
89
104
  },
90
105
  {
91
106
  value: "X",
92
- label: p.other
107
+ label: labels.other
93
108
  }
94
- ], E = S.map((e) => ({
95
- value: e.value,
96
- label: e.label
97
- })), D = (e) => {
98
- switch (e) {
99
- case "name": return p.firstName;
100
- case "firstLastName": return p.firstLast;
101
- case "secondLastName": return p.secondLast;
102
- case "gender": return p.gender;
103
- case "birthDate": return p.dob;
104
- case "birthState": return p.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;
105
122
  }
106
123
  };
107
- 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", {
108
184
  class: "IncodeCurpValidation IncodeGenerateCurpForm",
109
185
  children: [
110
- b.map((e) => {
111
- let n = y(_, e.required), o = n ? f(`forms.label.${n}`) ?? void 0 : void 0, s = i?.[e.key], c = s ? f(s) ?? void 0 : void 0, u = D(e.key);
112
- if (e.type === "dropdown") {
113
- let n = e.key === "gender" ? T : E, i = e.key === "gender" ? p.genderPlaceholder : p.statePlaceholder;
114
- return /* @__PURE__ */ r(h, {
115
- id: `curp-${e.key === "birthState" ? "birth-state" : "gender"}`,
116
- label: u,
117
- labelHint: o,
118
- placeholder: i,
119
- value: t[e.key],
120
- options: n,
121
- disabled: l,
122
- required: e.required,
123
- onChange: (t) => {
124
- e.key === "gender" ? a({ gender: t }) : a({ [e.key]: t });
125
- },
126
- onBlur: w(e.key),
127
- error: c,
128
- showErrorIcon: !!c,
129
- "data-testid": e.key === "gender" ? "curp-gender" : "curp-birth-state",
130
- ...e.key === "birthState" ? { searchable: !0 } : {}
131
- }, e.key);
132
- }
133
- return e.type === "date" ? /* @__PURE__ */ r(g, {
134
- id: "curp-birth-date",
135
- label: u,
136
- labelHint: o,
137
- value: t.birthDate,
138
- onInput: C("birthDate"),
139
- onBlur: w("birthDate"),
140
- max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
141
- disabled: l,
142
- required: e.required,
143
- error: c,
144
- showErrorIcon: !!c,
145
- "data-testid": "curp-birth-date",
146
- ...e.autoComplete ? { autoComplete: e.autoComplete } : {}
147
- }, e.key) : /* @__PURE__ */ r(m, {
148
- id: e.key === "name" ? "curp-first-name" : e.key === "firstLastName" ? "curp-first-last" : "curp-second-last",
149
- label: u,
150
- labelHint: o,
151
- value: t[e.key],
152
- onInput: C(e.key),
153
- onBlur: w(e.key),
154
- placeholder: u,
155
- disabled: l,
156
- required: e.required,
157
- error: c,
158
- showErrorIcon: !!c,
159
- ...e.autoComplete ? { autoComplete: e.autoComplete } : {}
160
- }, e.key);
161
- }),
162
- /* @__PURE__ */ r(s, { size: 16 }),
163
- /* @__PURE__ */ r(u, {
186
+ GENERATE_CURP_FIELDS.map(renderField),
187
+ /* @__PURE__ */ u(Spacer, { size: 16 }),
188
+ /* @__PURE__ */ u(Button, {
164
189
  type: "button",
165
- onClick: c,
166
- disabled: x || l,
190
+ onClick: onGenerate,
191
+ disabled: hasValidationErrors || disabled,
167
192
  "data-testid": "curp-generate",
168
- children: p.generate
193
+ children: labels.generate
169
194
  })
170
195
  ]
171
196
  });
172
- }, T = ({ config: n, manager: o, onFinish: h, onError: g }) => {
173
- let { t: _ } = e(), [v, y] = i(() => {
174
- if (o) return o;
175
- if (!n) throw Error("CurpValidation config is required when no manager is provided");
176
- return x({ config: n });
177
- }, { manageLifecycle: !o });
178
- if (a({
179
- status: v.status,
180
- onFinish: h,
181
- onError: g
182
- }), v.status === "idle" || v.status === "loading" || v.status === "verifying" || v.status === "generating") return /* @__PURE__ */ r(l, { spinnerConfig: { title: v.status === "generating" ? _("curp.status.generating") ?? "Generating..." : _("curp.status.verifying") ?? "Verifying..." } });
183
- if (v.status === "enterCurp") return /* @__PURE__ */ r(c, {
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
211
+ });
212
+ if (state.status === "idle" || state.status === "loading" || 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..." } });
213
+ if (state.status === "enterCurp") return /* @__PURE__ */ u(Page, {
184
214
  className: "IncodeCurpValidationPage",
185
- title: _("curp.enterCurp") ?? "Enter your CURP",
186
- children: /* @__PURE__ */ r(C, {
187
- curp: v.curp,
188
- errorKey: v.validationErrors?.curp,
189
- onCurpChange: (e) => y.setCurp(e),
190
- onCurpBlur: () => y.validateField("curp"),
191
- onVerify: () => y.verify(),
192
- onSwitchToGenerate: () => y.switchToGenerate(),
193
- placeholder: _("curp.placeholder.curp") ?? "CURP",
194
- continueLabel: _("curp.continue") ?? "Continue",
195
- dontHaveLabel: _("curp.dontHave") ?? "I don't have my CURP"
215
+ title: t("curp.enterCurp") ?? "Enter your CURP",
216
+ children: /* @__PURE__ */ u(CurpInput, {
217
+ curp: state.curp,
218
+ errorKey: state.validationErrors?.curp,
219
+ onCurpChange: (curp) => manager.setCurp(curp),
220
+ onCurpBlur: () => manager.validateField("curp"),
221
+ onVerify: () => manager.verify(),
222
+ onSwitchToGenerate: () => manager.switchToGenerate(),
223
+ placeholder: t("curp.placeholder.curp") ?? "CURP",
224
+ continueLabel: t("curp.continue") ?? "Continue",
225
+ dontHaveLabel: t("curp.dontHave") ?? "I don't have my CURP"
196
226
  })
197
227
  });
198
- if (v.status === "generateCurp") return /* @__PURE__ */ r(c, {
228
+ if (state.status === "generateCurp") return /* @__PURE__ */ u(Page, {
199
229
  className: "IncodeCurpValidationPage",
200
- title: _("curp.generate") ?? "Generate your CURP",
201
- hideFooterBranding: !0,
202
- children: /* @__PURE__ */ r(w, {
203
- form: v.form,
204
- validationErrors: v.validationErrors,
205
- onFormChange: (e) => y.setGenerateForm(e),
206
- onValidateField: (e) => y.validateField(e),
207
- onGenerate: () => y.generate()
230
+ title: t("curp.generate") ?? "Generate your CURP",
231
+ hideFooterBranding: true,
232
+ children: /* @__PURE__ */ u(GenerateCurpFormComponent, {
233
+ form: state.form,
234
+ validationErrors: state.validationErrors,
235
+ onFormChange: (form) => manager.setGenerateForm(form),
236
+ onValidateField: (field) => manager.validateField(field),
237
+ onGenerate: () => manager.generate()
208
238
  })
209
239
  });
210
- if (v.status === "confirmCurp") return /* @__PURE__ */ r(c, {
240
+ if (state.status === "confirmCurp") return /* @__PURE__ */ u(Page, {
211
241
  className: "IncodeCurpValidationPage",
212
- title: _("curp.status.confirm") ?? "Confirm your CURP",
213
- children: /* @__PURE__ */ r("div", {
242
+ title: t("curp.status.confirm") ?? "Confirm your CURP",
243
+ children: /* @__PURE__ */ u("div", {
214
244
  class: "IncodeCurpValidation IncodeCurpConfirm",
215
245
  children: [
216
- /* @__PURE__ */ r(m, {
246
+ /* @__PURE__ */ u(InputComposed, {
217
247
  id: "curp-confirm-input",
218
- value: v.curp,
219
- readOnly: !0,
220
- "aria-label": _("curp.status.generatedCurp") ?? "Generated CURP",
248
+ value: state.curp,
249
+ readOnly: true,
250
+ "aria-label": t("curp.status.generatedCurp") ?? "Generated CURP",
221
251
  "data-testid": "curp-confirm-input"
222
252
  }),
223
- /* @__PURE__ */ r(s, {}),
224
- /* @__PURE__ */ r(u, {
253
+ /* @__PURE__ */ u(Spacer, {}),
254
+ /* @__PURE__ */ u(Button, {
225
255
  type: "button",
226
- onClick: () => y.confirmGenerated(),
256
+ onClick: () => manager.confirmGenerated(),
227
257
  "data-testid": "curp-confirm",
228
- children: _("curp.continue") ?? "Continue"
258
+ children: t("curp.continue") ?? "Continue"
229
259
  })
230
260
  ]
231
261
  })
232
262
  });
233
- if (v.status === "success") return /* @__PURE__ */ r(c, {
263
+ if (state.status === "success") return /* @__PURE__ */ u(Page, {
234
264
  className: "IncodeCurpValidationPage",
235
- children: /* @__PURE__ */ r("div", {
265
+ children: /* @__PURE__ */ u("div", {
236
266
  class: "IncodeCurpValidation IncodeCurpSuccess",
237
267
  children: [
238
- /* @__PURE__ */ r(f, { size: 64 }),
239
- /* @__PURE__ */ r(s, { size: 16 }),
240
- /* @__PURE__ */ r(p, {
268
+ /* @__PURE__ */ u(SuccessIcon, { size: 64 }),
269
+ /* @__PURE__ */ u(Spacer, { size: 16 }),
270
+ /* @__PURE__ */ u(AutoFocusTitle, {
241
271
  className: "IncodeCurpSuccessTitle",
242
- children: _("curp.status.verified") ?? "Verified"
272
+ children: t("curp.status.verified") ?? "Verified"
243
273
  })
244
274
  ]
245
275
  })
246
276
  });
247
- if (v.status === "failure" || v.status === "generateError") {
248
- let e = v.retriesLeft > 0, n = v.status === "failure" ? _("curp.status.notVerified") ?? "Not verified" : _("curp.status.couldntGenerate") ?? "Couldn't generate CURP";
249
- return /* @__PURE__ */ r(c, {
277
+ if (state.status === "failure" || state.status === "generateError") {
278
+ const canRetry = state.retriesLeft > 0;
279
+ const title = state.status === "failure" ? t("curp.status.notVerified") ?? "Not verified" : t("curp.status.couldntGenerate") ?? "Couldn't generate CURP";
280
+ return /* @__PURE__ */ u(Page, {
250
281
  className: "IncodeCurpValidationPage",
251
- children: /* @__PURE__ */ r("div", {
282
+ children: /* @__PURE__ */ u("div", {
252
283
  class: "IncodeCurpValidation IncodeCurpFailure",
253
284
  children: [
254
- /* @__PURE__ */ r(s, {}),
255
- /* @__PURE__ */ r(d, { size: 64 }),
256
- /* @__PURE__ */ r(s, { size: 16 }),
257
- /* @__PURE__ */ r(p, {
285
+ /* @__PURE__ */ u(Spacer, {}),
286
+ /* @__PURE__ */ u(ErrorIcon, { size: 64 }),
287
+ /* @__PURE__ */ u(Spacer, { size: 16 }),
288
+ /* @__PURE__ */ u(AutoFocusTitle, {
258
289
  className: "IncodeCurpFailureTitle",
259
- children: n
290
+ children: title
260
291
  }),
261
- v.status === "generateError" && e && /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ r(s, { size: 12 }), /* @__PURE__ */ r("p", {
292
+ state.status === "generateError" && canRetry && /* @__PURE__ */ u(k, { children: [/* @__PURE__ */ u(Spacer, { size: 12 }), /* @__PURE__ */ u("p", {
262
293
  class: "IncodeCurpFailureHint",
263
294
  role: "alert",
264
- children: _("curp.status.checkInfo") ?? "Please check your information"
295
+ children: t("curp.status.checkInfo") ?? "Please check your information"
265
296
  })] }),
266
- /* @__PURE__ */ r(s, {}),
267
- e && /* @__PURE__ */ r(t, { children: /* @__PURE__ */ r(u, {
297
+ /* @__PURE__ */ u(Spacer, {}),
298
+ canRetry && /* @__PURE__ */ u(k, { children: /* @__PURE__ */ u(Button, {
268
299
  type: "button",
269
- onClick: () => y.retry(),
300
+ onClick: () => manager.retry(),
270
301
  "data-testid": "curp-retry",
271
- children: v.status === "failure" ? _("curp.status.tryAgain") ?? "Try again" : _("curp.status.edit") ?? "Edit information"
302
+ children: state.status === "failure" ? t("curp.status.tryAgain") ?? "Try again" : t("curp.status.edit") ?? "Edit information"
272
303
  }) })
273
304
  ]
274
305
  })
275
306
  });
276
307
  }
277
- return v.status === "finished" || v.status, null;
278
- }, E = ({ config: e, manager: t, onFinish: n, onError: i }) => /* @__PURE__ */ r(o, { children: e || t ? /* @__PURE__ */ r(T, {
279
- config: e,
280
- manager: t,
281
- onFinish: n,
282
- onError: i
283
- }) : null });
284
- _(E, "incode-curp-validation");
308
+ if (state.status === "finished" || state.status === "closed") return null;
309
+ return null;
310
+ };
311
+ var CurpValidation = ({ config, manager, onFinish, onError }) => {
312
+ return /* @__PURE__ */ u(IncodeComponent, { children: config || manager ? /* @__PURE__ */ u(CurpValidationContent, {
313
+ config,
314
+ manager,
315
+ onFinish,
316
+ onError
317
+ }) : null });
318
+ };
319
+ registerIncodeModuleElement(CurpValidation, "incode-curp-validation");
285
320
  //#endregion
286
- export { E as CurpValidation };
321
+ export { CurpValidation };