@verbb/formie-browser 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/CHANGELOG.md +76 -22
  2. package/dist/chunks/address-country-Rx6GQTND.js +68 -0
  3. package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
  4. package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
  5. package/dist/chunks/api-CmwLRq_n.js +780 -0
  6. package/dist/chunks/api-DMK8NSUI.js +407 -0
  7. package/dist/chunks/api-sPqGbOww.js +125 -0
  8. package/dist/chunks/async-nPFRNQ06.js +25 -0
  9. package/dist/chunks/bpoint-DSjqRv63.js +24 -0
  10. package/dist/chunks/calculations-CeDgB9jt.js +299 -0
  11. package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
  12. package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
  13. package/dist/chunks/chunk-3b4jIN3o.js +13 -0
  14. package/dist/chunks/combobox-D-2b42wn.js +1954 -0
  15. package/dist/chunks/conditions-DjZOtHfS.js +412 -0
  16. package/dist/chunks/constants-DVcJAvc5.js +38 -0
  17. package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
  18. package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
  19. package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
  20. package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
  21. package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
  22. package/dist/chunks/debug-BV0DvdHx.js +41 -0
  23. package/dist/chunks/dist-BQ4a9hmy.js +2659 -0
  24. package/dist/chunks/event-names-BCI2FLD8.js +51 -0
  25. package/dist/chunks/eway-D3ctTbEk.js +70 -0
  26. package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
  27. package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
  28. package/dist/chunks/file-upload-D49m8-DR.js +287 -0
  29. package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
  30. package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
  31. package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
  32. package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
  33. package/dist/chunks/google-address-OhKilPWE.js +161 -0
  34. package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
  35. package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
  36. package/dist/chunks/http-D-JExro7.js +27 -0
  37. package/dist/chunks/i18n-BY1ds1BL.js +121 -0
  38. package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
  39. package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
  40. package/dist/chunks/mollie-COG-ko2D.js +23 -0
  41. package/dist/chunks/moneris-CMH8PlRc.js +117 -0
  42. package/dist/chunks/opayo-D2jsR5vh.js +113 -0
  43. package/dist/chunks/paddle-DxF88RfC.js +55 -0
  44. package/dist/chunks/paypal-b5pnwrA2.js +95 -0
  45. package/dist/chunks/payway-BJYu9DIR.js +55 -0
  46. package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
  47. package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
  48. package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
  49. package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
  50. package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
  51. package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
  52. package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
  53. package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
  54. package/dist/chunks/repeater-B5leVxZU.js +102 -0
  55. package/dist/chunks/rich-text-D0sb8bmX.js +349 -0
  56. package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
  57. package/dist/chunks/sdk-BhHAYgga.js +1397 -0
  58. package/dist/chunks/shared-Bx9s0i0P.js +100 -0
  59. package/dist/chunks/signature-xz4QO7CR.js +536 -0
  60. package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
  61. package/dist/chunks/square-BP8RWAKB.js +40 -0
  62. package/dist/chunks/stripe-MihN63uC.js +184 -0
  63. package/dist/chunks/styles-BfoIZwJp.js +19 -0
  64. package/dist/chunks/summary-D3AjxpYN.js +114 -0
  65. package/dist/chunks/table-C-lkQN6I.js +78 -0
  66. package/dist/chunks/text-limit-DbgEFHLO.js +125 -0
  67. package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
  68. package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
  69. package/dist/chunks/upload-manager-BpqWSHmU.js +2558 -0
  70. package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
  71. package/dist/css/formie-theme.css +2 -0
  72. package/dist/css/theme/_buttons.css +16 -0
  73. package/dist/css/theme/_tokens.css +2 -0
  74. package/dist/css/theme/fields/_address-state.css +94 -0
  75. package/dist/css/theme/fields/_combobox.css +246 -0
  76. package/dist/css/theme/fields/_select.css +13 -0
  77. package/dist/css/theme/fields/_signature.css +19 -0
  78. package/dist/css/theme/fields/_upload-manager.css +279 -0
  79. package/dist/index.js +2448 -39
  80. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  81. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  82. package/dist/js/core/validation-focus.d.ts +4 -0
  83. package/dist/js/core/validation-focus.d.ts.map +1 -0
  84. package/dist/js/modules/address/api.d.ts +1 -0
  85. package/dist/js/modules/address/api.d.ts.map +1 -1
  86. package/dist/js/modules/address/constants.d.ts +22 -1
  87. package/dist/js/modules/address/constants.d.ts.map +1 -1
  88. package/dist/js/modules/address/host.d.ts +2 -2
  89. package/dist/js/modules/address/host.d.ts.map +1 -1
  90. package/dist/js/modules/address/loqate.d.ts.map +1 -1
  91. package/dist/js/modules/fields/address-country.d.ts +3 -0
  92. package/dist/js/modules/fields/address-country.d.ts.map +1 -0
  93. package/dist/js/modules/fields/address-state.d.ts +3 -0
  94. package/dist/js/modules/fields/address-state.d.ts.map +1 -0
  95. package/dist/js/modules/fields/calculations.d.ts.map +1 -1
  96. package/dist/js/modules/fields/combobox.d.ts +17 -0
  97. package/dist/js/modules/fields/combobox.d.ts.map +1 -0
  98. package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
  99. package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
  100. package/dist/js/modules/fields/custom-link.d.ts +3 -0
  101. package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
  102. package/dist/js/modules/fields/custom-maps.d.ts +3 -0
  103. package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
  104. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  105. package/dist/js/modules/fields/index.d.ts.map +1 -1
  106. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  107. package/dist/js/modules/fields/signature.d.ts.map +1 -1
  108. package/dist/js/modules/fields/upload-manager.d.ts +3 -0
  109. package/dist/js/modules/fields/upload-manager.d.ts.map +1 -0
  110. package/dist/js/submit/pipeline.d.ts.map +1 -1
  111. package/dist/js/utils/country-from-ip.d.ts +7 -0
  112. package/dist/js/utils/country-from-ip.d.ts.map +1 -0
  113. package/dist/js/utils/field-references.d.ts +1 -0
  114. package/dist/js/utils/field-references.d.ts.map +1 -1
  115. package/dist/js/utils/field-references.row-scope.d.ts +11 -0
  116. package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
  117. package/package.json +8 -3
  118. package/src/css/formie-theme.css +2 -0
  119. package/src/css/theme/_buttons.css +16 -0
  120. package/src/css/theme/_tokens.css +2 -0
  121. package/src/css/theme/fields/_address-state.css +94 -0
  122. package/src/css/theme/fields/_combobox.css +246 -0
  123. package/src/css/theme/fields/_select.css +13 -0
  124. package/src/css/theme/fields/_signature.css +19 -0
  125. package/src/css/theme/fields/_upload-manager.css +279 -0
  126. package/src/js/core/create-formie-client.ts +27 -0
  127. package/src/js/core/submit-result-ui.ts +4 -4
  128. package/src/js/core/validation-focus.ts +117 -0
  129. package/src/js/modules/address/api.ts +7 -0
  130. package/src/js/modules/address/constants.ts +82 -2
  131. package/src/js/modules/address/host.ts +16 -6
  132. package/src/js/modules/address/loqate.ts +3 -17
  133. package/src/js/modules/fields/address-country.ts +156 -0
  134. package/src/js/modules/fields/address-state.ts +946 -0
  135. package/src/js/modules/fields/calculations.ts +32 -0
  136. package/src/js/modules/fields/combobox.ts +188 -0
  137. package/src/js/modules/fields/custom-google-maps.ts +416 -0
  138. package/src/js/modules/fields/custom-link.ts +95 -0
  139. package/src/js/modules/fields/custom-maps.ts +339 -0
  140. package/src/js/modules/fields/date-picker.ts +96 -3
  141. package/src/js/modules/fields/index.ts +7 -0
  142. package/src/js/modules/fields/phone-country.ts +6 -0
  143. package/src/js/modules/fields/signature.ts +199 -15
  144. package/src/js/modules/fields/upload-manager.ts +1277 -0
  145. package/src/js/submit/pipeline.ts +11 -1
  146. package/src/js/utils/country-from-ip.ts +54 -0
  147. package/src/js/utils/field-references.row-scope.ts +303 -0
  148. package/src/js/utils/field-references.ts +1 -0
  149. package/src/vendor.d.ts +1 -1
  150. package/dist/chunks/address-finder-BU4roxT6.js +0 -37
  151. package/dist/chunks/bpoint-uNg5j6rt.js +0 -26
  152. package/dist/chunks/calculations-C9t6Zop9.js +0 -147
  153. package/dist/chunks/captcha-eu-BAPzHNts.js +0 -34
  154. package/dist/chunks/checkbox-radio-CHeLNVIK.js +0 -141
  155. package/dist/chunks/conditions-DKxVCsjD.js +0 -459
  156. package/dist/chunks/date-picker-B3iQ797Z.js +0 -4994
  157. package/dist/chunks/eway-DCielIML.js +0 -74
  158. package/dist/chunks/file-upload-DP2TOUYV.js +0 -316
  159. package/dist/chunks/friendly-captcha-v1-DdlcGiFY.js +0 -33
  160. package/dist/chunks/friendly-captcha-v2-76w-YnFm.js +0 -38
  161. package/dist/chunks/go-cardless-rwCkzbNK.js +0 -24
  162. package/dist/chunks/google-address-BD8IZ86V.js +0 -181
  163. package/dist/chunks/hcaptcha-BNNTL6uf.js +0 -56
  164. package/dist/chunks/hidden-CW6Rcf1N.js +0 -31
  165. package/dist/chunks/index-BEsfee-D.js +0 -1839
  166. package/dist/chunks/index-BP7Unm5Y.js +0 -863
  167. package/dist/chunks/index-D6npYxvr.js +0 -4423
  168. package/dist/chunks/loqate-B-ZNS65B.js +0 -55
  169. package/dist/chunks/mollie-BDAZ-1X4.js +0 -24
  170. package/dist/chunks/moneris-B1b0uEtY.js +0 -101
  171. package/dist/chunks/opayo-CC5hraHo.js +0 -122
  172. package/dist/chunks/paddle-B4GmrDsq.js +0 -60
  173. package/dist/chunks/paypal-BFS6XsIS.js +0 -100
  174. package/dist/chunks/payway-DekoJead.js +0 -56
  175. package/dist/chunks/phone-country-Cm5YUeXI.js +0 -3765
  176. package/dist/chunks/place-kit-DizZWV_e.js +0 -42
  177. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
  178. package/dist/chunks/recaptcha-enterprise-BbOvO7JZ.js +0 -71
  179. package/dist/chunks/recaptcha-shared-Dwg1eVFS.js +0 -15
  180. package/dist/chunks/recaptcha-v2-checkbox-SY3ti5iQ.js +0 -41
  181. package/dist/chunks/recaptcha-v2-invisible-DSmQnn6c.js +0 -59
  182. package/dist/chunks/recaptcha-v3-DNh7YCnR.js +0 -28
  183. package/dist/chunks/repeater-DM0vuFNQ.js +0 -124
  184. package/dist/chunks/rich-text-C8aGYp70.js +0 -304
  185. package/dist/chunks/scripts-CKTFtxPO.js +0 -36
  186. package/dist/chunks/sdk-3SicTWby.js +0 -1559
  187. package/dist/chunks/shared--BU5CFoL.js +0 -80
  188. package/dist/chunks/signature-pFhZfH7d.js +0 -550
  189. package/dist/chunks/snaptcha-VuOUOaLj.js +0 -8
  190. package/dist/chunks/square-BR9pvToy.js +0 -46
  191. package/dist/chunks/stripe-OHUwoV9g.js +0 -202
  192. package/dist/chunks/styles-C3aqgtek.js +0 -21
  193. package/dist/chunks/summary-Da7Ktg3N.js +0 -126
  194. package/dist/chunks/table-C0PmR9bI.js +0 -95
  195. package/dist/chunks/text-limit-mLEwZDIa.js +0 -144
  196. package/dist/chunks/turnstile-9tM7q_LK.js +0 -59
  197. package/dist/chunks/utils-BntI3W4S.js +0 -6149
