@verbb/formie-browser 1.0.13 → 1.0.15

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 (389) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/chunks/{address-country-Rx6GQTND.js → address-country-BcEQKw0T.js} +11 -5
  3. package/dist/chunks/{address-finder-k7_BXaRe.js → address-finder-BWGINCSA.js} +3 -3
  4. package/dist/chunks/address-state-DI3ndhMU.js +365 -0
  5. package/dist/chunks/{api-BUb6P-xu.js → api-BK9b340y.js} +93 -63
  6. package/dist/chunks/{api-DqpfkZWL.js → api-Dxl_CKw-.js} +202 -193
  7. package/dist/chunks/{api-sPqGbOww.js → api-ghNr2uxX.js} +15 -9
  8. package/dist/chunks/{async-nPFRNQ06.js → async-2GdXNFCE.js} +18 -1
  9. package/dist/chunks/{bpoint-Dlq34XH1.js → bpoint-BwtuyN_O.js} +3 -3
  10. package/dist/chunks/calculations-YEoVCG2q.js +310 -0
  11. package/dist/chunks/{captcha-eu-CGm8Lbrj.js → captcha-eu-DWLoQFKB.js} +6 -5
  12. package/dist/chunks/{checkbox-radio-BY2aTCOG.js → checkbox-radio-gsm8QPJg.js} +74 -75
  13. package/dist/chunks/{combobox-C0EuExSI.js → combobox-Ba08_cHL.js} +340 -328
  14. package/dist/chunks/conditions-Ceeg6ReZ.js +467 -0
  15. package/dist/chunks/country-from-ip-DDj_mFki.js +29 -0
  16. package/dist/chunks/csrf-DxHg_ZYt.js +61 -0
  17. package/dist/chunks/{custom-google-maps-BsaSirEZ.js → custom-google-maps-C4l2S3GO.js} +9 -3
  18. package/dist/chunks/{custom-link-CJ1-FjEM.js → custom-link-CLazgKYH.js} +8 -2
  19. package/dist/chunks/{custom-maps-DYW_pBid.js → custom-maps-DqcAlD0v.js} +10 -4
  20. package/dist/chunks/{date-picker-F9BUBDSW.js → date-picker-DaPvMrop.js} +467 -443
  21. package/dist/chunks/{dist-D6i-VNgM.js → dist-ZLeW0zZ3.js} +1281 -453
  22. package/dist/chunks/{eway-D9_m8ooj.js → eway-uw0DzU-L.js} +5 -5
  23. package/dist/chunks/field-references.resolver-Ca8MguFv.js +104 -0
  24. package/dist/chunks/{file-upload-rqfZNqlH.js → file-upload-B8_mH012.js} +119 -99
  25. package/dist/chunks/friendly-captcha-v1-CVXaXgDO.js +34 -0
  26. package/dist/chunks/{friendly-captcha-v2-CLSAbkqx.js → friendly-captcha-v2-DkeIVTKI.js} +6 -5
  27. package/dist/chunks/{friendly-challenge-8uPatWqk.js → friendly-challenge-DPG9MJb1.js} +111 -102
  28. package/dist/chunks/{go-cardless-DAT3ZaQf.js → go-cardless-c4wLJdOt.js} +2 -2
  29. package/dist/chunks/google-address-JHYvjwgN.js +168 -0
  30. package/dist/chunks/{hcaptcha-CGLAmgjO.js → hcaptcha-Dt3ELLlP.js} +4 -4
  31. package/dist/chunks/{hidden-D7_Ch-QN.js → hidden-BZhXnNPe.js} +8 -2
  32. package/dist/chunks/http-C2QdHuWO.js +27 -0
  33. package/dist/chunks/{leaflet-src-j-lHNmhR.js → leaflet-src-DE6rv6M-.js} +42 -46
  34. package/dist/chunks/{loqate-CJPzBmSm.js → loqate-m51iPyO1.js} +3 -3
  35. package/dist/chunks/{mollie-Bibhl67p.js → mollie-Bn0PX173.js} +2 -2
  36. package/dist/chunks/{moneris-H2wSqk9h.js → moneris-BRbUvI4t.js} +3 -3
  37. package/dist/chunks/opayo-BwWdInEP.js +188 -0
  38. package/dist/chunks/{paddle-DkvIxQdG.js → paddle-CympHVvd.js} +4 -4
  39. package/dist/chunks/{password-validation-D06uH9va.js → password-validation-C8_uO_c_.js} +18 -12
  40. package/dist/chunks/{paypal-CQpAF7Ua.js → paypal-h75h6wae.js} +8 -6
  41. package/dist/chunks/{payway-CwDkC7YZ.js → payway-C9rHTCC_.js} +4 -4
  42. package/dist/chunks/{phone-country-D3ayr60L.js → phone-country-B8fv-L5_.js} +80 -63
  43. package/dist/chunks/{place-kit-BGHklIZ-.js → place-kit-BnZGQ-L1.js} +11 -11
  44. package/dist/chunks/{placekit-autocomplete.esm-DWVabQlq.js → placekit-autocomplete.esm-CZZERYur.js} +11 -15
  45. package/dist/chunks/{recaptcha-enterprise-XPId5-bS.js → recaptcha-enterprise-CUs8BO6V.js} +4 -4
  46. package/dist/chunks/{recaptcha-shared-CLYJvojk.js → recaptcha-shared-DTbTw-MF.js} +2 -2
  47. package/dist/chunks/{recaptcha-v2-checkbox-Cy-0PEPc.js → recaptcha-v2-checkbox-P1McW4Pv.js} +4 -4
  48. package/dist/chunks/{recaptcha-v2-invisible-BwRH540O.js → recaptcha-v2-invisible-FGDqozSP.js} +4 -4
  49. package/dist/chunks/{recaptcha-v3-No4Ykrhk.js → recaptcha-v3-CflUHeZD.js} +4 -4
  50. package/dist/chunks/{repeater-BVnPUqTj.js → repeater-CyhDbozO.js} +60 -40
  51. package/dist/chunks/request-profile-DhwkeCpS.js +10 -0
  52. package/dist/chunks/rich-text-uV4o_pGk.js +361 -0
  53. package/dist/chunks/{chunk-3b4jIN3o.js → rolldown-runtime-DtPi1Y-2.js} +2 -2
  54. package/dist/chunks/{scripts-CbQ7agX3.js → scripts-DrccjrFv.js} +1 -1
  55. package/dist/chunks/{sdk-BhHAYgga.js → sdk-lkwSvlpM.js} +282 -234
  56. package/dist/chunks/{shared-Bx9s0i0P.js → shared-OKhSay59.js} +27 -21
  57. package/dist/chunks/{signature-IOhuicje.js → signature-7cldFbqj.js} +138 -112
  58. package/dist/chunks/skip-CEW89ExY.js +7 -0
  59. package/dist/chunks/{snaptcha-DKx98oon.js → snaptcha-C3QLYxFT.js} +2 -2
  60. package/dist/chunks/{square-DwdcOI1G.js → square-C1z5DPVw.js} +9 -7
  61. package/dist/chunks/{stripe-DaoG2FT1.js → stripe-Dmkdkq1y.js} +11 -12
  62. package/dist/chunks/{summary-Dks0gXS3.js → summary-Bn-g5SDx.js} +48 -46
  63. package/dist/chunks/{survey-likert-DkE6bR7B.js → survey-likert-fk1hUPff.js} +7 -1
  64. package/dist/chunks/{survey-rank-DN6x4IZM.js → survey-rank-BsLGl2LX.js} +37 -25
  65. package/dist/chunks/{survey-rating-BnsNL9U5.js → survey-rating-DVS6e6fM.js} +17 -5
  66. package/dist/chunks/{table-CAjCJHrL.js → table-j7MlLLCc.js} +22 -16
  67. package/dist/chunks/{text-limit-BGaY0jhI.js → text-limit-LGMPhFuC.js} +40 -34
  68. package/dist/chunks/{theme-classes-Tv7q7ToE.js → theme-classes-DAQuEqdP.js} +1 -1
  69. package/dist/chunks/{turnstile-DJakPzQD.js → turnstile-ptihQfLl.js} +4 -4
  70. package/dist/chunks/{upload-manager-W-QDgxKD.js → upload-manager-BW7l-BhF.js} +459 -387
  71. package/dist/chunks/{utils-Vqp8i_RM.js → utils-DpUBPadZ.js} +20 -14
  72. package/dist/css/formie-base.css +104 -1
  73. package/dist/css/theme/_messages.css +2 -0
  74. package/dist/css/theme/_tokens.css +31 -25
  75. package/dist/css/theme/forms/_form.css +5 -1
  76. package/dist/index.d.ts +5 -4
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +1779 -1415
  79. package/dist/js/contracts/client.d.ts +5 -3
  80. package/dist/js/contracts/client.d.ts.map +1 -1
  81. package/dist/js/contracts/common.d.ts +2 -2
  82. package/dist/js/contracts/common.d.ts.map +1 -1
  83. package/dist/js/contracts/modules.d.ts +37 -12
  84. package/dist/js/contracts/modules.d.ts.map +1 -1
  85. package/dist/js/contracts/schema.d.ts +20 -38
  86. package/dist/js/contracts/schema.d.ts.map +1 -1
  87. package/dist/js/contracts/theme.d.ts +4 -1
  88. package/dist/js/contracts/theme.d.ts.map +1 -1
  89. package/dist/js/core/client-rendered-modules.d.ts +17 -0
  90. package/dist/js/core/client-rendered-modules.d.ts.map +1 -0
  91. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  92. package/dist/js/core/field-error-aria.d.ts +23 -0
  93. package/dist/js/core/field-error-aria.d.ts.map +1 -0
  94. package/dist/js/core/hydrate-modules.d.ts +10 -8
  95. package/dist/js/core/hydrate-modules.d.ts.map +1 -1
  96. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  97. package/dist/js/core/submit-result-ui.d.ts +3 -1
  98. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  99. package/dist/js/core/validation-focus.d.ts.map +1 -1
  100. package/dist/js/modules/address/address-finder.d.ts +1 -1
  101. package/dist/js/modules/address/address-finder.d.ts.map +1 -1
  102. package/dist/js/modules/address/factories.d.ts +3 -3
  103. package/dist/js/modules/address/factories.d.ts.map +1 -1
  104. package/dist/js/modules/address/google-address.d.ts +12 -1
  105. package/dist/js/modules/address/google-address.d.ts.map +1 -1
  106. package/dist/js/modules/address/index.d.ts +2 -2
  107. package/dist/js/modules/address/index.d.ts.map +1 -1
  108. package/dist/js/modules/address/loqate.d.ts +1 -1
  109. package/dist/js/modules/address/loqate.d.ts.map +1 -1
  110. package/dist/js/modules/address/place-kit.d.ts +1 -1
  111. package/dist/js/modules/address/place-kit.d.ts.map +1 -1
  112. package/dist/js/modules/captchas/captcha-eu.d.ts +1 -1
  113. package/dist/js/modules/captchas/captcha-eu.d.ts.map +1 -1
  114. package/dist/js/modules/captchas/factories.d.ts +11 -11
  115. package/dist/js/modules/captchas/factories.d.ts.map +1 -1
  116. package/dist/js/modules/captchas/friendly-captcha-v1.d.ts +1 -1
  117. package/dist/js/modules/captchas/friendly-captcha-v1.d.ts.map +1 -1
  118. package/dist/js/modules/captchas/friendly-captcha-v2.d.ts +1 -1
  119. package/dist/js/modules/captchas/friendly-captcha-v2.d.ts.map +1 -1
  120. package/dist/js/modules/captchas/hcaptcha.d.ts +1 -1
  121. package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -1
  122. package/dist/js/modules/captchas/index.d.ts +2 -2
  123. package/dist/js/modules/captchas/index.d.ts.map +1 -1
  124. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts +1 -1
  125. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -1
  126. package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts +1 -1
  127. package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts.map +1 -1
  128. package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts +1 -1
  129. package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts.map +1 -1
  130. package/dist/js/modules/captchas/recaptcha-v3.d.ts +1 -1
  131. package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
  132. package/dist/js/modules/captchas/snaptcha.d.ts +1 -1
  133. package/dist/js/modules/captchas/snaptcha.d.ts.map +1 -1
  134. package/dist/js/modules/captchas/turnstile.d.ts +1 -1
  135. package/dist/js/modules/captchas/turnstile.d.ts.map +1 -1
  136. package/dist/js/modules/fields/address-country.d.ts +2 -2
  137. package/dist/js/modules/fields/address-country.d.ts.map +1 -1
  138. package/dist/js/modules/fields/address-state.d.ts +2 -2
  139. package/dist/js/modules/fields/address-state.d.ts.map +1 -1
  140. package/dist/js/modules/fields/calculations.d.ts +2 -2
  141. package/dist/js/modules/fields/calculations.d.ts.map +1 -1
  142. package/dist/js/modules/fields/checkbox-radio.d.ts +2 -2
  143. package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
  144. package/dist/js/modules/fields/combobox.d.ts +2 -2
  145. package/dist/js/modules/fields/combobox.d.ts.map +1 -1
  146. package/dist/js/modules/fields/conditions/config.d.ts.map +1 -1
  147. package/dist/js/modules/fields/conditions/effects.d.ts +1 -0
  148. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
  149. package/dist/js/modules/fields/conditions/evaluator.d.ts +4 -1
  150. package/dist/js/modules/fields/conditions/evaluator.d.ts.map +1 -1
  151. package/dist/js/modules/fields/conditions/references.d.ts.map +1 -1
  152. package/dist/js/modules/fields/conditions/submission-context.d.ts +15 -0
  153. package/dist/js/modules/fields/conditions/submission-context.d.ts.map +1 -0
  154. package/dist/js/modules/fields/conditions/types.d.ts +3 -1
  155. package/dist/js/modules/fields/conditions/types.d.ts.map +1 -1
  156. package/dist/js/modules/fields/conditions/values.d.ts +1 -1
  157. package/dist/js/modules/fields/conditions/values.d.ts.map +1 -1
  158. package/dist/js/modules/fields/conditions.d.ts +2 -2
  159. package/dist/js/modules/fields/conditions.d.ts.map +1 -1
  160. package/dist/js/modules/fields/custom-google-maps.d.ts +2 -2
  161. package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -1
  162. package/dist/js/modules/fields/custom-link.d.ts +2 -2
  163. package/dist/js/modules/fields/custom-link.d.ts.map +1 -1
  164. package/dist/js/modules/fields/custom-maps.d.ts +2 -2
  165. package/dist/js/modules/fields/custom-maps.d.ts.map +1 -1
  166. package/dist/js/modules/fields/date-picker.d.ts +2 -2
  167. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  168. package/dist/js/modules/fields/file-upload.d.ts +2 -2
  169. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  170. package/dist/js/modules/fields/hidden.d.ts +2 -2
  171. package/dist/js/modules/fields/hidden.d.ts.map +1 -1
  172. package/dist/js/modules/fields/index.d.ts +2 -2
  173. package/dist/js/modules/fields/index.d.ts.map +1 -1
  174. package/dist/js/modules/fields/password-validation.d.ts +2 -2
  175. package/dist/js/modules/fields/password-validation.d.ts.map +1 -1
  176. package/dist/js/modules/fields/phone-country.d.ts +2 -2
  177. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  178. package/dist/js/modules/fields/repeater.d.ts +2 -2
  179. package/dist/js/modules/fields/repeater.d.ts.map +1 -1
  180. package/dist/js/modules/fields/rich-text.d.ts +2 -2
  181. package/dist/js/modules/fields/rich-text.d.ts.map +1 -1
  182. package/dist/js/modules/fields/shared.d.ts +1 -0
  183. package/dist/js/modules/fields/shared.d.ts.map +1 -1
  184. package/dist/js/modules/fields/signature.d.ts +2 -2
  185. package/dist/js/modules/fields/signature.d.ts.map +1 -1
  186. package/dist/js/modules/fields/summary.d.ts +2 -2
  187. package/dist/js/modules/fields/summary.d.ts.map +1 -1
  188. package/dist/js/modules/fields/survey-likert.d.ts +2 -2
  189. package/dist/js/modules/fields/survey-likert.d.ts.map +1 -1
  190. package/dist/js/modules/fields/survey-rank.d.ts +2 -2
  191. package/dist/js/modules/fields/survey-rank.d.ts.map +1 -1
  192. package/dist/js/modules/fields/survey-rating.d.ts +2 -2
  193. package/dist/js/modules/fields/survey-rating.d.ts.map +1 -1
  194. package/dist/js/modules/fields/table.d.ts +2 -2
  195. package/dist/js/modules/fields/table.d.ts.map +1 -1
  196. package/dist/js/modules/fields/text-limit.d.ts +2 -2
  197. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  198. package/dist/js/modules/fields/upload-manager.d.ts +2 -2
  199. package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
  200. package/dist/js/modules/loader.d.ts +10 -4
  201. package/dist/js/modules/loader.d.ts.map +1 -1
  202. package/dist/js/modules/payments/bpoint.d.ts +1 -1
  203. package/dist/js/modules/payments/bpoint.d.ts.map +1 -1
  204. package/dist/js/modules/payments/eway.d.ts +1 -1
  205. package/dist/js/modules/payments/eway.d.ts.map +1 -1
  206. package/dist/js/modules/payments/factories.d.ts +7 -7
  207. package/dist/js/modules/payments/factories.d.ts.map +1 -1
  208. package/dist/js/modules/payments/go-cardless.d.ts +1 -1
  209. package/dist/js/modules/payments/go-cardless.d.ts.map +1 -1
  210. package/dist/js/modules/payments/index.d.ts +2 -2
  211. package/dist/js/modules/payments/index.d.ts.map +1 -1
  212. package/dist/js/modules/payments/mollie.d.ts +1 -1
  213. package/dist/js/modules/payments/mollie.d.ts.map +1 -1
  214. package/dist/js/modules/payments/moneris.d.ts +1 -1
  215. package/dist/js/modules/payments/moneris.d.ts.map +1 -1
  216. package/dist/js/modules/payments/opayo.d.ts +1 -1
  217. package/dist/js/modules/payments/opayo.d.ts.map +1 -1
  218. package/dist/js/modules/payments/paddle.d.ts +1 -1
  219. package/dist/js/modules/payments/paddle.d.ts.map +1 -1
  220. package/dist/js/modules/payments/paypal.d.ts +1 -1
  221. package/dist/js/modules/payments/paypal.d.ts.map +1 -1
  222. package/dist/js/modules/payments/payway.d.ts +1 -1
  223. package/dist/js/modules/payments/payway.d.ts.map +1 -1
  224. package/dist/js/modules/payments/square.d.ts +1 -1
  225. package/dist/js/modules/payments/square.d.ts.map +1 -1
  226. package/dist/js/modules/payments/stripe.d.ts +1 -1
  227. package/dist/js/modules/payments/stripe.d.ts.map +1 -1
  228. package/dist/js/modules/payments/utils.d.ts +6 -0
  229. package/dist/js/modules/payments/utils.d.ts.map +1 -1
  230. package/dist/js/modules/registry.d.ts +6 -4
  231. package/dist/js/modules/registry.d.ts.map +1 -1
  232. package/dist/js/submit/pipeline.d.ts.map +1 -1
  233. package/dist/js/theme/browser-theme-state.generated.d.ts +24 -0
  234. package/dist/js/theme/browser-theme-state.generated.d.ts.map +1 -0
  235. package/dist/js/theme/theme-classes.d.ts +3 -3
  236. package/dist/js/theme/theme-classes.d.ts.map +1 -1
  237. package/dist/js/transport/forms-api.d.ts +5 -3
  238. package/dist/js/transport/forms-api.d.ts.map +1 -1
  239. package/dist/js/utils/async.d.ts +1 -0
  240. package/dist/js/utils/async.d.ts.map +1 -1
  241. package/dist/js/utils/country-from-ip.d.ts +2 -2
  242. package/dist/js/utils/country-from-ip.d.ts.map +1 -1
  243. package/dist/js/utils/csrf.d.ts +17 -0
  244. package/dist/js/utils/csrf.d.ts.map +1 -0
  245. package/dist/js/utils/field-references.parser.d.ts +1 -0
  246. package/dist/js/utils/field-references.parser.d.ts.map +1 -1
  247. package/dist/js/utils/field-references.resolver.d.ts.map +1 -1
  248. package/dist/js/utils/field-references.types.d.ts +1 -0
  249. package/dist/js/utils/field-references.types.d.ts.map +1 -1
  250. package/dist/js/utils/http.d.ts +3 -1
  251. package/dist/js/utils/http.d.ts.map +1 -1
  252. package/dist/js/utils/request-profile.d.ts +4 -0
  253. package/dist/js/utils/request-profile.d.ts.map +1 -0
  254. package/dist/js/utils/unload-warning.d.ts.map +1 -1
  255. package/dist/js/validation/rules/email.d.ts.map +1 -1
  256. package/dist/js/validation/rules/match.d.ts.map +1 -1
  257. package/dist/js/validation/rules/number.d.ts.map +1 -1
  258. package/dist/js/validation/rules/required.d.ts.map +1 -1
  259. package/dist/js/validation/rules/shared.d.ts.map +1 -1
  260. package/dist/js/validation/rules/url.d.ts.map +1 -1
  261. package/dist/js/validation/skip.d.ts +7 -0
  262. package/dist/js/validation/skip.d.ts.map +1 -0
  263. package/dist/js/validation/submit-readiness.d.ts.map +1 -1
  264. package/dist/js/validation/validator.d.ts.map +1 -1
  265. package/package.json +43 -12
  266. package/src/css/formie-base.css +104 -1
  267. package/src/css/theme/_messages.css +2 -0
  268. package/src/css/theme/_tokens.css +31 -25
  269. package/src/css/theme/forms/_form.css +5 -1
  270. package/src/index.ts +13 -8
  271. package/src/js/contracts/client.ts +5 -3
  272. package/src/js/contracts/common.ts +5 -6
  273. package/src/js/contracts/modules.ts +41 -12
  274. package/src/js/contracts/schema.ts +21 -43
  275. package/src/js/contracts/theme.ts +6 -1
  276. package/src/js/core/client-rendered-modules.ts +69 -0
  277. package/src/js/core/create-formie-client.ts +132 -86
  278. package/src/js/core/field-error-aria.ts +93 -0
  279. package/src/js/core/hydrate-modules.ts +54 -29
  280. package/src/js/core/submit-result-state.ts +51 -45
  281. package/src/js/core/submit-result-ui.ts +25 -68
  282. package/src/js/core/validation-focus.ts +20 -20
  283. package/src/js/modules/address/address-finder.ts +1 -1
  284. package/src/js/modules/address/factories.ts +15 -13
  285. package/src/js/modules/address/google-address.ts +102 -40
  286. package/src/js/modules/address/index.ts +2 -2
  287. package/src/js/modules/address/loqate.ts +1 -1
  288. package/src/js/modules/address/place-kit.ts +14 -8
  289. package/src/js/modules/captchas/captcha-eu.ts +2 -2
  290. package/src/js/modules/captchas/factories.ts +66 -42
  291. package/src/js/modules/captchas/friendly-captcha-v1.ts +12 -2
  292. package/src/js/modules/captchas/friendly-captcha-v2.ts +4 -2
  293. package/src/js/modules/captchas/hcaptcha.ts +5 -5
  294. package/src/js/modules/captchas/index.ts +2 -2
  295. package/src/js/modules/captchas/recaptcha-enterprise.ts +2 -2
  296. package/src/js/modules/captchas/recaptcha-v2-checkbox.ts +3 -3
  297. package/src/js/modules/captchas/recaptcha-v2-invisible.ts +2 -2
  298. package/src/js/modules/captchas/recaptcha-v3.ts +2 -2
  299. package/src/js/modules/captchas/snaptcha.ts +1 -1
  300. package/src/js/modules/captchas/turnstile.ts +3 -3
  301. package/src/js/modules/fields/address-country.ts +11 -9
  302. package/src/js/modules/fields/address-state.ts +94 -35
  303. package/src/js/modules/fields/calculations.ts +5 -3
  304. package/src/js/modules/fields/checkbox-radio.ts +24 -42
  305. package/src/js/modules/fields/combobox.ts +28 -9
  306. package/src/js/modules/fields/conditions/config.ts +17 -20
  307. package/src/js/modules/fields/conditions/effects.ts +25 -29
  308. package/src/js/modules/fields/conditions/evaluator.ts +21 -29
  309. package/src/js/modules/fields/conditions/references.ts +16 -5
  310. package/src/js/modules/fields/conditions/submission-context.ts +80 -0
  311. package/src/js/modules/fields/conditions/types.ts +3 -1
  312. package/src/js/modules/fields/conditions/values.ts +31 -6
  313. package/src/js/modules/fields/conditions.ts +65 -18
  314. package/src/js/modules/fields/custom-google-maps.ts +5 -3
  315. package/src/js/modules/fields/custom-link.ts +5 -3
  316. package/src/js/modules/fields/custom-maps.ts +5 -3
  317. package/src/js/modules/fields/date-picker.ts +40 -7
  318. package/src/js/modules/fields/file-upload.ts +62 -23
  319. package/src/js/modules/fields/hidden.ts +5 -3
  320. package/src/js/modules/fields/index.ts +2 -2
  321. package/src/js/modules/fields/password-validation.ts +5 -3
  322. package/src/js/modules/fields/phone-country.ts +35 -8
  323. package/src/js/modules/fields/repeater.ts +60 -7
  324. package/src/js/modules/fields/rich-text.ts +20 -4
  325. package/src/js/modules/fields/shared.ts +13 -0
  326. package/src/js/modules/fields/signature.ts +24 -4
  327. package/src/js/modules/fields/summary.ts +8 -20
  328. package/src/js/modules/fields/survey-likert.ts +5 -3
  329. package/src/js/modules/fields/survey-rank.ts +21 -3
  330. package/src/js/modules/fields/survey-rating.ts +17 -3
  331. package/src/js/modules/fields/table.ts +5 -3
  332. package/src/js/modules/fields/text-limit.ts +5 -3
  333. package/src/js/modules/fields/upload-manager.ts +244 -67
  334. package/src/js/modules/loader.ts +345 -281
  335. package/src/js/modules/payments/bpoint.ts +2 -2
  336. package/src/js/modules/payments/eway.ts +2 -2
  337. package/src/js/modules/payments/factories.ts +53 -52
  338. package/src/js/modules/payments/go-cardless.ts +1 -1
  339. package/src/js/modules/payments/index.ts +2 -2
  340. package/src/js/modules/payments/mollie.ts +1 -1
  341. package/src/js/modules/payments/moneris.ts +2 -2
  342. package/src/js/modules/payments/opayo.ts +21 -8
  343. package/src/js/modules/payments/paddle.ts +10 -6
  344. package/src/js/modules/payments/payment.ts +22 -18
  345. package/src/js/modules/payments/paypal.ts +1 -1
  346. package/src/js/modules/payments/payway.ts +2 -2
  347. package/src/js/modules/payments/square.ts +2 -2
  348. package/src/js/modules/payments/stripe.ts +5 -5
  349. package/src/js/modules/payments/utils.ts +14 -0
  350. package/src/js/modules/registry.ts +19 -11
  351. package/src/js/submit/pipeline.ts +10 -11
  352. package/src/js/theme/browser-theme-state.generated.ts +25 -0
  353. package/src/js/theme/theme-classes.ts +3 -3
  354. package/src/js/transport/forms-api.ts +66 -67
  355. package/src/js/utils/async.ts +34 -0
  356. package/src/js/utils/country-from-ip.ts +14 -9
  357. package/src/js/utils/csrf.ts +136 -0
  358. package/src/js/utils/field-references.parser.ts +13 -113
  359. package/src/js/utils/field-references.resolver.ts +27 -64
  360. package/src/js/utils/field-references.row-scope.ts +1 -1
  361. package/src/js/utils/field-references.types.ts +1 -0
  362. package/src/js/utils/http.ts +5 -5
  363. package/src/js/utils/request-profile.ts +10 -0
  364. package/src/js/utils/unload-warning.ts +12 -4
  365. package/src/js/validation/rules/email.ts +3 -5
  366. package/src/js/validation/rules/match.ts +2 -1
  367. package/src/js/validation/rules/minmax.ts +4 -43
  368. package/src/js/validation/rules/number.ts +3 -47
  369. package/src/js/validation/rules/pattern.ts +3 -8
  370. package/src/js/validation/rules/required.ts +14 -1
  371. package/src/js/validation/rules/shared.ts +5 -1
  372. package/src/js/validation/rules/url.ts +3 -10
  373. package/src/js/validation/skip.ts +9 -0
  374. package/src/js/validation/submit-readiness.ts +9 -2
  375. package/src/js/validation/validator.ts +49 -61
  376. package/dist/chunks/address-state-BwE01m2_.js +0 -344
  377. package/dist/chunks/calculations-Dv3hYb8_.js +0 -299
  378. package/dist/chunks/conditions-CPH1snCx.js +0 -424
  379. package/dist/chunks/country-from-ip-BwxKaBuJ.js +0 -26
  380. package/dist/chunks/field-references.resolver-CHwn0G0L.js +0 -145
  381. package/dist/chunks/friendly-captcha-v1-C_2reOXr.js +0 -31
  382. package/dist/chunks/google-address-BH3Zhi06.js +0 -161
  383. package/dist/chunks/http-D-JExro7.js +0 -27
  384. package/dist/chunks/opayo-CR0DtsLa.js +0 -179
  385. package/dist/chunks/rich-text-Bg_--4TG.js +0 -349
  386. package/dist/js/modules/fields/conditions/transforms.d.ts +0 -3
  387. package/dist/js/modules/fields/conditions/transforms.d.ts.map +0 -1
  388. package/src/js/modules/fields/conditions/transforms.ts +0 -206
  389. package/src/js/modules/payments/stub-payment-module.ts +0 -87
