@verbb/formie-browser 1.0.0 → 1.0.2
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 +16 -0
- package/dist/chunks/address-finder-CQW81kY0.js +37 -0
- package/dist/chunks/bpoint-D8OjLmsn.js +26 -0
- package/dist/chunks/calculations-BqZsENCq.js +147 -0
- package/dist/chunks/captcha-eu-DIa6aUWz.js +34 -0
- package/dist/chunks/checkbox-radio-BI-UjgMF.js +136 -0
- package/dist/chunks/conditions-BVl6jTYo.js +433 -0
- package/dist/chunks/date-picker-69TgvErA.js +4994 -0
- package/dist/chunks/eway-1GPxH6DU.js +74 -0
- package/dist/chunks/file-upload-BDZZftgL.js +281 -0
- package/dist/chunks/friendly-captcha-v1-DA2QPKA3.js +33 -0
- package/dist/chunks/friendly-captcha-v2-BorOWiz_.js +38 -0
- package/dist/chunks/go-cardless-DwBgERcA.js +24 -0
- package/dist/chunks/google-address-BcTBncyS.js +162 -0
- package/dist/chunks/hcaptcha-BchdVCqq.js +56 -0
- package/dist/chunks/hidden-D8RqSPt7.js +31 -0
- package/dist/chunks/index-BEsfee-D.js +1839 -0
- package/dist/chunks/index-BP7Unm5Y.js +863 -0
- package/dist/chunks/index-C1ZOKiAi.js +4229 -0
- package/dist/chunks/loqate-nXuTX7In.js +55 -0
- package/dist/chunks/mollie-qdCynQCd.js +24 -0
- package/dist/chunks/moneris-BNEA-laO.js +101 -0
- package/dist/chunks/opayo-BJtXOkuK.js +122 -0
- package/dist/chunks/paddle-D72Pa8kr.js +60 -0
- package/dist/chunks/paypal-Cqt2bned.js +100 -0
- package/dist/chunks/payway-BjCqsc0H.js +56 -0
- package/dist/chunks/phone-country-K9pYAlzM.js +3765 -0
- package/dist/chunks/place-kit-Dg6f_UoM.js +42 -0
- package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +1299 -0
- package/dist/chunks/recaptcha-enterprise--VYAeeqz.js +71 -0
- package/dist/chunks/recaptcha-shared-PSIEEEe1.js +15 -0
- package/dist/chunks/recaptcha-v2-checkbox-atBNe5ml.js +41 -0
- package/dist/chunks/recaptcha-v2-invisible-DnBufNPT.js +59 -0
- package/dist/chunks/recaptcha-v3-CF6O8rDj.js +28 -0
- package/dist/chunks/repeater-CB7Yojvx.js +124 -0
- package/dist/chunks/rich-text-nAV_SQZo.js +304 -0
- package/dist/chunks/scripts-BkAAux0i.js +36 -0
- package/dist/chunks/sdk-3SicTWby.js +1559 -0
- package/dist/chunks/shared-DGqeMvcJ.js +80 -0
- package/dist/chunks/signature-BT6CsQ6n.js +550 -0
- package/dist/chunks/snaptcha-C7qQo02f.js +8 -0
- package/dist/chunks/square-C5AH3trb.js +46 -0
- package/dist/chunks/stripe-EJK0RyUv.js +202 -0
- package/dist/chunks/styles-C3aqgtek.js +21 -0
- package/dist/chunks/summary-DC_ipXCU.js +126 -0
- package/dist/chunks/table-BEAI99qo.js +95 -0
- package/dist/chunks/text-limit-Blgq5G-G.js +135 -0
- package/dist/chunks/turnstile-_uCRwnU-.js +59 -0
- package/dist/chunks/utils-BntI3W4S.js +6149 -0
- package/dist/index.js +39 -3205
- package/package.json +5 -5
- package/src/js/modules/fields/file-upload.ts +1 -1
- package/src/js/modules/fields/repeater.ts +1 -1
- package/src/js/modules/fields/rich-text.ts +2 -2
- package/src/js/modules/fields/signature.ts +1 -1
- package/src/js/modules/fields/summary.ts +1 -1
- package/src/js/modules/fields/table.ts +1 -1
- package/src/js/modules/fields/text-limit.ts +1 -1
- package/src/js/modules/payments/paypal.ts +1 -1
- package/src/js/modules/payments/payway.ts +1 -1
- package/src/js/modules/payments/stripe.ts +1 -1
- package/dist/chunks/address-finder-DfMCiW89.js +0 -47
- package/dist/chunks/api-CbqEMQT5.js +0 -181
- package/dist/chunks/api-DE7LfK-R.js +0 -960
- package/dist/chunks/api-DOfDzYC_.js +0 -538
- package/dist/chunks/async-B3DUf1GZ.js +0 -26
- package/dist/chunks/bpoint-Ciy3yY9Q.js +0 -34
- package/dist/chunks/calculations-CkYAqO_-.js +0 -197
- package/dist/chunks/captcha-eu-DnOWhMwr.js +0 -43
- package/dist/chunks/checkbox-radio-0x7Tc0br.js +0 -197
- package/dist/chunks/chunk-K6L4z4UQ.js +0 -24
- package/dist/chunks/conditions-4fXKhEJS.js +0 -609
- package/dist/chunks/date-picker-B6iZkjHS.js +0 -6204
- package/dist/chunks/debug-KnZeKYBI.js +0 -39
- package/dist/chunks/dist-D09GnXMW.js +0 -2663
- package/dist/chunks/event-names-DamGPtXR.js +0 -51
- package/dist/chunks/eway-DEAYcwT0.js +0 -86
- package/dist/chunks/field-references.keys-BpBZ_quS.js +0 -24
- package/dist/chunks/field-references.resolver-Ba6xhiJC.js +0 -183
- package/dist/chunks/file-upload-Bh63PQSE.js +0 -430
- package/dist/chunks/friendly-captcha-v1-CqO4WVre.js +0 -40
- package/dist/chunks/friendly-captcha-v2-CyykcJcM.js +0 -47
- package/dist/chunks/friendly-challenge-Dg8XkStd.js +0 -1101
- package/dist/chunks/go-cardless-CuND59rR.js +0 -26
- package/dist/chunks/google-address--uR8WDSm.js +0 -208
- package/dist/chunks/hcaptcha-CmaFUesv.js +0 -72
- package/dist/chunks/hidden-CYnZYple.js +0 -36
- package/dist/chunks/http-18nn97DZ.js +0 -29
- package/dist/chunks/i18n-vUh-KGiH.js +0 -55
- package/dist/chunks/loqate-BICNJlVK.js +0 -97
- package/dist/chunks/mollie-DwlsgHZ1.js +0 -26
- package/dist/chunks/moneris-B_IFZFTx.js +0 -159
- package/dist/chunks/opayo-U2x_TOII.js +0 -192
- package/dist/chunks/paddle-BqXFrc79.js +0 -75
- package/dist/chunks/paypal-Cn_DYGDb.js +0 -121
- package/dist/chunks/payway-Rnq796eC.js +0 -75
- package/dist/chunks/phone-country-B6Me4lK0.js +0 -3317
- package/dist/chunks/place-kit-ldUl-u9w.js +0 -56
- package/dist/chunks/placekit-autocomplete.esm-D-lGeaZl.js +0 -1771
- package/dist/chunks/recaptcha-enterprise-DPJNyv1X.js +0 -72
- package/dist/chunks/recaptcha-shared-DTI4qWVR.js +0 -22
- package/dist/chunks/recaptcha-v2-checkbox-zFjpvJ5c.js +0 -49
- package/dist/chunks/recaptcha-v2-invisible-CnYtkNvz.js +0 -62
- package/dist/chunks/recaptcha-v3-EAlWhnkX.js +0 -33
- package/dist/chunks/repeater-CXD1eLSn.js +0 -151
- package/dist/chunks/rich-text-DkmZRhGj.js +0 -442
- package/dist/chunks/scripts-BGD_iU_6.js +0 -41
- package/dist/chunks/sdk-B7u9fTlP.js +0 -2103
- package/dist/chunks/shared-DC6_1u8X.js +0 -85
- package/dist/chunks/signature-E9KyYXS1.js +0 -765
- package/dist/chunks/snaptcha-CCDunGeb.js +0 -8
- package/dist/chunks/square-BLqK51rS.js +0 -61
- package/dist/chunks/stripe-B8gHpZNC.js +0 -273
- package/dist/chunks/styles-BIh6g7V_.js +0 -22
- package/dist/chunks/summary-EcNE0cvg.js +0 -191
- package/dist/chunks/table-yxEDL6kA.js +0 -124
- package/dist/chunks/text-limit-D0H_Ca2c.js +0 -179
- package/dist/chunks/theme-classes-vSHpdCUO.js +0 -59
- package/dist/chunks/turnstile-DP0bdR7T.js +0 -68
- package/dist/chunks/utils-ByrEVYrJ.js +0 -49584
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { s as getPaymentProviderActionEventName } from "./event-names-DamGPtXR.js";
|
|
2
|
-
import { t as definePaymentModule } from "./api-DE7LfK-R.js";
|
|
3
|
-
//#region src/js/modules/payments/go-cardless.ts
|
|
4
|
-
/** Event name from PHP addSubmitData – dispatched on form when backend returns GoCardless redirect URL */
|
|
5
|
-
var REDIRECT_EVENT = getPaymentProviderActionEventName("go-cardless", "redirect");
|
|
6
|
-
var goCardlessModule = definePaymentModule({
|
|
7
|
-
id: "go-cardless",
|
|
8
|
-
defaultRequiredInputSuffixes: [],
|
|
9
|
-
load: async () => null,
|
|
10
|
-
setup: async ({ services, root }) => {
|
|
11
|
-
const handler = (event) => {
|
|
12
|
-
const data = event.detail?.data;
|
|
13
|
-
if (!data?.redirectUrl) {
|
|
14
|
-
services.addError("Missing GoCardless redirect URL.");
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
window.location.href = data.redirectUrl;
|
|
18
|
-
};
|
|
19
|
-
root.addEventListener(REDIRECT_EVENT, handler);
|
|
20
|
-
return { destroy: () => {
|
|
21
|
-
root.removeEventListener(REDIRECT_EVENT, handler);
|
|
22
|
-
} };
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
//#endregion
|
|
26
|
-
export { goCardlessModule };
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { n as getAddressProviderEventName } from "./event-names-DamGPtXR.js";
|
|
2
|
-
import { t as defineAddressModule } from "./api-CbqEMQT5.js";
|
|
3
|
-
import { n as loadExternalScript, t as ensureGlobal } from "./scripts-BGD_iU_6.js";
|
|
4
|
-
//#region src/js/modules/address/google-address.ts
|
|
5
|
-
var SCRIPT_ID = "FORMIE_GOOGLE_ADDRESS_SCRIPT";
|
|
6
|
-
var CALLBACK_NAME = "formieGoogleMapsReady";
|
|
7
|
-
var loadPromise = null;
|
|
8
|
-
/** Load Google Maps with callback; required when using loading=async. */
|
|
9
|
-
async function loadGoogleMapsScript(apiKey) {
|
|
10
|
-
const w = window;
|
|
11
|
-
const existing = w.google;
|
|
12
|
-
if (typeof existing !== "undefined" && existing !== null) {
|
|
13
|
-
const maps = existing.maps;
|
|
14
|
-
if (maps?.places?.PlaceAutocompleteElement) return existing;
|
|
15
|
-
const imp = maps;
|
|
16
|
-
if (typeof imp?.importLibrary === "function") await imp.importLibrary("places");
|
|
17
|
-
return existing;
|
|
18
|
-
}
|
|
19
|
-
if (loadPromise) return loadPromise;
|
|
20
|
-
if (document.getElementById(SCRIPT_ID)) {
|
|
21
|
-
const google = await ensureGlobal("google", 1e4);
|
|
22
|
-
const maps = google?.maps;
|
|
23
|
-
if (typeof maps?.importLibrary === "function") await maps.importLibrary("places");
|
|
24
|
-
return google;
|
|
25
|
-
}
|
|
26
|
-
const url = new URL("https://maps.googleapis.com/maps/api/js");
|
|
27
|
-
url.searchParams.set("key", apiKey);
|
|
28
|
-
url.searchParams.set("loading", "async");
|
|
29
|
-
url.searchParams.set("libraries", "places");
|
|
30
|
-
url.searchParams.set("callback", CALLBACK_NAME);
|
|
31
|
-
loadPromise = (async () => {
|
|
32
|
-
const ready = new Promise((resolve, reject) => {
|
|
33
|
-
const t = setTimeout(() => {
|
|
34
|
-
if (w[CALLBACK_NAME]) {
|
|
35
|
-
delete w[CALLBACK_NAME];
|
|
36
|
-
reject(/* @__PURE__ */ new Error("Google Maps API load timeout"));
|
|
37
|
-
}
|
|
38
|
-
}, 15e3);
|
|
39
|
-
w[CALLBACK_NAME] = () => {
|
|
40
|
-
clearTimeout(t);
|
|
41
|
-
delete w[CALLBACK_NAME];
|
|
42
|
-
resolve(w.google);
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
await loadExternalScript({
|
|
46
|
-
id: SCRIPT_ID,
|
|
47
|
-
src: url.toString(),
|
|
48
|
-
async: true,
|
|
49
|
-
defer: true
|
|
50
|
-
});
|
|
51
|
-
const google = await ready;
|
|
52
|
-
const maps = google?.maps;
|
|
53
|
-
if (typeof maps?.importLibrary === "function") await maps.importLibrary("places");
|
|
54
|
-
return google;
|
|
55
|
-
})();
|
|
56
|
-
try {
|
|
57
|
-
return await loadPromise;
|
|
58
|
-
} catch (e) {
|
|
59
|
-
loadPromise = null;
|
|
60
|
-
throw e;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function setFieldValues(services, data) {
|
|
64
|
-
if (data.formattedAddress) services.input.setValue("autoComplete", data.formattedAddress);
|
|
65
|
-
if (data.address1) services.input.setValue("address1", data.address1);
|
|
66
|
-
if (data.city !== void 0) services.input.setValue("city", data.city);
|
|
67
|
-
if (data.state !== void 0) services.input.setValue("state", data.state);
|
|
68
|
-
if (data.zip !== void 0) services.input.setValue("zip", data.zip);
|
|
69
|
-
if (data.country !== void 0) services.input.setValue("country", data.country);
|
|
70
|
-
}
|
|
71
|
-
function componentMap() {
|
|
72
|
-
return {
|
|
73
|
-
subpremise: "shortText",
|
|
74
|
-
street_number: "shortText",
|
|
75
|
-
route: "longText",
|
|
76
|
-
postal_town: "longText",
|
|
77
|
-
locality: "longText",
|
|
78
|
-
administrative_area_level_1: "shortText",
|
|
79
|
-
country: "shortText",
|
|
80
|
-
postal_code: "shortText"
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function parseAddressComponents(components) {
|
|
84
|
-
const map = componentMap();
|
|
85
|
-
const out = {};
|
|
86
|
-
for (const comp of components) {
|
|
87
|
-
const type = comp.types?.[0];
|
|
88
|
-
if (!type || !map[type]) continue;
|
|
89
|
-
out[type] = comp[map[type]] ?? comp.short_text ?? comp.long_text ?? "";
|
|
90
|
-
}
|
|
91
|
-
return out;
|
|
92
|
-
}
|
|
93
|
-
function buildAddressFromComponents(formData) {
|
|
94
|
-
let address1 = "";
|
|
95
|
-
if (formData.street_number || formData.route) {
|
|
96
|
-
address1 = [formData.street_number, formData.route].filter(Boolean).join(" ");
|
|
97
|
-
if (formData.subpremise) address1 = `${formData.subpremise}/${address1}`;
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
address1,
|
|
101
|
-
city: formData.locality || formData.postal_town || "",
|
|
102
|
-
state: formData.administrative_area_level_1 || "",
|
|
103
|
-
zip: formData.postal_code || "",
|
|
104
|
-
country: formData.country || ""
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
var googleAddressModule = defineAddressModule({
|
|
108
|
-
id: "google-address",
|
|
109
|
-
load: async ({ options }) => {
|
|
110
|
-
const apiKey = options.provider.apiKey;
|
|
111
|
-
if (!apiKey) throw new Error("Google Places API key is required");
|
|
112
|
-
return loadGoogleMapsScript(apiKey);
|
|
113
|
-
},
|
|
114
|
-
mount: async ({ api, field, services, provider }) => {
|
|
115
|
-
const input = services.input.getAutocomplete();
|
|
116
|
-
const PlaceAutocompleteElement = api?.maps?.places?.PlaceAutocompleteElement;
|
|
117
|
-
if (!input || typeof PlaceAutocompleteElement !== "function") {
|
|
118
|
-
console.warn("[formie] Google Places API not ready; address autocomplete skipped.");
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
const autocomplete = new PlaceAutocompleteElement({
|
|
122
|
-
types: ["geocode"],
|
|
123
|
-
...provider.options || {}
|
|
124
|
-
});
|
|
125
|
-
const inputHeight = window.getComputedStyle(input).height;
|
|
126
|
-
autocomplete.style.height = inputHeight;
|
|
127
|
-
autocomplete.style.boxSizing = "border-box";
|
|
128
|
-
let wrapper = input.parentElement;
|
|
129
|
-
if (!wrapper?.classList.contains("formie-autocomplete-wrapper")) {
|
|
130
|
-
wrapper = document.createElement("div");
|
|
131
|
-
wrapper.classList.add("formie-autocomplete-wrapper");
|
|
132
|
-
input.parentNode?.insertBefore(wrapper, input);
|
|
133
|
-
wrapper.appendChild(input);
|
|
134
|
-
}
|
|
135
|
-
const savedValue = input.value;
|
|
136
|
-
if (savedValue) {
|
|
137
|
-
const overlay = document.createElement("div");
|
|
138
|
-
overlay.classList.add("formie-autocomplete-placeholder");
|
|
139
|
-
overlay.textContent = savedValue;
|
|
140
|
-
wrapper.style.position = "relative";
|
|
141
|
-
overlay.style.cssText = `
|
|
142
|
-
position: absolute; left: 0; top: 0; height: ${inputHeight};
|
|
143
|
-
line-height: ${inputHeight}; width: 100%; padding: 0 2.5rem;
|
|
144
|
-
pointer-events: none; color: #6B7280; font-size: 14px; z-index: 1;
|
|
145
|
-
`;
|
|
146
|
-
wrapper.appendChild(overlay);
|
|
147
|
-
autocomplete.addEventListener("focusin", () => {
|
|
148
|
-
overlay.style.display = "none";
|
|
149
|
-
});
|
|
150
|
-
autocomplete.addEventListener("focusout", () => {
|
|
151
|
-
if (input.value) overlay.style.display = "";
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
wrapper.replaceChild(autocomplete, input);
|
|
155
|
-
input.type = "hidden";
|
|
156
|
-
input.name = input.getAttribute("name") || "";
|
|
157
|
-
wrapper.appendChild(input);
|
|
158
|
-
const onSelect = async (ev) => {
|
|
159
|
-
const pred = ev.placePrediction;
|
|
160
|
-
if (!pred) return;
|
|
161
|
-
const place = await pred.toPlace();
|
|
162
|
-
await place.fetchFields({ fields: ["addressComponents", "formattedAddress"] });
|
|
163
|
-
if (!place.addressComponents) return;
|
|
164
|
-
setFieldValues(services, {
|
|
165
|
-
...buildAddressFromComponents(parseAddressComponents(place.addressComponents)),
|
|
166
|
-
formattedAddress: place.formattedAddress
|
|
167
|
-
});
|
|
168
|
-
field.dispatchEvent(new CustomEvent(getAddressProviderEventName("google", "populate"), {
|
|
169
|
-
bubbles: true,
|
|
170
|
-
detail: {
|
|
171
|
-
addressProvider: "google",
|
|
172
|
-
place,
|
|
173
|
-
formattedAddress: place.formattedAddress,
|
|
174
|
-
addressComponents: place.addressComponents
|
|
175
|
-
}
|
|
176
|
-
}));
|
|
177
|
-
};
|
|
178
|
-
autocomplete.addEventListener("gmp-select", onSelect);
|
|
179
|
-
return autocomplete;
|
|
180
|
-
},
|
|
181
|
-
onCurrentLocation: async (position, { field, services }) => {
|
|
182
|
-
const { latitude, longitude } = position.coords;
|
|
183
|
-
const form = services.form;
|
|
184
|
-
const actionUrl = form?.action || window.location.href;
|
|
185
|
-
const fieldHandle = field.getAttribute("data-formie-field-handle")?.trim();
|
|
186
|
-
const formHandle = (form?.querySelector("[name=\"handle\"]"))?.value?.trim();
|
|
187
|
-
if (!formHandle || !fieldHandle) return;
|
|
188
|
-
try {
|
|
189
|
-
const formData = new FormData();
|
|
190
|
-
formData.append("action", "formie/address/google-places-geocode");
|
|
191
|
-
formData.append("latlng", `${latitude},${longitude}`);
|
|
192
|
-
formData.append("handle", formHandle);
|
|
193
|
-
formData.append("fieldHandle", fieldHandle);
|
|
194
|
-
const data = await (await fetch(actionUrl, {
|
|
195
|
-
method: "POST",
|
|
196
|
-
body: formData,
|
|
197
|
-
credentials: "include",
|
|
198
|
-
headers: {
|
|
199
|
-
"X-Requested-With": "XMLHttpRequest",
|
|
200
|
-
Accept: "application/json"
|
|
201
|
-
}
|
|
202
|
-
})).json();
|
|
203
|
-
if (data?.results?.[0]?.address_components) setFieldValues(services, buildAddressFromComponents(parseAddressComponents(data.results[0].address_components)));
|
|
204
|
-
} catch {}
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
//#endregion
|
|
208
|
-
export { googleAddressModule };
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { a as CAPTCHA_PROVIDER_LOAD_TIMEOUT_MS, r as getScriptAttributes, t as defineCaptchaModule } from "./api-DOfDzYC_.js";
|
|
2
|
-
import { n as loadExternalScript, t as ensureGlobal } from "./scripts-BGD_iU_6.js";
|
|
3
|
-
//#region src/js/modules/captchas/hcaptcha.ts
|
|
4
|
-
async function loadHcaptchaGlobal(options) {
|
|
5
|
-
const language = typeof options.language === "string" && options.language.trim() !== "" ? options.language.trim() : "en";
|
|
6
|
-
const { async, defer } = getScriptAttributes(options.loadingMethod);
|
|
7
|
-
const callbackName = "FORMIE_HCAPTCHA_ONLOAD";
|
|
8
|
-
const globalWindow = window;
|
|
9
|
-
const existing = globalWindow.hcaptcha;
|
|
10
|
-
if (existing) return existing;
|
|
11
|
-
const callbackPromise = new Promise((resolve) => {
|
|
12
|
-
globalWindow[callbackName] = () => {
|
|
13
|
-
delete globalWindow[callbackName];
|
|
14
|
-
resolve();
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
await loadExternalScript({
|
|
18
|
-
id: "FORMIE_HCAPTCHA_SCRIPT",
|
|
19
|
-
src: `https://js.hcaptcha.com/1/api.js?recaptchacompat=off&render=explicit&onload=${encodeURIComponent(callbackName)}&hl=${encodeURIComponent(language)}`,
|
|
20
|
-
async,
|
|
21
|
-
defer
|
|
22
|
-
});
|
|
23
|
-
await callbackPromise;
|
|
24
|
-
return ensureGlobal("hcaptcha", CAPTCHA_PROVIDER_LOAD_TIMEOUT_MS);
|
|
25
|
-
}
|
|
26
|
-
var hcaptchaModule = defineCaptchaModule({
|
|
27
|
-
id: "hcaptcha",
|
|
28
|
-
defaultPlaceholderSelector: "[data-hcaptcha-placeholder]",
|
|
29
|
-
defaultTokenFieldNames: ["h-captcha-response"],
|
|
30
|
-
load: ({ options }) => {
|
|
31
|
-
return loadHcaptchaGlobal(options.provider);
|
|
32
|
-
},
|
|
33
|
-
mount: ({ api, container, provider, services }) => {
|
|
34
|
-
return api.render(container, {
|
|
35
|
-
sitekey: provider.siteKey || "",
|
|
36
|
-
theme: provider.theme || "light",
|
|
37
|
-
size: provider.size || "normal",
|
|
38
|
-
callback: (token) => {
|
|
39
|
-
if (typeof token === "string" && token.trim() !== "") services.tokens.write(token.trim());
|
|
40
|
-
services.errors.clear();
|
|
41
|
-
},
|
|
42
|
-
"expired-callback": () => {
|
|
43
|
-
services.tokens.clear();
|
|
44
|
-
services.errors.clear();
|
|
45
|
-
},
|
|
46
|
-
"chalexpired-callback": () => {
|
|
47
|
-
services.tokens.clear();
|
|
48
|
-
services.errors.clear();
|
|
49
|
-
},
|
|
50
|
-
"error-callback": () => {
|
|
51
|
-
services.tokens.clear();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
screen: ({ api, widget, placeholder, services, stageCtx }) => {
|
|
56
|
-
if (services.tokens.has()) return;
|
|
57
|
-
api.execute(widget);
|
|
58
|
-
return services.tokens.wait().then((hasToken) => {
|
|
59
|
-
if (!hasToken) {
|
|
60
|
-
const message = services.errors.getDefaultMessage();
|
|
61
|
-
services.errors.show(message, placeholder);
|
|
62
|
-
stageCtx.abort(message);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
unmount: ({ api, widget, services }) => {
|
|
67
|
-
api.reset(widget);
|
|
68
|
-
services.tokens.clear();
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
//#endregion
|
|
72
|
-
export { hcaptchaModule };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { r as getModuleFieldContainers } from "./shared-DC6_1u8X.js";
|
|
2
|
-
//#region src/js/modules/fields/hidden.ts
|
|
3
|
-
var INPUT_SELECTOR = "input[data-formie-hidden-input]";
|
|
4
|
-
function getCookieValue(name) {
|
|
5
|
-
const cookies = document.cookie ? document.cookie.split("; ") : [];
|
|
6
|
-
for (const cookie of cookies) {
|
|
7
|
-
const parts = cookie.split("=");
|
|
8
|
-
if (decodeURIComponent(parts.shift() || "") === name) return decodeURIComponent(parts.join("="));
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
var hiddenModule = {
|
|
13
|
-
id: "hidden",
|
|
14
|
-
kind: "field",
|
|
15
|
-
match: (ctx) => {
|
|
16
|
-
return !!ctx.target.querySelector(INPUT_SELECTOR);
|
|
17
|
-
},
|
|
18
|
-
setup: async (ctx) => {
|
|
19
|
-
const options = ctx.options || {};
|
|
20
|
-
const cookieValue = options.cookieName ? getCookieValue(options.cookieName) : null;
|
|
21
|
-
const inputs = getModuleFieldContainers(ctx).map((field) => {
|
|
22
|
-
return field.querySelector(INPUT_SELECTOR);
|
|
23
|
-
}).filter((input) => {
|
|
24
|
-
return input instanceof HTMLInputElement;
|
|
25
|
-
});
|
|
26
|
-
if (cookieValue !== null) inputs.forEach((input) => {
|
|
27
|
-
input.value = cookieValue;
|
|
28
|
-
});
|
|
29
|
-
await ctx.emit("formie:module:hidden:init", { count: inputs.length });
|
|
30
|
-
return { destroy: () => {
|
|
31
|
-
ctx.emit("formie:module:hidden:destroy", {});
|
|
32
|
-
} };
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
36
|
-
export { hiddenModule };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region src/js/utils/http.ts
|
|
2
|
-
async function request(url, options = {}) {
|
|
3
|
-
const headers = {
|
|
4
|
-
Accept: "application/json",
|
|
5
|
-
...options.headers || {}
|
|
6
|
-
};
|
|
7
|
-
delete headers["X-Requested-With"];
|
|
8
|
-
delete headers["x-requested-with"];
|
|
9
|
-
return fetch(String(url), {
|
|
10
|
-
method: options.method || "GET",
|
|
11
|
-
body: options.body ?? null,
|
|
12
|
-
signal: options.signal,
|
|
13
|
-
cache: "no-store",
|
|
14
|
-
headers,
|
|
15
|
-
credentials: "same-origin"
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
async function requestJson(url, options = {}) {
|
|
19
|
-
const response = await request(url, options);
|
|
20
|
-
if (!response.ok) throw new Error(`Request failed (${response.status}) for ${String(url)}`);
|
|
21
|
-
return response.json();
|
|
22
|
-
}
|
|
23
|
-
async function requestText(url, options = {}) {
|
|
24
|
-
const response = await request(url, options);
|
|
25
|
-
if (!response.ok) throw new Error(`Request failed (${response.status}) for ${String(url)}`);
|
|
26
|
-
return response.text();
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { requestText as n, requestJson as t };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//#region src/js/utils/i18n.ts
|
|
2
|
-
function getWindowTranslationStore() {
|
|
3
|
-
return window.FormieTranslations || {};
|
|
4
|
-
}
|
|
5
|
-
function hydrateTranslationsFromDom() {
|
|
6
|
-
if (typeof document === "undefined") return;
|
|
7
|
-
const scripts = Array.from(document.querySelectorAll("script[type=\"application/json\"][data-formie-translations]:not([data-formie-translations-loaded=\"true\"])"));
|
|
8
|
-
if (scripts.length === 0) return;
|
|
9
|
-
let nextStore = null;
|
|
10
|
-
for (const script of scripts) {
|
|
11
|
-
script.dataset.formieTranslationsLoaded = "true";
|
|
12
|
-
const payload = script.textContent?.trim();
|
|
13
|
-
if (!payload) continue;
|
|
14
|
-
try {
|
|
15
|
-
const translations = JSON.parse(payload);
|
|
16
|
-
if (!translations || Array.isArray(translations) || typeof translations !== "object") continue;
|
|
17
|
-
nextStore = {
|
|
18
|
-
...nextStore ?? getWindowTranslationStore(),
|
|
19
|
-
...translations
|
|
20
|
-
};
|
|
21
|
-
} catch {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (nextStore) window.FormieTranslations = nextStore;
|
|
26
|
-
}
|
|
27
|
-
function getTranslationStore() {
|
|
28
|
-
hydrateTranslationsFromDom();
|
|
29
|
-
return getWindowTranslationStore();
|
|
30
|
-
}
|
|
31
|
-
function getFormieTranslations() {
|
|
32
|
-
return { ...getTranslationStore() };
|
|
33
|
-
}
|
|
34
|
-
function setFormieTranslations(translations) {
|
|
35
|
-
window.FormieTranslations = { ...translations };
|
|
36
|
-
return getFormieTranslations();
|
|
37
|
-
}
|
|
38
|
-
function mergeFormieTranslations(translations) {
|
|
39
|
-
window.FormieTranslations = {
|
|
40
|
-
...getTranslationStore(),
|
|
41
|
-
...translations
|
|
42
|
-
};
|
|
43
|
-
return getFormieTranslations();
|
|
44
|
-
}
|
|
45
|
-
function t(message, replacements = {}) {
|
|
46
|
-
let output = getTranslationStore()[message] || message;
|
|
47
|
-
output = output.replace(/{([a-zA-Z0-9]+)}/g, (match, key) => {
|
|
48
|
-
if (Object.prototype.hasOwnProperty.call(replacements, key)) return String(replacements[key]);
|
|
49
|
-
return match;
|
|
50
|
-
});
|
|
51
|
-
return output;
|
|
52
|
-
}
|
|
53
|
-
var translate = t;
|
|
54
|
-
//#endregion
|
|
55
|
-
export { translate as a, t as i, mergeFormieTranslations as n, setFormieTranslations as r, getFormieTranslations as t };
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { n as ADDRESS_SELECTORS, t as defineAddressModule } from "./api-CbqEMQT5.js";
|
|
2
|
-
import { r as loadScriptAndEnsureGlobal } from "./scripts-BGD_iU_6.js";
|
|
3
|
-
//#region src/js/modules/address/loqate.ts
|
|
4
|
-
var SCRIPT_ID = "FORMIE_LOQATE_SCRIPT";
|
|
5
|
-
var loqateModule = defineAddressModule({
|
|
6
|
-
id: "loqate",
|
|
7
|
-
load: async () => {
|
|
8
|
-
await loadScriptAndEnsureGlobal("pca", {
|
|
9
|
-
id: SCRIPT_ID,
|
|
10
|
-
src: "https://services.pcapredict.com/js/address-3.91.min.js",
|
|
11
|
-
async: true,
|
|
12
|
-
defer: true
|
|
13
|
-
});
|
|
14
|
-
const link = document.createElement("link");
|
|
15
|
-
link.href = "https://services.pcapredict.com/css/address-3.91.min.css";
|
|
16
|
-
link.rel = "stylesheet";
|
|
17
|
-
link.type = "text/css";
|
|
18
|
-
if (!document.querySelector(`link[href="${link.href}"]`)) document.body.appendChild(link);
|
|
19
|
-
return window.pca;
|
|
20
|
-
},
|
|
21
|
-
mount: ({ api, field, services, provider }) => {
|
|
22
|
-
const namespace = provider.namespace || "";
|
|
23
|
-
const apiKey = provider.apiKey || "";
|
|
24
|
-
if (!apiKey) throw new Error("Loqate API key is required");
|
|
25
|
-
const handleToSelector = {
|
|
26
|
-
autoComplete: ADDRESS_SELECTORS.autoComplete,
|
|
27
|
-
address1: ADDRESS_SELECTORS.address1,
|
|
28
|
-
address2: ADDRESS_SELECTORS.address2,
|
|
29
|
-
address3: ADDRESS_SELECTORS.address3,
|
|
30
|
-
city: ADDRESS_SELECTORS.city,
|
|
31
|
-
state: ADDRESS_SELECTORS.state,
|
|
32
|
-
zip: ADDRESS_SELECTORS.zip,
|
|
33
|
-
country: ADDRESS_SELECTORS.country
|
|
34
|
-
};
|
|
35
|
-
const getLoqateElementRef = (handle) => {
|
|
36
|
-
if (namespace) return `${namespace}[${handle}]`;
|
|
37
|
-
const cssSelector = handleToSelector[handle];
|
|
38
|
-
const el = cssSelector ? field.querySelector(cssSelector) : null;
|
|
39
|
-
if (el?.name) return el.name;
|
|
40
|
-
if (el?.id) return el.id;
|
|
41
|
-
return "";
|
|
42
|
-
};
|
|
43
|
-
const autoCompleteRef = getLoqateElementRef("autoComplete");
|
|
44
|
-
if (!autoCompleteRef) throw new Error("Loqate: could not find autocomplete input within address field");
|
|
45
|
-
const fields = [
|
|
46
|
-
{
|
|
47
|
-
element: autoCompleteRef,
|
|
48
|
-
field: "",
|
|
49
|
-
mode: api.fieldMode.SEARCH
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
element: getLoqateElementRef("address1"),
|
|
53
|
-
field: "Line1",
|
|
54
|
-
mode: api.fieldMode.POPULATE
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
element: getLoqateElementRef("address2"),
|
|
58
|
-
field: "Line2",
|
|
59
|
-
mode: api.fieldMode.POPULATE
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
element: getLoqateElementRef("address3"),
|
|
63
|
-
field: "Line3",
|
|
64
|
-
mode: api.fieldMode.POPULATE
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
element: getLoqateElementRef("city"),
|
|
68
|
-
field: "City",
|
|
69
|
-
mode: api.fieldMode.POPULATE
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
element: getLoqateElementRef("state"),
|
|
73
|
-
field: "Province",
|
|
74
|
-
mode: api.fieldMode.POPULATE
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
element: getLoqateElementRef("zip"),
|
|
78
|
-
field: "PostalCode",
|
|
79
|
-
mode: api.fieldMode.POPULATE
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
element: getLoqateElementRef("country"),
|
|
83
|
-
field: "CountryName",
|
|
84
|
-
mode: api.fieldMode.COUNTRY
|
|
85
|
-
}
|
|
86
|
-
].filter((f) => f.element);
|
|
87
|
-
const control = new api.Address(fields, {
|
|
88
|
-
key: apiKey,
|
|
89
|
-
simulateReactEvents: true,
|
|
90
|
-
...provider.reconfigurableOptions || {}
|
|
91
|
-
});
|
|
92
|
-
if (typeof control.load === "function") control.load();
|
|
93
|
-
return control;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
//#endregion
|
|
97
|
-
export { loqateModule };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { s as getPaymentProviderActionEventName } from "./event-names-DamGPtXR.js";
|
|
2
|
-
import { t as definePaymentModule } from "./api-DE7LfK-R.js";
|
|
3
|
-
//#region src/js/modules/payments/mollie.ts
|
|
4
|
-
/** Event name from PHP addSubmitData – dispatched on form when backend returns Mollie checkout URL */
|
|
5
|
-
var REDIRECT_EVENT = getPaymentProviderActionEventName("mollie", "redirect");
|
|
6
|
-
var mollieModule = definePaymentModule({
|
|
7
|
-
id: "mollie",
|
|
8
|
-
defaultRequiredInputSuffixes: [],
|
|
9
|
-
load: async () => null,
|
|
10
|
-
setup: async ({ services, root }) => {
|
|
11
|
-
const handler = (event) => {
|
|
12
|
-
const data = event.detail?.data;
|
|
13
|
-
if (!data?.checkoutUrl) {
|
|
14
|
-
services.addError("Missing Mollie checkout URL.");
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
window.location.href = data.checkoutUrl;
|
|
18
|
-
};
|
|
19
|
-
root.addEventListener(REDIRECT_EVENT, handler);
|
|
20
|
-
return { destroy: () => {
|
|
21
|
-
root.removeEventListener(REDIRECT_EVENT, handler);
|
|
22
|
-
} };
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
//#endregion
|
|
26
|
-
export { mollieModule };
|