@verbb/formie-browser 1.0.14 → 1.0.16
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 +66 -0
- package/dist/chunks/{address-country-Dn71jroa.js → address-country-DLJF-OkC.js} +5 -9
- package/dist/chunks/{address-finder-O49uDRoR.js → address-finder-QK1m1eyv.js} +2 -2
- package/dist/chunks/{address-state-ByYatUur.js → address-state-CHKit8AW.js} +113 -112
- package/dist/chunks/{api-DYYsVIub.js → api-BPtH5RBA.js} +162 -130
- package/dist/chunks/{api-D6kJ7kXZ.js → api-BR2Gqy37.js} +313 -303
- package/dist/chunks/{api-ghNr2uxX.js → api-CmuOZ0i3.js} +1 -1
- package/dist/chunks/{async-nPFRNQ06.js → async-2GdXNFCE.js} +18 -1
- package/dist/chunks/{bpoint-D0RKFM4F.js → bpoint-GvYfyPjD.js} +1 -1
- package/dist/chunks/{calculations-YEoVCG2q.js → calculations-DeEmdUDq.js} +5 -7
- package/dist/chunks/{captcha-eu-DERJbXnH.js → captcha-eu-eU_M6snp.js} +2 -2
- package/dist/chunks/{checkbox-radio-gsm8QPJg.js → checkbox-radio-CSXo6svm.js} +4 -12
- package/dist/chunks/{combobox-CWNdx4Fk.js → combobox-CJh2DoSO.js} +323 -363
- package/dist/chunks/{conditions-DqNHLTbN.js → conditions-Dz3068K0.js} +140 -153
- package/dist/chunks/{country-from-ip-DDj_mFki.js → country-from-ip-BqQ-BqLH.js} +1 -1
- package/dist/chunks/{custom-google-maps-C4l2S3GO.js → custom-google-maps-rNm5VFbb.js} +2 -6
- package/dist/chunks/{custom-link-CLazgKYH.js → custom-link-CLqFCssQ.js} +1 -1
- package/dist/chunks/{custom-maps-DqcAlD0v.js → custom-maps-DgjYQDLj.js} +4 -8
- package/dist/chunks/{date-picker-RUnevF7l.js → date-picker-BVJxJVYT.js} +42 -58
- package/dist/chunks/{debug-BV0DvdHx.js → debug-rhzqP1j2.js} +2 -14
- package/dist/chunks/{dist-ZLeW0zZ3.js → dist-CJReDlDK.js} +13 -8
- package/dist/chunks/{eway-or6dtjoT.js → eway-BZuTBAUW.js} +3 -3
- package/dist/chunks/{field-references.resolver-Ca8MguFv.js → field-references.resolver-uSHf5-NP.js} +1 -1
- package/dist/chunks/{file-upload-Bm-TXyNB.js → file-upload-vEUr_EuP.js} +131 -113
- package/dist/chunks/{friendly-captcha-v1-GFqCt1Mh.js → friendly-captcha-v1-C_cF1WD2.js} +2 -2
- package/dist/chunks/{friendly-captcha-v2-WoW246JG.js → friendly-captcha-v2-BenESH-n.js} +2 -2
- package/dist/chunks/{friendly-challenge-DPG9MJb1.js → friendly-challenge-BgPBEMXx.js} +21 -35
- package/dist/chunks/{go-cardless-DzJ-0FKg.js → go-cardless-DWZeB0Bq.js} +2 -6
- package/dist/chunks/{google-address-C1P1nTDM.js → google-address-DQR6rsbh.js} +15 -10
- package/dist/chunks/{hcaptcha-D0T8aIHz.js → hcaptcha-COilLmRT.js} +2 -2
- package/dist/chunks/{hidden-BZhXnNPe.js → hidden-Bc2TpcgF.js} +1 -1
- package/dist/chunks/{http-C2QdHuWO.js → http-Dj_skqaa.js} +1 -1
- package/dist/chunks/{leaflet-src-DE6rv6M-.js → leaflet-src-Cg-LUOD8.js} +74 -122
- package/dist/chunks/{loqate-DD1S7PY9.js → loqate-ZZClcacr.js} +2 -2
- package/dist/chunks/{mollie-DG8Ju83x.js → mollie-8OMXIYa8.js} +2 -6
- package/dist/chunks/{moneris-C8m3Fvqu.js → moneris-qYHJ9EFy.js} +1 -1
- package/dist/chunks/opayo-DlWPEnla.js +159 -0
- package/dist/chunks/{paddle-BIYR9Um3.js → paddle-CArfWih0.js} +2 -2
- package/dist/chunks/{password-validation-C8_uO_c_.js → password-validation-HGOU9kf3.js} +2 -2
- package/dist/chunks/{paypal-B_yxIo2d.js → paypal-BcaMCMGY.js} +2 -2
- package/dist/chunks/{payway-CeOzS0sL.js → payway-vxC7_bfR.js} +4 -12
- package/dist/chunks/{phone-country-bAqje17P.js → phone-country-Bx9EG50h.js} +124 -141
- package/dist/chunks/{place-kit-BE5gi3vo.js → place-kit-BKk8xDXf.js} +10 -10
- package/dist/chunks/{placekit-autocomplete.esm-CZZERYur.js → placekit-autocomplete.esm-D2A_0iVU.js} +2 -5
- package/dist/chunks/{recaptcha-enterprise-CruXddZq.js → recaptcha-enterprise-Cx6HUpMa.js} +6 -12
- package/dist/chunks/recaptcha-shared-CcMI-r8t.js +33 -0
- package/dist/chunks/{recaptcha-v2-checkbox-CCnJYCnG.js → recaptcha-v2-checkbox-DQ9BJzcv.js} +2 -2
- package/dist/chunks/{recaptcha-v2-invisible-BuVqRRYn.js → recaptcha-v2-invisible-BP0T8Pan.js} +2 -2
- package/dist/chunks/recaptcha-v3-DKMGQ27K.js +38 -0
- package/dist/chunks/{repeater-DwE27jI1.js → repeater-BR0RUvTs.js} +50 -40
- package/dist/chunks/{rich-text-uV4o_pGk.js → rich-text-H2A6cm1t.js} +33 -11
- package/dist/chunks/{rolldown-runtime-DtPi1Y-2.js → rolldown-runtime-VHNaYcLd.js} +1 -1
- package/dist/chunks/{scripts-CbQ7agX3.js → scripts-DrccjrFv.js} +1 -1
- package/dist/chunks/{sdk-lkwSvlpM.js → sdk-_cmrRYgp.js} +4 -16
- package/dist/chunks/{shared-OKhSay59.js → shared-CJ1LIEh3.js} +1 -3
- package/dist/chunks/{signature-7cldFbqj.js → signature-CfKA_poI.js} +9 -41
- package/dist/chunks/skip-CEW89ExY.js +7 -0
- package/dist/chunks/{snaptcha-C04kNGYQ.js → snaptcha-P3EoSQud.js} +1 -1
- package/dist/chunks/{square-DEzxv9D9.js → square-Dyz0p_GU.js} +2 -2
- package/dist/chunks/{stripe-CVPQGDz3.js → stripe-Bfd_jp_k.js} +4 -7
- package/dist/chunks/{summary-BF_8mrXI.js → summary-B3CAebLV.js} +45 -37
- package/dist/chunks/{survey-likert-fk1hUPff.js → survey-likert-CEtUceag.js} +1 -1
- package/dist/chunks/{survey-rank-BsLGl2LX.js → survey-rank-Dtt97y6s.js} +3 -7
- package/dist/chunks/{survey-rating-DVS6e6fM.js → survey-rating-mlDMI0uq.js} +9 -23
- package/dist/chunks/{table-DnIBdeKF.js → table-0k6Md0IO.js} +2 -2
- package/dist/chunks/{text-limit-LGMPhFuC.js → text-limit-CTVML6s7.js} +10 -10
- package/dist/chunks/{turnstile-n9DNyPxi.js → turnstile-Sp4ubowK.js} +2 -2
- package/dist/chunks/{upload-manager-BbiUosZq.js → upload-manager-Ccg3d_4I.js} +258 -260
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +743 -734
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/dom-events.d.ts +5 -0
- package/dist/js/core/dom-events.d.ts.map +1 -1
- package/dist/js/core/page-client-event.d.ts.map +1 -1
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts +3 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/core/validation-focus.d.ts.map +1 -1
- package/dist/js/modules/address/google-address.d.ts +10 -0
- package/dist/js/modules/address/google-address.d.ts.map +1 -1
- package/dist/js/modules/address/place-kit.d.ts.map +1 -1
- package/dist/js/modules/captchas/factories.d.ts.map +1 -1
- package/dist/js/modules/captchas/host.d.ts +4 -1
- package/dist/js/modules/captchas/host.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-shared.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-shared.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
- package/dist/js/modules/fields/address-state.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts +2 -0
- package/dist/js/modules/fields/combobox.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions.d.ts.map +1 -1
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/modules/fields/repeater.d.ts.map +1 -1
- package/dist/js/modules/fields/rich-text.d.ts.map +1 -1
- package/dist/js/modules/fields/summary.d.ts.map +1 -1
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
- package/dist/js/modules/payments/factories.d.ts.map +1 -1
- package/dist/js/modules/payments/opayo.d.ts.map +1 -1
- package/dist/js/submit/pipeline.d.ts +2 -0
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/utils/async.d.ts +1 -0
- package/dist/js/utils/async.d.ts.map +1 -1
- package/dist/js/utils/form-started-at.d.ts +1 -0
- package/dist/js/utils/form-started-at.d.ts.map +1 -1
- package/dist/js/utils/unload-warning.d.ts +4 -0
- package/dist/js/utils/unload-warning.d.ts.map +1 -1
- package/dist/js/validation/rules/required.d.ts.map +1 -1
- package/dist/js/validation/submit-readiness.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts +1 -0
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/js/core/create-formie-client.ts +37 -28
- package/src/js/core/dom-events.ts +30 -1
- package/src/js/core/page-client-event.ts +5 -7
- package/src/js/core/submit-result-state.ts +30 -2
- package/src/js/core/submit-result-ui.ts +25 -3
- package/src/js/core/validation-focus.ts +17 -3
- package/src/js/modules/address/google-address.ts +95 -37
- package/src/js/modules/address/place-kit.ts +13 -7
- package/src/js/modules/captchas/factories.ts +241 -101
- package/src/js/modules/captchas/host.ts +16 -0
- package/src/js/modules/captchas/recaptcha-enterprise.ts +1 -1
- package/src/js/modules/captchas/recaptcha-shared.ts +23 -5
- package/src/js/modules/captchas/recaptcha-v3.ts +23 -14
- package/src/js/modules/fields/address-country.ts +5 -5
- package/src/js/modules/fields/address-state.ts +80 -27
- package/src/js/modules/fields/combobox.ts +22 -1
- package/src/js/modules/fields/conditions/effects.ts +4 -5
- package/src/js/modules/fields/conditions.ts +9 -0
- package/src/js/modules/fields/date-picker.ts +6 -3
- package/src/js/modules/fields/file-upload.ts +55 -18
- package/src/js/modules/fields/phone-country.ts +25 -2
- package/src/js/modules/fields/repeater.ts +55 -4
- package/src/js/modules/fields/rich-text.ts +33 -0
- package/src/js/modules/fields/summary.ts +63 -10
- package/src/js/modules/fields/text-limit.ts +11 -0
- package/src/js/modules/fields/upload-manager.ts +54 -18
- package/src/js/modules/payments/factories.ts +87 -54
- package/src/js/modules/payments/opayo.ts +7 -0
- package/src/js/submit/pipeline.ts +16 -9
- package/src/js/utils/async.ts +34 -0
- package/src/js/utils/form-started-at.ts +19 -4
- package/src/js/utils/unload-warning.ts +63 -7
- package/src/js/validation/rules/required.ts +18 -0
- package/src/js/validation/submit-readiness.ts +2 -0
- package/src/js/validation/validator.ts +29 -6
- package/src/vendor.d.ts +2 -0
- package/dist/chunks/opayo-B3EvrVxw.js +0 -188
- package/dist/chunks/recaptcha-shared-AQRMDMme.js +0 -27
- package/dist/chunks/recaptcha-v3-CloqhO2A.js +0 -28
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as e } from "./event-names-BCI2FLD8.js";
|
|
2
|
-
import { t } from "./debug-
|
|
2
|
+
import { t } from "./debug-rhzqP1j2.js";
|
|
3
3
|
import { t as n } from "./theme-classes-DAQuEqdP.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { n as r, t as i } from "./async-2GdXNFCE.js";
|
|
5
|
+
import { i as a } from "./i18n-BY1ds1BL.js";
|
|
6
6
|
//#region src/js/modules/captchas/constants.ts
|
|
7
7
|
var o = 2e3, s = 5e3, c = 5e3, l = 12e4;
|
|
8
8
|
//#endregion
|
|
@@ -38,8 +38,8 @@ function m(e, t, { value: n = "", container: r } = {}) {
|
|
|
38
38
|
}
|
|
39
39
|
async function h(e, t, n) {
|
|
40
40
|
if (f(e, t)) return !0;
|
|
41
|
-
let
|
|
42
|
-
for (; Date.now() <
|
|
41
|
+
let i = Date.now() + Math.max(n, 0);
|
|
42
|
+
for (; Date.now() < i;) if (await r(120), f(e, t)) return !0;
|
|
43
43
|
return !1;
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
@@ -98,17 +98,18 @@ function O(e, t) {
|
|
|
98
98
|
return !n || typeof n != "object" ? null : n;
|
|
99
99
|
}
|
|
100
100
|
function k(e, t, n, r) {
|
|
101
|
-
let
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
let a = /* @__PURE__ */ new Set(), o = !0, s = () => {
|
|
102
|
+
if (!o) return;
|
|
103
|
+
let i = x(e, t), s = new Set(i.filter((e) => S(e)));
|
|
104
|
+
i.forEach((e) => {
|
|
105
|
+
s.has(e) && !a.has(e) && (a.add(e), n(e));
|
|
106
|
+
}), Array.from(a).forEach((e) => {
|
|
107
|
+
s.has(e) || (a.delete(e), r(e));
|
|
107
108
|
});
|
|
108
|
-
},
|
|
109
|
-
|
|
109
|
+
}, c = i(s, 20), l = new MutationObserver(() => {
|
|
110
|
+
c();
|
|
110
111
|
});
|
|
111
|
-
|
|
112
|
+
l.observe(e, {
|
|
112
113
|
childList: !0,
|
|
113
114
|
subtree: !0,
|
|
114
115
|
attributes: !0,
|
|
@@ -120,33 +121,29 @@ function k(e, t, n, r) {
|
|
|
120
121
|
"data-formie-page-hidden"
|
|
121
122
|
]
|
|
122
123
|
});
|
|
123
|
-
let
|
|
124
|
-
|
|
124
|
+
let u = [b(window, "resize", () => {
|
|
125
|
+
c();
|
|
125
126
|
}), ...v.map((t) => b(e, t, () => {
|
|
126
|
-
|
|
127
|
-
o();
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
s();
|
|
127
|
+
y.has(t) ? s() : c();
|
|
131
128
|
}))];
|
|
132
|
-
return
|
|
129
|
+
return s(), {
|
|
133
130
|
cleanup: () => {
|
|
134
|
-
|
|
131
|
+
o && (o = !1, l.disconnect(), u.forEach((e) => {
|
|
135
132
|
e();
|
|
136
|
-
}), Array.from(
|
|
133
|
+
}), Array.from(a).forEach((e) => {
|
|
137
134
|
r(e);
|
|
138
|
-
}),
|
|
135
|
+
}), a.clear());
|
|
139
136
|
},
|
|
140
|
-
reconcile:
|
|
141
|
-
reconcileImmediate:
|
|
137
|
+
reconcile: c,
|
|
138
|
+
reconcileImmediate: s,
|
|
142
139
|
getVisible: () => x(e, t).filter((e) => S(e))
|
|
143
140
|
};
|
|
144
141
|
}
|
|
145
142
|
function A(e, t) {
|
|
146
143
|
return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
|
|
147
144
|
}
|
|
148
|
-
function j(e, t, { defaultPlaceholderSelector: n, defaultTokenFieldNames:
|
|
149
|
-
let s = t || {}, c = Object.entries(s).reduce((e, [t, n]) => (g.has(t) || (e[t] = n), e), {}), l =
|
|
145
|
+
function j(e, t, { defaultPlaceholderSelector: n, defaultTokenFieldNames: r = [], defaultWaitForValueMs: i = o }) {
|
|
146
|
+
let s = t || {}, c = Object.entries(s).reduce((e, [t, n]) => (g.has(t) || (e[t] = n), e), {}), l = r.map(String).filter(Boolean), u = Number(i), d = typeof s.placeholderSelector == "string" && s.placeholderSelector.trim() !== "" ? s.placeholderSelector.trim() : n, f = typeof s.errorMessage == "string" && s.errorMessage.trim() !== "" ? s.errorMessage.trim() : a("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;
|
|
150
147
|
return {
|
|
151
148
|
handle: A(e, s),
|
|
152
149
|
ui: {
|
|
@@ -155,22 +152,22 @@ function j(e, t, { defaultPlaceholderSelector: n, defaultTokenFieldNames: i = []
|
|
|
155
152
|
},
|
|
156
153
|
transport: {
|
|
157
154
|
tokenFieldNames: l,
|
|
158
|
-
waitForValueMs: Number.isFinite(u) ? u :
|
|
155
|
+
waitForValueMs: Number.isFinite(u) ? u : i,
|
|
159
156
|
sessionKey: p,
|
|
160
157
|
value: m
|
|
161
158
|
},
|
|
162
159
|
provider: c
|
|
163
160
|
};
|
|
164
161
|
}
|
|
165
|
-
function M(e, t) {
|
|
166
|
-
let
|
|
162
|
+
function M(e, t, n = {}) {
|
|
163
|
+
let r = e.form || e.root, i = t.ui.placeholderSelector, a = t.handle;
|
|
167
164
|
return {
|
|
168
165
|
form: e.form,
|
|
169
166
|
root: e.root,
|
|
170
167
|
placeholder: {
|
|
171
|
-
query: () => x(e.root,
|
|
172
|
-
getPrimary: () => C(e.root,
|
|
173
|
-
observe: (t, n) => k(e.root,
|
|
168
|
+
query: () => x(e.root, i),
|
|
169
|
+
getPrimary: () => C(e.root, i),
|
|
170
|
+
observe: (t, n) => k(e.root, i, t, n),
|
|
174
171
|
createContainer: (e) => w(e),
|
|
175
172
|
clear: (e) => {
|
|
176
173
|
e && (T(e), e.innerHTML = "");
|
|
@@ -178,35 +175,35 @@ function M(e, t) {
|
|
|
178
175
|
},
|
|
179
176
|
errors: {
|
|
180
177
|
getDefaultMessage: () => t.ui.errorMessage,
|
|
181
|
-
show: (
|
|
182
|
-
E(
|
|
178
|
+
show: (r, a) => {
|
|
179
|
+
n.isActive?.() !== !1 && E(a || C(e.root, i), r || t.ui.errorMessage, e.form || e.root);
|
|
183
180
|
},
|
|
184
181
|
clear: (t) => {
|
|
185
|
-
T(t || C(e.root,
|
|
182
|
+
n.isActive?.() !== !1 && T(t || C(e.root, i));
|
|
186
183
|
}
|
|
187
184
|
},
|
|
188
185
|
tokens: {
|
|
189
186
|
names: t.transport.tokenFieldNames,
|
|
190
|
-
has: (e = t.transport.tokenFieldNames,
|
|
191
|
-
read: (e = t.transport.tokenFieldNames[0],
|
|
192
|
-
write: (
|
|
193
|
-
|
|
194
|
-
m(
|
|
195
|
-
value:
|
|
196
|
-
container:
|
|
187
|
+
has: (e = t.transport.tokenFieldNames, n = r) => f(n, e),
|
|
188
|
+
read: (e = t.transport.tokenFieldNames[0], n = r) => e ? d(n, e) : "",
|
|
189
|
+
write: (i, { names: a = t.transport.tokenFieldNames, root: o = r, container: s = e.form } = {}) => {
|
|
190
|
+
n.isActive?.() !== !1 && (n.onTokenFieldNames?.(a), a.forEach((e) => {
|
|
191
|
+
m(o, e, {
|
|
192
|
+
value: i,
|
|
193
|
+
container: s
|
|
197
194
|
});
|
|
198
|
-
});
|
|
195
|
+
}));
|
|
199
196
|
},
|
|
200
|
-
clear: (e = t.transport.tokenFieldNames,
|
|
201
|
-
p(
|
|
197
|
+
clear: (e = t.transport.tokenFieldNames, i = r) => {
|
|
198
|
+
n.isActive?.() !== !1 && p(i, e);
|
|
202
199
|
},
|
|
203
|
-
wait: (e = t.transport.waitForValueMs,
|
|
200
|
+
wait: (e = t.transport.waitForValueMs, n = t.transport.tokenFieldNames, i = r) => h(i, n, e)
|
|
204
201
|
},
|
|
205
202
|
refresh: {
|
|
206
|
-
providerHandle:
|
|
203
|
+
providerHandle: a,
|
|
207
204
|
onTokensRefreshed: (t) => {
|
|
208
205
|
let n = ["formie:refresh-tokens:after", "formie:refresh-tokens:refreshed"].map((n) => b(e.root, n, (e) => {
|
|
209
|
-
let n = O(D(e),
|
|
206
|
+
let n = O(D(e), a);
|
|
210
207
|
n && t(n);
|
|
211
208
|
}));
|
|
212
209
|
return () => {
|
|
@@ -249,22 +246,45 @@ function P({ moduleId: e, defaultPlaceholderSelector: t, defaultTokenFieldNames:
|
|
|
249
246
|
if (!e) throw Error("The CAPTCHA needs a supported placeholder in the client-rendered form.");
|
|
250
247
|
s = document.createElement("div"), s.setAttribute(e, ""), (a.form ?? a.root).append(s);
|
|
251
248
|
}
|
|
252
|
-
let c =
|
|
253
|
-
|
|
254
|
-
options: o,
|
|
255
|
-
services: c
|
|
256
|
-
});
|
|
257
|
-
if (!l) {
|
|
258
|
-
s?.remove();
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
let u = l.destroy;
|
|
262
|
-
return {
|
|
263
|
-
...l,
|
|
264
|
-
destroy: async () => {
|
|
265
|
-
await u(), s?.remove();
|
|
266
|
-
}
|
|
249
|
+
let c = new Set(o.transport.tokenFieldNames), l = !0, u = (e) => {
|
|
250
|
+
e.filter(Boolean).forEach((e) => c.add(e));
|
|
267
251
|
};
|
|
252
|
+
u(o.transport.sessionKey ? [o.transport.sessionKey] : []);
|
|
253
|
+
let d = M(a, o, {
|
|
254
|
+
onTokenFieldNames: u,
|
|
255
|
+
isActive: () => l
|
|
256
|
+
}), f = d.events.onForm("formie:unload-warning:collect-exclusions", (e) => {
|
|
257
|
+
let t = e.detail;
|
|
258
|
+
t?.form === a.form && t.exclude(...c);
|
|
259
|
+
}), p = d.refresh.onTokensRefreshed((e) => {
|
|
260
|
+
typeof e.sessionKey == "string" && e.sessionKey.trim() !== "" && u([e.sessionKey.trim()]);
|
|
261
|
+
}), m = () => {
|
|
262
|
+
l = !1, f(), p(), s?.remove();
|
|
263
|
+
};
|
|
264
|
+
try {
|
|
265
|
+
let e = await i({
|
|
266
|
+
...a,
|
|
267
|
+
options: o,
|
|
268
|
+
services: d
|
|
269
|
+
});
|
|
270
|
+
if (!e) {
|
|
271
|
+
m();
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
let t = e.destroy;
|
|
275
|
+
return {
|
|
276
|
+
...e,
|
|
277
|
+
destroy: async () => {
|
|
278
|
+
try {
|
|
279
|
+
await t();
|
|
280
|
+
} finally {
|
|
281
|
+
m();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
} catch (e) {
|
|
286
|
+
throw m(), e;
|
|
287
|
+
}
|
|
268
288
|
}
|
|
269
289
|
};
|
|
270
290
|
}
|
|
@@ -316,28 +336,38 @@ function I(t) {
|
|
|
316
336
|
defaultPlaceholderSelector: t.defaultPlaceholderSelector,
|
|
317
337
|
defaultTokenFieldNames: t.defaultTokenFieldNames,
|
|
318
338
|
setup: async (n) => {
|
|
319
|
-
let r = [], i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = n.services.placeholder.getPrimary(),
|
|
320
|
-
let r =
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
339
|
+
let r = [], i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = null, c = n.services.placeholder.getPrimary(), l = !1, u, d = null, f = async () => (d ||= (N.log("Loading captcha provider API.", { moduleId: t.moduleId }), t.load(n)), d), p = (e) => {
|
|
340
|
+
let r = o.get(e);
|
|
341
|
+
if (r) return r;
|
|
342
|
+
let s = (async () => {
|
|
343
|
+
await a.get(e)?.catch(() => {}), n.services.errors.clear(e);
|
|
344
|
+
let r = i.has(e), o = i.get(e);
|
|
345
|
+
i.delete(e);
|
|
346
|
+
try {
|
|
347
|
+
if (r && t.unmount) {
|
|
348
|
+
let r = await f();
|
|
349
|
+
await t.unmount({
|
|
350
|
+
api: r,
|
|
351
|
+
widget: o,
|
|
352
|
+
placeholder: e,
|
|
353
|
+
services: n.services,
|
|
354
|
+
options: n.options,
|
|
355
|
+
provider: n.options.provider
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
} finally {
|
|
359
|
+
e.innerHTML = "", n.services.tokens.clear(), c === e && (c = n.services.placeholder.getPrimary());
|
|
360
|
+
}
|
|
361
|
+
})().finally(() => o.delete(e));
|
|
362
|
+
return o.set(e, s), s;
|
|
363
|
+
}, m = async (e) => {
|
|
364
|
+
let r = o.get(e);
|
|
365
|
+
if (r && await r, l || i.has(e)) return;
|
|
336
366
|
if (a.has(e)) return a.get(e);
|
|
337
|
-
let
|
|
338
|
-
let r = await
|
|
339
|
-
if (
|
|
340
|
-
let a = n.services.placeholder.createContainer(e),
|
|
367
|
+
let s = (async () => {
|
|
368
|
+
let r = await f();
|
|
369
|
+
if (l || i.has(e)) return;
|
|
370
|
+
let a = n.services.placeholder.createContainer(e), o = await t.mount({
|
|
341
371
|
api: r,
|
|
342
372
|
placeholder: e,
|
|
343
373
|
container: a,
|
|
@@ -345,30 +375,29 @@ function I(t) {
|
|
|
345
375
|
options: n.options,
|
|
346
376
|
provider: n.options.provider
|
|
347
377
|
});
|
|
348
|
-
i.set(e,
|
|
378
|
+
i.set(e, o), c = e, N.log("Mounted captcha placeholder widget.", { moduleId: t.moduleId });
|
|
349
379
|
})().finally(() => {
|
|
350
380
|
a.delete(e);
|
|
351
381
|
});
|
|
352
|
-
a.set(e,
|
|
353
|
-
},
|
|
354
|
-
|
|
355
|
-
|
|
382
|
+
a.set(e, s), await s;
|
|
383
|
+
}, h = n.services.placeholder.observe((e) => {
|
|
384
|
+
c = e, m(e).catch((e) => {
|
|
385
|
+
u = e;
|
|
356
386
|
});
|
|
357
387
|
}, (e) => {
|
|
358
|
-
|
|
388
|
+
l || p(e).catch((e) => {
|
|
389
|
+
u = e;
|
|
390
|
+
});
|
|
359
391
|
});
|
|
360
|
-
r.push(
|
|
361
|
-
let
|
|
362
|
-
|
|
392
|
+
r.push(h.cleanup);
|
|
393
|
+
let g = async (e) => {
|
|
394
|
+
if (l) return;
|
|
395
|
+
let r = h.getVisible();
|
|
363
396
|
if (t.reset) {
|
|
364
|
-
let a = await
|
|
397
|
+
let a = await f();
|
|
365
398
|
for (let o of r) {
|
|
366
399
|
let r = i.get(o);
|
|
367
|
-
|
|
368
|
-
await f(o);
|
|
369
|
-
continue;
|
|
370
|
-
}
|
|
371
|
-
await t.reset({
|
|
400
|
+
i.has(o) ? (await t.reset({
|
|
372
401
|
api: a,
|
|
373
402
|
widget: r,
|
|
374
403
|
placeholder: o,
|
|
@@ -376,55 +405,58 @@ function I(t) {
|
|
|
376
405
|
options: n.options,
|
|
377
406
|
provider: n.options.provider,
|
|
378
407
|
reason: e
|
|
379
|
-
}), n.services.tokens.clear(), n.services.errors.clear(o);
|
|
408
|
+
}), n.services.tokens.clear(), n.services.errors.clear(o)) : await m(o);
|
|
380
409
|
}
|
|
381
|
-
|
|
382
|
-
|
|
410
|
+
h.reconcile();
|
|
411
|
+
} else {
|
|
412
|
+
for (let e of Array.from(i.keys())) await p(e);
|
|
413
|
+
for (let e of r) await m(e);
|
|
414
|
+
h.reconcile();
|
|
383
415
|
}
|
|
384
|
-
for (let e of Array.from(i.keys())) await d(e);
|
|
385
|
-
for (let e of r) await f(e);
|
|
386
|
-
p.reconcile();
|
|
387
416
|
};
|
|
388
417
|
r.push(n.services.events.onRoot("formie:submit:result", (e) => {
|
|
389
418
|
let t = e instanceof CustomEvent ? e.detail : null;
|
|
390
|
-
t?.stage !== "validate" && (t?.ok !== !1 || t?.stage !== "challenge") && t?.ok !== !0 &&
|
|
419
|
+
t?.stage !== "validate" && (t?.ok !== !1 || t?.stage !== "challenge") && t?.ok !== !0 && g("submit-result");
|
|
391
420
|
})), n.form && r.push(n.services.events.onForm(e("reset"), () => {
|
|
392
|
-
|
|
393
|
-
|
|
421
|
+
c = n.services.placeholder.getPrimary() || c, window.setTimeout(() => {
|
|
422
|
+
g("reset-state");
|
|
394
423
|
}, 0);
|
|
395
|
-
}))
|
|
424
|
+
}));
|
|
425
|
+
let _ = () => s || (l = !0, s = (async () => {
|
|
426
|
+
r.forEach((e) => e()), await Promise.allSettled([...a.values()]);
|
|
427
|
+
let e = (await Promise.allSettled(/* @__PURE__ */ new Set([...o.values(), ...Array.from(i.keys(), p)]))).flatMap((e) => e.status === "rejected" ? [e.reason] : []);
|
|
428
|
+
if (e.length) throw AggregateError(e, "CAPTCHA widgets could not clean up.");
|
|
429
|
+
})(), s);
|
|
430
|
+
h.reconcileImmediate();
|
|
396
431
|
try {
|
|
397
|
-
if (await Promise.all([...a.values()]),
|
|
432
|
+
if (await Promise.all([...a.values()]), u) throw u;
|
|
398
433
|
} catch (e) {
|
|
399
|
-
throw
|
|
434
|
+
throw await _().catch((e) => {
|
|
435
|
+
N.warn("Captcha cleanup after failed setup.", { error: e });
|
|
436
|
+
}), e;
|
|
400
437
|
}
|
|
401
438
|
return {
|
|
402
439
|
assertReady: () => {
|
|
403
|
-
if (
|
|
404
|
-
},
|
|
405
|
-
destroy: async () => {
|
|
406
|
-
s = !0, r.forEach((e) => {
|
|
407
|
-
e();
|
|
408
|
-
});
|
|
409
|
-
for (let e of Array.from(i.keys())) await d(e);
|
|
440
|
+
if (u) throw u;
|
|
410
441
|
},
|
|
442
|
+
destroy: _,
|
|
411
443
|
beforeSubmit: async (e) => {
|
|
412
444
|
if (e.action !== "submit") return;
|
|
413
|
-
|
|
414
|
-
let r =
|
|
445
|
+
h.reconcileImmediate();
|
|
446
|
+
let r = h.getVisible();
|
|
415
447
|
if (r.length === 0) return;
|
|
416
|
-
let a = r.find((e) => e ===
|
|
417
|
-
await
|
|
418
|
-
let
|
|
419
|
-
if (!
|
|
448
|
+
let a = r.find((e) => e === c) || r[0];
|
|
449
|
+
await m(a), a = c || a, n.services.errors.clear(a);
|
|
450
|
+
let o = i.get(a);
|
|
451
|
+
if (!i.has(a)) {
|
|
420
452
|
let r = n.services.errors.getDefaultMessage();
|
|
421
453
|
n.services.errors.show(r, a), N.warn("Captcha widget unavailable at challenge stage.", { moduleId: t.moduleId }), e.abort(r);
|
|
422
454
|
return;
|
|
423
455
|
}
|
|
424
|
-
let
|
|
456
|
+
let s = await f();
|
|
425
457
|
await t.challenge({
|
|
426
|
-
api:
|
|
427
|
-
widget:
|
|
458
|
+
api: s,
|
|
459
|
+
widget: o,
|
|
428
460
|
placeholder: a,
|
|
429
461
|
services: n.services,
|
|
430
462
|
options: n.options,
|