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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/dist/ae-signature/ae-signature.es.js +15 -13
  2. package/dist/aligndevicelottie-DY_bX_p8.js +12769 -0
  3. package/dist/antifraud/antifraud.es.js +22 -19
  4. package/dist/authentication/authentication.es.js +42 -33
  5. package/dist/autoFocusTitle-DM6PvgcP.js +29 -0
  6. package/dist/{back-horizontal-hint-DsPhKbR4.js → back-horizontal-hint-BXYix0Wj.js} +26 -26
  7. package/dist/back-tutorial-vb1MxlrT.js +14597 -0
  8. package/dist/{back-vertical-hint-BFJbYQrX.js → back-vertical-hint-DNSh6JNH.js} +27 -27
  9. package/dist/backdevicelottie-HypPqBz7.js +16690 -0
  10. package/dist/base.css +5 -0
  11. package/dist/blurdevicelottie-CBXtBFiJ.js +15951 -0
  12. package/dist/bottomSheet-BuzqNQtG.js +39 -0
  13. package/dist/browser-ponyfill-CLLvZCVg.js +441 -0
  14. package/dist/button-B-qlr4iI.js +35 -0
  15. package/dist/checkbox-CTPETqo5.js +96 -0
  16. package/dist/consent/consent.es.js +75 -64
  17. package/dist/countrySelector-CzyuaDIs.js +60 -0
  18. package/dist/cpf-ocr/cpf-ocr.es.js +2 -2
  19. package/dist/cpfOcr-DQVs3r8N.js +92 -0
  20. package/dist/cpfOcr-WNklFuxT.js +2 -0
  21. package/dist/cross-document-data-match/cross-document-data-match.es.js +20 -17
  22. package/dist/curp-validation/curp-validation.es.js +246 -211
  23. package/dist/customFields-B4MqqDI6.js +140 -0
  24. package/dist/customWatchlist-Dfqw1DQP.js +36 -0
  25. package/dist/dateInputComposed-BsPQHG5o.js +1 -0
  26. package/dist/dateInputComposed-DY97tQVK.js +69 -0
  27. package/dist/defineProperty-mefzVtTv.js +39 -0
  28. package/dist/document-capture/document-capture.es.js +2 -2
  29. package/dist/documentCapture-BE78MIlR.js +876 -0
  30. package/dist/documentCapture-BVfNZL29.js +2 -0
  31. package/dist/dropdownComposed-BF4L-7mJ.js +380 -0
  32. package/dist/dropdownComposed-mvHuRFHn.js +1 -0
  33. package/dist/dynamicForms-BYGGAQoc.js +352 -0
  34. package/dist/ekyb/ekyb.es.js +2 -2
  35. package/dist/ekybModule-BUPX0QhW.js +2 -0
  36. package/dist/ekybModule-CkTXu-4u.js +279 -0
  37. package/dist/ekyc/ekyc.es.js +2 -2
  38. package/dist/ekycModule-BWsVX39d.js +257 -0
  39. package/dist/ekycModule-DNDPqvUc.js +2 -0
  40. package/dist/electronic-signature/electronic-signature.es.js +2 -2
  41. package/dist/electronic-signature-BJSyzex9.js +426 -0
  42. package/dist/email/email.es.js +198 -78
  43. package/dist/emailInput-BHp4Apt4.js +39 -0
  44. package/dist/errorIcon-B0rmz3rw.js +26 -0
  45. package/dist/expiredId-C105HVKv.js +85 -0
  46. package/dist/extensibility-DJwVxojG.js +3070 -0
  47. package/dist/extensibility.es.js +26 -26
  48. package/dist/face-match/face-match.es.js +2 -2
  49. package/dist/faceMatch-BOFGxzzx.js +343 -0
  50. package/dist/faceMatch-CDMcFQwR.js +2 -0
  51. package/dist/field-comparison/field-comparison.es.js +2 -2
  52. package/dist/fieldComparison-BMDmQ8eA.js +88 -0
  53. package/dist/fieldComparison-Z1NleSxD.js +2 -0
  54. package/dist/{flip-animation-CuQ57qTn.js → flip-animation-BGRvygw9.js} +4221 -4221
  55. package/dist/flow/flow.es.js +597 -493
  56. package/dist/flow/styles.css +0 -8
  57. package/dist/{front-horizontal-hint-CKm7PnmS.js → front-horizontal-hint-CLSU0iVo.js} +70 -70
  58. package/dist/{front-vertical-hint-CLHC2qoH.js → front-vertical-hint-BWq-yWQ8.js} +81 -81
  59. package/dist/frontdevicelottie-CLqitJhG.js +17314 -0
  60. package/dist/geolocation/geolocation.es.js +485 -395
  61. package/dist/glaredevicelottie-BS04U6Fc.js +14478 -0
  62. package/dist/governmentValidation/governmentValidation.es.js +145 -64
  63. package/dist/governmentValidation/styles.css +0 -36
  64. package/dist/homeScreen-BsEYyiDB.js +264 -0
  65. package/dist/hooks-BtgmGvba.js +149 -0
  66. package/dist/i18n-gTHArCl9.js +2971 -0
  67. package/dist/icons-DKY3xDkf.js +360 -0
  68. package/dist/id/id.es.js +565 -413
  69. package/dist/id-laser-h-DX8UbVNH.js +467 -0
  70. package/dist/id-laser-v-DhnHdjlB.js +490 -0
  71. package/dist/id-tutorial-lj4iKtYT.js +13165 -0
  72. package/dist/id-verification/id-verification.es.js +21 -18
  73. package/dist/idOcr-BS77o1VC.js +123 -0
  74. package/dist/identity-reuse/identity-reuse.es.js +168 -130
  75. package/dist/incode-logo-57XFniXU.js +4 -0
  76. package/dist/incodeComponent-CDJxFZvS.js +63 -0
  77. package/dist/incodeModule-DkA_yd0X.js +13 -0
  78. package/dist/index.es.js +16 -14
  79. package/dist/inputComposed-5V2nLTqH.js +99 -0
  80. package/dist/inputComposed-BPOYwUBl.js +1 -0
  81. package/dist/loadingIcon-DN62ugKs.js +148 -0
  82. package/dist/lottie_light-Dp9Bz3mf.js +9031 -0
  83. package/dist/mandatoryConsent-DP189TUn.js +107 -0
  84. package/dist/modal-B5QeulDu.js +153 -0
  85. package/dist/modal.hooks-C7K9k_pY.js +202 -0
  86. package/dist/numberedStep-DVAyTPv1.js +13 -0
  87. package/dist/optionAccessibleLabel-Czc2YC8z.js +202 -0
  88. package/dist/otpInput-2IQ-JCK8.js +195 -0
  89. package/dist/page-BZ-0eNWq.js +71 -0
  90. package/dist/{passport-horizontal-hint-C_le0HVU.js → passport-horizontal-hint-DfVsf4Cc.js} +55 -55
  91. package/dist/{passport-tutorial-BYN4T_TE.js → passport-tutorial-zT1ZoA-D.js} +7096 -7084
  92. package/dist/{passport-vertical-hint-H-pyICSv.js → passport-vertical-hint-DVxbTyQp.js} +49 -49
  93. package/dist/pdf-BZA70WbM.js +22398 -0
  94. package/dist/pdfViewer-Dr63sJ51.js +114 -0
  95. package/dist/phone/phone.es.js +214 -87
  96. package/dist/phoneInputComposed-D_IabWKJ.js +12142 -0
  97. package/dist/processing-B_u8wUB7.js +8 -0
  98. package/dist/qe-signature/qe-signature.es.js +15 -13
  99. package/dist/radioGroupComposed-DwYW-Ld-.js +215 -0
  100. package/dist/redirect-to-mobile/redirect-to-mobile.es.js +2099 -859
  101. package/dist/registerIncodeElement-BJJGzVdq.js +11 -0
  102. package/dist/requiredLabelHint-DEadtiwx.js +17 -0
  103. package/dist/richText-C7GUm0WL.js +3153 -0
  104. package/dist/rolldown-runtime--E5BIlTp.js +33 -0
  105. package/dist/selfie/selfie.es.js +54 -42
  106. package/dist/selfieTutorial-CtruLyO2.js +2689 -0
  107. package/dist/signature/signature.es.js +765 -406
  108. package/dist/snackbar-Dz9crm39.js +16 -0
  109. package/dist/spinner-BfBIZkDQ.js +42 -0
  110. package/dist/spinner-DEDtE7Pz.js +1 -0
  111. package/dist/statusPage-CVCoieyd.js +28 -0
  112. package/dist/successIcon-rmzr-pxu.js +30 -0
  113. package/dist/tabs--UMd6eEB.js +103 -0
  114. package/dist/transitionSpinner-CWhGcr7c.js +26 -0
  115. package/dist/{tutorial-QzQ536BL.js → tutorial-Jv0noW4z.js} +832 -578
  116. package/dist/types/extensibility.d.ts +3 -1
  117. package/dist/types/index.d.ts +13 -4
  118. package/dist/typography-BK4AmfKX.js +45 -0
  119. package/dist/uiConfig-sgEkFuuA.js +25 -0
  120. package/dist/useModuleLoader-CuhHtmgr.js +670 -0
  121. package/dist/vendor-preact-BH7vOa2r.js +957 -0
  122. package/dist/verificationResult-CJ0JyV6A.js +64 -0
  123. package/dist/verifiedByIncode-8QBn-kgZ.js +103 -0
  124. package/dist/watchlist/watchlist.es.js +31 -26
  125. package/dist/watchlistForBusiness-RZcnjVDb.js +80 -0
  126. package/dist/workflow/styles.css +0 -8
  127. package/dist/workflow/workflow.es.js +251 -209
  128. package/package.json +4 -2
  129. package/dist/aligndevicelottie-D8KsO77t.js +0 -12757
  130. package/dist/autoFocusTitle-BpYdaSUM.js +0 -16
  131. package/dist/back-tutorial-DhSE2FJo.js +0 -14585
  132. package/dist/backdevicelottie-CJWGVMdw.js +0 -16678
  133. package/dist/blurdevicelottie-Dxt2deEB.js +0 -15939
  134. package/dist/bottomSheet-QrpyatOD.js +0 -31
  135. package/dist/browser-ponyfill-Crda_c5R.js +0 -299
  136. package/dist/button-DcCUEn2n.js +0 -24
  137. package/dist/checkbox-DCCzBAuF.js +0 -86
  138. package/dist/countrySelector-CJ8egQ4C.js +0 -58
  139. package/dist/cpfOcr-Db06i-Lm.js +0 -2
  140. package/dist/cpfOcr-FixhUeMQ.js +0 -79
  141. package/dist/customFields-C1G9xHNX.js +0 -125
  142. package/dist/customWatchlist-IKEblz7u.js +0 -31
  143. package/dist/dateInputComposed-Cg8BvYSK.js +0 -1
  144. package/dist/dateInputComposed-Ddd7HLyM.js +0 -58
  145. package/dist/defineProperty-xczUyn-m.js +0 -39
  146. package/dist/documentCapture-D9I7FjGe.js +0 -2
  147. package/dist/documentCapture-b61wlala.js +0 -765
  148. package/dist/dropdownComposed-B4U0AIak.js +0 -1
  149. package/dist/dropdownComposed-CS2pyn-g.js +0 -293
  150. package/dist/dynamicForms-tYQog0kw.js +0 -298
  151. package/dist/ekybModule-C33C4JES.js +0 -237
  152. package/dist/ekybModule-LON6G2Bz.js +0 -2
  153. package/dist/ekycModule-BJOgtTAh.js +0 -225
  154. package/dist/ekycModule-BSf_DIG7.js +0 -2
  155. package/dist/electronic-signature-OdgTyso4.js +0 -406
  156. package/dist/emailInput-CU7mLB21.js +0 -37
  157. package/dist/errorIcon-DpHzAoAo.js +0 -24
  158. package/dist/expiredId-nfVAZgTL.js +0 -70
  159. package/dist/extensibility-BbNy3mVG.js +0 -2602
  160. package/dist/faceMatch-BIila4kf.js +0 -2
  161. package/dist/faceMatch-DJ7Mqujx.js +0 -206
  162. package/dist/fieldComparison-D2RSFYl-.js +0 -84
  163. package/dist/fieldComparison-DbUyouFd.js +0 -2
  164. package/dist/frontdevicelottie-65Vyfpff.js +0 -17302
  165. package/dist/glaredevicelottie-BEyaqtc6.js +0 -14466
  166. package/dist/homeScreen-CyPddxWl.js +0 -227
  167. package/dist/hooks-MxHtZWTS.js +0 -112
  168. package/dist/i18n-Kzzvkz94.js +0 -2019
  169. package/dist/icons-9I5g9-_1.js +0 -292
  170. package/dist/id-laser-h-iCPbFixz.js +0 -467
  171. package/dist/id-laser-v-CNzwliP2.js +0 -483
  172. package/dist/id-tutorial-CF4nO4oX.js +0 -13153
  173. package/dist/idOcr-DlMLMDqa.js +0 -97
  174. package/dist/incode-logo-DX016usY.js +0 -4
  175. package/dist/incodeComponent-BoFhgK7G.js +0 -50
  176. package/dist/incodeModule-BiCoAJ5k.js +0 -13
  177. package/dist/inputComposed-DAEey9xm.js +0 -94
  178. package/dist/inputComposed-eS4B0Mkh.js +0 -1
  179. package/dist/loadingIcon-BN5YRQUb.js +0 -104
  180. package/dist/lottie_light-DLqSnziX.js +0 -4419
  181. package/dist/mandatoryConsent-DNz2jZ43.js +0 -98
  182. package/dist/modal-ZqAhwiRF.js +0 -135
  183. package/dist/modal.hooks-LdusROLW.js +0 -126
  184. package/dist/numberedStep-CdLWASwL.js +0 -11
  185. package/dist/optionAccessibleLabel-DcygPaME.js +0 -140
  186. package/dist/otpInput-C4pk4BJU.js +0 -157
  187. package/dist/page-DA3R7q0J.js +0 -69
  188. package/dist/pdf-51QeiFSx.js +0 -14967
  189. package/dist/pdfViewer-rKzTHket.js +0 -64
  190. package/dist/phoneInputComposed-CjAxk2Gj.js +0 -11230
  191. package/dist/processing-DPktVde2.js +0 -6
  192. package/dist/radioGroupComposed-DRRxVk9Z.js +0 -178
  193. package/dist/registerIncodeElement-BHWOwdSS.js +0 -7
  194. package/dist/requiredLabelHint-B6FN3v88.js +0 -13
  195. package/dist/richText-6pIbydcz.js +0 -1973
  196. package/dist/rolldown-runtime-CYMK-g2i.js +0 -20
  197. package/dist/selfieTutorial-Yo9AlUoT.js +0 -2677
  198. package/dist/snackbar-CQiiWO4p.js +0 -14
  199. package/dist/spinner-B4dcie2T.js +0 -1
  200. package/dist/spinner-CKnjVHxw.js +0 -39
  201. package/dist/statusPage-B8b3Jg6N.js +0 -28
  202. package/dist/successIcon-SlKgTSty.js +0 -28
  203. package/dist/tabs-D7lGst3Q.js +0 -78
  204. package/dist/transitionSpinner-Di3bOyOu.js +0 -17
  205. package/dist/typography-CxjaknHN.js +0 -28
  206. package/dist/uiConfig-CwpQ-IM6.js +0 -20
  207. package/dist/useModuleLoader-Bqs7fglI.js +0 -517
  208. package/dist/vendor-preact-D6SntenC.js +0 -958
  209. package/dist/verificationResult-DhT3hH1b.js +0 -90
  210. package/dist/verifiedByIncode-DpbxzO0y.js +0 -101
  211. package/dist/watchlistForBusiness-CRXVbH4l.js +0 -75
