@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
@@ -0,0 +1,76 @@
1
+ import { i as e } from "./constants-DVcJAvc5.js";
2
+ import { t } from "./api-sPqGbOww.js";
3
+ import { r as n } from "./scripts-6CYSUGKQ.js";
4
+ //#region src/js/modules/address/loqate.ts
5
+ var r = "FORMIE_LOQATE_SCRIPT", i = t({
6
+ id: "loqate",
7
+ load: async () => {
8
+ await n("pca", {
9
+ id: r,
10
+ src: "https://services.pcapredict.com/js/address-3.91.min.js",
11
+ async: !0,
12
+ defer: !0
13
+ });
14
+ let e = document.createElement("link");
15
+ 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;
16
+ },
17
+ mount: ({ api: t, field: n, services: r, provider: i }) => {
18
+ let a = i.namespace || "", o = i.apiKey || "";
19
+ if (!o) throw Error("Loqate API key is required");
20
+ let s = (t) => {
21
+ if (a) return `${a}[${t}]`;
22
+ let r = e(n, t);
23
+ return r?.name ? r.name : r?.id ? r.id : "";
24
+ }, c = s("autoComplete");
25
+ if (!c) throw Error("Loqate: could not find autocomplete input within address field");
26
+ let l = [
27
+ {
28
+ element: c,
29
+ field: "",
30
+ mode: t.fieldMode.SEARCH
31
+ },
32
+ {
33
+ element: s("address1"),
34
+ field: "Line1",
35
+ mode: t.fieldMode.POPULATE
36
+ },
37
+ {
38
+ element: s("address2"),
39
+ field: "Line2",
40
+ mode: t.fieldMode.POPULATE
41
+ },
42
+ {
43
+ element: s("address3"),
44
+ field: "Line3",
45
+ mode: t.fieldMode.POPULATE
46
+ },
47
+ {
48
+ element: s("city"),
49
+ field: "City",
50
+ mode: t.fieldMode.POPULATE
51
+ },
52
+ {
53
+ element: s("state"),
54
+ field: "Province",
55
+ mode: t.fieldMode.POPULATE
56
+ },
57
+ {
58
+ element: s("zip"),
59
+ field: "PostalCode",
60
+ mode: t.fieldMode.POPULATE
61
+ },
62
+ {
63
+ element: s("country"),
64
+ field: "CountryName",
65
+ mode: t.fieldMode.COUNTRY
66
+ }
67
+ ].filter((e) => e.element), u = new t.Address(l, {
68
+ key: o,
69
+ simulateReactEvents: !0,
70
+ ...i.reconfigurableOptions || {}
71
+ });
72
+ return typeof u.load == "function" && u.load(), u;
73
+ }
74
+ });
75
+ //#endregion
76
+ export { i as loqateModule };
@@ -0,0 +1,23 @@
1
+ import { s as e } from "./event-names-BCI2FLD8.js";
2
+ import { t } from "./api-CmwLRq_n.js";
3
+ //#region src/js/modules/payments/mollie.ts
4
+ var n = e("mollie", "redirect"), r = t({
5
+ id: "mollie",
6
+ defaultRequiredInputSuffixes: [],
7
+ load: async () => null,
8
+ setup: async ({ services: e, root: t }) => {
9
+ let r = (t) => {
10
+ let n = t.detail?.data;
11
+ if (!n?.checkoutUrl) {
12
+ e.addError("Missing Mollie checkout URL.");
13
+ return;
14
+ }
15
+ window.location.href = n.checkoutUrl;
16
+ };
17
+ return t.addEventListener(n, r), { destroy: () => {
18
+ t.removeEventListener(n, r);
19
+ } };
20
+ }
21
+ });
22
+ //#endregion
23
+ export { r as mollieModule };
@@ -0,0 +1,117 @@
1
+ import { t as e } from "./api-CmwLRq_n.js";
2
+ //#region src/js/modules/payments/moneris.ts
3
+ var t = {
4
+ 940: "Invalid profile ID (tokenization request).",
5
+ 941: "Error generating token.",
6
+ 942: "Invalid Profile ID or source URL.",
7
+ 943: "Card data is invalid.",
8
+ 944: "Invalid expiration date.",
9
+ 945: "Invalid CVD."
10
+ }, n = (e) => {
11
+ let n = (e) => {
12
+ let n = String(e.dataKey ?? e.data_key ?? "").trim(), r = String(e.responseCode ?? e.response_code ?? "").trim(), i = String(e.responseMessage ?? e.response_message ?? "").trim(), a = String(e.error ?? e.errorMessage ?? e.message ?? "").trim();
13
+ if (n) return {
14
+ token: n,
15
+ error: ""
16
+ };
17
+ if (r && r !== "001") {
18
+ let e = t[r] || `Moneris response code ${r}.`;
19
+ return {
20
+ token: "",
21
+ error: i || e
22
+ };
23
+ }
24
+ return {
25
+ token: "",
26
+ error: a
27
+ };
28
+ };
29
+ if (e && typeof e == "object") return n(e);
30
+ if (typeof e != "string") return {
31
+ token: "",
32
+ error: ""
33
+ };
34
+ let r = e.trim();
35
+ if (!r) return {
36
+ token: "",
37
+ error: ""
38
+ };
39
+ try {
40
+ let e = JSON.parse(r);
41
+ if (e && typeof e == "object") return n(e);
42
+ } catch {}
43
+ if (r.includes("=")) {
44
+ let e = new URLSearchParams(r), n = (e.get("dataKey") || e.get("data_key") || "").trim(), i = (e.get("responseCode") || e.get("response_code") || "").trim(), a = (e.get("responseMessage") || e.get("response_message") || "").trim(), o = (e.get("error") || e.get("message") || "").trim();
45
+ if (n) return {
46
+ token: n,
47
+ error: ""
48
+ };
49
+ if (i && i !== "001") {
50
+ let e = t[i] || `Moneris response code ${i}.`;
51
+ return {
52
+ token: "",
53
+ error: a || e
54
+ };
55
+ }
56
+ return {
57
+ token: "",
58
+ error: o
59
+ };
60
+ }
61
+ return /^[A-Za-z0-9._-]{8,}$/.test(r) ? {
62
+ token: r,
63
+ error: ""
64
+ } : {
65
+ token: "",
66
+ error: ""
67
+ };
68
+ }, r = e({
69
+ id: "moneris",
70
+ defaultRequiredInputSuffixes: ["monerisTokenId"],
71
+ load: async () => null,
72
+ onBeforeAuthorize: async (e) => {
73
+ let { field: t, services: r, options: i } = e, a = t, o = (i.provider.endpointUrl || "").trim(), s = t.querySelector("[data-formie-moneris-frame]"), c = "";
74
+ try {
75
+ c = new URL(o, window.location.origin).origin;
76
+ } catch {
77
+ c = "";
78
+ }
79
+ if (!s?.contentWindow || !c) return r.addError("Moneris frame or endpoint is missing."), !1;
80
+ a.__formieMonerisAuthorizeCleanup?.();
81
+ let l = (a.__formieMonerisAuthorizeRequestId || 0) + 1;
82
+ return a.__formieMonerisAuthorizeRequestId = l, new Promise((e) => {
83
+ let t = !1, i = "", o = 0, u = () => {
84
+ window.removeEventListener("message", d), window.clearTimeout(o), a.__formieMonerisAuthorizeCleanup === u && (a.__formieMonerisAuthorizeCleanup = null);
85
+ }, d = (o) => {
86
+ if (t || l !== a.__formieMonerisAuthorizeRequestId || o.origin !== c) return;
87
+ let s = n(o.data);
88
+ s.token ? (t = !0, u(), r.updateInputs("monerisTokenId", s.token), e(!0)) : s.error && (i = s.error);
89
+ };
90
+ a.__formieMonerisAuthorizeCleanup = u, o = window.setTimeout(() => {
91
+ t || (t = !0, u(), r.addError(i || "Moneris tokenization timed out. Please try again."), e(!1));
92
+ }, 1e4), window.addEventListener("message", d);
93
+ try {
94
+ s.contentWindow?.postMessage("tokenize", c);
95
+ } catch {
96
+ t = !0, u(), r.addError("Moneris tokenization could not be started."), e(!1);
97
+ }
98
+ });
99
+ },
100
+ setup: async (e) => {
101
+ let { services: t } = e, r = t.events.onRoot("message", (e) => {
102
+ if (!e.origin.includes("moneris")) return;
103
+ let r = n(e.data);
104
+ r.token && t.updateInputs("monerisTokenId", r.token);
105
+ });
106
+ return { destroy: () => {
107
+ r();
108
+ let t = e.target;
109
+ t.__formieMonerisAuthorizeCleanup?.(), t.__formieMonerisAuthorizeCleanup = null;
110
+ } };
111
+ },
112
+ onAfterSubmit: async ({ services: e }) => {
113
+ e.updateInputs("monerisTokenId", "");
114
+ }
115
+ });
116
+ //#endregion
117
+ export { r as monerisModule };
@@ -0,0 +1,113 @@
1
+ import { s as e } from "./event-names-BCI2FLD8.js";
2
+ import { t } from "./debug-BV0DvdHx.js";
3
+ import { t as n } from "./api-CmwLRq_n.js";
4
+ import { r } from "./scripts-6CYSUGKQ.js";
5
+ //#region src/js/modules/payments/opayo.ts
6
+ var i = "FORMIE_OPAYO_SCRIPT", a = "https://live.opayo.eu.elavon.com/api/v1/js/sagepay.js", o = "https://sandbox.opayo.eu.elavon.com/api/v1/js/sagepay.js", s = t("payments", "opayo"), c = e("opayo", "challenge"), l = "formie:payment:opayo:challenge:response", u = n({
7
+ id: "opayo",
8
+ defaultRequiredInputSuffixes: ["opayoTokenId"],
9
+ load: async (e) => {
10
+ let { provider: t } = e.options;
11
+ return await r("sagepayOwnForm", {
12
+ id: i,
13
+ src: t.useSandbox ? o : a,
14
+ timeoutMs: 1e4
15
+ }), null;
16
+ },
17
+ onBeforeAuthorize: async (e) => {
18
+ let { field: t, services: n, options: r } = e, i = r.provider, a = i.handle || "opayo", o = n.form;
19
+ if (!o?.action) return n.addError("Form action is missing."), s.warn("Missing form action before authorize."), !1;
20
+ let c = window.sagepayOwnForm;
21
+ if (!c) return n.addError("Opayo script failed to load."), s.warn("sagepayOwnForm global not available."), !1;
22
+ let l = t.querySelector("[data-opayo-card=\"cardholder-name\"]")?.value ?? "", u = t.querySelector("[data-opayo-card=\"card-number\"]")?.value ?? "", d = t.querySelector("[data-opayo-card=\"expiry-date\"]")?.value ?? "", f = t.querySelector("[data-opayo-card=\"security-code\"]")?.value ?? "";
23
+ return u = u.replace(/[\s/]/g, ""), d = d.replace(/[\s/]/g, ""), new Promise((e) => {
24
+ let t = new FormData();
25
+ t.append("action", "formie/payment-webhooks/process-callback"), t.append("merchantSessionKey", "true"), t.append("handle", a), t.append("sessionToken", i.sessionToken || ""), fetch(o.action, {
26
+ method: "POST",
27
+ body: t
28
+ }).then(async (t) => {
29
+ if (t.status < 200 || t.status >= 300) {
30
+ n.addError(`${t.status}: ${t.statusText}`), s.warn("Merchant session request failed.", {
31
+ status: t.status,
32
+ statusText: t.statusText
33
+ }), e(!1);
34
+ return;
35
+ }
36
+ try {
37
+ let r = (await t.json()).merchantSessionKey;
38
+ if (!r) {
39
+ n.addError("Unable to get merchant session."), s.warn("merchantSessionKey missing in callback response."), e(!1);
40
+ return;
41
+ }
42
+ c({ merchantSessionKey: r }).tokeniseCardDetails({
43
+ cardDetails: {
44
+ cardholderName: l,
45
+ cardNumber: u,
46
+ expiryDate: d,
47
+ securityCode: f
48
+ },
49
+ onTokenised: (t) => {
50
+ t.success && t.cardIdentifier ? (n.updateInputs("opayoTokenId", t.cardIdentifier), n.updateInputs("opayoSessionKey", r), s.log("Tokenization succeeded.", { hasCardIdentifier: !!t.cardIdentifier }), e(!0)) : (n.addError(t.errors?.[0]?.message || "Tokenization failed."), s.warn("Tokenization failed.", t), e(!1));
51
+ }
52
+ });
53
+ } catch {
54
+ n.addError("Unable to parse merchant session response."), s.warn("Failed to parse merchant session response."), e(!1);
55
+ }
56
+ }).catch(() => {
57
+ n.addError("Network error. Please try again."), s.warn("Network error requesting merchant session."), e(!1);
58
+ });
59
+ });
60
+ },
61
+ setup: async (e) => {
62
+ let { services: t } = e;
63
+ e.target;
64
+ let n = null, r = !1, i = () => {
65
+ n?.parentNode && n.parentNode.removeChild(n), n = null;
66
+ }, a = t.events.onForm(c, ((e) => {
67
+ let a = e.detail?.data;
68
+ if (!a?.acsUrl || !a?.creq) return;
69
+ r = !1, s.log("Received payment challenge event.", {
70
+ hasAcsUrl: !!a.acsUrl,
71
+ hasCreq: !!a.creq
72
+ });
73
+ let o = t.form?.querySelector("input[name*=\"opayoSessionKey\"]")?.value || "", c = document.createElement("div");
74
+ c.className = "formie-modal", c.id = `formie-opayo-dialog-${Math.random().toString(36).slice(2, 9)}`, c.innerHTML = "\n <div class=\"formie-modal-backdrop\" data-dialog-close></div>\n <div class=\"formie-modal-content\">\n <div class=\"formie-loading formie-loading-large\" style=\"--formie-loading-width: 3rem; --formie-loading-height: 3rem; top: 50%; margin-top: -1.5rem;\"></div>\n <iframe width=\"100%\" height=\"100%\" style=\"width: 100%; height: 100%; position: relative; z-index: 1;\"></iframe>\n </div>\n ";
75
+ let l = c.querySelector("iframe"), u = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), d = a.returnUrl || a.redirectUrl || "", f = `<form action="${u(a.acsUrl)}" method="post">
76
+ <input type="hidden" name="creq" value="${u(a.creq || "")}" />
77
+ <input type="hidden" name="threeDSSessionData" value="${u(a.threeDSSessionData || "")}" />
78
+ <input type="hidden" name="MD" value="${u(o)}" />
79
+ <input type="hidden" name="TermUrl" value="${u(d)}" />
80
+ <input type="hidden" name="ThreeDSNotificationURL" value="${u(d)}" />
81
+ </form><script>document.forms[0].submit();<\/script>`;
82
+ i(), document.body.appendChild(c), n = c, l?.contentWindow && (l.contentWindow.document.open(), l.contentWindow.document.write(f), l.contentWindow.document.close());
83
+ })), o = (e) => {
84
+ if (e.data?.message === l) {
85
+ if (!n) {
86
+ s.log("Ignoring 3DS response without active dialog.");
87
+ return;
88
+ }
89
+ if (r) {
90
+ s.warn("Ignoring duplicate 3DS response while processing.");
91
+ return;
92
+ }
93
+ if (r = !0, s.log("Received payment challenge response message.", e.data?.value), i(), t.removeError(), e.data?.value?.error) {
94
+ t.addError(e.data.value.error.message), t.releaseSubmitLoading(), r = !1;
95
+ return;
96
+ }
97
+ t.updateInputs("opayo3DSComplete", e.data.value?.transactionId ?? ""), t.triggerSubmit();
98
+ }
99
+ };
100
+ return window.addEventListener("message", o), { destroy: () => {
101
+ a(), window.removeEventListener("message", o), i(), r = !1;
102
+ } };
103
+ },
104
+ onAfterSubmit: async ({ services: e }) => {
105
+ e.updateInputs([
106
+ "opayoTokenId",
107
+ "opayoSessionKey",
108
+ "opayo3DSComplete"
109
+ ], "");
110
+ }
111
+ });
112
+ //#endregion
113
+ export { u as opayoModule };
@@ -0,0 +1,55 @@
1
+ import { s as e } from "./event-names-BCI2FLD8.js";
2
+ import { t } from "./api-CmwLRq_n.js";
3
+ import { r as n } from "./scripts-6CYSUGKQ.js";
4
+ //#region src/js/modules/payments/paddle.ts
5
+ var r = "FORMIE_PADDLE_SCRIPT", i = e("paddle", "initialize"), a = t({
6
+ id: "paddle",
7
+ defaultRequiredInputSuffixes: ["paddleCheckoutData"],
8
+ load: async () => null,
9
+ setup: async (e) => {
10
+ let { services: t } = e;
11
+ e.target;
12
+ let a = e.options.provider, o = a.clientSideToken;
13
+ if (!o?.trim()) return t.addError("Missing clientSideToken for Paddle."), {};
14
+ let s;
15
+ try {
16
+ s = await n("Paddle", {
17
+ id: r,
18
+ src: "https://cdn.paddle.com/paddle/v2/paddle.js"
19
+ }), s.Environment.set(a.environment || "production");
20
+ } catch (e) {
21
+ return t.addError(e instanceof Error ? e.message : "Failed to load Paddle SDK."), {};
22
+ }
23
+ s.Initialize({
24
+ token: o,
25
+ checkout: { settings: {
26
+ displayMode: "overlay",
27
+ variant: "multi-page"
28
+ } },
29
+ eventCallback: (e) => {
30
+ e.name === "checkout.completed" && (t.updateInputs("paddleCheckoutInit", ""), t.updateInputs("paddleCheckoutData", JSON.stringify(e.data || {})), setTimeout(() => {
31
+ s.Checkout.close(), t.triggerSubmit();
32
+ }, 500));
33
+ }
34
+ });
35
+ let c = (e) => {
36
+ if (!e?.items) return t.addError("Missing Paddle checkout items."), !1;
37
+ try {
38
+ t.releaseSubmitLoading(), s.Checkout.open(e);
39
+ } catch (e) {
40
+ return t.addError(e instanceof Error ? e.message : "Unable to open Paddle checkout."), !1;
41
+ }
42
+ return !0;
43
+ }, l = t.events.onForm(i, ((e) => {
44
+ c(e.detail?.data);
45
+ }));
46
+ return { destroy: () => {
47
+ l();
48
+ } };
49
+ },
50
+ onAfterSubmit: async ({ services: e }) => {
51
+ e.updateInputs("paddleCheckoutInit", "true"), e.updateInputs("paddleCheckoutData", "");
52
+ }
53
+ });
54
+ //#endregion
55
+ export { a as paddleModule };
@@ -0,0 +1,95 @@
1
+ import { t as e } from "./api-CmwLRq_n.js";
2
+ import { r as t } from "./scripts-6CYSUGKQ.js";
3
+ import { t as n } from "./styles-BfoIZwJp.js";
4
+ //#endregion
5
+ //#region src/js/modules/payments/paypal.ts
6
+ n("paypal", ["@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)}}"]);
7
+ var r = "FORMIE_PAYPAL_SCRIPT";
8
+ function i(e) {
9
+ if (!e) return "";
10
+ let t = (e.purchase_units || [])[0]?.payments || {}, n = t.authorizations || [], r = t.captures || [];
11
+ return String(n[0]?.id || r[0]?.id || "").trim();
12
+ }
13
+ function a(e, t) {
14
+ return `https://www.paypal.com/sdk/js?${[
15
+ "intent=authorize",
16
+ `currency=${encodeURIComponent(t)}`,
17
+ `client-id=${encodeURIComponent(e)}`
18
+ ].join("&")}`;
19
+ }
20
+ var o = e({
21
+ id: "paypal",
22
+ defaultRequiredInputSuffixes: ["paypalOrderId", "paypalAuthId"],
23
+ load: async (e) => {
24
+ let { provider: n } = e.options, i = n.clientId;
25
+ return i?.trim() ? (await t("paypal", {
26
+ id: r,
27
+ src: a(i, n.currency || "AUD")
28
+ }), window.paypal) : (console.error("[formie] Missing clientId for PayPal."), null);
29
+ },
30
+ mount: async (e) => {
31
+ let { api: t, field: n, services: r, options: a, provider: o } = e, s = n.querySelector("[data-formie-paypal-button]");
32
+ if (!s || !t || s.getAttribute("data-formie-paypal-rendered") === "true") return null;
33
+ s.innerHTML = "";
34
+ let c = !!o.useSandbox, l = r.resolveCurrency({
35
+ value: o.currency,
36
+ defaultCurrency: "AUD"
37
+ });
38
+ if (!l.ok) return r.addError("error" in l ? l.error : "Invalid PayPal currency."), null;
39
+ let u = l.value, d = {
40
+ layout: o.buttonLayout || "vertical",
41
+ color: o.buttonColor || "gold",
42
+ shape: o.buttonShape || "rect",
43
+ label: o.buttonLabel || "paypal",
44
+ width: o.buttonWidth || 250,
45
+ height: o.buttonHeight || 35
46
+ };
47
+ d.layout === "horizontal" && (d.tagline = o.buttonTagline ?? !0);
48
+ let f = {
49
+ env: c ? "sandbox" : "production",
50
+ style: d,
51
+ createOrder: (e, t) => {
52
+ r.removeError();
53
+ let n = r.resolveAmount({
54
+ type: o.amountType,
55
+ fixed: o.amountFixed,
56
+ variable: o.amountVariable
57
+ });
58
+ if (!n.ok) {
59
+ let e = "error" in n ? n.error : "Invalid PayPal amount.";
60
+ throw r.addError(e), Error(e);
61
+ }
62
+ return t.order.create({
63
+ intent: "AUTHORIZE",
64
+ application_context: { user_action: "CONTINUE" },
65
+ purchase_units: [{ amount: {
66
+ currency_code: u,
67
+ value: String(n.value)
68
+ } }]
69
+ });
70
+ },
71
+ onError: (e) => {
72
+ r.addError(e?.message || "PayPal error.");
73
+ },
74
+ onApprove: async (e, t) => {
75
+ try {
76
+ let n = i(await t.order.authorize());
77
+ r.updateInputs("paypalOrderId", e.orderID), r.updateInputs("paypalAuthId", n || ""), n ? r.addSuccess("Payment authorized. Finalize the form to complete payment.") : r.addSuccess("PayPal approval received. Finalizing payment on submit.");
78
+ } catch {
79
+ r.addError("Unable to authorize payment. Please try again.");
80
+ }
81
+ }
82
+ }, p = t.Buttons(f);
83
+ return s.setAttribute("data-formie-paypal-rendered", "true"), p.render(s);
84
+ },
85
+ unmount: async (e) => {
86
+ e.widget?.close && e.widget.close();
87
+ let t = e.field.querySelector("[data-formie-paypal-button]");
88
+ t && (t.removeAttribute("data-formie-paypal-rendered"), t.innerHTML = "");
89
+ },
90
+ onAfterSubmit: async ({ services: e }) => {
91
+ e.updateInputs(["paypalOrderId", "paypalAuthId"], ""), e.removeSuccess(), e.removeError();
92
+ }
93
+ });
94
+ //#endregion
95
+ export { o as paypalModule };
@@ -0,0 +1,55 @@
1
+ import { t as e } from "./api-CmwLRq_n.js";
2
+ import { r as t } from "./scripts-6CYSUGKQ.js";
3
+ import { t as n } from "./styles-BfoIZwJp.js";
4
+ //#endregion
5
+ //#region src/js/modules/payments/payway.ts
6
+ n("payway", ["@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)}}"]);
7
+ var r = "FORMIE_PAYWAY_SCRIPT", i = e({
8
+ id: "payway",
9
+ defaultRequiredInputSuffixes: ["paywayTokenId"],
10
+ load: async (e) => {
11
+ let { provider: n } = e.options;
12
+ return n.publishableKey?.trim() ? (await t("payway", {
13
+ id: r,
14
+ src: "https://api.payway.com.au/rest/v1/payway.js"
15
+ }), null) : (console.error("[formie] Missing publishableKey for PayWay."), null);
16
+ },
17
+ mount: async (e) => {
18
+ let { field: t, services: n, options: r } = e, i = r.provider;
19
+ if (!t.querySelector("[data-formie-payway-button]")) return null;
20
+ let a = window.payway;
21
+ return a ? new Promise((e) => {
22
+ a.createCreditCardFrame({
23
+ layout: "wide",
24
+ publishableApiKey: i.publishableKey || "",
25
+ tokenMode: "callback"
26
+ }, (t, r) => {
27
+ if (t || !r) {
28
+ n.addError(t?.message || "PayWay frame failed to load."), e(null);
29
+ return;
30
+ }
31
+ e(r);
32
+ });
33
+ }) : null;
34
+ },
35
+ unmount: async (e) => {
36
+ e.widget?.destroy();
37
+ },
38
+ onBeforeAuthorize: async (e) => {
39
+ let { widget: t, services: n } = e;
40
+ return t ? new Promise((e) => {
41
+ t.getToken((t, r) => {
42
+ if (t) {
43
+ n.addError(t.message), e(!1);
44
+ return;
45
+ }
46
+ r?.singleUseTokenId ? (n.updateInputs("paywayTokenId", r.singleUseTokenId), e(!0)) : (n.addError("Tokenization failed."), e(!1));
47
+ });
48
+ }) : (n.addError("PayWay card frame is not ready."), !1);
49
+ },
50
+ onAfterSubmit: async ({ services: e }) => {
51
+ e.updateInputs("paywayTokenId", "");
52
+ }
53
+ });
54
+ //#endregion
55
+ export { i as paywayModule };