@verbb/formie-browser 1.0.4 → 1.0.6
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 +76 -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-CeDgB9jt.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-DjZOtHfS.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-BQ4a9hmy.js +2659 -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-D0sb8bmX.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-xz4QO7CR.js +536 -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-DbgEFHLO.js +125 -0
- package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
- package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
- package/dist/chunks/upload-manager-BpqWSHmU.js +2558 -0
- package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
- package/dist/css/formie-theme.css +2 -0
- package/dist/css/theme/_buttons.css +16 -0
- package/dist/css/theme/_tokens.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/css/theme/fields/_signature.css +19 -0
- package/dist/css/theme/fields/_upload-manager.css +279 -0
- package/dist/index.js +2448 -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/modules/fields/signature.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts +3 -0
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -0
- 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 +8 -3
- package/src/css/formie-theme.css +2 -0
- package/src/css/theme/_buttons.css +16 -0
- package/src/css/theme/_tokens.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/css/theme/fields/_signature.css +19 -0
- package/src/css/theme/fields/_upload-manager.css +279 -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 +7 -0
- package/src/js/modules/fields/phone-country.ts +6 -0
- package/src/js/modules/fields/signature.ts +199 -15
- package/src/js/modules/fields/upload-manager.ts +1277 -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/src/vendor.d.ts +1 -1
- 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,407 @@
|
|
|
1
|
+
import { a as e } from "./event-names-BCI2FLD8.js";
|
|
2
|
+
import { t } from "./debug-BV0DvdHx.js";
|
|
3
|
+
import { t as n } from "./theme-classes-Tv7q7ToE.js";
|
|
4
|
+
import { i as r } from "./i18n-BY1ds1BL.js";
|
|
5
|
+
import { n as i, t as a } from "./async-nPFRNQ06.js";
|
|
6
|
+
//#region src/js/modules/captchas/constants.ts
|
|
7
|
+
var o = 2e3, s = 5e3, c = 5e3, l = 12e4;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/js/modules/captchas/utils.ts
|
|
10
|
+
function u(e) {
|
|
11
|
+
let t = String(e || "asyncDefer").toLowerCase();
|
|
12
|
+
return {
|
|
13
|
+
async: t.includes("async"),
|
|
14
|
+
defer: t.includes("defer")
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function d(e, t) {
|
|
18
|
+
let n = Array.from(e.querySelectorAll(`input[name="${t}"], textarea[name="${t}"]`));
|
|
19
|
+
for (let e of n) {
|
|
20
|
+
let t = String(e.value || "").trim();
|
|
21
|
+
if (t !== "") return t;
|
|
22
|
+
}
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
function f(e, t) {
|
|
26
|
+
return t.some((t) => d(e, t) !== "");
|
|
27
|
+
}
|
|
28
|
+
function p(e, t) {
|
|
29
|
+
t.forEach((t) => {
|
|
30
|
+
Array.from(e.querySelectorAll(`input[name="${t}"], textarea[name="${t}"]`)).forEach((e) => {
|
|
31
|
+
e.value = "";
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function m(e, t, { value: n = "", container: r } = {}) {
|
|
36
|
+
let i = e.querySelector(`input[name="${t}"]`);
|
|
37
|
+
return i || (i = document.createElement("input"), i.type = "hidden", i.name = t, (r || (e instanceof HTMLElement ? e : null))?.appendChild(i)), i.value = n, i;
|
|
38
|
+
}
|
|
39
|
+
async function h(e, t, n) {
|
|
40
|
+
if (f(e, t)) return !0;
|
|
41
|
+
let r = Date.now() + Math.max(n, 0);
|
|
42
|
+
for (; Date.now() < r;) if (await i(120), f(e, t)) return !0;
|
|
43
|
+
return !1;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/js/modules/captchas/host.ts
|
|
47
|
+
var g = new Set([
|
|
48
|
+
"handle",
|
|
49
|
+
"placeholderSelector",
|
|
50
|
+
"errorMessage",
|
|
51
|
+
"sessionKey",
|
|
52
|
+
"value"
|
|
53
|
+
]), _ = "[data-formie-captcha-error-container]", v = [
|
|
54
|
+
"formie:page:navigate",
|
|
55
|
+
"formie:page:navigate:after",
|
|
56
|
+
"formie:submit:result"
|
|
57
|
+
];
|
|
58
|
+
function y(e, t, n) {
|
|
59
|
+
return e.addEventListener(t, n), () => {
|
|
60
|
+
e.removeEventListener(t, n);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function b(e, t) {
|
|
64
|
+
return e instanceof HTMLElement && e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
|
|
65
|
+
}
|
|
66
|
+
function x(e) {
|
|
67
|
+
if (!(e instanceof HTMLElement) || !e.isConnected || e.hidden || e.closest("[hidden]") || e.closest("[data-formie-page-hidden]") || e.closest("[aria-hidden=\"true\"]")) return !1;
|
|
68
|
+
let t = window.getComputedStyle(e);
|
|
69
|
+
return t.display !== "none" && t.visibility !== "hidden";
|
|
70
|
+
}
|
|
71
|
+
function S(e, t) {
|
|
72
|
+
let n = b(e, t);
|
|
73
|
+
return n.find((e) => x(e)) || n[0] || null;
|
|
74
|
+
}
|
|
75
|
+
function C(e) {
|
|
76
|
+
e.innerHTML = "";
|
|
77
|
+
let t = document.createElement("div");
|
|
78
|
+
return e.appendChild(t), t;
|
|
79
|
+
}
|
|
80
|
+
function w(e) {
|
|
81
|
+
e?.querySelector(_)?.remove();
|
|
82
|
+
}
|
|
83
|
+
function T(e, t, r) {
|
|
84
|
+
if (!e) return;
|
|
85
|
+
w(e);
|
|
86
|
+
let i = document.createElement("div");
|
|
87
|
+
i.setAttribute("data-formie-captcha-error-container", ""), i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), n(i, r || e, "fieldErrors");
|
|
88
|
+
let a = document.createElement("div");
|
|
89
|
+
a.setAttribute("data-formie-captcha-error", ""), a.setAttribute("role", "alert"), n(a, r || e, "fieldError"), a.textContent = t, i.appendChild(a), e.appendChild(i);
|
|
90
|
+
}
|
|
91
|
+
function E(e) {
|
|
92
|
+
let t = e instanceof CustomEvent ? e.detail : null;
|
|
93
|
+
return !t || typeof t != "object" ? null : t;
|
|
94
|
+
}
|
|
95
|
+
function D(e, t) {
|
|
96
|
+
if (!e?.captchas || typeof e.captchas != "object") return null;
|
|
97
|
+
let n = e.captchas[t];
|
|
98
|
+
return !n || typeof n != "object" ? null : n;
|
|
99
|
+
}
|
|
100
|
+
function O(e, t, n, r) {
|
|
101
|
+
let i = /* @__PURE__ */ new Set(), o = () => {
|
|
102
|
+
let a = b(e, t), o = new Set(a.filter((e) => x(e)));
|
|
103
|
+
a.forEach((e) => {
|
|
104
|
+
o.has(e) && !i.has(e) && (i.add(e), n(e));
|
|
105
|
+
}), Array.from(i).forEach((e) => {
|
|
106
|
+
o.has(e) || (i.delete(e), r(e));
|
|
107
|
+
});
|
|
108
|
+
}, s = a(o, 20), c = new MutationObserver(() => {
|
|
109
|
+
s();
|
|
110
|
+
});
|
|
111
|
+
c.observe(e, {
|
|
112
|
+
childList: !0,
|
|
113
|
+
subtree: !0,
|
|
114
|
+
attributes: !0,
|
|
115
|
+
attributeFilter: [
|
|
116
|
+
"class",
|
|
117
|
+
"style",
|
|
118
|
+
"hidden",
|
|
119
|
+
"aria-hidden",
|
|
120
|
+
"data-formie-page-hidden"
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
let l = [y(window, "resize", () => {
|
|
124
|
+
s();
|
|
125
|
+
}), ...v.map((t) => y(e, t, () => {
|
|
126
|
+
s();
|
|
127
|
+
}))];
|
|
128
|
+
return o(), {
|
|
129
|
+
cleanup: () => {
|
|
130
|
+
c.disconnect(), l.forEach((e) => {
|
|
131
|
+
e();
|
|
132
|
+
}), Array.from(i).forEach((e) => {
|
|
133
|
+
r(e);
|
|
134
|
+
}), i.clear();
|
|
135
|
+
},
|
|
136
|
+
reconcile: s,
|
|
137
|
+
getVisible: () => b(e, t).filter((e) => x(e))
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function k(e, t) {
|
|
141
|
+
return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
|
|
142
|
+
}
|
|
143
|
+
function A(e, t, { defaultPlaceholderSelector: n, defaultTokenFieldNames: i = [], defaultWaitForValueMs: a = o }) {
|
|
144
|
+
let s = t || {}, c = Object.entries(s).reduce((e, [t, n]) => (g.has(t) || (e[t] = n), e), {}), l = i.map(String).filter(Boolean), u = Number(a), d = typeof s.placeholderSelector == "string" && s.placeholderSelector.trim() !== "" ? s.placeholderSelector.trim() : n, f = typeof s.errorMessage == "string" && s.errorMessage.trim() !== "" ? s.errorMessage.trim() : r("Captcha challenge must be completed."), p = typeof s.sessionKey == "string" && s.sessionKey.trim() !== "" ? s.sessionKey.trim() : null, m = typeof s.value == "string" ? s.value : null;
|
|
145
|
+
return {
|
|
146
|
+
handle: k(e, s),
|
|
147
|
+
ui: {
|
|
148
|
+
placeholderSelector: d,
|
|
149
|
+
errorMessage: f
|
|
150
|
+
},
|
|
151
|
+
transport: {
|
|
152
|
+
tokenFieldNames: l,
|
|
153
|
+
waitForValueMs: Number.isFinite(u) ? u : a,
|
|
154
|
+
sessionKey: p,
|
|
155
|
+
value: m
|
|
156
|
+
},
|
|
157
|
+
provider: c
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function j(e, t) {
|
|
161
|
+
let n = e.form || e.root, r = t.ui.placeholderSelector, i = t.handle;
|
|
162
|
+
return {
|
|
163
|
+
form: e.form,
|
|
164
|
+
root: e.root,
|
|
165
|
+
placeholder: {
|
|
166
|
+
query: () => b(e.root, r),
|
|
167
|
+
getPrimary: () => S(e.root, r),
|
|
168
|
+
observe: (t, n) => O(e.root, r, t, n),
|
|
169
|
+
createContainer: (e) => C(e),
|
|
170
|
+
clear: (e) => {
|
|
171
|
+
e && (w(e), e.innerHTML = "");
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
errors: {
|
|
175
|
+
getDefaultMessage: () => t.ui.errorMessage,
|
|
176
|
+
show: (n, i) => {
|
|
177
|
+
T(i || S(e.root, r), n || t.ui.errorMessage, e.form || e.root);
|
|
178
|
+
},
|
|
179
|
+
clear: (t) => {
|
|
180
|
+
w(t || S(e.root, r));
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
tokens: {
|
|
184
|
+
names: t.transport.tokenFieldNames,
|
|
185
|
+
has: (e = t.transport.tokenFieldNames, r = n) => f(r, e),
|
|
186
|
+
read: (e = t.transport.tokenFieldNames[0], r = n) => e ? d(r, e) : "",
|
|
187
|
+
write: (r, { names: i = t.transport.tokenFieldNames, root: a = n, container: o = e.form } = {}) => {
|
|
188
|
+
i.forEach((e) => {
|
|
189
|
+
m(a, e, {
|
|
190
|
+
value: r,
|
|
191
|
+
container: o
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
clear: (e = t.transport.tokenFieldNames, r = n) => {
|
|
196
|
+
p(r, e);
|
|
197
|
+
},
|
|
198
|
+
wait: (e = t.transport.waitForValueMs, r = t.transport.tokenFieldNames, i = n) => h(i, r, e)
|
|
199
|
+
},
|
|
200
|
+
refresh: {
|
|
201
|
+
providerHandle: i,
|
|
202
|
+
onTokensRefreshed: (t) => {
|
|
203
|
+
let n = ["formie:refresh-tokens:after", "formie:refresh-tokens:refreshed"].map((n) => y(e.root, n, (e) => {
|
|
204
|
+
let n = D(E(e), i);
|
|
205
|
+
n && t(n);
|
|
206
|
+
}));
|
|
207
|
+
return () => {
|
|
208
|
+
n.forEach((e) => {
|
|
209
|
+
e();
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
events: {
|
|
215
|
+
onRoot: (t, n) => y(e.root, t, n),
|
|
216
|
+
onForm: (t, n) => e.form ? y(e.form, t, n) : () => {}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/js/modules/captchas/factories.ts
|
|
222
|
+
var M = t("captchas");
|
|
223
|
+
function N({ id: e, defaultPlaceholderSelector: t, defaultTokenFieldNames: n = [], defaultWaitForValueMs: r = o, setup: i }) {
|
|
224
|
+
return {
|
|
225
|
+
id: e,
|
|
226
|
+
kind: "captcha",
|
|
227
|
+
match: () => !0,
|
|
228
|
+
setup: async (a) => {
|
|
229
|
+
let o = A(e, a.options || {}, {
|
|
230
|
+
defaultPlaceholderSelector: t,
|
|
231
|
+
defaultTokenFieldNames: n,
|
|
232
|
+
defaultWaitForValueMs: r
|
|
233
|
+
});
|
|
234
|
+
M.log("Setup module.", {
|
|
235
|
+
moduleId: e,
|
|
236
|
+
placeholderSelector: o.ui.placeholderSelector,
|
|
237
|
+
tokenFieldNames: o.transport.tokenFieldNames
|
|
238
|
+
});
|
|
239
|
+
let s = j(a, o);
|
|
240
|
+
return i({
|
|
241
|
+
...a,
|
|
242
|
+
options: o,
|
|
243
|
+
services: s
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function P({ id: e, defaultPlaceholderSelector: t, defaultTokenFieldNames: n = [], defaultWaitForValueMs: r = o }) {
|
|
249
|
+
return N({
|
|
250
|
+
id: e,
|
|
251
|
+
defaultPlaceholderSelector: t,
|
|
252
|
+
defaultTokenFieldNames: n,
|
|
253
|
+
defaultWaitForValueMs: r,
|
|
254
|
+
setup: async ({ services: t, options: n, root: r }) => {
|
|
255
|
+
let i = [], a = t.placeholder.getPrimary(), o = n.transport.sessionKey, s = n.transport.value || "", c = (e) => {
|
|
256
|
+
!e || !o || (e.innerHTML = "", m(e, o, {
|
|
257
|
+
value: s,
|
|
258
|
+
container: e
|
|
259
|
+
}));
|
|
260
|
+
}, l = t.placeholder.observe((t) => {
|
|
261
|
+
a = t, M.log("Passive placeholder visible.", { moduleId: e }), c(t);
|
|
262
|
+
}, (e) => {
|
|
263
|
+
a === e && (a = t.placeholder.getPrimary()), e.innerHTML = "";
|
|
264
|
+
});
|
|
265
|
+
return i.push(l.cleanup), c(a), i.push(t.refresh.onTokensRefreshed((e) => {
|
|
266
|
+
o = typeof e.sessionKey == "string" && e.sessionKey.trim() !== "" ? e.sessionKey.trim() : o, s = typeof e.value == "string" ? e.value : "";
|
|
267
|
+
let n = t.placeholder.getPrimary() || a;
|
|
268
|
+
a = n, c(n);
|
|
269
|
+
})), {
|
|
270
|
+
destroy: () => {
|
|
271
|
+
i.forEach((e) => {
|
|
272
|
+
e();
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
onBeforeStage: async (i) => {
|
|
276
|
+
if (i.stage !== "screen" || i.action !== "submit") return;
|
|
277
|
+
let s = o ? [o] : n.transport.tokenFieldNames;
|
|
278
|
+
if (s.length !== 0 && !await h(r, s, n.transport.waitForValueMs)) {
|
|
279
|
+
let n = t.errors.getDefaultMessage();
|
|
280
|
+
t.errors.show(n, a), M.warn("Passive captcha missing token.", {
|
|
281
|
+
moduleId: e,
|
|
282
|
+
tokenFieldNames: s
|
|
283
|
+
}), i.abort(n);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function F(t) {
|
|
291
|
+
return N({
|
|
292
|
+
id: t.id,
|
|
293
|
+
defaultPlaceholderSelector: t.defaultPlaceholderSelector,
|
|
294
|
+
defaultTokenFieldNames: t.defaultTokenFieldNames,
|
|
295
|
+
setup: async (n) => {
|
|
296
|
+
let r = [], i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = n.services.placeholder.getPrimary(), s = !1, c = null, l = async () => (c ||= (M.log("Loading captcha provider API.", { moduleId: t.id }), t.load(n)), c), u = async (e) => {
|
|
297
|
+
let r = i.get(e);
|
|
298
|
+
if (n.services.errors.clear(e), !r) {
|
|
299
|
+
e.innerHTML = "";
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
let a = await l();
|
|
303
|
+
t.unmount && await t.unmount({
|
|
304
|
+
api: a,
|
|
305
|
+
widget: r,
|
|
306
|
+
placeholder: e,
|
|
307
|
+
services: n.services,
|
|
308
|
+
options: n.options,
|
|
309
|
+
provider: n.options.provider
|
|
310
|
+
}), i.delete(e), e.innerHTML = "", n.services.tokens.clear(), M.log("Unmounted captcha placeholder widget.", { moduleId: t.id }), o === e && (o = n.services.placeholder.getPrimary());
|
|
311
|
+
}, d = async (e) => {
|
|
312
|
+
if (s || i.has(e) || a.has(e)) return;
|
|
313
|
+
let r = (async () => {
|
|
314
|
+
let r = await l();
|
|
315
|
+
if (s || i.has(e)) return;
|
|
316
|
+
let a = n.services.placeholder.createContainer(e), c = await t.mount({
|
|
317
|
+
api: r,
|
|
318
|
+
placeholder: e,
|
|
319
|
+
container: a,
|
|
320
|
+
services: n.services,
|
|
321
|
+
options: n.options,
|
|
322
|
+
provider: n.options.provider
|
|
323
|
+
});
|
|
324
|
+
i.set(e, c), o = e, M.log("Mounted captcha placeholder widget.", { moduleId: t.id });
|
|
325
|
+
})().finally(() => {
|
|
326
|
+
a.delete(e);
|
|
327
|
+
});
|
|
328
|
+
a.set(e, r), await r;
|
|
329
|
+
}, f = n.services.placeholder.observe((e) => {
|
|
330
|
+
o = e, d(e);
|
|
331
|
+
}, (e) => {
|
|
332
|
+
u(e);
|
|
333
|
+
});
|
|
334
|
+
r.push(f.cleanup);
|
|
335
|
+
let p = async (e) => {
|
|
336
|
+
let r = f.getVisible();
|
|
337
|
+
if (t.reset) {
|
|
338
|
+
let a = await l();
|
|
339
|
+
for (let o of r) {
|
|
340
|
+
let r = i.get(o);
|
|
341
|
+
if (!r) {
|
|
342
|
+
await d(o);
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
await t.reset({
|
|
346
|
+
api: a,
|
|
347
|
+
widget: r,
|
|
348
|
+
placeholder: o,
|
|
349
|
+
services: n.services,
|
|
350
|
+
options: n.options,
|
|
351
|
+
provider: n.options.provider,
|
|
352
|
+
reason: e
|
|
353
|
+
}), n.services.tokens.clear(), n.services.errors.clear(o);
|
|
354
|
+
}
|
|
355
|
+
f.reconcile();
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
for (let e of Array.from(i.keys())) await u(e);
|
|
359
|
+
for (let e of r) await d(e);
|
|
360
|
+
f.reconcile();
|
|
361
|
+
};
|
|
362
|
+
return r.push(n.services.events.onRoot("formie:submit:result", (e) => {
|
|
363
|
+
let t = e instanceof CustomEvent ? e.detail : null;
|
|
364
|
+
t?.stage !== "validate" && (t?.ok === !1 && t?.stage === "screen" || t?.ok !== !0 && p("submit-result"));
|
|
365
|
+
})), n.form && r.push(n.services.events.onForm(e("reset"), () => {
|
|
366
|
+
o = n.services.placeholder.getPrimary() || o, window.setTimeout(() => {
|
|
367
|
+
p("reset-state");
|
|
368
|
+
}, 0);
|
|
369
|
+
})), {
|
|
370
|
+
destroy: async () => {
|
|
371
|
+
s = !0, r.forEach((e) => {
|
|
372
|
+
e();
|
|
373
|
+
});
|
|
374
|
+
for (let e of Array.from(i.keys())) await u(e);
|
|
375
|
+
},
|
|
376
|
+
onBeforeStage: async (e) => {
|
|
377
|
+
if (e.stage !== "screen" || e.action !== "submit") return;
|
|
378
|
+
let r = f.getVisible();
|
|
379
|
+
if (r.length === 0) return;
|
|
380
|
+
let a = r.find((e) => e === o) || r[0];
|
|
381
|
+
await d(a), a = o || a, n.services.errors.clear(a);
|
|
382
|
+
let s = i.get(a);
|
|
383
|
+
if (!s) {
|
|
384
|
+
let r = n.services.errors.getDefaultMessage();
|
|
385
|
+
n.services.errors.show(r, a), M.warn("Captcha widget unavailable at screen stage.", { moduleId: t.id }), e.abort(r);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
let c = await l();
|
|
389
|
+
await t.screen({
|
|
390
|
+
api: c,
|
|
391
|
+
widget: s,
|
|
392
|
+
placeholder: a,
|
|
393
|
+
services: n.services,
|
|
394
|
+
options: n.options,
|
|
395
|
+
provider: n.options.provider,
|
|
396
|
+
stageCtx: e
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region src/js/modules/captchas/api.ts
|
|
405
|
+
var I = F, L = P;
|
|
406
|
+
//#endregion
|
|
407
|
+
export { s as a, l as i, L as n, c as o, u as r, I as t };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { t as e } from "./debug-BV0DvdHx.js";
|
|
2
|
+
import { i as t, r as n, t as r } from "./constants-DVcJAvc5.js";
|
|
3
|
+
//#region src/js/modules/address/host.ts
|
|
4
|
+
var i = new Set(["handle"]);
|
|
5
|
+
function a(e, t) {
|
|
6
|
+
return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
|
|
7
|
+
}
|
|
8
|
+
function o(e, t) {
|
|
9
|
+
let n = t || {}, r = Object.entries(n).reduce((e, [t, n]) => (i.has(t) || (e[t] = n), e), {});
|
|
10
|
+
return {
|
|
11
|
+
handle: a(e, n),
|
|
12
|
+
provider: r
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function s(e, t, n) {
|
|
16
|
+
return e.addEventListener(t, n), () => {
|
|
17
|
+
e.removeEventListener(t, n);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function c(e) {
|
|
21
|
+
let i = e.target, a = e.form, o = e.root, c = n;
|
|
22
|
+
return {
|
|
23
|
+
root: o,
|
|
24
|
+
field: i,
|
|
25
|
+
form: a,
|
|
26
|
+
input: {
|
|
27
|
+
getAutocomplete: () => i.querySelector(c),
|
|
28
|
+
setValue: (e, n, r) => {
|
|
29
|
+
let a = t(i, e);
|
|
30
|
+
if (!a) return;
|
|
31
|
+
let o = n || r || "";
|
|
32
|
+
a.value !== o && (a.value = o, a.dispatchEvent(new Event("input", { bubbles: !0 })), a.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
location: {
|
|
36
|
+
getButton: () => i.querySelector(r),
|
|
37
|
+
onUseLocation: (e) => {
|
|
38
|
+
let t = i.querySelector(r);
|
|
39
|
+
if (!t) return () => {};
|
|
40
|
+
let n = (t) => {
|
|
41
|
+
t.preventDefault(), navigator.geolocation && navigator.geolocation.getCurrentPosition(e, () => {}, { enableHighAccuracy: !0 });
|
|
42
|
+
};
|
|
43
|
+
return t.addEventListener("click", n), () => {
|
|
44
|
+
t.removeEventListener("click", n);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
events: { onField: (e, t) => s(i, e, t) }
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/js/modules/address/factories.ts
|
|
53
|
+
var l = e("address");
|
|
54
|
+
function u(e) {
|
|
55
|
+
let t = e;
|
|
56
|
+
return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
|
|
57
|
+
}
|
|
58
|
+
function d(e) {
|
|
59
|
+
return {
|
|
60
|
+
id: e.id,
|
|
61
|
+
kind: "address",
|
|
62
|
+
match: (e) => !!e.target.querySelector("[data-formie-address-autocomplete-input]"),
|
|
63
|
+
setup: async (t) => {
|
|
64
|
+
let n = o(e.id, t.options || {}), r = c(t);
|
|
65
|
+
l.log("Setup module.", { moduleId: e.id });
|
|
66
|
+
let i = {
|
|
67
|
+
...t,
|
|
68
|
+
options: n,
|
|
69
|
+
services: r
|
|
70
|
+
}, a = [], s = null, d = null;
|
|
71
|
+
if (!r.input.getAutocomplete()) return console.warn(`[formie] Address module "${e.id}" skipped: no autocomplete input found in target. Ensure the Address field has the Auto-Complete subfield enabled.`), l.warn("Autocomplete input missing; skipping module.", { moduleId: e.id }), { destroy: () => {} };
|
|
72
|
+
let f = async () => (s ||= (l.log("Loading provider API.", { moduleId: e.id }), e.load(i)), s), p = async () => {
|
|
73
|
+
if (d || !u(t.target)) return;
|
|
74
|
+
let i = await f();
|
|
75
|
+
d = await e.mount({
|
|
76
|
+
api: i,
|
|
77
|
+
field: t.target,
|
|
78
|
+
services: r,
|
|
79
|
+
options: n,
|
|
80
|
+
provider: n.provider
|
|
81
|
+
}), l.log("Widget mounted.", { moduleId: e.id });
|
|
82
|
+
};
|
|
83
|
+
u(t.target) && await p(), ["formie:page:navigate:after", "formie:submit:result"].forEach((e) => {
|
|
84
|
+
let n = () => {
|
|
85
|
+
p();
|
|
86
|
+
};
|
|
87
|
+
t.root.addEventListener(e, n), a.push(() => {
|
|
88
|
+
t.root.removeEventListener(e, n);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
let m = r.location.onUseLocation((i) => {
|
|
92
|
+
e.onCurrentLocation && (async () => {
|
|
93
|
+
if (await p(), !d) return;
|
|
94
|
+
let a = await f();
|
|
95
|
+
await e.onCurrentLocation?.(i, {
|
|
96
|
+
api: a,
|
|
97
|
+
widget: d,
|
|
98
|
+
field: t.target,
|
|
99
|
+
services: r,
|
|
100
|
+
options: n,
|
|
101
|
+
provider: n.provider
|
|
102
|
+
});
|
|
103
|
+
})();
|
|
104
|
+
});
|
|
105
|
+
return m && a.push(m), { destroy: async () => {
|
|
106
|
+
if (l.log("Destroying module.", { moduleId: e.id }), a.forEach((e) => e()), d && e.unmount) {
|
|
107
|
+
let i = await f();
|
|
108
|
+
await e.unmount({
|
|
109
|
+
api: i,
|
|
110
|
+
widget: d,
|
|
111
|
+
field: t.target,
|
|
112
|
+
services: r,
|
|
113
|
+
options: n,
|
|
114
|
+
provider: n.provider
|
|
115
|
+
}), l.log("Widget unmounted.", { moduleId: e.id });
|
|
116
|
+
}
|
|
117
|
+
} };
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/js/modules/address/api.ts
|
|
123
|
+
var f = d;
|
|
124
|
+
//#endregion
|
|
125
|
+
export { f as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/js/utils/async.ts
|
|
2
|
+
async function e(e) {
|
|
3
|
+
await new Promise((t) => {
|
|
4
|
+
window.setTimeout(t, Math.max(e, 0));
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
async function t(t, { timeoutMs: n = 5e3, intervalMs: r = 30 } = {}) {
|
|
8
|
+
let i = Date.now();
|
|
9
|
+
for (; Date.now() - i < n;) {
|
|
10
|
+
let n = t();
|
|
11
|
+
if (n) return n;
|
|
12
|
+
await e(r);
|
|
13
|
+
}
|
|
14
|
+
throw Error("Timed out waiting for async condition.");
|
|
15
|
+
}
|
|
16
|
+
function n(e, t) {
|
|
17
|
+
let n = null;
|
|
18
|
+
return (...r) => {
|
|
19
|
+
n !== null && window.clearTimeout(n), n = window.setTimeout(() => {
|
|
20
|
+
e(...r);
|
|
21
|
+
}, Math.max(t, 0));
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { e as n, t as r, n as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { t as e } from "./api-CmwLRq_n.js";
|
|
2
|
+
//#region src/js/modules/payments/bpoint.ts
|
|
3
|
+
var t = e({
|
|
4
|
+
id: "bpoint",
|
|
5
|
+
defaultRequiredInputSuffixes: ["bpointToken"],
|
|
6
|
+
load: async () => null,
|
|
7
|
+
onBeforeAuthorize: async ({ field: e, services: t }) => {
|
|
8
|
+
if ((e.querySelector("input[name$=\"[bpointToken]\"]")?.value || "").trim() !== "") return !0;
|
|
9
|
+
let n = e.querySelector("[data-bpoint-card=\"cardholder-name\"]")?.value?.trim() || "", r = e.querySelector("[data-bpoint-card=\"card-number\"]")?.value?.replace(/\s+/g, "") || "", i = e.querySelector("[data-bpoint-card=\"expiry-date\"]")?.value || "", a = e.querySelector("[data-bpoint-card=\"security-code\"]")?.value?.trim() || "", o = (i.match(/\d/g) || []).join("").slice(0, 4);
|
|
10
|
+
if (!r || o.length !== 4 || !a) return t.addError("Please provide valid card details to continue."), !1;
|
|
11
|
+
let s = {
|
|
12
|
+
cardholderName: n,
|
|
13
|
+
cardNumber: r,
|
|
14
|
+
expiryDate: o,
|
|
15
|
+
cvn: a
|
|
16
|
+
};
|
|
17
|
+
return t.updateInputs("bpointToken", JSON.stringify(s)), !0;
|
|
18
|
+
},
|
|
19
|
+
onAfterSubmit: async ({ services: e }) => {
|
|
20
|
+
e.updateInputs("bpointToken", "");
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { t as bpointModule };
|