@verbb/formie-browser 1.0.14 → 1.0.15

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/chunks/{address-country-Dn71jroa.js → address-country-BcEQKw0T.js} +1 -1
  3. package/dist/chunks/{address-finder-O49uDRoR.js → address-finder-BWGINCSA.js} +1 -1
  4. package/dist/chunks/{address-state-ByYatUur.js → address-state-DI3ndhMU.js} +98 -88
  5. package/dist/chunks/{api-DYYsVIub.js → api-BK9b340y.js} +16 -16
  6. package/dist/chunks/{api-D6kJ7kXZ.js → api-Dxl_CKw-.js} +30 -25
  7. package/dist/chunks/{async-nPFRNQ06.js → async-2GdXNFCE.js} +18 -1
  8. package/dist/chunks/{bpoint-D0RKFM4F.js → bpoint-BwtuyN_O.js} +1 -1
  9. package/dist/chunks/{captcha-eu-DERJbXnH.js → captcha-eu-DWLoQFKB.js} +2 -2
  10. package/dist/chunks/{combobox-CWNdx4Fk.js → combobox-Ba08_cHL.js} +259 -258
  11. package/dist/chunks/{conditions-DqNHLTbN.js → conditions-Ceeg6ReZ.js} +113 -110
  12. package/dist/chunks/{date-picker-RUnevF7l.js → date-picker-DaPvMrop.js} +12 -11
  13. package/dist/chunks/{eway-or6dtjoT.js → eway-uw0DzU-L.js} +3 -3
  14. package/dist/chunks/{file-upload-Bm-TXyNB.js → file-upload-B8_mH012.js} +28 -16
  15. package/dist/chunks/{friendly-captcha-v1-GFqCt1Mh.js → friendly-captcha-v1-CVXaXgDO.js} +1 -1
  16. package/dist/chunks/{friendly-captcha-v2-WoW246JG.js → friendly-captcha-v2-DkeIVTKI.js} +1 -1
  17. package/dist/chunks/{go-cardless-DzJ-0FKg.js → go-cardless-c4wLJdOt.js} +1 -1
  18. package/dist/chunks/{google-address-C1P1nTDM.js → google-address-JHYvjwgN.js} +13 -8
  19. package/dist/chunks/{hcaptcha-D0T8aIHz.js → hcaptcha-Dt3ELLlP.js} +2 -2
  20. package/dist/chunks/{loqate-DD1S7PY9.js → loqate-m51iPyO1.js} +1 -1
  21. package/dist/chunks/{mollie-DG8Ju83x.js → mollie-Bn0PX173.js} +1 -1
  22. package/dist/chunks/{moneris-C8m3Fvqu.js → moneris-BRbUvI4t.js} +1 -1
  23. package/dist/chunks/{opayo-B3EvrVxw.js → opayo-BwWdInEP.js} +2 -2
  24. package/dist/chunks/{paddle-BIYR9Um3.js → paddle-CympHVvd.js} +2 -2
  25. package/dist/chunks/{paypal-B_yxIo2d.js → paypal-h75h6wae.js} +2 -2
  26. package/dist/chunks/{payway-CeOzS0sL.js → payway-C9rHTCC_.js} +2 -2
  27. package/dist/chunks/{phone-country-bAqje17P.js → phone-country-B8fv-L5_.js} +1 -1
  28. package/dist/chunks/{place-kit-BE5gi3vo.js → place-kit-BnZGQ-L1.js} +8 -8
  29. package/dist/chunks/{recaptcha-enterprise-CruXddZq.js → recaptcha-enterprise-CUs8BO6V.js} +2 -2
  30. package/dist/chunks/{recaptcha-shared-AQRMDMme.js → recaptcha-shared-DTbTw-MF.js} +2 -2
  31. package/dist/chunks/{recaptcha-v2-checkbox-CCnJYCnG.js → recaptcha-v2-checkbox-P1McW4Pv.js} +2 -2
  32. package/dist/chunks/{recaptcha-v2-invisible-BuVqRRYn.js → recaptcha-v2-invisible-FGDqozSP.js} +2 -2
  33. package/dist/chunks/{recaptcha-v3-CloqhO2A.js → recaptcha-v3-CflUHeZD.js} +2 -2
  34. package/dist/chunks/{repeater-DwE27jI1.js → repeater-CyhDbozO.js} +47 -33
  35. package/dist/chunks/{scripts-CbQ7agX3.js → scripts-DrccjrFv.js} +1 -1
  36. package/dist/chunks/skip-CEW89ExY.js +7 -0
  37. package/dist/chunks/{snaptcha-C04kNGYQ.js → snaptcha-C3QLYxFT.js} +1 -1
  38. package/dist/chunks/{square-DEzxv9D9.js → square-C1z5DPVw.js} +2 -2
  39. package/dist/chunks/{stripe-CVPQGDz3.js → stripe-Dmkdkq1y.js} +2 -2
  40. package/dist/chunks/{summary-BF_8mrXI.js → summary-Bn-g5SDx.js} +1 -1
  41. package/dist/chunks/{table-DnIBdeKF.js → table-j7MlLLCc.js} +1 -1
  42. package/dist/chunks/{turnstile-n9DNyPxi.js → turnstile-ptihQfLl.js} +2 -2
  43. package/dist/chunks/{upload-manager-BbiUosZq.js → upload-manager-BW7l-BhF.js} +248 -236
  44. package/dist/index.js +548 -535
  45. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  46. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  47. package/dist/js/core/submit-result-ui.d.ts +3 -1
  48. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  49. package/dist/js/modules/address/google-address.d.ts +10 -0
  50. package/dist/js/modules/address/google-address.d.ts.map +1 -1
  51. package/dist/js/modules/address/place-kit.d.ts.map +1 -1
  52. package/dist/js/modules/fields/address-state.d.ts.map +1 -1
  53. package/dist/js/modules/fields/combobox.d.ts.map +1 -1
  54. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
  55. package/dist/js/modules/fields/conditions.d.ts.map +1 -1
  56. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  57. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  58. package/dist/js/modules/fields/repeater.d.ts.map +1 -1
  59. package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
  60. package/dist/js/utils/async.d.ts +1 -0
  61. package/dist/js/utils/async.d.ts.map +1 -1
  62. package/dist/js/validation/rules/required.d.ts.map +1 -1
  63. package/dist/js/validation/validator.d.ts.map +1 -1
  64. package/package.json +2 -2
  65. package/src/js/core/create-formie-client.ts +17 -10
  66. package/src/js/core/submit-result-state.ts +17 -0
  67. package/src/js/core/submit-result-ui.ts +4 -3
  68. package/src/js/modules/address/google-address.ts +95 -37
  69. package/src/js/modules/address/place-kit.ts +13 -7
  70. package/src/js/modules/fields/address-country.ts +5 -5
  71. package/src/js/modules/fields/address-state.ts +74 -23
  72. package/src/js/modules/fields/combobox.ts +3 -0
  73. package/src/js/modules/fields/conditions/effects.ts +4 -5
  74. package/src/js/modules/fields/conditions.ts +6 -0
  75. package/src/js/modules/fields/date-picker.ts +6 -3
  76. package/src/js/modules/fields/file-upload.ts +44 -14
  77. package/src/js/modules/fields/phone-country.ts +2 -2
  78. package/src/js/modules/fields/repeater.ts +55 -4
  79. package/src/js/modules/fields/upload-manager.ts +54 -18
  80. package/src/js/utils/async.ts +34 -0
  81. package/src/js/validation/rules/required.ts +12 -0
  82. package/src/js/validation/validator.ts +14 -2