@@ -1,115 +1,242 @@
1
- import { n as e } from "../i18n-Kzzvkz94.js";
2
- import { h as t, v as n } from "../vendor-preact-D6SntenC.js";
3
- import { a as r, 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 "../button-DcCUEn2n.js";
8
- import { t as u } from "../otpInput-C4pk4BJU.js";
9
- import { t as d } from "../checkbox-DCCzBAuF.js";
10
- import { t as f } from "../phoneInputComposed-CjAxk2Gj.js";
11
- import { t as p } from "../incodeModule-BiCoAJ5k.js";
12
- import { createPhoneManager as m } from "@incodetech/core/phone";
1
+ import { n as useTranslation } from "../i18n-gTHArCl9.js";
2
+ import { h as q, v as u } from "../vendor-preact-BH7vOa2r.js";
3
+ import { a as isTerminalModuleState, 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-BZ-0eNWq.js";
7
+ import { t as Button } from "../button-B-qlr4iI.js";
8
+ import { t as OtpInput } from "../otpInput-2IQ-JCK8.js";
9
+ import { t as Checkbox } from "../checkbox-CTPETqo5.js";
10
+ import { t as PhoneInputComposed } from "../phoneInputComposed-D_IabWKJ.js";
11
+ import { t as registerIncodeModuleElement } from "../incodeModule-DkA_yd0X.js";
12
+ import { createPhoneManager } from "@incodetech/core/phone";
13
13
  //#region src/modules/phone/phone.tsx
14
- function h(e) {
15
- return e === "invalidPhone" ? "phone.invalidPhone" : e === "serverError" ? "phone.serverError" : e;
14
+ /**
15
+ * @module @incodetech/ui/phone
16
+ *
17
+ * Phone verification UI component for the Incode Web SDK.
18
+ * Provides a complete, ready-to-use phone verification experience
19
+ * with country code selection and OTP input.
20
+ *
21
+ * ## UI Usage
22
+ *
23
+ * The Phone component can be used as a React/Preact component or as a
24
+ * Web Component (`<incode-phone>`).
25
+ *
26
+ * @example React/Preact component usage
27
+ * ```tsx
28
+ * import { Phone } from '@incodetech/ui/phone';
29
+ * import { setup } from '@incodetech/core';
30
+ *
31
+ * // Configure the SDK first
32
+ * setup({ apiURL: 'https://api.example.com', token: 'your-token' });
33
+ *
34
+ * function App() {
35
+ * const config = {
36
+ * otpVerification: true,
37
+ * otpExpirationInMinutes: 5,
38
+ * prefill: false,
39
+ * };
40
+ *
41
+ * return (
42
+ * <Phone
43
+ * config={config}
44
+ * onFinish={() => console.log('Phone verified!')}
45
+ * onError={(error) => console.error('Error:', error)}
46
+ * />
47
+ * );
48
+ * }
49
+ * ```
50
+ *
51
+ * @example Web Component usage
52
+ * ```html
53
+ * <!-- Include the script -->
54
+ * <script type="module">
55
+ * import '@incodetech/ui/phone';
56
+ * import { setup } from '@incodetech/core';
57
+ *
58
+ * setup({ apiURL: 'https://api.example.com', token: 'your-token' });
59
+ *
60
+ * const phone = document.querySelector('incode-phone');
61
+ * phone.config = {
62
+ * otpVerification: true,
63
+ * otpExpirationInMinutes: 5,
64
+ * prefill: false,
65
+ * };
66
+ * phone.onFinish = () => console.log('Phone verified!');
67
+ * phone.onError = (error) => console.error('Error:', error);
68
+ * <\/script>
69
+ *
70
+ * <incode-phone></incode-phone>
71
+ * ```
72
+ *
73
+ * ## Styling
74
+ *
75
+ * The component uses CSS custom properties (variables) for theming.
76
+ * Override these variables to customize the appearance:
77
+ *
78
+ * ```css
79
+ * :root {
80
+ * --button-primary-surface-default: #0066cc;
81
+ * --input-border-default: #cccccc;
82
+ * --text-title: #333333;
83
+ * }
84
+ * ```
85
+ *
86
+ * ## Headless Alternative
87
+ *
88
+ * For complete control over the UI, use the headless `createPhoneManager`
89
+ * from `@incodetech/core/phone` instead. See the core module documentation.
90
+ */
91
+ function getPhoneErrorTranslationKey(error) {
92
+ if (error === "invalidPhone") return "phone.invalidPhone";
93
+ if (error === "serverError") return "phone.serverError";
94
+ return error;
16
95
  }
17
- function g(e) {
18
- return e === "serverError" ? "phone.serverError" : e;
96
+ function getOtpErrorTranslationKey(error) {
97
+ if (error === "serverError") return "phone.serverError";
98
+ return error;
19
99
  }
20
- var _ = ({ config: o, manager: p, onFinish: _, onError: v }) => {
21
- let { t: y } = e(), [b, x] = i(() => {
22
- if (p) return p;
23
- if (!o) throw Error("Phone config is required");
24
- return m({ config: o });
25
- }, { manageLifecycle: !p }), S = t((e) => y("phone.formatHint", { example: e }), [y]), C = t(({ callingCode: e, countryName: t }) => y("phone.countryCodeAriaLabel", {
26
- callingCode: e,
27
- countryName: t
28
- }), [y]);
29
- if (a({
30
- status: b.status,
31
- onFinish: _,
32
- onError: v,
33
- error: b.status === "error" ? b.error : void 0
34
- }), b.status === "idle" || b.status === "loadingPrefill" || b.status === "loadingStartInfo") return null;
35
- if (b.status === "inputting" || b.status === "submitting" || b.status === "sendingInitialOtp") {
36
- let e = b.status === "submitting" || b.status === "sendingInitialOtp", t = b.status === "inputting" ? b.countryCode : "US", r = b.status === "inputting" ? b.prefilledPhone : void 0, i = b.status === "inputting" && b.phoneError ? y(h(b.phoneError)) : void 0, a = b.status === "inputting" && b.validationErrors?.phone ? y(h(b.validationErrors.phone)) : void 0, o = i ?? a, u = !i && !!a, p = b.status === "inputting" ? b.isValid : !0, m = b.status === "inputting" ? b.optinEnabled ?? !1 : !1;
37
- return /* @__PURE__ */ n(c, {
100
+ var PhoneContent = ({ config, manager: externalManager, onFinish, onError }) => {
101
+ const { t } = useTranslation();
102
+ const [state, manager] = useManager(() => {
103
+ if (externalManager) return externalManager;
104
+ if (!config) throw new Error("Phone config is required");
105
+ return createPhoneManager({ config });
106
+ }, { manageLifecycle: !externalManager });
107
+ const formatHintBuilder = q((example) => t("phone.formatHint", { example }), [t]);
108
+ const countryAriaLabelBuilder = q(({ callingCode, countryName }) => t("phone.countryCodeAriaLabel", {
109
+ callingCode,
110
+ countryName
111
+ }), [t]);
112
+ useModuleTerminalCallbacks({
113
+ status: state.status,
114
+ onFinish,
115
+ onError,
116
+ error: state.status === "error" ? state.error : void 0
117
+ });
118
+ if (state.status === "idle" || state.status === "loadingPrefill" || state.status === "loadingStartInfo") return null;
119
+ if (state.status === "inputting" || state.status === "submitting" || state.status === "sendingInitialOtp") {
120
+ const isLoading = state.status === "submitting" || state.status === "sendingInitialOtp";
121
+ const countryCode = state.status === "inputting" ? state.countryCode : "US";
122
+ const prefilledPhone = state.status === "inputting" ? state.prefilledPhone : void 0;
123
+ const serverPhoneError = state.status === "inputting" && state.phoneError ? t(getPhoneErrorTranslationKey(state.phoneError)) : void 0;
124
+ const clientPhoneError = state.status === "inputting" && state.validationErrors?.phone ? t(getPhoneErrorTranslationKey(state.validationErrors.phone)) : void 0;
125
+ const phoneError = serverPhoneError ?? clientPhoneError;
126
+ const showFormatHintInError = !serverPhoneError && !!clientPhoneError;
127
+ const isValid = state.status === "inputting" ? state.isValid : true;
128
+ const optinEnabled = state.status === "inputting" ? state.optinEnabled ?? false : false;
129
+ return /* @__PURE__ */ u(Page, {
38
130
  className: "IncodePhonePage",
39
- title: y("phone.verify"),
40
- subtitle: y("email.willSendCode"),
131
+ title: t("phone.verify"),
132
+ subtitle: t("email.willSendCode"),
41
133
  children: [
42
- /* @__PURE__ */ n("div", {
134
+ /* @__PURE__ */ u("div", {
43
135
  class: "IncodePhoneInputContainer",
44
136
  children: [
45
- /* @__PURE__ */ n(f, {
137
+ /* @__PURE__ */ u(PhoneInputComposed, {
46
138
  id: "phone",
47
- countryCode: t,
48
- value: r,
49
- error: o,
50
- showFormatHintInError: u,
51
- disabled: e,
52
- onChange: (e, t) => {
53
- x.setPhoneNumber(e, t);
139
+ countryCode,
140
+ value: prefilledPhone,
141
+ error: phoneError,
142
+ showFormatHintInError,
143
+ disabled: isLoading,
144
+ onChange: (phone, isValid) => {
145
+ manager.setPhoneNumber(phone, isValid);
54
146
  },
55
147
  onBlur: () => {
56
- x.validatePhone();
148
+ manager.validatePhone();
57
149
  },
58
- formatHintBuilder: S,
59
- countryAriaLabelBuilder: C,
150
+ formatHintBuilder,
151
+ countryAriaLabelBuilder,
60
152
  "data-testid": "phone-input",
61
- showErrorIcon: !0
153
+ showErrorIcon: true
62
154
  }),
63
- /* @__PURE__ */ n(s, { size: 16 }),
64
- m && /* @__PURE__ */ n(d, {
155
+ /* @__PURE__ */ u(Spacer, { size: 16 }),
156
+ optinEnabled && /* @__PURE__ */ u(Checkbox, {
65
157
  id: "phone-optin",
66
- label: y("phone.optIn"),
158
+ label: t("phone.optIn"),
67
159
  size: "s",
68
- onChange: (e) => x.setOptInGranted(e.target.checked)
160
+ onChange: (e) => manager.setOptInGranted(e.target.checked)
69
161
  })
70
162
  ]
71
163
  }),
72
- /* @__PURE__ */ n(s, {}),
73
- /* @__PURE__ */ n(l, {
74
- onClick: () => x.submit(),
75
- disabled: !p,
76
- isLoading: e,
164
+ /* @__PURE__ */ u(Spacer, {}),
165
+ /* @__PURE__ */ u(Button, {
166
+ onClick: () => manager.submit(),
167
+ disabled: !isValid,
168
+ isLoading,
77
169
  "data-testid": "phone-submit",
78
- children: y("common.continue")
170
+ children: t("common.continue")
79
171
  })
80
172
  ]
81
173
  }, "phone-input");
82
174
  }
83
- if (b.status === "awaitingOtp" || b.status === "verifyingOtp" || b.status === "otpError" || b.status === "resendingOtp") {
84
- let e = b.status === "verifyingOtp", t = b.status === "otpError", r = b.status === "awaitingOtp", i = b.status === "resendingOtp", a = r || t || e, o = t ? y(g(b.otpError)) : void 0, s = "otpValidationErrors" in b && b.otpValidationErrors?.otp ? y("otp.incompleteCode", { length: b.otpLength }) : void 0, l = "isOtpValid" in b ? b.isOtpValid : !0;
85
- return /* @__PURE__ */ n(c, {
175
+ if (state.status === "awaitingOtp" || state.status === "verifyingOtp" || state.status === "otpError" || state.status === "resendingOtp") {
176
+ const isVerifying = state.status === "verifyingOtp";
177
+ const hasOtpError = state.status === "otpError";
178
+ const isAwaitingOtp = state.status === "awaitingOtp";
179
+ const isResending = state.status === "resendingOtp";
180
+ const showResendCooldown = isAwaitingOtp || hasOtpError || isVerifying;
181
+ const otpError = hasOtpError ? t(getOtpErrorTranslationKey(state.otpError)) : void 0;
182
+ const otpValidationError = "otpValidationErrors" in state && state.otpValidationErrors?.otp ? t("otp.incompleteCode", { length: state.otpLength }) : void 0;
183
+ const isOtpValid = "isOtpValid" in state ? state.isOtpValid : true;
184
+ return /* @__PURE__ */ u(Page, {
86
185
  className: "IncodePhonePage",
87
- title: y("otp.enterCodeSMS"),
88
- children: /* @__PURE__ */ n(u, {
89
- value: b.otpCode,
90
- otpLength: b.otpLength,
91
- resendTimer: a ? b.resendTimer : 0,
92
- canResend: a ? b.canResend : !1,
93
- isLoading: e,
94
- disabled: i || e,
95
- error: o,
96
- validationError: s,
97
- isValid: l,
98
- onSubmit: (e) => x.submitOtp(e),
99
- onChange: (e) => x.setOtpCode(e),
100
- onValidate: () => x.validateOtp(),
101
- onResend: () => x.resendOtp(),
102
- onBack: () => x.back()
186
+ title: t("otp.enterCodeSMS"),
187
+ children: /* @__PURE__ */ u(OtpInput, {
188
+ value: state.otpCode,
189
+ otpLength: state.otpLength,
190
+ resendTimer: showResendCooldown ? state.resendTimer : 0,
191
+ canResend: showResendCooldown ? state.canResend : false,
192
+ isLoading: isVerifying,
193
+ disabled: isResending || isVerifying,
194
+ error: otpError,
195
+ validationError: otpValidationError,
196
+ isValid: isOtpValid,
197
+ onSubmit: (code) => manager.submitOtp(code),
198
+ onChange: (code) => manager.setOtpCode(code),
199
+ onValidate: () => manager.validateOtp(),
200
+ onResend: () => manager.resendOtp(),
201
+ onBack: () => manager.back()
103
202
  })
104
203
  }, "phone-otp");
105
204
  }
106
- return r(b), null;
107
- }, v = ({ config: e, manager: t, onFinish: r, onError: i }) => /* @__PURE__ */ n(o, { children: e || t ? /* @__PURE__ */ n(_, {
108
- config: e,
109
- manager: t,
110
- onFinish: r,
111
- onError: i
112
- }) : null });
113
- p(v, "incode-phone");
205
+ if (isTerminalModuleState(state)) return null;
206
+ return null;
207
+ };
208
+ /**
209
+ * Phone verification UI component.
210
+ *
211
+ * Provides a complete phone verification experience including:
212
+ * - Country code selector with flag emojis
213
+ * - Phone number input with validation
214
+ * - OTP code entry with resend functionality
215
+ * - Loading states and error handling
216
+ *
217
+ * @example Basic usage
218
+ * ```tsx
219
+ * <Phone
220
+ * config={{
221
+ * otpVerification: true,
222
+ * otpExpirationInMinutes: 5,
223
+ * prefill: false,
224
+ * }}
225
+ * onFinish={() => router.push('/next-step')}
226
+ * onError={(err) => toast.error(err)}
227
+ * />
228
+ * ```
229
+ *
230
+ * @see {@link createPhoneManager} for headless usage
231
+ */
232
+ var Phone = ({ config, manager, onFinish, onError }) => {
233
+ return /* @__PURE__ */ u(IncodeComponent, { children: config || manager ? /* @__PURE__ */ u(PhoneContent, {
234
+ config,
235
+ manager,
236
+ onFinish,
237
+ onError
238
+ }) : null });
239
+ };
240
+ registerIncodeModuleElement(Phone, "incode-phone");
114
241
  //#endregion
115
- export { v as Phone };
242
+ export { Phone };