@@ -1,55 +0,0 @@
1
- import { d as p, A as d } from "./index-D6npYxvr.js";
2
- import { l as y } from "./scripts-CKTFtxPO.js";
3
- const E = "FORMIE_LOQATE_SCRIPT", C = p({
4
- id: "loqate",
5
- load: async () => {
6
- await y("pca", {
7
- id: E,
8
- src: "https://services.pcapredict.com/js/address-3.91.min.js",
9
- async: !0,
10
- defer: !0
11
- });
12
- const e = document.createElement("link");
13
- return e.href = "https://services.pcapredict.com/css/address-3.91.min.css", e.rel = "stylesheet", e.type = "text/css", document.querySelector(`link[href="${e.href}"]`) || document.body.appendChild(e), window.pca;
14
- },
15
- mount: ({ api: e, field: m, services: P, provider: n }) => {
16
- const l = n.namespace || "", i = n.apiKey || "";
17
- if (!i)
18
- throw new Error("Loqate API key is required");
19
- const f = {
20
- autoComplete: d.autoComplete,
21
- address1: d.address1,
22
- address2: d.address2,
23
- address3: d.address3,
24
- city: d.city,
25
- state: d.state,
26
- zip: d.zip,
27
- country: d.country
28
- }, t = (o) => {
29
- if (l)
30
- return `${l}[${o}]`;
31
- const a = f[o], s = a ? m.querySelector(a) : null;
32
- return s?.name ? s.name : s?.id ? s.id : "";
33
- }, c = t("autoComplete");
34
- if (!c)
35
- throw new Error("Loqate: could not find autocomplete input within address field");
36
- const u = [
37
- { element: c, field: "", mode: e.fieldMode.SEARCH },
38
- { element: t("address1"), field: "Line1", mode: e.fieldMode.POPULATE },
39
- { element: t("address2"), field: "Line2", mode: e.fieldMode.POPULATE },
40
- { element: t("address3"), field: "Line3", mode: e.fieldMode.POPULATE },
41
- { element: t("city"), field: "City", mode: e.fieldMode.POPULATE },
42
- { element: t("state"), field: "Province", mode: e.fieldMode.POPULATE },
43
- { element: t("zip"), field: "PostalCode", mode: e.fieldMode.POPULATE },
44
- { element: t("country"), field: "CountryName", mode: e.fieldMode.COUNTRY }
45
- ].filter((o) => o.element), r = new e.Address(u, {
46
- key: i,
47
- simulateReactEvents: !0,
48
- ...n.reconfigurableOptions || {}
49
- });
50
- return typeof r.load == "function" && r.load(), r;
51
- }
52
- });
53
- export {
54
- C as loqateModule
55
- };
@@ -1,24 +0,0 @@
1
- import { v as d, x as l } from "./index-D6npYxvr.js";
2
- const o = l("mollie", "redirect"), s = d({
3
- id: "mollie",
4
- defaultRequiredInputSuffixes: [],
5
- load: async () => null,
6
- setup: async ({ services: r, root: e }) => {
7
- const t = (i) => {
8
- const n = i.detail?.data;
9
- if (!n?.checkoutUrl) {
10
- r.addError("Missing Mollie checkout URL.");
11
- return;
12
- }
13
- window.location.href = n.checkoutUrl;
14
- };
15
- return e.addEventListener(o, t), {
16
- destroy: () => {
17
- e.removeEventListener(o, t);
18
- }
19
- };
20
- }
21
- });
22
- export {
23
- s as mollieModule
24
- };
@@ -1,101 +0,0 @@
1
- import { v as S } from "./index-D6npYxvr.js";
2
- const k = {
3
- 940: "Invalid profile ID (tokenization request).",
4
- 941: "Error generating token.",
5
- 942: "Invalid Profile ID or source URL.",
6
- 943: "Card data is invalid.",
7
- 944: "Invalid expiration date.",
8
- 945: "Invalid CVD."
9
- }, I = (n) => {
10
- const i = (e) => {
11
- const r = String(e.dataKey ?? e.data_key ?? "").trim(), t = String(e.responseCode ?? e.response_code ?? "").trim(), d = String(e.responseMessage ?? e.response_message ?? "").trim(), a = String(e.error ?? e.errorMessage ?? e.message ?? "").trim();
12
- if (r)
13
- return { token: r, error: "" };
14
- if (t && t !== "001") {
15
- const s = k[t] || `Moneris response code ${t}.`;
16
- return { token: "", error: d || s };
17
- }
18
- return { token: "", error: a };
19
- };
20
- if (n && typeof n == "object")
21
- return i(n);
22
- if (typeof n != "string")
23
- return { token: "", error: "" };
24
- const o = n.trim();
25
- if (!o)
26
- return { token: "", error: "" };
27
- try {
28
- const e = JSON.parse(o);
29
- if (e && typeof e == "object")
30
- return i(e);
31
- } catch {
32
- }
33
- if (o.includes("=")) {
34
- const e = new URLSearchParams(o), r = (e.get("dataKey") || e.get("data_key") || "").trim(), t = (e.get("responseCode") || e.get("response_code") || "").trim(), d = (e.get("responseMessage") || e.get("response_message") || "").trim(), a = (e.get("error") || e.get("message") || "").trim();
35
- if (r)
36
- return { token: r, error: "" };
37
- if (t && t !== "001") {
38
- const s = k[t] || `Moneris response code ${t}.`;
39
- return { token: "", error: d || s };
40
- }
41
- return { token: "", error: a };
42
- }
43
- return /^[A-Za-z0-9._-]{8,}$/.test(o) ? { token: o, error: "" } : { token: "", error: "" };
44
- }, z = S({
45
- id: "moneris",
46
- defaultRequiredInputSuffixes: ["monerisTokenId"],
47
- load: async () => null,
48
- onBeforeAuthorize: async (n) => {
49
- const { field: i, services: o, options: e } = n, r = i, d = (e.provider.endpointUrl || "").trim(), a = i.querySelector("[data-formie-moneris-frame]");
50
- let s = "";
51
- try {
52
- s = new URL(d, window.location.origin).origin;
53
- } catch {
54
- s = "";
55
- }
56
- if (!a?.contentWindow || !s)
57
- return o.addError("Moneris frame or endpoint is missing."), !1;
58
- r.__formieMonerisAuthorizeCleanup?.();
59
- const p = (r.__formieMonerisAuthorizeRequestId || 0) + 1;
60
- return r.__formieMonerisAuthorizeRequestId = p, new Promise((f) => {
61
- let u = !1, g = "", l = 0;
62
- const c = () => {
63
- window.removeEventListener("message", M), window.clearTimeout(l), r.__formieMonerisAuthorizeCleanup === c && (r.__formieMonerisAuthorizeCleanup = null);
64
- }, M = (_) => {
65
- if (u || p !== r.__formieMonerisAuthorizeRequestId || _.origin !== s)
66
- return;
67
- const m = I(_.data);
68
- m.token ? (u = !0, c(), o.updateInputs("monerisTokenId", m.token), f(!0)) : m.error && (g = m.error);
69
- };
70
- r.__formieMonerisAuthorizeCleanup = c, l = window.setTimeout(() => {
71
- u || (u = !0, c(), o.addError(g || "Moneris tokenization timed out. Please try again."), f(!1));
72
- }, 1e4), window.addEventListener("message", M);
73
- try {
74
- a.contentWindow?.postMessage("tokenize", s);
75
- } catch {
76
- u = !0, c(), o.addError("Moneris tokenization could not be started."), f(!1);
77
- }
78
- });
79
- },
80
- setup: async (n) => {
81
- const { services: i } = n, o = (r) => {
82
- if (!r.origin.includes("moneris"))
83
- return;
84
- const t = I(r.data);
85
- t.token && i.updateInputs("monerisTokenId", t.token);
86
- }, e = i.events.onRoot("message", o);
87
- return {
88
- destroy: () => {
89
- e();
90
- const r = n.target;
91
- r.__formieMonerisAuthorizeCleanup?.(), r.__formieMonerisAuthorizeCleanup = null;
92
- }
93
- };
94
- },
95
- onAfterSubmit: async ({ services: n }) => {
96
- n.updateInputs("monerisTokenId", "");
97
- }
98
- });
99
- export {
100
- z as monerisModule
101
- };
@@ -1,122 +0,0 @@
1
- import { v, x as w, h as b } from "./index-D6npYxvr.js";
2
- import { l as E } from "./scripts-CKTFtxPO.js";
3
- const I = "FORMIE_OPAYO_SCRIPT", D = "https://live.opayo.eu.elavon.com/api/v1/js/sagepay.js", T = "https://sandbox.opayo.eu.elavon.com/api/v1/js/sagepay.js", t = b("payments", "opayo"), k = w("opayo", "challenge"), C = "formie:payment:opayo:challenge:response", R = v({
4
- id: "opayo",
5
- defaultRequiredInputSuffixes: ["opayoTokenId"],
6
- load: async (c) => {
7
- const { provider: a } = c.options, d = !!a.useSandbox ? T : D;
8
- return await E("sagepayOwnForm", {
9
- id: I,
10
- src: d,
11
- timeoutMs: 1e4
12
- }), null;
13
- },
14
- onBeforeAuthorize: async (c) => {
15
- const { field: a, services: e, options: d } = c, p = d.provider, g = p.handle || "opayo", m = e.form;
16
- if (!m?.action)
17
- return e.addError("Form action is missing."), t.warn("Missing form action before authorize."), !1;
18
- const s = window.sagepayOwnForm;
19
- if (!s)
20
- return e.addError("Opayo script failed to load."), t.warn("sagepayOwnForm global not available."), !1;
21
- const r = a.querySelector('[data-opayo-card="cardholder-name"]')?.value ?? "";
22
- let y = a.querySelector('[data-opayo-card="card-number"]')?.value ?? "", f = a.querySelector('[data-opayo-card="expiry-date"]')?.value ?? "";
23
- const h = a.querySelector('[data-opayo-card="security-code"]')?.value ?? "";
24
- return y = y.replace(/[\s/]/g, ""), f = f.replace(/[\s/]/g, ""), new Promise((n) => {
25
- const i = new FormData();
26
- i.append("action", "formie/payment-webhooks/process-callback"), i.append("merchantSessionKey", "true"), i.append("handle", g), i.append("sessionToken", p.sessionToken || ""), fetch(m.action, {
27
- method: "POST",
28
- body: i
29
- }).then(async (o) => {
30
- if (o.status < 200 || o.status >= 300) {
31
- e.addError(`${o.status}: ${o.statusText}`), t.warn("Merchant session request failed.", {
32
- status: o.status,
33
- statusText: o.statusText
34
- }), n(!1);
35
- return;
36
- }
37
- try {
38
- const u = (await o.json()).merchantSessionKey;
39
- if (!u) {
40
- e.addError("Unable to get merchant session."), t.warn("merchantSessionKey missing in callback response."), n(!1);
41
- return;
42
- }
43
- s({ merchantSessionKey: u }).tokeniseCardDetails({
44
- cardDetails: {
45
- cardholderName: r,
46
- cardNumber: y,
47
- expiryDate: f,
48
- securityCode: h
49
- },
50
- onTokenised: (l) => {
51
- l.success && l.cardIdentifier ? (e.updateInputs("opayoTokenId", l.cardIdentifier), e.updateInputs("opayoSessionKey", u), t.log("Tokenization succeeded.", {
52
- hasCardIdentifier: !!l.cardIdentifier
53
- }), n(!0)) : (e.addError(l.errors?.[0]?.message || "Tokenization failed."), t.warn("Tokenization failed.", l), n(!1));
54
- }
55
- });
56
- } catch {
57
- e.addError("Unable to parse merchant session response."), t.warn("Failed to parse merchant session response."), n(!1);
58
- }
59
- }).catch(() => {
60
- e.addError("Network error. Please try again."), t.warn("Network error requesting merchant session."), n(!1);
61
- });
62
- });
63
- },
64
- setup: async (c) => {
65
- const { services: a } = c;
66
- c.target;
67
- let e = null, d = !1;
68
- const p = () => {
69
- e?.parentNode && e.parentNode.removeChild(e), e = null;
70
- }, g = a.events.onForm(k, ((s) => {
71
- const r = s.detail?.data;
72
- if (!r?.acsUrl || !r?.creq) return;
73
- d = !1, t.log("Received payment challenge event.", {
74
- hasAcsUrl: !!r.acsUrl,
75
- hasCreq: !!r.creq
76
- });
77
- const h = a.form?.querySelector('input[name*="opayoSessionKey"]')?.value || "", n = document.createElement("div");
78
- n.className = "formie-modal", n.id = `formie-opayo-dialog-${Math.random().toString(36).slice(2, 9)}`, n.innerHTML = `
79
- <div class="formie-modal-backdrop" data-dialog-close></div>
80
- <div class="formie-modal-content">
81
- <div class="formie-loading formie-loading-large" style="--formie-loading-width: 3rem; --formie-loading-height: 3rem; top: 50%; margin-top: -1.5rem;"></div>
82
- <iframe width="100%" height="100%" style="width: 100%; height: 100%; position: relative; z-index: 1;"></iframe>
83
- </div>
84
- `;
85
- const i = n.querySelector("iframe"), o = (l) => l.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), S = r.returnUrl || r.redirectUrl || "", u = `<form action="${o(r.acsUrl)}" method="post">
86
- <input type="hidden" name="creq" value="${o(r.creq || "")}" />
87
- <input type="hidden" name="threeDSSessionData" value="${o(r.threeDSSessionData || "")}" />
88
- <input type="hidden" name="MD" value="${o(h)}" />
89
- <input type="hidden" name="TermUrl" value="${o(S)}" />
90
- <input type="hidden" name="ThreeDSNotificationURL" value="${o(S)}" />
91
- </form><script>document.forms[0].submit();<\/script>`;
92
- p(), document.body.appendChild(n), e = n, i?.contentWindow && (i.contentWindow.document.open(), i.contentWindow.document.write(u), i.contentWindow.document.close());
93
- })), m = (s) => {
94
- if (s.data?.message === C) {
95
- if (!e) {
96
- t.log("Ignoring 3DS response without active dialog.");
97
- return;
98
- }
99
- if (d) {
100
- t.warn("Ignoring duplicate 3DS response while processing.");
101
- return;
102
- }
103
- if (d = !0, t.log("Received payment challenge response message.", s.data?.value), p(), a.removeError(), s.data?.value?.error) {
104
- a.addError(s.data.value.error.message), a.releaseSubmitLoading(), d = !1;
105
- return;
106
- }
107
- a.updateInputs("opayo3DSComplete", s.data.value?.transactionId ?? ""), a.triggerSubmit();
108
- }
109
- };
110
- return window.addEventListener("message", m), {
111
- destroy: () => {
112
- g(), window.removeEventListener("message", m), p(), d = !1;
113
- }
114
- };
115
- },
116
- onAfterSubmit: async ({ services: c }) => {
117
- c.updateInputs(["opayoTokenId", "opayoSessionKey", "opayo3DSComplete"], "");
118
- }
119
- });
120
- export {
121
- R as opayoModule
122
- };
@@ -1,60 +0,0 @@
1
- import { v as l, x as u } from "./index-D6npYxvr.js";
2
- import { l as c } from "./scripts-CKTFtxPO.js";
3
- const p = "FORMIE_PADDLE_SCRIPT", m = u("paddle", "initialize"), h = l({
4
- id: "paddle",
5
- defaultRequiredInputSuffixes: ["paddleCheckoutData"],
6
- load: async () => null,
7
- setup: async (d) => {
8
- const { services: t } = d;
9
- d.target;
10
- const o = d.options.provider, n = o.clientSideToken;
11
- if (!n?.trim())
12
- return t.addError("Missing clientSideToken for Paddle."), {};
13
- let a;
14
- try {
15
- a = await c("Paddle", {
16
- id: p,
17
- src: "https://cdn.paddle.com/paddle/v2/paddle.js"
18
- }), a.Environment.set(o.environment || "production");
19
- } catch (e) {
20
- return t.addError(e instanceof Error ? e.message : "Failed to load Paddle SDK."), {};
21
- }
22
- a.Initialize({
23
- token: n,
24
- checkout: {
25
- settings: {
26
- displayMode: "overlay",
27
- variant: "multi-page"
28
- }
29
- },
30
- eventCallback: (e) => {
31
- e.name === "checkout.completed" && (t.updateInputs("paddleCheckoutInit", ""), t.updateInputs("paddleCheckoutData", JSON.stringify(e.data || {})), setTimeout(() => {
32
- a.Checkout.close(), t.triggerSubmit();
33
- }, 500));
34
- }
35
- });
36
- const i = (e) => {
37
- if (!e?.items)
38
- return t.addError("Missing Paddle checkout items."), !1;
39
- try {
40
- t.releaseSubmitLoading(), a.Checkout.open(e);
41
- } catch (r) {
42
- return t.addError(r instanceof Error ? r.message : "Unable to open Paddle checkout."), !1;
43
- }
44
- return !0;
45
- }, s = t.events.onForm(m, ((e) => {
46
- i(e.detail?.data);
47
- }));
48
- return {
49
- destroy: () => {
50
- s();
51
- }
52
- };
53
- },
54
- onAfterSubmit: async ({ services: d }) => {
55
- d.updateInputs("paddleCheckoutInit", "true"), d.updateInputs("paddleCheckoutData", "");
56
- }
57
- });
58
- export {
59
- h as paddleModule
60
- };
@@ -1,100 +0,0 @@
1
- import { v as b } from "./index-D6npYxvr.js";
2
- import { e as I } from "./styles-C3aqgtek.js";
3
- import { l as v } from "./scripts-CKTFtxPO.js";
4
- const g = "@layer formie-theme{.formie-paypal-button{border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm);background:var(--formie-color-surface);box-sizing:border-box;min-height:var(--formie-control-height);padding:var(--formie-space-2)}}";
5
- I("paypal", [g]);
6
- const A = "FORMIE_PAYPAL_SCRIPT";
7
- function P(r) {
8
- if (!r)
9
- return "";
10
- const a = (r.purchase_units || [])[0]?.payments || {}, e = a.authorizations || [], c = a.captures || [];
11
- return String(e[0]?.id || c[0]?.id || "").trim();
12
- }
13
- function S(r, o) {
14
- return `https://www.paypal.com/sdk/js?${[
15
- "intent=authorize",
16
- `currency=${encodeURIComponent(o)}`,
17
- `client-id=${encodeURIComponent(r)}`
18
- ].join("&")}`;
19
- }
20
- const U = b({
21
- id: "paypal",
22
- defaultRequiredInputSuffixes: ["paypalOrderId", "paypalAuthId"],
23
- load: async (r) => {
24
- const { provider: o } = r.options, a = o.clientId;
25
- if (!a?.trim())
26
- return console.error("[formie] Missing clientId for PayPal."), null;
27
- const e = o.currency || "AUD", c = S(a, e);
28
- return await v("paypal", {
29
- id: A,
30
- src: c
31
- }), window.paypal;
32
- },
33
- mount: async (r) => {
34
- const { api: o, field: a, services: e, options: c, provider: t } = r, i = a.querySelector("[data-formie-paypal-button]");
35
- if (!i || !o || i.getAttribute("data-formie-paypal-rendered") === "true")
36
- return null;
37
- i.innerHTML = "";
38
- const y = !!t.useSandbox, s = e.resolveCurrency({ value: t.currency, defaultCurrency: "AUD" });
39
- if (!s.ok)
40
- return e.addError("error" in s ? s.error : "Invalid PayPal currency."), null;
41
- const m = s.value, l = {
42
- layout: t.buttonLayout || "vertical",
43
- color: t.buttonColor || "gold",
44
- shape: t.buttonShape || "rect",
45
- label: t.buttonLabel || "paypal",
46
- width: t.buttonWidth || 250,
47
- height: t.buttonHeight || 35
48
- };
49
- l.layout === "horizontal" && (l.tagline = t.buttonTagline ?? !0);
50
- const f = {
51
- env: y ? "sandbox" : "production",
52
- style: l,
53
- createOrder: (d, p) => {
54
- e.removeError();
55
- const n = e.resolveAmount({
56
- type: t.amountType,
57
- fixed: t.amountFixed,
58
- variable: t.amountVariable
59
- });
60
- if (!n.ok) {
61
- const u = "error" in n ? n.error : "Invalid PayPal amount.";
62
- throw e.addError(u), new Error(u);
63
- }
64
- return p.order.create({
65
- intent: "AUTHORIZE",
66
- application_context: { user_action: "CONTINUE" },
67
- purchase_units: [{
68
- amount: {
69
- currency_code: m,
70
- value: String(n.value)
71
- }
72
- }]
73
- });
74
- },
75
- onError: (d) => {
76
- e.addError(d?.message || "PayPal error.");
77
- },
78
- onApprove: async (d, p) => {
79
- try {
80
- const n = await p.order.authorize(), u = P(n);
81
- e.updateInputs("paypalOrderId", d.orderID), e.updateInputs("paypalAuthId", u || ""), u ? e.addSuccess("Payment authorized. Finalize the form to complete payment.") : e.addSuccess("PayPal approval received. Finalizing payment on submit.");
82
- } catch {
83
- e.addError("Unable to authorize payment. Please try again.");
84
- }
85
- }
86
- }, h = o.Buttons(f);
87
- return i.setAttribute("data-formie-paypal-rendered", "true"), h.render(i);
88
- },
89
- unmount: async (r) => {
90
- r.widget?.close && r.widget.close();
91
- const o = r.field.querySelector("[data-formie-paypal-button]");
92
- o && (o.removeAttribute("data-formie-paypal-rendered"), o.innerHTML = "");
93
- },
94
- onAfterSubmit: async ({ services: r }) => {
95
- r.updateInputs(["paypalOrderId", "paypalAuthId"], ""), r.removeSuccess(), r.removeError();
96
- }
97
- });
98
- export {
99
- U as paypalModule
100
- };
@@ -1,56 +0,0 @@
1
- import { v as y } from "./index-D6npYxvr.js";
2
- import { e as u } from "./styles-C3aqgtek.js";
3
- import { l as p } from "./scripts-CKTFtxPO.js";
4
- const f = "@layer formie-theme{.formie-payway-button{border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm);background:var(--formie-color-surface);box-sizing:border-box;min-height:var(--formie-control-height);padding:var(--formie-space-2)}}";
5
- u("payway", [f]);
6
- const c = "FORMIE_PAYWAY_SCRIPT", h = y({
7
- id: "payway",
8
- defaultRequiredInputSuffixes: ["paywayTokenId"],
9
- load: async (e) => {
10
- const { provider: a } = e.options;
11
- return a.publishableKey?.trim() ? (await p("payway", {
12
- id: c,
13
- src: "https://api.payway.com.au/rest/v1/payway.js"
14
- }), null) : (console.error("[formie] Missing publishableKey for PayWay."), null);
15
- },
16
- mount: async (e) => {
17
- const { field: a, services: r, options: o } = e, i = o.provider;
18
- if (!a.querySelector("[data-formie-payway-button]"))
19
- return null;
20
- const t = window.payway;
21
- return t ? new Promise((s) => {
22
- t.createCreditCardFrame({
23
- layout: "wide",
24
- publishableApiKey: i.publishableKey || "",
25
- tokenMode: "callback"
26
- }, (d, l) => {
27
- if (d || !l) {
28
- r.addError(d?.message || "PayWay frame failed to load."), s(null);
29
- return;
30
- }
31
- s(l);
32
- });
33
- }) : null;
34
- },
35
- unmount: async (e) => {
36
- e.widget?.destroy();
37
- },
38
- onBeforeAuthorize: async (e) => {
39
- const { widget: a, services: r } = e;
40
- return a ? new Promise((o) => {
41
- a.getToken((i, n) => {
42
- if (i) {
43
- r.addError(i.message), o(!1);
44
- return;
45
- }
46
- n?.singleUseTokenId ? (r.updateInputs("paywayTokenId", n.singleUseTokenId), o(!0)) : (r.addError("Tokenization failed."), o(!1));
47
- });
48
- }) : (r.addError("PayWay card frame is not ready."), !1);
49
- },
50
- onAfterSubmit: async ({ services: e }) => {
51
- e.updateInputs("paywayTokenId", "");
52
- }
53
- });
54
- export {
55
- h as paywayModule
56
- };