@@ -1,10 +1,10 @@
1
1
  import { a as e, d as t, u as n } from "./event-names-BCI2FLD8.js";
2
2
  import { t as r } from "./debug-BV0DvdHx.js";
3
- import { i, r as a, t as o } from "./theme-classes-Tv7q7ToE.js";
4
- import { i as s } from "./i18n-BY1ds1BL.js";
5
- import { n as c, t as l } from "./async-nPFRNQ06.js";
3
+ import { a as i, i as a, t as o } from "./theme-classes-DAQuEqdP.js";
4
+ import { n as s, t as c } from "./async-2GdXNFCE.js";
5
+ import { i as l } from "./i18n-BY1ds1BL.js";
6
6
  import { r as u, t as d } from "./field-references.keys-58ZSTrCW.js";
7
- import { n as f, r as p } from "./field-references.resolver-CHwn0G0L.js";
7
+ import { n as f, r as p } from "./field-references.resolver-Ca8MguFv.js";
8
8
  //#region src/js/core/dom-events.ts
9
9
  function m(e, n, r) {
10
10
  e.dispatchEvent(new CustomEvent(t(n), {
@@ -136,7 +136,8 @@ function S(e) {
136
136
  //#region src/js/validation/submit-readiness.ts
137
137
  var C = "data-formie-submit-validation-disabled", w = "data-formie-preserve-disabled", se = "data-formie-submit-ready";
138
138
  function T(e) {
139
- return e.dataset.formieDisableSubmitUntilValid === "true";
139
+ let t = e.dataset.formieDisableSubmitUntilValid?.trim().toLowerCase();
140
+ return t === "" || t === "true" || t === "1";
140
141
  }
141
142
  function ce(e) {
142
143
  return Array.from(e.querySelectorAll("button[data-formie-action=\"submit\"]")).filter((e) => e instanceof HTMLButtonElement);
@@ -154,7 +155,7 @@ function E(e, t) {
154
155
  e.hasAttribute(w) ? (e.disabled = !0, e.removeAttribute(w)) : e.disabled = !1, e.removeAttribute(C);
155
156
  return;
156
157
  }
157
- e.hasAttribute(C) || (e.disabled && e.setAttribute(w, "true"), e.setAttribute(C, "true")), e.disabled = !0;
158
+ e.hasAttribute(C) || (e.disabled && e.setAttribute(w, "true"), e.setAttribute(C, "true")), e.disabled ||= !0;
158
159
  }
159
160
  });
160
161
  }
@@ -244,14 +245,13 @@ function ge(e) {
244
245
  return e <= 0 ? "start" : e >= 100 ? "end" : "middle";
245
246
  }
246
247
  function _e(e) {
247
- return (e.dataset.formieSubmitAction || "").trim();
248
+ return (e.dataset.formieCompletionBehavior || e.dataset.formieSubmitAction || "").trim();
248
249
  }
249
250
  function P(e, t) {
250
- let n = t.meta?.effectiveSubmitAction;
251
- return typeof n == "string" && n.trim() !== "" ? n.trim() : _e(e);
251
+ return t.completion ? String(t.completion.behavior) : _e(e);
252
252
  }
253
253
  function F(e) {
254
- let t = e.dataset.formieSubmitActionFormHide;
254
+ let t = e.dataset.formieHideFormAfterSubmit ?? e.dataset.formieSubmitActionFormHide;
255
255
  if (t === void 0) return !1;
256
256
  let n = t.trim().toLowerCase();
257
257
  return n === "true" || n === "1" || n === "";
@@ -265,7 +265,7 @@ function I(e, t) {
265
265
  ].forEach((n) => {
266
266
  e.querySelectorAll(n).forEach((e) => {
267
267
  let n = e;
268
- t ? n.hidden = !0 : n.hidden = !1;
268
+ n.hidden = !!t;
269
269
  });
270
270
  });
271
271
  }
@@ -309,38 +309,42 @@ function xe(e, t) {
309
309
  }), t && (t.setAttribute("data-formie-loading", "true"), be(e, t)));
