@verbb/formie-browser 1.0.12 → 1.0.14

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 (383) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/chunks/{address-country-Rx6GQTND.js → address-country-Dn71jroa.js} +10 -4
  3. package/dist/chunks/{address-finder-k7_BXaRe.js → address-finder-O49uDRoR.js} +2 -2
  4. package/dist/chunks/{address-state-BwE01m2_.js → address-state-ByYatUur.js} +154 -143
  5. package/dist/chunks/{api-DqpfkZWL.js → api-D6kJ7kXZ.js} +183 -179
  6. package/dist/chunks/{api-BUb6P-xu.js → api-DYYsVIub.js} +77 -47
  7. package/dist/chunks/{api-sPqGbOww.js → api-ghNr2uxX.js} +15 -9
  8. package/dist/chunks/{bpoint-Dlq34XH1.js → bpoint-D0RKFM4F.js} +3 -3
  9. package/dist/chunks/calculations-YEoVCG2q.js +310 -0
  10. package/dist/chunks/{captcha-eu-CGm8Lbrj.js → captcha-eu-DERJbXnH.js} +5 -4
  11. package/dist/chunks/{checkbox-radio-BY2aTCOG.js → checkbox-radio-gsm8QPJg.js} +74 -75
  12. package/dist/chunks/{combobox-C0EuExSI.js → combobox-CWNdx4Fk.js} +290 -279
  13. package/dist/chunks/conditions-DqNHLTbN.js +464 -0
  14. package/dist/chunks/country-from-ip-DDj_mFki.js +29 -0
  15. package/dist/chunks/csrf-DxHg_ZYt.js +61 -0
  16. package/dist/chunks/{custom-google-maps-BsaSirEZ.js → custom-google-maps-C4l2S3GO.js} +9 -3
  17. package/dist/chunks/{custom-link-CJ1-FjEM.js → custom-link-CLazgKYH.js} +8 -2
  18. package/dist/chunks/{custom-maps-DYW_pBid.js → custom-maps-DqcAlD0v.js} +10 -4
  19. package/dist/chunks/{date-picker-5CA_-zGb.js → date-picker-RUnevF7l.js} +456 -430
  20. package/dist/chunks/{dist-BdUy8m_p.js → dist-ZLeW0zZ3.js} +1280 -452
  21. package/dist/chunks/{eway-D9_m8ooj.js → eway-or6dtjoT.js} +3 -3
  22. package/dist/chunks/field-references.resolver-Ca8MguFv.js +104 -0
  23. package/dist/chunks/{file-upload-rqfZNqlH.js → file-upload-Bm-TXyNB.js} +104 -96
  24. package/dist/chunks/friendly-captcha-v1-GFqCt1Mh.js +34 -0
  25. package/dist/chunks/{friendly-captcha-v2-CLSAbkqx.js → friendly-captcha-v2-WoW246JG.js} +6 -5
  26. package/dist/chunks/{friendly-challenge-8uPatWqk.js → friendly-challenge-DPG9MJb1.js} +111 -102
  27. package/dist/chunks/{go-cardless-DAT3ZaQf.js → go-cardless-DzJ-0FKg.js} +2 -2
  28. package/dist/chunks/google-address-C1P1nTDM.js +163 -0
  29. package/dist/chunks/{hcaptcha-CGLAmgjO.js → hcaptcha-D0T8aIHz.js} +3 -3
  30. package/dist/chunks/{hidden-D7_Ch-QN.js → hidden-BZhXnNPe.js} +8 -2
  31. package/dist/chunks/http-C2QdHuWO.js +27 -0
  32. package/dist/chunks/{leaflet-src-j-lHNmhR.js → leaflet-src-DE6rv6M-.js} +42 -46
  33. package/dist/chunks/{loqate-CJPzBmSm.js → loqate-DD1S7PY9.js} +2 -2
  34. package/dist/chunks/{mollie-Bibhl67p.js → mollie-DG8Ju83x.js} +2 -2
  35. package/dist/chunks/{moneris-H2wSqk9h.js → moneris-C8m3Fvqu.js} +3 -3
  36. package/dist/chunks/opayo-B3EvrVxw.js +188 -0
  37. package/dist/chunks/{paddle-DkvIxQdG.js → paddle-BIYR9Um3.js} +3 -3
  38. package/dist/chunks/{password-validation-T0vDQPCr.js → password-validation-C8_uO_c_.js} +18 -12
  39. package/dist/chunks/{paypal-CQpAF7Ua.js → paypal-B_yxIo2d.js} +7 -5
  40. package/dist/chunks/{payway-CwDkC7YZ.js → payway-CeOzS0sL.js} +3 -3
  41. package/dist/chunks/{phone-country-D3ayr60L.js → phone-country-bAqje17P.js} +80 -63
  42. package/dist/chunks/{place-kit-BGHklIZ-.js → place-kit-BE5gi3vo.js} +3 -3
  43. package/dist/chunks/{placekit-autocomplete.esm-DWVabQlq.js → placekit-autocomplete.esm-CZZERYur.js} +11 -15
  44. package/dist/chunks/{recaptcha-enterprise-XPId5-bS.js → recaptcha-enterprise-CruXddZq.js} +4 -4
  45. package/dist/chunks/{recaptcha-shared-CLYJvojk.js → recaptcha-shared-AQRMDMme.js} +1 -1
  46. package/dist/chunks/{recaptcha-v2-checkbox-Cy-0PEPc.js → recaptcha-v2-checkbox-CCnJYCnG.js} +4 -4
  47. package/dist/chunks/{recaptcha-v2-invisible-BwRH540O.js → recaptcha-v2-invisible-BuVqRRYn.js} +4 -4
  48. package/dist/chunks/{recaptcha-v3-No4Ykrhk.js → recaptcha-v3-CloqhO2A.js} +4 -4
  49. package/dist/chunks/{repeater-BVnPUqTj.js → repeater-DwE27jI1.js} +25 -19
  50. package/dist/chunks/request-profile-DhwkeCpS.js +10 -0
  51. package/dist/chunks/rich-text-uV4o_pGk.js +361 -0
  52. package/dist/chunks/{chunk-3b4jIN3o.js → rolldown-runtime-DtPi1Y-2.js} +2 -2
  53. package/dist/chunks/{sdk-BhHAYgga.js → sdk-lkwSvlpM.js} +282 -234
  54. package/dist/chunks/{shared-Bx9s0i0P.js → shared-OKhSay59.js} +27 -21
  55. package/dist/chunks/{signature-xz4QO7CR.js → signature-7cldFbqj.js} +160 -112
  56. package/dist/chunks/{snaptcha-DKx98oon.js → snaptcha-C04kNGYQ.js} +2 -2
  57. package/dist/chunks/{square-DwdcOI1G.js → square-DEzxv9D9.js} +8 -6
  58. package/dist/chunks/{stripe-DaoG2FT1.js → stripe-CVPQGDz3.js} +10 -11
  59. package/dist/chunks/{summary-Dks0gXS3.js → summary-BF_8mrXI.js} +47 -45
  60. package/dist/chunks/{survey-likert-DkE6bR7B.js → survey-likert-fk1hUPff.js} +7 -1
  61. package/dist/chunks/{survey-rank-DN6x4IZM.js → survey-rank-BsLGl2LX.js} +37 -25
  62. package/dist/chunks/{survey-rating-BnsNL9U5.js → survey-rating-DVS6e6fM.js} +17 -5
  63. package/dist/chunks/{table-CAjCJHrL.js → table-DnIBdeKF.js} +21 -15
  64. package/dist/chunks/{text-limit-Bn18WrPU.js → text-limit-LGMPhFuC.js} +40 -34
  65. package/dist/chunks/{theme-classes-Tv7q7ToE.js → theme-classes-DAQuEqdP.js} +1 -1
  66. package/dist/chunks/{turnstile-DJakPzQD.js → turnstile-n9DNyPxi.js} +3 -3
  67. package/dist/chunks/{upload-manager-W-QDgxKD.js → upload-manager-BbiUosZq.js} +410 -350
  68. package/dist/chunks/{utils-Vqp8i_RM.js → utils-DpUBPadZ.js} +20 -14
  69. package/dist/css/formie-base.css +104 -1
  70. package/dist/css/theme/_messages.css +2 -0
  71. package/dist/css/theme/_tokens.css +31 -25
  72. package/dist/css/theme/fields/_signature.css +2 -1
  73. package/dist/css/theme/forms/_form.css +5 -1
  74. package/dist/index.d.ts +5 -4
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +1778 -1425
  77. package/dist/js/contracts/client.d.ts +5 -3
  78. package/dist/js/contracts/client.d.ts.map +1 -1
  79. package/dist/js/contracts/common.d.ts +2 -2
  80. package/dist/js/contracts/common.d.ts.map +1 -1
  81. package/dist/js/contracts/modules.d.ts +37 -12
  82. package/dist/js/contracts/modules.d.ts.map +1 -1
  83. package/dist/js/contracts/schema.d.ts +20 -38
  84. package/dist/js/contracts/schema.d.ts.map +1 -1
  85. package/dist/js/contracts/theme.d.ts +4 -1
  86. package/dist/js/contracts/theme.d.ts.map +1 -1
  87. package/dist/js/core/client-rendered-modules.d.ts +17 -0
  88. package/dist/js/core/client-rendered-modules.d.ts.map +1 -0
  89. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  90. package/dist/js/core/field-error-aria.d.ts +23 -0
  91. package/dist/js/core/field-error-aria.d.ts.map +1 -0
  92. package/dist/js/core/hydrate-modules.d.ts +10 -8
  93. package/dist/js/core/hydrate-modules.d.ts.map +1 -1
  94. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  95. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  96. package/dist/js/core/validation-focus.d.ts.map +1 -1
  97. package/dist/js/modules/address/address-finder.d.ts +1 -1
  98. package/dist/js/modules/address/address-finder.d.ts.map +1 -1
  99. package/dist/js/modules/address/factories.d.ts +3 -3
  100. package/dist/js/modules/address/factories.d.ts.map +1 -1
  101. package/dist/js/modules/address/google-address.d.ts +2 -1
  102. package/dist/js/modules/address/google-address.d.ts.map +1 -1
  103. package/dist/js/modules/address/index.d.ts +2 -2
  104. package/dist/js/modules/address/index.d.ts.map +1 -1
  105. package/dist/js/modules/address/loqate.d.ts +1 -1
  106. package/dist/js/modules/address/loqate.d.ts.map +1 -1
  107. package/dist/js/modules/address/place-kit.d.ts +1 -1
  108. package/dist/js/modules/address/place-kit.d.ts.map +1 -1
  109. package/dist/js/modules/captchas/captcha-eu.d.ts +1 -1
  110. package/dist/js/modules/captchas/captcha-eu.d.ts.map +1 -1
  111. package/dist/js/modules/captchas/factories.d.ts +11 -11
  112. package/dist/js/modules/captchas/factories.d.ts.map +1 -1
  113. package/dist/js/modules/captchas/friendly-captcha-v1.d.ts +1 -1
  114. package/dist/js/modules/captchas/friendly-captcha-v1.d.ts.map +1 -1
  115. package/dist/js/modules/captchas/friendly-captcha-v2.d.ts +1 -1
  116. package/dist/js/modules/captchas/friendly-captcha-v2.d.ts.map +1 -1
  117. package/dist/js/modules/captchas/hcaptcha.d.ts +1 -1
  118. package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -1
  119. package/dist/js/modules/captchas/index.d.ts +2 -2
  120. package/dist/js/modules/captchas/index.d.ts.map +1 -1
  121. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts +1 -1
  122. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -1
  123. package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts +1 -1
  124. package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts.map +1 -1
  125. package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts +1 -1
  126. package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts.map +1 -1
  127. package/dist/js/modules/captchas/recaptcha-v3.d.ts +1 -1
  128. package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
  129. package/dist/js/modules/captchas/snaptcha.d.ts +1 -1
  130. package/dist/js/modules/captchas/snaptcha.d.ts.map +1 -1
  131. package/dist/js/modules/captchas/turnstile.d.ts +1 -1
  132. package/dist/js/modules/captchas/turnstile.d.ts.map +1 -1
  133. package/dist/js/modules/fields/address-country.d.ts +2 -2
  134. package/dist/js/modules/fields/address-country.d.ts.map +1 -1
  135. package/dist/js/modules/fields/address-state.d.ts +2 -2
  136. package/dist/js/modules/fields/address-state.d.ts.map +1 -1
  137. package/dist/js/modules/fields/calculations.d.ts +2 -2
  138. package/dist/js/modules/fields/calculations.d.ts.map +1 -1
  139. package/dist/js/modules/fields/checkbox-radio.d.ts +2 -2
  140. package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
  141. package/dist/js/modules/fields/combobox.d.ts +2 -2
  142. package/dist/js/modules/fields/combobox.d.ts.map +1 -1
  143. package/dist/js/modules/fields/conditions/config.d.ts.map +1 -1
  144. package/dist/js/modules/fields/conditions/effects.d.ts +1 -0
  145. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
  146. package/dist/js/modules/fields/conditions/evaluator.d.ts +4 -1
  147. package/dist/js/modules/fields/conditions/evaluator.d.ts.map +1 -1
  148. package/dist/js/modules/fields/conditions/references.d.ts.map +1 -1
  149. package/dist/js/modules/fields/conditions/submission-context.d.ts +15 -0
  150. package/dist/js/modules/fields/conditions/submission-context.d.ts.map +1 -0
  151. package/dist/js/modules/fields/conditions/types.d.ts +3 -1
  152. package/dist/js/modules/fields/conditions/types.d.ts.map +1 -1
  153. package/dist/js/modules/fields/conditions/values.d.ts +1 -1
  154. package/dist/js/modules/fields/conditions/values.d.ts.map +1 -1
  155. package/dist/js/modules/fields/conditions.d.ts +2 -2
  156. package/dist/js/modules/fields/conditions.d.ts.map +1 -1
  157. package/dist/js/modules/fields/custom-google-maps.d.ts +2 -2
  158. package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -1
  159. package/dist/js/modules/fields/custom-link.d.ts +2 -2
  160. package/dist/js/modules/fields/custom-link.d.ts.map +1 -1
  161. package/dist/js/modules/fields/custom-maps.d.ts +2 -2
  162. package/dist/js/modules/fields/custom-maps.d.ts.map +1 -1
  163. package/dist/js/modules/fields/date-picker.d.ts +2 -2
  164. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  165. package/dist/js/modules/fields/file-upload.d.ts +2 -2
  166. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  167. package/dist/js/modules/fields/hidden.d.ts +2 -2
  168. package/dist/js/modules/fields/hidden.d.ts.map +1 -1
  169. package/dist/js/modules/fields/index.d.ts +2 -2
  170. package/dist/js/modules/fields/index.d.ts.map +1 -1
  171. package/dist/js/modules/fields/password-validation.d.ts +2 -2
  172. package/dist/js/modules/fields/password-validation.d.ts.map +1 -1
  173. package/dist/js/modules/fields/phone-country.d.ts +2 -2
  174. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  175. package/dist/js/modules/fields/repeater.d.ts +2 -2
  176. package/dist/js/modules/fields/repeater.d.ts.map +1 -1
  177. package/dist/js/modules/fields/rich-text.d.ts +2 -2
  178. package/dist/js/modules/fields/rich-text.d.ts.map +1 -1
  179. package/dist/js/modules/fields/shared.d.ts +1 -0
  180. package/dist/js/modules/fields/shared.d.ts.map +1 -1
  181. package/dist/js/modules/fields/signature.d.ts +2 -2
  182. package/dist/js/modules/fields/signature.d.ts.map +1 -1
  183. package/dist/js/modules/fields/summary.d.ts +2 -2
  184. package/dist/js/modules/fields/summary.d.ts.map +1 -1
  185. package/dist/js/modules/fields/survey-likert.d.ts +2 -2
  186. package/dist/js/modules/fields/survey-likert.d.ts.map +1 -1
  187. package/dist/js/modules/fields/survey-rank.d.ts +2 -2
  188. package/dist/js/modules/fields/survey-rank.d.ts.map +1 -1
  189. package/dist/js/modules/fields/survey-rating.d.ts +2 -2
  190. package/dist/js/modules/fields/survey-rating.d.ts.map +1 -1
  191. package/dist/js/modules/fields/table.d.ts +2 -2
  192. package/dist/js/modules/fields/table.d.ts.map +1 -1
  193. package/dist/js/modules/fields/text-limit.d.ts +2 -2
  194. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  195. package/dist/js/modules/fields/upload-manager.d.ts +2 -2
  196. package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
  197. package/dist/js/modules/loader.d.ts +10 -4
  198. package/dist/js/modules/loader.d.ts.map +1 -1
  199. package/dist/js/modules/payments/bpoint.d.ts +1 -1
  200. package/dist/js/modules/payments/bpoint.d.ts.map +1 -1
  201. package/dist/js/modules/payments/eway.d.ts +1 -1
  202. package/dist/js/modules/payments/eway.d.ts.map +1 -1
  203. package/dist/js/modules/payments/factories.d.ts +7 -7
  204. package/dist/js/modules/payments/factories.d.ts.map +1 -1
  205. package/dist/js/modules/payments/go-cardless.d.ts +1 -1
  206. package/dist/js/modules/payments/go-cardless.d.ts.map +1 -1
  207. package/dist/js/modules/payments/index.d.ts +2 -2
  208. package/dist/js/modules/payments/index.d.ts.map +1 -1
  209. package/dist/js/modules/payments/mollie.d.ts +1 -1
  210. package/dist/js/modules/payments/mollie.d.ts.map +1 -1
  211. package/dist/js/modules/payments/moneris.d.ts +1 -1
  212. package/dist/js/modules/payments/moneris.d.ts.map +1 -1
  213. package/dist/js/modules/payments/opayo.d.ts +1 -1
  214. package/dist/js/modules/payments/opayo.d.ts.map +1 -1
  215. package/dist/js/modules/payments/paddle.d.ts +1 -1
  216. package/dist/js/modules/payments/paddle.d.ts.map +1 -1
  217. package/dist/js/modules/payments/paypal.d.ts +1 -1
  218. package/dist/js/modules/payments/paypal.d.ts.map +1 -1
  219. package/dist/js/modules/payments/payway.d.ts +1 -1
  220. package/dist/js/modules/payments/payway.d.ts.map +1 -1
  221. package/dist/js/modules/payments/square.d.ts +1 -1
  222. package/dist/js/modules/payments/square.d.ts.map +1 -1
  223. package/dist/js/modules/payments/stripe.d.ts +1 -1
  224. package/dist/js/modules/payments/stripe.d.ts.map +1 -1
  225. package/dist/js/modules/payments/utils.d.ts +6 -0
  226. package/dist/js/modules/payments/utils.d.ts.map +1 -1
  227. package/dist/js/modules/registry.d.ts +6 -4
  228. package/dist/js/modules/registry.d.ts.map +1 -1
  229. package/dist/js/submit/pipeline.d.ts.map +1 -1
  230. package/dist/js/theme/browser-theme-state.generated.d.ts +24 -0
  231. package/dist/js/theme/browser-theme-state.generated.d.ts.map +1 -0
  232. package/dist/js/theme/theme-classes.d.ts +3 -3
  233. package/dist/js/theme/theme-classes.d.ts.map +1 -1
  234. package/dist/js/transport/forms-api.d.ts +5 -3
  235. package/dist/js/transport/forms-api.d.ts.map +1 -1
  236. package/dist/js/utils/country-from-ip.d.ts +2 -2
  237. package/dist/js/utils/country-from-ip.d.ts.map +1 -1
  238. package/dist/js/utils/csrf.d.ts +17 -0
  239. package/dist/js/utils/csrf.d.ts.map +1 -0
  240. package/dist/js/utils/field-references.parser.d.ts +1 -0
  241. package/dist/js/utils/field-references.parser.d.ts.map +1 -1
  242. package/dist/js/utils/field-references.resolver.d.ts.map +1 -1
  243. package/dist/js/utils/field-references.types.d.ts +1 -0
  244. package/dist/js/utils/field-references.types.d.ts.map +1 -1
  245. package/dist/js/utils/http.d.ts +3 -1
  246. package/dist/js/utils/http.d.ts.map +1 -1
  247. package/dist/js/utils/request-profile.d.ts +4 -0
  248. package/dist/js/utils/request-profile.d.ts.map +1 -0
  249. package/dist/js/utils/unload-warning.d.ts.map +1 -1
  250. package/dist/js/validation/rules/email.d.ts.map +1 -1
  251. package/dist/js/validation/rules/match.d.ts.map +1 -1
  252. package/dist/js/validation/rules/number.d.ts.map +1 -1
  253. package/dist/js/validation/rules/required.d.ts.map +1 -1
  254. package/dist/js/validation/rules/shared.d.ts.map +1 -1
  255. package/dist/js/validation/rules/url.d.ts.map +1 -1
  256. package/dist/js/validation/skip.d.ts +7 -0
  257. package/dist/js/validation/skip.d.ts.map +1 -0
  258. package/dist/js/validation/submit-readiness.d.ts.map +1 -1
  259. package/dist/js/validation/validator.d.ts.map +1 -1
  260. package/package.json +43 -12
  261. package/src/css/formie-base.css +104 -1
  262. package/src/css/theme/_messages.css +2 -0
  263. package/src/css/theme/_tokens.css +31 -25
  264. package/src/css/theme/fields/_signature.css +2 -1
  265. package/src/css/theme/forms/_form.css +5 -1
  266. package/src/index.ts +13 -8
  267. package/src/js/contracts/client.ts +5 -3
  268. package/src/js/contracts/common.ts +5 -6
  269. package/src/js/contracts/modules.ts +41 -12
  270. package/src/js/contracts/schema.ts +21 -43
  271. package/src/js/contracts/theme.ts +6 -1
  272. package/src/js/core/client-rendered-modules.ts +69 -0
  273. package/src/js/core/create-formie-client.ts +119 -73
  274. package/src/js/core/field-error-aria.ts +93 -0
  275. package/src/js/core/hydrate-modules.ts +54 -29
  276. package/src/js/core/submit-result-state.ts +34 -45
  277. package/src/js/core/submit-result-ui.ts +21 -65
  278. package/src/js/core/validation-focus.ts +20 -20
  279. package/src/js/modules/address/address-finder.ts +1 -1
  280. package/src/js/modules/address/factories.ts +15 -13
  281. package/src/js/modules/address/google-address.ts +10 -6
  282. package/src/js/modules/address/index.ts +2 -2
  283. package/src/js/modules/address/loqate.ts +1 -1
  284. package/src/js/modules/address/place-kit.ts +1 -1
  285. package/src/js/modules/captchas/captcha-eu.ts +2 -2
  286. package/src/js/modules/captchas/factories.ts +66 -42
  287. package/src/js/modules/captchas/friendly-captcha-v1.ts +12 -2
  288. package/src/js/modules/captchas/friendly-captcha-v2.ts +4 -2
  289. package/src/js/modules/captchas/hcaptcha.ts +5 -5
  290. package/src/js/modules/captchas/index.ts +2 -2
  291. package/src/js/modules/captchas/recaptcha-enterprise.ts +2 -2
  292. package/src/js/modules/captchas/recaptcha-v2-checkbox.ts +3 -3
  293. package/src/js/modules/captchas/recaptcha-v2-invisible.ts +2 -2
  294. package/src/js/modules/captchas/recaptcha-v3.ts +2 -2
  295. package/src/js/modules/captchas/snaptcha.ts +1 -1
  296. package/src/js/modules/captchas/turnstile.ts +3 -3
  297. package/src/js/modules/fields/address-country.ts +6 -4
  298. package/src/js/modules/fields/address-state.ts +20 -12
  299. package/src/js/modules/fields/calculations.ts +5 -3
  300. package/src/js/modules/fields/checkbox-radio.ts +24 -42
  301. package/src/js/modules/fields/combobox.ts +25 -9
  302. package/src/js/modules/fields/conditions/config.ts +17 -20
  303. package/src/js/modules/fields/conditions/effects.ts +23 -26
  304. package/src/js/modules/fields/conditions/evaluator.ts +21 -29
  305. package/src/js/modules/fields/conditions/references.ts +16 -5
  306. package/src/js/modules/fields/conditions/submission-context.ts +80 -0
  307. package/src/js/modules/fields/conditions/types.ts +3 -1
  308. package/src/js/modules/fields/conditions/values.ts +31 -6
  309. package/src/js/modules/fields/conditions.ts +59 -18
  310. package/src/js/modules/fields/custom-google-maps.ts +5 -3
  311. package/src/js/modules/fields/custom-link.ts +5 -3
  312. package/src/js/modules/fields/custom-maps.ts +5 -3
  313. package/src/js/modules/fields/date-picker.ts +40 -4
  314. package/src/js/modules/fields/file-upload.ts +19 -10
  315. package/src/js/modules/fields/hidden.ts +5 -3
  316. package/src/js/modules/fields/index.ts +2 -2
  317. package/src/js/modules/fields/password-validation.ts +5 -3
  318. package/src/js/modules/fields/phone-country.ts +33 -6
  319. package/src/js/modules/fields/repeater.ts +5 -3
  320. package/src/js/modules/fields/rich-text.ts +20 -4
  321. package/src/js/modules/fields/shared.ts +13 -0
  322. package/src/js/modules/fields/signature.ts +64 -6
  323. package/src/js/modules/fields/summary.ts +8 -20
  324. package/src/js/modules/fields/survey-likert.ts +5 -3
  325. package/src/js/modules/fields/survey-rank.ts +21 -3
  326. package/src/js/modules/fields/survey-rating.ts +17 -3
  327. package/src/js/modules/fields/table.ts +5 -3
  328. package/src/js/modules/fields/text-limit.ts +5 -3
  329. package/src/js/modules/fields/upload-manager.ts +190 -49
  330. package/src/js/modules/loader.ts +345 -281
  331. package/src/js/modules/payments/bpoint.ts +2 -2
  332. package/src/js/modules/payments/eway.ts +2 -2
  333. package/src/js/modules/payments/factories.ts +53 -52
  334. package/src/js/modules/payments/go-cardless.ts +1 -1
  335. package/src/js/modules/payments/index.ts +2 -2
  336. package/src/js/modules/payments/mollie.ts +1 -1
  337. package/src/js/modules/payments/moneris.ts +2 -2
  338. package/src/js/modules/payments/opayo.ts +21 -8
  339. package/src/js/modules/payments/paddle.ts +10 -6
  340. package/src/js/modules/payments/payment.ts +22 -18
  341. package/src/js/modules/payments/paypal.ts +1 -1
  342. package/src/js/modules/payments/payway.ts +2 -2
  343. package/src/js/modules/payments/square.ts +2 -2
  344. package/src/js/modules/payments/stripe.ts +5 -5
  345. package/src/js/modules/payments/utils.ts +14 -0
  346. package/src/js/modules/registry.ts +19 -11
  347. package/src/js/submit/pipeline.ts +10 -11
  348. package/src/js/theme/browser-theme-state.generated.ts +25 -0
  349. package/src/js/theme/theme-classes.ts +3 -3
  350. package/src/js/transport/forms-api.ts +66 -67
  351. package/src/js/utils/country-from-ip.ts +14 -9
  352. package/src/js/utils/csrf.ts +136 -0
  353. package/src/js/utils/field-references.parser.ts +13 -113
  354. package/src/js/utils/field-references.resolver.ts +27 -64
  355. package/src/js/utils/field-references.row-scope.ts +1 -1
  356. package/src/js/utils/field-references.types.ts +1 -0
  357. package/src/js/utils/http.ts +5 -5
  358. package/src/js/utils/request-profile.ts +10 -0
  359. package/src/js/utils/unload-warning.ts +12 -4
  360. package/src/js/validation/rules/email.ts +3 -5
  361. package/src/js/validation/rules/match.ts +2 -1
  362. package/src/js/validation/rules/minmax.ts +4 -43
  363. package/src/js/validation/rules/number.ts +3 -47
  364. package/src/js/validation/rules/pattern.ts +3 -8
  365. package/src/js/validation/rules/required.ts +2 -1
  366. package/src/js/validation/rules/shared.ts +5 -1
  367. package/src/js/validation/rules/url.ts +3 -10
  368. package/src/js/validation/skip.ts +9 -0
  369. package/src/js/validation/submit-readiness.ts +9 -2
  370. package/src/js/validation/validator.ts +35 -59
  371. package/dist/chunks/calculations-DERi2xaC.js +0 -299
  372. package/dist/chunks/conditions-65kBcFWW.js +0 -424
  373. package/dist/chunks/country-from-ip-BwxKaBuJ.js +0 -26
  374. package/dist/chunks/field-references.resolver-CHwn0G0L.js +0 -145
  375. package/dist/chunks/friendly-captcha-v1-C_2reOXr.js +0 -31
  376. package/dist/chunks/google-address-BH3Zhi06.js +0 -161
  377. package/dist/chunks/http-D-JExro7.js +0 -27
  378. package/dist/chunks/opayo-CR0DtsLa.js +0 -179
  379. package/dist/chunks/rich-text-Bg_--4TG.js +0 -349
  380. package/dist/js/modules/fields/conditions/transforms.d.ts +0 -3
  381. package/dist/js/modules/fields/conditions/transforms.d.ts.map +0 -1
  382. package/src/js/modules/fields/conditions/transforms.ts +0 -206
  383. package/src/js/modules/payments/stub-payment-module.ts +0 -87
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verbb/formie-browser",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -28,19 +28,49 @@
28
28
  "**/*.css"
