@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.
- package/CHANGELOG.md +80 -0
- package/dist/chunks/{address-country-Rx6GQTND.js → address-country-BcEQKw0T.js} +11 -5
- package/dist/chunks/{address-finder-k7_BXaRe.js → address-finder-BWGINCSA.js} +3 -3
- package/dist/chunks/address-state-DI3ndhMU.js +365 -0
- package/dist/chunks/{api-BUb6P-xu.js → api-BK9b340y.js} +93 -63
- package/dist/chunks/{api-DqpfkZWL.js → api-Dxl_CKw-.js} +202 -193
- package/dist/chunks/{api-sPqGbOww.js → api-ghNr2uxX.js} +15 -9
- package/dist/chunks/{async-nPFRNQ06.js → async-2GdXNFCE.js} +18 -1
- package/dist/chunks/{bpoint-Dlq34XH1.js → bpoint-BwtuyN_O.js} +3 -3
- package/dist/chunks/calculations-YEoVCG2q.js +310 -0
- package/dist/chunks/{captcha-eu-CGm8Lbrj.js → captcha-eu-DWLoQFKB.js} +6 -5
- package/dist/chunks/{checkbox-radio-BY2aTCOG.js → checkbox-radio-gsm8QPJg.js} +74 -75
- package/dist/chunks/{combobox-C0EuExSI.js → combobox-Ba08_cHL.js} +340 -328
- package/dist/chunks/conditions-Ceeg6ReZ.js +467 -0
- package/dist/chunks/country-from-ip-DDj_mFki.js +29 -0
- package/dist/chunks/csrf-DxHg_ZYt.js +61 -0
- package/dist/chunks/{custom-google-maps-BsaSirEZ.js → custom-google-maps-C4l2S3GO.js} +9 -3
- package/dist/chunks/{custom-link-CJ1-FjEM.js → custom-link-CLazgKYH.js} +8 -2
- package/dist/chunks/{custom-maps-DYW_pBid.js → custom-maps-DqcAlD0v.js} +10 -4
- package/dist/chunks/{date-picker-F9BUBDSW.js → date-picker-DaPvMrop.js} +467 -443
- package/dist/chunks/{dist-D6i-VNgM.js → dist-ZLeW0zZ3.js} +1281 -453
- package/dist/chunks/{eway-D9_m8ooj.js → eway-uw0DzU-L.js} +5 -5
- package/dist/chunks/field-references.resolver-Ca8MguFv.js +104 -0
- package/dist/chunks/{file-upload-rqfZNqlH.js → file-upload-B8_mH012.js} +119 -99
- package/dist/chunks/friendly-captcha-v1-CVXaXgDO.js +34 -0
- package/dist/chunks/{friendly-captcha-v2-CLSAbkqx.js → friendly-captcha-v2-DkeIVTKI.js} +6 -5
- package/dist/chunks/{friendly-challenge-8uPatWqk.js → friendly-challenge-DPG9MJb1.js} +111 -102
- package/dist/chunks/{go-cardless-DAT3ZaQf.js → go-cardless-c4wLJdOt.js} +2 -2
- package/dist/chunks/google-address-JHYvjwgN.js +168 -0
- package/dist/chunks/{hcaptcha-CGLAmgjO.js → hcaptcha-Dt3ELLlP.js} +4 -4
- package/dist/chunks/{hidden-D7_Ch-QN.js → hidden-BZhXnNPe.js} +8 -2
- package/dist/chunks/http-C2QdHuWO.js +27 -0
- package/dist/chunks/{leaflet-src-j-lHNmhR.js → leaflet-src-DE6rv6M-.js} +42 -46
- package/dist/chunks/{loqate-CJPzBmSm.js → loqate-m51iPyO1.js} +3 -3
- package/dist/chunks/{mollie-Bibhl67p.js → mollie-Bn0PX173.js} +2 -2
- package/dist/chunks/{moneris-H2wSqk9h.js → moneris-BRbUvI4t.js} +3 -3
- package/dist/chunks/opayo-BwWdInEP.js +188 -0
- package/dist/chunks/{paddle-DkvIxQdG.js → paddle-CympHVvd.js} +4 -4
- package/dist/chunks/{password-validation-D06uH9va.js → password-validation-C8_uO_c_.js} +18 -12
- package/dist/chunks/{paypal-CQpAF7Ua.js → paypal-h75h6wae.js} +8 -6
- package/dist/chunks/{payway-CwDkC7YZ.js → payway-C9rHTCC_.js} +4 -4
- package/dist/chunks/{phone-country-D3ayr60L.js → phone-country-B8fv-L5_.js} +80 -63
- package/dist/chunks/{place-kit-BGHklIZ-.js → place-kit-BnZGQ-L1.js} +11 -11
- package/dist/chunks/{placekit-autocomplete.esm-DWVabQlq.js → placekit-autocomplete.esm-CZZERYur.js} +11 -15
- package/dist/chunks/{recaptcha-enterprise-XPId5-bS.js → recaptcha-enterprise-CUs8BO6V.js} +4 -4
- package/dist/chunks/{recaptcha-shared-CLYJvojk.js → recaptcha-shared-DTbTw-MF.js} +2 -2
- package/dist/chunks/{recaptcha-v2-checkbox-Cy-0PEPc.js → recaptcha-v2-checkbox-P1McW4Pv.js} +4 -4
- package/dist/chunks/{recaptcha-v2-invisible-BwRH540O.js → recaptcha-v2-invisible-FGDqozSP.js} +4 -4
- package/dist/chunks/{recaptcha-v3-No4Ykrhk.js → recaptcha-v3-CflUHeZD.js} +4 -4
- package/dist/chunks/{repeater-BVnPUqTj.js → repeater-CyhDbozO.js} +60 -40
- package/dist/chunks/request-profile-DhwkeCpS.js +10 -0
- package/dist/chunks/rich-text-uV4o_pGk.js +361 -0
- package/dist/chunks/{chunk-3b4jIN3o.js → rolldown-runtime-DtPi1Y-2.js} +2 -2
- package/dist/chunks/{scripts-CbQ7agX3.js → scripts-DrccjrFv.js} +1 -1
- package/dist/chunks/{sdk-BhHAYgga.js → sdk-lkwSvlpM.js} +282 -234
- package/dist/chunks/{shared-Bx9s0i0P.js → shared-OKhSay59.js} +27 -21
- package/dist/chunks/{signature-IOhuicje.js → signature-7cldFbqj.js} +138 -112
- package/dist/chunks/skip-CEW89ExY.js +7 -0
- package/dist/chunks/{snaptcha-DKx98oon.js → snaptcha-C3QLYxFT.js} +2 -2
- package/dist/chunks/{square-DwdcOI1G.js → square-C1z5DPVw.js} +9 -7
- package/dist/chunks/{stripe-DaoG2FT1.js → stripe-Dmkdkq1y.js} +11 -12
- package/dist/chunks/{summary-Dks0gXS3.js → summary-Bn-g5SDx.js} +48 -46
- package/dist/chunks/{survey-likert-DkE6bR7B.js → survey-likert-fk1hUPff.js} +7 -1
- package/dist/chunks/{survey-rank-DN6x4IZM.js → survey-rank-BsLGl2LX.js} +37 -25
- package/dist/chunks/{survey-rating-BnsNL9U5.js → survey-rating-DVS6e6fM.js} +17 -5
- package/dist/chunks/{table-CAjCJHrL.js → table-j7MlLLCc.js} +22 -16
- package/dist/chunks/{text-limit-BGaY0jhI.js → text-limit-LGMPhFuC.js} +40 -34
- package/dist/chunks/{theme-classes-Tv7q7ToE.js → theme-classes-DAQuEqdP.js} +1 -1
- package/dist/chunks/{turnstile-DJakPzQD.js → turnstile-ptihQfLl.js} +4 -4
- package/dist/chunks/{upload-manager-W-QDgxKD.js → upload-manager-BW7l-BhF.js} +459 -387
- package/dist/chunks/{utils-Vqp8i_RM.js → utils-DpUBPadZ.js} +20 -14
- package/dist/css/formie-base.css +104 -1
- package/dist/css/theme/_messages.css +2 -0
- package/dist/css/theme/_tokens.css +31 -25
- package/dist/css/theme/forms/_form.css +5 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1779 -1415
- package/dist/js/contracts/client.d.ts +5 -3
- package/dist/js/contracts/client.d.ts.map +1 -1
- package/dist/js/contracts/common.d.ts +2 -2
- package/dist/js/contracts/common.d.ts.map +1 -1
- package/dist/js/contracts/modules.d.ts +37 -12
- package/dist/js/contracts/modules.d.ts.map +1 -1
- package/dist/js/contracts/schema.d.ts +20 -38
- package/dist/js/contracts/schema.d.ts.map +1 -1
- package/dist/js/contracts/theme.d.ts +4 -1
- package/dist/js/contracts/theme.d.ts.map +1 -1
- package/dist/js/core/client-rendered-modules.d.ts +17 -0
- package/dist/js/core/client-rendered-modules.d.ts.map +1 -0
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/field-error-aria.d.ts +23 -0
- package/dist/js/core/field-error-aria.d.ts.map +1 -0
- package/dist/js/core/hydrate-modules.d.ts +10 -8
- package/dist/js/core/hydrate-modules.d.ts.map +1 -1
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts +3 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/core/validation-focus.d.ts.map +1 -1
- package/dist/js/modules/address/address-finder.d.ts +1 -1
- package/dist/js/modules/address/address-finder.d.ts.map +1 -1
- package/dist/js/modules/address/factories.d.ts +3 -3
- package/dist/js/modules/address/factories.d.ts.map +1 -1
- package/dist/js/modules/address/google-address.d.ts +12 -1
- package/dist/js/modules/address/google-address.d.ts.map +1 -1
- package/dist/js/modules/address/index.d.ts +2 -2
- package/dist/js/modules/address/index.d.ts.map +1 -1
- package/dist/js/modules/address/loqate.d.ts +1 -1
- package/dist/js/modules/address/loqate.d.ts.map +1 -1
- package/dist/js/modules/address/place-kit.d.ts +1 -1
- package/dist/js/modules/address/place-kit.d.ts.map +1 -1
- package/dist/js/modules/captchas/captcha-eu.d.ts +1 -1
- package/dist/js/modules/captchas/captcha-eu.d.ts.map +1 -1
- package/dist/js/modules/captchas/factories.d.ts +11 -11
- package/dist/js/modules/captchas/factories.d.ts.map +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v1.d.ts +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v1.d.ts.map +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v2.d.ts +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v2.d.ts.map +1 -1
- package/dist/js/modules/captchas/hcaptcha.d.ts +1 -1
- package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -1
- package/dist/js/modules/captchas/index.d.ts +2 -2
- package/dist/js/modules/captchas/index.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-enterprise.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v3.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
- package/dist/js/modules/captchas/snaptcha.d.ts +1 -1
- package/dist/js/modules/captchas/snaptcha.d.ts.map +1 -1
- package/dist/js/modules/captchas/turnstile.d.ts +1 -1
- package/dist/js/modules/captchas/turnstile.d.ts.map +1 -1
- package/dist/js/modules/fields/address-country.d.ts +2 -2
- package/dist/js/modules/fields/address-country.d.ts.map +1 -1
- package/dist/js/modules/fields/address-state.d.ts +2 -2
- package/dist/js/modules/fields/address-state.d.ts.map +1 -1
- package/dist/js/modules/fields/calculations.d.ts +2 -2
- package/dist/js/modules/fields/calculations.d.ts.map +1 -1
- package/dist/js/modules/fields/checkbox-radio.d.ts +2 -2
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts +2 -2
- package/dist/js/modules/fields/combobox.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/config.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/effects.d.ts +1 -0
- package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/evaluator.d.ts +4 -1
- package/dist/js/modules/fields/conditions/evaluator.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/references.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/submission-context.d.ts +15 -0
- package/dist/js/modules/fields/conditions/submission-context.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/types.d.ts +3 -1
- package/dist/js/modules/fields/conditions/types.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/values.d.ts +1 -1
- package/dist/js/modules/fields/conditions/values.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions.d.ts +2 -2
- package/dist/js/modules/fields/conditions.d.ts.map +1 -1
- package/dist/js/modules/fields/custom-google-maps.d.ts +2 -2
- package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -1
- package/dist/js/modules/fields/custom-link.d.ts +2 -2
- package/dist/js/modules/fields/custom-link.d.ts.map +1 -1
- package/dist/js/modules/fields/custom-maps.d.ts +2 -2
- package/dist/js/modules/fields/custom-maps.d.ts.map +1 -1
- package/dist/js/modules/fields/date-picker.d.ts +2 -2
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts +2 -2
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/hidden.d.ts +2 -2
- package/dist/js/modules/fields/hidden.d.ts.map +1 -1
- package/dist/js/modules/fields/index.d.ts +2 -2
- package/dist/js/modules/fields/index.d.ts.map +1 -1
- package/dist/js/modules/fields/password-validation.d.ts +2 -2
- package/dist/js/modules/fields/password-validation.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts +2 -2
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/modules/fields/repeater.d.ts +2 -2
- package/dist/js/modules/fields/repeater.d.ts.map +1 -1
- package/dist/js/modules/fields/rich-text.d.ts +2 -2
- package/dist/js/modules/fields/rich-text.d.ts.map +1 -1
- package/dist/js/modules/fields/shared.d.ts +1 -0
- package/dist/js/modules/fields/shared.d.ts.map +1 -1
- package/dist/js/modules/fields/signature.d.ts +2 -2
- package/dist/js/modules/fields/signature.d.ts.map +1 -1
- package/dist/js/modules/fields/summary.d.ts +2 -2
- package/dist/js/modules/fields/summary.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-likert.d.ts +2 -2
- package/dist/js/modules/fields/survey-likert.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-rank.d.ts +2 -2
- package/dist/js/modules/fields/survey-rank.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-rating.d.ts +2 -2
- package/dist/js/modules/fields/survey-rating.d.ts.map +1 -1
- package/dist/js/modules/fields/table.d.ts +2 -2
- package/dist/js/modules/fields/table.d.ts.map +1 -1
- package/dist/js/modules/fields/text-limit.d.ts +2 -2
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts +2 -2
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
- package/dist/js/modules/loader.d.ts +10 -4
- package/dist/js/modules/loader.d.ts.map +1 -1
- package/dist/js/modules/payments/bpoint.d.ts +1 -1
- package/dist/js/modules/payments/bpoint.d.ts.map +1 -1
- package/dist/js/modules/payments/eway.d.ts +1 -1
- package/dist/js/modules/payments/eway.d.ts.map +1 -1
- package/dist/js/modules/payments/factories.d.ts +7 -7
- package/dist/js/modules/payments/factories.d.ts.map +1 -1
- package/dist/js/modules/payments/go-cardless.d.ts +1 -1
- package/dist/js/modules/payments/go-cardless.d.ts.map +1 -1
- package/dist/js/modules/payments/index.d.ts +2 -2
- package/dist/js/modules/payments/index.d.ts.map +1 -1
- package/dist/js/modules/payments/mollie.d.ts +1 -1
- package/dist/js/modules/payments/mollie.d.ts.map +1 -1
- package/dist/js/modules/payments/moneris.d.ts +1 -1
- package/dist/js/modules/payments/moneris.d.ts.map +1 -1
- package/dist/js/modules/payments/opayo.d.ts +1 -1
- package/dist/js/modules/payments/opayo.d.ts.map +1 -1
- package/dist/js/modules/payments/paddle.d.ts +1 -1
- package/dist/js/modules/payments/paddle.d.ts.map +1 -1
- package/dist/js/modules/payments/paypal.d.ts +1 -1
- package/dist/js/modules/payments/paypal.d.ts.map +1 -1
- package/dist/js/modules/payments/payway.d.ts +1 -1
- package/dist/js/modules/payments/payway.d.ts.map +1 -1
- package/dist/js/modules/payments/square.d.ts +1 -1
- package/dist/js/modules/payments/square.d.ts.map +1 -1
- package/dist/js/modules/payments/stripe.d.ts +1 -1
- package/dist/js/modules/payments/stripe.d.ts.map +1 -1
- package/dist/js/modules/payments/utils.d.ts +6 -0
- package/dist/js/modules/payments/utils.d.ts.map +1 -1
- package/dist/js/modules/registry.d.ts +6 -4
- package/dist/js/modules/registry.d.ts.map +1 -1
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/theme/browser-theme-state.generated.d.ts +24 -0
- package/dist/js/theme/browser-theme-state.generated.d.ts.map +1 -0
- package/dist/js/theme/theme-classes.d.ts +3 -3
- package/dist/js/theme/theme-classes.d.ts.map +1 -1
- package/dist/js/transport/forms-api.d.ts +5 -3
- package/dist/js/transport/forms-api.d.ts.map +1 -1
- package/dist/js/utils/async.d.ts +1 -0
- package/dist/js/utils/async.d.ts.map +1 -1
- package/dist/js/utils/country-from-ip.d.ts +2 -2
- package/dist/js/utils/country-from-ip.d.ts.map +1 -1
- package/dist/js/utils/csrf.d.ts +17 -0
- package/dist/js/utils/csrf.d.ts.map +1 -0
- package/dist/js/utils/field-references.parser.d.ts +1 -0
- package/dist/js/utils/field-references.parser.d.ts.map +1 -1
- package/dist/js/utils/field-references.resolver.d.ts.map +1 -1
- package/dist/js/utils/field-references.types.d.ts +1 -0
- package/dist/js/utils/field-references.types.d.ts.map +1 -1
- package/dist/js/utils/http.d.ts +3 -1
- package/dist/js/utils/http.d.ts.map +1 -1
- package/dist/js/utils/request-profile.d.ts +4 -0
- package/dist/js/utils/request-profile.d.ts.map +1 -0
- package/dist/js/utils/unload-warning.d.ts.map +1 -1
- package/dist/js/validation/rules/email.d.ts.map +1 -1
- package/dist/js/validation/rules/match.d.ts.map +1 -1
- package/dist/js/validation/rules/number.d.ts.map +1 -1
- package/dist/js/validation/rules/required.d.ts.map +1 -1
- package/dist/js/validation/rules/shared.d.ts.map +1 -1
- package/dist/js/validation/rules/url.d.ts.map +1 -1
- package/dist/js/validation/skip.d.ts +7 -0
- package/dist/js/validation/skip.d.ts.map +1 -0
- package/dist/js/validation/submit-readiness.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +43 -12
- package/src/css/formie-base.css +104 -1
- package/src/css/theme/_messages.css +2 -0
- package/src/css/theme/_tokens.css +31 -25
- package/src/css/theme/forms/_form.css +5 -1
- package/src/index.ts +13 -8
- package/src/js/contracts/client.ts +5 -3
- package/src/js/contracts/common.ts +5 -6
- package/src/js/contracts/modules.ts +41 -12
- package/src/js/contracts/schema.ts +21 -43
- package/src/js/contracts/theme.ts +6 -1
- package/src/js/core/client-rendered-modules.ts +69 -0
- package/src/js/core/create-formie-client.ts +132 -86
- package/src/js/core/field-error-aria.ts +93 -0
- package/src/js/core/hydrate-modules.ts +54 -29
- package/src/js/core/submit-result-state.ts +51 -45
- package/src/js/core/submit-result-ui.ts +25 -68
- package/src/js/core/validation-focus.ts +20 -20
- package/src/js/modules/address/address-finder.ts +1 -1
- package/src/js/modules/address/factories.ts +15 -13
- package/src/js/modules/address/google-address.ts +102 -40
- package/src/js/modules/address/index.ts +2 -2
- package/src/js/modules/address/loqate.ts +1 -1
- package/src/js/modules/address/place-kit.ts +14 -8
- package/src/js/modules/captchas/captcha-eu.ts +2 -2
- package/src/js/modules/captchas/factories.ts +66 -42
- package/src/js/modules/captchas/friendly-captcha-v1.ts +12 -2
- package/src/js/modules/captchas/friendly-captcha-v2.ts +4 -2
- package/src/js/modules/captchas/hcaptcha.ts +5 -5
- package/src/js/modules/captchas/index.ts +2 -2
- package/src/js/modules/captchas/recaptcha-enterprise.ts +2 -2
- package/src/js/modules/captchas/recaptcha-v2-checkbox.ts +3 -3
- package/src/js/modules/captchas/recaptcha-v2-invisible.ts +2 -2
- package/src/js/modules/captchas/recaptcha-v3.ts +2 -2
- package/src/js/modules/captchas/snaptcha.ts +1 -1
- package/src/js/modules/captchas/turnstile.ts +3 -3
- package/src/js/modules/fields/address-country.ts +11 -9
- package/src/js/modules/fields/address-state.ts +94 -35
- package/src/js/modules/fields/calculations.ts +5 -3
- package/src/js/modules/fields/checkbox-radio.ts +24 -42
- package/src/js/modules/fields/combobox.ts +28 -9
- package/src/js/modules/fields/conditions/config.ts +17 -20
- package/src/js/modules/fields/conditions/effects.ts +25 -29
- package/src/js/modules/fields/conditions/evaluator.ts +21 -29
- package/src/js/modules/fields/conditions/references.ts +16 -5
- package/src/js/modules/fields/conditions/submission-context.ts +80 -0
- package/src/js/modules/fields/conditions/types.ts +3 -1
- package/src/js/modules/fields/conditions/values.ts +31 -6
- package/src/js/modules/fields/conditions.ts +65 -18
- package/src/js/modules/fields/custom-google-maps.ts +5 -3
- package/src/js/modules/fields/custom-link.ts +5 -3
- package/src/js/modules/fields/custom-maps.ts +5 -3
- package/src/js/modules/fields/date-picker.ts +40 -7
- package/src/js/modules/fields/file-upload.ts +62 -23
- package/src/js/modules/fields/hidden.ts +5 -3
- package/src/js/modules/fields/index.ts +2 -2
- package/src/js/modules/fields/password-validation.ts +5 -3
- package/src/js/modules/fields/phone-country.ts +35 -8
- package/src/js/modules/fields/repeater.ts +60 -7
- package/src/js/modules/fields/rich-text.ts +20 -4
- package/src/js/modules/fields/shared.ts +13 -0
- package/src/js/modules/fields/signature.ts +24 -4
- package/src/js/modules/fields/summary.ts +8 -20
- package/src/js/modules/fields/survey-likert.ts +5 -3
- package/src/js/modules/fields/survey-rank.ts +21 -3
- package/src/js/modules/fields/survey-rating.ts +17 -3
- package/src/js/modules/fields/table.ts +5 -3
- package/src/js/modules/fields/text-limit.ts +5 -3
- package/src/js/modules/fields/upload-manager.ts +244 -67
- package/src/js/modules/loader.ts +345 -281
- package/src/js/modules/payments/bpoint.ts +2 -2
- package/src/js/modules/payments/eway.ts +2 -2
- package/src/js/modules/payments/factories.ts +53 -52
- package/src/js/modules/payments/go-cardless.ts +1 -1
- package/src/js/modules/payments/index.ts +2 -2
- package/src/js/modules/payments/mollie.ts +1 -1
- package/src/js/modules/payments/moneris.ts +2 -2
- package/src/js/modules/payments/opayo.ts +21 -8
- package/src/js/modules/payments/paddle.ts +10 -6
- package/src/js/modules/payments/payment.ts +22 -18
- package/src/js/modules/payments/paypal.ts +1 -1
- package/src/js/modules/payments/payway.ts +2 -2
- package/src/js/modules/payments/square.ts +2 -2
- package/src/js/modules/payments/stripe.ts +5 -5
- package/src/js/modules/payments/utils.ts +14 -0
- package/src/js/modules/registry.ts +19 -11
- package/src/js/submit/pipeline.ts +10 -11
- package/src/js/theme/browser-theme-state.generated.ts +25 -0
- package/src/js/theme/theme-classes.ts +3 -3
- package/src/js/transport/forms-api.ts +66 -67
- package/src/js/utils/async.ts +34 -0
- package/src/js/utils/country-from-ip.ts +14 -9
- package/src/js/utils/csrf.ts +136 -0
- package/src/js/utils/field-references.parser.ts +13 -113
- package/src/js/utils/field-references.resolver.ts +27 -64
- package/src/js/utils/field-references.row-scope.ts +1 -1
- package/src/js/utils/field-references.types.ts +1 -0
- package/src/js/utils/http.ts +5 -5
- package/src/js/utils/request-profile.ts +10 -0
- package/src/js/utils/unload-warning.ts +12 -4
- package/src/js/validation/rules/email.ts +3 -5
- package/src/js/validation/rules/match.ts +2 -1
- package/src/js/validation/rules/minmax.ts +4 -43
- package/src/js/validation/rules/number.ts +3 -47
- package/src/js/validation/rules/pattern.ts +3 -8
- package/src/js/validation/rules/required.ts +14 -1
- package/src/js/validation/rules/shared.ts +5 -1
- package/src/js/validation/rules/url.ts +3 -10
- package/src/js/validation/skip.ts +9 -0
- package/src/js/validation/submit-readiness.ts +9 -2
- package/src/js/validation/validator.ts +49 -61
- package/dist/chunks/address-state-BwE01m2_.js +0 -344
- package/dist/chunks/calculations-Dv3hYb8_.js +0 -299
- package/dist/chunks/conditions-CPH1snCx.js +0 -424
- package/dist/chunks/country-from-ip-BwxKaBuJ.js +0 -26
- package/dist/chunks/field-references.resolver-CHwn0G0L.js +0 -145
- package/dist/chunks/friendly-captcha-v1-C_2reOXr.js +0 -31
- package/dist/chunks/google-address-BH3Zhi06.js +0 -161
- package/dist/chunks/http-D-JExro7.js +0 -27
- package/dist/chunks/opayo-CR0DtsLa.js +0 -179
- package/dist/chunks/rich-text-Bg_--4TG.js +0 -349
- package/dist/js/modules/fields/conditions/transforms.d.ts +0 -3
- package/dist/js/modules/fields/conditions/transforms.d.ts.map +0 -1
- package/src/js/modules/fields/conditions/transforms.ts +0 -206
- package/src/js/modules/payments/stub-payment-module.ts +0 -87
|
@@ -1,15 +1,6 @@
|
|
|
1
|
+
import { appendDescribedBy, setErrorMessageReference } from '#core/field-error-aria';
|
|
1
2
|
import { addThemeClasses } from '#theme/theme-classes';
|
|
2
|
-
|
|
3
|
-
function appendDescribedBy(input: HTMLElement, describedById: string): void {
|
|
4
|
-
const current = (input.getAttribute('aria-describedby') || '').trim();
|
|
5
|
-
const items = current ? current.split(/\s+/) : [];
|
|
6
|
-
|
|
7
|
-
if (!items.includes(describedById)) {
|
|
8
|
-
items.push(describedById);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
input.setAttribute('aria-describedby', items.join(' ').trim());
|
|
12
|
-
}
|
|
3
|
+
import { isValidationSkipped } from '#validation/skip';
|
|
13
4
|
|
|
14
5
|
function getFirstErroredField(form: HTMLFormElement): HTMLElement | null {
|
|
15
6
|
const fields = Array.from(form.querySelectorAll('[data-formie-field-handle]')) as HTMLElement[];
|
|
@@ -24,15 +15,19 @@ function getFirstErroredField(form: HTMLFormElement): HTMLElement | null {
|
|
|
24
15
|
}
|
|
25
16
|
|
|
26
17
|
function getFieldFocusTarget(field: HTMLElement): HTMLElement | null {
|
|
27
|
-
const invalidControl = field.
|
|
18
|
+
const invalidControl = Array.from(field.querySelectorAll('[aria-invalid="true"]')).find((node) => {
|
|
19
|
+
return !isValidationSkipped(node);
|
|
20
|
+
}) as HTMLElement | undefined;
|
|
28
21
|
|
|
29
22
|
if (invalidControl) {
|
|
30
23
|
return invalidControl;
|
|
31
24
|
}
|
|
32
25
|
|
|
33
|
-
return field.
|
|
26
|
+
return Array.from(field.querySelectorAll(
|
|
34
27
|
'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled])',
|
|
35
|
-
)
|
|
28
|
+
)).find((node) => {
|
|
29
|
+
return !isValidationSkipped(node);
|
|
30
|
+
}) as HTMLElement | undefined ?? null;
|
|
36
31
|
}
|
|
37
32
|
|
|
38
33
|
function getFormLevelErrorTarget(form: HTMLFormElement): HTMLElement | null {
|
|
@@ -54,23 +49,28 @@ export function enhanceServerRenderedFieldErrors(form: HTMLFormElement): void {
|
|
|
54
49
|
field.setAttribute('data-formie-field-has-error', 'true');
|
|
55
50
|
addThemeClasses(field, form, 'fieldLayoutError');
|
|
56
51
|
|
|
57
|
-
const errorContainer = field.querySelector('[data-formie-field-errors]') as HTMLElement | null;
|
|
58
|
-
const errorContainerId = errorContainer?.id || '';
|
|
59
52
|
const primaryError = field.querySelector('[data-formie-field-error]') as HTMLElement | null;
|
|
60
53
|
const primaryErrorId = primaryError?.id || '';
|
|
61
54
|
|
|
62
55
|
field.querySelectorAll('input, select, textarea').forEach((input) => {
|
|
63
56
|
const element = input as HTMLElement;
|
|
57
|
+
|
|
58
|
+
if (isValidationSkipped(element)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
64
62
|
element.setAttribute('aria-invalid', 'true');
|
|
65
63
|
addThemeClasses(element, form, 'fieldControlError');
|
|
66
64
|
element.setAttribute('data-formie-input-has-error', 'true');
|
|
67
65
|
|
|
68
|
-
if (
|
|
69
|
-
|
|
66
|
+
if (primaryErrorId) {
|
|
67
|
+
// Pair aria-errormessage + aria-describedby on the message id (#2946).
|
|
68
|
+
setErrorMessageReference(element, primaryErrorId);
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const instructions = field.querySelector('[data-formie-instructions]') as HTMLElement | null;
|
|
72
|
+
if (instructions?.id) {
|
|
73
|
+
appendDescribedBy(element, instructions.id);
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
});
|
|
@@ -28,7 +28,7 @@ export const addressFinderModule = defineAddressModule<
|
|
|
28
28
|
AddressFinderGlobal,
|
|
29
29
|
AddressFinderWidget
|
|
30
30
|
>({
|
|
31
|
-
|
|
31
|
+
moduleId: 'formie:address-finder',
|
|
32
32
|
load: async () => {
|
|
33
33
|
return loadScriptAndEnsureGlobal<AddressFinderGlobal>('AddressFinder', {
|
|
34
34
|
id: SCRIPT_ID,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
BrowserModuleDefinition,
|
|
3
|
+
BrowserModuleInstance,
|
|
4
4
|
ModuleSetupContext,
|
|
5
5
|
} from '#contracts/modules';
|
|
6
6
|
import {
|
|
@@ -30,7 +30,7 @@ export type ManagedAddressModuleAdapter<
|
|
|
30
30
|
TApi,
|
|
31
31
|
TWidget,
|
|
32
32
|
> = {
|
|
33
|
-
|
|
33
|
+
moduleId: string;
|
|
34
34
|
load: (ctx: AddressModuleSetupContext<TProvider>) => Promise<TApi>;
|
|
35
35
|
mount: (args: {
|
|
36
36
|
api: TApi;
|
|
@@ -61,9 +61,11 @@ export function createManagedAddressModule<
|
|
|
61
61
|
TProvider extends Record<string, unknown>,
|
|
62
62
|
TApi,
|
|
63
63
|
TWidget,
|
|
64
|
-
>(adapter: ManagedAddressModuleAdapter<TProvider, TApi, TWidget>):
|
|
64
|
+
>(adapter: ManagedAddressModuleAdapter<TProvider, TApi, TWidget>): BrowserModuleDefinition {
|
|
65
65
|
return {
|
|
66
|
-
|
|
66
|
+
moduleId: adapter.moduleId,
|
|
67
|
+
version: 2,
|
|
68
|
+
surfaces: ['server-rendered', 'client-rendered', 'cp-edit'],
|
|
67
69
|
kind: 'address',
|
|
68
70
|
match: (ctx) => {
|
|
69
71
|
const input = ctx.target.querySelector('[data-formie-address-autocomplete-input]');
|
|
@@ -71,10 +73,10 @@ export function createManagedAddressModule<
|
|
|
71
73
|
return !!input;
|
|
72
74
|
},
|
|
73
75
|
setup: async (ctx) => {
|
|
74
|
-
const options = normalizeAddressModuleOptions<TProvider>(adapter.
|
|
76
|
+
const options = normalizeAddressModuleOptions<TProvider>(adapter.moduleId.split(':')[1], ctx.options || {});
|
|
75
77
|
const services = createAddressHostServices(ctx);
|
|
76
78
|
debug.log('Setup module.', {
|
|
77
|
-
moduleId: adapter.
|
|
79
|
+
moduleId: adapter.moduleId,
|
|
78
80
|
});
|
|
79
81
|
|
|
80
82
|
const setupCtx: AddressModuleSetupContext<TProvider> = {
|
|
@@ -90,11 +92,11 @@ export function createManagedAddressModule<
|
|
|
90
92
|
|
|
91
93
|
if (!input) {
|
|
92
94
|
console.warn(
|
|
93
|
-
`[formie] Address module "${adapter.
|
|
95
|
+
`[formie] Address module "${adapter.moduleId}" skipped: no autocomplete input found in target. ` +
|
|
94
96
|
'Ensure the Address field has the Auto-Complete subfield enabled.',
|
|
95
97
|
);
|
|
96
98
|
debug.warn('Autocomplete input missing; skipping module.', {
|
|
97
|
-
moduleId: adapter.
|
|
99
|
+
moduleId: adapter.moduleId,
|
|
98
100
|
});
|
|
99
101
|
return {
|
|
100
102
|
destroy: () => { },
|
|
@@ -104,7 +106,7 @@ export function createManagedAddressModule<
|
|
|
104
106
|
const getApi = async(): Promise<TApi> => {
|
|
105
107
|
if (!apiPromise) {
|
|
106
108
|
debug.log('Loading provider API.', {
|
|
107
|
-
moduleId: adapter.
|
|
109
|
+
moduleId: adapter.moduleId,
|
|
108
110
|
});
|
|
109
111
|
apiPromise = adapter.load(setupCtx);
|
|
110
112
|
}
|
|
@@ -126,7 +128,7 @@ export function createManagedAddressModule<
|
|
|
126
128
|
provider: options.provider,
|
|
127
129
|
});
|
|
128
130
|
debug.log('Widget mounted.', {
|
|
129
|
-
moduleId: adapter.
|
|
131
|
+
moduleId: adapter.moduleId,
|
|
130
132
|
});
|
|
131
133
|
};
|
|
132
134
|
|
|
@@ -178,7 +180,7 @@ export function createManagedAddressModule<
|
|
|
178
180
|
return {
|
|
179
181
|
destroy: async () => {
|
|
180
182
|
debug.log('Destroying module.', {
|
|
181
|
-
moduleId: adapter.
|
|
183
|
+
moduleId: adapter.moduleId,
|
|
182
184
|
});
|
|
183
185
|
cleanups.forEach((c) => c());
|
|
184
186
|
|
|
@@ -193,7 +195,7 @@ export function createManagedAddressModule<
|
|
|
193
195
|
provider: options.provider,
|
|
194
196
|
});
|
|
195
197
|
debug.log('Widget unmounted.', {
|
|
196
|
-
moduleId: adapter.
|
|
198
|
+
moduleId: adapter.moduleId,
|
|
197
199
|
});
|
|
198
200
|
}
|
|
199
201
|
},
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { appendFormCsrfToFormData } from '#utils/csrf';
|
|
2
|
+
import { browserRequest } from '@verbb/formie-core';
|
|
3
|
+
import { getFormBrowserRequestOptions } from '#utils/request-profile';
|
|
1
4
|
import { defineAddressModule } from '#modules/address/api';
|
|
2
5
|
import type { AddressHostServices } from '#modules/address/host';
|
|
3
6
|
import { getAddressProviderEventName } from '#utils/event-names';
|
|
@@ -7,6 +10,7 @@ type GoogleMaps = typeof google;
|
|
|
7
10
|
|
|
8
11
|
type GoogleAddressProviderOptions = {
|
|
9
12
|
apiKey?: string;
|
|
13
|
+
geocodeEndpoint?: string;
|
|
10
14
|
options?: Record<string, unknown>;
|
|
11
15
|
countryDefaultValue?: string;
|
|
12
16
|
};
|
|
@@ -26,7 +30,8 @@ async function loadGoogleMapsScript(apiKey: string): Promise<GoogleMaps> {
|
|
|
26
30
|
if (maps?.places?.PlaceAutocompleteElement) {
|
|
27
31
|
return existing as GoogleMaps;
|
|
28
32
|
}
|
|
29
|
-
const imp = maps as
|
|
33
|
+
const imp = maps as
|
|
34
|
+
{ importLibrary?: (name: string) => Promise<unknown> } | undefined;
|
|
30
35
|
if (typeof imp?.importLibrary === 'function') {
|
|
31
36
|
await imp.importLibrary('places');
|
|
32
37
|
}
|
|
@@ -40,7 +45,8 @@ async function loadGoogleMapsScript(apiKey: string): Promise<GoogleMaps> {
|
|
|
40
45
|
const existingScript = document.getElementById(SCRIPT_ID);
|
|
41
46
|
if (existingScript) {
|
|
42
47
|
const google = await ensureGlobal<GoogleMaps>('google', 10000);
|
|
43
|
-
const maps = google?.maps as
|
|
48
|
+
const maps = google?.maps as
|
|
49
|
+
{ importLibrary?: (name: string) => Promise<unknown> } | undefined;
|
|
44
50
|
if (typeof maps?.importLibrary === 'function') {
|
|
45
51
|
await maps.importLibrary('places');
|
|
46
52
|
}
|
|
@@ -76,7 +82,8 @@ async function loadGoogleMapsScript(apiKey: string): Promise<GoogleMaps> {
|
|
|
76
82
|
});
|
|
77
83
|
|
|
78
84
|
const google = await ready;
|
|
79
|
-
const maps = google?.maps as
|
|
85
|
+
const maps = google?.maps as
|
|
86
|
+
{ importLibrary?: (name: string) => Promise<unknown> } | undefined;
|
|
80
87
|
if (typeof maps?.importLibrary === 'function') {
|
|
81
88
|
await maps.importLibrary('places');
|
|
82
89
|
}
|
|
@@ -148,7 +155,13 @@ type AddressComponent = {
|
|
|
148
155
|
long_text?: string;
|
|
149
156
|
};
|
|
150
157
|
|
|
151
|
-
|
|
158
|
+
type GooglePostalAddress = {
|
|
159
|
+
addressLines?: unknown[];
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
function parseAddressComponents(
|
|
163
|
+
components: AddressComponent[],
|
|
164
|
+
): Record<string, string> {
|
|
152
165
|
const map = componentMap();
|
|
153
166
|
const out: Record<string, string> = {};
|
|
154
167
|
|
|
@@ -158,10 +171,11 @@ function parseAddressComponents(components: AddressComponent[]): Record<string,
|
|
|
158
171
|
if (!type || !map[type as keyof typeof map]) continue;
|
|
159
172
|
|
|
160
173
|
const fieldKey = map[type as keyof typeof map];
|
|
161
|
-
const val =
|
|
162
|
-
??
|
|
163
|
-
|
|
164
|
-
??
|
|
174
|
+
const val =
|
|
175
|
+
(comp as unknown as Record<string, string>)[fieldKey] ??
|
|
176
|
+
comp.short_text ??
|
|
177
|
+
comp.long_text ??
|
|
178
|
+
'';
|
|
165
179
|
|
|
166
180
|
out[type] = val;
|
|
167
181
|
}
|
|
@@ -169,17 +183,26 @@ function parseAddressComponents(components: AddressComponent[]): Record<string,
|
|
|
169
183
|
return out;
|
|
170
184
|
}
|
|
171
185
|
|
|
172
|
-
function buildAddressFromComponents(
|
|
186
|
+
export function buildAddressFromComponents(
|
|
187
|
+
formData: Record<string, string>,
|
|
188
|
+
postalAddress?: GooglePostalAddress,
|
|
189
|
+
): {
|
|
173
190
|
address1: string;
|
|
174
191
|
city: string;
|
|
175
192
|
state: string;
|
|
176
193
|
zip: string;
|
|
177
194
|
country: string;
|
|
178
195
|
} {
|
|
179
|
-
|
|
196
|
+
const postalAddressLines = postalAddress?.addressLines?.filter(
|
|
197
|
+
(line): line is string =>
|
|
198
|
+
typeof line === 'string' && line.trim() !== '',
|
|
199
|
+
);
|
|
200
|
+
let address1 = postalAddressLines?.join(', ') || '';
|
|
180
201
|
|
|
181
|
-
if (formData.street_number || formData.route) {
|
|
182
|
-
address1 = [formData.street_number, formData.route]
|
|
202
|
+
if (!address1 && (formData.street_number || formData.route)) {
|
|
203
|
+
address1 = [formData.street_number, formData.route]
|
|
204
|
+
.filter(Boolean)
|
|
205
|
+
.join(' ');
|
|
183
206
|
|
|
184
207
|
if (formData.subpremise) {
|
|
185
208
|
address1 = `${formData.subpremise}/${address1}`;
|
|
@@ -199,7 +222,8 @@ function hasCountryRestriction(options: Record<string, unknown>): boolean {
|
|
|
199
222
|
const componentRestrictions = options.componentRestrictions;
|
|
200
223
|
|
|
201
224
|
if (componentRestrictions && typeof componentRestrictions === 'object') {
|
|
202
|
-
const country = (componentRestrictions as { country?: unknown })
|
|
225
|
+
const country = (componentRestrictions as { country?: unknown })
|
|
226
|
+
.country;
|
|
203
227
|
|
|
204
228
|
if (Array.isArray(country) ? country.length > 0 : Boolean(country)) {
|
|
205
229
|
return true;
|
|
@@ -211,7 +235,9 @@ function hasCountryRestriction(options: Record<string, unknown>): boolean {
|
|
|
211
235
|
return Array.isArray(includedRegionCodes) && includedRegionCodes.length > 0;
|
|
212
236
|
}
|
|
213
237
|
|
|
214
|
-
export function buildGoogleAutocompleteOptions(
|
|
238
|
+
export function buildGoogleAutocompleteOptions(
|
|
239
|
+
provider: GoogleAddressProviderOptions,
|
|
240
|
+
): Record<string, unknown> {
|
|
215
241
|
const options = { types: ['geocode'], ...(provider.options || {}) };
|
|
216
242
|
const country = provider.countryDefaultValue?.trim().toLowerCase();
|
|
217
243
|
|
|
@@ -231,7 +257,7 @@ export const googleAddressModule = defineAddressModule<
|
|
|
231
257
|
GoogleMaps,
|
|
232
258
|
google.maps.places.PlaceAutocompleteElement
|
|
233
259
|
>({
|
|
234
|
-
|
|
260
|
+
moduleId: 'formie:google-address',
|
|
235
261
|
load: async ({ options }) => {
|
|
236
262
|
const apiKey = options.provider.apiKey;
|
|
237
263
|
|
|
@@ -243,10 +269,13 @@ export const googleAddressModule = defineAddressModule<
|
|
|
243
269
|
},
|
|
244
270
|
mount: async ({ api, field, services, provider }) => {
|
|
245
271
|
const input = services.input.getAutocomplete();
|
|
246
|
-
const PlaceAutocompleteElement =
|
|
272
|
+
const PlaceAutocompleteElement =
|
|
273
|
+
api?.maps?.places?.PlaceAutocompleteElement;
|
|
247
274
|
|
|
248
275
|
if (!input || typeof PlaceAutocompleteElement !== 'function') {
|
|
249
|
-
console.warn(
|
|
276
|
+
console.warn(
|
|
277
|
+
'[formie] Google Places API not ready; address autocomplete skipped.',
|
|
278
|
+
);
|
|
250
279
|
return null;
|
|
251
280
|
}
|
|
252
281
|
|
|
@@ -299,20 +328,40 @@ export const googleAddressModule = defineAddressModule<
|
|
|
299
328
|
wrapper.appendChild(input);
|
|
300
329
|
|
|
301
330
|
const onSelect = async (ev: Event): Promise<void> => {
|
|
302
|
-
const e = ev as unknown as {
|
|
331
|
+
const e = ev as unknown as {
|
|
332
|
+
placePrediction?: {
|
|
333
|
+
toPlace: () => Promise<{
|
|
334
|
+
addressComponents?: unknown[];
|
|
335
|
+
formattedAddress?: string;
|
|
336
|
+
postalAddress?: GooglePostalAddress;
|
|
337
|
+
fetchFields: (opts: {
|
|
338
|
+
fields: string[];
|
|
339
|
+
}) => Promise<void>;
|
|
340
|
+
}>;
|
|
341
|
+
};
|
|
342
|
+
};
|
|
303
343
|
const pred = e.placePrediction;
|
|
304
344
|
|
|
305
345
|
if (!pred) return;
|
|
306
346
|
|
|
307
347
|
const place = await pred.toPlace();
|
|
308
|
-
await place.fetchFields({
|
|
348
|
+
await place.fetchFields({
|
|
349
|
+
fields: [
|
|
350
|
+
'addressComponents',
|
|
351
|
+
'formattedAddress',
|
|
352
|
+
'postalAddress',
|
|
353
|
+
],
|
|
354
|
+
});
|
|
309
355
|
|
|
310
356
|
if (!place.addressComponents) return;
|
|
311
357
|
|
|
312
358
|
const formData = parseAddressComponents(
|
|
313
359
|
place.addressComponents as AddressComponent[],
|
|
314
360
|
);
|
|
315
|
-
const address = buildAddressFromComponents(
|
|
361
|
+
const address = buildAddressFromComponents(
|
|
362
|
+
formData,
|
|
363
|
+
place.postalAddress,
|
|
364
|
+
);
|
|
316
365
|
|
|
317
366
|
setFieldValues(services, {
|
|
318
367
|
...address,
|
|
@@ -320,46 +369,59 @@ export const googleAddressModule = defineAddressModule<
|
|
|
320
369
|
});
|
|
321
370
|
|
|
322
371
|
field.dispatchEvent(
|
|
323
|
-
new CustomEvent(
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
372
|
+
new CustomEvent(
|
|
373
|
+
getAddressProviderEventName('google', 'populate'),
|
|
374
|
+
{
|
|
375
|
+
bubbles: true,
|
|
376
|
+
detail: {
|
|
377
|
+
addressProvider: 'google',
|
|
378
|
+
place,
|
|
379
|
+
formattedAddress: place.formattedAddress,
|
|
380
|
+
addressComponents: place.addressComponents,
|
|
381
|
+
postalAddress: place.postalAddress,
|
|
382
|
+
},
|
|
330
383
|
},
|
|
331
|
-
|
|
384
|
+
),
|
|
332
385
|
);
|
|
333
386
|
};
|
|
334
387
|
autocomplete.addEventListener('gmp-select', onSelect as EventListener);
|
|
335
388
|
|
|
336
389
|
return autocomplete;
|
|
337
390
|
},
|
|
338
|
-
onCurrentLocation: async (position, { field, services }) => {
|
|
391
|
+
onCurrentLocation: async (position, { field, services, provider }) => {
|
|
339
392
|
const { latitude, longitude } = position.coords;
|
|
340
393
|
const form = services.form;
|
|
341
|
-
const actionUrl =
|
|
342
|
-
|
|
343
|
-
const
|
|
394
|
+
const actionUrl =
|
|
395
|
+
provider.geocodeEndpoint || form?.action || window.location.href;
|
|
396
|
+
const fieldHandle = field
|
|
397
|
+
.getAttribute('data-formie-field-handle')
|
|
398
|
+
?.trim();
|
|
399
|
+
const formHandle = (
|
|
400
|
+
form?.querySelector('[name="handle"]') as HTMLInputElement | null
|
|
401
|
+
)?.value?.trim();
|
|
344
402
|
|
|
345
403
|
if (!formHandle || !fieldHandle) return;
|
|
346
404
|
|
|
347
405
|
try {
|
|
348
406
|
const formData = new FormData();
|
|
407
|
+
if (form) appendFormCsrfToFormData(formData, form);
|
|
349
408
|
formData.append('action', 'formie/address/google-places-geocode');
|
|
350
409
|
formData.append('latlng', `${latitude},${longitude}`);
|
|
351
410
|
formData.append('handle', formHandle);
|
|
352
411
|
formData.append('fieldHandle', fieldHandle);
|
|
353
412
|
|
|
354
|
-
const response = await
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
413
|
+
const response = await browserRequest(
|
|
414
|
+
actionUrl,
|
|
415
|
+
{
|
|
416
|
+
method: 'POST',
|
|
417
|
+
body: formData,
|
|
418
|
+
headers: {
|
|
419
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
420
|
+
Accept: 'application/json',
|
|
421
|
+
},
|
|
361
422
|
},
|
|
362
|
-
|
|
423
|
+
getFormBrowserRequestOptions(form),
|
|
424
|
+
);
|
|
363
425
|
|
|
364
426
|
const data = await response.json();
|
|
365
427
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BrowserModuleDefinition } from '#contracts/modules';
|
|
2
2
|
|
|
3
|
-
export const builtinAddressModuleLoaders: Record<string, () => Promise<
|
|
3
|
+
export const builtinAddressModuleLoaders: Record<string, () => Promise<BrowserModuleDefinition>> = {
|
|
4
4
|
// Address providers stay behind lazy importer entries because their SDKs are
|
|
5
5
|
// optional and often much heavier than the base form client.
|
|
6
6
|
'address-finder': () => import('#modules/address/address-finder').then((m) => m.addressFinderModule),
|
|
@@ -28,7 +28,7 @@ export const placeKitModule = defineAddressModule<
|
|
|
28
28
|
(apiKey: string, options: Record<string, unknown>) => PlaceKitPicker,
|
|
29
29
|
PlaceKitPicker
|
|
30
30
|
>({
|
|
31
|
-
|
|
31
|
+
moduleId: 'formie:place-kit',
|
|
32
32
|
load: async () => {
|
|
33
33
|
const module = await import('@placekit/autocomplete-js');
|
|
34
34
|
|
|
@@ -58,13 +58,6 @@ export const placeKitModule = defineAddressModule<
|
|
|
58
58
|
const picker = api(provider.apiKey, options as { target: HTMLInputElement });
|
|
59
59
|
|
|
60
60
|
picker.on('pick', (value, item: PlaceKitItem) => {
|
|
61
|
-
field.dispatchEvent(
|
|
62
|
-
new CustomEvent(getAddressProviderEventName('place-kit', 'populate'), {
|
|
63
|
-
bubbles: true,
|
|
64
|
-
detail: { addressProvider: 'place-kit', addressComponents: item },
|
|
65
|
-
}),
|
|
66
|
-
);
|
|
67
|
-
|
|
68
61
|
let address1 = '';
|
|
69
62
|
|
|
70
63
|
if (item.street) {
|
|
@@ -87,6 +80,19 @@ export const placeKitModule = defineAddressModule<
|
|
|
87
80
|
services.input.setValue('state', item.administrative || '');
|
|
88
81
|
services.input.setValue('zip', typeof zip === 'string' ? zip : '');
|
|
89
82
|
services.input.setValue('country', countryValue || item.country || '');
|
|
83
|
+
|
|
84
|
+
// Notify dependent state controls after all address values are applied.
|
|
85
|
+
// Keep the provider value available while country options are loading.
|
|
86
|
+
field.dispatchEvent(
|
|
87
|
+
new CustomEvent(getAddressProviderEventName('place-kit', 'populate'), {
|
|
88
|
+
bubbles: true,
|
|
89
|
+
detail: {
|
|
90
|
+
addressProvider: 'place-kit',
|
|
91
|
+
addressComponents: item,
|
|
92
|
+
state: item.administrative || '',
|
|
93
|
+
},
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
90
96
|
});
|
|
91
97
|
|
|
92
98
|
return picker;
|
|
@@ -34,7 +34,7 @@ async function loadCaptchaEuGlobal(options: CaptchaEuProviderOptions): Promise<C
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export const captchaEuModule = defineCaptchaModule<CaptchaEuProviderOptions, CaptchaEuGlobal, HTMLElement>({
|
|
37
|
-
|
|
37
|
+
moduleId: 'formie:captcha-eu',
|
|
38
38
|
defaultPlaceholderSelector: '[data-captcha-eu-placeholder]',
|
|
39
39
|
defaultTokenFieldNames: ['captcha-eu-token'],
|
|
40
40
|
load: ({ options }) => {
|
|
@@ -69,7 +69,7 @@ export const captchaEuModule = defineCaptchaModule<CaptchaEuProviderOptions, Cap
|
|
|
69
69
|
|
|
70
70
|
return container;
|
|
71
71
|
},
|
|
72
|
-
|
|
72
|
+
challenge: async ({ placeholder, services, stageCtx }) => {
|
|
73
73
|
// Captcha.eu solves through its own widget lifecycle and callback. By
|
|
74
74
|
// screen time we only need to wait for the shared transport layer to
|
|
75
75
|
// contain the provider payload.
|