310
310
  }
311
311
  function B(e) {
312
- if (e.removeAttribute("data-formie-loading"), z(e).forEach((t) => {
312
+ e.removeAttribute("data-formie-loading"), z(e).forEach((t) => {
313
313
  if ("disabled" in t) {
314
314
  let e = t;
315
315
  e.disabled = e.getAttribute("data-formie-was-disabled") === "true";
316
316
  }
317
317
  R(t), t.removeAttribute("data-formie-was-disabled"), t.removeAttribute("data-formie-loading"), i(t, e, "loading", !1), t.removeAttribute("data-formie-loading-indicator"), t.removeAttribute("data-formie-loading-text");
318
- }), e.dataset.formieDisableSubmitUntilValid === "true") {
319
- let t = e;
320
- t.formieValidation && E(e, t.formieValidation);
321
- }
318
+ });
319
+ let t = e;
320
+ t.formieValidation && E(e, t.formieValidation);
322
321
  }
323
322
  function V(e, t) {
324
323
  let n = N(e), r = me(e), s = n.findIndex((e) => e.getAttribute("data-formie-page-id") === t);
325
- if (n.forEach((n) => {
324
+ n.forEach((n) => {
326
325
  n.getAttribute("data-formie-page-id") === t ? (n.removeAttribute("data-formie-page-hidden"), a(n, e, "pageHidden")) : (n.setAttribute("data-formie-page-hidden", "true"), o(n, e, "pageHidden"));
327
326
  }), r.forEach((n, r) => {
328
327
  let c = n.getAttribute("data-formie-page-id") === t, l = s > -1 && r < s;
329
328
  i(n, e, "tabCurrent", c), i(n, e, "tabComplete", l);
330
329
  let u = n.querySelector("[data-formie-tab-link]");
331
330
  u && (i(u, e, "tabLinkCurrent", c), c ? a(u, e, "tabLinkInactive") : o(u, e, "tabLinkInactive")), c ? n.setAttribute("aria-current", "page") : n.removeAttribute("aria-current"), l ? n.setAttribute("data-formie-tab-complete", "true") : n.removeAttribute("data-formie-tab-complete");
332
- }), s > -1 && n.length > 0 && ye(e, he(e, s, n.length)), A(e, "pageId", t), b(e), e.dataset.formieDisableSubmitUntilValid === "true") {
333
- let t = e;
334
- t.formieValidation && E(e, t.formieValidation);
335
- }
331
+ }), s > -1 && n.length > 0 && ye(e, he(e, s, n.length)), A(e, "pageId", t), b(e);
332
+ let c = e;
333
+ c.formieValidation && E(e, c.formieValidation);
336
334
  }
