@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.
- package/CHANGELOG.md +57 -0
- package/dist/chunks/{address-country-Rx6GQTND.js → address-country-Dn71jroa.js} +10 -4
- package/dist/chunks/{address-finder-k7_BXaRe.js → address-finder-O49uDRoR.js} +2 -2
- package/dist/chunks/{address-state-BwE01m2_.js → address-state-ByYatUur.js} +154 -143
- package/dist/chunks/{api-DqpfkZWL.js → api-D6kJ7kXZ.js} +183 -179
- package/dist/chunks/{api-BUb6P-xu.js → api-DYYsVIub.js} +77 -47
- package/dist/chunks/{api-sPqGbOww.js → api-ghNr2uxX.js} +15 -9
- package/dist/chunks/{bpoint-Dlq34XH1.js → bpoint-D0RKFM4F.js} +3 -3
- package/dist/chunks/calculations-YEoVCG2q.js +310 -0
- package/dist/chunks/{captcha-eu-CGm8Lbrj.js → captcha-eu-DERJbXnH.js} +5 -4
- package/dist/chunks/{checkbox-radio-BY2aTCOG.js → checkbox-radio-gsm8QPJg.js} +74 -75
- package/dist/chunks/{combobox-C0EuExSI.js → combobox-CWNdx4Fk.js} +290 -279
- package/dist/chunks/conditions-DqNHLTbN.js +464 -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-5CA_-zGb.js → date-picker-RUnevF7l.js} +456 -430
- package/dist/chunks/{dist-BdUy8m_p.js → dist-ZLeW0zZ3.js} +1280 -452
- package/dist/chunks/{eway-D9_m8ooj.js → eway-or6dtjoT.js} +3 -3
- package/dist/chunks/field-references.resolver-Ca8MguFv.js +104 -0
- package/dist/chunks/{file-upload-rqfZNqlH.js → file-upload-Bm-TXyNB.js} +104 -96
- package/dist/chunks/friendly-captcha-v1-GFqCt1Mh.js +34 -0
- package/dist/chunks/{friendly-captcha-v2-CLSAbkqx.js → friendly-captcha-v2-WoW246JG.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-DzJ-0FKg.js} +2 -2
- package/dist/chunks/google-address-C1P1nTDM.js +163 -0
- package/dist/chunks/{hcaptcha-CGLAmgjO.js → hcaptcha-D0T8aIHz.js} +3 -3
- 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-DD1S7PY9.js} +2 -2
- package/dist/chunks/{mollie-Bibhl67p.js → mollie-DG8Ju83x.js} +2 -2
- package/dist/chunks/{moneris-H2wSqk9h.js → moneris-C8m3Fvqu.js} +3 -3
- package/dist/chunks/opayo-B3EvrVxw.js +188 -0
- package/dist/chunks/{paddle-DkvIxQdG.js → paddle-BIYR9Um3.js} +3 -3
- package/dist/chunks/{password-validation-T0vDQPCr.js → password-validation-C8_uO_c_.js} +18 -12
- package/dist/chunks/{paypal-CQpAF7Ua.js → paypal-B_yxIo2d.js} +7 -5
- package/dist/chunks/{payway-CwDkC7YZ.js → payway-CeOzS0sL.js} +3 -3
- package/dist/chunks/{phone-country-D3ayr60L.js → phone-country-bAqje17P.js} +80 -63
- package/dist/chunks/{place-kit-BGHklIZ-.js → place-kit-BE5gi3vo.js} +3 -3
- 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-CruXddZq.js} +4 -4
- package/dist/chunks/{recaptcha-shared-CLYJvojk.js → recaptcha-shared-AQRMDMme.js} +1 -1
- package/dist/chunks/{recaptcha-v2-checkbox-Cy-0PEPc.js → recaptcha-v2-checkbox-CCnJYCnG.js} +4 -4
- package/dist/chunks/{recaptcha-v2-invisible-BwRH540O.js → recaptcha-v2-invisible-BuVqRRYn.js} +4 -4
- package/dist/chunks/{recaptcha-v3-No4Ykrhk.js → recaptcha-v3-CloqhO2A.js} +4 -4
- package/dist/chunks/{repeater-BVnPUqTj.js → repeater-DwE27jI1.js} +25 -19
- 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/{sdk-BhHAYgga.js → sdk-lkwSvlpM.js} +282 -234
- package/dist/chunks/{shared-Bx9s0i0P.js → shared-OKhSay59.js} +27 -21
- package/dist/chunks/{signature-xz4QO7CR.js → signature-7cldFbqj.js} +160 -112
- package/dist/chunks/{snaptcha-DKx98oon.js → snaptcha-C04kNGYQ.js} +2 -2
- package/dist/chunks/{square-DwdcOI1G.js → square-DEzxv9D9.js} +8 -6
- package/dist/chunks/{stripe-DaoG2FT1.js → stripe-CVPQGDz3.js} +10 -11
- package/dist/chunks/{summary-Dks0gXS3.js → summary-BF_8mrXI.js} +47 -45
- 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-DnIBdeKF.js} +21 -15
- package/dist/chunks/{text-limit-Bn18WrPU.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-n9DNyPxi.js} +3 -3
- package/dist/chunks/{upload-manager-W-QDgxKD.js → upload-manager-BbiUosZq.js} +410 -350
- 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/fields/_signature.css +2 -1
- 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 +1778 -1425
- 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.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 +2 -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/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/fields/_signature.css +2 -1
- 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 +119 -73
- 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 +34 -45
- package/src/js/core/submit-result-ui.ts +21 -65
- 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 +10 -6
- 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 +1 -1
- 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 +6 -4
- package/src/js/modules/fields/address-state.ts +20 -12
- 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 +25 -9
- package/src/js/modules/fields/conditions/config.ts +17 -20
- package/src/js/modules/fields/conditions/effects.ts +23 -26
- 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 +59 -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 -4
- package/src/js/modules/fields/file-upload.ts +19 -10
- 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 +33 -6
- package/src/js/modules/fields/repeater.ts +5 -3
- 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 +64 -6
- 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 +190 -49
- 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/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 +2 -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 +35 -59
- package/dist/chunks/calculations-DERi2xaC.js +0 -299
- package/dist/chunks/conditions-65kBcFWW.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,161 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./event-names-BCI2FLD8.js";
|
|
2
|
-
import { t } from "./api-sPqGbOww.js";
|
|
3
|
-
import { n, t as r } from "./scripts-CbQ7agX3.js";
|
|
4
|
-
//#region src/js/modules/address/google-address.ts
|
|
5
|
-
var i = "FORMIE_GOOGLE_ADDRESS_SCRIPT", a = "formieGoogleMapsReady", o = null;
|
|
6
|
-
async function s(e) {
|
|
7
|
-
let t = window, s = t.google;
|
|
8
|
-
if (s != null) {
|
|
9
|
-
let e = s.maps;
|
|
10
|
-
if (e?.places?.PlaceAutocompleteElement) return s;
|
|
11
|
-
let t = e;
|
|
12
|
-
return typeof t?.importLibrary == "function" && await t.importLibrary("places"), s;
|
|
13
|
-
}
|
|
14
|
-
if (o) return o;
|
|
15
|
-
if (document.getElementById(i)) {
|
|
16
|
-
let e = await r("google", 1e4), t = e?.maps;
|
|
17
|
-
return typeof t?.importLibrary == "function" && await t.importLibrary("places"), e;
|
|
18
|
-
}
|
|
19
|
-
let c = new URL("https://maps.googleapis.com/maps/api/js");
|
|
20
|
-
c.searchParams.set("key", e), c.searchParams.set("loading", "async"), c.searchParams.set("libraries", "places"), c.searchParams.set("callback", a), o = (async () => {
|
|
21
|
-
let e = new Promise((e, n) => {
|
|
22
|
-
let r = setTimeout(() => {
|
|
23
|
-
t[a] && (delete t[a], n(/* @__PURE__ */ Error("Google Maps API load timeout")));
|
|
24
|
-
}, 15e3);
|
|
25
|
-
t[a] = () => {
|
|
26
|
-
clearTimeout(r), delete t[a], e(t.google);
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
await n({
|
|
30
|
-
id: i,
|
|
31
|
-
src: c.toString(),
|
|
32
|
-
async: !0,
|
|
33
|
-
defer: !0
|
|
34
|
-
});
|
|
35
|
-
let r = await e, o = r?.maps;
|
|
36
|
-
return typeof o?.importLibrary == "function" && await o.importLibrary("places"), r;
|
|
37
|
-
})();
|
|
38
|
-
try {
|
|
39
|
-
return await o;
|
|
40
|
-
} catch (e) {
|
|
41
|
-
throw o = null, e;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function c(e, t) {
|
|
45
|
-
t.formattedAddress && e.input.setValue("autoComplete", t.formattedAddress), t.address1 && e.input.setValue("address1", t.address1), t.city !== void 0 && e.input.setValue("city", t.city), t.state !== void 0 && e.input.setValue("state", t.state), t.zip !== void 0 && e.input.setValue("zip", t.zip), t.country !== void 0 && e.input.setValue("country", t.country);
|
|
46
|
-
}
|
|
47
|
-
function l() {
|
|
48
|
-
return {
|
|
49
|
-
subpremise: "shortText",
|
|
50
|
-
street_number: "shortText",
|
|
51
|
-
route: "longText",
|
|
52
|
-
postal_town: "longText",
|
|
53
|
-
locality: "longText",
|
|
54
|
-
administrative_area_level_1: "shortText",
|
|
55
|
-
country: "shortText",
|
|
56
|
-
postal_code: "shortText"
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function u(e) {
|
|
60
|
-
let t = l(), n = {};
|
|
61
|
-
for (let r of e) {
|
|
62
|
-
let e = r.types?.[0];
|
|
63
|
-
!e || !t[e] || (n[e] = r[t[e]] ?? r.short_text ?? r.long_text ?? "");
|
|
64
|
-
}
|
|
65
|
-
return n;
|
|
66
|
-
}
|
|
67
|
-
function d(e) {
|
|
68
|
-
let t = "";
|
|
69
|
-
return (e.street_number || e.route) && (t = [e.street_number, e.route].filter(Boolean).join(" "), e.subpremise && (t = `${e.subpremise}/${t}`)), {
|
|
70
|
-
address1: t,
|
|
71
|
-
city: e.locality || e.postal_town || "",
|
|
72
|
-
state: e.administrative_area_level_1 || "",
|
|
73
|
-
zip: e.postal_code || "",
|
|
74
|
-
country: e.country || ""
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function f(e) {
|
|
78
|
-
let t = e.componentRestrictions;
|
|
79
|
-
if (t && typeof t == "object") {
|
|
80
|
-
let e = t.country;
|
|
81
|
-
if (Array.isArray(e) ? e.length > 0 : e) return !0;
|
|
82
|
-
}
|
|
83
|
-
let n = e.includedRegionCodes;
|
|
84
|
-
return Array.isArray(n) && n.length > 0;
|
|
85
|
-
}
|
|
86
|
-
function p(e) {
|
|
87
|
-
let t = {
|
|
88
|
-
types: ["geocode"],
|
|
89
|
-
...e.options || {}
|
|
90
|
-
}, n = e.countryDefaultValue?.trim().toLowerCase();
|
|
91
|
-
return !n || f(t) ? t : {
|
|
92
|
-
...t,
|
|
93
|
-
componentRestrictions: { country: n },
|
|
94
|
-
includedRegionCodes: [n.toUpperCase()]
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
var m = t({
|
|
98
|
-
id: "google-address",
|
|
99
|
-
load: async ({ options: e }) => {
|
|
100
|
-
let t = e.provider.apiKey;
|
|
101
|
-
if (!t) throw Error("Google Places API key is required");
|
|
102
|
-
return s(t);
|
|
103
|
-
},
|
|
104
|
-
mount: async ({ api: t, field: n, services: r, provider: i }) => {
|
|
105
|
-
let a = r.input.getAutocomplete(), o = t?.maps?.places?.PlaceAutocompleteElement;
|
|
106
|
-
if (!a || typeof o != "function") return console.warn("[formie] Google Places API not ready; address autocomplete skipped."), null;
|
|
107
|
-
let s = new o(p(i)), l = window.getComputedStyle(a).height;
|
|
108
|
-
s.style.height = l, s.style.boxSizing = "border-box";
|
|
109
|
-
let f = a.parentElement;
|
|
110
|
-
f?.classList.contains("formie-autocomplete-wrapper") || (f = document.createElement("div"), f.classList.add("formie-autocomplete-wrapper"), a.parentNode?.insertBefore(f, a), f.appendChild(a));
|
|
111
|
-
let m = a.value;
|
|
112
|
-
if (m) {
|
|
113
|
-
let e = document.createElement("div");
|
|
114
|
-
e.classList.add("formie-autocomplete-placeholder"), e.textContent = m, f.style.position = "relative", e.style.cssText = `
|
|
115
|
-
position: absolute; left: 0; top: 0; height: ${l};
|
|
116
|
-
line-height: ${l}; width: 100%; padding: 0 2.5rem;
|
|
117
|
-
pointer-events: none; color: #6B7280; font-size: 14px; z-index: 1;
|
|
118
|
-
`, f.appendChild(e), s.addEventListener("focusin", () => {
|
|
119
|
-
e.style.display = "none";
|
|
120
|
-
}), s.addEventListener("focusout", () => {
|
|
121
|
-
a.value && (e.style.display = "");
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
return f.replaceChild(s, a), a.type = "hidden", a.name = a.getAttribute("name") || "", f.appendChild(a), s.addEventListener("gmp-select", async (t) => {
|
|
125
|
-
let i = t.placePrediction;
|
|
126
|
-
if (!i) return;
|
|
127
|
-
let a = await i.toPlace();
|
|
128
|
-
await a.fetchFields({ fields: ["addressComponents", "formattedAddress"] }), a.addressComponents && (c(r, {
|
|
129
|
-
...d(u(a.addressComponents)),
|
|
130
|
-
formattedAddress: a.formattedAddress
|
|
131
|
-
}), n.dispatchEvent(new CustomEvent(e("google", "populate"), {
|
|
132
|
-
bubbles: !0,
|
|
133
|
-
detail: {
|
|
134
|
-
addressProvider: "google",
|
|
135
|
-
place: a,
|
|
136
|
-
formattedAddress: a.formattedAddress,
|
|
137
|
-
addressComponents: a.addressComponents
|
|
138
|
-
}
|
|
139
|
-
})));
|
|
140
|
-
}), s;
|
|
141
|
-
},
|
|
142
|
-
onCurrentLocation: async (e, { field: t, services: n }) => {
|
|
143
|
-
let { latitude: r, longitude: i } = e.coords, a = n.form, o = a?.action || window.location.href, s = t.getAttribute("data-formie-field-handle")?.trim(), l = (a?.querySelector("[name=\"handle\"]"))?.value?.trim();
|
|
144
|
-
if (!(!l || !s)) try {
|
|
145
|
-
let e = new FormData();
|
|
146
|
-
e.append("action", "formie/address/google-places-geocode"), e.append("latlng", `${r},${i}`), e.append("handle", l), e.append("fieldHandle", s);
|
|
147
|
-
let t = await (await fetch(o, {
|
|
148
|
-
method: "POST",
|
|
149
|
-
body: e,
|
|
150
|
-
credentials: "include",
|
|
151
|
-
headers: {
|
|
152
|
-
"X-Requested-With": "XMLHttpRequest",
|
|
153
|
-
Accept: "application/json"
|
|
154
|
-
}
|
|
155
|
-
})).json();
|
|
156
|
-
t?.results?.[0]?.address_components && c(n, d(u(t.results[0].address_components)));
|
|
157
|
-
} catch {}
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
//#endregion
|
|
161
|
-
export { m as googleAddressModule };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region src/js/utils/http.ts
|
|
2
|
-
async function e(e, t = {}) {
|
|
3
|
-
let n = {
|
|
4
|
-
Accept: "application/json",
|
|
5
|
-
...t.headers || {}
|
|
6
|
-
};
|
|
7
|
-
return delete n["X-Requested-With"], delete n["x-requested-with"], fetch(String(e), {
|
|
8
|
-
method: t.method || "GET",
|
|
9
|
-
body: t.body ?? null,
|
|
10
|
-
signal: t.signal,
|
|
11
|
-
cache: "no-store",
|
|
12
|
-
headers: n,
|
|
13
|
-
credentials: "same-origin"
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
async function t(t, n = {}) {
|
|
17
|
-
let r = await e(t, n);
|
|
18
|
-
if (!r.ok) throw Error(`Request failed (${r.status}) for ${String(t)}`);
|
|
19
|
-
return r.json();
|
|
20
|
-
}
|
|
21
|
-
async function n(t, n = {}) {
|
|
22
|
-
let r = await e(t, n);
|
|
23
|
-
if (!r.ok) throw Error(`Request failed (${r.status}) for ${String(t)}`);
|
|
24
|
-
return r.text();
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { n, t };
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { s as e } from "./event-names-BCI2FLD8.js";
|
|
2
|
-
import { t } from "./api-DqpfkZWL.js";
|
|
3
|
-
import { t as n } from "./debug-BV0DvdHx.js";
|
|
4
|
-
import { r } from "./scripts-CbQ7agX3.js";
|
|
5
|
-
import { t as i } from "./styles-BfoIZwJp.js";
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/js/modules/payments/opayo.ts
|
|
8
|
-
i("opayo", ["@layer formie-theme{.formie-opayo-drop-in{box-sizing:border-box;width:100%;min-height:10rem}}"]);
|
|
9
|
-
var a = "FORMIE_OPAYO_SCRIPT", o = "https://live.opayo.eu.elavon.com/api/v1/js/sagepay.js", s = "https://sandbox.opayo.eu.elavon.com/api/v1/js/sagepay.js", c = "[data-formie-opayo-drop-in]", l = n("payments", "opayo"), u = e("opayo", "challenge"), d = "formie:payment:opayo:challenge:response";
|
|
10
|
-
function f(e) {
|
|
11
|
-
return e.checkoutMode === "dropIn";
|
|
12
|
-
}
|
|
13
|
-
async function p(e) {
|
|
14
|
-
let { form: t, handle: n, sessionToken: r, services: i } = e, a = new FormData();
|
|
15
|
-
a.append("action", "formie/payment-webhooks/process-callback"), a.append("merchantSessionKey", "true"), a.append("handle", n), a.append("sessionToken", r);
|
|
16
|
-
try {
|
|
17
|
-
let e = await fetch(t.action, {
|
|
18
|
-
method: "POST",
|
|
19
|
-
body: a
|
|
20
|
-
});
|
|
21
|
-
return e.status < 200 || e.status >= 300 ? (i.addError(`${e.status}: ${e.statusText}`), l.warn("Merchant session request failed.", {
|
|
22
|
-
status: e.status,
|
|
23
|
-
statusText: e.statusText
|
|
24
|
-
}), null) : (await e.json()).merchantSessionKey || (i.addError("Unable to get merchant session."), l.warn("merchantSessionKey missing in callback response."), null);
|
|
25
|
-
} catch {
|
|
26
|
-
return i.addError("Network error. Please try again."), l.warn("Network error requesting merchant session."), null;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function m(e) {
|
|
30
|
-
return e.id ||= `formie-opayo-drop-in-${Math.random().toString(36).slice(2, 9)}`, e.id;
|
|
31
|
-
}
|
|
32
|
-
var h = t({
|
|
33
|
-
id: "opayo",
|
|
34
|
-
defaultRequiredInputSuffixes: ["opayoTokenId"],
|
|
35
|
-
load: async (e) => {
|
|
36
|
-
let { provider: t } = e.options, n = t.useSandbox ? s : o;
|
|
37
|
-
return await r(f(t) ? "sagepayCheckout" : "sagepayOwnForm", {
|
|
38
|
-
id: a,
|
|
39
|
-
src: n,
|
|
40
|
-
timeoutMs: 1e4
|
|
41
|
-
}), null;
|
|
42
|
-
},
|
|
43
|
-
mount: async ({ field: e, services: t, provider: n }) => {
|
|
44
|
-
if (!f(n)) return null;
|
|
45
|
-
let r = t.form, i = window.sagepayCheckout, a = e.querySelector(c);
|
|
46
|
-
if (!r?.action) return t.addError("Form action is missing."), l.warn("Missing form action before drop-in mount."), null;
|
|
47
|
-
if (!i) return t.addError("Opayo script failed to load."), l.warn("sagepayCheckout global not available."), null;
|
|
48
|
-
if (!a) return t.addError("Opayo drop-in container is missing."), l.warn("Drop-in container not found in payment field."), null;
|
|
49
|
-
let o = n.handle || "opayo", s = await p({
|
|
50
|
-
form: r,
|
|
51
|
-
handle: o,
|
|
52
|
-
sessionToken: n.sessionToken || "",
|
|
53
|
-
services: t
|
|
54
|
-
});
|
|
55
|
-
if (!s) return null;
|
|
56
|
-
let u = m(a), d = {
|
|
57
|
-
checkout: null,
|
|
58
|
-
merchantSessionKey: s,
|
|
59
|
-
pendingAuthorize: null,
|
|
60
|
-
retriedTokenise: !1
|
|
61
|
-
};
|
|
62
|
-
return d.checkout = i({
|
|
63
|
-
merchantSessionKey: s,
|
|
64
|
-
containerSelector: `#${u}`,
|
|
65
|
-
onTokenise: (e) => {
|
|
66
|
-
let i = d.pendingAuthorize;
|
|
67
|
-
if (d.pendingAuthorize = null, !i) {
|
|
68
|
-
l.warn("Drop-in tokenisation completed without a pending authorize step.");
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (e.success && e.cardIdentifier) {
|
|
72
|
-
t.updateInputs("opayoTokenId", e.cardIdentifier), t.updateInputs("opayoSessionKey", d.merchantSessionKey), l.log("Drop-in tokenization succeeded.", { hasCardIdentifier: !!e.cardIdentifier }), i(!0);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (!d.retriedTokenise) {
|
|
76
|
-
d.retriedTokenise = !0, p({
|
|
77
|
-
form: r,
|
|
78
|
-
handle: o,
|
|
79
|
-
sessionToken: n.sessionToken || "",
|
|
80
|
-
services: t
|
|
81
|
-
}).then((n) => {
|
|
82
|
-
if (!n) {
|
|
83
|
-
t.addError(e.errors?.[0]?.message || "Tokenization failed."), l.warn("Drop-in tokenization failed after session refresh.", e), i(!1);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
d.merchantSessionKey = n, d.pendingAuthorize = i, d.checkout.tokenise({ newMerchantSessionKey: n });
|
|
87
|
-
});
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
t.addError(e.errors?.[0]?.message || "Tokenization failed."), l.warn("Drop-in tokenization failed.", e), i(!1);
|
|
91
|
-
}
|
|
92
|
-
}), l.log("Drop-in checkout mounted.", { containerId: u }), d;
|
|
93
|
-
},
|
|
94
|
-
unmount: async ({ widget: e }) => {
|
|
95
|
-
e?.checkout?.destroy?.();
|
|
96
|
-
},
|
|
97
|
-
onBeforeAuthorize: async (e) => {
|
|
98
|
-
let { field: t, services: n, options: r, provider: i, widget: a } = e, o = i.handle || "opayo", s = n.form;
|
|
99
|
-
if (!s?.action) return n.addError("Form action is missing."), l.warn("Missing form action before authorize."), !1;
|
|
100
|
-
if (f(i)) return a ? (a.retriedTokenise = !1, new Promise((e) => {
|
|
101
|
-
a.pendingAuthorize = e, a.checkout.tokenise();
|
|
102
|
-
})) : (n.addError("Opayo drop-in checkout is not ready."), l.warn("Drop-in authorize requested before widget mount."), !1);
|
|
103
|
-
let c = window.sagepayOwnForm;
|
|
104
|
-
if (!c) return n.addError("Opayo script failed to load."), l.warn("sagepayOwnForm global not available."), !1;
|
|
105
|
-
let u = t.querySelector("[data-opayo-card=\"cardholder-name\"]")?.value ?? "", d = t.querySelector("[data-opayo-card=\"card-number\"]")?.value ?? "", m = t.querySelector("[data-opayo-card=\"expiry-date\"]")?.value ?? "", h = t.querySelector("[data-opayo-card=\"security-code\"]")?.value ?? "";
|
|
106
|
-
d = d.replace(/[\s/]/g, ""), m = m.replace(/[\s/]/g, "");
|
|
107
|
-
let g = await p({
|
|
108
|
-
form: s,
|
|
109
|
-
handle: o,
|
|
110
|
-
sessionToken: i.sessionToken || "",
|
|
111
|
-
services: n
|
|
112
|
-
});
|
|
113
|
-
return g ? new Promise((e) => {
|
|
114
|
-
c({ merchantSessionKey: g }).tokeniseCardDetails({
|
|
115
|
-
cardDetails: {
|
|
116
|
-
cardholderName: u,
|
|
117
|
-
cardNumber: d,
|
|
118
|
-
expiryDate: m,
|
|
119
|
-
securityCode: h
|
|
120
|
-
},
|
|
121
|
-
onTokenised: (t) => {
|
|
122
|
-
t.success && t.cardIdentifier ? (n.updateInputs("opayoTokenId", t.cardIdentifier), n.updateInputs("opayoSessionKey", g), l.log("Tokenization succeeded.", { hasCardIdentifier: !!t.cardIdentifier }), e(!0)) : (n.addError(t.errors?.[0]?.message || "Tokenization failed."), l.warn("Tokenization failed.", t), e(!1));
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}) : !1;
|
|
126
|
-
},
|
|
127
|
-
setup: async (e) => {
|
|
128
|
-
let { services: t } = e;
|
|
129
|
-
e.target;
|
|
130
|
-
let n = null, r = !1, i = () => {
|
|
131
|
-
n?.parentNode && n.parentNode.removeChild(n), n = null;
|
|
132
|
-
}, a = t.events.onForm(u, ((e) => {
|
|
133
|
-
let a = e.detail?.data;
|
|
134
|
-
if (!a?.acsUrl || !a?.creq) return;
|
|
135
|
-
r = !1, l.log("Received payment challenge event.", {
|
|
136
|
-
hasAcsUrl: !!a.acsUrl,
|
|
137
|
-
hasCreq: !!a.creq
|
|
138
|
-
});
|
|
139
|
-
let o = t.form?.querySelector("input[name*=\"opayoSessionKey\"]")?.value || "", s = document.createElement("div");
|
|
140
|
-
s.className = "formie-modal", s.id = `formie-opayo-dialog-${Math.random().toString(36).slice(2, 9)}`, s.innerHTML = "\n <div class=\"formie-modal-backdrop\" data-dialog-close></div>\n <div class=\"formie-modal-content\">\n <div class=\"formie-loading formie-loading-large\" style=\"--formie-loading-width: 3rem; --formie-loading-height: 3rem; top: 50%; margin-top: -1.5rem;\"></div>\n <iframe width=\"100%\" height=\"100%\" style=\"width: 100%; height: 100%; position: relative; z-index: 1;\"></iframe>\n </div>\n ";
|
|
141
|
-
let c = s.querySelector("iframe"), u = (e) => e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), d = a.returnUrl || a.redirectUrl || "", f = `<form action="${u(a.acsUrl)}" method="post">
|
|
142
|
-
<input type="hidden" name="creq" value="${u(a.creq || "")}" />
|
|
143
|
-
<input type="hidden" name="threeDSSessionData" value="${u(a.threeDSSessionData || "")}" />
|
|
144
|
-
<input type="hidden" name="MD" value="${u(o)}" />
|
|
145
|
-
<input type="hidden" name="TermUrl" value="${u(d)}" />
|
|
146
|
-
<input type="hidden" name="ThreeDSNotificationURL" value="${u(d)}" />
|
|
147
|
-
</form><script>document.forms[0].submit();<\/script>`;
|
|
148
|
-
i(), document.body.appendChild(s), n = s, c?.contentWindow && (c.contentWindow.document.open(), c.contentWindow.document.write(f), c.contentWindow.document.close());
|
|
149
|
-
})), o = (e) => {
|
|
150
|
-
if (e.data?.message === d) {
|
|
151
|
-
if (!n) {
|
|
152
|
-
l.log("Ignoring 3DS response without active dialog.");
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (r) {
|
|
156
|
-
l.warn("Ignoring duplicate 3DS response while processing.");
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (r = !0, l.log("Received payment challenge response message.", e.data?.value), i(), t.removeError(), e.data?.value?.error) {
|
|
160
|
-
t.addError(e.data.value.error.message), t.releaseSubmitLoading(), r = !1;
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
t.updateInputs("opayo3DSComplete", e.data.value?.transactionId ?? ""), t.triggerSubmit();
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
return window.addEventListener("message", o), { destroy: () => {
|
|
167
|
-
a(), window.removeEventListener("message", o), i(), r = !1;
|
|
168
|
-
} };
|
|
169
|
-
},
|
|
170
|
-
onAfterSubmit: async ({ services: e }) => {
|
|
171
|
-
e.updateInputs([
|
|
172
|
-
"opayoTokenId",
|
|
173
|
-
"opayoSessionKey",
|
|
174
|
-
"opayo3DSComplete"
|
|
175
|
-
], "");
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
//#endregion
|
|
179
|
-
export { h as opayoModule };
|