29
29
  ],
30
30
  "imports": {
31
- "#theme/*": "./src/js/theme/*",
31
+ "#theme/*": {
32
+ "types": "./dist/js/theme/*.d.ts",
33
+ "default": "./src/js/theme/*"
34
+ },
32
35
  "#theme-css/*": "./src/css/theme/*",
33
36
  "#theme-base/*": "./src/css/theme-base/*",
34
37
  "#icons/*": "./src/icons/*",
35
- "#contracts/*": "./src/js/contracts/*",
36
- "#compatibility/*": "./src/js/compatibility/*",
37
- "#core/*": "./src/js/core/*",
38
- "#events/*": "./src/js/events/*",
39
- "#modules/*": "./src/js/modules/*",
40
- "#submit/*": "./src/js/submit/*",
41
- "#transport/*": "./src/js/transport/*",
42
- "#utils/*": "./src/js/utils/*",
43
- "#validation/*": "./src/js/validation/*"
38
+ "#contracts/*": {
39
+ "types": "./dist/js/contracts/*.d.ts",
40
+ "default": "./src/js/contracts/*"
41
+ },
42
+ "#compatibility/*": {
43
+ "types": "./dist/js/compatibility/*.d.ts",
44
+ "default": "./src/js/compatibility/*"
45
+ },
46
+ "#core/*": {
47
+ "types": "./dist/js/core/*.d.ts",
48
+ "default": "./src/js/core/*"
49
+ },
50
+ "#events/*": {
51
+ "types": "./dist/js/events/*.d.ts",
52
+ "default": "./src/js/events/*"
53
+ },
54
+ "#modules/*": {
55
+ "types": "./dist/js/modules/*.d.ts",
56
+ "default": "./src/js/modules/*"
57
+ },
58
+ "#submit/*": {
59
+ "types": "./dist/js/submit/*.d.ts",
60
+ "default": "./src/js/submit/*"
61
+ },
62
+ "#transport/*": {
63
+ "types": "./dist/js/transport/*.d.ts",
64
+ "default": "./src/js/transport/*"
65
+ },
66
+ "#utils/*": {
67
+ "types": "./dist/js/utils/*.d.ts",
68
+ "default": "./src/js/utils/*"
69
+ },
70
+ "#validation/*": {
71
+ "types": "./dist/js/validation/*.d.ts",
72
+ "default": "./src/js/validation/*"
73
+ }
44
74
  },
