@verbb/formie-browser 1.0.3 → 1.0.4
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 +8 -0
- package/dist/chunks/{address-finder-BjMuEiwF.js → address-finder-BU4roxT6.js} +2 -2
- package/dist/chunks/{bpoint-KudsBCo2.js → bpoint-uNg5j6rt.js} +1 -1
- package/dist/chunks/{calculations-DlGSkQ3W.js → calculations-C9t6Zop9.js} +2 -2
- package/dist/chunks/{captcha-eu-CterYFok.js → captcha-eu-BAPzHNts.js} +2 -2
- package/dist/chunks/{checkbox-radio-CBvgk3hR.js → checkbox-radio-CHeLNVIK.js} +39 -34
- package/dist/chunks/{conditions-DYy1-Hwt.js → conditions-DKxVCsjD.js} +2 -2
- package/dist/chunks/{date-picker-BlD--zfe.js → date-picker-B3iQ797Z.js} +2 -2
- package/dist/chunks/{eway-qwc-B5Us.js → eway-DCielIML.js} +2 -2
- package/dist/chunks/{file-upload-CIgHrXfp.js → file-upload-DP2TOUYV.js} +34 -34
- package/dist/chunks/{friendly-captcha-v1-EDFac33c.js → friendly-captcha-v1-DdlcGiFY.js} +1 -1
- package/dist/chunks/{friendly-captcha-v2-BDpSvFGR.js → friendly-captcha-v2-76w-YnFm.js} +1 -1
- package/dist/chunks/{go-cardless-DuDMVsnz.js → go-cardless-rwCkzbNK.js} +1 -1
- package/dist/chunks/{google-address-Bmjp01pH.js → google-address-BD8IZ86V.js} +2 -2
- package/dist/chunks/{hcaptcha-BTQ6An6g.js → hcaptcha-BNNTL6uf.js} +2 -2
- package/dist/chunks/{hidden-DbPdOxKb.js → hidden-CW6Rcf1N.js} +1 -1
- package/dist/chunks/{index-BcqwpPNE.js → index-D6npYxvr.js} +790 -681
- package/dist/chunks/{loqate-BdNGv93o.js → loqate-B-ZNS65B.js} +2 -2
- package/dist/chunks/{mollie-DFOjTuGX.js → mollie-BDAZ-1X4.js} +1 -1
- package/dist/chunks/{moneris-BbFfl-EL.js → moneris-B1b0uEtY.js} +1 -1
- package/dist/chunks/{opayo-CmgYa9ya.js → opayo-CC5hraHo.js} +2 -2
- package/dist/chunks/{paddle-BUi7w1_o.js → paddle-B4GmrDsq.js} +2 -2
- package/dist/chunks/{paypal-A-ePfh6k.js → paypal-BFS6XsIS.js} +2 -2
- package/dist/chunks/{payway-BqFCbhyo.js → payway-DekoJead.js} +2 -2
- package/dist/chunks/{phone-country-DPMiqk4L.js → phone-country-Cm5YUeXI.js} +2 -2
- package/dist/chunks/{place-kit-CX7tamAg.js → place-kit-DizZWV_e.js} +1 -1
- package/dist/chunks/{recaptcha-enterprise-DxF6cW95.js → recaptcha-enterprise-BbOvO7JZ.js} +2 -2
- package/dist/chunks/{recaptcha-shared-DhGcbiaq.js → recaptcha-shared-Dwg1eVFS.js} +2 -2
- package/dist/chunks/{recaptcha-v2-checkbox-R9EfbZ4k.js → recaptcha-v2-checkbox-SY3ti5iQ.js} +2 -2
- package/dist/chunks/{recaptcha-v2-invisible-DV9hswAp.js → recaptcha-v2-invisible-DSmQnn6c.js} +2 -2
- package/dist/chunks/{recaptcha-v3-V0xc-Edh.js → recaptcha-v3-DNh7YCnR.js} +2 -2
- package/dist/chunks/{repeater-DKUT6TGI.js → repeater-DM0vuFNQ.js} +2 -2
- package/dist/chunks/{rich-text-SH7KiaKH.js → rich-text-C8aGYp70.js} +1 -1
- package/dist/chunks/{scripts-D9N2d5rN.js → scripts-CKTFtxPO.js} +1 -1
- package/dist/chunks/{shared-BmntPmnW.js → shared--BU5CFoL.js} +1 -1
- package/dist/chunks/{signature-BA3tQsGT.js → signature-pFhZfH7d.js} +1 -1
- package/dist/chunks/{snaptcha-DV7p6J9k.js → snaptcha-VuOUOaLj.js} +1 -1
- package/dist/chunks/{square-Bs-ndqYK.js → square-BR9pvToy.js} +4 -4
- package/dist/chunks/{stripe-DkZAHxtn.js → stripe-OHUwoV9g.js} +2 -2
- package/dist/chunks/{summary-Dq2i9TQk.js → summary-Da7Ktg3N.js} +2 -2
- package/dist/chunks/{table-Cu4WfVcw.js → table-C0PmR9bI.js} +2 -2
- package/dist/chunks/text-limit-mLEwZDIa.js +144 -0
- package/dist/chunks/{turnstile-CId90tRr.js → turnstile-9tM7q_LK.js} +2 -2
- package/dist/index.js +9 -9
- package/dist/js/core/field-error-container.d.ts +4 -0
- package/dist/js/core/field-error-container.d.ts.map +1 -0
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
- package/dist/js/utils/i18n.d.ts.map +1 -1
- package/dist/js/validation/rules/email.d.ts.map +1 -1
- package/dist/js/validation/rules/number.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/js/core/field-error-container.ts +39 -0
- package/src/js/core/submit-result-state.ts +12 -2
- package/src/js/core/submit-result-ui.ts +3 -9
- package/src/js/modules/fields/checkbox-radio.ts +21 -15
- package/src/js/modules/fields/file-upload.ts +12 -9
- package/src/js/modules/fields/text-limit.ts +87 -22
- package/src/js/utils/i18n.ts +184 -5
- package/src/js/validation/rules/email.ts +3 -2
- package/src/js/validation/rules/match.ts +2 -2
- package/src/js/validation/rules/minmax.ts +4 -4
- package/src/js/validation/rules/number.ts +9 -5
- package/src/js/validation/rules/pattern.ts +4 -4
- package/src/js/validation/rules/required.ts +1 -1
- package/src/js/validation/rules/url.ts +1 -1
- package/src/js/validation/validator.ts +7 -7
- package/dist/chunks/text-limit-2ycmB-Ae.js +0 -135
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Dr = [
|
|
2
2
|
{ legacyEvent: "onFormieLoaded", canonicalEvent: "formie:mount:after", disposition: "approximate", target: "document" },
|
|
3
3
|
{ legacyEvent: "onFormieInit", canonicalEvent: "formie:mount:after", disposition: "approximate", target: "document" },
|
|
4
4
|
{ legacyEvent: "onFormieReady", canonicalEvent: "formie:mount:after", disposition: "safe" },
|
|
@@ -9,13 +9,13 @@ const _r = [
|
|
|
9
9
|
{ legacyEvent: "onFormieValidate", canonicalEvent: "formie:stage:validate:before", disposition: "approximate" },
|
|
10
10
|
{ legacyEvent: "onAfterFormieValidate", canonicalEvent: "formie:stage:validate:after", disposition: "approximate" },
|
|
11
11
|
{ legacyEvent: "onFormieSubmit", canonicalEvent: "formie:submit:after", disposition: "approximate" }
|
|
12
|
-
],
|
|
12
|
+
], oa = [
|
|
13
13
|
{ legacyEvent: "formieValidatorInitialized", canonicalEvent: "formie:validator:ready", disposition: "safe" },
|
|
14
14
|
{ legacyEvent: "formieValidatorDestroyed", canonicalEvent: "formie:validator:destroy", disposition: "safe" },
|
|
15
15
|
{ legacyEvent: "formieValidatorShowError", canonicalEvent: "formie:validator:show-error", disposition: "safe" },
|
|
16
16
|
{ legacyEvent: "formieValidatorClearError", canonicalEvent: "formie:validator:clear-error", disposition: "safe" }
|
|
17
17
|
];
|
|
18
|
-
function
|
|
18
|
+
function xr(e) {
|
|
19
19
|
if (!e)
|
|
20
20
|
return {
|
|
21
21
|
enabled: !1,
|
|
@@ -35,7 +35,7 @@ function Dr(e) {
|
|
|
35
35
|
legacyValidatorEvents: r
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const Nr = [
|
|
39
39
|
"formie:mount:after",
|
|
40
40
|
"formie:unmount:before",
|
|
41
41
|
"formie:unmount:after",
|
|
@@ -53,49 +53,49 @@ const xr = [
|
|
|
53
53
|
"formie:refresh-tokens:after",
|
|
54
54
|
"formie:refresh-tokens:refreshed"
|
|
55
55
|
];
|
|
56
|
-
function
|
|
56
|
+
function Be(e) {
|
|
57
57
|
return e;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function aa(e) {
|
|
60
60
|
return e;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function sa(e, t) {
|
|
63
63
|
return `formie:field:${e}:${t}`;
|
|
64
64
|
}
|
|
65
65
|
function pe(e) {
|
|
66
66
|
return `formie:validator:${e}`;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function la(e, t) {
|
|
69
69
|
return `formie:address:${e}:${t}`;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function ua(e) {
|
|
72
72
|
return `formie:file-upload:${e}`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function ca(e, t) {
|
|
75
75
|
return `formie:payment:${e}:${t}`;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function je(e) {
|
|
78
78
|
return `formie:state:${e}`;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function Ur(e, t) {
|
|
81
81
|
return `formie:module:${e}:${t}`;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Br(e) {
|
|
84
84
|
return `formie:module:${e}`;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function jr(e, t, r) {
|
|
87
87
|
e.dispatchEvent(new CustomEvent(t, {
|
|
88
88
|
bubbles: !0,
|
|
89
89
|
detail: r
|
|
90
90
|
}));
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function zr(e, t) {
|
|
93
93
|
if (e.canonicalEvent !== "formie:submit:result")
|
|
94
94
|
return !0;
|
|
95
95
|
const r = t;
|
|
96
96
|
return e.legacyEvent === "onAfterFormieSubmit" ? !!r?.ok : e.legacyEvent === "onFormieSubmitError" ? r?.ok === !1 : !0;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Wr(e, t) {
|
|
99
99
|
const r = t && typeof t == "object" ? t : {}, n = typeof r.pageId == "string" ? r.pageId : "", i = Array.from(e.querySelectorAll("[data-formie-page-id]")), o = i.findIndex((a) => a.getAttribute("data-formie-page-id") === n);
|
|
100
100
|
return {
|
|
101
101
|
data: {
|
|
@@ -105,7 +105,7 @@ function jr(e, t) {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Kr(e, t, r, n, i) {
|
|
109
109
|
const o = globalThis.Formie || i;
|
|
110
110
|
return e.legacyEvent === "onFormieLoaded" ? {
|
|
111
111
|
formie: o
|
|
@@ -119,24 +119,24 @@ function Wr(e, t, r, n, i) {
|
|
|
119
119
|
form: n,
|
|
120
120
|
target: r,
|
|
121
121
|
instance: i
|
|
122
|
-
} : e.legacyEvent === "onFormiePageToggle" ?
|
|
122
|
+
} : e.legacyEvent === "onFormiePageToggle" ? Wr(n, t) : t;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Gr({
|
|
125
125
|
target: e,
|
|
126
126
|
form: t,
|
|
127
127
|
instance: r,
|
|
128
128
|
options: n,
|
|
129
129
|
unbinds: i
|
|
130
130
|
}) {
|
|
131
|
-
n.legacyDomEvents &&
|
|
131
|
+
n.legacyDomEvents && Dr.forEach((o) => {
|
|
132
132
|
const a = (s) => {
|
|
133
|
-
if (!(s instanceof CustomEvent) || !
|
|
133
|
+
if (!(s instanceof CustomEvent) || !zr(o, s.detail))
|
|
134
134
|
return;
|
|
135
135
|
const l = o.target === "document" ? document : t;
|
|
136
|
-
|
|
136
|
+
jr(l, o.legacyEvent, Kr(o, s.detail, e, t, r));
|
|
137
137
|
};
|
|
138
|
-
e.addEventListener(
|
|
139
|
-
e.removeEventListener(
|
|
138
|
+
e.addEventListener(Be(o.canonicalEvent), a), i.push(() => {
|
|
139
|
+
e.removeEventListener(Be(o.canonicalEvent), a);
|
|
140
140
|
});
|
|
141
141
|
});
|
|
142
142
|
}
|
|
@@ -146,10 +146,10 @@ function ge(e, t, r) {
|
|
|
146
146
|
detail: r
|
|
147
147
|
}));
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function Oe(e, t) {
|
|
150
150
|
return !!e && typeof e == "object" && e.validator === t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Jr({
|
|
153
153
|
target: e,
|
|
154
154
|
form: t,
|
|
155
155
|
validatorDetail: r,
|
|
@@ -165,12 +165,12 @@ function Gr({
|
|
|
165
165
|
};
|
|
166
166
|
ge(document, "formieValidatorInitialized", l);
|
|
167
167
|
const d = (u) => {
|
|
168
|
-
!(u instanceof CustomEvent) ||
|
|
168
|
+
!(u instanceof CustomEvent) || !Oe(u.detail, o) || ge(document, "formieValidatorDestroyed", {
|
|
169
169
|
...l,
|
|
170
170
|
...u.detail
|
|
171
171
|
});
|
|
172
172
|
}, p = (u) => {
|
|
173
|
-
!(u instanceof CustomEvent) ||
|
|
173
|
+
!(u instanceof CustomEvent) || !Oe(u.detail, o) || !(u.target instanceof Element) || t.contains(u.target) && ge(u.target, "formieValidatorShowError", {
|
|
174
174
|
...u.detail,
|
|
175
175
|
addValidator: a,
|
|
176
176
|
removeValidator: s,
|
|
@@ -178,7 +178,7 @@ function Gr({
|
|
|
178
178
|
target: e
|
|
179
179
|
});
|
|
180
180
|
}, h = (u) => {
|
|
181
|
-
!(u instanceof CustomEvent) ||
|
|
181
|
+
!(u instanceof CustomEvent) || !Oe(u.detail, o) || !(u.target instanceof Element) || t.contains(u.target) && ge(u.target, "formieValidatorClearError", {
|
|
182
182
|
...u.detail,
|
|
183
183
|
addValidator: a,
|
|
184
184
|
removeValidator: s,
|
|
@@ -191,21 +191,21 @@ function Gr({
|
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
function I(e, t, r) {
|
|
194
|
-
e.dispatchEvent(new CustomEvent(
|
|
194
|
+
e.dispatchEvent(new CustomEvent(Be(t), {
|
|
195
195
|
bubbles: !0,
|
|
196
196
|
detail: r
|
|
197
197
|
}));
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function zt() {
|
|
200
200
|
return globalThis;
|
|
201
201
|
}
|
|
202
202
|
function Wt() {
|
|
203
|
-
return
|
|
203
|
+
return zt().__FORMIE_DEBUG__ === !0;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
|
|
205
|
+
function da(e) {
|
|
206
|
+
zt().__FORMIE_DEBUG__ = e;
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function Yr(e, t, r) {
|
|
209
209
|
if (Wt()) {
|
|
210
210
|
if (typeof r > "u") {
|
|
211
211
|
console.log(`[formie:${e}] ${t}`);
|
|
@@ -214,7 +214,7 @@ function Jr(e, t, r) {
|
|
|
214
214
|
console.log(`[formie:${e}] ${t}`, r);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function Zr(e, t, r) {
|
|
218
218
|
if (Wt()) {
|
|
219
219
|
if (typeof r > "u") {
|
|
220
220
|
console.warn(`[formie:${e}] ${t}`);
|
|
@@ -227,25 +227,25 @@ function _(e, t) {
|
|
|
227
227
|
const r = t ? `${e}:${t}` : e;
|
|
228
228
|
return {
|
|
229
229
|
log: (n, i) => {
|
|
230
|
-
|
|
230
|
+
Yr(r, n, i);
|
|
231
231
|
},
|
|
232
232
|
warn: (n, i) => {
|
|
233
|
-
|
|
233
|
+
Zr(r, n, i);
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
-
const Ee = _("general", "page-client-event"),
|
|
238
|
-
function
|
|
237
|
+
const Ee = _("general", "page-client-event"), Qr = "data-formie-client-event";
|
|
238
|
+
function Xr(e) {
|
|
239
239
|
return typeof window < "u" && window.CSS?.escape ? window.CSS.escape(e) : e.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function en(e) {
|
|
242
242
|
const r = e.querySelector('input[name="pageId"]')?.value?.trim();
|
|
243
243
|
if (r)
|
|
244
244
|
return r;
|
|
245
245
|
const i = e.querySelector("[data-formie-page]:not([data-formie-page-hidden])")?.getAttribute("data-formie-page-id")?.trim();
|
|
246
246
|
return i || e.querySelector("[data-formie-page]")?.getAttribute("data-formie-page-id")?.trim() || null;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function tn(e) {
|
|
249
249
|
if (!e?.trim())
|
|
250
250
|
return null;
|
|
251
251
|
try {
|
|
@@ -257,7 +257,7 @@ function en(e) {
|
|
|
257
257
|
}), null;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function rn(e) {
|
|
261
261
|
const t = {};
|
|
262
262
|
return e.forEach((r) => {
|
|
263
263
|
const n = typeof r.label == "string" ? r.label.trim() : "";
|
|
@@ -267,25 +267,25 @@ function tn(e) {
|
|
|
267
267
|
function Kt(e, t) {
|
|
268
268
|
if (t !== "submit")
|
|
269
269
|
return;
|
|
270
|
-
const r =
|
|
270
|
+
const r = en(e);
|
|
271
271
|
if (!r) {
|
|
272
272
|
Ee.log("No submitted page id; skipping client event.");
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
275
|
const n = e.querySelector(
|
|
276
|
-
`[data-formie-page][data-formie-page-id="${
|
|
276
|
+
`[data-formie-page][data-formie-page-id="${Xr(r)}"]`
|
|
277
277
|
);
|
|
278
278
|
if (!n) {
|
|
279
279
|
Ee.log("No page section for id; skipping client event.", { pageId: r });
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
|
-
const i = n.getAttribute(
|
|
282
|
+
const i = n.getAttribute(Qr);
|
|
283
283
|
if (i === null)
|
|
284
284
|
return;
|
|
285
|
-
const o =
|
|
285
|
+
const o = tn(i);
|
|
286
286
|
if (!o || !Array.isArray(o.fields))
|
|
287
287
|
return;
|
|
288
|
-
const a =
|
|
288
|
+
const a = rn(o.fields), s = window;
|
|
289
289
|
s.dataLayer = s.dataLayer || [], s.dataLayer.push(a), e.dispatchEvent(new CustomEvent("formie:client-event", {
|
|
290
290
|
bubbles: !0,
|
|
291
291
|
detail: { payload: a }
|
|
@@ -294,37 +294,37 @@ function Kt(e, t) {
|
|
|
294
294
|
keys: Object.keys(a)
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
const we = /* @__PURE__ */ new WeakMap(),
|
|
298
|
-
function
|
|
297
|
+
const we = /* @__PURE__ */ new WeakMap(), nn = "[data-formie-form], [data-formie], form";
|
|
298
|
+
function on(e) {
|
|
299
299
|
return e ? (Array.isArray(e) ? e : [e]).flatMap((r) => String(r).split(/\s+/)).map((r) => r.trim()).filter(Boolean) : [];
|
|
300
300
|
}
|
|
301
301
|
function tt(e) {
|
|
302
302
|
return Array.from(new Set(e));
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function an(e) {
|
|
305
305
|
if (!e)
|
|
306
306
|
return {};
|
|
307
307
|
const t = we.get(e);
|
|
308
308
|
if (t)
|
|
309
309
|
return t;
|
|
310
|
-
const r = e.closest(
|
|
310
|
+
const r = e.closest(nn);
|
|
311
311
|
return r ? we.get(r) || {} : {};
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function sn(e) {
|
|
314
314
|
const t = {};
|
|
315
315
|
return Object.entries(e || {}).forEach(([r, n]) => {
|
|
316
|
-
const i = tt(
|
|
316
|
+
const i = tt(on(n));
|
|
317
317
|
i.length && (t[r] = i);
|
|
318
318
|
}), t;
|
|
319
319
|
}
|
|
320
320
|
function yt(e, t, r) {
|
|
321
|
-
const n =
|
|
321
|
+
const n = sn(t), i = r || (e instanceof HTMLFormElement ? e : e.querySelector("form"));
|
|
322
322
|
return we.set(e, n), i && we.set(i, n), n;
|
|
323
323
|
}
|
|
324
324
|
function rt(e, t) {
|
|
325
|
-
return
|
|
325
|
+
return an(e)[t] || [];
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function O(e, t, ...r) {
|
|
328
328
|
const n = tt(r.flatMap((i) => rt(t, i)));
|
|
329
329
|
n.length && e.classList.add(...n);
|
|
330
330
|
}
|
|
@@ -337,7 +337,7 @@ function ue(e, t, r, n) {
|
|
|
337
337
|
e.classList.toggle(i, n);
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function ln(e, t) {
|
|
341
341
|
if (ue(e, e, "tabError", t), t) {
|
|
342
342
|
e.setAttribute("data-formie-tab-error", "true");
|
|
343
343
|
return;
|
|
@@ -351,7 +351,7 @@ function J(e) {
|
|
|
351
351
|
i && n.querySelector("[data-formie-field-has-error]") && t.add(i);
|
|
352
352
|
}), e.querySelectorAll("[data-formie-tab]").forEach((r) => {
|
|
353
353
|
const n = r, i = n.getAttribute("data-formie-page-id");
|
|
354
|
-
|
|
354
|
+
ln(n, !!i && t.has(i));
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
357
|
class Gt {
|
|
@@ -432,20 +432,20 @@ async function Jt(e, t = {}) {
|
|
|
432
432
|
credentials: "same-origin"
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
async function
|
|
435
|
+
async function Re(e, t = {}) {
|
|
436
436
|
const r = await Jt(e, t);
|
|
437
437
|
if (!r.ok)
|
|
438
438
|
throw new Error(`Request failed (${r.status}) for ${String(e)}`);
|
|
439
439
|
return r.json();
|
|
440
440
|
}
|
|
441
|
-
async function
|
|
441
|
+
async function fa(e, t = {}) {
|
|
442
442
|
const r = await Jt(e, t);
|
|
443
443
|
if (!r.ok)
|
|
444
444
|
throw new Error(`Request failed (${r.status}) for ${String(e)}`);
|
|
445
445
|
return r.text();
|
|
446
446
|
}
|
|
447
|
-
const
|
|
448
|
-
function
|
|
447
|
+
const H = _("general", "transport");
|
|
448
|
+
function un(e) {
|
|
449
449
|
const t = {};
|
|
450
450
|
return ["theme", "themeConfig", "locale", "siteId"].forEach((r) => {
|
|
451
451
|
e[r] !== void 0 && (t[r] = e[r]);
|
|
@@ -461,7 +461,7 @@ function Yt(e, t = "", r = {}) {
|
|
|
461
461
|
Yt(i, o, r);
|
|
462
462
|
}), r;
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function cn(e, t) {
|
|
465
465
|
const r = e.success === !0, n = e.keepSubmitLoading === !0, i = e.errors, o = Yt(i || {}), a = o.form || [], s = {};
|
|
466
466
|
Object.entries(o).forEach(([h, u]) => {
|
|
467
467
|
if (h === "form")
|
|
@@ -489,24 +489,24 @@ function un(e, t) {
|
|
|
489
489
|
meta: e
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
|
-
async function
|
|
492
|
+
async function dn(e, t, r = {}) {
|
|
493
493
|
const n = JSON.stringify({
|
|
494
494
|
handle: t,
|
|
495
495
|
renderOptions: r
|
|
496
496
|
});
|
|
497
|
-
|
|
498
|
-
const i = await
|
|
497
|
+
H.log("requestRender start.", { endpoint: e, handle: t });
|
|
498
|
+
const i = await Re(e, {
|
|
499
499
|
method: "POST",
|
|
500
500
|
body: n,
|
|
501
501
|
headers: {
|
|
502
502
|
"Content-Type": "application/json"
|
|
503
503
|
}
|
|
504
504
|
});
|
|
505
|
-
return
|
|
505
|
+
return H.log("requestRender complete.", {
|
|
506
506
|
hasHtml: !!i.html
|
|
507
507
|
}), i;
|
|
508
508
|
}
|
|
509
|
-
async function
|
|
509
|
+
async function fn(e, t, r = {}) {
|
|
510
510
|
const i = JSON.stringify({
|
|
511
511
|
query: `
|
|
512
512
|
query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
|
|
@@ -516,11 +516,11 @@ query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
|
|
|
516
516
|
}`,
|
|
517
517
|
variables: {
|
|
518
518
|
handle: t,
|
|
519
|
-
input:
|
|
519
|
+
input: un(r)
|
|
520
520
|
}
|
|
521
521
|
});
|
|
522
|
-
|
|
523
|
-
const o = await
|
|
522
|
+
H.log("requestGraphqlRender start.", { endpoint: e, handle: t });
|
|
523
|
+
const o = await Re(e, {
|
|
524
524
|
method: "POST",
|
|
525
525
|
body: i,
|
|
526
526
|
headers: {
|
|
@@ -532,23 +532,23 @@ query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
|
|
|
532
532
|
if (!o.data?.formieHtmlForm)
|
|
533
533
|
throw new Error(`Form not found for handle "${t}".`);
|
|
534
534
|
const a = o.data.formieHtmlForm;
|
|
535
|
-
return
|
|
535
|
+
return H.log("requestGraphqlRender complete.", {
|
|
536
536
|
hasHtml: !!a.html
|
|
537
537
|
}), a;
|
|
538
538
|
}
|
|
539
539
|
async function nt(e, t, r) {
|
|
540
540
|
const n = new URL(e, window.location.origin);
|
|
541
|
-
n.searchParams.set("handle", t), r && n.searchParams.set("renderId", r),
|
|
541
|
+
n.searchParams.set("handle", t), r && n.searchParams.set("renderId", r), H.log("requestRefreshTokens start.", {
|
|
542
542
|
endpoint: n.toString(),
|
|
543
543
|
handle: t,
|
|
544
544
|
hasRenderId: !!r
|
|
545
545
|
});
|
|
546
|
-
const i = await
|
|
547
|
-
return
|
|
546
|
+
const i = await Re(n.toString());
|
|
547
|
+
return H.log("requestRefreshTokens complete.", {
|
|
548
548
|
hasRefreshTokens: !!i.refreshTokens
|
|
549
549
|
}), i.refreshTokens || i;
|
|
550
550
|
}
|
|
551
|
-
async function
|
|
551
|
+
async function mn(e, t, r) {
|
|
552
552
|
const n = new URL(e, window.location.origin), i = new FormData();
|
|
553
553
|
if (r && i.append("pageId", r), t) {
|
|
554
554
|
["handle", "renderId", "draftContextToken", "draftContext", "continuationToken"].forEach((d) => {
|
|
@@ -558,24 +558,24 @@ async function fn(e, t, r) {
|
|
|
558
558
|
const l = t.querySelector('input[name="CRAFT_CSRF_TOKEN"]')?.value?.trim();
|
|
559
559
|
l && i.append("CRAFT_CSRF_TOKEN", l);
|
|
560
560
|
}
|
|
561
|
-
|
|
561
|
+
H.log("requestSetPage start.", {
|
|
562
562
|
requestUrl: n.toString(),
|
|
563
563
|
pageId: r || null
|
|
564
564
|
});
|
|
565
|
-
const o = await
|
|
565
|
+
const o = await Re(n.toString(), {
|
|
566
566
|
method: "POST",
|
|
567
567
|
body: i
|
|
568
568
|
});
|
|
569
|
-
return
|
|
569
|
+
return H.log("requestSetPage complete.", o), o;
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function pn(e, t) {
|
|
572
572
|
const r = new URL(e, window.location.origin), n = new FormData();
|
|
573
573
|
["handle", "renderId", "draftContextToken", "draftContext"].forEach((s) => {
|
|
574
574
|
const d = t.querySelector(`input[name="${s}"]`)?.value?.trim();
|
|
575
575
|
d && n.append(s, d);
|
|
576
576
|
});
|
|
577
577
|
const a = t.querySelector('input[name="CRAFT_CSRF_TOKEN"]')?.value?.trim();
|
|
578
|
-
a && n.append("CRAFT_CSRF_TOKEN", a),
|
|
578
|
+
a && n.append("CRAFT_CSRF_TOKEN", a), H.log("clearSubmissionOnUnload start.", {
|
|
579
579
|
requestUrl: r.toString()
|
|
580
580
|
});
|
|
581
581
|
try {
|
|
@@ -593,9 +593,9 @@ function mn(e, t) {
|
|
|
593
593
|
}
|
|
594
594
|
});
|
|
595
595
|
}
|
|
596
|
-
async function
|
|
596
|
+
async function gn(e, t) {
|
|
597
597
|
const r = (e.getAttribute("method") || "POST").toUpperCase(), n = e.getAttribute("action") || window.location.href, i = e.dataset.formieErrorMessage?.trim() || "Submission failed.";
|
|
598
|
-
|
|
598
|
+
H.log("submitForm start.", {
|
|
599
599
|
method: r,
|
|
600
600
|
action: n,
|
|
601
601
|
submitAction: t.get("submitAction")
|
|
@@ -609,13 +609,13 @@ async function pn(e, t) {
|
|
|
609
609
|
}
|
|
610
610
|
}), a = o.headers.get("content-type") || "";
|
|
611
611
|
if (!a.includes("application/json"))
|
|
612
|
-
return o.ok ? (
|
|
612
|
+
return o.ok ? (H.log("submitForm non-JSON success response.", {
|
|
613
613
|
status: o.status,
|
|
614
614
|
contentType: a
|
|
615
615
|
}), {
|
|
616
616
|
ok: !0,
|
|
617
617
|
message: "Submission completed."
|
|
618
|
-
}) : (
|
|
618
|
+
}) : (H.warn("submitForm non-JSON HTTP error.", {
|
|
619
619
|
status: o.status,
|
|
620
620
|
contentType: a
|
|
621
621
|
}), {
|
|
@@ -624,8 +624,8 @@ async function pn(e, t) {
|
|
|
624
624
|
message: `Request failed (${o.status}).`,
|
|
625
625
|
formErrors: [`Request failed (${o.status}).`]
|
|
626
626
|
});
|
|
627
|
-
const s = await o.json(), l =
|
|
628
|
-
return
|
|
627
|
+
const s = await o.json(), l = cn(s, i);
|
|
628
|
+
return H.log("submitForm JSON response normalized.", {
|
|
629
629
|
ok: l.ok,
|
|
630
630
|
code: l.code,
|
|
631
631
|
hasRedirect: !!l.redirect?.url,
|
|
@@ -648,8 +648,8 @@ function Zt(e) {
|
|
|
648
648
|
final: r === t[t.length - 1]
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
|
-
const
|
|
652
|
-
function
|
|
651
|
+
const hn = ["prepare", "normalize", "validate", "screen", "authorize", "dispatch", "finalize"], bn = ["prepare", "normalize", "validate", "screen", "authorize"], F = _("general", "pipeline");
|
|
652
|
+
function $e(e, t) {
|
|
653
653
|
return {
|
|
654
654
|
ok: !1,
|
|
655
655
|
stage: e,
|
|
@@ -683,20 +683,20 @@ function er(e, t) {
|
|
|
683
683
|
}
|
|
684
684
|
e.append(t.name, t.value);
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function yn(e, t) {
|
|
687
687
|
t.querySelectorAll("input, select, textarea").forEach((r) => {
|
|
688
688
|
const n = Qt(r) ? r : null;
|
|
689
689
|
!n || n.closest("[data-formie-page]") || Xt(n) && er(e, n);
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function vn(e, t) {
|
|
693
693
|
const r = /* @__PURE__ */ new Set();
|
|
694
694
|
return t.querySelectorAll("input, select, textarea").forEach((n) => {
|
|
695
695
|
const i = Qt(n) ? n : null;
|
|
696
696
|
!i || !i.name || i.disabled || i instanceof HTMLInputElement && (i.type === "submit" || i.type === "button" || i.type === "reset" || i.type === "image") || (i.name.startsWith("fields[") && r.add(i.name), Xt(i) && er(e, i));
|
|
697
697
|
}), r;
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function En(e, t) {
|
|
700
700
|
t.forEach((r) => {
|
|
701
701
|
e.has(r) || e.append(r, "");
|
|
702
702
|
});
|
|
@@ -708,28 +708,28 @@ function vt(e, t) {
|
|
|
708
708
|
return a.set("submitAction", t), a;
|
|
709
709
|
}
|
|
710
710
|
const i = new FormData();
|
|
711
|
-
|
|
712
|
-
const o =
|
|
713
|
-
return
|
|
711
|
+
yn(i, e);
|
|
712
|
+
const o = vn(i, n);
|
|
713
|
+
return En(i, o), i.set("submitAction", t), i;
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function Sn(e, t) {
|
|
716
716
|
if (t !== "submit")
|
|
717
717
|
return !1;
|
|
718
718
|
const r = it(e);
|
|
719
719
|
return r.length ? (r.find((i) => !i.hasAttribute("data-formie-page-hidden")) || r[r.length - 1]) === r[r.length - 1] : !0;
|
|
720
720
|
}
|
|
721
721
|
async function tr(e, t, r, n = {}) {
|
|
722
|
-
|
|
722
|
+
F.log("Starting submit pipeline.", {
|
|
723
723
|
action: t,
|
|
724
724
|
preflightOnly: n.preflightOnly === !0
|
|
725
725
|
});
|
|
726
726
|
let i = !1, o, a = null;
|
|
727
|
-
const s =
|
|
727
|
+
const s = Sn(e, t), l = {
|
|
728
728
|
form: e,
|
|
729
729
|
action: t,
|
|
730
730
|
formData: vt(e, t),
|
|
731
731
|
abort: (u) => {
|
|
732
|
-
i = !0, o = u,
|
|
732
|
+
i = !0, o = u, F.warn("Pipeline aborted.", { reason: u });
|
|
733
733
|
},
|
|
734
734
|
isAborted: () => i,
|
|
735
735
|
abortReason: () => o
|
|
@@ -765,59 +765,59 @@ async function tr(e, t, r, n = {}) {
|
|
|
765
765
|
authorize: async () => null,
|
|
766
766
|
dispatch: async (u) => {
|
|
767
767
|
u.formData = vt(u.form, u.action);
|
|
768
|
-
const c = await
|
|
768
|
+
const c = await gn(u.form, u.formData);
|
|
769
769
|
return a = c, c;
|
|
770
770
|
},
|
|
771
771
|
finalize: async (u) => (a && a.ok && a.redirect?.url && (a.redirect.target === "new-tab" ? window.open(a.redirect.url, "_blank") : window.location.href = a.redirect.url), null)
|
|
772
772
|
};
|
|
773
773
|
{
|
|
774
774
|
const u = await r.emitSafe("formie:submit:before", l);
|
|
775
|
-
u.failed.length > 0 &&
|
|
775
|
+
u.failed.length > 0 && F.warn("Submit before listeners failed.", {
|
|
776
776
|
eventName: u.eventName,
|
|
777
777
|
failed: u.failed.length
|
|
778
778
|
});
|
|
779
779
|
}
|
|
780
780
|
if (s) {
|
|
781
781
|
const u = await r.emitSafe("formie:submit:final:before", l);
|
|
782
|
-
u.failed.length > 0 &&
|
|
782
|
+
u.failed.length > 0 && F.warn("Final submit before listeners failed.", {
|
|
783
783
|
eventName: u.eventName,
|
|
784
784
|
failed: u.failed.length
|
|
785
785
|
});
|
|
786
786
|
}
|
|
787
|
-
const p = n.preflightOnly ?
|
|
787
|
+
const p = n.preflightOnly ? bn : hn;
|
|
788
788
|
for (const u of p) {
|
|
789
|
-
if (
|
|
790
|
-
return
|
|
789
|
+
if (F.log("Stage start.", { stage: u, action: t }), i)
|
|
790
|
+
return F.warn("Stage skipped due to abort.", { stage: u, reason: o }), $e(u, o);
|
|
791
791
|
{
|
|
792
792
|
const b = await r.emitSafe(`formie:stage:${u}:before`, {
|
|
793
793
|
...l,
|
|
794
794
|
stage: u
|
|
795
795
|
});
|
|
796
|
-
b.failed.length > 0 &&
|
|
796
|
+
b.failed.length > 0 && F.warn("Stage before listeners failed.", {
|
|
797
797
|
stage: u,
|
|
798
798
|
failed: b.failed.length
|
|
799
799
|
});
|
|
800
800
|
}
|
|
801
801
|
if (i) {
|
|
802
|
-
const b =
|
|
802
|
+
const b = $e(u, o);
|
|
803
803
|
{
|
|
804
804
|
const A = await r.emitSafe("formie:submit:after", b);
|
|
805
|
-
A.failed.length > 0 &&
|
|
805
|
+
A.failed.length > 0 && F.warn("Submit after listeners failed (abort before stage).", {
|
|
806
806
|
stage: u,
|
|
807
807
|
failed: A.failed.length
|
|
808
808
|
});
|
|
809
809
|
}
|
|
810
810
|
if (s) {
|
|
811
811
|
const A = await r.emitSafe("formie:submit:final:after", b);
|
|
812
|
-
A.failed.length > 0 &&
|
|
812
|
+
A.failed.length > 0 && F.warn("Final submit after listeners failed (abort before stage).", {
|
|
813
813
|
stage: u,
|
|
814
814
|
failed: A.failed.length
|
|
815
815
|
});
|
|
816
816
|
}
|
|
817
|
-
return
|
|
817
|
+
return F.warn("Aborted after stage before-hooks.", { stage: u, reason: o }), b;
|
|
818
818
|
}
|
|
819
819
|
const c = await d[u](l);
|
|
820
|
-
|
|
820
|
+
F.log("Stage runner complete.", {
|
|
821
821
|
stage: u,
|
|
822
822
|
hasResult: !!c,
|
|
823
823
|
ok: c ? c.ok : void 0,
|
|
@@ -829,45 +829,45 @@ async function tr(e, t, r, n = {}) {
|
|
|
829
829
|
stage: u,
|
|
830
830
|
result: c
|
|
831
831
|
});
|
|
832
|
-
b.failed.length > 0 &&
|
|
832
|
+
b.failed.length > 0 && F.warn("Stage after listeners failed.", {
|
|
833
833
|
stage: u,
|
|
834
834
|
failed: b.failed.length
|
|
835
835
|
});
|
|
836
836
|
}
|
|
837
837
|
if (i) {
|
|
838
|
-
const b =
|
|
838
|
+
const b = $e(u, o);
|
|
839
839
|
{
|
|
840
840
|
const A = await r.emitSafe("formie:submit:after", b);
|
|
841
|
-
A.failed.length > 0 &&
|
|
841
|
+
A.failed.length > 0 && F.warn("Submit after listeners failed (abort after stage).", {
|
|
842
842
|
stage: u,
|
|
843
843
|
failed: A.failed.length
|
|
844
844
|
});
|
|
845
845
|
}
|
|
846
846
|
if (s) {
|
|
847
847
|
const A = await r.emitSafe("formie:submit:final:after", b);
|
|
848
|
-
A.failed.length > 0 &&
|
|
848
|
+
A.failed.length > 0 && F.warn("Final submit after listeners failed (abort after stage).", {
|
|
849
849
|
stage: u,
|
|
850
850
|
failed: A.failed.length
|
|
851
851
|
});
|
|
852
852
|
}
|
|
853
|
-
return
|
|
853
|
+
return F.warn("Aborted after stage after-hooks.", { stage: u, reason: o }), b;
|
|
854
854
|
}
|
|
855
855
|
if (c && !c.ok) {
|
|
856
856
|
{
|
|
857
857
|
const b = await r.emitSafe("formie:submit:after", c);
|
|
858
|
-
b.failed.length > 0 &&
|
|
858
|
+
b.failed.length > 0 && F.warn("Submit after listeners failed (failed stage).", {
|
|
859
859
|
stage: u,
|
|
860
860
|
failed: b.failed.length
|
|
861
861
|
});
|
|
862
862
|
}
|
|
863
863
|
if (s) {
|
|
864
864
|
const b = await r.emitSafe("formie:submit:final:after", c);
|
|
865
|
-
b.failed.length > 0 &&
|
|
865
|
+
b.failed.length > 0 && F.warn("Final submit after listeners failed (failed stage).", {
|
|
866
866
|
stage: u,
|
|
867
867
|
failed: b.failed.length
|
|
868
868
|
});
|
|
869
869
|
}
|
|
870
|
-
return
|
|
870
|
+
return F.warn("Pipeline short-circuited by failed stage.", {
|
|
871
871
|
stage: u,
|
|
872
872
|
code: c.code,
|
|
873
873
|
message: c.message
|
|
@@ -881,27 +881,37 @@ async function tr(e, t, r, n = {}) {
|
|
|
881
881
|
};
|
|
882
882
|
{
|
|
883
883
|
const u = await r.emitSafe("formie:submit:after", h);
|
|
884
|
-
u.failed.length > 0 &&
|
|
884
|
+
u.failed.length > 0 && F.warn("Submit after listeners failed (success).", {
|
|
885
885
|
failed: u.failed.length
|
|
886
886
|
});
|
|
887
887
|
}
|
|
888
888
|
if (s) {
|
|
889
889
|
const u = await r.emitSafe("formie:submit:final:after", h);
|
|
890
|
-
u.failed.length > 0 &&
|
|
890
|
+
u.failed.length > 0 && F.warn("Final submit after listeners failed (success).", {
|
|
891
891
|
failed: u.failed.length
|
|
892
892
|
});
|
|
893
893
|
}
|
|
894
|
-
return
|
|
894
|
+
return F.log("Pipeline completed.", {
|
|
895
895
|
ok: h.ok,
|
|
896
896
|
stage: h.stage,
|
|
897
897
|
code: h.code
|
|
898
898
|
}), h;
|
|
899
899
|
}
|
|
900
|
-
|
|
900
|
+
function An(e) {
|
|
901
|
+
return e.querySelector("[data-formie-field-layout]")?.getAttribute("data-formie-error-position")?.trim() === "above" ? "above" : "below";
|
|
902
|
+
}
|
|
903
|
+
function rr(e, t) {
|
|
904
|
+
const r = e.querySelector("[data-formie-field-errors]");
|
|
905
|
+
if (r)
|
|
906
|
+
return r;
|
|
907
|
+
const n = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), o = An(e), a = document.createElement("div");
|
|
908
|
+
return a.setAttribute("data-formie-field-errors", "true"), t?.(a), n && i ? o === "above" ? n.insertBefore(a, i) : n.appendChild(a) : e.appendChild(a), a;
|
|
909
|
+
}
|
|
910
|
+
const wn = {
|
|
901
911
|
rule: ({ input: e, getRule: t }) => !t("email") || !e.value || e.value.length < 1 ? !0 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.value),
|
|
902
|
-
message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-pattern-email-message") ?? e.getAttribute("data-pattern-email-message") ?? r("{
|
|
912
|
+
message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-validation-email-message") ?? e.getAttribute("data-formie-pattern-email-message") ?? e.getAttribute("data-pattern-email-message") ?? r("{label} is not a valid email address.", { label: t })
|
|
903
913
|
};
|
|
904
|
-
function
|
|
914
|
+
function Tn(e) {
|
|
905
915
|
return e?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() || "";
|
|
906
916
|
}
|
|
907
917
|
function Et(e) {
|
|
@@ -914,19 +924,19 @@ function Et(e) {
|
|
|
914
924
|
const n = e.form.querySelector(`[data-formie-field-handle="${r}"]`);
|
|
915
925
|
return n ? n.querySelector(e.config.fieldsSelector) : null;
|
|
916
926
|
}
|
|
917
|
-
const
|
|
927
|
+
const Mn = {
|
|
918
928
|
rule: (e) => {
|
|
919
929
|
const t = Et(e);
|
|
920
930
|
return t ? t.value === e.input.value : !0;
|
|
921
931
|
},
|
|
922
932
|
message: (e) => {
|
|
923
|
-
const r = Et(e)?.closest("[data-formie-field-handle]"), n =
|
|
924
|
-
return e.t("{
|
|
925
|
-
|
|
933
|
+
const r = Et(e)?.closest("[data-formie-field-handle]"), n = Tn(r);
|
|
934
|
+
return e.t("{label} must match {value}.", {
|
|
935
|
+
label: e.label,
|
|
926
936
|
value: n
|
|
927
937
|
});
|
|
928
938
|
}
|
|
929
|
-
},
|
|
939
|
+
}, Cn = {
|
|
930
940
|
rule: ({ input: e, getRule: t }) => {
|
|
931
941
|
const r = t("number");
|
|
932
942
|
if (!r || !e.value || e.value.trim() === "")
|
|
@@ -943,9 +953,9 @@ const wn = {
|
|
|
943
953
|
},
|
|
944
954
|
message: ({ input: e, label: t, getRule: r, t: n }) => {
|
|
945
955
|
const i = r("number"), o = i !== !0 && i && typeof i == "object" && typeof i.min == "number" ? i.min : null, a = i !== !0 && i && typeof i == "object" && typeof i.max == "number" ? i.max : null;
|
|
946
|
-
return o !== null && a !== null ? n("{
|
|
956
|
+
return o !== null && a !== null ? e.getAttribute("data-formie-validation-number-min-message") ?? n("{label} must be between {min} and {max}.", { label: t, min: o, max: a }) : o !== null ? e.getAttribute("data-formie-validation-number-min-message") ?? n("{label} must be no less than {min}.", { label: t, min: o }) : a !== null ? e.getAttribute("data-formie-validation-number-max-message") ?? n("{label} must be no greater than {max}.", { label: t, max: a }) : e.getAttribute("data-formie-validation-number-message") ?? e.getAttribute("data-formie-pattern-number-message") ?? e.getAttribute("data-pattern-number-message") ?? n("{label} is not a valid number.", { label: t });
|
|
947
957
|
}
|
|
948
|
-
},
|
|
958
|
+
}, Ln = {
|
|
949
959
|
rule: ({ input: e, getRule: t }) => {
|
|
950
960
|
if (!t("required") || e.type === "hidden")
|
|
951
961
|
return !0;
|
|
@@ -955,8 +965,8 @@ const wn = {
|
|
|
955
965
|
}
|
|
956
966
|
return e.value.trim() !== "";
|
|
957
967
|
},
|
|
958
|
-
message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-required-message") ?? e.getAttribute("data-required-message") ?? r("{
|
|
959
|
-
},
|
|
968
|
+
message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-required-message") ?? e.getAttribute("data-required-message") ?? r("{label} cannot be blank.", { label: t })
|
|
969
|
+
}, In = {
|
|
960
970
|
rule: ({ input: e, getRule: t }) => {
|
|
961
971
|
if (!t("url") || !e.value || e.value.length < 1)
|
|
962
972
|
return !0;
|
|
@@ -966,20 +976,20 @@ const wn = {
|
|
|
966
976
|
return !1;
|
|
967
977
|
}
|
|
968
978
|
},
|
|
969
|
-
message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-pattern-url-message") ?? e.getAttribute("data-pattern-url-message") ?? r("{
|
|
970
|
-
},
|
|
979
|
+
message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-pattern-url-message") ?? e.getAttribute("data-pattern-url-message") ?? r("{label} is not a valid URL.", { label: t })
|
|
980
|
+
}, Rn = {
|
|
971
981
|
// Keep the core validator registry centralized so FormieValidator can extend
|
|
972
982
|
// it at runtime while still shipping one predictable builtin rule surface.
|
|
973
|
-
required:
|
|
974
|
-
email:
|
|
975
|
-
url:
|
|
976
|
-
number:
|
|
977
|
-
match:
|
|
983
|
+
required: Ln,
|
|
984
|
+
email: wn,
|
|
985
|
+
url: In,
|
|
986
|
+
number: Cn,
|
|
987
|
+
match: Mn
|
|
978
988
|
};
|
|
979
|
-
function
|
|
989
|
+
function nr() {
|
|
980
990
|
return window.FormieTranslations || {};
|
|
981
991
|
}
|
|
982
|
-
function
|
|
992
|
+
function Fn() {
|
|
983
993
|
if (typeof document > "u")
|
|
984
994
|
return;
|
|
985
995
|
const e = Array.from(document.querySelectorAll('script[type="application/json"][data-formie-translations]:not([data-formie-translations-loaded="true"])'));
|
|
@@ -995,7 +1005,7 @@ function In() {
|
|
|
995
1005
|
if (!i || Array.isArray(i) || typeof i != "object")
|
|
996
1006
|
continue;
|
|
997
1007
|
t = {
|
|
998
|
-
...t ??
|
|
1008
|
+
...t ?? nr(),
|
|
999
1009
|
...i
|
|
1000
1010
|
};
|
|
1001
1011
|
} catch {
|
|
@@ -1005,25 +1015,117 @@ function In() {
|
|
|
1005
1015
|
t && (window.FormieTranslations = t);
|
|
1006
1016
|
}
|
|
1007
1017
|
function ot() {
|
|
1008
|
-
return
|
|
1018
|
+
return Fn(), nr();
|
|
1009
1019
|
}
|
|
1010
|
-
function
|
|
1020
|
+
function ir() {
|
|
1011
1021
|
return { ...ot() };
|
|
1012
1022
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return window.FormieTranslations = { ...e },
|
|
1023
|
+
function ma(e) {
|
|
1024
|
+
return window.FormieTranslations = { ...e }, ir();
|
|
1015
1025
|
}
|
|
1016
|
-
function
|
|
1026
|
+
function pa(e) {
|
|
1017
1027
|
return window.FormieTranslations = {
|
|
1018
1028
|
...ot(),
|
|
1019
1029
|
...e
|
|
1020
|
-
},
|
|
1030
|
+
}, ir();
|
|
1031
|
+
}
|
|
1032
|
+
function kn(e) {
|
|
1033
|
+
const t = {};
|
|
1034
|
+
let r = 0;
|
|
1035
|
+
for (; r < e.length; ) {
|
|
1036
|
+
for (; r < e.length && /\s/.test(e[r]); )
|
|
1037
|
+
r++;
|
|
1038
|
+
if (r >= e.length)
|
|
1039
|
+
break;
|
|
1040
|
+
const n = e.slice(r).match(/^(\w+|=\d+)\{/);
|
|
1041
|
+
if (!n)
|
|
1042
|
+
break;
|
|
1043
|
+
const i = n[1];
|
|
1044
|
+
r += n[0].length;
|
|
1045
|
+
let o = 1;
|
|
1046
|
+
const a = r;
|
|
1047
|
+
for (; r < e.length && o > 0; )
|
|
1048
|
+
e[r] === "{" ? o++ : e[r] === "}" && o--, o > 0 && r++;
|
|
1049
|
+
t[i] = e.slice(a, r), r++;
|
|
1050
|
+
}
|
|
1051
|
+
return t;
|
|
1052
|
+
}
|
|
1053
|
+
function Pn(e, t) {
|
|
1054
|
+
const r = `=${e}`;
|
|
1055
|
+
if (Object.prototype.hasOwnProperty.call(t, r))
|
|
1056
|
+
return t[r];
|
|
1057
|
+
if (typeof Intl < "u" && typeof Intl.PluralRules == "function") {
|
|
1058
|
+
const i = new Intl.PluralRules().select(e);
|
|
1059
|
+
if (Object.prototype.hasOwnProperty.call(t, i))
|
|
1060
|
+
return t[i];
|
|
1061
|
+
}
|
|
1062
|
+
if (e === 1 && Object.prototype.hasOwnProperty.call(t, "one"))
|
|
1063
|
+
return t.one;
|
|
1064
|
+
if (Object.prototype.hasOwnProperty.call(t, "other"))
|
|
1065
|
+
return t.other;
|
|
1066
|
+
const n = Object.keys(t)[0];
|
|
1067
|
+
return n ? t[n] : "";
|
|
1068
|
+
}
|
|
1069
|
+
function qn(e, t) {
|
|
1070
|
+
const r = e.slice(t).match(/^\{(\w+),\s*plural,\s*/);
|
|
1071
|
+
if (!r)
|
|
1072
|
+
return null;
|
|
1073
|
+
const n = r[1], i = t + r[0].length;
|
|
1074
|
+
let o = i;
|
|
1075
|
+
for (; o < e.length; ) {
|
|
1076
|
+
for (; o < e.length && /\s/.test(e[o]); )
|
|
1077
|
+
o++;
|
|
1078
|
+
if (o >= e.length || e[o] === "}")
|
|
1079
|
+
break;
|
|
1080
|
+
const a = e.slice(o).match(/^(\w+|=\d+)\{/);
|
|
1081
|
+
if (!a)
|
|
1082
|
+
return null;
|
|
1083
|
+
o += a[0].length;
|
|
1084
|
+
let s = 1;
|
|
1085
|
+
for (; o < e.length && s > 0; )
|
|
1086
|
+
e[o] === "{" ? s++ : e[o] === "}" && s--, s > 0 && o++;
|
|
1087
|
+
o++;
|
|
1088
|
+
}
|
|
1089
|
+
return o >= e.length || e[o] !== "}" ? null : {
|
|
1090
|
+
param: n,
|
|
1091
|
+
body: e.slice(i, o),
|
|
1092
|
+
endIndex: o
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
function Vn(e, t) {
|
|
1096
|
+
let r = "", n = 0;
|
|
1097
|
+
for (; n < e.length; ) {
|
|
1098
|
+
if (e[n] !== "{") {
|
|
1099
|
+
r += e[n], n++;
|
|
1100
|
+
continue;
|
|
1101
|
+
}
|
|
1102
|
+
const i = qn(e, n);
|
|
1103
|
+
if (!i) {
|
|
1104
|
+
r += e[n], n++;
|
|
1105
|
+
continue;
|
|
1106
|
+
}
|
|
1107
|
+
const o = t[i.param], a = typeof o == "number" ? o : Number.parseInt(String(o ?? ""), 10) || 0, s = kn(i.body);
|
|
1108
|
+
let l = Pn(a, s);
|
|
1109
|
+
l = l.replace(/#/g, String(a)), r += l, n = i.endIndex + 1;
|
|
1110
|
+
}
|
|
1111
|
+
return r;
|
|
1112
|
+
}
|
|
1113
|
+
function On(e, t) {
|
|
1114
|
+
return e.replace(/\{(\w+),\s*number\}/g, (r, n) => {
|
|
1115
|
+
if (!Object.prototype.hasOwnProperty.call(t, n))
|
|
1116
|
+
return r;
|
|
1117
|
+
const i = t[n];
|
|
1118
|
+
return typeof i == "number" ? i.toLocaleString() : String(i);
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
function $n(e, t) {
|
|
1122
|
+
return e.replace(/\{(\w+)\}/g, (r, n) => Object.prototype.hasOwnProperty.call(t, n) ? String(t[n]) : r);
|
|
1021
1123
|
}
|
|
1022
1124
|
function x(e, t = {}) {
|
|
1023
1125
|
let r = ot()[e] || e;
|
|
1024
|
-
return r = r
|
|
1126
|
+
return r = Vn(r, t), r = On(r, t), r = $n(r, t), r;
|
|
1025
1127
|
}
|
|
1026
|
-
const
|
|
1128
|
+
const ga = x, Hn = {
|
|
1027
1129
|
// eslint-disable-next-line
|
|
1028
1130
|
email: /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*(\.\w{2,})+$/,
|
|
1029
1131
|
url: /^(?:(?:https?|HTTPS?|ftp|FTP):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)(?:\.(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)*(?:\.(?:[a-zA-Z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/,
|
|
@@ -1036,7 +1138,7 @@ const aa = x, Fn = {
|
|
|
1036
1138
|
function oe(e) {
|
|
1037
1139
|
return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement);
|
|
1038
1140
|
}
|
|
1039
|
-
function
|
|
1141
|
+
function _n(e, t) {
|
|
1040
1142
|
const r = (e.getAttribute("aria-describedby") || "").trim();
|
|
1041
1143
|
if (!r)
|
|
1042
1144
|
return;
|
|
@@ -1047,17 +1149,17 @@ function Rn(e, t) {
|
|
|
1047
1149
|
}
|
|
1048
1150
|
e.removeAttribute("aria-describedby");
|
|
1049
1151
|
}
|
|
1050
|
-
function
|
|
1152
|
+
function Dn(e, t) {
|
|
1051
1153
|
const r = (e.getAttribute("aria-describedby") || "").trim(), n = r ? r.split(/\s+/) : [];
|
|
1052
1154
|
n.includes(t) || n.push(t), e.setAttribute("aria-describedby", n.join(" ").trim());
|
|
1053
1155
|
}
|
|
1054
|
-
function
|
|
1156
|
+
function xn(e, t) {
|
|
1055
1157
|
e.setAttribute("aria-errormessage", t);
|
|
1056
1158
|
}
|
|
1057
|
-
function
|
|
1159
|
+
function Nn(e, t) {
|
|
1058
1160
|
e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
|
|
1059
1161
|
}
|
|
1060
|
-
class
|
|
1162
|
+
class Un {
|
|
1061
1163
|
constructor(t, r = {}) {
|
|
1062
1164
|
this.errors = [], this.validators = {}, this.boundListeners = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.submitted = !1, this.initialValues = /* @__PURE__ */ new WeakMap(), this.form = t, this.onBlur = this.blurHandler.bind(this), this.onChange = this.changeHandler.bind(this), this.onInput = this.inputHandler.bind(this), this.config = {
|
|
1063
1165
|
live: !1,
|
|
@@ -1067,9 +1169,9 @@ class Vn {
|
|
|
1067
1169
|
messagesClass: [],
|
|
1068
1170
|
messageClass: [],
|
|
1069
1171
|
fieldsSelector: 'input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([disabled]), select:not([disabled]), textarea:not([disabled])',
|
|
1070
|
-
patterns:
|
|
1172
|
+
patterns: Hn,
|
|
1071
1173
|
...r
|
|
1072
|
-
}, Object.entries(
|
|
1174
|
+
}, Object.entries(Rn).forEach(([n, i]) => {
|
|
1073
1175
|
this.addValidator(n, i.rule, i.message);
|
|
1074
1176
|
}), this.init();
|
|
1075
1177
|
}
|
|
@@ -1150,9 +1252,9 @@ class Vn {
|
|
|
1150
1252
|
o.remove();
|
|
1151
1253
|
}), n && (n.innerHTML = ""), r.querySelectorAll("input, select, textarea").forEach((o) => {
|
|
1152
1254
|
const a = o;
|
|
1153
|
-
a.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && a.classList.remove(...this.config.inputErrorClass), a.removeAttribute("data-formie-input-has-error"), i &&
|
|
1255
|
+
a.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && a.classList.remove(...this.config.inputErrorClass), a.removeAttribute("data-formie-input-has-error"), i && _n(a, i), r.querySelectorAll("[data-formie-field-error]").forEach((s) => {
|
|
1154
1256
|
const l = s.id;
|
|
1155
|
-
l &&
|
|
1257
|
+
l && Nn(a, l);
|
|
1156
1258
|
});
|
|
1157
1259
|
});
|
|
1158
1260
|
for (let o = r; o; o = o.parentElement?.closest("[data-formie-field-handle]"))
|
|
@@ -1166,13 +1268,15 @@ class Vn {
|
|
|
1166
1268
|
if (!i)
|
|
1167
1269
|
return;
|
|
1168
1270
|
let o = i.querySelector("[data-formie-field-errors]");
|
|
1169
|
-
o || (o =
|
|
1271
|
+
o || (o = rr(i, (d) => {
|
|
1272
|
+
this.config.messagesClass.length && d.classList.add(...this.config.messagesClass);
|
|
1273
|
+
})), this.config.messagesClass.length && o.classList.add(...this.config.messagesClass), o.innerHTML = "";
|
|
1170
1274
|
const a = i.getAttribute("data-formie-field-handle") || "field", s = `${a}-error`;
|
|
1171
1275
|
o.id = o.id || `${a}-errors`, o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true");
|
|
1172
1276
|
const l = document.createElement("div");
|
|
1173
1277
|
l.setAttribute("data-formie-field-error", "true"), l.setAttribute(`data-formie-field-error-${r}`, "true"), l.setAttribute("id", s), l.setAttribute("role", "alert"), this.config.messageClass.length && l.classList.add(...this.config.messageClass), l.textContent = n, o.appendChild(l), i.setAttribute("data-formie-field-has-error", "true"), i.querySelectorAll("input, select, textarea").forEach((d) => {
|
|
1174
1278
|
const p = d;
|
|
1175
|
-
p.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && p.classList.add(...this.config.inputErrorClass), p.setAttribute("data-formie-input-has-error", "true"),
|
|
1279
|
+
p.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && p.classList.add(...this.config.inputErrorClass), p.setAttribute("data-formie-input-has-error", "true"), Dn(p, o.id), xn(p, s);
|
|
1176
1280
|
});
|
|
1177
1281
|
for (let d = i; d; d = d.parentElement?.closest("[data-formie-field-handle]"))
|
|
1178
1282
|
this.config.fieldContainerErrorClass.length && d.classList.add(...this.config.fieldContainerErrorClass), d.setAttribute("data-formie-field-has-error", "true");
|
|
@@ -1196,7 +1300,7 @@ class Vn {
|
|
|
1196
1300
|
};
|
|
1197
1301
|
}
|
|
1198
1302
|
getErrorMessage(t, r, n, i) {
|
|
1199
|
-
return (typeof n.errorMessage == "function" ? n.errorMessage(i) : n.errorMessage) ?? x("{
|
|
1303
|
+
return (typeof n.errorMessage == "function" ? n.errorMessage(i) : n.errorMessage) ?? x("{label} is invalid.", { label: i.label });
|
|
1200
1304
|
}
|
|
1201
1305
|
getErrors() {
|
|
1202
1306
|
return this.errors;
|
|
@@ -1289,36 +1393,36 @@ class Vn {
|
|
|
1289
1393
|
delete this.validators[t];
|
|
1290
1394
|
}
|
|
1291
1395
|
}
|
|
1292
|
-
const he = "data-formie-submit-validation-disabled",
|
|
1293
|
-
function
|
|
1396
|
+
const he = "data-formie-submit-validation-disabled", He = "data-formie-preserve-disabled", Bn = "data-formie-submit-ready";
|
|
1397
|
+
function or(e) {
|
|
1294
1398
|
return e.dataset.formieDisableSubmitUntilValid === "true";
|
|
1295
1399
|
}
|
|
1296
|
-
function
|
|
1400
|
+
function jn(e) {
|
|
1297
1401
|
return Array.from(e.querySelectorAll('button[data-formie-action="submit"]')).filter((t) => t instanceof HTMLButtonElement);
|
|
1298
1402
|
}
|
|
1299
|
-
function
|
|
1403
|
+
function zn(e) {
|
|
1300
1404
|
return !e.hasAttribute("data-formie-conditionally-hidden") && !e.closest("[data-formie-conditionally-hidden]");
|
|
1301
1405
|
}
|
|
1302
1406
|
function at(e, t) {
|
|
1303
|
-
if (!
|
|
1407
|
+
if (!or(e) || e.getAttribute("data-formie-loading") === "true")
|
|
1304
1408
|
return;
|
|
1305
1409
|
const { scope: r, final: n } = Zt(e), i = t.isValid(r, {
|
|
1306
1410
|
includeHiddenPages: n
|
|
1307
1411
|
});
|
|
1308
|
-
e.setAttribute(
|
|
1309
|
-
if (
|
|
1412
|
+
e.setAttribute(Bn, i ? "true" : "false"), jn(e).forEach((o) => {
|
|
1413
|
+
if (zn(o)) {
|
|
1310
1414
|
if (i) {
|
|
1311
1415
|
if (!o.hasAttribute(he))
|
|
1312
1416
|
return;
|
|
1313
|
-
o.hasAttribute(
|
|
1417
|
+
o.hasAttribute(He) ? (o.disabled = !0, o.removeAttribute(He)) : o.disabled = !1, o.removeAttribute(he);
|
|
1314
1418
|
return;
|
|
1315
1419
|
}
|
|
1316
|
-
o.hasAttribute(he) || (o.disabled && o.setAttribute(
|
|
1420
|
+
o.hasAttribute(he) || (o.disabled && o.setAttribute(He, "true"), o.setAttribute(he, "true")), o.disabled = !0;
|
|
1317
1421
|
}
|
|
1318
1422
|
});
|
|
1319
1423
|
}
|
|
1320
|
-
function
|
|
1321
|
-
if (!
|
|
1424
|
+
function Wn(e, t, r) {
|
|
1425
|
+
if (!or(e))
|
|
1322
1426
|
return () => {
|
|
1323
1427
|
};
|
|
1324
1428
|
let n = !1;
|
|
@@ -1365,8 +1469,8 @@ function _n(e, t, r) {
|
|
|
1365
1469
|
e.removeEventListener("input", o, !0), e.removeEventListener("change", o, !0), e.removeEventListener("reset", a), r.removeEventListener("formie:conditions:evaluated", s), l.disconnect();
|
|
1366
1470
|
};
|
|
1367
1471
|
}
|
|
1368
|
-
const
|
|
1369
|
-
function
|
|
1472
|
+
const Kn = "STALE_SUBMISSION_STATE", St = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), j = _("general", "submit-result");
|
|
1473
|
+
function ze(e, t, r) {
|
|
1370
1474
|
let n = e.querySelector(`input[name="${t}"]`);
|
|
1371
1475
|
n || (n = document.createElement("input"), n.type = "hidden", n.name = t, e.appendChild(n)), n.value = r;
|
|
1372
1476
|
}
|
|
@@ -1376,7 +1480,7 @@ function At(e, t) {
|
|
|
1376
1480
|
function ae(e, t) {
|
|
1377
1481
|
e.querySelector(`input[name="${t}"]`)?.remove();
|
|
1378
1482
|
}
|
|
1379
|
-
function
|
|
1483
|
+
function Gn(e, t) {
|
|
1380
1484
|
try {
|
|
1381
1485
|
const r = new URL(e, window.location.href);
|
|
1382
1486
|
return r.searchParams.delete(t), r.toString();
|
|
@@ -1384,28 +1488,32 @@ function xn(e, t) {
|
|
|
1384
1488
|
return e;
|
|
1385
1489
|
}
|
|
1386
1490
|
}
|
|
1387
|
-
function
|
|
1491
|
+
function Jn(e) {
|
|
1388
1492
|
try {
|
|
1389
1493
|
return new URL(e, window.location.href).origin === window.location.origin;
|
|
1390
1494
|
} catch {
|
|
1391
1495
|
return !1;
|
|
1392
1496
|
}
|
|
1393
1497
|
}
|
|
1394
|
-
function
|
|
1498
|
+
function ar(e) {
|
|
1395
1499
|
return Array.from(e.querySelectorAll("[data-formie-page]"));
|
|
1396
1500
|
}
|
|
1397
|
-
function
|
|
1501
|
+
function Yn(e) {
|
|
1398
1502
|
return Array.from(e.querySelectorAll("[data-formie-tab]"));
|
|
1399
1503
|
}
|
|
1400
|
-
function
|
|
1504
|
+
function Zn(e, t, r) {
|
|
1401
1505
|
return t < 0 || r < 1 ? 0 : (e.dataset.formieProgressCalculation === "page-position" ? "page-position" : "completion") === "page-position" ? Math.round((t + 1) / r * 100) : Math.round(t / r * 100);
|
|
1402
1506
|
}
|
|
1403
|
-
function
|
|
1507
|
+
function Qn(e) {
|
|
1404
1508
|
return e <= 0 ? "start" : e >= 100 ? "end" : "middle";
|
|
1405
1509
|
}
|
|
1406
|
-
function
|
|
1510
|
+
function Xn(e) {
|
|
1407
1511
|
return (e.dataset.formieSubmitAction || "").trim();
|
|
1408
1512
|
}
|
|
1513
|
+
function wt(e, t) {
|
|
1514
|
+
const r = t.meta?.effectiveSubmitAction;
|
|
1515
|
+
return typeof r == "string" && r.trim() !== "" ? r.trim() : Xn(e);
|
|
1516
|
+
}
|
|
1409
1517
|
function Tt(e) {
|
|
1410
1518
|
const t = e.dataset.formieSubmitActionFormHide;
|
|
1411
1519
|
if (t === void 0)
|
|
@@ -1427,22 +1535,22 @@ function st(e, t) {
|
|
|
1427
1535
|
});
|
|
1428
1536
|
});
|
|
1429
1537
|
}
|
|
1430
|
-
function
|
|
1538
|
+
function B(e) {
|
|
1431
1539
|
const t = St.get(e);
|
|
1432
1540
|
typeof t == "number" && (window.clearTimeout(t), St.delete(e));
|
|
1433
1541
|
}
|
|
1434
|
-
function
|
|
1542
|
+
function ei(e, t) {
|
|
1435
1543
|
Te.has(e) || Te.set(e, e.innerHTML), e.textContent = t;
|
|
1436
1544
|
}
|
|
1437
1545
|
function We(e) {
|
|
1438
1546
|
const t = Te.get(e);
|
|
1439
1547
|
t !== void 0 && (e.innerHTML = t, Te.delete(e));
|
|
1440
1548
|
}
|
|
1441
|
-
function
|
|
1549
|
+
function ti(e, t) {
|
|
1442
1550
|
const r = e.querySelector("[data-formie-progress-bar]"), n = e.querySelector("[data-formie-progress-value]");
|
|
1443
|
-
r && (r.style.width = `${t}%`, r.setAttribute("aria-valuenow", `${t}`), r.setAttribute("data-formie-progress-state",
|
|
1551
|
+
r && (r.style.width = `${t}%`, r.setAttribute("aria-valuenow", `${t}`), r.setAttribute("data-formie-progress-state", Qn(t)), n && (n.textContent = `${t}%`, n.setAttribute("data-formie-progress-value", `${t}`)));
|
|
1444
1552
|
}
|
|
1445
|
-
function
|
|
1553
|
+
function ri(e, t) {
|
|
1446
1554
|
if (!t)
|
|
1447
1555
|
return;
|
|
1448
1556
|
const r = (e.dataset.formieLoadingIndicator || "").trim();
|
|
@@ -1453,24 +1561,24 @@ function Kn(e, t) {
|
|
|
1453
1561
|
}
|
|
1454
1562
|
if (r === "text") {
|
|
1455
1563
|
const n = (e.dataset.formieLoadingIndicatorText || "").trim(), i = t.textContent?.trim() || "", o = n || i;
|
|
1456
|
-
t.setAttribute("data-formie-loading-text", o),
|
|
1564
|
+
t.setAttribute("data-formie-loading-text", o), ei(t, o);
|
|
1457
1565
|
return;
|
|
1458
1566
|
}
|
|
1459
1567
|
We(t), t.removeAttribute("data-formie-loading-text");
|
|
1460
1568
|
}
|
|
1461
1569
|
}
|
|
1462
|
-
function
|
|
1570
|
+
function sr(e) {
|
|
1463
1571
|
return Array.from(e.querySelectorAll("[data-formie-action]"));
|
|
1464
1572
|
}
|
|
1465
|
-
function
|
|
1573
|
+
function lr(e, t) {
|
|
1466
1574
|
if (e.getAttribute("data-formie-loading") === "true")
|
|
1467
1575
|
return;
|
|
1468
|
-
e.setAttribute("data-formie-loading", "true"),
|
|
1576
|
+
e.setAttribute("data-formie-loading", "true"), sr(e).forEach((n) => {
|
|
1469
1577
|
"disabled" in n && (n.disabled ? n.setAttribute("data-formie-was-disabled", "true") : n.removeAttribute("data-formie-was-disabled"), n.disabled = !0);
|
|
1470
|
-
}), t && (t.setAttribute("data-formie-loading", "true"),
|
|
1578
|
+
}), t && (t.setAttribute("data-formie-loading", "true"), ri(e, t));
|
|
1471
1579
|
}
|
|
1472
1580
|
function Me(e) {
|
|
1473
|
-
if (e.removeAttribute("data-formie-loading"),
|
|
1581
|
+
if (e.removeAttribute("data-formie-loading"), sr(e).forEach((r) => {
|
|
1474
1582
|
if ("disabled" in r) {
|
|
1475
1583
|
const n = r, i = n.getAttribute("data-formie-was-disabled") === "true";
|
|
1476
1584
|
n.disabled = i;
|
|
@@ -1482,30 +1590,30 @@ function Me(e) {
|
|
|
1482
1590
|
}
|
|
1483
1591
|
}
|
|
1484
1592
|
function lt(e, t) {
|
|
1485
|
-
const r =
|
|
1593
|
+
const r = ar(e), n = Yn(e), i = r.findIndex((o) => o.getAttribute("data-formie-page-id") === t);
|
|
1486
1594
|
if (r.forEach((o) => {
|
|
1487
|
-
o.getAttribute("data-formie-page-id") === t ? (o.removeAttribute("data-formie-page-hidden"), le(o, e, "pageHidden")) : (o.setAttribute("data-formie-page-hidden", "true"),
|
|
1595
|
+
o.getAttribute("data-formie-page-id") === t ? (o.removeAttribute("data-formie-page-hidden"), le(o, e, "pageHidden")) : (o.setAttribute("data-formie-page-hidden", "true"), O(o, e, "pageHidden"));
|
|
1488
1596
|
}), n.forEach((o, a) => {
|
|
1489
1597
|
const s = o.getAttribute("data-formie-page-id") === t, l = i > -1 && a < i;
|
|
1490
1598
|
ue(o, e, "tabCurrent", s), ue(o, e, "tabComplete", l), s ? o.setAttribute("aria-current", "page") : o.removeAttribute("aria-current"), l ? o.setAttribute("data-formie-tab-complete", "true") : o.removeAttribute("data-formie-tab-complete");
|
|
1491
1599
|
}), i > -1 && r.length > 0) {
|
|
1492
|
-
const o =
|
|
1493
|
-
|
|
1600
|
+
const o = Zn(e, i, r.length);
|
|
1601
|
+
ti(e, o);
|
|
1494
1602
|
}
|
|
1495
|
-
if (
|
|
1603
|
+
if (ze(e, "pageId", t), J(e), e.dataset.formieDisableSubmitUntilValid === "true") {
|
|
1496
1604
|
const o = e;
|
|
1497
1605
|
o.formieValidation && at(e, o.formieValidation);
|
|
1498
1606
|
}
|
|
1499
1607
|
}
|
|
1500
|
-
function
|
|
1608
|
+
function ni(e, t) {
|
|
1501
1609
|
const r = t.meta?.submissionUid;
|
|
1502
|
-
typeof r == "string" && r.trim() !== "" &&
|
|
1610
|
+
typeof r == "string" && r.trim() !== "" && ze(e, "submissionUid", r);
|
|
1503
1611
|
const n = t.meta?.session?.continuation?.continuationToken;
|
|
1504
|
-
typeof n == "string" && n.trim() !== "" ?
|
|
1612
|
+
typeof n == "string" && n.trim() !== "" ? ze(e, "continuationToken", n) : ae(e, "continuationToken");
|
|
1505
1613
|
}
|
|
1506
|
-
function
|
|
1614
|
+
function ii(e) {
|
|
1507
1615
|
const t = e.getAttribute("action");
|
|
1508
|
-
t && e.setAttribute("action",
|
|
1616
|
+
t && e.setAttribute("action", Gn(t, "resumeToken"));
|
|
1509
1617
|
try {
|
|
1510
1618
|
const r = new URL(window.location.href);
|
|
1511
1619
|
if (!r.searchParams.has("resumeToken"))
|
|
@@ -1514,12 +1622,12 @@ function Jn(e) {
|
|
|
1514
1622
|
} catch {
|
|
1515
1623
|
}
|
|
1516
1624
|
}
|
|
1517
|
-
function
|
|
1625
|
+
function oi(e, t) {
|
|
1518
1626
|
const r = t.meta?.resumeUrl;
|
|
1519
1627
|
if (typeof r != "string" || r.trim() === "")
|
|
1520
1628
|
return;
|
|
1521
1629
|
const n = r.trim();
|
|
1522
|
-
if (!
|
|
1630
|
+
if (!Jn(n))
|
|
1523
1631
|
return;
|
|
1524
1632
|
e.getAttribute("action") && e.setAttribute("action", n);
|
|
1525
1633
|
try {
|
|
@@ -1529,17 +1637,17 @@ function Yn(e, t) {
|
|
|
1529
1637
|
}
|
|
1530
1638
|
}
|
|
1531
1639
|
function be(e, t = {}) {
|
|
1532
|
-
const n = e.formieValidation, i =
|
|
1533
|
-
if (
|
|
1534
|
-
lt(e, i), e.dispatchEvent(new CustomEvent(
|
|
1640
|
+
const n = e.formieValidation, i = ar(e)[0]?.getAttribute("data-formie-page-id");
|
|
1641
|
+
if (B(e), e.reset(), t.preserveHiddenState || st(e, !1), ae(e, "submissionId"), ae(e, "submissionUid"), ae(e, "continuationToken"), ae(e, "pageId"), ii(e), n?.resetLiveState(), i) {
|
|
1642
|
+
lt(e, i), e.dispatchEvent(new CustomEvent(je("reset"), { bubbles: !0 }));
|
|
1535
1643
|
return;
|
|
1536
1644
|
}
|
|
1537
|
-
J(e), e.dispatchEvent(new CustomEvent(
|
|
1645
|
+
J(e), e.dispatchEvent(new CustomEvent(je("reset"), { bubbles: !0 }));
|
|
1538
1646
|
}
|
|
1539
|
-
function
|
|
1540
|
-
return e.code ===
|
|
1647
|
+
function ai(e) {
|
|
1648
|
+
return e.code === Kn || e.meta?.resetState === !0;
|
|
1541
1649
|
}
|
|
1542
|
-
function
|
|
1650
|
+
function si(e, t) {
|
|
1543
1651
|
const r = t.submitData, n = /* @__PURE__ */ new Set();
|
|
1544
1652
|
let i = !1;
|
|
1545
1653
|
if (Array.isArray(r) && r.length > 0) {
|
|
@@ -1548,7 +1656,7 @@ function Qn(e, t) {
|
|
|
1548
1656
|
);
|
|
1549
1657
|
for (const h of p) {
|
|
1550
1658
|
const u = h.event;
|
|
1551
|
-
n.add(u),
|
|
1659
|
+
n.add(u), j.log("Dispatching submitData event.", {
|
|
1552
1660
|
eventName: u
|
|
1553
1661
|
}), u.startsWith("formie:payment:") && (i = !0), e.dispatchEvent(new CustomEvent(u, {
|
|
1554
1662
|
bubbles: !0,
|
|
@@ -1560,74 +1668,74 @@ function Qn(e, t) {
|
|
|
1560
1668
|
return d && !n.has(d) && (d.startsWith("formie:payment:") && (i = !0), e.dispatchEvent(new CustomEvent(d, {
|
|
1561
1669
|
bubbles: !0,
|
|
1562
1670
|
detail: { data: l }
|
|
1563
|
-
})),
|
|
1671
|
+
})), j.log("Dispatching fallback payment action event.", {
|
|
1564
1672
|
eventName: d
|
|
1565
1673
|
})), { hasPaymentFollowUpEvent: i };
|
|
1566
1674
|
}
|
|
1567
|
-
function
|
|
1568
|
-
if (
|
|
1675
|
+
function li(e, t, r) {
|
|
1676
|
+
if (j.log("Applying submit result state.", {
|
|
1569
1677
|
ok: t.ok,
|
|
1570
1678
|
action: r,
|
|
1571
1679
|
code: t.code,
|
|
1572
1680
|
hasRedirect: !!t.redirect?.url,
|
|
1573
1681
|
hasSubmitData: Array.isArray(t.submitData) && t.submitData.length > 0
|
|
1574
|
-
}),
|
|
1575
|
-
be(e),
|
|
1682
|
+
}), ai(t)) {
|
|
1683
|
+
be(e), j.log("Resetting state due to stale/reset marker.");
|
|
1576
1684
|
return;
|
|
1577
1685
|
}
|
|
1578
|
-
const n =
|
|
1686
|
+
const n = si(e, t);
|
|
1579
1687
|
if (!t.ok && t.redirect?.url && !n.hasPaymentFollowUpEvent) {
|
|
1580
|
-
|
|
1688
|
+
j.log("Applying redirect fallback for failed result.", {
|
|
1581
1689
|
url: t.redirect.url,
|
|
1582
1690
|
target: t.redirect.target
|
|
1583
|
-
}),
|
|
1691
|
+
}), B(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank") : (At(e, "redirect"), window.location.href = t.redirect.url);
|
|
1584
1692
|
return;
|
|
1585
1693
|
}
|
|
1586
|
-
if (
|
|
1587
|
-
|
|
1694
|
+
if (ni(e, t), !t.ok) {
|
|
1695
|
+
j.log("Non-redirect failure; keeping current form state."), B(e);
|
|
1588
1696
|
return;
|
|
1589
1697
|
}
|
|
1590
1698
|
if (Kt(e, r), t.nextPage?.id) {
|
|
1591
|
-
|
|
1699
|
+
B(e), e.formieValidation?.resetLiveState(), lt(e, t.nextPage.id), j.log("Advanced to next page.", {
|
|
1592
1700
|
nextPageId: t.nextPage.id
|
|
1593
1701
|
});
|
|
1594
1702
|
return;
|
|
1595
1703
|
}
|
|
1596
1704
|
if (r === "save") {
|
|
1597
|
-
|
|
1705
|
+
B(e), oi(e, t), j.log("Applied save/resume token state.");
|
|
1598
1706
|
return;
|
|
1599
1707
|
}
|
|
1600
1708
|
if (r === "submit" && !t.redirect?.url) {
|
|
1601
|
-
const i = wt(e), o = i === "message" && Tt(e);
|
|
1709
|
+
const i = wt(e, t), o = i === "message" && Tt(e);
|
|
1602
1710
|
if (i === "reload") {
|
|
1603
|
-
|
|
1711
|
+
B(e), At(e, "reload"), window.location.reload();
|
|
1604
1712
|
return;
|
|
1605
1713
|
}
|
|
1606
1714
|
if (i === "reset") {
|
|
1607
1715
|
be(e);
|
|
1608
1716
|
return;
|
|
1609
1717
|
}
|
|
1610
|
-
|
|
1718
|
+
B(e), be(e, { preserveHiddenState: o });
|
|
1611
1719
|
return;
|
|
1612
1720
|
}
|
|
1613
1721
|
if (r === "submit" && t.redirect?.url && t.redirect.target === "new-tab") {
|
|
1614
|
-
const o = wt(e) === "message" && Tt(e);
|
|
1615
|
-
|
|
1722
|
+
const o = wt(e, t) === "message" && Tt(e);
|
|
1723
|
+
B(e), be(e, { preserveHiddenState: o });
|
|
1616
1724
|
return;
|
|
1617
1725
|
}
|
|
1618
|
-
|
|
1726
|
+
B(e);
|
|
1619
1727
|
}
|
|
1620
1728
|
const Ce = /* @__PURE__ */ new WeakMap();
|
|
1621
|
-
function
|
|
1729
|
+
function ur(e) {
|
|
1622
1730
|
return (e.dataset.formieSubmitAction || "").trim();
|
|
1623
1731
|
}
|
|
1624
|
-
function
|
|
1732
|
+
function ui(e) {
|
|
1625
1733
|
return (e.dataset.formieErrorMessagePosition || "top-form").trim() || "top-form";
|
|
1626
1734
|
}
|
|
1627
|
-
function
|
|
1735
|
+
function cr(e) {
|
|
1628
1736
|
return (e.dataset.formieSubmitActionMessagePosition || "").trim();
|
|
1629
1737
|
}
|
|
1630
|
-
function
|
|
1738
|
+
function ci(e) {
|
|
1631
1739
|
const t = (e.dataset.formieSubmitActionMessageTimeout || "").trim();
|
|
1632
1740
|
if (!t)
|
|
1633
1741
|
return null;
|
|
@@ -1641,41 +1749,42 @@ function ut(e) {
|
|
|
1641
1749
|
const r = t.trim().toLowerCase();
|
|
1642
1750
|
return r === "true" || r === "1" || r === "";
|
|
1643
1751
|
}
|
|
1644
|
-
function
|
|
1752
|
+
function di(e) {
|
|
1645
1753
|
const t = Ce.get(e);
|
|
1646
1754
|
typeof t == "number" && (window.clearTimeout(t), Ce.delete(e));
|
|
1647
1755
|
}
|
|
1648
|
-
function
|
|
1756
|
+
function dr(e) {
|
|
1649
1757
|
return e.querySelector("[data-formie-form-messages-top]") || e;
|
|
1650
1758
|
}
|
|
1651
|
-
function
|
|
1759
|
+
function fr(e) {
|
|
1652
1760
|
return e.querySelector("[data-formie-form-messages-bottom]") || e;
|
|
1653
1761
|
}
|
|
1654
|
-
function
|
|
1655
|
-
return t === "bottom-form" ?
|
|
1762
|
+
function fi(e, t) {
|
|
1763
|
+
return t === "bottom-form" ? fr(e) : dr(e);
|
|
1656
1764
|
}
|
|
1657
|
-
function
|
|
1658
|
-
return t === "top-form" ?
|
|
1765
|
+
function mi(e, t) {
|
|
1766
|
+
return t === "top-form" ? dr(e) : t === "bottom-form" && !ut(e) ? fr(e) : e;
|
|
1659
1767
|
}
|
|
1660
|
-
function
|
|
1661
|
-
const t =
|
|
1768
|
+
function pi(e) {
|
|
1769
|
+
const t = ui(e), r = fi(e, t);
|
|
1662
1770
|
let n = r.querySelector("[data-formie-error-container], [data-formie-errors]");
|
|
1663
|
-
return n || (n = document.createElement("div"), n.setAttribute("data-formie-errors", "true"),
|
|
1771
|
+
return n || (n = document.createElement("div"), n.setAttribute("data-formie-errors", "true"), O(n, e, "errors")), n.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
|
|
1664
1772
|
}
|
|
1665
|
-
function
|
|
1773
|
+
function gi(e, t) {
|
|
1666
1774
|
let r = t.querySelector("[data-formie-error-message-container], [data-formie-message][data-formie-message-error]");
|
|
1667
|
-
return r || (r = document.createElement("div"), r.setAttribute("data-formie-error-message-container", "true"), t.appendChild(r)), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-error", "true"),
|
|
1775
|
+
return r || (r = document.createElement("div"), r.setAttribute("data-formie-error-message-container", "true"), t.appendChild(r)), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-error", "true"), O(r, e, "message", "messageError"), r.setAttribute("role", "alert"), r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r;
|
|
1668
1776
|
}
|
|
1669
|
-
function
|
|
1777
|
+
function hi(e, t) {
|
|
1670
1778
|
let r = e.querySelector("[data-formie-success-container]");
|
|
1671
|
-
const n =
|
|
1672
|
-
return r || (r = document.createElement("div"), r.setAttribute("data-formie-success-container", "true"),
|
|
1779
|
+
const n = mi(e, t);
|
|
1780
|
+
return r || (r = document.createElement("div"), r.setAttribute("data-formie-success-container", "true"), O(r, e, "successes")), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
|
|
1673
1781
|
}
|
|
1674
|
-
function
|
|
1675
|
-
|
|
1676
|
-
|
|
1782
|
+
function bi(e) {
|
|
1783
|
+
return rr(e, (t) => {
|
|
1784
|
+
O(t, e, "fieldErrors");
|
|
1785
|
+
});
|
|
1677
1786
|
}
|
|
1678
|
-
function
|
|
1787
|
+
function yi(e, t) {
|
|
1679
1788
|
const r = (e.getAttribute("aria-describedby") || "").trim();
|
|
1680
1789
|
if (!r)
|
|
1681
1790
|
return;
|
|
@@ -1686,26 +1795,26 @@ function ui(e, t) {
|
|
|
1686
1795
|
}
|
|
1687
1796
|
e.removeAttribute("aria-describedby");
|
|
1688
1797
|
}
|
|
1689
|
-
function
|
|
1798
|
+
function vi(e, t) {
|
|
1690
1799
|
e.setAttribute("aria-errormessage", t);
|
|
1691
1800
|
}
|
|
1692
|
-
function
|
|
1801
|
+
function Ei(e, t) {
|
|
1693
1802
|
e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
|
|
1694
1803
|
}
|
|
1695
|
-
function
|
|
1804
|
+
function mr(e) {
|
|
1696
1805
|
e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
|
|
1697
1806
|
const r = t, n = r.querySelector("[data-formie-field-errors]"), i = n?.id || "", o = Array.from(r.querySelectorAll("[data-formie-field-error]")).map((a) => a.id).filter(Boolean);
|
|
1698
1807
|
le(r, e, "fieldLayoutError"), r.removeAttribute("data-formie-field-has-error"), r.querySelectorAll("[data-formie-field-error]").forEach((a) => {
|
|
1699
1808
|
a.remove();
|
|
1700
1809
|
}), n && !n.querySelector("[data-formie-field-error]") && (n.innerHTML = ""), r.querySelectorAll("input, select, textarea").forEach((a) => {
|
|
1701
1810
|
const s = a;
|
|
1702
|
-
s.removeAttribute("aria-invalid"), le(s, e, "fieldControlError"), s.removeAttribute("data-formie-input-has-error"), i &&
|
|
1703
|
-
|
|
1811
|
+
s.removeAttribute("aria-invalid"), le(s, e, "fieldControlError"), s.removeAttribute("data-formie-input-has-error"), i && yi(s, i), o.forEach((l) => {
|
|
1812
|
+
Ei(s, l);
|
|
1704
1813
|
});
|
|
1705
1814
|
});
|
|
1706
1815
|
}), J(e);
|
|
1707
1816
|
}
|
|
1708
|
-
function
|
|
1817
|
+
function pr(e) {
|
|
1709
1818
|
e.querySelectorAll("[data-formie-error-container], [data-formie-errors]").forEach((t) => {
|
|
1710
1819
|
const r = t;
|
|
1711
1820
|
r.querySelectorAll("[data-formie-error]").forEach((n) => {
|
|
@@ -1714,16 +1823,16 @@ function mr(e) {
|
|
|
1714
1823
|
});
|
|
1715
1824
|
}
|
|
1716
1825
|
function ct(e) {
|
|
1717
|
-
|
|
1826
|
+
di(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((t) => {
|
|
1718
1827
|
t.remove();
|
|
1719
1828
|
}), e.querySelectorAll("[data-formie-success-container]").forEach((t) => {
|
|
1720
1829
|
const r = t;
|
|
1721
1830
|
r.querySelectorAll("[data-formie-success]").forEach((n) => {
|
|
1722
1831
|
n.remove();
|
|
1723
1832
|
}), le(r, e, "message", "messageSuccess"), r.removeAttribute("data-formie-message"), r.removeAttribute("data-formie-message-success"), r.removeAttribute("role"), r.removeAttribute("aria-live"), r.removeAttribute("aria-atomic"), r.querySelector("[data-formie-success]") || (r.innerHTML = "");
|
|
1724
|
-
}),
|
|
1833
|
+
}), ur(e) === "message" && ut(e) || st(e, !1);
|
|
1725
1834
|
}
|
|
1726
|
-
function
|
|
1835
|
+
function gr(e) {
|
|
1727
1836
|
e.querySelectorAll('[aria-invalid="true"]').forEach((t) => {
|
|
1728
1837
|
t.removeAttribute("aria-invalid");
|
|
1729
1838
|
});
|
|
@@ -1732,44 +1841,44 @@ function Mt(e, t) {
|
|
|
1732
1841
|
const r = (e.getAttribute("aria-describedby") || "").trim(), n = r ? r.split(/\s+/) : [];
|
|
1733
1842
|
n.includes(t) || n.push(t), e.setAttribute("aria-describedby", n.join(" ").trim());
|
|
1734
1843
|
}
|
|
1735
|
-
function
|
|
1844
|
+
function Si(e, t) {
|
|
1736
1845
|
Object.entries(t).forEach(([r, n]) => {
|
|
1737
1846
|
const i = e.querySelector(`[data-formie-field-handle="${r}"]`);
|
|
1738
1847
|
if (!i)
|
|
1739
1848
|
return;
|
|
1740
|
-
const o =
|
|
1741
|
-
o.id = a, o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true"),
|
|
1849
|
+
const o = bi(i), a = o.id && o.id.trim() ? o.id : `${r}-errors`;
|
|
1850
|
+
o.id = a, o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true"), O(i, e, "fieldLayoutError"), i.setAttribute("data-formie-field-has-error", "true"), n.forEach((l, d) => {
|
|
1742
1851
|
const p = document.createElement("div");
|
|
1743
|
-
p.setAttribute("data-formie-field-error", "true"), p.setAttribute("role", "alert"), p.id = `${a}-${d + 1}`,
|
|
1852
|
+
p.setAttribute("data-formie-field-error", "true"), p.setAttribute("role", "alert"), p.id = `${a}-${d + 1}`, O(p, e, "fieldError"), p.textContent = l, o.appendChild(p);
|
|
1744
1853
|
});
|
|
1745
1854
|
const s = o.querySelector("[data-formie-field-error]")?.id;
|
|
1746
1855
|
i.querySelectorAll("input, select, textarea").forEach((l) => {
|
|
1747
1856
|
const d = l;
|
|
1748
|
-
d.setAttribute("aria-invalid", "true"),
|
|
1857
|
+
d.setAttribute("aria-invalid", "true"), O(d, e, "fieldControlError"), d.setAttribute("data-formie-input-has-error", "true"), Mt(d, a), s && vi(d, s);
|
|
1749
1858
|
const p = i.querySelector("[data-formie-instructions]");
|
|
1750
1859
|
p?.id && Mt(d, p.id);
|
|
1751
1860
|
});
|
|
1752
1861
|
}), J(e);
|
|
1753
1862
|
}
|
|
1754
1863
|
function Ct(e, t) {
|
|
1755
|
-
const r =
|
|
1756
|
-
|
|
1864
|
+
const r = pi(e), n = gi(e, r);
|
|
1865
|
+
O(r, e, "errors"), t.forEach((i) => {
|
|
1757
1866
|
const o = document.createElement("div");
|
|
1758
|
-
o.setAttribute("data-formie-error", "true"), o.setAttribute("role", "alert"),
|
|
1867
|
+
o.setAttribute("data-formie-error", "true"), o.setAttribute("role", "alert"), O(o, e, "error"), o.innerHTML = i, n.appendChild(o);
|
|
1759
1868
|
});
|
|
1760
1869
|
}
|
|
1761
|
-
function
|
|
1762
|
-
return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 :
|
|
1870
|
+
function Ai(e, t) {
|
|
1871
|
+
return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : ur(e) === "message" && cr(e) !== "";
|
|
1763
1872
|
}
|
|
1764
|
-
function
|
|
1765
|
-
const r =
|
|
1873
|
+
function wi(e, t) {
|
|
1874
|
+
const r = cr(e);
|
|
1766
1875
|
if (!r)
|
|
1767
1876
|
return;
|
|
1768
|
-
const n =
|
|
1769
|
-
|
|
1877
|
+
const n = hi(e, r);
|
|
1878
|
+
O(n, e, "message", "messageSuccess"), n.setAttribute("data-formie-message", "true"), n.setAttribute("data-formie-message-success", "true"), n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true");
|
|
1770
1879
|
const i = document.createElement("div");
|
|
1771
|
-
i.setAttribute("data-formie-success", "true"),
|
|
1772
|
-
const o =
|
|
1880
|
+
i.setAttribute("data-formie-success", "true"), O(i, e, "success"), i.innerHTML = t, n.appendChild(i), ut(e) && st(e, !0);
|
|
1881
|
+
const o = ci(e);
|
|
1773
1882
|
if (o !== null) {
|
|
1774
1883
|
const a = window.setTimeout(() => {
|
|
1775
1884
|
Ce.delete(e), ct(e);
|
|
@@ -1778,27 +1887,27 @@ function pi(e, t) {
|
|
|
1778
1887
|
}
|
|
1779
1888
|
}
|
|
1780
1889
|
function Le(e, t) {
|
|
1781
|
-
if (
|
|
1782
|
-
|
|
1890
|
+
if (mr(e), pr(e), ct(e), gr(e), t.ok) {
|
|
1891
|
+
Ai(e, t) && wi(e, t.message || "");
|
|
1783
1892
|
return;
|
|
1784
1893
|
}
|
|
1785
|
-
if (t.fieldErrors &&
|
|
1894
|
+
if (t.fieldErrors && Si(e, t.fieldErrors), t.formErrors?.length) {
|
|
1786
1895
|
Ct(e, t.formErrors);
|
|
1787
1896
|
return;
|
|
1788
1897
|
}
|
|
1789
1898
|
!t.fieldErrors && t.message && Ct(e, [t.message]);
|
|
1790
1899
|
}
|
|
1791
|
-
const
|
|
1792
|
-
function
|
|
1900
|
+
const Ti = _("general", "submit-flow");
|
|
1901
|
+
function Mi(e) {
|
|
1793
1902
|
return !(!e.ok && e.stage === "validate");
|
|
1794
1903
|
}
|
|
1795
|
-
function
|
|
1904
|
+
function hr(e) {
|
|
1796
1905
|
return e ? !!(e.keepSubmitLoading === !0 || e.ok && e.redirect?.url && e.redirect.target !== "new-tab") : !1;
|
|
1797
1906
|
}
|
|
1798
|
-
function
|
|
1799
|
-
|
|
1907
|
+
function br(e) {
|
|
1908
|
+
mr(e), pr(e), ct(e), gr(e);
|
|
1800
1909
|
}
|
|
1801
|
-
async function
|
|
1910
|
+
async function yr(e) {
|
|
1802
1911
|
const {
|
|
1803
1912
|
id: t,
|
|
1804
1913
|
target: r,
|
|
@@ -1812,7 +1921,7 @@ async function br(e) {
|
|
|
1812
1921
|
onRefreshTokensAfterSubmit: p,
|
|
1813
1922
|
dispatchSubmitResult: h
|
|
1814
1923
|
} = e;
|
|
1815
|
-
|
|
1924
|
+
br(n), lr(n, l || null);
|
|
1816
1925
|
let u = {
|
|
1817
1926
|
ok: !1,
|
|
1818
1927
|
code: "SUBMIT_ERROR",
|
|
@@ -1823,25 +1932,25 @@ async function br(e) {
|
|
|
1823
1932
|
await d(n), u = await tr(n, s, i, {
|
|
1824
1933
|
validator: o,
|
|
1825
1934
|
validateOnSubmit: a
|
|
1826
|
-
}), Le(n, u),
|
|
1935
|
+
}), Le(n, u), li(n, u, s), Mi(u) && await p(u), h(u);
|
|
1827
1936
|
} catch (c) {
|
|
1828
1937
|
u = {
|
|
1829
1938
|
ok: !1,
|
|
1830
1939
|
code: "SUBMIT_ERROR",
|
|
1831
1940
|
message: c instanceof Error ? c.message : "Submission failed.",
|
|
1832
1941
|
formErrors: [c instanceof Error ? c.message : "Submission failed."]
|
|
1833
|
-
}, Le(n, u), h(u),
|
|
1942
|
+
}, Le(n, u), h(u), Ti.warn("Submit failed with exception.", {
|
|
1834
1943
|
id: t,
|
|
1835
1944
|
action: s,
|
|
1836
1945
|
target: r,
|
|
1837
1946
|
error: c instanceof Error ? c.message : c
|
|
1838
1947
|
});
|
|
1839
1948
|
} finally {
|
|
1840
|
-
|
|
1949
|
+
hr(u) || Me(n);
|
|
1841
1950
|
}
|
|
1842
1951
|
return u;
|
|
1843
1952
|
}
|
|
1844
|
-
class
|
|
1953
|
+
class vr {
|
|
1845
1954
|
constructor() {
|
|
1846
1955
|
this.modules = /* @__PURE__ */ new Map();
|
|
1847
1956
|
}
|
|
@@ -1861,96 +1970,96 @@ class yr {
|
|
|
1861
1970
|
return Array.from(this.modules.values());
|
|
1862
1971
|
}
|
|
1863
1972
|
}
|
|
1864
|
-
const
|
|
1973
|
+
const Ci = {
|
|
1865
1974
|
// Address providers stay behind lazy importer entries because their SDKs are
|
|
1866
1975
|
// optional and often much heavier than the base form client.
|
|
1867
|
-
"address-finder": () => import("./address-finder-
|
|
1868
|
-
"google-address": () => import("./google-address-
|
|
1869
|
-
loqate: () => import("./loqate-
|
|
1870
|
-
"place-kit": () => import("./place-kit-
|
|
1871
|
-
},
|
|
1976
|
+
"address-finder": () => import("./address-finder-BU4roxT6.js").then((e) => e.addressFinderModule),
|
|
1977
|
+
"google-address": () => import("./google-address-BD8IZ86V.js").then((e) => e.googleAddressModule),
|
|
1978
|
+
loqate: () => import("./loqate-B-ZNS65B.js").then((e) => e.loqateModule),
|
|
1979
|
+
"place-kit": () => import("./place-kit-DizZWV_e.js").then((e) => e.placeKitModule)
|
|
1980
|
+
}, Li = {
|
|
1872
1981
|
// Module ids map directly to importer functions so the loader can fetch only
|
|
1873
1982
|
// the captcha chunks required by the current form manifest.
|
|
1874
|
-
"captcha-eu": () => import("./captcha-eu-
|
|
1875
|
-
"friendly-captcha-v1": () => import("./friendly-captcha-v1-
|
|
1876
|
-
"friendly-captcha-v2": () => import("./friendly-captcha-v2-
|
|
1877
|
-
hcaptcha: () => import("./hcaptcha-
|
|
1878
|
-
"recaptcha-enterprise": () => import("./recaptcha-enterprise-
|
|
1879
|
-
"recaptcha-v2-checkbox": () => import("./recaptcha-v2-checkbox-
|
|
1880
|
-
"recaptcha-v2-invisible": () => import("./recaptcha-v2-invisible-
|
|
1881
|
-
"recaptcha-v3": () => import("./recaptcha-v3-
|
|
1882
|
-
snaptcha: () => import("./snaptcha-
|
|
1883
|
-
turnstile: () => import("./turnstile-
|
|
1884
|
-
},
|
|
1983
|
+
"captcha-eu": () => import("./captcha-eu-BAPzHNts.js").then((e) => e.captchaEuModule),
|
|
1984
|
+
"friendly-captcha-v1": () => import("./friendly-captcha-v1-DdlcGiFY.js").then((e) => e.friendlyCaptchaV1Module),
|
|
1985
|
+
"friendly-captcha-v2": () => import("./friendly-captcha-v2-76w-YnFm.js").then((e) => e.friendlyCaptchaV2Module),
|
|
1986
|
+
hcaptcha: () => import("./hcaptcha-BNNTL6uf.js").then((e) => e.hcaptchaModule),
|
|
1987
|
+
"recaptcha-enterprise": () => import("./recaptcha-enterprise-BbOvO7JZ.js").then((e) => e.recaptchaEnterpriseModule),
|
|
1988
|
+
"recaptcha-v2-checkbox": () => import("./recaptcha-v2-checkbox-SY3ti5iQ.js").then((e) => e.recaptchaV2CheckboxModule),
|
|
1989
|
+
"recaptcha-v2-invisible": () => import("./recaptcha-v2-invisible-DSmQnn6c.js").then((e) => e.recaptchaV2InvisibleModule),
|
|
1990
|
+
"recaptcha-v3": () => import("./recaptcha-v3-DNh7YCnR.js").then((e) => e.recaptchaV3Module),
|
|
1991
|
+
snaptcha: () => import("./snaptcha-VuOUOaLj.js").then((e) => e.snaptchaModule),
|
|
1992
|
+
turnstile: () => import("./turnstile-9tM7q_LK.js").then((e) => e.turnstileModule)
|
|
1993
|
+
}, Ii = {
|
|
1885
1994
|
// Keep the builtin map flat and explicit so manifest ids remain the source of
|
|
1886
1995
|
// truth for lazy-loading first-party field enhancements.
|
|
1887
|
-
calculations: () => import("./calculations-
|
|
1888
|
-
"checkbox-radio": () => import("./checkbox-radio-
|
|
1889
|
-
conditions: () => import("./conditions-
|
|
1890
|
-
"date-picker": () => import("./date-picker-
|
|
1891
|
-
"file-upload": () => import("./file-upload-
|
|
1892
|
-
hidden: () => import("./hidden-
|
|
1893
|
-
"phone-country": () => import("./phone-country-
|
|
1894
|
-
repeater: () => import("./repeater-
|
|
1895
|
-
"rich-text": () => import("./rich-text-
|
|
1896
|
-
signature: () => import("./signature-
|
|
1897
|
-
summary: () => import("./summary-
|
|
1898
|
-
table: () => import("./table-
|
|
1899
|
-
"text-limit": () => import("./text-limit-
|
|
1900
|
-
},
|
|
1996
|
+
calculations: () => import("./calculations-C9t6Zop9.js").then((e) => e.calculationsModule),
|
|
1997
|
+
"checkbox-radio": () => import("./checkbox-radio-CHeLNVIK.js").then((e) => e.checkboxRadioModule),
|
|
1998
|
+
conditions: () => import("./conditions-DKxVCsjD.js").then((e) => e.conditionsModule),
|
|
1999
|
+
"date-picker": () => import("./date-picker-B3iQ797Z.js").then((e) => e.datePickerModule),
|
|
2000
|
+
"file-upload": () => import("./file-upload-DP2TOUYV.js").then((e) => e.fileUploadModule),
|
|
2001
|
+
hidden: () => import("./hidden-CW6Rcf1N.js").then((e) => e.hiddenModule),
|
|
2002
|
+
"phone-country": () => import("./phone-country-Cm5YUeXI.js").then((e) => e.phoneCountryModule),
|
|
2003
|
+
repeater: () => import("./repeater-DM0vuFNQ.js").then((e) => e.repeaterModule),
|
|
2004
|
+
"rich-text": () => import("./rich-text-C8aGYp70.js").then((e) => e.richTextModule),
|
|
2005
|
+
signature: () => import("./signature-pFhZfH7d.js").then((e) => e.signatureModule),
|
|
2006
|
+
summary: () => import("./summary-Da7Ktg3N.js").then((e) => e.summaryModule),
|
|
2007
|
+
table: () => import("./table-C0PmR9bI.js").then((e) => e.tableModule),
|
|
2008
|
+
"text-limit": () => import("./text-limit-mLEwZDIa.js").then((e) => e.textLimitModule)
|
|
2009
|
+
}, Ri = {
|
|
1901
2010
|
// Keep payment providers lazy and separately addressable so forms only ship
|
|
1902
2011
|
// the payment SDK wrapper code they actually declare in their manifest.
|
|
1903
|
-
bpoint: () => import("./bpoint-
|
|
1904
|
-
eway: () => import("./eway-
|
|
1905
|
-
"go-cardless": () => import("./go-cardless-
|
|
1906
|
-
mollie: () => import("./mollie-
|
|
1907
|
-
moneris: () => import("./moneris-
|
|
1908
|
-
opayo: () => import("./opayo-
|
|
1909
|
-
paddle: () => import("./paddle-
|
|
1910
|
-
paypal: () => import("./paypal-
|
|
1911
|
-
payway: () => import("./payway-
|
|
1912
|
-
square: () => import("./square-
|
|
1913
|
-
stripe: () => import("./stripe-
|
|
1914
|
-
},
|
|
1915
|
-
...
|
|
1916
|
-
...
|
|
1917
|
-
...
|
|
1918
|
-
...
|
|
1919
|
-
}, _e = /* @__PURE__ */ new Map(), D = _("general", "loader"),
|
|
2012
|
+
bpoint: () => import("./bpoint-uNg5j6rt.js").then((e) => e.bpointModule),
|
|
2013
|
+
eway: () => import("./eway-DCielIML.js").then((e) => e.ewayModule),
|
|
2014
|
+
"go-cardless": () => import("./go-cardless-rwCkzbNK.js").then((e) => e.goCardlessModule),
|
|
2015
|
+
mollie: () => import("./mollie-BDAZ-1X4.js").then((e) => e.mollieModule),
|
|
2016
|
+
moneris: () => import("./moneris-B1b0uEtY.js").then((e) => e.monerisModule),
|
|
2017
|
+
opayo: () => import("./opayo-CC5hraHo.js").then((e) => e.opayoModule),
|
|
2018
|
+
paddle: () => import("./paddle-B4GmrDsq.js").then((e) => e.paddleModule),
|
|
2019
|
+
paypal: () => import("./paypal-BFS6XsIS.js").then((e) => e.paypalModule),
|
|
2020
|
+
payway: () => import("./payway-DekoJead.js").then((e) => e.paywayModule),
|
|
2021
|
+
square: () => import("./square-BR9pvToy.js").then((e) => e.squareModule),
|
|
2022
|
+
stripe: () => import("./stripe-OHUwoV9g.js").then((e) => e.stripeModule)
|
|
2023
|
+
}, Fi = {
|
|
2024
|
+
...Ii,
|
|
2025
|
+
...Ci,
|
|
2026
|
+
...Li,
|
|
2027
|
+
...Ri
|
|
2028
|
+
}, _e = /* @__PURE__ */ new Map(), D = _("general", "loader"), ki = new Function("src", "return import(src);");
|
|
1920
2029
|
async function ye(e, t, r, n) {
|
|
1921
|
-
await e(
|
|
2030
|
+
await e(Br(r), n), await e(Ur(t, r), n);
|
|
1922
2031
|
}
|
|
1923
|
-
function
|
|
2032
|
+
function Er(e) {
|
|
1924
2033
|
return !!e && typeof e == "object" && typeof e.id == "string" && typeof e.setup == "function" && typeof e.match == "function";
|
|
1925
2034
|
}
|
|
1926
|
-
async function
|
|
1927
|
-
const r =
|
|
2035
|
+
async function Pi(e, t) {
|
|
2036
|
+
const r = Fi[e];
|
|
1928
2037
|
return r ? (_e.has(e) || _e.set(e, (async () => {
|
|
1929
2038
|
try {
|
|
1930
2039
|
const n = await r();
|
|
1931
|
-
return
|
|
2040
|
+
return Er(n) ? (t.registry.register(n), n) : null;
|
|
1932
2041
|
} catch (n) {
|
|
1933
2042
|
return console.error("[formie] Failed to load builtin module:", e, n), D.warn("Failed loading builtin module.", { moduleId: e, error: n }), null;
|
|
1934
2043
|
}
|
|
1935
2044
|
})()), _e.get(e) || null) : null;
|
|
1936
2045
|
}
|
|
1937
|
-
async function
|
|
2046
|
+
async function qi(e) {
|
|
1938
2047
|
try {
|
|
1939
|
-
const t = await
|
|
1940
|
-
return
|
|
2048
|
+
const t = await ki(e), r = t?.default || t?.formieModule || null;
|
|
2049
|
+
return Er(r) ? r : null;
|
|
1941
2050
|
} catch (t) {
|
|
1942
2051
|
return console.error("[formie] Failed to load module from src:", e, t), D.warn("Failed loading module from src.", { src: e, error: t }), null;
|
|
1943
2052
|
}
|
|
1944
2053
|
}
|
|
1945
|
-
async function
|
|
2054
|
+
async function Vi(e, t) {
|
|
1946
2055
|
const r = t.registry.get(e.id);
|
|
1947
2056
|
if (r)
|
|
1948
2057
|
return r;
|
|
1949
|
-
const n = await
|
|
2058
|
+
const n = await Pi(e.id, t);
|
|
1950
2059
|
if (n)
|
|
1951
2060
|
return n;
|
|
1952
2061
|
if (e.src) {
|
|
1953
|
-
const i = await
|
|
2062
|
+
const i = await qi(e.src);
|
|
1954
2063
|
if (i)
|
|
1955
2064
|
return t.registry.register(i), i;
|
|
1956
2065
|
}
|
|
@@ -1962,26 +2071,26 @@ function De(e) {
|
|
|
1962
2071
|
function ve(e, t) {
|
|
1963
2072
|
return e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
|
|
1964
2073
|
}
|
|
1965
|
-
function
|
|
2074
|
+
function Oi(e, t) {
|
|
1966
2075
|
const r = t.setupContext.root, n = t.setupContext.form, i = e.targetType, o = e.targetId;
|
|
1967
2076
|
return i === "selector" ? ve(r, o).map((a) => ({ scope: i, element: a })) : i === "field" ? ve(r, `[data-formie-field-handle="${De(o)}"]`).map((a) => ({ scope: i, element: a })) : i === "page" ? ve(r, `[data-formie-page-id="${De(o)}"]`).map((a) => ({ scope: i, element: a })) : i === "button" ? ve(r, `[data-formie-action="${De(o)}"]`).map((a) => ({ scope: i, element: a })) : [{
|
|
1968
2077
|
scope: "form",
|
|
1969
2078
|
element: n || r
|
|
1970
2079
|
}];
|
|
1971
2080
|
}
|
|
1972
|
-
function
|
|
2081
|
+
function $i(e, t) {
|
|
1973
2082
|
return (e.targets && e.targets.length > 0 ? e.targets : [{
|
|
1974
2083
|
targetType: "form",
|
|
1975
2084
|
targetId: "form"
|
|
1976
|
-
}]).flatMap((n) =>
|
|
2085
|
+
}]).flatMap((n) => Oi(n, t));
|
|
1977
2086
|
}
|
|
1978
|
-
async function
|
|
2087
|
+
async function Sr(e, t) {
|
|
1979
2088
|
const r = [];
|
|
1980
2089
|
D.log("Loading module manifest.", {
|
|
1981
2090
|
manifestCount: e.length
|
|
1982
2091
|
});
|
|
1983
2092
|
for (const n of e) {
|
|
1984
|
-
const i = await
|
|
2093
|
+
const i = await Vi(n, t);
|
|
1985
2094
|
if (!i) {
|
|
1986
2095
|
D.warn("Skipping manifest item (definition not resolved).", {
|
|
1987
2096
|
moduleId: n.id,
|
|
@@ -1989,7 +2098,7 @@ async function Er(e, t) {
|
|
|
1989
2098
|
});
|
|
1990
2099
|
continue;
|
|
1991
2100
|
}
|
|
1992
|
-
const o =
|
|
2101
|
+
const o = $i(n, t);
|
|
1993
2102
|
D.log("Resolved module targets.", {
|
|
1994
2103
|
moduleId: i.id,
|
|
1995
2104
|
targets: n.targets || [],
|
|
@@ -2062,7 +2171,7 @@ async function Er(e, t) {
|
|
|
2062
2171
|
instanceCount: r.length
|
|
2063
2172
|
}), r;
|
|
2064
2173
|
}
|
|
2065
|
-
const
|
|
2174
|
+
const Hi = /* @__PURE__ */ new Set([
|
|
2066
2175
|
"CRAFT_CSRF_TOKEN",
|
|
2067
2176
|
"action",
|
|
2068
2177
|
"redirect",
|
|
@@ -2098,20 +2207,20 @@ function Ke(e, t) {
|
|
|
2098
2207
|
}
|
|
2099
2208
|
return JSON.stringify(String(e));
|
|
2100
2209
|
}
|
|
2101
|
-
function
|
|
2210
|
+
function _i(e) {
|
|
2102
2211
|
return Ke(e, /* @__PURE__ */ new WeakSet());
|
|
2103
2212
|
}
|
|
2104
|
-
function
|
|
2213
|
+
function Di(e) {
|
|
2105
2214
|
if (!e)
|
|
2106
2215
|
return !1;
|
|
2107
2216
|
const t = e.endsWith("[]") ? e.slice(0, -2) : e;
|
|
2108
|
-
return !
|
|
2217
|
+
return !Hi.has(t);
|
|
2109
2218
|
}
|
|
2110
2219
|
function Lt(e) {
|
|
2111
|
-
const t = Array.from(new FormData(e).entries()).filter(([r]) =>
|
|
2112
|
-
return
|
|
2220
|
+
const t = Array.from(new FormData(e).entries()).filter(([r]) => Di(String(r || "")));
|
|
2221
|
+
return _i(t);
|
|
2113
2222
|
}
|
|
2114
|
-
function
|
|
2223
|
+
function xi(e, t = {}) {
|
|
2115
2224
|
let r = null, n = !1, i = !1, o = null, a = null, s = null;
|
|
2116
2225
|
const l = () => {
|
|
2117
2226
|
o !== null && (window.cancelAnimationFrame(o), o = null), a !== null && (window.clearTimeout(a), a = null), s !== null && (window.clearTimeout(s), s = null);
|
|
@@ -2139,7 +2248,7 @@ function ki(e, t = {}) {
|
|
|
2139
2248
|
}
|
|
2140
2249
|
};
|
|
2141
2250
|
}
|
|
2142
|
-
const X = '[data-formie]:not([data-formie-init="false"]), [data-formie-form]:not([data-formie-init="false"])',
|
|
2251
|
+
const X = '[data-formie]:not([data-formie-init="false"]), [data-formie-form]:not([data-formie-init="false"])', Ni = 300, Ui = "/actions/formie/server/forms/render", It = "/api", Bi = "/actions/formie/server/forms/refresh-tokens", ji = "/actions/formie/server/submissions/submit", zi = "/actions/formie/server/submissions/set-page", Wi = "/actions/formie/server/submissions/clear-submission", Ki = "/actions/formie/file-upload/hydrate", L = _("general", "client"), Rt = /* @__PURE__ */ new Set();
|
|
2143
2252
|
function ce(e, t) {
|
|
2144
2253
|
if (e == null || e === "")
|
|
2145
2254
|
return t;
|
|
@@ -2161,7 +2270,7 @@ function ee(e) {
|
|
|
2161
2270
|
compatibility: ce(t.formieCompatibility, !1)
|
|
2162
2271
|
};
|
|
2163
2272
|
}
|
|
2164
|
-
function
|
|
2273
|
+
function Fe(e) {
|
|
2165
2274
|
return e || "server-rendered";
|
|
2166
2275
|
}
|
|
2167
2276
|
function ke(e) {
|
|
@@ -2170,10 +2279,10 @@ function ke(e) {
|
|
|
2170
2279
|
function Se(e) {
|
|
2171
2280
|
return e instanceof HTMLFormElement ? e : e.querySelector("form");
|
|
2172
2281
|
}
|
|
2173
|
-
function
|
|
2174
|
-
|
|
2282
|
+
function Gi(e, t) {
|
|
2283
|
+
Rt.has(e) || (Rt.add(e), L.warn(t));
|
|
2175
2284
|
}
|
|
2176
|
-
function
|
|
2285
|
+
function Ar(e, t) {
|
|
2177
2286
|
if (!e)
|
|
2178
2287
|
return e;
|
|
2179
2288
|
try {
|
|
@@ -2190,22 +2299,22 @@ function Sr(e, t) {
|
|
|
2190
2299
|
}
|
|
2191
2300
|
function re(e, t) {
|
|
2192
2301
|
const r = (e || "").trim();
|
|
2193
|
-
return r ? r.includes("/actions/") ? r :
|
|
2302
|
+
return r ? r.includes("/actions/") ? r : Ar(t, r) : t;
|
|
2194
2303
|
}
|
|
2195
|
-
function
|
|
2196
|
-
return re(e.endpoint || t.dataset.formieEndpoint,
|
|
2304
|
+
function Ji(e, t) {
|
|
2305
|
+
return re(e.endpoint || t.dataset.formieEndpoint, Ui);
|
|
2197
2306
|
}
|
|
2198
|
-
function
|
|
2307
|
+
function Yi(e, t) {
|
|
2199
2308
|
const r = (e.endpoint || t.dataset.formieEndpoint || "").trim();
|
|
2200
|
-
return r ? r.includes("/graphql") || r.endsWith("/api") || r.includes("/actions/graphql/") ? r :
|
|
2309
|
+
return r ? r.includes("/graphql") || r.endsWith("/api") || r.includes("/actions/graphql/") ? r : Ar(It, r) : It;
|
|
2201
2310
|
}
|
|
2202
2311
|
function dt(e, t) {
|
|
2203
2312
|
return re(
|
|
2204
2313
|
t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint,
|
|
2205
|
-
|
|
2314
|
+
Bi
|
|
2206
2315
|
);
|
|
2207
2316
|
}
|
|
2208
|
-
function
|
|
2317
|
+
function Ft(e, t) {
|
|
2209
2318
|
if (!e)
|
|
2210
2319
|
return t;
|
|
2211
2320
|
try {
|
|
@@ -2217,15 +2326,15 @@ function Rt(e, t) {
|
|
|
2217
2326
|
return t;
|
|
2218
2327
|
}
|
|
2219
2328
|
}
|
|
2220
|
-
function
|
|
2221
|
-
const n = r.endpoint || e.dataset.formieEndpoint, i = re(n,
|
|
2222
|
-
t.setAttribute("action",
|
|
2223
|
-
const s = a.getAttribute("href"), l = re(n,
|
|
2224
|
-
a.setAttribute("href",
|
|
2329
|
+
function Zi(e, t, r) {
|
|
2330
|
+
const n = r.endpoint || e.dataset.formieEndpoint, i = re(n, ji), o = t.getAttribute("action");
|
|
2331
|
+
t.setAttribute("action", Ft(o, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((a) => {
|
|
2332
|
+
const s = a.getAttribute("href"), l = re(n, zi);
|
|
2333
|
+
a.setAttribute("href", Ft(s, l));
|
|
2225
2334
|
}), t.querySelectorAll("[data-formie-file-upload-hydrate-endpoint]").forEach((a) => {
|
|
2226
2335
|
a.setAttribute(
|
|
2227
2336
|
"data-formie-file-upload-hydrate-endpoint",
|
|
2228
|
-
re(n,
|
|
2337
|
+
re(n, Ki)
|
|
2229
2338
|
);
|
|
2230
2339
|
});
|
|
2231
2340
|
}
|
|
@@ -2239,16 +2348,16 @@ function mt(e) {
|
|
|
2239
2348
|
const t = e.trim().toLowerCase();
|
|
2240
2349
|
return t === "true" || t === "1" || t === "";
|
|
2241
2350
|
}
|
|
2242
|
-
function
|
|
2351
|
+
function Qi(e) {
|
|
2243
2352
|
return ce(e.dataset.formieAutomaticSubmissionState, !0);
|
|
2244
2353
|
}
|
|
2245
|
-
function
|
|
2354
|
+
function Xi(e, t, r) {
|
|
2246
2355
|
return re(
|
|
2247
2356
|
r.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint,
|
|
2248
|
-
|
|
2357
|
+
Wi
|
|
2249
2358
|
);
|
|
2250
2359
|
}
|
|
2251
|
-
function
|
|
2360
|
+
function eo(e) {
|
|
2252
2361
|
return mt(e.dataset.formieUnloadWarning);
|
|
2253
2362
|
}
|
|
2254
2363
|
function kt(e, t) {
|
|
@@ -2257,10 +2366,10 @@ function kt(e, t) {
|
|
|
2257
2366
|
function xe(e) {
|
|
2258
2367
|
e.removeAttribute("data-formie-internal-navigation");
|
|
2259
2368
|
}
|
|
2260
|
-
function
|
|
2369
|
+
function Pt(e) {
|
|
2261
2370
|
return e.getAttribute("data-formie-internal-navigation") !== null;
|
|
2262
2371
|
}
|
|
2263
|
-
function
|
|
2372
|
+
function qt(e, t) {
|
|
2264
2373
|
if (!e)
|
|
2265
2374
|
return !1;
|
|
2266
2375
|
try {
|
|
@@ -2269,26 +2378,26 @@ function Pt(e, t) {
|
|
|
2269
2378
|
return !1;
|
|
2270
2379
|
}
|
|
2271
2380
|
}
|
|
2272
|
-
function
|
|
2273
|
-
return
|
|
2381
|
+
function to(e) {
|
|
2382
|
+
return qt(window.location.href, "resumeToken") || qt(e.getAttribute("action"), "resumeToken");
|
|
2274
2383
|
}
|
|
2275
|
-
function
|
|
2384
|
+
function ro(e) {
|
|
2276
2385
|
return e instanceof MouseEvent ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey : !0;
|
|
2277
2386
|
}
|
|
2278
|
-
function
|
|
2387
|
+
function no(e, t = 0) {
|
|
2279
2388
|
if (!e)
|
|
2280
2389
|
return t;
|
|
2281
2390
|
const r = Number.parseInt(e, 10);
|
|
2282
2391
|
return Number.isFinite(r) ? r : t;
|
|
2283
2392
|
}
|
|
2284
|
-
function
|
|
2285
|
-
return Math.max(0,
|
|
2393
|
+
function io(e) {
|
|
2394
|
+
return Math.max(0, no(e.dataset.formieSubmitDelay, Ni));
|
|
2286
2395
|
}
|
|
2287
2396
|
function Je(e) {
|
|
2288
2397
|
return mt(e.dataset.formieValidationOnSubmit);
|
|
2289
2398
|
}
|
|
2290
2399
|
async function Ye(e) {
|
|
2291
|
-
const t =
|
|
2400
|
+
const t = io(e);
|
|
2292
2401
|
t < 1 || await new Promise((r) => {
|
|
2293
2402
|
window.setTimeout(r, t);
|
|
2294
2403
|
});
|
|
@@ -2303,7 +2412,7 @@ function Vt(e, t) {
|
|
|
2303
2412
|
return console.error(`[formie] Failed to parse ${t}.`, n), null;
|
|
2304
2413
|
}
|
|
2305
2414
|
}
|
|
2306
|
-
function
|
|
2415
|
+
function Ot(e, t) {
|
|
2307
2416
|
const r = t || (e instanceof HTMLFormElement ? e : null);
|
|
2308
2417
|
if (!r)
|
|
2309
2418
|
return null;
|
|
@@ -2313,7 +2422,7 @@ function $t(e, t) {
|
|
|
2313
2422
|
theme: i || void 0
|
|
2314
2423
|
};
|
|
2315
2424
|
}
|
|
2316
|
-
function
|
|
2425
|
+
function oo(e) {
|
|
2317
2426
|
if (!(e instanceof HTMLElement))
|
|
2318
2427
|
return !0;
|
|
2319
2428
|
if (!e.isConnected || e.hidden || e.closest("[hidden]"))
|
|
@@ -2321,7 +2430,7 @@ function Yi(e) {
|
|
|
2321
2430
|
const t = window.getComputedStyle(e);
|
|
2322
2431
|
return t.display === "none" || t.visibility === "hidden" ? !1 : e.getClientRects().length > 0;
|
|
2323
2432
|
}
|
|
2324
|
-
function
|
|
2433
|
+
function ao(e, t) {
|
|
2325
2434
|
return t === document ? !0 : t instanceof Element ? t === e || t.contains(e) : !0;
|
|
2326
2435
|
}
|
|
2327
2436
|
function V(e) {
|
|
@@ -2353,8 +2462,8 @@ function pt(e, t) {
|
|
|
2353
2462
|
});
|
|
2354
2463
|
}
|
|
2355
2464
|
}
|
|
2356
|
-
async function
|
|
2357
|
-
const r =
|
|
2465
|
+
async function so(e, t) {
|
|
2466
|
+
const r = Fe(t.mode), n = ke(t.transport);
|
|
2358
2467
|
if (r !== "server-rendered")
|
|
2359
2468
|
return null;
|
|
2360
2469
|
if (t.payload)
|
|
@@ -2370,26 +2479,26 @@ async function Qi(e, t) {
|
|
|
2370
2479
|
siteId: t.siteId,
|
|
2371
2480
|
theme: t.theme,
|
|
2372
2481
|
themeConfig: t.themeConfig
|
|
2373
|
-
}, s = n === "graphql" ?
|
|
2482
|
+
}, s = n === "graphql" ? Yi(t, e) : Ji(t, e), l = n === "graphql" ? await fn(s, o, a) : await dn(s, o, {
|
|
2374
2483
|
...a,
|
|
2375
2484
|
endpoint: s
|
|
2376
2485
|
});
|
|
2377
2486
|
return l?.html && (e.innerHTML = l.html), l;
|
|
2378
2487
|
}
|
|
2379
|
-
async function
|
|
2488
|
+
async function wr(e, t, r) {
|
|
2380
2489
|
if (t.refreshTokens === !1)
|
|
2381
2490
|
return;
|
|
2382
|
-
ft(ke(t.transport),
|
|
2491
|
+
ft(ke(t.transport), Fe(t.mode));
|
|
2383
2492
|
const n = t.formHandle || e.dataset.formieHandle;
|
|
2384
2493
|
if (!n)
|
|
2385
2494
|
return;
|
|
2386
2495
|
const i = dt(t, e), a = r.querySelector('input[name="renderId"]')?.value || void 0, s = await nt(i, n, a);
|
|
2387
2496
|
pt(r, s), I(e, "formie:refresh-tokens:refreshed", s);
|
|
2388
2497
|
}
|
|
2389
|
-
function
|
|
2498
|
+
function lo(e, t, r, n, i, o) {
|
|
2390
2499
|
const a = String(
|
|
2391
2500
|
t.dataset.formieSubmitMethod || ""
|
|
2392
|
-
).trim().toLowerCase(), s =
|
|
2501
|
+
).trim().toLowerCase(), s = Xi(r, e, t);
|
|
2393
2502
|
let l = !1;
|
|
2394
2503
|
const d = t.querySelectorAll("[data-formie-action]"), p = (c) => {
|
|
2395
2504
|
if (c) {
|
|
@@ -2398,9 +2507,9 @@ function Xi(e, t, r, n, i, o) {
|
|
|
2398
2507
|
}
|
|
2399
2508
|
t.removeAttribute("data-formie-pending-action");
|
|
2400
2509
|
};
|
|
2401
|
-
if (
|
|
2402
|
-
const c =
|
|
2403
|
-
shouldWarn: () => !
|
|
2510
|
+
if (eo(t)) {
|
|
2511
|
+
const c = xi(t, {
|
|
2512
|
+
shouldWarn: () => !Pt(t)
|
|
2404
2513
|
}), b = (f) => {
|
|
2405
2514
|
if (!(f instanceof CustomEvent))
|
|
2406
2515
|
return;
|
|
@@ -2424,7 +2533,7 @@ function Xi(e, t, r, n, i, o) {
|
|
|
2424
2533
|
}), t.querySelectorAll("[data-formie-tab-link]").forEach((c) => {
|
|
2425
2534
|
const b = async (A) => {
|
|
2426
2535
|
if (a !== "ajax") {
|
|
2427
|
-
|
|
2536
|
+
ro(A) && kt(t, "set-page");
|
|
2428
2537
|
return;
|
|
2429
2538
|
}
|
|
2430
2539
|
A.preventDefault();
|
|
@@ -2435,7 +2544,7 @@ function Xi(e, t, r, n, i, o) {
|
|
|
2435
2544
|
href: E
|
|
2436
2545
|
});
|
|
2437
2546
|
try {
|
|
2438
|
-
const y = await
|
|
2547
|
+
const y = await mn(E, t, v);
|
|
2439
2548
|
I(e, "formie:page:navigate:after", {
|
|
2440
2549
|
pageId: v,
|
|
2441
2550
|
href: E,
|
|
@@ -2453,10 +2562,10 @@ function Xi(e, t, r, n, i, o) {
|
|
|
2453
2562
|
c.addEventListener("click", b), o.push(() => {
|
|
2454
2563
|
c.removeEventListener("click", b);
|
|
2455
2564
|
});
|
|
2456
|
-
}), !
|
|
2565
|
+
}), !Qi(t)) {
|
|
2457
2566
|
let c = !1;
|
|
2458
2567
|
const b = () => {
|
|
2459
|
-
c ||
|
|
2568
|
+
c || Pt(t) || to(t) || (c = !0, pn(s, t));
|
|
2460
2569
|
};
|
|
2461
2570
|
window.addEventListener("pagehide", b), window.addEventListener("beforeunload", b), o.push(() => {
|
|
2462
2571
|
window.removeEventListener("pagehide", b), window.removeEventListener("beforeunload", b);
|
|
@@ -2476,7 +2585,7 @@ function Xi(e, t, r, n, i, o) {
|
|
|
2476
2585
|
let g = null, S = !1;
|
|
2477
2586
|
try {
|
|
2478
2587
|
if (b)
|
|
2479
|
-
g = await
|
|
2588
|
+
g = await yr({
|
|
2480
2589
|
target: e,
|
|
2481
2590
|
form: t,
|
|
2482
2591
|
bus: n,
|
|
@@ -2486,14 +2595,14 @@ function Xi(e, t, r, n, i, o) {
|
|
|
2486
2595
|
submitter: f,
|
|
2487
2596
|
waitForSubmitDelay: Ye,
|
|
2488
2597
|
onRefreshTokensAfterSubmit: async () => {
|
|
2489
|
-
await
|
|
2598
|
+
await wr(e, r, t);
|
|
2490
2599
|
},
|
|
2491
2600
|
dispatchSubmitResult: (M) => {
|
|
2492
2601
|
I(e, "formie:submit:result", M);
|
|
2493
2602
|
}
|
|
2494
2603
|
});
|
|
2495
2604
|
else {
|
|
2496
|
-
if (
|
|
2605
|
+
if (br(t), lr(t, f), await Ye(t), g = await tr(t, m, n, {
|
|
2497
2606
|
validator: i,
|
|
2498
2607
|
validateOnSubmit: Je(t),
|
|
2499
2608
|
preflightOnly: !0
|
|
@@ -2527,25 +2636,25 @@ function Xi(e, t, r, n, i, o) {
|
|
|
2527
2636
|
formErrors: [M instanceof Error ? M.message : "Submission failed."]
|
|
2528
2637
|
}, Le(t, g), I(e, "formie:submit:result", g), xe(t);
|
|
2529
2638
|
} finally {
|
|
2530
|
-
p(null), !b && !S && !
|
|
2639
|
+
p(null), !b && !S && !hr(g) && Me(t);
|
|
2531
2640
|
}
|
|
2532
2641
|
};
|
|
2533
2642
|
t.addEventListener("submit", u), o.push(() => {
|
|
2534
2643
|
t.removeEventListener("submit", u);
|
|
2535
2644
|
});
|
|
2536
2645
|
}
|
|
2537
|
-
async function
|
|
2646
|
+
async function uo(e, t, r) {
|
|
2538
2647
|
if (t.refreshTokens === !1 || !t.staticCache)
|
|
2539
2648
|
return;
|
|
2540
|
-
ft(ke(t.transport),
|
|
2649
|
+
ft(ke(t.transport), Fe(t.mode));
|
|
2541
2650
|
const n = t.formHandle || e.dataset.formieHandle, i = dt(t, e), a = r?.querySelector('input[name="renderId"]')?.value || void 0;
|
|
2542
2651
|
if (!n)
|
|
2543
2652
|
return;
|
|
2544
2653
|
const s = await nt(i, n, a);
|
|
2545
2654
|
!s || !r || (pt(r, s), I(e, "formie:refresh-tokens:after", s));
|
|
2546
2655
|
}
|
|
2547
|
-
function
|
|
2548
|
-
const e = /* @__PURE__ */ new Map(), t = new
|
|
2656
|
+
function co() {
|
|
2657
|
+
const e = /* @__PURE__ */ new Map(), t = new vr(), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = [
|
|
2549
2658
|
"prepare",
|
|
2550
2659
|
"normalize",
|
|
2551
2660
|
"validate",
|
|
@@ -2599,24 +2708,24 @@ function to() {
|
|
|
2599
2708
|
const m = new Gt(), g = [], S = f?.id || `formie-${e.size + 1}`, M = ee(f), T = {
|
|
2600
2709
|
...M,
|
|
2601
2710
|
...v,
|
|
2602
|
-
mode:
|
|
2711
|
+
mode: Fe(v.mode ?? M.mode),
|
|
2603
2712
|
transport: ke(v.transport ?? M.transport)
|
|
2604
|
-
},
|
|
2713
|
+
}, R = xr(T.compatibility);
|
|
2605
2714
|
if (T.mode !== "server-rendered" && !Se(f))
|
|
2606
2715
|
throw new Error(`Formie ${T.mode} mode is not implemented yet in the browser client.`);
|
|
2607
|
-
const
|
|
2716
|
+
const P = await so(f, T), w = Se(f);
|
|
2608
2717
|
T.staticCache = v.staticCache ?? Ge(w ? w.dataset : f.dataset);
|
|
2609
|
-
const
|
|
2610
|
-
...
|
|
2611
|
-
...
|
|
2612
|
-
} : null,
|
|
2718
|
+
const q = Ot(f, w), N = P || q ? {
|
|
2719
|
+
...P || {},
|
|
2720
|
+
...q || {}
|
|
2721
|
+
} : null, z = N?.theme, Y = {}, fe = (N?.modules || []).filter((C) => !!C?.id && !!C?.type);
|
|
2613
2722
|
L.log("Resolved mount payload.", {
|
|
2614
2723
|
target: V(f),
|
|
2615
|
-
hasRenderPayload: !!
|
|
2616
|
-
hasEmbeddedPayload: !!
|
|
2724
|
+
hasRenderPayload: !!P,
|
|
2725
|
+
hasEmbeddedPayload: !!q,
|
|
2617
2726
|
moduleCount: fe.length
|
|
2618
2727
|
});
|
|
2619
|
-
const ne = yt(f,
|
|
2728
|
+
const ne = yt(f, z, w), k = w ? new Un(w, {
|
|
2620
2729
|
live: mt(w.dataset.formieValidationOnFocus),
|
|
2621
2730
|
errorMessage: w.dataset.formieErrorMessage || "",
|
|
2622
2731
|
fieldContainerErrorClass: ne.fieldLayoutError || [],
|
|
@@ -2627,17 +2736,17 @@ function to() {
|
|
|
2627
2736
|
if (w && k) {
|
|
2628
2737
|
const C = w;
|
|
2629
2738
|
C.formieValidation = k, Y.validation = k;
|
|
2630
|
-
const
|
|
2739
|
+
const $ = {
|
|
2631
2740
|
validator: k,
|
|
2632
2741
|
addValidator: k.addValidator.bind(k),
|
|
2633
2742
|
removeValidator: k.removeValidator.bind(k)
|
|
2634
2743
|
};
|
|
2635
|
-
I(w, "formie:validator:ready",
|
|
2744
|
+
I(w, "formie:validator:ready", $), I(f, "formie:validator:ready", $);
|
|
2636
2745
|
}
|
|
2637
|
-
w && ((
|
|
2746
|
+
w && ((P || T.endpoint || f.dataset.formieEndpoint) && Zi(f, w, T), J(w)), Object.keys(ne).length && I(f, "formie:theme:applied", {
|
|
2638
2747
|
hasClasses: !0
|
|
2639
2748
|
});
|
|
2640
|
-
const me = await
|
|
2749
|
+
const me = await Sr(fe, {
|
|
2641
2750
|
registry: t,
|
|
2642
2751
|
matchContext: {
|
|
2643
2752
|
root: f,
|
|
@@ -2651,8 +2760,8 @@ function to() {
|
|
|
2651
2760
|
target: f,
|
|
2652
2761
|
scope: "form",
|
|
2653
2762
|
state: Y,
|
|
2654
|
-
on: (C,
|
|
2655
|
-
emit: (C,
|
|
2763
|
+
on: (C, $) => m.on(C, $),
|
|
2764
|
+
emit: (C, $) => (I(f, C, $), m.emitSafe(C, $).then((Z) => {
|
|
2656
2765
|
Z.failed.length > 0 && L.warn("Lifecycle listeners failed.", {
|
|
2657
2766
|
eventName: C,
|
|
2658
2767
|
failed: Z.failed.length
|
|
@@ -2664,7 +2773,7 @@ function to() {
|
|
|
2664
2773
|
target: V(f),
|
|
2665
2774
|
moduleInstances: me.length
|
|
2666
2775
|
});
|
|
2667
|
-
const
|
|
2776
|
+
const qe = {
|
|
2668
2777
|
id: S,
|
|
2669
2778
|
root: f,
|
|
2670
2779
|
submit: async (C = "submit") => {
|
|
@@ -2679,15 +2788,15 @@ function to() {
|
|
|
2679
2788
|
message: "No form element found for mount target.",
|
|
2680
2789
|
formErrors: ["No form element found for mount target."]
|
|
2681
2790
|
};
|
|
2682
|
-
const
|
|
2683
|
-
if (
|
|
2791
|
+
const $ = w.querySelector('input[name="submitAction"]');
|
|
2792
|
+
if ($ && ($.value = C), w.getAttribute("data-formie-loading") === "true")
|
|
2684
2793
|
return {
|
|
2685
2794
|
ok: !1,
|
|
2686
2795
|
code: "SUBMIT_IN_PROGRESS",
|
|
2687
2796
|
message: "Submission already in progress.",
|
|
2688
2797
|
formErrors: []
|
|
2689
2798
|
};
|
|
2690
|
-
const Z = w.querySelector(`[data-formie-action="${C}"]`), Q = await
|
|
2799
|
+
const Z = w.querySelector(`[data-formie-action="${C}"]`), Q = await yr({
|
|
2691
2800
|
id: S,
|
|
2692
2801
|
target: f,
|
|
2693
2802
|
form: w,
|
|
@@ -2698,7 +2807,7 @@ function to() {
|
|
|
2698
2807
|
submitter: Z,
|
|
2699
2808
|
waitForSubmitDelay: Ye,
|
|
2700
2809
|
onRefreshTokensAfterSubmit: async () => {
|
|
2701
|
-
await
|
|
2810
|
+
await wr(f, T, w);
|
|
2702
2811
|
},
|
|
2703
2812
|
dispatchSubmitResult: (Ve) => {
|
|
2704
2813
|
I(f, "formie:submit:result", Ve);
|
|
@@ -2715,9 +2824,9 @@ function to() {
|
|
|
2715
2824
|
destroy: async () => {
|
|
2716
2825
|
await o(f);
|
|
2717
2826
|
},
|
|
2718
|
-
on: (C,
|
|
2827
|
+
on: (C, $) => m.on(C, $)
|
|
2719
2828
|
};
|
|
2720
|
-
w && (
|
|
2829
|
+
w && (Jr({
|
|
2721
2830
|
target: f,
|
|
2722
2831
|
form: w,
|
|
2723
2832
|
validatorDetail: k ? {
|
|
@@ -2725,16 +2834,16 @@ function to() {
|
|
|
2725
2834
|
addValidator: k.addValidator.bind(k),
|
|
2726
2835
|
removeValidator: k.removeValidator.bind(k)
|
|
2727
2836
|
} : null,
|
|
2728
|
-
options:
|
|
2837
|
+
options: R,
|
|
2729
2838
|
unbinds: g
|
|
2730
|
-
}),
|
|
2839
|
+
}), Gr({
|
|
2731
2840
|
target: f,
|
|
2732
2841
|
form: w,
|
|
2733
|
-
instance:
|
|
2734
|
-
options:
|
|
2842
|
+
instance: qe,
|
|
2843
|
+
options: R,
|
|
2735
2844
|
unbinds: g
|
|
2736
|
-
})), w && (
|
|
2737
|
-
const
|
|
2845
|
+
})), w && (lo(f, w, T, m, k, g), k && g.push(Wn(w, k, f)), await uo(f, T, w)), i.forEach((C) => {
|
|
2846
|
+
const $ = m.on(`formie:stage:${C}:before`, async (W) => {
|
|
2738
2847
|
I(f, `formie:stage:${C}:before`, W);
|
|
2739
2848
|
}), Z = m.on(`formie:stage:${C}:before`, async (W) => {
|
|
2740
2849
|
for (const ie of me)
|
|
@@ -2746,22 +2855,22 @@ function to() {
|
|
|
2746
2855
|
for (const bt of me)
|
|
2747
2856
|
bt.onAfterStage && await bt.onAfterStage(ie, ie.result);
|
|
2748
2857
|
});
|
|
2749
|
-
g.push(
|
|
2858
|
+
g.push($, Z, Q, Ve);
|
|
2750
2859
|
});
|
|
2751
|
-
const
|
|
2860
|
+
const Or = m.on("formie:submit:before", async (C) => {
|
|
2752
2861
|
I(f, "formie:submit:before", C);
|
|
2753
2862
|
}), $r = m.on("formie:submit:after", async (C) => {
|
|
2754
2863
|
I(f, "formie:submit:after", C);
|
|
2755
2864
|
}), Hr = m.on("formie:submit:final:before", async (C) => {
|
|
2756
2865
|
I(f, "formie:submit:final:before", C);
|
|
2757
|
-
}),
|
|
2866
|
+
}), _r = m.on("formie:submit:final:after", async (C) => {
|
|
2758
2867
|
I(f, "formie:submit:final:after", C);
|
|
2759
2868
|
});
|
|
2760
2869
|
return g.push(
|
|
2761
|
-
|
|
2870
|
+
Or,
|
|
2762
2871
|
$r,
|
|
2763
2872
|
Hr,
|
|
2764
|
-
|
|
2873
|
+
_r
|
|
2765
2874
|
), e.set(f, {
|
|
2766
2875
|
options: T,
|
|
2767
2876
|
bus: m,
|
|
@@ -2769,7 +2878,7 @@ function to() {
|
|
|
2769
2878
|
validator: k,
|
|
2770
2879
|
modules: me,
|
|
2771
2880
|
unbinds: g,
|
|
2772
|
-
instance:
|
|
2881
|
+
instance: qe
|
|
2773
2882
|
}), I(f, "formie:mount:after", {
|
|
2774
2883
|
id: S,
|
|
2775
2884
|
mode: T.mode
|
|
@@ -2777,9 +2886,9 @@ function to() {
|
|
|
2777
2886
|
id: S,
|
|
2778
2887
|
target: V(f),
|
|
2779
2888
|
mode: T.mode
|
|
2780
|
-
}),
|
|
2889
|
+
}), qe;
|
|
2781
2890
|
}, s = (f, v) => {
|
|
2782
|
-
if (!v.autoVisible ||
|
|
2891
|
+
if (!v.autoVisible || oo(f) || typeof IntersectionObserver > "u")
|
|
2783
2892
|
return a(f, v);
|
|
2784
2893
|
if (e.has(f))
|
|
2785
2894
|
return Promise.resolve(e.get(f)?.instance || null);
|
|
@@ -2818,7 +2927,7 @@ function to() {
|
|
|
2818
2927
|
...E.options,
|
|
2819
2928
|
...v
|
|
2820
2929
|
};
|
|
2821
|
-
const y = v.payload?.theme || E.options.payload?.theme ||
|
|
2930
|
+
const y = v.payload?.theme || E.options.payload?.theme || Ot(f, E.form)?.theme, m = yt(f, y, E.form);
|
|
2822
2931
|
return E.validator && (E.validator.config.fieldContainerErrorClass = m.fieldLayoutError || [], E.validator.config.inputErrorClass = m.fieldControlError || [], E.validator.config.messagesClass = m.fieldErrors || [], E.validator.config.messageClass = m.fieldError || []), Object.keys(m).length && I(f, "formie:theme:applied", {
|
|
2823
2932
|
hasClasses: !0,
|
|
2824
2933
|
reason: "update"
|
|
@@ -2826,14 +2935,14 @@ function to() {
|
|
|
2826
2935
|
},
|
|
2827
2936
|
getInstance: (f) => e.get(f)?.instance || null,
|
|
2828
2937
|
refreshForCache: async (f) => {
|
|
2829
|
-
|
|
2938
|
+
Gi(
|
|
2830
2939
|
"refreshForCache",
|
|
2831
2940
|
"Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead."
|
|
2832
2941
|
);
|
|
2833
2942
|
let v = null;
|
|
2834
2943
|
if (typeof f == "string") {
|
|
2835
|
-
const
|
|
2836
|
-
|
|
2944
|
+
const P = document.getElementById(f);
|
|
2945
|
+
P ? v = P : v = document.querySelector(`[data-formie-form-id="${f}"]`);
|
|
2837
2946
|
} else
|
|
2838
2947
|
v = f;
|
|
2839
2948
|
if (!v) {
|
|
@@ -2856,8 +2965,8 @@ function to() {
|
|
|
2856
2965
|
});
|
|
2857
2966
|
return;
|
|
2858
2967
|
}
|
|
2859
|
-
const
|
|
2860
|
-
|
|
2968
|
+
const R = await nt(S, g, T);
|
|
2969
|
+
R && (pt(y, R), I(v, "formie:refresh-tokens:after", R));
|
|
2861
2970
|
},
|
|
2862
2971
|
registerModule: (f, v) => t.register(f, v),
|
|
2863
2972
|
unregisterModule: (f) => {
|
|
@@ -2913,7 +3022,7 @@ function to() {
|
|
|
2913
3022
|
subtree: !0
|
|
2914
3023
|
}), () => {
|
|
2915
3024
|
E.disconnect(), L.log("Observer stopped."), r.forEach((m, g) => {
|
|
2916
|
-
|
|
3025
|
+
ao(g, v) && (m(), r.delete(g));
|
|
2917
3026
|
});
|
|
2918
3027
|
const y = [];
|
|
2919
3028
|
v instanceof Element && v.matches(X) && y.push(v), v.querySelectorAll(X).forEach((m) => {
|
|
@@ -2925,9 +3034,9 @@ function to() {
|
|
|
2925
3034
|
}
|
|
2926
3035
|
};
|
|
2927
3036
|
}
|
|
2928
|
-
const
|
|
2929
|
-
async function
|
|
2930
|
-
const t = e.root, r = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), n = e.modules ?? [], i = e.mode ?? "server-rendered", o = e.registry ?? new
|
|
3037
|
+
const Tr = _("general", "module-hydrator");
|
|
3038
|
+
async function ha(e) {
|
|
3039
|
+
const t = e.root, r = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), n = e.modules ?? [], i = e.mode ?? "server-rendered", o = e.registry ?? new vr(), a = new Gt(), s = await Sr(n, {
|
|
2931
3040
|
registry: o,
|
|
2932
3041
|
setupContext: {
|
|
2933
3042
|
formId: r?.id || t.id || "formie-modules",
|
|
@@ -2948,13 +3057,13 @@ async function sa(e) {
|
|
|
2948
3057
|
mode: i
|
|
2949
3058
|
}
|
|
2950
3059
|
});
|
|
2951
|
-
return
|
|
3060
|
+
return Tr.log("Hydrated module manifest.", {
|
|
2952
3061
|
moduleCount: n.length,
|
|
2953
3062
|
instanceCount: s.length,
|
|
2954
3063
|
mode: i
|
|
2955
3064
|
}), {
|
|
2956
3065
|
destroy: async () => {
|
|
2957
|
-
await
|
|
3066
|
+
await fo(s), a.clear();
|
|
2958
3067
|
},
|
|
2959
3068
|
on: (l, d) => a.on(l, d),
|
|
2960
3069
|
emit: async (l, d) => {
|
|
@@ -2967,45 +3076,45 @@ async function sa(e) {
|
|
|
2967
3076
|
getRegisteredModules: () => o.getAll()
|
|
2968
3077
|
};
|
|
2969
3078
|
}
|
|
2970
|
-
async function
|
|
3079
|
+
async function fo(e) {
|
|
2971
3080
|
for (const t of e)
|
|
2972
3081
|
try {
|
|
2973
3082
|
await t.destroy();
|
|
2974
3083
|
} catch (r) {
|
|
2975
|
-
console.error("[formie] Failed to destroy module instance.", r),
|
|
3084
|
+
console.error("[formie] Failed to destroy module instance.", r), Tr.warn("Failed destroying module instance.", { error: r });
|
|
2976
3085
|
}
|
|
2977
3086
|
}
|
|
2978
|
-
function
|
|
3087
|
+
function Pe(e) {
|
|
2979
3088
|
return e instanceof Element;
|
|
2980
3089
|
}
|
|
2981
|
-
function
|
|
3090
|
+
function mo(e) {
|
|
2982
3091
|
return e.ok;
|
|
2983
3092
|
}
|
|
2984
|
-
function
|
|
2985
|
-
return typeof e == "string" ? `selector "${e}"` :
|
|
3093
|
+
function po(e) {
|
|
3094
|
+
return typeof e == "string" ? `selector "${e}"` : Pe(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
|
|
2986
3095
|
}
|
|
2987
|
-
function
|
|
3096
|
+
function go(e) {
|
|
2988
3097
|
const t = /* @__PURE__ */ new Set(), r = [];
|
|
2989
3098
|
for (const n of e)
|
|
2990
|
-
!
|
|
3099
|
+
!Pe(n) || t.has(n) || (t.add(n), r.push(n));
|
|
2991
3100
|
return r;
|
|
2992
3101
|
}
|
|
2993
3102
|
function Ze(e) {
|
|
2994
|
-
return typeof e == "string" ? Array.from(document.querySelectorAll(e)) :
|
|
3103
|
+
return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : Pe(e) ? [e] : go(e);
|
|
2995
3104
|
}
|
|
2996
|
-
function
|
|
3105
|
+
function ho() {
|
|
2997
3106
|
return document.readyState !== "loading" ? Promise.resolve() : new Promise((e) => {
|
|
2998
3107
|
document.addEventListener("DOMContentLoaded", () => e(), { once: !0 });
|
|
2999
3108
|
});
|
|
3000
3109
|
}
|
|
3001
|
-
async function
|
|
3110
|
+
async function bo(e) {
|
|
3002
3111
|
const t = Ze(e);
|
|
3003
|
-
return t.length > 0 || typeof e != "string" ? t : (await
|
|
3112
|
+
return t.length > 0 || typeof e != "string" ? t : (await ho(), Ze(e));
|
|
3004
3113
|
}
|
|
3005
|
-
function
|
|
3006
|
-
return typeof e == "string" ? document :
|
|
3114
|
+
function yo(e) {
|
|
3115
|
+
return typeof e == "string" ? document : Pe(e) ? e.getRootNode() : document;
|
|
3007
3116
|
}
|
|
3008
|
-
function
|
|
3117
|
+
function vo(e) {
|
|
3009
3118
|
const {
|
|
3010
3119
|
element: t,
|
|
3011
3120
|
observe: r,
|
|
@@ -3023,8 +3132,8 @@ function uo(e) {
|
|
|
3023
3132
|
...p
|
|
3024
3133
|
};
|
|
3025
3134
|
}
|
|
3026
|
-
async function
|
|
3027
|
-
const i = [], o =
|
|
3135
|
+
async function $t(e, t, r, n) {
|
|
3136
|
+
const i = [], o = vo(e);
|
|
3028
3137
|
for (const a of n) {
|
|
3029
3138
|
const s = r.get(a);
|
|
3030
3139
|
if (s) {
|
|
@@ -3034,9 +3143,9 @@ async function Ht(e, t, r, n) {
|
|
|
3034
3143
|
const l = await t.mount(a, o), d = [];
|
|
3035
3144
|
if (e.onReady?.(l), d.push(l.on("formie:submit:result", (p) => {
|
|
3036
3145
|
const h = p;
|
|
3037
|
-
e.onResult?.(h, l),
|
|
3146
|
+
e.onResult?.(h, l), mo(h) ? e.onSuccess?.(h, l) : e.onError?.(h, l);
|
|
3038
3147
|
})), e.onEvent)
|
|
3039
|
-
for (const p of
|
|
3148
|
+
for (const p of Nr)
|
|
3040
3149
|
d.push(l.on(p, (h) => {
|
|
3041
3150
|
e.onEvent?.({
|
|
3042
3151
|
name: p,
|
|
@@ -3050,12 +3159,12 @@ async function Ht(e, t, r, n) {
|
|
|
3050
3159
|
}
|
|
3051
3160
|
return i;
|
|
3052
3161
|
}
|
|
3053
|
-
async function
|
|
3054
|
-
const t = e.client ??
|
|
3162
|
+
async function ba(e) {
|
|
3163
|
+
const t = e.client ?? co(), r = /* @__PURE__ */ new Map(), n = await bo(e.element);
|
|
3055
3164
|
if (n.length === 0 && !e.allowEmpty)
|
|
3056
|
-
throw new Error(`Formie could not find any elements for ${
|
|
3057
|
-
await
|
|
3058
|
-
const i = e.observe ? t.observe(
|
|
3165
|
+
throw new Error(`Formie could not find any elements for ${po(e.element)}.`);
|
|
3166
|
+
await $t(e, t, r, n);
|
|
3167
|
+
const i = e.observe ? t.observe(yo(e.element)) : null;
|
|
3059
3168
|
return {
|
|
3060
3169
|
client: t,
|
|
3061
3170
|
get instances() {
|
|
@@ -3067,7 +3176,7 @@ async function la(e) {
|
|
|
3067
3176
|
},
|
|
3068
3177
|
async rescan() {
|
|
3069
3178
|
const o = Ze(e.element);
|
|
3070
|
-
return o.length === 0 ? Array.from(r.values()).map(({ instance: a }) => a) :
|
|
3179
|
+
return o.length === 0 ? Array.from(r.values()).map(({ instance: a }) => a) : $t(e, t, r, o);
|
|
3071
3180
|
},
|
|
3072
3181
|
async destroy() {
|
|
3073
3182
|
i?.();
|
|
@@ -3077,13 +3186,13 @@ async function la(e) {
|
|
|
3077
3186
|
}
|
|
3078
3187
|
};
|
|
3079
3188
|
}
|
|
3080
|
-
const gt = 2e3,
|
|
3189
|
+
const gt = 2e3, ya = 5e3, va = 5e3, Ea = 12e4;
|
|
3081
3190
|
async function ht(e) {
|
|
3082
3191
|
await new Promise((t) => {
|
|
3083
3192
|
window.setTimeout(t, Math.max(e, 0));
|
|
3084
3193
|
});
|
|
3085
3194
|
}
|
|
3086
|
-
async function
|
|
3195
|
+
async function Sa(e, {
|
|
3087
3196
|
timeoutMs: t = 5e3,
|
|
3088
3197
|
intervalMs: r = 30
|
|
3089
3198
|
} = {}) {
|
|
@@ -3096,7 +3205,7 @@ async function fa(e, {
|
|
|
3096
3205
|
}
|
|
3097
3206
|
throw new Error("Timed out waiting for async condition.");
|
|
3098
3207
|
}
|
|
3099
|
-
function
|
|
3208
|
+
function Mr(e, t) {
|
|
3100
3209
|
let r = null;
|
|
3101
3210
|
return (...n) => {
|
|
3102
3211
|
r !== null && window.clearTimeout(r), r = window.setTimeout(() => {
|
|
@@ -3104,14 +3213,14 @@ function Tr(e, t) {
|
|
|
3104
3213
|
}, Math.max(t, 0));
|
|
3105
3214
|
};
|
|
3106
3215
|
}
|
|
3107
|
-
function
|
|
3216
|
+
function Aa(e) {
|
|
3108
3217
|
const t = String(e || "asyncDefer").toLowerCase();
|
|
3109
3218
|
return {
|
|
3110
3219
|
async: t.includes("async"),
|
|
3111
3220
|
defer: t.includes("defer")
|
|
3112
3221
|
};
|
|
3113
3222
|
}
|
|
3114
|
-
function
|
|
3223
|
+
function Cr(e, t) {
|
|
3115
3224
|
const r = Array.from(e.querySelectorAll(`input[name="${t}"], textarea[name="${t}"]`));
|
|
3116
3225
|
for (const n of r) {
|
|
3117
3226
|
const i = String(n.value || "").trim();
|
|
@@ -3121,23 +3230,23 @@ function Mr(e, t) {
|
|
|
3121
3230
|
return "";
|
|
3122
3231
|
}
|
|
3123
3232
|
function Qe(e, t) {
|
|
3124
|
-
return t.some((r) =>
|
|
3233
|
+
return t.some((r) => Cr(e, r) !== "");
|
|
3125
3234
|
}
|
|
3126
|
-
function
|
|
3235
|
+
function Eo(e, t) {
|
|
3127
3236
|
t.forEach((r) => {
|
|
3128
3237
|
Array.from(e.querySelectorAll(`input[name="${r}"], textarea[name="${r}"]`)).forEach((i) => {
|
|
3129
3238
|
i.value = "";
|
|
3130
3239
|
});
|
|
3131
3240
|
});
|
|
3132
3241
|
}
|
|
3133
|
-
function
|
|
3242
|
+
function Lr(e, t, {
|
|
3134
3243
|
value: r = "",
|
|
3135
3244
|
container: n
|
|
3136
3245
|
} = {}) {
|
|
3137
3246
|
let i = e.querySelector(`input[name="${t}"]`);
|
|
3138
3247
|
return i || (i = document.createElement("input"), i.type = "hidden", i.name = t, (n || (e instanceof HTMLElement ? e : null))?.appendChild(i)), i.value = r, i;
|
|
3139
3248
|
}
|
|
3140
|
-
async function
|
|
3249
|
+
async function Ir(e, t, r) {
|
|
3141
3250
|
if (Qe(e, t))
|
|
3142
3251
|
return !0;
|
|
3143
3252
|
const n = Date.now() + Math.max(r, 0);
|
|
@@ -3146,13 +3255,13 @@ async function Lr(e, t, r) {
|
|
|
3146
3255
|
return !0;
|
|
3147
3256
|
return !1;
|
|
3148
3257
|
}
|
|
3149
|
-
const
|
|
3258
|
+
const So = /* @__PURE__ */ new Set([
|
|
3150
3259
|
"handle",
|
|
3151
3260
|
"placeholderSelector",
|
|
3152
3261
|
"errorMessage",
|
|
3153
3262
|
"sessionKey",
|
|
3154
3263
|
"value"
|
|
3155
|
-
]),
|
|
3264
|
+
]), Ao = "[data-formie-captcha-error-container]", wo = [
|
|
3156
3265
|
"formie:page:navigate",
|
|
3157
3266
|
"formie:page:navigate:after",
|
|
3158
3267
|
"formie:submit:result"
|
|
@@ -3175,34 +3284,34 @@ function Ne(e, t) {
|
|
|
3175
3284
|
const r = Ie(e, t);
|
|
3176
3285
|
return r.find((n) => Xe(n)) || r[0] || null;
|
|
3177
3286
|
}
|
|
3178
|
-
function
|
|
3287
|
+
function To(e) {
|
|
3179
3288
|
e.innerHTML = "";
|
|
3180
3289
|
const t = document.createElement("div");
|
|
3181
3290
|
return e.appendChild(t), t;
|
|
3182
3291
|
}
|
|
3183
3292
|
function et(e) {
|
|
3184
|
-
e?.querySelector(
|
|
3293
|
+
e?.querySelector(Ao)?.remove();
|
|
3185
3294
|
}
|
|
3186
|
-
function
|
|
3295
|
+
function Mo(e, t, r) {
|
|
3187
3296
|
if (!e)
|
|
3188
3297
|
return;
|
|
3189
3298
|
et(e);
|
|
3190
3299
|
const n = document.createElement("div");
|
|
3191
|
-
n.setAttribute("data-formie-captcha-error-container", ""), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"),
|
|
3300
|
+
n.setAttribute("data-formie-captcha-error-container", ""), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"), O(n, r || e, "fieldErrors");
|
|
3192
3301
|
const i = document.createElement("div");
|
|
3193
|
-
i.setAttribute("data-formie-captcha-error", ""), i.setAttribute("role", "alert"),
|
|
3302
|
+
i.setAttribute("data-formie-captcha-error", ""), i.setAttribute("role", "alert"), O(i, r || e, "fieldError"), i.textContent = t, n.appendChild(i), e.appendChild(n);
|
|
3194
3303
|
}
|
|
3195
|
-
function
|
|
3304
|
+
function Co(e) {
|
|
3196
3305
|
const t = e instanceof CustomEvent ? e.detail : null;
|
|
3197
3306
|
return !t || typeof t != "object" ? null : t;
|
|
3198
3307
|
}
|
|
3199
|
-
function
|
|
3308
|
+
function Lo(e, t) {
|
|
3200
3309
|
if (!e?.captchas || typeof e.captchas != "object")
|
|
3201
3310
|
return null;
|
|
3202
3311
|
const r = e.captchas[t];
|
|
3203
3312
|
return !r || typeof r != "object" ? null : r;
|
|
3204
3313
|
}
|
|
3205
|
-
function
|
|
3314
|
+
function Io(e, t, r, n) {
|
|
3206
3315
|
const i = /* @__PURE__ */ new Set(), o = () => {
|
|
3207
3316
|
const d = Ie(e, t), p = new Set(d.filter((h) => Xe(h)));
|
|
3208
3317
|
d.forEach((h) => {
|
|
@@ -3210,7 +3319,7 @@ function vo(e, t, r, n) {
|
|
|
3210
3319
|
}), Array.from(i).forEach((h) => {
|
|
3211
3320
|
p.has(h) || (i.delete(h), n(h));
|
|
3212
3321
|
});
|
|
3213
|
-
}, a =
|
|
3322
|
+
}, a = Mr(o, 20), s = new MutationObserver(() => {
|
|
3214
3323
|
a();
|
|
3215
3324
|
});
|
|
3216
3325
|
s.observe(e, {
|
|
@@ -3223,7 +3332,7 @@ function vo(e, t, r, n) {
|
|
|
3223
3332
|
se(window, "resize", () => {
|
|
3224
3333
|
a();
|
|
3225
3334
|
}),
|
|
3226
|
-
...
|
|
3335
|
+
...wo.map((d) => se(e, d, () => {
|
|
3227
3336
|
a();
|
|
3228
3337
|
}))
|
|
3229
3338
|
];
|
|
@@ -3239,17 +3348,17 @@ function vo(e, t, r, n) {
|
|
|
3239
3348
|
getVisible: () => Ie(e, t).filter((d) => Xe(d))
|
|
3240
3349
|
};
|
|
3241
3350
|
}
|
|
3242
|
-
function
|
|
3351
|
+
function Ro(e, t) {
|
|
3243
3352
|
return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
|
|
3244
3353
|
}
|
|
3245
|
-
function
|
|
3354
|
+
function Fo(e, t, {
|
|
3246
3355
|
defaultPlaceholderSelector: r,
|
|
3247
3356
|
defaultTokenFieldNames: n = [],
|
|
3248
3357
|
defaultWaitForValueMs: i = gt
|
|
3249
3358
|
}) {
|
|
3250
|
-
const o = t || {}, a = Object.entries(o).reduce((c, [b, A]) => (
|
|
3359
|
+
const o = t || {}, a = Object.entries(o).reduce((c, [b, A]) => (So.has(b) || (c[b] = A), c), {}), s = n.map(String).filter(Boolean), l = Number(i), d = typeof o.placeholderSelector == "string" && o.placeholderSelector.trim() !== "" ? o.placeholderSelector.trim() : r, p = typeof o.errorMessage == "string" && o.errorMessage.trim() !== "" ? o.errorMessage.trim() : x("Captcha challenge must be completed."), h = typeof o.sessionKey == "string" && o.sessionKey.trim() !== "" ? o.sessionKey.trim() : null, u = typeof o.value == "string" ? o.value : null;
|
|
3251
3360
|
return {
|
|
3252
|
-
handle:
|
|
3361
|
+
handle: Ro(e, o),
|
|
3253
3362
|
ui: {
|
|
3254
3363
|
placeholderSelector: d,
|
|
3255
3364
|
errorMessage: p
|
|
@@ -3263,7 +3372,7 @@ function So(e, t, {
|
|
|
3263
3372
|
provider: a
|
|
3264
3373
|
};
|
|
3265
3374
|
}
|
|
3266
|
-
function
|
|
3375
|
+
function ko(e, t) {
|
|
3267
3376
|
const r = e.form || e.root, n = t.ui.placeholderSelector, i = t.handle;
|
|
3268
3377
|
return {
|
|
3269
3378
|
form: e.form,
|
|
@@ -3271,8 +3380,8 @@ function Ao(e, t) {
|
|
|
3271
3380
|
placeholder: {
|
|
3272
3381
|
query: () => Ie(e.root, n),
|
|
3273
3382
|
getPrimary: () => Ne(e.root, n),
|
|
3274
|
-
observe: (o, a) =>
|
|
3275
|
-
createContainer: (o) =>
|
|
3383
|
+
observe: (o, a) => Io(e.root, n, o, a),
|
|
3384
|
+
createContainer: (o) => To(o),
|
|
3276
3385
|
clear: (o) => {
|
|
3277
3386
|
o && (et(o), o.innerHTML = "");
|
|
3278
3387
|
}
|
|
@@ -3280,7 +3389,7 @@ function Ao(e, t) {
|
|
|
3280
3389
|
errors: {
|
|
3281
3390
|
getDefaultMessage: () => t.ui.errorMessage,
|
|
3282
3391
|
show: (o, a) => {
|
|
3283
|
-
|
|
3392
|
+
Mo(a || Ne(e.root, n), o || t.ui.errorMessage, e.form || e.root);
|
|
3284
3393
|
},
|
|
3285
3394
|
clear: (o) => {
|
|
3286
3395
|
et(o || Ne(e.root, n));
|
|
@@ -3289,29 +3398,29 @@ function Ao(e, t) {
|
|
|
3289
3398
|
tokens: {
|
|
3290
3399
|
names: t.transport.tokenFieldNames,
|
|
3291
3400
|
has: (o = t.transport.tokenFieldNames, a = r) => Qe(a, o),
|
|
3292
|
-
read: (o = t.transport.tokenFieldNames[0], a = r) => o ?
|
|
3401
|
+
read: (o = t.transport.tokenFieldNames[0], a = r) => o ? Cr(a, o) : "",
|
|
3293
3402
|
write: (o, {
|
|
3294
3403
|
names: a = t.transport.tokenFieldNames,
|
|
3295
3404
|
root: s = r,
|
|
3296
3405
|
container: l = e.form
|
|
3297
3406
|
} = {}) => {
|
|
3298
3407
|
a.forEach((d) => {
|
|
3299
|
-
|
|
3408
|
+
Lr(s, d, {
|
|
3300
3409
|
value: o,
|
|
3301
3410
|
container: l
|
|
3302
3411
|
});
|
|
3303
3412
|
});
|
|
3304
3413
|
},
|
|
3305
3414
|
clear: (o = t.transport.tokenFieldNames, a = r) => {
|
|
3306
|
-
|
|
3415
|
+
Eo(a, o);
|
|
3307
3416
|
},
|
|
3308
|
-
wait: (o = t.transport.waitForValueMs, a = t.transport.tokenFieldNames, s = r) =>
|
|
3417
|
+
wait: (o = t.transport.waitForValueMs, a = t.transport.tokenFieldNames, s = r) => Ir(s, a, o)
|
|
3309
3418
|
},
|
|
3310
3419
|
refresh: {
|
|
3311
3420
|
providerHandle: i,
|
|
3312
3421
|
onTokensRefreshed: (o) => {
|
|
3313
3422
|
const a = ["formie:refresh-tokens:after", "formie:refresh-tokens:refreshed"].map((s) => se(e.root, s, (l) => {
|
|
3314
|
-
const d =
|
|
3423
|
+
const d = Co(l), p = Lo(d, i);
|
|
3315
3424
|
p && o(p);
|
|
3316
3425
|
}));
|
|
3317
3426
|
return () => {
|
|
@@ -3329,7 +3438,7 @@ function Ao(e, t) {
|
|
|
3329
3438
|
};
|
|
3330
3439
|
}
|
|
3331
3440
|
const G = _("captchas");
|
|
3332
|
-
function
|
|
3441
|
+
function Rr({
|
|
3333
3442
|
id: e,
|
|
3334
3443
|
defaultPlaceholderSelector: t,
|
|
3335
3444
|
defaultTokenFieldNames: r = [],
|
|
@@ -3341,7 +3450,7 @@ function Ir({
|
|
|
3341
3450
|
kind: "captcha",
|
|
3342
3451
|
match: () => !0,
|
|
3343
3452
|
setup: async (o) => {
|
|
3344
|
-
const a =
|
|
3453
|
+
const a = Fo(e, o.options || {}, {
|
|
3345
3454
|
defaultPlaceholderSelector: t,
|
|
3346
3455
|
defaultTokenFieldNames: r,
|
|
3347
3456
|
defaultWaitForValueMs: n
|
|
@@ -3351,7 +3460,7 @@ function Ir({
|
|
|
3351
3460
|
placeholderSelector: a.ui.placeholderSelector,
|
|
3352
3461
|
tokenFieldNames: a.transport.tokenFieldNames
|
|
3353
3462
|
});
|
|
3354
|
-
const s =
|
|
3463
|
+
const s = ko(o, a);
|
|
3355
3464
|
return i({
|
|
3356
3465
|
...o,
|
|
3357
3466
|
options: a,
|
|
@@ -3360,13 +3469,13 @@ function Ir({
|
|
|
3360
3469
|
}
|
|
3361
3470
|
};
|
|
3362
3471
|
}
|
|
3363
|
-
function
|
|
3472
|
+
function Po({
|
|
3364
3473
|
id: e,
|
|
3365
3474
|
defaultPlaceholderSelector: t,
|
|
3366
3475
|
defaultTokenFieldNames: r = [],
|
|
3367
3476
|
defaultWaitForValueMs: n = gt
|
|
3368
3477
|
}) {
|
|
3369
|
-
return
|
|
3478
|
+
return Rr({
|
|
3370
3479
|
id: e,
|
|
3371
3480
|
defaultPlaceholderSelector: t,
|
|
3372
3481
|
defaultTokenFieldNames: r,
|
|
@@ -3375,7 +3484,7 @@ function wo({
|
|
|
3375
3484
|
const s = [];
|
|
3376
3485
|
let l = i.placeholder.getPrimary(), d = o.transport.sessionKey, p = o.transport.value || "";
|
|
3377
3486
|
const h = (c) => {
|
|
3378
|
-
!c || !d || (c.innerHTML = "",
|
|
3487
|
+
!c || !d || (c.innerHTML = "", Lr(c, d, {
|
|
3379
3488
|
value: p,
|
|
3380
3489
|
container: c
|
|
3381
3490
|
}));
|
|
@@ -3405,7 +3514,7 @@ function wo({
|
|
|
3405
3514
|
const b = d ? [d] : o.transport.tokenFieldNames;
|
|
3406
3515
|
if (b.length === 0)
|
|
3407
3516
|
return;
|
|
3408
|
-
if (!await
|
|
3517
|
+
if (!await Ir(a, b, o.transport.waitForValueMs)) {
|
|
3409
3518
|
const f = i.errors.getDefaultMessage();
|
|
3410
3519
|
i.errors.show(f, l), G.warn("Passive captcha missing token.", {
|
|
3411
3520
|
moduleId: e,
|
|
@@ -3417,8 +3526,8 @@ function wo({
|
|
|
3417
3526
|
}
|
|
3418
3527
|
});
|
|
3419
3528
|
}
|
|
3420
|
-
function
|
|
3421
|
-
return
|
|
3529
|
+
function qo(e) {
|
|
3530
|
+
return Rr({
|
|
3422
3531
|
id: e.id,
|
|
3423
3532
|
defaultPlaceholderSelector: e.defaultPlaceholderSelector,
|
|
3424
3533
|
defaultTokenFieldNames: e.defaultTokenFieldNames,
|
|
@@ -3507,7 +3616,7 @@ function To(e) {
|
|
|
3507
3616
|
return r.push(t.services.events.onRoot("formie:submit:result", (c) => {
|
|
3508
3617
|
const b = c instanceof CustomEvent ? c.detail : null;
|
|
3509
3618
|
b?.stage !== "validate" && (b?.ok === !1 && b?.stage === "screen" || b?.ok !== !0 && u("submit-result"));
|
|
3510
|
-
})), t.form && r.push(t.services.events.onForm(
|
|
3619
|
+
})), t.form && r.push(t.services.events.onForm(je("reset"), () => {
|
|
3511
3620
|
o = t.services.placeholder.getPrimary() || o, window.setTimeout(() => {
|
|
3512
3621
|
u("reset-state");
|
|
3513
3622
|
}, 0);
|
|
@@ -3550,7 +3659,7 @@ function To(e) {
|
|
|
3550
3659
|
}
|
|
3551
3660
|
});
|
|
3552
3661
|
}
|
|
3553
|
-
const
|
|
3662
|
+
const wa = qo, Ta = Po, Ht = 2500, Vo = {
|
|
3554
3663
|
bpoint: ["bpointToken"],
|
|
3555
3664
|
stripe: ["stripePaymentIntentId"],
|
|
3556
3665
|
paypal: ["paypalOrderId", "paypalAuthId"],
|
|
@@ -3563,18 +3672,18 @@ const pa = To, ga = wo, Ot = 2500, Mo = {
|
|
|
3563
3672
|
paddle: ["paddleTransactionId"],
|
|
3564
3673
|
square: ["squarePaymentId"]
|
|
3565
3674
|
};
|
|
3566
|
-
function
|
|
3675
|
+
function Oo(e) {
|
|
3567
3676
|
return e.replace("{field:", "").replace("{", "").replace("}", "").replace("]", "").split("[").join("][");
|
|
3568
3677
|
}
|
|
3569
|
-
function
|
|
3570
|
-
return `fields[${
|
|
3678
|
+
function $o(e) {
|
|
3679
|
+
return `fields[${Oo(e)}]`;
|
|
3571
3680
|
}
|
|
3572
|
-
function
|
|
3573
|
-
const r =
|
|
3681
|
+
function Ho(e, t) {
|
|
3682
|
+
const r = $o(t), n = Array.from(e.querySelectorAll(`[name="${r}"]`)), i = Array.from(e.querySelectorAll(`[name="${r}[]"]`));
|
|
3574
3683
|
return (i.length ? i : n).filter((o) => o instanceof HTMLElement);
|
|
3575
3684
|
}
|
|
3576
3685
|
function _t(e, t) {
|
|
3577
|
-
const r =
|
|
3686
|
+
const r = Ho(e, t);
|
|
3578
3687
|
for (const n of r) {
|
|
3579
3688
|
const o = n.closest("[data-formie-field-handle]")?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim();
|
|
3580
3689
|
if (o)
|
|
@@ -3587,11 +3696,11 @@ function Ue(e) {
|
|
|
3587
3696
|
const r = t.includes(","), n = t.includes(".");
|
|
3588
3697
|
return r && n ? t = t.replace(/\./g, "").replace(/,/, ".") : r && !n ? t = t.replace(/,/, ".") : t = t.replace(/,/g, ""), parseFloat(t);
|
|
3589
3698
|
}
|
|
3590
|
-
function
|
|
3699
|
+
function _o(e) {
|
|
3591
3700
|
return e.replace(/^\{field:/, "").replace(/^\{/, "").replace(/\}$/, "").trim();
|
|
3592
3701
|
}
|
|
3593
3702
|
function de(e) {
|
|
3594
|
-
return
|
|
3703
|
+
return _o(e).replace(/\]/g, "").split("[").join(".").replace(/\.+/g, ".").replace(/^\./, "").replace(/\.$/, "");
|
|
3595
3704
|
}
|
|
3596
3705
|
function Fr(e) {
|
|
3597
3706
|
const r = de(e).split(".").filter(Boolean);
|
|
@@ -3600,14 +3709,14 @@ function Fr(e) {
|
|
|
3600
3709
|
const [n, ...i] = r;
|
|
3601
3710
|
return `fields[${n}]${i.map((o) => `[${o}]`).join("")}`;
|
|
3602
3711
|
}
|
|
3603
|
-
function
|
|
3712
|
+
function Do(e) {
|
|
3604
3713
|
const r = String(e || "").trim().match(/^fields\[([^\]]+)\](.*)$/);
|
|
3605
3714
|
if (!r)
|
|
3606
3715
|
return "";
|
|
3607
3716
|
const n = r[1] || "", i = r[2] || "", o = Array.from(i.matchAll(/\[([^\]]+)\]/g)).map((a) => a[1] || "").filter(Boolean);
|
|
3608
3717
|
return [n, ...o].join(".");
|
|
3609
3718
|
}
|
|
3610
|
-
function
|
|
3719
|
+
function xo(e) {
|
|
3611
3720
|
const t = e.split(";").map((a) => a.trim()).filter(Boolean);
|
|
3612
3721
|
if (!t.length)
|
|
3613
3722
|
return {
|
|
@@ -3633,7 +3742,7 @@ function ko(e) {
|
|
|
3633
3742
|
transforms: i
|
|
3634
3743
|
};
|
|
3635
3744
|
}
|
|
3636
|
-
function
|
|
3745
|
+
function kr(e) {
|
|
3637
3746
|
const t = String(e || "").trim();
|
|
3638
3747
|
if (!t)
|
|
3639
3748
|
return {
|
|
@@ -3658,7 +3767,7 @@ function Rr(e) {
|
|
|
3658
3767
|
isToken: !1,
|
|
3659
3768
|
isValid: !0
|
|
3660
3769
|
};
|
|
3661
|
-
const n = (r[1] || "").trim().toLowerCase(), i = (r[2] || "").trim(), [o, a = ""] = i.split("|", 2), { source: s, transforms: l } =
|
|
3770
|
+
const n = (r[1] || "").trim().toLowerCase(), i = (r[2] || "").trim(), [o, a = ""] = i.split("|", 2), { source: s, transforms: l } = xo(o || "");
|
|
3662
3771
|
if (n !== "field")
|
|
3663
3772
|
return {
|
|
3664
3773
|
raw: t,
|
|
@@ -3682,10 +3791,10 @@ function Rr(e) {
|
|
|
3682
3791
|
isValid: u !== ""
|
|
3683
3792
|
};
|
|
3684
3793
|
}
|
|
3685
|
-
function
|
|
3794
|
+
function No(e) {
|
|
3686
3795
|
return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
|
|
3687
3796
|
}
|
|
3688
|
-
function
|
|
3797
|
+
function Uo(e, t, r) {
|
|
3689
3798
|
const n = t.trim(), i = String(r.name || "").trim();
|
|
3690
3799
|
if (!n || !i)
|
|
3691
3800
|
return;
|
|
@@ -3696,14 +3805,14 @@ function Po(e, t, r) {
|
|
|
3696
3805
|
};
|
|
3697
3806
|
o.names.includes(i) || o.names.push(i), o.inputs.includes(r) || o.inputs.push(r), e.set(n, o);
|
|
3698
3807
|
}
|
|
3699
|
-
function
|
|
3808
|
+
function Bo(e) {
|
|
3700
3809
|
const t = /* @__PURE__ */ new Map();
|
|
3701
|
-
return Array.from(e.querySelectorAll("[name]")).filter((n) =>
|
|
3702
|
-
const i =
|
|
3703
|
-
i &&
|
|
3810
|
+
return Array.from(e.querySelectorAll("[name]")).filter((n) => No(n)).forEach((n) => {
|
|
3811
|
+
const i = Do(n.name);
|
|
3812
|
+
i && Uo(t, i, n);
|
|
3704
3813
|
}), t;
|
|
3705
3814
|
}
|
|
3706
|
-
function
|
|
3815
|
+
function jo(e) {
|
|
3707
3816
|
if (!e.length)
|
|
3708
3817
|
return "";
|
|
3709
3818
|
const t = e[0];
|
|
@@ -3715,33 +3824,33 @@ function $o(e) {
|
|
|
3715
3824
|
}
|
|
3716
3825
|
return t.value;
|
|
3717
3826
|
}
|
|
3718
|
-
function
|
|
3827
|
+
function Pr(e, t) {
|
|
3719
3828
|
return e.get(de(t)) || null;
|
|
3720
3829
|
}
|
|
3721
|
-
function
|
|
3722
|
-
const r =
|
|
3830
|
+
function zo(e, t) {
|
|
3831
|
+
const r = kr(e), n = r.key, i = Pr(t, n);
|
|
3723
3832
|
if (!i)
|
|
3724
3833
|
return {
|
|
3725
3834
|
key: n,
|
|
3726
3835
|
value: r.defaultValue,
|
|
3727
3836
|
found: !1
|
|
3728
3837
|
};
|
|
3729
|
-
const o =
|
|
3838
|
+
const o = jo(i.inputs);
|
|
3730
3839
|
return {
|
|
3731
3840
|
key: n,
|
|
3732
3841
|
value: o === "" && r.defaultValue !== "" ? r.defaultValue : o,
|
|
3733
3842
|
found: !0
|
|
3734
3843
|
};
|
|
3735
3844
|
}
|
|
3736
|
-
function
|
|
3737
|
-
const n =
|
|
3845
|
+
function Ma(e, t, r) {
|
|
3846
|
+
const n = kr(e), i = n.key;
|
|
3738
3847
|
if (!i)
|
|
3739
3848
|
return {
|
|
3740
3849
|
key: i,
|
|
3741
3850
|
value: n.defaultValue,
|
|
3742
3851
|
found: !1
|
|
3743
3852
|
};
|
|
3744
|
-
const o = r ?
|
|
3853
|
+
const o = r ? Pr(r, i) : null, s = (o?.names?.length ? o.names : [Fr(i)]).flatMap((l) => {
|
|
3745
3854
|
const d = t.getAll(l).map((p) => String(p ?? ""));
|
|
3746
3855
|
return d.length ? d : t.getAll(`${l}[]`).map((p) => String(p ?? ""));
|
|
3747
3856
|
}).filter((l) => l !== "");
|
|
@@ -3769,7 +3878,7 @@ function Ae(e, t) {
|
|
|
3769
3878
|
missingSuffix: r
|
|
3770
3879
|
};
|
|
3771
3880
|
}
|
|
3772
|
-
async function
|
|
3881
|
+
async function Vr(e, t, r) {
|
|
3773
3882
|
const n = Ae(e, t);
|
|
3774
3883
|
if (n.ok)
|
|
3775
3884
|
return n;
|
|
@@ -3782,22 +3891,22 @@ async function Pr(e, t, r) {
|
|
|
3782
3891
|
}
|
|
3783
3892
|
return Ae(e, t);
|
|
3784
3893
|
}
|
|
3785
|
-
const
|
|
3894
|
+
const Wo = /* @__PURE__ */ new Set([
|
|
3786
3895
|
"handle",
|
|
3787
3896
|
"requiredInputSuffixes",
|
|
3788
3897
|
"waitForValueMs",
|
|
3789
3898
|
"errorMessage"
|
|
3790
3899
|
]), Dt = "[data-payment-success]", xt = "[data-payment-error]";
|
|
3791
|
-
function
|
|
3900
|
+
function Ko(e, t) {
|
|
3792
3901
|
return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
|
|
3793
3902
|
}
|
|
3794
|
-
function
|
|
3795
|
-
const n = t || {}, i = Object.entries(n).reduce((l, [d, p]) => (
|
|
3903
|
+
function Go(e, t, r) {
|
|
3904
|
+
const n = t || {}, i = Object.entries(n).reduce((l, [d, p]) => (Wo.has(d) || (l[d] = p), l), {}), o = Array.isArray(n.requiredInputSuffixes) ? n.requiredInputSuffixes.map(String).filter(Boolean) : r.defaultRequiredInputSuffixes || [], a = Number(n.waitForValueMs ?? r.defaultWaitForValueMs ?? Ht), s = typeof n.errorMessage == "string" && n.errorMessage.trim() !== "" ? n.errorMessage.trim() : "Payment authorization is incomplete.";
|
|
3796
3905
|
return {
|
|
3797
|
-
handle:
|
|
3906
|
+
handle: Ko(e, n),
|
|
3798
3907
|
transport: {
|
|
3799
3908
|
requiredInputSuffixes: o,
|
|
3800
|
-
waitForValueMs: Number.isFinite(a) ? a :
|
|
3909
|
+
waitForValueMs: Number.isFinite(a) ? a : Ht,
|
|
3801
3910
|
errorMessage: s
|
|
3802
3911
|
},
|
|
3803
3912
|
provider: i
|
|
@@ -3808,9 +3917,9 @@ function Nt(e, t, r) {
|
|
|
3808
3917
|
e.removeEventListener(t, r);
|
|
3809
3918
|
};
|
|
3810
3919
|
}
|
|
3811
|
-
function
|
|
3812
|
-
const r = e.target, n = e.form, i = e.root, o = n || i, a = t.transport.requiredInputSuffixes, s = () =>
|
|
3813
|
-
const g =
|
|
3920
|
+
function Jo(e, t) {
|
|
3921
|
+
const r = e.target, n = e.form, i = e.root, o = n || i, a = t.transport.requiredInputSuffixes, s = () => Bo(n || i), l = (y) => {
|
|
3922
|
+
const g = zo(y, s()).value;
|
|
3814
3923
|
return Array.isArray(g) ? g[0] || "" : String(g || "");
|
|
3815
3924
|
};
|
|
3816
3925
|
return {
|
|
@@ -3828,7 +3937,7 @@ function xo(e, t) {
|
|
|
3828
3937
|
const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(xt);
|
|
3829
3938
|
g && g.remove();
|
|
3830
3939
|
const S = document.createElement("div");
|
|
3831
|
-
S.setAttribute("data-payment-error", ""), S.textContent = y,
|
|
3940
|
+
S.setAttribute("data-payment-error", ""), S.textContent = y, O(S, n || i, "fieldError"), m.appendChild(S);
|
|
3832
3941
|
},
|
|
3833
3942
|
removeError: () => {
|
|
3834
3943
|
r.querySelector(xt)?.remove();
|
|
@@ -3837,30 +3946,30 @@ function xo(e, t) {
|
|
|
3837
3946
|
const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(Dt);
|
|
3838
3947
|
g && g.remove();
|
|
3839
3948
|
const S = document.createElement("div");
|
|
3840
|
-
S.setAttribute("data-payment-success", ""), S.textContent = y,
|
|
3949
|
+
S.setAttribute("data-payment-success", ""), S.textContent = y, O(S, n || i, "successMessage"), m.appendChild(S);
|
|
3841
3950
|
},
|
|
3842
3951
|
removeSuccess: () => {
|
|
3843
3952
|
r.querySelector(Dt)?.remove();
|
|
3844
3953
|
},
|
|
3845
3954
|
hasToken: () => Ae(o, a).ok,
|
|
3846
|
-
waitForToken: (y = t.transport.waitForValueMs) =>
|
|
3955
|
+
waitForToken: (y = t.transport.waitForValueMs) => Vr(o, a, y).then((m) => m.ok),
|
|
3847
3956
|
getFieldValue: (y, m = "string") => {
|
|
3848
3957
|
const g = l(y);
|
|
3849
3958
|
return m === "float" || m === "int" || m === "number" ? Ue(g) : g;
|
|
3850
3959
|
},
|
|
3851
3960
|
resolveAmount: (y) => {
|
|
3852
|
-
const m = n || i, S = String(y.type || "").toLowerCase() === "dynamic" && typeof y.variable == "string" && y.variable.trim() !== "", M = y.value ?? (S ? y.variable : y.fixed), T = String(M ?? "").trim(),
|
|
3853
|
-
if (Number.isFinite(
|
|
3854
|
-
return { ok: !0, value:
|
|
3961
|
+
const m = n || i, S = String(y.type || "").toLowerCase() === "dynamic" && typeof y.variable == "string" && y.variable.trim() !== "", M = y.value ?? (S ? y.variable : y.fixed), T = String(M ?? "").trim(), R = typeof M == "number" ? M : Ue(T);
|
|
3962
|
+
if (Number.isFinite(R) && R > 0)
|
|
3963
|
+
return { ok: !0, value: R };
|
|
3855
3964
|
if (T !== "") {
|
|
3856
|
-
const
|
|
3965
|
+
const P = l(T), w = Ue(P);
|
|
3857
3966
|
if (Number.isFinite(w) && w > 0)
|
|
3858
3967
|
return { ok: !0, value: w };
|
|
3859
|
-
const
|
|
3860
|
-
if (!
|
|
3968
|
+
const q = _t(m, T);
|
|
3969
|
+
if (!P)
|
|
3861
3970
|
return {
|
|
3862
3971
|
ok: !1,
|
|
3863
|
-
error:
|
|
3972
|
+
error: q ? x('Provide a value for "{label}" to proceed.', { label: q }) : x("Provide a payment amount to proceed.")
|
|
3864
3973
|
};
|
|
3865
3974
|
}
|
|
3866
3975
|
return {
|
|
@@ -3869,18 +3978,18 @@ function xo(e, t) {
|
|
|
3869
3978
|
};
|
|
3870
3979
|
},
|
|
3871
3980
|
resolveCurrency: (y) => {
|
|
3872
|
-
const m = n || i, S = String(y.type || "").toLowerCase() === "dynamic" && typeof y.variable == "string" && y.variable.trim() !== "", M = y.value ?? (S ? y.variable : y.fixed ?? y.defaultCurrency ?? ""), T = String(M ?? "").trim(),
|
|
3873
|
-
if (/^[A-Z]{3}$/.test(
|
|
3874
|
-
return { ok: !0, value:
|
|
3981
|
+
const m = n || i, S = String(y.type || "").toLowerCase() === "dynamic" && typeof y.variable == "string" && y.variable.trim() !== "", M = y.value ?? (S ? y.variable : y.fixed ?? y.defaultCurrency ?? ""), T = String(M ?? "").trim(), R = T.toUpperCase();
|
|
3982
|
+
if (/^[A-Z]{3}$/.test(R) && !S)
|
|
3983
|
+
return { ok: !0, value: R };
|
|
3875
3984
|
if (T !== "") {
|
|
3876
|
-
const
|
|
3985
|
+
const P = String(l(T) || "").trim(), w = P.toUpperCase();
|
|
3877
3986
|
if (/^[A-Z]{3}$/.test(w))
|
|
3878
3987
|
return { ok: !0, value: w };
|
|
3879
|
-
const
|
|
3880
|
-
if (!
|
|
3988
|
+
const q = _t(m, T);
|
|
3989
|
+
if (!P)
|
|
3881
3990
|
return {
|
|
3882
3991
|
ok: !1,
|
|
3883
|
-
error:
|
|
3992
|
+
error: q ? x('Provide a value for "{label}" to proceed.', { label: q }) : x("Provide a payment currency to proceed.")
|
|
3884
3993
|
};
|
|
3885
3994
|
}
|
|
3886
3995
|
return {
|
|
@@ -3889,27 +3998,27 @@ function xo(e, t) {
|
|
|
3889
3998
|
};
|
|
3890
3999
|
},
|
|
3891
4000
|
watchFieldValueChanges: (y, m, g = 600) => {
|
|
3892
|
-
const S = n || i, M = y.map((
|
|
4001
|
+
const S = n || i, M = y.map((q) => String(q || "").trim()).filter(Boolean);
|
|
3893
4002
|
if (M.length === 0)
|
|
3894
4003
|
return () => {
|
|
3895
4004
|
};
|
|
3896
|
-
const T = s(),
|
|
3897
|
-
M.forEach((
|
|
3898
|
-
const N = de(
|
|
3899
|
-
if (
|
|
3900
|
-
|
|
3901
|
-
|
|
4005
|
+
const T = s(), R = /* @__PURE__ */ new Set();
|
|
4006
|
+
M.forEach((q) => {
|
|
4007
|
+
const N = de(q), z = T.get(N);
|
|
4008
|
+
if (z?.names?.length) {
|
|
4009
|
+
z.names.forEach((fe) => {
|
|
4010
|
+
R.add(fe);
|
|
3902
4011
|
});
|
|
3903
4012
|
return;
|
|
3904
4013
|
}
|
|
3905
4014
|
const Y = Fr(N);
|
|
3906
|
-
Y && (
|
|
4015
|
+
Y && (R.add(Y), R.add(`${Y}[]`));
|
|
3907
4016
|
});
|
|
3908
|
-
const
|
|
4017
|
+
const P = Mr(() => {
|
|
3909
4018
|
m();
|
|
3910
|
-
}, g), w = (
|
|
3911
|
-
const
|
|
3912
|
-
!
|
|
4019
|
+
}, g), w = (q) => {
|
|
4020
|
+
const z = q.target?.name || "";
|
|
4021
|
+
!z || !R.has(z) || P();
|
|
3913
4022
|
};
|
|
3914
4023
|
return S.addEventListener("input", w), S.addEventListener("change", w), () => {
|
|
3915
4024
|
S.removeEventListener("input", w), S.removeEventListener("change", w);
|
|
@@ -3934,8 +4043,8 @@ function xo(e, t) {
|
|
|
3934
4043
|
g && (m.email = g);
|
|
3935
4044
|
}
|
|
3936
4045
|
if (y.billingAddress) {
|
|
3937
|
-
const g = y.billingAddress, S = {}, M = l(`${g}.address1`), T = l(`${g}.address2`),
|
|
3938
|
-
M && (S.line1 = M), T && (S.line2 = T),
|
|
4046
|
+
const g = y.billingAddress, S = {}, M = l(`${g}.address1`), T = l(`${g}.address2`), R = l(`${g}.address3`), P = l(`${g}.city`), w = l(`${g}.zip`), q = l(`${g}.state`), N = l(`${g}.country`);
|
|
4047
|
+
M && (S.line1 = M), T && (S.line2 = T), R && (S.line3 = R), P && (S.city = P), w && (S.postal_code = w), q && (S.state = q), N && (S.country = N), Object.keys(S).length && (m.address = S);
|
|
3939
4048
|
}
|
|
3940
4049
|
return { billing_details: m };
|
|
3941
4050
|
},
|
|
@@ -3951,8 +4060,8 @@ function Ut(e) {
|
|
|
3951
4060
|
const t = e;
|
|
3952
4061
|
return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
|
|
3953
4062
|
}
|
|
3954
|
-
function
|
|
3955
|
-
const t = e.defaultRequiredInputSuffixes ??
|
|
4063
|
+
function Yo(e) {
|
|
4064
|
+
const t = e.defaultRequiredInputSuffixes ?? Vo[e.id] ?? [];
|
|
3956
4065
|
return {
|
|
3957
4066
|
id: e.id,
|
|
3958
4067
|
kind: "payment",
|
|
@@ -3970,13 +4079,13 @@ function No(e) {
|
|
|
3970
4079
|
} catch {
|
|
3971
4080
|
}
|
|
3972
4081
|
}
|
|
3973
|
-
const a =
|
|
4082
|
+
const a = Go(
|
|
3974
4083
|
e.id,
|
|
3975
4084
|
r.options || {},
|
|
3976
4085
|
{
|
|
3977
4086
|
defaultRequiredInputSuffixes: t
|
|
3978
4087
|
}
|
|
3979
|
-
), s =
|
|
4088
|
+
), s = Jo(r, a), l = {
|
|
3980
4089
|
...r,
|
|
3981
4090
|
options: a,
|
|
3982
4091
|
services: s
|
|
@@ -4077,7 +4186,7 @@ function No(e) {
|
|
|
4077
4186
|
}
|
|
4078
4187
|
if (a.transport.requiredInputSuffixes.length === 0)
|
|
4079
4188
|
return;
|
|
4080
|
-
const S = r.form || r.root, M = await
|
|
4189
|
+
const S = r.form || r.root, M = await Vr(
|
|
4081
4190
|
S,
|
|
4082
4191
|
a.transport.requiredInputSuffixes,
|
|
4083
4192
|
a.transport.waitForValueMs
|
|
@@ -4101,7 +4210,7 @@ function No(e) {
|
|
|
4101
4210
|
}
|
|
4102
4211
|
};
|
|
4103
4212
|
}
|
|
4104
|
-
const
|
|
4213
|
+
const Ca = Yo, Zo = "[data-formie-address-autocomplete-input]", Bt = "[data-formie-address-location]", Qo = {
|
|
4105
4214
|
autoComplete: "[data-formie-address-autocomplete-input]",
|
|
4106
4215
|
address1: "[data-formie-address-line1-input]",
|
|
4107
4216
|
address2: "[data-formie-address-line2-input]",
|
|
@@ -4110,24 +4219,24 @@ const ba = No, Uo = "[data-formie-address-autocomplete-input]", zt = "[data-form
|
|
|
4110
4219
|
state: "[data-formie-address-state-input]",
|
|
4111
4220
|
zip: "[data-formie-address-zip-input]",
|
|
4112
4221
|
country: "[data-formie-address-country-input]"
|
|
4113
|
-
},
|
|
4114
|
-
function
|
|
4222
|
+
}, Xo = /* @__PURE__ */ new Set(["handle"]);
|
|
4223
|
+
function ea(e, t) {
|
|
4115
4224
|
return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
|
|
4116
4225
|
}
|
|
4117
|
-
function
|
|
4118
|
-
const r = t || {}, n = Object.entries(r).reduce((i, [o, a]) => (
|
|
4226
|
+
function ta(e, t) {
|
|
4227
|
+
const r = t || {}, n = Object.entries(r).reduce((i, [o, a]) => (Xo.has(o) || (i[o] = a), i), {});
|
|
4119
4228
|
return {
|
|
4120
|
-
handle:
|
|
4229
|
+
handle: ea(e, r),
|
|
4121
4230
|
provider: n
|
|
4122
4231
|
};
|
|
4123
4232
|
}
|
|
4124
|
-
function
|
|
4233
|
+
function ra(e, t, r) {
|
|
4125
4234
|
return e.addEventListener(t, r), () => {
|
|
4126
4235
|
e.removeEventListener(t, r);
|
|
4127
4236
|
};
|
|
4128
4237
|
}
|
|
4129
|
-
function
|
|
4130
|
-
const t = e.target, r = e.form, n = e.root, i =
|
|
4238
|
+
function na(e) {
|
|
4239
|
+
const t = e.target, r = e.form, n = e.root, i = Zo;
|
|
4131
4240
|
return {
|
|
4132
4241
|
root: n,
|
|
4133
4242
|
field: t,
|
|
@@ -4135,14 +4244,14 @@ function Go(e) {
|
|
|
4135
4244
|
input: {
|
|
4136
4245
|
getAutocomplete: () => t.querySelector(i),
|
|
4137
4246
|
setValue: (o, a, s) => {
|
|
4138
|
-
const l =
|
|
4247
|
+
const l = Qo[o], d = t.querySelector(l);
|
|
4139
4248
|
d && (d.value = a || s || "");
|
|
4140
4249
|
}
|
|
4141
4250
|
},
|
|
4142
4251
|
location: {
|
|
4143
|
-
getButton: () => t.querySelector(
|
|
4252
|
+
getButton: () => t.querySelector(Bt),
|
|
4144
4253
|
onUseLocation: (o) => {
|
|
4145
|
-
const a = t.querySelector(
|
|
4254
|
+
const a = t.querySelector(Bt);
|
|
4146
4255
|
if (!a)
|
|
4147
4256
|
return () => {
|
|
4148
4257
|
};
|
|
@@ -4160,22 +4269,22 @@ function Go(e) {
|
|
|
4160
4269
|
}
|
|
4161
4270
|
},
|
|
4162
4271
|
events: {
|
|
4163
|
-
onField: (o, a) =>
|
|
4272
|
+
onField: (o, a) => ra(t, o, a)
|
|
4164
4273
|
}
|
|
4165
4274
|
};
|
|
4166
4275
|
}
|
|
4167
4276
|
const te = _("address");
|
|
4168
|
-
function
|
|
4277
|
+
function jt(e) {
|
|
4169
4278
|
const t = e;
|
|
4170
4279
|
return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
|
|
4171
4280
|
}
|
|
4172
|
-
function
|
|
4281
|
+
function ia(e) {
|
|
4173
4282
|
return {
|
|
4174
4283
|
id: e.id,
|
|
4175
4284
|
kind: "address",
|
|
4176
4285
|
match: (t) => !!t.target.querySelector("[data-formie-address-autocomplete-input]"),
|
|
4177
4286
|
setup: async (t) => {
|
|
4178
|
-
const r =
|
|
4287
|
+
const r = ta(e.id, t.options || {}), n = na(t);
|
|
4179
4288
|
te.log("Setup module.", {
|
|
4180
4289
|
moduleId: e.id
|
|
4181
4290
|
});
|
|
@@ -4197,7 +4306,7 @@ function Jo(e) {
|
|
|
4197
4306
|
const d = async () => (a || (te.log("Loading provider API.", {
|
|
4198
4307
|
moduleId: e.id
|
|
4199
4308
|
}), a = e.load(i)), a), p = async () => {
|
|
4200
|
-
if (s || !
|
|
4309
|
+
if (s || !jt(t.target))
|
|
4201
4310
|
return;
|
|
4202
4311
|
const c = await d();
|
|
4203
4312
|
s = await e.mount({
|
|
@@ -4210,7 +4319,7 @@ function Jo(e) {
|
|
|
4210
4319
|
moduleId: e.id
|
|
4211
4320
|
});
|
|
4212
4321
|
};
|
|
4213
|
-
|
|
4322
|
+
jt(t.target) && await p(), ["formie:page:navigate:after", "formie:submit:result"].forEach((c) => {
|
|
4214
4323
|
const b = () => {
|
|
4215
4324
|
p();
|
|
4216
4325
|
};
|
|
@@ -4255,60 +4364,60 @@ function Jo(e) {
|
|
|
4255
4364
|
}
|
|
4256
4365
|
};
|
|
4257
4366
|
}
|
|
4258
|
-
const
|
|
4367
|
+
const La = ia;
|
|
4259
4368
|
export {
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4369
|
+
ga as $,
|
|
4370
|
+
Qo as A,
|
|
4371
|
+
Un as B,
|
|
4372
|
+
ya as C,
|
|
4373
|
+
oa as D,
|
|
4265
4374
|
Gr as E,
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4375
|
+
Nr as F,
|
|
4376
|
+
Jr as G,
|
|
4377
|
+
co as H,
|
|
4269
4378
|
Yr as I,
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4379
|
+
Zr as J,
|
|
4380
|
+
ba as K,
|
|
4381
|
+
Dr as L,
|
|
4382
|
+
vr as M,
|
|
4383
|
+
ir as N,
|
|
4384
|
+
Br as O,
|
|
4385
|
+
Ur as P,
|
|
4386
|
+
ha as Q,
|
|
4387
|
+
Do as R,
|
|
4388
|
+
Wt as S,
|
|
4389
|
+
pa as T,
|
|
4390
|
+
aa as U,
|
|
4391
|
+
kr as V,
|
|
4392
|
+
Ma as W,
|
|
4393
|
+
xr as X,
|
|
4394
|
+
da as Y,
|
|
4395
|
+
ma as Z,
|
|
4396
|
+
Be as _,
|
|
4397
|
+
wa as a,
|
|
4398
|
+
Aa as b,
|
|
4399
|
+
Ea as c,
|
|
4400
|
+
La as d,
|
|
4401
|
+
Ta as e,
|
|
4402
|
+
va as f,
|
|
4403
|
+
la as g,
|
|
4295
4404
|
_ as h,
|
|
4296
|
-
|
|
4405
|
+
Bo as i,
|
|
4297
4406
|
Fr as j,
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4407
|
+
sa as k,
|
|
4408
|
+
ua as l,
|
|
4409
|
+
je as m,
|
|
4301
4410
|
de as n,
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4411
|
+
Re as o,
|
|
4412
|
+
Mr as p,
|
|
4413
|
+
fa as q,
|
|
4414
|
+
zo as r,
|
|
4306
4415
|
ht as s,
|
|
4307
4416
|
ue as t,
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4417
|
+
x as u,
|
|
4418
|
+
Ca as v,
|
|
4419
|
+
Sa as w,
|
|
4420
|
+
ca as x,
|
|
4421
|
+
O as y,
|
|
4422
|
+
le as z
|
|
4314
4423
|
};
|