@@ -1,8 +1,8 @@
1
1
  import { a as e, d as t, u as n } from "./event-names-BCI2FLD8.js";
2
2
  import { t as r } from "./debug-BV0DvdHx.js";
3
3
  import { a as i, i as a, t as o } from "./theme-classes-DAQuEqdP.js";
4
- import { i as s } from "./i18n-BY1ds1BL.js";
5
- import { n as c, t as l } from "./async-nPFRNQ06.js";
4
+ import { n as s, t as c } from "./async-2GdXNFCE.js";
5
+ import { i as l } from "./i18n-BY1ds1BL.js";
6
6
  import { r as u, t as d } from "./field-references.keys-58ZSTrCW.js";
7
7
  import { n as f, r as p } from "./field-references.resolver-Ca8MguFv.js";
8
8
  //#region src/js/core/dom-events.ts
@@ -332,7 +332,11 @@ function V(e, t) {
332
332
  let c = e;
333
333
  c.formieValidation && E(e, c.formieValidation);
334
334
  }
335
- function H(e, t) {
335
+ function Se(e, t) {
336
+ if (t.meta?.resetSubmissionIdentity === !0) {
337
+ M(e, "submissionId"), M(e, "submissionUid"), M(e, "progressId"), A(e, "expectedVersion", "0"), H(e);
338
+ return;
339
+ }
336
340
  let n = t.meta?.session?.version ?? t.meta?.version;
337
341
  typeof n == "number" && A(e, "expectedVersion", String(n));
338
342
  let r = t.meta?.submissionUid;
@@ -340,7 +344,7 @@ function H(e, t) {
340
344
  let i = (t.meta?.session)?.continuation?.progressId;
341
345
  typeof i == "string" && i.trim() !== "" ? A(e, "progressId", i) : M(e, "progressId");
342
346
  }
343
- function Se(e) {
347
+ function H(e) {
344
348
  let t = e.getAttribute("action");
345
349
  t && e.setAttribute("action", fe(t, "resumeToken"));
346
350
  try {
@@ -363,7 +367,7 @@ function Ce(e, t) {
363
367
  }
364
368
  function U(t, n = {}) {
365
369
  let r = t.formieValidation, i = N(t)[0]?.getAttribute("data-formie-page-id");
366
- if (L(t), t.reset(), n.preserveHiddenState || I(t, !1), M(t, "submissionId"), A(t, "expectedVersion", "0"), M(t, "submissionUid"), M(t, "progressId"), M(t, "pageId"), Se(t), r?.resetLiveState(), i) {
370
+ if (L(t), t.reset(), n.preserveHiddenState || I(t, !1), M(t, "submissionId"), A(t, "expectedVersion", "0"), M(t, "submissionUid"), M(t, "progressId"), M(t, "pageId"), H(t), r?.resetLiveState(), i) {
367
371
  V(t, i), t.dispatchEvent(new CustomEvent(e("reset"), { bubbles: !0 }));
368
372
  return;
369
373
  }
@@ -401,6 +405,7 @@ function Ee(e, t, n) {
401
405
  U(e), k.log("Resetting state due to stale/reset marker.");
402
406
  return;
403
407
  }
408
+ t.payment?.action?.type === "redirect" && t.payment.action.url && j(e, "payment-redirect");
404
409
  let r = Te(e, t);
405
410
  if (!t.ok && t.redirect?.url && !r.hasPaymentFollowUpEvent) {
406
411
  k.log("Applying redirect fallback for failed result.", {
@@ -409,7 +414,7 @@ function Ee(e, t, n) {
409
414
  }), L(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank", "noopener,noreferrer") : (j(e, "redirect"), window.location.href = t.redirect.url);
410
415
  return;
411
416
  }
412
- if (H(e, t), !t.ok) {
417
+ if (Se(e, t), !t.ok) {
413
418
  k.log("Non-redirect failure; keeping current form state."), L(e);
414
419
  return;
415
420
  }
@@ -510,7 +515,7 @@ async function Y(e, t, n) {
510
515
  if (r.ok) return r;
511
516
  let i = Date.now() + Math.max(n, 0);
512
517
  for (; Date.now() < i;) {
513
- await c(120);
518
+ await s(120);
514
519
  let n = J(e, t);
515
520
  if (n.ok) return n;
516
521
  }
@@ -545,7 +550,7 @@ function Q(e, t, n) {
545
550
  };
546
551
  }
547
552
  function Fe(e, t) {
548
- let n = e.target, r = e.form, i = e.root, a = r || i, c = t.transport.requiredInputSuffixes, m = () => p(r || i), h = (e) => {
553
+ let n = e.target, r = e.form, i = e.root, a = r || i, s = t.transport.requiredInputSuffixes, m = () => p(r || i), h = (e) => {
549
554
  let t = f(e, m()).value;
550
555
  return Array.isArray(t) ? t[0] || "" : String(t || "");
551
556
  };
@@ -578,17 +583,17 @@ function Fe(e, t) {
578
583
  removeSuccess: () => {
579
584
  n.querySelector(X)?.remove();
580
585
  },
581
- hasToken: () => J(a, c).ok,
582
- waitForToken: (e = t.transport.waitForValueMs) => Y(a, c, e).then((e) => e.ok),
586
+ hasToken: () => J(a, s).ok,
587
+ waitForToken: (e = t.transport.waitForValueMs) => Y(a, s, e).then((e) => e.ok),
583
588
  getFieldValue: (e, t = "string") => {
584
589
  let n = h(e);
585
590
  return t === "float" || t === "int" || t === "number" ? G(n) : n;
586
591
  },
587
592
  resolveAmount: (e) => {
588
- let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed), o = String(a ?? "").trim(), c = typeof a == "number" ? a : G(o);
589
- if (Number.isFinite(c) && c > 0) return {
593
+ let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed), o = String(a ?? "").trim(), s = typeof a == "number" ? a : G(o);
594
+ if (Number.isFinite(s) && s > 0) return {
590
595
  ok: !0,
591
- value: c
596
+ value: s
592
597
  };
593
598
  if (o !== "") {
594
599
  let e = h(o), n = G(e);
@@ -599,19 +604,19 @@ function Fe(e, t) {
599
604
  let r = W(t, o);
600
605
  if (!e) return {
601
606
  ok: !1,
602
- error: r ? s("Provide a value for \"{label}\" to proceed.", { label: r }) : s("Provide a payment amount to proceed.")
607
+ error: r ? l("Provide a value for \"{label}\" to proceed.", { label: r }) : l("Provide a payment amount to proceed.")
603
608
  };
604
609
  }
605
610
  return {
606
611
  ok: !1,
607
- error: s("Payment amount must be greater than 0.")
612
+ error: l("Payment amount must be greater than 0.")
608
613
  };
609
614
  },
610
615
  resolveCurrency: (e) => {
611
- let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed ?? e.defaultCurrency ?? ""), o = String(a ?? "").trim(), c = o.toUpperCase();
612
- if (/^[A-Z]{3}$/.test(c) && !n) return {
616
+ let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed ?? e.defaultCurrency ?? ""), o = String(a ?? "").trim(), s = o.toUpperCase();
617
+ if (/^[A-Z]{3}$/.test(s) && !n) return {
613
618
  ok: !0,
614
- value: c
619
+ value: s
615
620
  };
616
621
  if (o !== "") {
617
622
  let e = String(h(o) || "").trim(), n = e.toUpperCase();
@@ -622,34 +627,34 @@ function Fe(e, t) {
622
627
  let r = W(t, o);
623
628
  if (!e) return {
624
629
  ok: !1,
625
- error: r ? s("Provide a value for \"{label}\" to proceed.", { label: r }) : s("Provide a payment currency to proceed.")
630
+ error: r ? l("Provide a value for \"{label}\" to proceed.", { label: r }) : l("Provide a payment currency to proceed.")
626
631
  };
627
632
  }
628
633
  return {
629
634
  ok: !1,
630
- error: s("Payment currency must be a valid 3-letter code.")
635
+ error: l("Payment currency must be a valid 3-letter code.")
631
636
  };
632
637
  },
633
638
  watchFieldValueChanges: (e, t, n = 600) => {
634
639
  let a = r || i, o = e.map((e) => String(e || "").trim()).filter(Boolean);
635
640
  if (o.length === 0) return () => {};
636
- let s = m(), c = /* @__PURE__ */ new Set();
641
+ let s = m(), l = /* @__PURE__ */ new Set();
637
642
  o.forEach((e) => {
638
643
  let t = u(e), n = s.get(t);
639
644
  if (n?.names?.length) {
640
645
  n.names.forEach((e) => {
641
- c.add(e);
646
+ l.add(e);
642
647
  });
643
648
  return;
644
649
  }
645
650
  let r = d(t);
646
- r && (c.add(r), c.add(`${r}[]`));
651
+ r && (l.add(r), l.add(`${r}[]`));
647
652
  });
648
- let f = l(() => {
653
+ let f = c(() => {
649
654
  t();
650
655
  }, n), p = (e) => {
651
656
  let t = e.target?.name || "";
652
- t && c.has(t) && f();
657
+ t && l.has(t) && f();
653
658
  };
654
659
  return a.addEventListener("input", p), a.addEventListener("change", p), () => {
655
660
  a.removeEventListener("input", p), a.removeEventListener("change", p);
@@ -21,5 +21,22 @@ function n(e, t) {
21
21
  }, Math.max(t, 0));
22
22
  };
23
23
  }
24
+ function r(e, t = document, n = 1e4) {
25
+ return new Promise((r, i) => {
26
+ if (!t.querySelector(e)) {
27
+ r();
28
+ return;
29
+ }
30
+ let a = null, o = new MutationObserver(() => {
31
+ t.querySelector(e) || (o.disconnect(), a !== null && window.clearTimeout(a), r());
32
+ });
33
+ o.observe(t, {
34
+ childList: !0,
35
+ subtree: !0
36
+ }), a = window.setTimeout(() => {
37
+ o.disconnect(), i(/* @__PURE__ */ Error(`Timed out waiting for "${e}" to be removed.`));
38
+ }, Math.max(n, 0));
39
+ });
40
+ }
24
41
  //#endregion
25
- export { e as n, t as r, n as t };
42
+ export { r as i, e as n, t as r, n as t };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./api-D6kJ7kXZ.js";
1
+ import { t as e } from "./api-Dxl_CKw-.js";
2
2
  //#region src/js/modules/payments/bpoint.ts
3
3
  var t = e({
4
4
  moduleId: "formie:bpoint",
@@ -1,5 +1,5 @@
1
- import { a as e, t } from "./api-DYYsVIub.js";
2
- import { r as n } from "./scripts-CbQ7agX3.js";
1
+ import { a as e, t } from "./api-BK9b340y.js";
2
+ import { r as n } from "./scripts-DrccjrFv.js";
3
3
  //#region src/js/modules/captchas/captcha-eu.ts
4
4
  async function r(t) {
5
5
  let r = String(t.endPoint || "https://www.captcha.eu").trim().replace(/\/+$/, "");