45
75
  "exports": {
46
76
  ".": {
@@ -57,6 +87,7 @@
57
87
  "access": "public"
58
88
  },
59
89
  "scripts": {
90
+ "prebuild": "node ../../scripts/generate-browser-theme-state.mjs",
60
91
  "dev": "vite build --watch",
61
92
  "build": "vite build && tsc -p tsconfig.json"
62
93
  },
@@ -70,7 +101,7 @@
70
101
  "@placekit/autocomplete-js": "^2.2.1",
71
102
  "@uppy/core": "^5.2.0",
72
103
  "@uppy/xhr-upload": "^5.2.0",
73
- "@verbb/formie-core": "1.0.12",
104
+ "@verbb/formie-core": "1.0.14",
74
105
  "expression-language": "^2.5.4",
75
106
  "flatpickr": "^4.6.13",
76
107
  "friendly-challenge": "^0.9.19",
@@ -75,4 +75,107 @@
75
75
  [hidden] {
76
76
  display: none !important;
77
77
  }
78
- }
78
+
79
+ .formie-module-error--fallback {
80
+ margin-block: 0 1.5rem;
81
+ padding: 1rem;
82
+ border: 1px solid #f3a6a6;
83
+ border-inline-start: 4px solid #c92a2a;
84
+ border-radius: 0.375rem;
85
+ background: #fff5f5;
86
+ color: #5f2120;
87
+ font: 0.875rem/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
88
+ }
89
+
90
+ .formie-module-error--fallback .formie-module-error__notice {
91
+ display: flex;
92
+ align-items: flex-start;
93
+ gap: 0.75rem;
94
+ }
95
+
96
+ .formie-module-error--fallback .formie-module-error__indicator {
97
+ display: inline-flex;
98
+ flex: 0 0 auto;
99
+ align-items: center;
100
+ justify-content: center;
101
+ width: 1.5rem;
102
+ height: 1.5rem;
103
+ border-radius: 50%;
104
+ background: #c92a2a;
105
+ color: #fff;
106
+ font-weight: 700;
107
+ line-height: 1;
108
+ }
109
+
110
+ .formie-module-error--fallback .formie-module-error__content {
111
+ min-width: 0;
112
+ }
113
+
114
+ .formie-module-error--fallback .formie-module-error__title {
115
+ display: block;
116
+ margin-block-end: 0.125rem;
117
+ color: #842029;
118
+ font-size: 0.9375rem;
119
+ }
120
+
121
+ .formie-module-error--fallback .formie-module-error__details {
122
+ margin-block-start: 0.875rem;
123
+ padding-block-start: 0.75rem;
124
+ border-block-start: 1px solid #f3c2c2;
125
+ }
126
+
127
+ .formie-module-error--fallback .formie-module-error__details > summary {
128
+ width: fit-content;
129
+ cursor: pointer;
130
+ font-weight: 600;
131
+ }
132
+
133
+ .formie-module-error--fallback .formie-module-error__details > pre {
134
+ max-height: 16rem;
135
+ margin-block: 0.75rem;
136
+ padding: 0.75rem;
137
+ overflow: auto;
138
+ border: 1px solid #ead0d0;
139
+ border-radius: 0.25rem;
140
+ background: #fff;
141
+ color: #3f2929;
142
+ font: 0.75rem/1.5 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
143
+ overflow-wrap: anywhere;
144
+ user-select: text;
145
+ white-space: pre-wrap;
146
+ }
147
+
148
+ .formie-module-error--fallback .formie-module-error__actions {
149
+ display: flex;
150
+ flex-wrap: wrap;
151
+ align-items: center;
152
+ gap: 0.75rem;
153
+ }
154
+
155
+ .formie-module-error--fallback .formie-module-error__copy {
156
+ padding: 0.375rem 0.625rem;
157
+ border: 1px solid #bd6464;
158
+ border-radius: 0.25rem;
159
+ background: #fff;
160
+ color: #6f1d1d;
161
+ cursor: pointer;
162
+ font: inherit;
163
+ font-weight: 600;
164
+ }
165
+
166
+ .formie-module-error--fallback .formie-module-error__copy:hover {
167
+ background: #fffafa;
168
+ }
169
+
170
+ .formie-module-error--fallback .formie-module-error__details > summary:focus-visible,
171
+ .formie-module-error--fallback .formie-module-error__copy:focus-visible,
172
+ .formie-module-error--fallback .formie-module-error__details > pre:focus-visible {
173
+ outline: 2px solid #7f1d1d;
174
+ outline-offset: 2px;
175
+ }
176
+
177
+ .formie-module-error--fallback .formie-module-error__copy-status {
178
+ color: #6f1d1d;
179
+ font-size: 0.8125rem;
180
+ }
181
+ }
@@ -24,6 +24,7 @@
24
24
  }
