@verbb/formie-browser 1.0.4 → 1.0.5
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 +62 -22
- package/dist/chunks/address-country-Rx6GQTND.js +68 -0
- package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
- package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
- package/dist/chunks/api-CmwLRq_n.js +780 -0
- package/dist/chunks/api-DMK8NSUI.js +407 -0
- package/dist/chunks/api-sPqGbOww.js +125 -0
- package/dist/chunks/async-nPFRNQ06.js +25 -0
- package/dist/chunks/bpoint-DSjqRv63.js +24 -0
- package/dist/chunks/calculations-CgVJcQ2P.js +299 -0
- package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
- package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
- package/dist/chunks/chunk-3b4jIN3o.js +13 -0
- package/dist/chunks/combobox-D-2b42wn.js +1954 -0
- package/dist/chunks/conditions-CZ3FU5QO.js +412 -0
- package/dist/chunks/constants-DVcJAvc5.js +38 -0
- package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
- package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
- package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
- package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
- package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
- package/dist/chunks/debug-BV0DvdHx.js +41 -0
- package/dist/chunks/dist-BF5GU3_9.js +2674 -0
- package/dist/chunks/event-names-BCI2FLD8.js +51 -0
- package/dist/chunks/eway-D3ctTbEk.js +70 -0
- package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
- package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
- package/dist/chunks/file-upload-D49m8-DR.js +287 -0
- package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
- package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
- package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
- package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
- package/dist/chunks/google-address-OhKilPWE.js +161 -0
- package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
- package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
- package/dist/chunks/http-D-JExro7.js +27 -0
- package/dist/chunks/i18n-BY1ds1BL.js +121 -0
- package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
- package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
- package/dist/chunks/mollie-COG-ko2D.js +23 -0
- package/dist/chunks/moneris-CMH8PlRc.js +117 -0
- package/dist/chunks/opayo-D2jsR5vh.js +113 -0
- package/dist/chunks/paddle-DxF88RfC.js +55 -0
- package/dist/chunks/paypal-b5pnwrA2.js +95 -0
- package/dist/chunks/payway-BJYu9DIR.js +55 -0
- package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
- package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
- package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
- package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
- package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
- package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
- package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
- package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
- package/dist/chunks/repeater-B5leVxZU.js +102 -0
- package/dist/chunks/rich-text-Cv8ADyk-.js +349 -0
- package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
- package/dist/chunks/sdk-BhHAYgga.js +1397 -0
- package/dist/chunks/shared-Bx9s0i0P.js +100 -0
- package/dist/chunks/signature-CpgqHCEx.js +463 -0
- package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
- package/dist/chunks/square-BP8RWAKB.js +40 -0
- package/dist/chunks/stripe-MihN63uC.js +184 -0
- package/dist/chunks/styles-BfoIZwJp.js +19 -0
- package/dist/chunks/summary-D3AjxpYN.js +114 -0
- package/dist/chunks/table-C-lkQN6I.js +78 -0
- package/dist/chunks/text-limit-B09elPDB.js +125 -0
- package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
- package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
- package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
- package/dist/css/formie-theme.css +2 -0
- package/dist/css/theme/fields/_address-state.css +94 -0
- package/dist/css/theme/fields/_combobox.css +246 -0
- package/dist/css/theme/fields/_select.css +13 -0
- package/dist/index.js +2447 -39
- package/dist/js/core/create-formie-client.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 +4 -0
- package/dist/js/core/validation-focus.d.ts.map +1 -0
- package/dist/js/modules/address/api.d.ts +1 -0
- package/dist/js/modules/address/api.d.ts.map +1 -1
- package/dist/js/modules/address/constants.d.ts +22 -1
- package/dist/js/modules/address/constants.d.ts.map +1 -1
- package/dist/js/modules/address/host.d.ts +2 -2
- package/dist/js/modules/address/host.d.ts.map +1 -1
- package/dist/js/modules/address/loqate.d.ts.map +1 -1
- package/dist/js/modules/fields/address-country.d.ts +3 -0
- package/dist/js/modules/fields/address-country.d.ts.map +1 -0
- package/dist/js/modules/fields/address-state.d.ts +3 -0
- package/dist/js/modules/fields/address-state.d.ts.map +1 -0
- package/dist/js/modules/fields/calculations.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts +17 -0
- package/dist/js/modules/fields/combobox.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-link.d.ts +3 -0
- package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-maps.d.ts +3 -0
- package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
- package/dist/js/modules/fields/index.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/utils/country-from-ip.d.ts +7 -0
- package/dist/js/utils/country-from-ip.d.ts.map +1 -0
- package/dist/js/utils/field-references.d.ts +1 -0
- package/dist/js/utils/field-references.d.ts.map +1 -1
- package/dist/js/utils/field-references.row-scope.d.ts +11 -0
- package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
- package/package.json +6 -3
- package/src/css/formie-theme.css +2 -0
- package/src/css/theme/fields/_address-state.css +94 -0
- package/src/css/theme/fields/_combobox.css +246 -0
- package/src/css/theme/fields/_select.css +13 -0
- package/src/js/core/create-formie-client.ts +27 -0
- package/src/js/core/submit-result-ui.ts +4 -4
- package/src/js/core/validation-focus.ts +117 -0
- package/src/js/modules/address/api.ts +7 -0
- package/src/js/modules/address/constants.ts +82 -2
- package/src/js/modules/address/host.ts +16 -6
- package/src/js/modules/address/loqate.ts +3 -17
- package/src/js/modules/fields/address-country.ts +156 -0
- package/src/js/modules/fields/address-state.ts +946 -0
- package/src/js/modules/fields/calculations.ts +32 -0
- package/src/js/modules/fields/combobox.ts +188 -0
- package/src/js/modules/fields/custom-google-maps.ts +416 -0
- package/src/js/modules/fields/custom-link.ts +95 -0
- package/src/js/modules/fields/custom-maps.ts +339 -0
- package/src/js/modules/fields/date-picker.ts +96 -3
- package/src/js/modules/fields/index.ts +6 -0
- package/src/js/modules/fields/phone-country.ts +6 -0
- package/src/js/submit/pipeline.ts +11 -1
- package/src/js/utils/country-from-ip.ts +54 -0
- package/src/js/utils/field-references.row-scope.ts +303 -0
- package/src/js/utils/field-references.ts +1 -0
- package/dist/chunks/address-finder-BU4roxT6.js +0 -37
- package/dist/chunks/bpoint-uNg5j6rt.js +0 -26
- package/dist/chunks/calculations-C9t6Zop9.js +0 -147
- package/dist/chunks/captcha-eu-BAPzHNts.js +0 -34
- package/dist/chunks/checkbox-radio-CHeLNVIK.js +0 -141
- package/dist/chunks/conditions-DKxVCsjD.js +0 -459
- package/dist/chunks/date-picker-B3iQ797Z.js +0 -4994
- package/dist/chunks/eway-DCielIML.js +0 -74
- package/dist/chunks/file-upload-DP2TOUYV.js +0 -316
- package/dist/chunks/friendly-captcha-v1-DdlcGiFY.js +0 -33
- package/dist/chunks/friendly-captcha-v2-76w-YnFm.js +0 -38
- package/dist/chunks/go-cardless-rwCkzbNK.js +0 -24
- package/dist/chunks/google-address-BD8IZ86V.js +0 -181
- package/dist/chunks/hcaptcha-BNNTL6uf.js +0 -56
- package/dist/chunks/hidden-CW6Rcf1N.js +0 -31
- package/dist/chunks/index-BEsfee-D.js +0 -1839
- package/dist/chunks/index-BP7Unm5Y.js +0 -863
- package/dist/chunks/index-D6npYxvr.js +0 -4423
- package/dist/chunks/loqate-B-ZNS65B.js +0 -55
- package/dist/chunks/mollie-BDAZ-1X4.js +0 -24
- package/dist/chunks/moneris-B1b0uEtY.js +0 -101
- package/dist/chunks/opayo-CC5hraHo.js +0 -122
- package/dist/chunks/paddle-B4GmrDsq.js +0 -60
- package/dist/chunks/paypal-BFS6XsIS.js +0 -100
- package/dist/chunks/payway-DekoJead.js +0 -56
- package/dist/chunks/phone-country-Cm5YUeXI.js +0 -3765
- package/dist/chunks/place-kit-DizZWV_e.js +0 -42
- package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
- package/dist/chunks/recaptcha-enterprise-BbOvO7JZ.js +0 -71
- package/dist/chunks/recaptcha-shared-Dwg1eVFS.js +0 -15
- package/dist/chunks/recaptcha-v2-checkbox-SY3ti5iQ.js +0 -41
- package/dist/chunks/recaptcha-v2-invisible-DSmQnn6c.js +0 -59
- package/dist/chunks/recaptcha-v3-DNh7YCnR.js +0 -28
- package/dist/chunks/repeater-DM0vuFNQ.js +0 -124
- package/dist/chunks/rich-text-C8aGYp70.js +0 -304
- package/dist/chunks/scripts-CKTFtxPO.js +0 -36
- package/dist/chunks/sdk-3SicTWby.js +0 -1559
- package/dist/chunks/shared--BU5CFoL.js +0 -80
- package/dist/chunks/signature-pFhZfH7d.js +0 -550
- package/dist/chunks/snaptcha-VuOUOaLj.js +0 -8
- package/dist/chunks/square-BR9pvToy.js +0 -46
- package/dist/chunks/stripe-OHUwoV9g.js +0 -202
- package/dist/chunks/styles-C3aqgtek.js +0 -21
- package/dist/chunks/summary-Da7Ktg3N.js +0 -126
- package/dist/chunks/table-C0PmR9bI.js +0 -95
- package/dist/chunks/text-limit-mLEwZDIa.js +0 -144
- package/dist/chunks/turnstile-9tM7q_LK.js +0 -59
- package/dist/chunks/utils-BntI3W4S.js +0 -6149
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { s as e } from "./event-names-BCI2FLD8.js";
|
|
2
|
+
import { t } from "./api-CmwLRq_n.js";
|
|
3
|
+
//#region src/js/modules/payments/go-cardless.ts
|
|
4
|
+
var n = e("go-cardless", "redirect"), r = t({
|
|
5
|
+
id: "go-cardless",
|
|
6
|
+
defaultRequiredInputSuffixes: [],
|
|
7
|
+
load: async () => null,
|
|
8
|
+
setup: async ({ services: e, root: t }) => {
|
|
9
|
+
let r = (t) => {
|
|
10
|
+
let n = t.detail?.data;
|
|
11
|
+
if (!n?.redirectUrl) {
|
|
12
|
+
e.addError("Missing GoCardless redirect URL.");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
window.location.href = n.redirectUrl;
|
|
16
|
+
};
|
|
17
|
+
return t.addEventListener(n, r), { destroy: () => {
|
|
18
|
+
t.removeEventListener(n, r);
|
|
19
|
+
} };
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { r as goCardlessModule };
|
|
@@ -0,0 +1,161 @@
|
|
|
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-6CYSUGKQ.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 };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { a as e, r as t, t as n } from "./api-DMK8NSUI.js";
|
|
2
|
+
import { n as r, t as i } from "./scripts-6CYSUGKQ.js";
|
|
3
|
+
//#region src/js/modules/captchas/hcaptcha.ts
|
|
4
|
+
async function a(n) {
|
|
5
|
+
let a = typeof n.language == "string" && n.language.trim() !== "" ? n.language.trim() : "en", { async: o, defer: s } = t(n.loadingMethod), c = "FORMIE_HCAPTCHA_ONLOAD", l = window, u = l.hcaptcha;
|
|
6
|
+
if (u) return u;
|
|
7
|
+
let d = new Promise((e) => {
|
|
8
|
+
l[c] = () => {
|
|
9
|
+
delete l[c], e();
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
return await r({
|
|
13
|
+
id: "FORMIE_HCAPTCHA_SCRIPT",
|
|
14
|
+
src: `https://js.hcaptcha.com/1/api.js?recaptchacompat=off&render=explicit&onload=FORMIE_HCAPTCHA_ONLOAD&hl=${encodeURIComponent(a)}`,
|
|
15
|
+
async: o,
|
|
16
|
+
defer: s
|
|
17
|
+
}), await d, i("hcaptcha", e);
|
|
18
|
+
}
|
|
19
|
+
var o = n({
|
|
20
|
+
id: "hcaptcha",
|
|
21
|
+
defaultPlaceholderSelector: "[data-hcaptcha-placeholder]",
|
|
22
|
+
defaultTokenFieldNames: ["h-captcha-response"],
|
|
23
|
+
load: ({ options: e }) => a(e.provider),
|
|
24
|
+
mount: ({ api: e, container: t, provider: n, services: r }) => e.render(t, {
|
|
25
|
+
sitekey: n.siteKey || "",
|
|
26
|
+
theme: n.theme || "light",
|
|
27
|
+
size: n.size || "normal",
|
|
28
|
+
callback: (e) => {
|
|
29
|
+
typeof e == "string" && e.trim() !== "" && r.tokens.write(e.trim()), r.errors.clear();
|
|
30
|
+
},
|
|
31
|
+
"expired-callback": () => {
|
|
32
|
+
r.tokens.clear(), r.errors.clear();
|
|
33
|
+
},
|
|
34
|
+
"chalexpired-callback": () => {
|
|
35
|
+
r.tokens.clear(), r.errors.clear();
|
|
36
|
+
},
|
|
37
|
+
"error-callback": () => {
|
|
38
|
+
r.tokens.clear();
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
screen: ({ api: e, widget: t, placeholder: n, services: r, stageCtx: i }) => {
|
|
42
|
+
if (!r.tokens.has()) return e.execute(t), r.tokens.wait().then((e) => {
|
|
43
|
+
if (!e) {
|
|
44
|
+
let e = r.errors.getDefaultMessage();
|
|
45
|
+
r.errors.show(e, n), i.abort(e);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
unmount: ({ api: e, widget: t, services: n }) => {
|
|
50
|
+
e.reset(t), n.tokens.clear();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
//#endregion
|
|
54
|
+
export { o as hcaptchaModule };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { r as e } from "./shared-Bx9s0i0P.js";
|
|
2
|
+
//#region src/js/modules/fields/hidden.ts
|
|
3
|
+
var t = "input[data-formie-hidden-input]";
|
|
4
|
+
function n(e) {
|
|
5
|
+
let t = document.cookie ? document.cookie.split("; ") : [];
|
|
6
|
+
for (let n of t) {
|
|
7
|
+
let t = n.split("=");
|
|
8
|
+
if (decodeURIComponent(t.shift() || "") === e) return decodeURIComponent(t.join("="));
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
var r = {
|
|
13
|
+
id: "hidden",
|
|
14
|
+
kind: "field",
|
|
15
|
+
match: (e) => !!e.target.querySelector(t),
|
|
16
|
+
setup: async (r) => {
|
|
17
|
+
let i = r.options || {}, a = i.cookieName ? n(i.cookieName) : null, o = e(r).map((e) => e.querySelector(t)).filter((e) => e instanceof HTMLInputElement);
|
|
18
|
+
return a !== null && o.forEach((e) => {
|
|
19
|
+
e.value = a;
|
|
20
|
+
}), await r.emit("formie:module:hidden:init", { count: o.length }), { destroy: () => {
|
|
21
|
+
r.emit("formie:module:hidden:destroy", {});
|
|
22
|
+
} };
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { r as hiddenModule };
|
|
@@ -0,0 +1,27 @@
|
|
|
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 };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
//#region src/js/utils/i18n.ts
|
|
2
|
+
function e() {
|
|
3
|
+
return window.FormieTranslations || {};
|
|
4
|
+
}
|
|
5
|
+
function t() {
|
|
6
|
+
if (typeof document > "u") return;
|
|
7
|
+
let t = Array.from(document.querySelectorAll("script[type=\"application/json\"][data-formie-translations]:not([data-formie-translations-loaded=\"true\"])"));
|
|
8
|
+
if (t.length === 0) return;
|
|
9
|
+
let n = null;
|
|
10
|
+
for (let r of t) {
|
|
11
|
+
r.dataset.formieTranslationsLoaded = "true";
|
|
12
|
+
let t = r.textContent?.trim();
|
|
13
|
+
if (t) try {
|
|
14
|
+
let r = JSON.parse(t);
|
|
15
|
+
if (!r || Array.isArray(r) || typeof r != "object") continue;
|
|
16
|
+
n = {
|
|
17
|
+
...n ?? e(),
|
|
18
|
+
...r
|
|
19
|
+
};
|
|
20
|
+
} catch {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
n && (window.FormieTranslations = n);
|
|
25
|
+
}
|
|
26
|
+
function n() {
|
|
27
|
+
return t(), e();
|
|
28
|
+
}
|
|
29
|
+
function r() {
|
|
30
|
+
return { ...n() };
|
|
31
|
+
}
|
|
32
|
+
function i(e) {
|
|
33
|
+
return window.FormieTranslations = { ...e }, r();
|
|
34
|
+
}
|
|
35
|
+
function a(e) {
|
|
36
|
+
return window.FormieTranslations = {
|
|
37
|
+
...n(),
|
|
38
|
+
...e
|
|
39
|
+
}, r();
|
|
40
|
+
}
|
|
41
|
+
function o(e) {
|
|
42
|
+
let t = {}, n = 0;
|
|
43
|
+
for (; n < e.length;) {
|
|
44
|
+
for (; n < e.length && /\s/.test(e[n]);) n++;
|
|
45
|
+
if (n >= e.length) break;
|
|
46
|
+
let r = e.slice(n).match(/^(\w+|=\d+)\{/);
|
|
47
|
+
if (!r) break;
|
|
48
|
+
let i = r[1];
|
|
49
|
+
n += r[0].length;
|
|
50
|
+
let a = 1, o = n;
|
|
51
|
+
for (; n < e.length && a > 0;) e[n] === "{" ? a++ : e[n] === "}" && a--, a > 0 && n++;
|
|
52
|
+
t[i] = e.slice(o, n), n++;
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
}
|
|
56
|
+
function s(e, t) {
|
|
57
|
+
let n = `=${e}`;
|
|
58
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) return t[n];
|
|
59
|
+
if (typeof Intl < "u" && typeof Intl.PluralRules == "function") {
|
|
60
|
+
let n = new Intl.PluralRules().select(e);
|
|
61
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) return t[n];
|
|
62
|
+
}
|
|
63
|
+
if (e === 1 && Object.prototype.hasOwnProperty.call(t, "one")) return t.one;
|
|
64
|
+
if (Object.prototype.hasOwnProperty.call(t, "other")) return t.other;
|
|
65
|
+
let r = Object.keys(t)[0];
|
|
66
|
+
return r ? t[r] : "";
|
|
67
|
+
}
|
|
68
|
+
function c(e, t) {
|
|
69
|
+
let n = e.slice(t).match(/^\{(\w+),\s*plural,\s*/);
|
|
70
|
+
if (!n) return null;
|
|
71
|
+
let r = n[1], i = t + n[0].length, a = i;
|
|
72
|
+
for (; a < e.length;) {
|
|
73
|
+
for (; a < e.length && /\s/.test(e[a]);) a++;
|
|
74
|
+
if (a >= e.length || e[a] === "}") break;
|
|
75
|
+
let t = e.slice(a).match(/^(\w+|=\d+)\{/);
|
|
76
|
+
if (!t) return null;
|
|
77
|
+
a += t[0].length;
|
|
78
|
+
let n = 1;
|
|
79
|
+
for (; a < e.length && n > 0;) e[a] === "{" ? n++ : e[a] === "}" && n--, n > 0 && a++;
|
|
80
|
+
a++;
|
|
81
|
+
}
|
|
82
|
+
return a >= e.length || e[a] !== "}" ? null : {
|
|
83
|
+
param: r,
|
|
84
|
+
body: e.slice(i, a),
|
|
85
|
+
endIndex: a
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function l(e, t) {
|
|
89
|
+
let n = "", r = 0;
|
|
90
|
+
for (; r < e.length;) {
|
|
91
|
+
if (e[r] !== "{") {
|
|
92
|
+
n += e[r], r++;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
let i = c(e, r);
|
|
96
|
+
if (!i) {
|
|
97
|
+
n += e[r], r++;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
let a = t[i.param], l = typeof a == "number" ? a : Number.parseInt(String(a ?? ""), 10) || 0, u = s(l, o(i.body));
|
|
101
|
+
u = u.replace(/#/g, String(l)), n += u, r = i.endIndex + 1;
|
|
102
|
+
}
|
|
103
|
+
return n;
|
|
104
|
+
}
|
|
105
|
+
function u(e, t) {
|
|
106
|
+
return e.replace(/\{(\w+),\s*number\}/g, (e, n) => {
|
|
107
|
+
if (!Object.prototype.hasOwnProperty.call(t, n)) return e;
|
|
108
|
+
let r = t[n];
|
|
109
|
+
return typeof r == "number" ? r.toLocaleString() : String(r);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function d(e, t) {
|
|
113
|
+
return e.replace(/\{(\w+)\}/g, (e, n) => Object.prototype.hasOwnProperty.call(t, n) ? String(t[n]) : e);
|
|
114
|
+
}
|
|
115
|
+
function f(e, t = {}) {
|
|
116
|
+
let r = n()[e] || e;
|
|
117
|
+
return r = l(r, t), r = u(r, t), r = d(r, t), r;
|
|
118
|
+
}
|
|
119
|
+
var p = f;
|
|
120
|
+
//#endregion
|
|
121
|
+
export { p as a, f as i, a as n, i as r, r as t };
|