@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
@@ -0,0 +1,352 @@
1
+ import { n as useTranslation } from "./i18n-gTHArCl9.js";
2
+ import { d as T, m as g, 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 Button } from "./button-B-qlr4iI.js";
8
+ import { t as VerificationResult } from "./verificationResult-CbVRf6Kh.js";
9
+ import { t as InputComposed } from "./inputComposed-5V2nLTqH.js";
10
+ import { n as countries, t as PhoneInputComposed } from "./phoneInputComposed-D_IabWKJ.js";
11
+ import { t as DropdownComposed } from "./dropdownComposed-BF4L-7mJ.js";
12
+ import { t as DateInputComposed } from "./dateInputComposed-DY97tQVK.js";
13
+ import { t as registerIncodeModuleElement } from "./incodeModule-DkA_yd0X.js";
14
+ import { n as getRequiredHintMode, t as getFieldHint } from "./requiredLabelHint-DEadtiwx.js";
15
+ import { t as EmailInput } from "./emailInput-D8qiAdjn.js";
16
+ import { formatCPF, isValidCPF } from "@incodetech/core/cpf-ocr";
17
+ import { createDynamicFormsManager } from "@incodetech/core/dynamic-forms";
18
+ //#region src/modules/dynamic-forms/dynamicForms.tsx
19
+ function getEffectiveType(question) {
20
+ return question.inputType ?? question.overrides ?? "TEXT";
21
+ }
22
+ function getAutocompleteToken(type) {
23
+ switch (type) {
24
+ case "NAME": return "name";
25
+ case "PHONE": return "tel";
26
+ case "DATE": return "bday";
27
+ default: return;
28
+ }
29
+ }
30
+ var QuestionInput = ({ question, value, disabled = false, error, labelHint, onChange, onFormatValidityChange, onBlur }) => {
31
+ const { t } = useTranslation();
32
+ const effectiveType = getEffectiveType(question);
33
+ const id = `dynamic-form-${question.questionId}`;
34
+ const label = question.question;
35
+ const isRequired = !question.isOptional;
36
+ const autocomplete = getAutocompleteToken(effectiveType);
37
+ const isCountryField = effectiveType === "COUNTRY" || effectiveType === "NATIONALITY";
38
+ const countryOptions = T(() => isCountryField ? countries.map((c) => ({
39
+ value: c.code,
40
+ label: `${c.emoji} ${c.name}`,
41
+ ariaLabel: c.name
42
+ })) : [], [isCountryField]);
43
+ if (effectiveType === "YESNO") {
44
+ const yesNoOptions = [{
45
+ value: "YES",
46
+ label: t("common.yes")
47
+ }, {
48
+ value: "NO",
49
+ label: t("common.no")
50
+ }];
51
+ return /* @__PURE__ */ u("div", {
52
+ class: "IncodeDynamicFormsField",
53
+ children: /* @__PURE__ */ u(DropdownComposed, {
54
+ id,
55
+ name: question.questionId,
56
+ label,
57
+ labelHint,
58
+ value,
59
+ options: yesNoOptions,
60
+ required: isRequired,
61
+ error,
62
+ disabled,
63
+ onChange: (val) => onChange(question.questionId, val),
64
+ onBlur: () => onBlur?.(question.questionId)
65
+ })
66
+ });
67
+ }
68
+ if (effectiveType === "DATE") return /* @__PURE__ */ u("div", {
69
+ class: "IncodeDynamicFormsField",
70
+ children: /* @__PURE__ */ u(DateInputComposed, {
71
+ id,
72
+ name: question.questionId,
73
+ label,
74
+ labelHint,
75
+ value,
76
+ required: isRequired,
77
+ autocomplete,
78
+ error,
79
+ showErrorIcon: !!error,
80
+ disabled,
81
+ onInput: (e) => onChange(question.questionId, e.target.value),
82
+ onBlur: () => onBlur?.(question.questionId)
83
+ })
84
+ });
85
+ if (effectiveType === "PHONE") return /* @__PURE__ */ u("div", {
86
+ class: "IncodeDynamicFormsField",
87
+ onFocusOut: () => onBlur?.(question.questionId),
88
+ children: /* @__PURE__ */ u(PhoneInputComposed, {
89
+ id,
90
+ label,
91
+ labelHint,
92
+ value,
93
+ required: isRequired,
94
+ autocomplete,
95
+ error,
96
+ showErrorIcon: !!error,
97
+ disabled,
98
+ onChange: (fullNumber, isValid) => {
99
+ onChange(question.questionId, fullNumber);
100
+ onFormatValidityChange?.(question.questionId, isValid);
101
+ }
102
+ })
103
+ });
104
+ if (effectiveType === "COUNTRY" || effectiveType === "NATIONALITY") return /* @__PURE__ */ u("div", {
105
+ class: "IncodeDynamicFormsField",
106
+ children: /* @__PURE__ */ u(DropdownComposed, {
107
+ id,
108
+ label,
109
+ labelHint,
110
+ value,
111
+ options: countryOptions,
112
+ searchable: true,
113
+ required: isRequired,
114
+ error,
115
+ disabled,
116
+ onChange: (val) => onChange(question.questionId, val),
117
+ onBlur: () => onBlur?.(question.questionId)
118
+ })
119
+ });
120
+ if (effectiveType === "SELECT" || effectiveType === "MULTISELECT") {
121
+ const selectOptions = (question.options ?? []).map((o) => ({
122
+ value: o,
123
+ label: o
124
+ }));
125
+ return /* @__PURE__ */ u("div", {
126
+ class: "IncodeDynamicFormsField",
127
+ children: /* @__PURE__ */ u(DropdownComposed, {
128
+ id,
129
+ label,
130
+ labelHint,
131
+ value,
132
+ options: selectOptions,
133
+ searchable: selectOptions.length > 5,
134
+ required: isRequired,
135
+ error,
136
+ disabled,
137
+ onChange: (val) => onChange(question.questionId, val),
138
+ onBlur: () => onBlur?.(question.questionId)
139
+ })
140
+ });
141
+ }
142
+ if (effectiveType === "EMAIL") return /* @__PURE__ */ u("div", {
143
+ class: "IncodeDynamicFormsField",
144
+ children: /* @__PURE__ */ u(EmailInput, {
145
+ value,
146
+ emailError: error,
147
+ label,
148
+ labelHint,
149
+ required: isRequired,
150
+ disabled,
151
+ onEmailChange: (email, isValid) => {
152
+ onChange(question.questionId, email);
153
+ onFormatValidityChange?.(question.questionId, isValid);
154
+ },
155
+ onBlur: () => onBlur?.(question.questionId)
156
+ })
157
+ });
158
+ if (effectiveType === "CPF") return /* @__PURE__ */ u("div", {
159
+ class: "IncodeDynamicFormsField",
160
+ children: /* @__PURE__ */ u(InputComposed, {
161
+ id,
162
+ name: question.questionId,
163
+ label,
164
+ labelHint,
165
+ inputMode: "numeric",
166
+ maxLength: 14,
167
+ value,
168
+ required: isRequired,
169
+ error,
170
+ showErrorIcon: !!error,
171
+ disabled,
172
+ onInput: (e) => {
173
+ const formatted = formatCPF(e.target.value);
174
+ e.target.value = formatted;
175
+ onChange(question.questionId, formatted);
176
+ onFormatValidityChange?.(question.questionId, isValidCPF(formatted));
177
+ },
178
+ onBlur: () => onBlur?.(question.questionId)
179
+ })
180
+ });
181
+ if (effectiveType === "NUMBER") return /* @__PURE__ */ u("div", {
182
+ class: "IncodeDynamicFormsField",
183
+ children: /* @__PURE__ */ u(InputComposed, {
184
+ id,
185
+ name: question.questionId,
186
+ label,
187
+ labelHint,
188
+ type: "number",
189
+ inputMode: "numeric",
190
+ value,
191
+ required: isRequired,
192
+ error,
193
+ showErrorIcon: !!error,
194
+ disabled,
195
+ onInput: (e) => {
196
+ const numeric = e.target.value.replace(/[^0-9]/g, "");
197
+ onChange(question.questionId, numeric);
198
+ },
199
+ onBlur: () => onBlur?.(question.questionId)
200
+ })
201
+ });
202
+ return /* @__PURE__ */ u("div", {
203
+ class: "IncodeDynamicFormsField",
204
+ children: /* @__PURE__ */ u(InputComposed, {
205
+ id,
206
+ name: question.questionId,
207
+ label,
208
+ labelHint,
209
+ type: "text",
210
+ value,
211
+ required: isRequired,
212
+ autocomplete,
213
+ error,
214
+ showErrorIcon: !!error,
215
+ disabled,
216
+ onInput: (e) => onChange(question.questionId, e.target.value),
217
+ onBlur: () => onBlur?.(question.questionId)
218
+ })
219
+ });
220
+ };
221
+ var ScreenForm = ({ screen, answers, validationErrors, canSubmit, isSubmitting = false, onAnswerChange, onAnswerValidityChange, onValidateField, onSubmit }) => {
222
+ const { t } = useTranslation();
223
+ const title = screen.hideTitle ? void 0 : screen.title || t("dynamicForms.title");
224
+ const titleId = g();
225
+ const fallbackFormLabel = screen.title || t("dynamicForms.title");
226
+ const hintMode = T(() => getRequiredHintMode(screen.questions.map((q) => !q.isOptional)), [screen]);
227
+ return /* @__PURE__ */ u(Page, {
228
+ className: "IncodeDynamicFormsPage",
229
+ title,
230
+ titleId: title ? titleId : void 0,
231
+ hideFooterBranding: true,
232
+ children: [
233
+ /* @__PURE__ */ u(Spacer, { size: 32 }),
234
+ isSubmitting && /* @__PURE__ */ u("div", {
235
+ role: "status",
236
+ "aria-live": "polite",
237
+ class: "IncodeSrOnly",
238
+ children: t("common.processing")
239
+ }),
240
+ /* @__PURE__ */ u("form", {
241
+ class: "IncodeDynamicFormsForm",
242
+ onSubmit: (e) => {
243
+ e.preventDefault();
244
+ onSubmit();
245
+ },
246
+ "aria-labelledby": title ? titleId : void 0,
247
+ "aria-label": title ? void 0 : fallbackFormLabel,
248
+ "aria-busy": isSubmitting || void 0,
249
+ children: [screen.questions.map((question) => {
250
+ const errorKey = validationErrors?.[question.questionId];
251
+ const hint = getFieldHint(hintMode, !question.isOptional);
252
+ const labelHint = hint ? t(`forms.label.${hint}`) ?? void 0 : void 0;
253
+ return /* @__PURE__ */ u(QuestionInput, {
254
+ question,
255
+ value: answers[question.questionId] ?? "",
256
+ disabled: isSubmitting,
257
+ error: errorKey ? t(errorKey) : void 0,
258
+ labelHint,
259
+ onChange: onAnswerChange,
260
+ onFormatValidityChange: onAnswerValidityChange,
261
+ onBlur: onValidateField
262
+ }, question.questionId);
263
+ }), /* @__PURE__ */ u(Button, {
264
+ type: "submit",
265
+ disabled: !canSubmit,
266
+ isLoading: isSubmitting,
267
+ children: t("common.continue")
268
+ })]
269
+ })
270
+ ]
271
+ });
272
+ };
273
+ var DynamicFormsContent = ({ config, manager: externalManager, onFinish }) => {
274
+ const { t } = useTranslation();
275
+ const [state, manager] = useManager(() => {
276
+ if (externalManager) return externalManager;
277
+ if (!config) throw new Error("DynamicForms config is required");
278
+ return createDynamicFormsManager({ config });
279
+ }, {
280
+ manageLifecycle: !externalManager,
281
+ autoLoad: true
282
+ });
283
+ useModuleTerminalCallbacks({
284
+ status: state.status === "closed" ? "finished" : state.status,
285
+ onFinish
286
+ });
287
+ if (state.status === "idle" || state.status === "loadingScreens") return /* @__PURE__ */ u(VerificationResult, {
288
+ status: "submitting",
289
+ submittingTitle: t("common.loading")
290
+ });
291
+ if (state.status === "inputting" || state.status === "submitting") {
292
+ const isSubmitting = state.status === "submitting";
293
+ const canSubmit = state.status === "inputting" ? state.canSubmit : false;
294
+ return /* @__PURE__ */ u(ScreenForm, {
295
+ screen: state.currentScreen,
296
+ answers: state.answers,
297
+ validationErrors: state.validationErrors,
298
+ canSubmit,
299
+ isSubmitting,
300
+ onAnswerChange: (questionId, value) => manager.setAnswer(questionId, value),
301
+ onAnswerValidityChange: (questionId, isValid) => manager.setAnswerValidity(questionId, isValid),
302
+ onValidateField: (questionId) => manager.validateField(questionId),
303
+ onSubmit: () => manager.submit()
304
+ }, state.screenIndex);
305
+ }
306
+ if (state.status === "success") return /* @__PURE__ */ u(VerificationResult, {
307
+ status: "success",
308
+ successTitle: t("dynamicForms.success")
309
+ });
310
+ if (state.status === "misconfigured") return /* @__PURE__ */ u(VerificationResult, {
311
+ status: "failure",
312
+ failureTitle: t("dynamicForms.misconfigured"),
313
+ onSkip: () => manager.close(),
314
+ skipLabel: t("common.close")
315
+ });
316
+ if (state.status === "finished" || state.status === "closed") return null;
317
+ };
318
+ /**
319
+ * Dynamic Forms UI component.
320
+ *
321
+ * Renders multi-screen forms driven by backend configuration.
322
+ * Supports all field types: TEXT, NAME, NUMBER, DATE, EMAIL, PHONE, CPF, COUNTRY, NATIONALITY, YESNO, SELECT, MULTISELECT.
323
+ *
324
+ * @example Basic usage with flowId
325
+ * ```tsx
326
+ * <DynamicForms
327
+ * config={{ flowId: 'your-flow-id' }}
328
+ * onFinish={() => router.push('/next-step')}
329
+ * onError={(err) => toast.error(err)}
330
+ * />
331
+ * ```
332
+ *
333
+ * @example Pre-loaded screens
334
+ * ```tsx
335
+ * <DynamicForms
336
+ * config={{ screens: [...] }}
337
+ * onFinish={() => router.push('/next-step')}
338
+ * />
339
+ * ```
340
+ *
341
+ * @see {@link createDynamicFormsManager} for headless usage
342
+ */
343
+ var DynamicForms = ({ config, manager, onFinish }) => {
344
+ return /* @__PURE__ */ u(IncodeComponent, { children: config || manager ? /* @__PURE__ */ u(DynamicFormsContent, {
345
+ config,
346
+ manager,
347
+ onFinish
348
+ }) : null });
349
+ };
350
+ registerIncodeModuleElement(DynamicForms, "incode-dynamic-forms");
351
+ //#endregion
352
+ export { DynamicForms };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../ekybModule-C33C4JES.js";
2
- export { e as EkybModule };
1
+ import { t as EkybModule } from "../ekybModule-DSOvdViS.js";
2
+ export { EkybModule };
@@ -0,0 +1,2 @@
1
+ import { t as EkybModule } from "./ekybModule-DSOvdViS.js";
2
+ export { EkybModule };
@@ -0,0 +1,279 @@
1
+ import { n as useTranslation } from "./i18n-gTHArCl9.js";
2
+ import { S as k, _ as y, d as T, l as A, v as u } from "./vendor-preact-BH7vOa2r.js";
3
+ import { c as useManager, i as useFormScrollable, 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 "./extensibility-FK5oOsIJ.js";
8
+ import { t as Spinner } from "./spinner-BfBIZkDQ.js";
9
+ import { t as Button } from "./button-B-qlr4iI.js";
10
+ import { t as VerificationResult } from "./verificationResult-CbVRf6Kh.js";
11
+ import { t as InputComposed } from "./inputComposed-5V2nLTqH.js";
12
+ import { i as translateError, r as FormField } from "./radioGroupComposed-DwYW-Ld-.js";
13
+ import { t as DropdownComposed } from "./dropdownComposed-BF4L-7mJ.js";
14
+ import { t as registerIncodeModuleElement } from "./incodeModule-DkA_yd0X.js";
15
+ import { n as getRequiredHintMode, t as getFieldHint } from "./requiredLabelHint-DEadtiwx.js";
16
+ import { n as AddressAutocomplete, t as getAccessibleOptionLabel } from "./optionAccessibleLabel-Czc2YC8z.js";
17
+ import { t as CountrySelector$1 } from "./countrySelector-CzyuaDIs.js";
18
+ import { DEV_ONLY_COUNTRIES, SUPPORTED_COUNTRIES, createEkybManager } from "@incodetech/core/ekyb";
19
+ //#region src/modules/ekyb/countrySelector.tsx
20
+ var CountrySelector = ({ value, onChange }) => {
21
+ const { t } = useTranslation();
22
+ return /* @__PURE__ */ u(CountrySelector$1, {
23
+ id: "ekyb-country",
24
+ label: t("ekyb.country"),
25
+ value,
26
+ onChange,
27
+ countryCodes: SUPPORTED_COUNTRIES,
28
+ devOnlyCountryCodes: DEV_ONLY_COUNTRIES,
29
+ "data-testid": "ekyb-country-selector"
30
+ });
31
+ };
32
+ //#endregion
33
+ //#region src/modules/ekyb/fieldInput.tsx
34
+ var FieldInput = ({ field, value, error, errorParams, country: _country, labelHint, onChange, onBlur }) => {
35
+ const { t } = useTranslation();
36
+ if (field.type === "dropdown") return /* @__PURE__ */ u(DropdownComposed, {
37
+ id: `ekyb-${field.name}`,
38
+ label: t(field.label),
39
+ labelHint,
40
+ placeholder: field.placeholder ? t(field.placeholder) : void 0,
41
+ value,
42
+ options: (field.options ?? []).map((o) => {
43
+ const translatedOptionLabel = t(o.label);
44
+ return {
45
+ ...o,
46
+ label: translatedOptionLabel,
47
+ ariaLabel: getAccessibleOptionLabel(translatedOptionLabel)
48
+ };
49
+ }),
50
+ error: translateError(t, error, errorParams),
51
+ required: field.required,
52
+ searchable: true,
53
+ onChange: (val) => onChange(field.name, val),
54
+ onBlur: onBlur ? () => onBlur(field.name) : void 0,
55
+ "data-testid": `ekyb-field-${field.name}`
56
+ });
57
+ return /* @__PURE__ */ u(FormField, {
58
+ name: field.name,
59
+ label: field.label,
60
+ displayLabel: field.displayLabel,
61
+ value,
62
+ error,
63
+ errorParams,
64
+ required: field.required,
65
+ labelHint,
66
+ onChange,
67
+ onBlur
68
+ });
69
+ };
70
+ //#endregion
71
+ //#region src/modules/ekyb/uboInputs.tsx
72
+ var UboInputs = ({ ubos, validationErrors, canAddUbo, labelHint, onSetField, onBlur, onAdd, onRemove }) => {
73
+ const { t } = useTranslation();
74
+ const translateError$2 = (err) => translateError(t, err?.key, err?.params);
75
+ if (ubos.length === 0) return null;
76
+ return /* @__PURE__ */ u("div", {
77
+ className: "IncodeEkybUbos",
78
+ children: [ubos.map((ubo, index) => {
79
+ const nameLabel = index === 0 ? t("ekyb.uboName") : t("ekyb.uboNameWithNumber", { number: index + 1 });
80
+ const surnameLabel = index === 0 ? t("ekyb.uboSurname") : t("ekyb.uboSurnameWithNumber", { number: index + 1 });
81
+ const isFirst = index === 0;
82
+ return /* @__PURE__ */ u("div", {
83
+ className: "IncodeEkybUboEntry",
84
+ role: "group",
85
+ "aria-label": `UBO ${index + 1}`,
86
+ children: [
87
+ /* @__PURE__ */ u(InputComposed, {
88
+ id: `ubo-${index}-name`,
89
+ label: nameLabel,
90
+ labelHint,
91
+ name: `ubo-${index}-name`,
92
+ value: ubo.name,
93
+ error: translateError$2(validationErrors?.[`ubo-${index}-name`]),
94
+ required: true,
95
+ onInput: (e) => onSetField(index, "name", e.target.value),
96
+ onBlur: onBlur ? () => onBlur(`ubo-${index}-name`) : void 0,
97
+ "data-testid": `ekyb-ubo-${index}-name`
98
+ }),
99
+ /* @__PURE__ */ u(InputComposed, {
100
+ id: `ubo-${index}-surname`,
101
+ label: surnameLabel,
102
+ labelHint,
103
+ name: `ubo-${index}-surname`,
104
+ value: ubo.surname,
105
+ error: translateError$2(validationErrors?.[`ubo-${index}-surname`]),
106
+ required: true,
107
+ onInput: (e) => onSetField(index, "surname", e.target.value),
108
+ onBlur: onBlur ? () => onBlur(`ubo-${index}-surname`) : void 0,
109
+ "data-testid": `ekyb-ubo-${index}-surname`
110
+ }),
111
+ !isFirst && /* @__PURE__ */ u("button", {
112
+ className: "IncodeEkybRemoveUbo",
113
+ onClick: () => onRemove(index),
114
+ type: "button",
115
+ "aria-label": `${t("common.remove")} UBO ${index + 1}`,
116
+ children: t("common.remove")
117
+ })
118
+ ]
119
+ }, ubo.id);
120
+ }), canAddUbo && /* @__PURE__ */ u("button", {
121
+ className: "IncodeEkybAddUbo",
122
+ onClick: onAdd,
123
+ type: "button",
124
+ "data-testid": "ekyb-add-ubo",
125
+ children: t("ekyb.addAnotherUbo")
126
+ })]
127
+ });
128
+ };
129
+ //#endregion
130
+ //#region src/modules/ekyb/ekybModule.tsx
131
+ var EkybContent = ({ config, onFinish }) => {
132
+ const { t } = useTranslation();
133
+ const [state, manager] = useManager(() => createEkybManager({ config }));
134
+ useModuleTerminalCallbacks({
135
+ status: state.status === "closed" ? "finished" : state.status,
136
+ onFinish
137
+ });
138
+ if (state.status === "finished" || state.status === "closed") return null;
139
+ if (state.status === "loading") return /* @__PURE__ */ u(VerificationResult, {
140
+ status: "submitting",
141
+ submittingTitle: t("common.loading")
142
+ });
143
+ if (state.status === "submitting") return /* @__PURE__ */ u(Page, {
144
+ className: "IncodeEkybPage",
145
+ children: /* @__PURE__ */ u(Spinner, {
146
+ fullScreen: false,
147
+ title: t("common.processing"),
148
+ className: "IncodeEkybSpinner"
149
+ })
150
+ });
151
+ if (state.status === "success") return /* @__PURE__ */ u(VerificationResult, { status: "success" });
152
+ if (state.status === "error") return /* @__PURE__ */ u(VerificationResult, {
153
+ status: "failure",
154
+ onRetry: () => manager.retry()
155
+ });
156
+ if (state.status === "form") return /* @__PURE__ */ u(EkybForm, {
157
+ state,
158
+ manager
159
+ });
160
+ return null;
161
+ };
162
+ var ADDRESS_FIELD_NAMES = new Set([
163
+ "street",
164
+ "houseNo",
165
+ "addressLine2",
166
+ "city",
167
+ "state",
168
+ "postalCode"
169
+ ]);
170
+ var EkybForm = ({ state, manager }) => {
171
+ const { country, fields, values, validationErrors, isValid, ubos, canAddUbo, addressSuggestions } = state;
172
+ const { t } = useTranslation();
173
+ const formRef = A(null);
174
+ const postalCodeFieldRef = A(null);
175
+ const previousPostalCodeErrorRef = A(void 0);
176
+ const isScrollable = useFormScrollable(formRef, fields.length);
177
+ const translateError$1 = (err) => translateError(t, err?.key, err?.params);
178
+ const postalCodeErrorKey = validationErrors?.postalCode?.key;
179
+ y(() => {
180
+ const previous = previousPostalCodeErrorRef.current;
181
+ previousPostalCodeErrorRef.current = postalCodeErrorKey;
182
+ if (!postalCodeErrorKey || previous === postalCodeErrorKey) return;
183
+ const rafId = requestAnimationFrame(() => {
184
+ const postalField = postalCodeFieldRef.current;
185
+ if (!postalField) return;
186
+ (postalField.querySelector("#postalCode-error") ?? postalField).scrollIntoView({
187
+ behavior: "smooth",
188
+ block: "nearest"
189
+ });
190
+ });
191
+ return () => cancelAnimationFrame(rafId);
192
+ }, [postalCodeErrorKey]);
193
+ const businessFields = fields.filter((f) => !ADDRESS_FIELD_NAMES.has(f.name));
194
+ const addressFields = fields.filter((f) => ADDRESS_FIELD_NAMES.has(f.name));
195
+ const mode = T(() => getRequiredHintMode(fields.map((f) => f.required)), [fields]);
196
+ const labelHintFor = (required) => {
197
+ const hint = getFieldHint(mode, required);
198
+ return hint ? t(`forms.label.${hint}`) : void 0;
199
+ };
200
+ return /* @__PURE__ */ u(Page, {
201
+ className: `IncodeEkybPage${isScrollable ? " IncodeEkybPageScrollable" : ""}`,
202
+ title: t("ekyb.title"),
203
+ children: [/* @__PURE__ */ u("div", {
204
+ ref: formRef,
205
+ className: "IncodeEkybForm",
206
+ children: [
207
+ /* @__PURE__ */ u(CountrySelector, {
208
+ value: country,
209
+ onChange: (c) => manager.setCountry(c)
210
+ }),
211
+ businessFields.map((field) => /* @__PURE__ */ u(FieldInput, {
212
+ field,
213
+ value: values[field.name] ?? "",
214
+ error: translateError$1(validationErrors?.[field.name]),
215
+ country,
216
+ labelHint: labelHintFor(field.required),
217
+ onChange: (name, value) => manager.setField(name, value),
218
+ onBlur: (name) => manager.validateField(name)
219
+ }, field.name)),
220
+ /* @__PURE__ */ u(UboInputs, {
221
+ ubos,
222
+ validationErrors,
223
+ canAddUbo,
224
+ labelHint: labelHintFor(true),
225
+ onSetField: (index, field, value) => manager.setUboField(index, field, value),
226
+ onBlur: (fieldKey) => manager.validateField(fieldKey),
227
+ onAdd: () => manager.addUbo(),
228
+ onRemove: (index) => manager.removeUbo(index)
229
+ }),
230
+ addressFields.length > 0 && /* @__PURE__ */ u(k, { children: [/* @__PURE__ */ u("h3", {
231
+ className: "IncodeEkybSectionHeader",
232
+ children: t("ekyb.addressDetails")
233
+ }), addressFields.map((field) => {
234
+ if (field.name === "street") return /* @__PURE__ */ u(AddressAutocomplete, {
235
+ label: field.label,
236
+ labelHint: labelHintFor(field.required),
237
+ value: values.street ?? "",
238
+ error: translateError$1(validationErrors?.street),
239
+ suggestions: addressSuggestions,
240
+ required: field.required,
241
+ onChange: (value) => manager.setField("street", value),
242
+ onSearch: (query) => manager.searchAddress(query),
243
+ onSelect: (suggestion) => manager.selectAddress(suggestion),
244
+ onBlur: () => manager.validateField("street")
245
+ }, field.name);
246
+ return /* @__PURE__ */ u("div", {
247
+ ref: field.name === "postalCode" ? postalCodeFieldRef : void 0,
248
+ children: /* @__PURE__ */ u(FieldInput, {
249
+ field,
250
+ value: values[field.name] ?? "",
251
+ error: translateError$1(validationErrors?.[field.name]),
252
+ country,
253
+ labelHint: labelHintFor(field.required),
254
+ onChange: (name, value) => manager.setField(name, value),
255
+ onBlur: (name) => manager.validateField(name)
256
+ })
257
+ }, field.name);
258
+ })] })
259
+ ]
260
+ }), /* @__PURE__ */ u("div", {
261
+ className: "IncodeEkybFooter",
262
+ children: [/* @__PURE__ */ u(Button, {
263
+ onClick: () => manager.submit(),
264
+ disabled: !isValid,
265
+ "data-testid": "ekyb-submit",
266
+ children: t("ekyb.continue")
267
+ }), /* @__PURE__ */ u(Spacer, { size: 16 })]
268
+ })]
269
+ });
270
+ };
271
+ var EkybModule = ({ config, onFinish }) => {
272
+ return /* @__PURE__ */ u(IncodeComponent, { children: config ? /* @__PURE__ */ u(EkybContent, {
273
+ config,
274
+ onFinish
275
+ }) : null });
276
+ };
277
+ registerIncodeModuleElement(EkybModule, "incode-ekyb");
278
+ //#endregion
279
+ export { EkybModule as t };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../ekycModule-BJOgtTAh.js";
2
- export { e as EkycModule };
1
+ import { t as EkycModule } from "../ekycModule-DtzcD2wV.js";
2
+ export { EkycModule };
@@ -0,0 +1,2 @@
1
+ import { t as EkycModule } from "./ekycModule-DtzcD2wV.js";
2
+ export { EkycModule };