25
25
 
26
26
  .formie-message-error {
27
+ border: var(--formie-border-width) solid var(--formie-color-danger-border);
27
28
  background: var(--formie-color-danger-soft);
28
29
  color: var(--formie-color-danger-dark);
29
30
  }
@@ -33,6 +34,7 @@
33
34
  }
34
35
 
35
36
  .formie-message-success {
37
+ border: var(--formie-border-width) solid var(--formie-color-success-border);
36
38
  background: var(--formie-color-success-soft);
37
39
  color: var(--formie-color-success-dark);
38
40
  }
@@ -47,6 +47,7 @@
47
47
  --formie-black: #000000;
48
48
  --formie-white: #ffffff;
49
49
 
50
+ /* Matches Tailwind CSS's Slate color palette, with a custom 450 accessibility step. */
50
51
  --formie-neutral-50: #f8fafc;
51
52
  --formie-neutral-100: #f1f5f9;
52
53
  --formie-neutral-200: #e2e8f0;
@@ -61,6 +62,7 @@
61
62
  --formie-neutral-900: #0f172a;
62
63
  --formie-neutral-950: #020617;
63
64
 
65
+ /* Custom tonal scale based on #1c41e3. */
64
66
  --formie-primary-50: #e8ecfc;
65
67
  --formie-primary-100: #d2d9f9;