337
335
  function Se(e, t) {
338
- let n = t.meta?.submissionUid;
339
- typeof n == "string" && n.trim() !== "" && A(e, "submissionUid", n);
340
- let r = (t.meta?.session)?.continuation?.continuationToken;
341
- typeof r == "string" && r.trim() !== "" ? A(e, "continuationToken", r) : M(e, "continuationToken");
342
- }
343
- function Ce(e) {
336
+ if (t.meta?.resetSubmissionIdentity === !0) {
337
+ M(e, "submissionId"), M(e, "submissionUid"), M(e, "progressId"), A(e, "expectedVersion", "0"), H(e);
338
+ return;
339
+ }
340
+ let n = t.meta?.session?.version ?? t.meta?.version;
341
+ typeof n == "number" && A(e, "expectedVersion", String(n));
342
+ let r = t.meta?.submissionUid;
343
+ typeof r == "string" && r.trim() !== "" && A(e, "submissionUid", r);
344
+ let i = (t.meta?.session)?.continuation?.progressId;
345
+ typeof i == "string" && i.trim() !== "" ? A(e, "progressId", i) : M(e, "progressId");
346
+ }
347
+ function H(e) {
344
348
  let t = e.getAttribute("action");
345
349
  t && e.setAttribute("action", fe(t, "resumeToken"));
346
350
  try {
@@ -349,7 +353,7 @@ function Ce(e) {
349
353
  e.searchParams.delete("resumeToken"), window.history.replaceState({}, document.title, `${e.pathname}${e.search}${e.hash}`);
350
354
  } catch {}
351
355
  }
352
- function we(e, t) {
356
+ function Ce(e, t) {
353
357
  let n = t.meta?.resumeUrl;
354
358
  if (typeof n != "string" || n.trim() === "") return;
355
359
  let r = n.trim();
@@ -361,18 +365,18 @@ function we(e, t) {
361
365
  } catch {}
362
366
  }
363
367
  }
364
- function H(t, n = {}) {
368
+ function U(t, n = {}) {
365
369
  let r = t.formieValidation, i = N(t)[0]?.getAttribute("data-formie-page-id");
366
- if (L(t), t.reset(), n.preserveHiddenState || I(t, !1), M(t, "submissionId"), M(t, "submissionUid"), M(t, "continuationToken"), M(t, "pageId"), Ce(t), r?.resetLiveState(), i) {
370
+ if (L(t), t.reset(), n.preserveHiddenState || I(t, !1), M(t, "submissionId"), A(t, "expectedVersion", "0"), M(t, "submissionUid"), M(t, "progressId"), M(t, "pageId"), H(t), r?.resetLiveState(), i) {
367
371
  V(t, i), t.dispatchEvent(new CustomEvent(e("reset"), { bubbles: !0 }));
368
372
  return;
369
373
  }
370
374
  b(t), t.dispatchEvent(new CustomEvent(e("reset"), { bubbles: !0 }));
371
375
  }
372
- function Te(e) {
376
+ function we(e) {
373
377
  return e.code === de || e.meta?.resetState === !0;
374
378
  }
375
- function Ee(e, t) {
379
+ function Te(e, t) {
376
380
  let r = t.submitData, i = /* @__PURE__ */ new Set(), a = !1;
377
381
  if (Array.isArray(r) && r.length > 0) {
378
382
  let t = r.filter((e) => typeof e == "object" && !!e && "event" in e && typeof e.event == "string");
@@ -384,29 +388,30 @@ function Ee(e, t) {
384
388
  }));
385
389
  }
386
390
  }
387
- let o = t.meta || {}, s = (o.paymentAction && typeof o.paymentAction == "object" ? o.paymentAction : null) || (o.paymentDecision && typeof o.paymentDecision == "object" ? o.paymentDecision.action : null), c = s ? String(s.event || "") : "", l = s ? s.payload : void 0, u = n(c);
388
- return u && !i.has(u) && (u.startsWith("formie:payment:") && (a = !0), e.dispatchEvent(new CustomEvent(u, {
391
+ let o = t.payment?.action, s = o ? String(o.event || "") : "", c = o ? o.payload : void 0, l = n(s);
392
+ return l && !i.has(l) && (l.startsWith("formie:payment:") && (a = !0), e.dispatchEvent(new CustomEvent(l, {
389
393
  bubbles: !0,
390
- detail: { data: l }
391
- })), k.log("Dispatching fallback payment action event.", { eventName: u })), { hasPaymentFollowUpEvent: a };
394
+ detail: { data: c }
395
+ })), k.log("Dispatching fallback payment action event.", { eventName: l })), { hasPaymentFollowUpEvent: a };
392
396
  }
393
- function De(e, t, n) {
397
+ function Ee(e, t, n) {
394
398
  if (k.log("Applying submit result state.", {
395
399
  ok: t.ok,
396
400
  action: n,
397
401
  code: t.code,
398
402
  hasRedirect: !!t.redirect?.url,
399
403
  hasSubmitData: Array.isArray(t.submitData) && t.submitData.length > 0
400
- }), Te(t)) {
401
- H(e), k.log("Resetting state due to stale/reset marker.");
404
+ }), we(t)) {
405
+ U(e), k.log("Resetting state due to stale/reset marker.");
402
406
  return;
403
407
  }
404
- let r = Ee(e, t);
408
+ t.payment?.action?.type === "redirect" && t.payment.action.url && j(e, "payment-redirect");
409
+ let r = Te(e, t);
405
410
  if (!t.ok && t.redirect?.url && !r.hasPaymentFollowUpEvent) {
406
411
  k.log("Applying redirect fallback for failed result.", {
407
412
  url: t.redirect.url,
408
413
  target: t.redirect.target
409
- }), L(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank") : (j(e, "redirect"), window.location.href = t.redirect.url);
414
+ }), L(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank", "noopener,noreferrer") : (j(e, "redirect"), window.location.href = t.redirect.url);
410
415
  return;
411
416
  }
412
417
  if (Se(e, t), !t.ok) {
@@ -418,32 +423,32 @@ function De(e, t, n) {
418
423
  return;
419
424
  }
420
425
  if (n === "save") {
421
- L(e), we(e, t), k.log("Applied save/resume token state.");
426
+ L(e), Ce(e, t), k.log("Applied save/resume token state.");
422
427
  return;
423
428
  }
424
- if (n === "submit" && !t.redirect?.url) {
429
+ if (t.completion && n === "submit" && !t.redirect?.url) {
425
430
  let n = P(e, t), r = n === "message" && F(e);
426
431
  if (n === "reload") {
427
432
  L(e), j(e, "reload"), window.location.reload();
428
433
  return;
429
434
  }
430
435
  if (n === "reset") {
431
- H(e);
436
+ U(e);
432
437
  return;
433
438
  }
434
- L(e), H(e, { preserveHiddenState: r });
439
+ L(e), U(e, { preserveHiddenState: r });
435
440
  return;
436
441
  }
437
442
  if (n === "submit" && t.redirect?.url && t.redirect.target === "new-tab") {
438
443
  let n = P(e, t) === "message" && F(e);
439
- L(e), H(e, { preserveHiddenState: n });
444
+ L(e), U(e, { preserveHiddenState: n });
440
445
  return;
441
446
  }
442
447
  L(e);
443
448
  }
444
449
  //#endregion
445
450
  //#region src/js/modules/payments/constants.ts
446
- var Oe = 2500, ke = {
451
+ var De = 2500, Oe = {
447
452
  bpoint: ["bpointToken"],
448
453
  stripe: ["stripePaymentIntentId"],
449
454
  paypal: ["paypalOrderId", "paypalAuthId"],
@@ -458,25 +463,25 @@ var Oe = 2500, ke = {
458
463
  };
459
464
  //#endregion
460
465
  //#region src/js/utils/fields.ts
461
- function Ae(e) {
466
+ function ke(e) {
462
467
  return e.replace("{field:", "").replace("{", "").replace("}", "").replace("]", "").split("[").join("][");
463
468
  }
464
- function je(e) {
465
- return `fields[${Ae(e)}]`;
469
+ function Ae(e) {
470
+ return `fields[${ke(e)}]`;
466
471
  }
467
- function Me(e, t) {
468
- let n = je(t), r = Array.from(e.querySelectorAll(`[name="${n}"]`)), i = Array.from(e.querySelectorAll(`[name="${n}[]"]`));
472
+ function je(e, t) {
473
+ let n = Ae(t), r = Array.from(e.querySelectorAll(`[name="${n}"]`)), i = Array.from(e.querySelectorAll(`[name="${n}[]"]`));
469
474
  return (i.length ? i : r).filter((e) => e instanceof HTMLElement);
470
475
  }
471
- function U(e, t) {
472
- let n = Me(e, t);
476
+ function W(e, t) {
477
+ let n = je(e, t);
473
478
  for (let e of n) {
474
479
  let t = e.closest("[data-formie-field-handle]")?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim();
475
480
  if (t) return t;
476
481
  }
477
482
  return "";
478
483
  }
479
- function W(e) {
484
+ function G(e) {
480
485
  let t = e.replace(/[^\d.,-]/g, ""), n = t.includes(","), r = t.includes(".");
481
486
  if (n && r) t = t.lastIndexOf(",") > t.lastIndexOf(".") ? t.replace(/\./g, "").replace(",", ".") : t.replace(/,/g, "");
482
487
  else if (n && !r) {
@@ -487,13 +492,17 @@ function W(e) {
487
492
  }
488
493
  //#endregion
489
494
  //#region src/js/modules/payments/utils.ts
490
- function G(e, t) {
495
+ function K(e) {
496
+ let t = e;
497
+ return !t.closest("[data-formie-conditionally-hidden]") && !t.closest("[data-formie-row-hidden]") && !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
498
+ }
499
+ function q(e, t) {
491
500
  let n = t.replace(/"/g, "\\\"");
492
501
  return e.querySelector(`input[name$="[${n}]"]`) || e.querySelector(`input[name$="${n}"]`);
493
502
  }
494
- function K(e, t) {
503
+ function J(e, t) {
495
504
  let n = t.find((t) => {
496
- let n = G(e, t);
505
+ let n = q(e, t);
497
506
  return !n || String(n.value || "").trim() === "";
498
507
  });
499
508
  return {
@@ -501,47 +510,47 @@ function K(e, t) {
501
510
  missingSuffix: n
502
511
  };
503
512
  }
504
- async function q(e, t, n) {
505
- let r = K(e, t);
513
+ async function Y(e, t, n) {
514
+ let r = J(e, t);
506
515
  if (r.ok) return r;
507
516
  let i = Date.now() + Math.max(n, 0);
508
517
  for (; Date.now() < i;) {
509
- await c(120);
510
- let n = K(e, t);
518
+ await s(120);
519
+ let n = J(e, t);
511
520
  if (n.ok) return n;
512
521
  }
513
- return K(e, t);
522
+ return J(e, t);
514
523
  }
515
524
  //#endregion
516
525
  //#region src/js/modules/payments/host.ts
517
- var Ne = new Set([
526
+ var Me = /* @__PURE__ */ new Set([
518
527
  "handle",
519
528
  "requiredInputSuffixes",
520
529
  "waitForValueMs",
521
530
  "errorMessage"
522
- ]), J = "[data-payment-success]", Y = "[data-payment-error]";
523
- function X(e, t) {
531
+ ]), X = "[data-payment-success]", Z = "[data-payment-error]";
532
+ function Ne(e, t) {
524
533
  return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
525
534
  }
526
535
  function Pe(e, t, n) {
527
- let r = t || {}, i = Object.entries(r).reduce((e, [t, n]) => (Ne.has(t) || (e[t] = n), e), {}), a = Array.isArray(r.requiredInputSuffixes) ? r.requiredInputSuffixes.map(String).filter(Boolean) : n.defaultRequiredInputSuffixes || [], o = Number(r.waitForValueMs ?? n.defaultWaitForValueMs ?? 2500), s = typeof r.errorMessage == "string" && r.errorMessage.trim() !== "" ? r.errorMessage.trim() : "Payment authorization is incomplete.";
536
+ let r = t || {}, i = Object.entries(r).reduce((e, [t, n]) => (Me.has(t) || (e[t] = n), e), {}), a = Array.isArray(r.requiredInputSuffixes) ? r.requiredInputSuffixes.map(String).filter(Boolean) : n.defaultRequiredInputSuffixes || [], o = Number(r.waitForValueMs ?? n.defaultWaitForValueMs ?? 2500), s = typeof r.errorMessage == "string" && r.errorMessage.trim() !== "" ? r.errorMessage.trim() : "Payment authorization is incomplete.";
528
537
  return {
529
- handle: X(e, r),
538
+ handle: Ne(e, r),
530
539
  transport: {
531
540
  requiredInputSuffixes: a,
532
- waitForValueMs: Number.isFinite(o) ? o : Oe,
541
+ waitForValueMs: Number.isFinite(o) ? o : De,
533
542
  errorMessage: s
534
543
  },
535
544
  provider: i
536
545
  };
537
546
  }
538
- function Z(e, t, n) {
547
+ function Q(e, t, n) {
539
548
  return e.addEventListener(t, n), () => {
540
549
  e.removeEventListener(t, n);
541
550
  };
542
551
  }
543
552
  function Fe(e, t) {
544
- let n = e.target, r = e.form, i = e.root, a = r || i, c = t.transport.requiredInputSuffixes, m = () => p(r || i), h = (e) => {
553
+ let n = e.target, r = e.form, i = e.root, a = r || i, s = t.transport.requiredInputSuffixes, m = () => p(r || i), h = (e) => {
545
554
  let t = f(e, m()).value;
546
555
  return Array.isArray(t) ? t[0] || "" : String(t || "");
547
556
  };
@@ -552,62 +561,62 @@ function Fe(e, t) {
552
561
  updateInputs: (e, t) => {
553
562
  let r = Array.isArray(e) ? e : [e];
554
563
  for (let e of r) {
555
- let r = G(a, e) ?? n.querySelector(`input[name*="${e}"]`);
564
+ let r = q(a, e) ?? n.querySelector(`input[name*="${e}"]`);
556
565
  r && (r.value = t);
557
566
  }
558
567
  },
559
568
  addError: (e) => {
560
- let t = n.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || n, a = t.querySelector(Y);
569
+ let t = n.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || n, a = t.querySelector(Z);
561
570
  a && a.remove();
562
571
  let s = document.createElement("div");
563
572
  s.setAttribute("data-payment-error", ""), s.textContent = e, o(s, r || i, "fieldError"), t.appendChild(s);
564
573
  },
565
574
  removeError: () => {
566
- n.querySelector(Y)?.remove();
575
+ n.querySelector(Z)?.remove();
567
576
  },
568
577
  addSuccess: (e) => {
569
- let t = n.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || n, a = t.querySelector(J);
578
+ let t = n.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || n, a = t.querySelector(X);
570
579
  a && a.remove();
571
580
  let s = document.createElement("div");
572
581
  s.setAttribute("data-payment-success", ""), s.textContent = e, o(s, r || i, "successMessage"), t.appendChild(s);
573
582
  },
574
583
  removeSuccess: () => {
575
- n.querySelector(J)?.remove();
584
+ n.querySelector(X)?.remove();
576
585
  },
577
- hasToken: () => K(a, c).ok,
578
- waitForToken: (e = t.transport.waitForValueMs) => q(a, c, e).then((e) => e.ok),
586
+ hasToken: () => J(a, s).ok,
587
+ waitForToken: (e = t.transport.waitForValueMs) => Y(a, s, e).then((e) => e.ok),
579
588
  getFieldValue: (e, t = "string") => {
580
589
  let n = h(e);
581
- return t === "float" || t === "int" || t === "number" ? W(n) : n;
590
+ return t === "float" || t === "int" || t === "number" ? G(n) : n;
582
591
  },
583
592
  resolveAmount: (e) => {
584
- let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed), o = String(a ?? "").trim(), c = typeof a == "number" ? a : W(o);
585
- if (Number.isFinite(c) && c > 0) return {
593
+ let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed), o = String(a ?? "").trim(), s = typeof a == "number" ? a : G(o);
594
+ if (Number.isFinite(s) && s > 0) return {
586
595
  ok: !0,
587
- value: c
596
+ value: s
588
597
  };
589
598
  if (o !== "") {
590
- let e = h(o), n = W(e);
599
+ let e = h(o), n = G(e);
591
600
  if (Number.isFinite(n) && n > 0) return {
592
601
  ok: !0,
593
602
  value: n
594
603
  };
595
- let r = U(t, o);
604
+ let r = W(t, o);
596
605
  if (!e) return {
597
606
  ok: !1,
598
- error: r ? s("Provide a value for \"{label}\" to proceed.", { label: r }) : s("Provide a payment amount to proceed.")
607
+ error: r ? l("Provide a value for \"{label}\" to proceed.", { label: r }) : l("Provide a payment amount to proceed.")
599
608
  };
600
609
  }
601
610
  return {
602
611
  ok: !1,
603
- error: s("Payment amount must be greater than 0.")
612
+ error: l("Payment amount must be greater than 0.")
604
613
  };
605
614
  },
606
615
  resolveCurrency: (e) => {
607
- let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed ?? e.defaultCurrency ?? ""), o = String(a ?? "").trim(), c = o.toUpperCase();
608
- if (/^[A-Z]{3}$/.test(c) && !n) return {
616
+ let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed ?? e.defaultCurrency ?? ""), o = String(a ?? "").trim(), s = o.toUpperCase();
617
+ if (/^[A-Z]{3}$/.test(s) && !n) return {
609
618
  ok: !0,
610
- value: c
619
+ value: s
611
620
  };
612
621
  if (o !== "") {
613
622
  let e = String(h(o) || "").trim(), n = e.toUpperCase();
@@ -615,37 +624,37 @@ function Fe(e, t) {
615
624
  ok: !0,
616
625
  value: n
617
626
  };
618
- let r = U(t, o);
627
+ let r = W(t, o);
619
628
  if (!e) return {
620
629
  ok: !1,
621
- error: r ? s("Provide a value for \"{label}\" to proceed.", { label: r }) : s("Provide a payment currency to proceed.")
630
+ error: r ? l("Provide a value for \"{label}\" to proceed.", { label: r }) : l("Provide a payment currency to proceed.")
622
631
  };
623
632
  }
624
633
  return {
625
634
  ok: !1,
626
- error: s("Payment currency must be a valid 3-letter code.")
635
+ error: l("Payment currency must be a valid 3-letter code.")
627
636
  };
628
637
  },
629
638
  watchFieldValueChanges: (e, t, n = 600) => {
630
639
  let a = r || i, o = e.map((e) => String(e || "").trim()).filter(Boolean);
631
640
  if (o.length === 0) return () => {};
632
- let s = m(), c = /* @__PURE__ */ new Set();
641
+ let s = m(), l = /* @__PURE__ */ new Set();
633
642
  o.forEach((e) => {
634
643
  let t = u(e), n = s.get(t);
635
644
  if (n?.names?.length) {
636
645
  n.names.forEach((e) => {
637
- c.add(e);
646
+ l.add(e);
638
647
  });
639
648
  return;
640
649
  }
641
650
  let r = d(t);
642
- r && (c.add(r), c.add(`${r}[]`));
651
+ r && (l.add(r), l.add(`${r}[]`));
643
652
  });
644
- let f = l(() => {
653
+ let f = c(() => {
645
654
  t();
646
655
  }, n), p = (e) => {
647
656
  let t = e.target?.name || "";
648
- !t || !c.has(t) || f();
657
+ t && l.has(t) && f();
649
658
  };
650
659
  return a.addEventListener("input", p), a.addEventListener("change", p), () => {
651
660
  a.removeEventListener("input", p), a.removeEventListener("change", p);
@@ -675,160 +684,160 @@ function Fe(e, t) {
675
684
  return { billing_details: t };
676
685
  },
677
686
  events: {
678
- onForm: (e, t) => r ? Z(r, e, t) : () => {},
679
- onRoot: (e, t) => Z(i, e, t)
687
+ onForm: (e, t) => r ? Q(r, e, t) : () => {},
688
+ onRoot: (e, t) => Q(i, e, t)
680
689
  }
681
690
  };
682
691
  }
683
692
  //#endregion
684
693
  //#region src/js/modules/payments/factories.ts
685
- var Q = r("payments");
686
- function $(e) {
687
- let t = e;
688
- return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
689
- }
694
+ var $ = r("payments");
690
695
  function Ie(e) {
691
- let t = e.defaultRequiredInputSuffixes ?? ke[e.id] ?? [];
696
+ let t = e.defaultRequiredInputSuffixes ?? Oe[e.moduleId.split(":")[1]] ?? [];
692
697
  return {
693
- id: e.id,
698
+ moduleId: e.moduleId,
699
+ version: 2,
700
+ surfaces: ["server-rendered", "client-rendered"],
694
701
  kind: "payment",
695
702
  match: (e) => !!(e.target.querySelector("[data-formie-field-type=\"payment\"]") || e.target.closest("[data-formie-field-type=\"payment\"]") || e.target.getAttribute?.("data-formie-field-type") === "payment"),
696
703
  setup: async (n) => {
697
704
  let r = n.target, i = r.__formiePaymentModuleRegistry || {};
698
705
  r.__formiePaymentModuleRegistry = i;
699
- let a = i[e.id];
700
- if (a?.destroy) {
701
- Q.warn("Found stale payment module instance; destroying previous.", { moduleId: e.id });
706
+ let a = n.entryKey ?? e.moduleId, o = i[a];
707
+ if (o?.destroy) {
708
+ $.warn("Found stale payment module instance; destroying previous.", { moduleId: e.moduleId });
702
709
  try {
703
- await a.destroy();
710
+ await o.destroy();
704
711
  } catch {}
705
712
  }
706
- let o = Pe(e.id, n.options || {}, { defaultRequiredInputSuffixes: t }), s = Fe(n, o), c = {
713
+ let s = Pe(e.moduleId.split(":")[1], n.options || {}, { defaultRequiredInputSuffixes: t }), c = Fe(n, s), l = {
707
714
  ...n,
708
- options: o,
709
- services: s
710
- }, l = [], u = null, d = null, f = null, p = null, m = async () => (u ||= (Q.log("Loading payment provider API.", { moduleId: e.id }), e.load(c)), u), h = async () => {
711
- if (!e.mount || d || !$(n.target)) return;
712
- let t = await m();
715
+ options: s,
716
+ services: c
717
+ }, u = [], d = null, f = null, p = null, m = null, h = async () => (d ||= ($.log("Loading payment provider API.", { moduleId: e.moduleId }), e.load(l)), d), g = async () => {
718
+ if (!e.mount || f || !K(n.target)) return;
719
+ let t = await h();
713
720
  try {
714
- d = await e.mount({
721
+ f = await e.mount({
715
722
  api: t,
716
723
  field: n.target,
717
- services: s,
718
- options: o,
719
- provider: o.provider
720
- }), Q.log("Payment widget mounted.", {
721
- moduleId: e.id,
722
- handle: o.handle
723
- });
724
- } catch {
725
- Q.warn("Payment widget mount failed.", {
726
- moduleId: e.id,
727
- handle: o.handle
724
+ services: c,
725
+ options: s,
726
+ provider: s.provider
727
+ }), $.log("Payment widget mounted.", {
728
+ moduleId: e.moduleId,
729
+ handle: s.handle
728
730
  });
731
+ } catch (t) {
732
+ throw $.warn("Payment widget mount failed.", {
733
+ moduleId: e.moduleId,
734
+ handle: s.handle
735
+ }), t;
729
736
  }
730
737
  };
731
- if (l.push(n.on("formie:submit:before", () => {
732
- s.removeError(), s.removeSuccess();
738
+ if (u.push(n.on("formie:submit:before", () => {
739
+ c.removeError(), c.removeSuccess();
733
740
  })), e.setup) {
734
741
  let t = n.root || n.form || n.target;
735
- f = await e.setup({
736
- ...c,
742
+ p = await e.setup({
743
+ ...l,
737
744
  root: t
738
- }), f.destroy && l.push(f.destroy);
745
+ }), p.destroy && u.push(p.destroy);
739
746
  }
740
- e.mount && $(n.target) && await h(), ["formie:page:navigate:after", "formie:submit:result"].forEach((e) => {
747
+ e.mount && K(n.target) && await g(), ["formie:page:navigate:after", "formie:submit:result"].forEach((e) => {
741
748
  let t = () => {
742
- h();
749
+ g();
743
750
  };
744
- n.root.addEventListener(e, t), l.push(() => {
751
+ n.root.addEventListener(e, t), u.push(() => {
745
752
  n.root.removeEventListener(e, t);
746
753
  });
747
- });
748
- let g = async () => {
749
- if (Q.log("Destroying payment module.", {
750
- moduleId: e.id,
751
- handle: o.handle
752
- }), l.forEach((e) => e()), d && e.unmount) {
753
- let t = await m();
754
+ }), u.push(n.on("formie:conditions:evaluated", () => {
755
+ g();
756
+ }));
757
+ let _ = async () => {
758
+ if ($.log("Destroying payment module.", {
759
+ moduleId: e.moduleId,
760
+ handle: s.handle
761
+ }), u.forEach((e) => e()), f && e.unmount) {
762
+ let t = await h();
754
763
  await e.unmount({
755
764
  api: t,
756
- widget: d,
765
+ widget: f,
757
766
  field: n.target,
758
- services: s,
759
- options: o,
760
- provider: o.provider
761
- }), Q.log("Payment widget unmounted.", {
762
- moduleId: e.id,
763
- handle: o.handle
767
+ services: c,
768
+ options: s,
769
+ provider: s.provider
770
+ }), $.log("Payment widget unmounted.", {
771
+ moduleId: e.moduleId,
772
+ handle: s.handle
764
773
  });
765
774
  }
766
- i[e.id]?.destroy === g && delete i[e.id], Q.log("Payment module destroy complete.", {
767
- moduleId: e.id,
768
- handle: o.handle
775
+ i[a]?.destroy === _ && delete i[a], $.log("Payment module destroy complete.", {
776
+ moduleId: e.moduleId,
777
+ handle: s.handle
769
778
  });
770
779
  };
771
- return i[e.id] = { destroy: g }, {
772
- destroy: g,
773
- onBeforeStage: async (t) => {
774
- if (f?.onBeforeStage) {
775
- await f.onBeforeStage(t);
780
+ return i[a] = { destroy: _ }, {
781
+ destroy: _,
782
+ beforeSubmit: async (t) => {
783
+ if (p?.beforeSubmit) {
784
+ await p.beforeSubmit(t);
776
785
  return;
777
786
  }
778
- if (t.stage !== "authorize" || t.action !== "submit" || n.target.closest("[data-formie-page]")?.hasAttribute("data-formie-page-hidden")) return;
779
- await h();
780
- let r = await m();
781
- if (e.onBeforeAuthorize) {
782
- p ||= (async () => e.onBeforeAuthorize({
787
+ if (t.action !== "submit" || !K(n.target)) return;
788
+ await g();
789
+ let r = await h();
790
+ if (e.onBeforePayment) {
791
+ m ||= (async () => e.onBeforePayment({
783
792
  api: r,
784
- widget: d,
793
+ widget: f,
785
794
  field: n.target,
786
- services: s,
787
- options: o,
788
- provider: o.provider,
795
+ services: c,
796
+ options: s,
797
+ provider: s.provider,
789
798
  stageCtx: t
790
799
  }))().finally(() => {
791
- p = null;
800
+ m = null;
792
801
  });
793
- let i = await p;
794
- if (Q.log("onBeforeAuthorize resolved.", {
795
- moduleId: e.id,
796
- handle: o.handle,
802
+ let i = await m;
803
+ if ($.log("onBeforePayment resolved.", {
804
+ moduleId: e.moduleId,
805
+ handle: s.handle,
797
806
  ok: i
798
807
  }), !i) {
799
- t.abort(o.transport.errorMessage);
808
+ t.abort(s.transport.errorMessage);
800
809
  return;
801
810
  }
802
811
  return;
803
812
  }
804
- if (o.transport.requiredInputSuffixes.length === 0) return;
805
- let i = await q(n.form || n.root, o.transport.requiredInputSuffixes, o.transport.waitForValueMs);
806
- i.ok || (Q.warn("Required payment input(s) missing.", {
807
- moduleId: e.id,
808
- handle: o.handle,
813
+ if (s.transport.requiredInputSuffixes.length === 0) return;
814
+ let i = await Y(n.form || n.root, s.transport.requiredInputSuffixes, s.transport.waitForValueMs);
815
+ i.ok || ($.warn("Required payment input(s) missing.", {
816
+ moduleId: e.moduleId,
817
+ handle: s.handle,
809
818
  missingSuffix: i.missingSuffix
810
- }), t.abort(o.transport.errorMessage));
819
+ }), t.abort(s.transport.errorMessage));
811
820
  },
812
- onAfterStage: async (t, r) => {
813
- if (!(t.stage !== "dispatch" || !e.onAfterSubmit) && !(!(await e.onAfterSubmit({
821
+ afterSubmit: async (t, r) => {
822
+ if (e.onAfterSubmit && (await e.onAfterSubmit({
814
823
  field: n.target,
815
- services: s,
816
- options: o,
817
- provider: o.provider,
824
+ services: c,
825
+ options: s,
826
+ provider: s.provider,
818
827
  result: r
819
- }))?.remount || !e.mount)) {
820
- if (d && e.unmount) {
821
- let t = await m();
828
+ }))?.remount && e.mount) {
829
+ if (f && e.unmount) {
830
+ let t = await h();
822
831
  await e.unmount({
823
832
  api: t,
824
- widget: d,
833
+ widget: f,
825
834
  field: n.target,
826
- services: s,
827
- options: o,
828
- provider: o.provider
835
+ services: c,
836
+ options: s,
837
+ provider: s.provider
829
838
  });
830
839
  }
831
- d = null, await h();
840
+ f = null, await g();
832
841
  }
833
842
  }
834
843
  };
@@ -839,4 +848,4 @@ function Ie(e) {
839
848
  //#region src/js/modules/payments/api.ts
840
849
  var Le = Ie;
841
850
  //#endregion
842
- export { I as a, x as c, y as d, ae as f, B as i, S as l, V as n, xe as o, m as p, De as r, ue as s, Le as t, b as u };
851
+ export { I as a, x as c, y as d, ae as f, B as i, S as l, V as n, xe as o, m as p, Ee as r, ue as s, Le as t, b as u };