66
68
  --formie-primary-200: #a4b3f4;
@@ -73,29 +75,31 @@
73
75
  --formie-primary-900: #060d2d;
74
76
  --formie-primary-950: #040920;
75
77
 
76
- --formie-danger-50: #fef2f2;
77
- --formie-danger-100: #fee2e2;
78
- --formie-danger-200: #fecaca;
79
- --formie-danger-300: #fca5a5;
80
- --formie-danger-400: #f87171;
81
- --formie-danger-500: #ef4444;
82
- --formie-danger-600: #dc2626;
83
- --formie-danger-700: #b91c1c;
84
- --formie-danger-800: #991b1b;
85
- --formie-danger-900: #7f1d1d;
86
- --formie-danger-950: #450a0a;
87
-
88
- --formie-success-50: #f0fdf4;
89
- --formie-success-100: #dcfce7;
90
- --formie-success-200: #bbf7d0;
91
- --formie-success-300: #86efac;
92
- --formie-success-400: #4ade80;
93
- --formie-success-500: #22c55e;
94
- --formie-success-600: #16a34a;
95
- --formie-success-700: #15803d;
96
- --formie-success-800: #166534;
97
- --formie-success-900: #14532d;
98
- --formie-success-950: #052e16;
78
+ /* Matches Tailwind CSS's Rose color palette. */
79
+ --formie-danger-50: #fff1f2;
80
+ --formie-danger-100: #ffe4e6;
81
+ --formie-danger-200: #fecdd3;
82
+ --formie-danger-300: #fda4af;
83
+ --formie-danger-400: #fb7185;
84
+ --formie-danger-500: #f43f5e;
85
+ --formie-danger-600: #e11d48;
86
+ --formie-danger-700: #be123c;
87
+ --formie-danger-800: #9f1239;
88
+ --formie-danger-900: #881337;
89
+ --formie-danger-950: #4c0519;
90
+
91
+ /* Matches Tailwind CSS's Emerald color palette. */
92
+ --formie-success-50: #ecfdf5;
93
+ --formie-success-100: #d1fae5;
94
+ --formie-success-200: #a7f3d0;
95
+ --formie-success-300: #6ee7b7;
96
+ --formie-success-400: #34d399;
97
+ --formie-success-500: #10b981;
98
+ --formie-success-600: #059669;
99
+ --formie-success-700: #047857;
100
+ --formie-success-800: #065f46;
101
+ --formie-success-900: #064e3b;
102
+ --formie-success-950: #022c22;
99
103
 
100
104
  /* Semantic color aliases */
101
105
  --formie-color-background: var(--formie-white);
@@ -116,16 +120,18 @@
116
120
  --formie-color-primary-soft: var(--formie-primary-100);
117
121
  --formie-color-focus-ring: var(--formie-primary-300);
118
122
  --formie-color-danger: var(--formie-danger-600);
123
+ --formie-color-danger-border: var(--formie-danger-200);
119
124
  --formie-color-danger-soft: var(--formie-danger-50);
120
125
  --formie-color-danger-dark: var(--formie-danger-900);
121
126
  --formie-color-success: var(--formie-success-500);
127
+ --formie-color-success-border: var(--formie-success-200);
122
128
  --formie-color-success-soft: var(--formie-success-50);
123
129
  --formie-color-success-dark: var(--formie-success-900);
124
130
  --formie-color-button-text: var(--formie-color-surface);
125
131
 
126
132
  --formie-focus-ring-border-color: var(--formie-color-focus-ring);
127
133
  --formie-shadow-focus: 0 0 0 3px rgba(119, 141, 238, 0.45);
128
- --formie-shadow-danger-focus: 0 0 0 3px rgba(248, 180, 180, 0.45);
134
+ --formie-shadow-danger-focus: 0 0 0 3px rgba(253, 164, 175, 0.45);
129
135
 
130
136
  /* Form */
131
137
  --formie-title-form-size: 1.4rem;
@@ -365,4 +371,4 @@
365
371
  -webkit-font-smoothing: antialiased;
366
372
  -moz-osx-font-smoothing: grayscale;
367
373
  }
368
- }
374
+ }
@@ -20,7 +20,8 @@
20
20
  [data-formie-field-type="signature"] .formie-signature-canvas {
21
21
  display: block;
22
22
  width: var(--formie-signature-width);
23
- height: var(--formie-signature-height);
23
+ min-height: var(--formie-signature-height);
24
+ height: auto;
24
25
  border: var(--formie-signature-border);
25
26
  background: var(--formie-signature-background);
26
27
  border-radius: var(--formie-signature-border-radius);
@@ -146,6 +146,10 @@
146
146
  gap: var(--formie-gap-field-errors);
147
147
  }
148
148
 
149
+ .formie-field-errors:empty {
150
+ position: absolute;
151
+ }
152
+
149
153
  .formie-page-tabs {
150
154
  display: flex;
151
155
  flex-wrap: wrap;
@@ -191,4 +195,4 @@
191
195
  .formie-tab-error.formie-tab-current .formie-tab-link:hover {
192
196
  color: var(--formie-color-danger);
193
197
  }
194
- }
198
+ }
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createFormieClient } from '#core/create-formie-client';
2
2
  export { hydrateFormieModules } from '#core/hydrate-modules';
3
3
  export { formie } from '#core/formie';
4
- export { ModuleRegistry } from '#modules/registry';
4
+ export { ModuleRegistry, clientRenderedModuleRegistry } from '#modules/registry';
5
5
  export { FormieValidator } from '#validation/validator';
6
6
  export { bindLegacyDomEventCompatibility } from '#compatibility/dom-adapter';
7
7
  export { bindLegacyValidatorCompatibility } from '#compatibility/validator-adapter';
@@ -85,8 +85,12 @@ export type {
85
85
  } from '#compatibility/event-map';
86
86
  export type { FormAction, FormMode, FormTransport, SubmitStage } from '#contracts/common';
87
87
  export type {
88
- FormieModuleDefinition,
89
- FormieModuleInstance,
88
+ BrowserModuleDefinition,
89
+ BrowserModuleInstance,
90
+ BrowserModuleFailure,
91
+ BrowserModuleHydrationReport,
92
+ AfterSubmitContext,
93
+ BeforeSubmitContext,
90
94
  ModuleHookContext,
91
95
  ModuleMatchContext,
92
96
  ModuleRegistrationOptions,
@@ -95,17 +99,16 @@ export type {
95
99
  } from '#contracts/modules';
96
100
  export type {
97
101
  FormRefreshTokensPayload,
98
- FormDefinitionField,
99
- FormDefinitionPage,
100
- FormDefinitionPayload,
101
102
  FormEndpointPayload,
102
- FormModuleManifest,
103
+ BrowserModuleEntry,
104
+ BrowserModuleKind,
105
+ BrowserModuleManifest,
103
106
  FormModuleTarget,
104
107
  FormModuleTargetType,
105
108
  FormRedirect,
106
109
  FormSubmitResult,
107
110
  } from '#contracts/schema';
108
- export type { ThemeClassMap } from '#contracts/theme';
111
+ export type { BrowserThemeClassMap, ThemeClassMap } from '#contracts/theme';
109
112
  export type {
110
113
  ValidationConfig,
111
114
  ValidationContext,
@@ -123,3 +126,5 @@ export type {
123
126
  ParsedFieldReference,
124
127
  ResolveFieldValueResult,
125
128
  } from '#utils/field-references';
129
+
130
+ export { mountClientRenderedModules } from '#core/client-rendered-modules';
@@ -1,11 +1,13 @@
1
1
  import type { LegacyCompatibilityOptions } from '#compatibility/event-map';
2
2
  import type { FormAction, FormMode, FormTransport } from '#contracts/common';
3
- import type { FormieModuleDefinition, ModuleRegistrationOptions } from '#contracts/modules';
3
+ import type { BrowserModuleDefinition, ModuleRegistrationOptions } from '#contracts/modules';
4
4
  import type { FormEndpointPayload, FormSubmitResult } from '#contracts/schema';
5
5
 
6
6
  export type FormMountOptions = {
7
7
  mode: FormMode;
8
+ /** REST/GraphQL select the HTML source; submission always uses the normal form endpoint. */
8
9
  transport?: FormTransport;
10
+ profile?: import('@verbb/formie-core').BrowserRequestOptions['profile'];
9
11
  formHandle?: string;
10
12
  endpoint?: string;
11
13
  payload?: FormEndpointPayload;
@@ -35,9 +37,9 @@ export type FormieClient = {
35
37
  update: (target: Element, options: Partial<FormMountOptions>) => Promise<FormieFormInstance>;
36
38
  getInstance: (target: Element) => FormieFormInstance | null;
37
39
  refreshForCache: (targetOrId: Element | string) => Promise<void>;
38
- registerModule: (moduleDefinition: FormieModuleDefinition, options?: ModuleRegistrationOptions) => boolean;
40
+ registerModule: (moduleDefinition: BrowserModuleDefinition, options?: ModuleRegistrationOptions) => boolean;
39
41
  unregisterModule: (moduleId: string) => void;
40
- getRegisteredModules: () => FormieModuleDefinition[];
42
+ getRegisteredModules: () => BrowserModuleDefinition[];
41
43
  scan: (root?: ParentNode) => Promise<FormieFormInstance[]>;
42
44
  observe: (root?: ParentNode) => () => void;
43
45
  };
@@ -1,14 +1,13 @@
1
1
  export type FormAction = 'submit' | 'back' | 'save';
2
2
 
3
- export type FormMode = 'server-rendered' | 'client-rendered';
3
+ export type FormMode = 'server-rendered';
4
4
 
5
5
  export type FormTransport = 'rest' | 'graphql';
6
6
 
7
7
  export type SubmitStage =
8
8
  | 'prepare'
9
- | 'normalize'
10
9
  | 'validate'
11
- | 'screen'
12
- | 'authorize'
13
- | 'dispatch'
14
- | 'finalize';
10
+ | 'challenge'
11
+ | 'payment'
12
+ | 'send'
13
+ | 'result';
@@ -1,13 +1,14 @@
1
- import type { FormAction, FormMode, SubmitStage } from '#contracts/common';
2
- import type { FormModuleManifest, FormModuleTargetType, FormSubmitResult } from '#contracts/schema';
1
+ import type { FormAction } from '#contracts/common';
2
+ import type { BrowserModuleEntry, FormModuleTargetType, FormSubmitResult } from '#contracts/schema';
3
+ import type { BrowserModuleKind, BrowserSurface } from '@verbb/formie-core';
3
4
 
4
5
  export type ModuleMatchContext = {
5
6
  root: Element;
6
7
  form: HTMLFormElement | null;
7
8
  target: Element;
8
9
  scope: FormModuleTargetType;
9
- mode: FormMode;
10
- manifestItem: FormModuleManifest;
10
+ surface: BrowserSurface;
11
+ manifestItem: BrowserModuleEntry;
11
12
  };
12
13
 
13
14
  export type ModuleHookContext = {
@@ -20,6 +21,8 @@ export type ModuleHookContext = {
20
21
  };
21
22
 
22
23
  export type ModuleSetupContext = ModuleHookContext & {
24
+ entryKey?: string;
25
+ surface: BrowserSurface;
23
26
  options?: Record<string, unknown>;
24
27
  on: (eventName: string, callback: (payload: unknown) => void) => () => void;
25
28
  emit: (eventName: string, payload?: unknown) => Promise<void>;
@@ -31,23 +34,49 @@ export type ModuleRegistrationOptions = {
31
34
 
32
35
  export type SubmitHookContext = {
33
36
  form: HTMLFormElement;
34
- stage: SubmitStage;
35
37
  action: FormAction;
36
38
  formData: FormData;
39
+ };
40
+
41
+ export type BeforeSubmitContext = SubmitHookContext & {
37
42
  abort: (reason?: string) => void;
38
43
  isAborted: () => boolean;
39
44
  abortReason: () => string | undefined;
40
45
  };
41
46
 
42
- export type FormieModuleInstance = {
47
+ export type AfterSubmitContext = SubmitHookContext;
48
+
49
+ export type BrowserModuleInstance = {
50
+ assertReady?: () => void;
51
+ key?: string;
52
+ moduleId?: string;
53
+ kind?: BrowserModuleKind;
54
+ target?: Element;
55
+ update?: (ctx: ModuleSetupContext) => void | Promise<void>;
43
56
  destroy: () => void | Promise<void>;
44
- onBeforeStage?: (ctx: SubmitHookContext) => void | Promise<void>;
45
- onAfterStage?: (ctx: SubmitHookContext, result?: FormSubmitResult) => void | Promise<void>;
57
+ beforeSubmit?: (ctx: BeforeSubmitContext) => void | Promise<void>;
58
+ afterSubmit?: (ctx: AfterSubmitContext, result: FormSubmitResult) => void | Promise<void>;
46
59
  };
47
60
 
48
- export type FormieModuleDefinition = {
49
- id: string;
50
- kind: 'field' | 'captcha' | 'payment' | 'address' | 'core';
61
+ export type BrowserModuleDefinition = {
62
+ moduleId: string;
63
+ version: 2;
64
+ surfaces: BrowserSurface[];
65
+ kind: BrowserModuleKind;
51
66
  match: (ctx: ModuleMatchContext) => boolean;
52
- setup: (ctx: ModuleSetupContext) => Promise<FormieModuleInstance | void>;
67
+ setup: (ctx: ModuleSetupContext) => Promise<BrowserModuleInstance | void>;
68
+ };
69
+
70
+ export type BrowserModuleFailure = {
71
+ key: string;
72
+ moduleId: string;
73
+ required: boolean;
74
+ surface: BrowserSurface;
75
+ code: 'MODULE_UNAVAILABLE';
76
+ message: string;
77
+ };
78
+
79
+ export type BrowserModuleHydrationReport = {
80
+ readonly instances: readonly BrowserModuleInstance[];
81
+ readonly failures: readonly BrowserModuleFailure[];
53
82
  };
@@ -1,32 +1,7 @@
1
+ import type { BrowserModuleManifest, PaymentDecision } from '@verbb/formie-core';
1
2
  import type { FormAction, SubmitStage } from '#contracts/common';
2
3
  import type { ThemeClassMap } from '#contracts/theme';
3
4
 
4
- export type FormDefinitionField = {
5
- id: string;
6
- uid?: string;
7
- handle: string;
8
- type: string;
9
- label?: string;
10
- required?: boolean;
11
- settings?: Record<string, unknown>;
12
- children?: FormDefinitionField[];
13
- };
14
-
15
- export type FormDefinitionPage = {
16
- id: string;
17
- name?: string;
18
- fields: FormDefinitionField[];
19
- settings?: Record<string, unknown>;
20
- };
21
-
22
- export type FormDefinitionPayload = {
23
- formId?: string;
24
- handle?: string;
25
- pages?: FormDefinitionPage[];
26
- settings?: Record<string, unknown>;
27
- theme?: ThemeClassMap;
28
- };
29
-
30
5
  export type FormRefreshTokensPayload = {
31
6
  csrf?: {
32
7
  param: string;
@@ -34,6 +9,7 @@ export type FormRefreshTokensPayload = {
34
9
  };
35
10
  requestToken?: string;
36
11
  renderId?: string;
12
+ uploadCreateToken?: string;
37
13
  captchas?: Record<string, { sessionKey: string; value?: string }>;
38
14
  meta?: Record<string, unknown>;
39
15
  };
@@ -43,6 +19,14 @@ export type FormRedirect = {
43
19
  target?: 'same-tab' | 'new-tab';
44
20
  };
45
21
 
22
+ export type FormCompletion = {
23
+ behavior: 'message' | 'redirect' | 'reload' | 'reset';
24
+ url: string | null;
25
+ target: 'same-tab' | 'new-tab';
26
+ message: string | null;
27
+ hideForm: boolean;
28
+ };
29
+
46
30
  export type FormClientEvent = {
47
31
  event: string;
48
32
  payload: Record<string, string>;
@@ -50,13 +34,19 @@ export type FormClientEvent = {
50
34
 
51
35
  export type FormSubmitResult = {
52
36
  ok: boolean;
37
+ outcome?: string;
38
+ version?: number | null;
39
+ submissionUid?: string | null;
40
+ errors?: unknown;
41
+ session?: unknown;
42
+ completion?: FormCompletion | null;
53
43
  action?: FormAction;
54
44
  stage?: SubmitStage;
55
45
  code?: string;
56
46
  message?: string;
57
47
  keepSubmitLoading?: boolean;
48
+ payment?: PaymentDecision | null;
58
49
  fieldErrors?: Record<string, string[]>;
59
- pageFieldErrors?: Record<string, Record<string, string[]>>;
60
50
  formErrors?: string[];
61
51
  nextPage?: { id: string } | null;
62
52
  redirect?: FormRedirect | null;
@@ -68,22 +58,10 @@ export type FormSubmitResult = {
68
58
  export type FormEndpointPayload = {
69
59
  html?: string;
70
60
  theme?: ThemeClassMap;
71
- modules?: FormModuleManifest[];
61
+ modules?: BrowserModuleManifest;
72
62
  refreshTokens?: FormRefreshTokensPayload;
73
63
  };
74
64
 
75
- export type FormModuleTargetType = 'form' | 'field' | 'page' | 'button' | 'selector';
76
-
77
- export type FormModuleTarget = {
78
- targetType: FormModuleTargetType;
79
- targetId: string;
80
- };
81
-
82
- export type FormModuleManifest = {
83
- id: string;
84
- src?: string;
85
- type: string;
86
- targets?: FormModuleTarget[];
87
- renderTargets?: string[];
88
- config?: Record<string, unknown>;
89
- };
65
+ export type { BrowserModuleEntry, BrowserModuleKind, BrowserModuleManifest } from '@verbb/formie-core';
66
+ export type FormModuleTarget = import('@verbb/formie-core').BrowserModuleTarget;
67
+ export type FormModuleTargetType = FormModuleTarget['type'];
@@ -1 +1,6 @@
1
- export type ThemeClassMap = Record<string, string[] | string>;
1
+ import type { BrowserThemeStateKey } from '#theme/browser-theme-state.generated';
2
+
3
+ export type BrowserThemeClassMap = Partial<Record<BrowserThemeStateKey, string[] | string>> & Record<string, string[] | string>;
4
+
5
+ /** @deprecated Use BrowserThemeClassMap. */
6
+ export type ThemeClassMap = BrowserThemeClassMap;