@verbb/formie-browser 1.0.0 → 1.0.2

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 (120) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunks/address-finder-CQW81kY0.js +37 -0
  3. package/dist/chunks/bpoint-D8OjLmsn.js +26 -0
  4. package/dist/chunks/calculations-BqZsENCq.js +147 -0
  5. package/dist/chunks/captcha-eu-DIa6aUWz.js +34 -0
  6. package/dist/chunks/checkbox-radio-BI-UjgMF.js +136 -0
  7. package/dist/chunks/conditions-BVl6jTYo.js +433 -0
  8. package/dist/chunks/date-picker-69TgvErA.js +4994 -0
  9. package/dist/chunks/eway-1GPxH6DU.js +74 -0
  10. package/dist/chunks/file-upload-BDZZftgL.js +281 -0
  11. package/dist/chunks/friendly-captcha-v1-DA2QPKA3.js +33 -0
  12. package/dist/chunks/friendly-captcha-v2-BorOWiz_.js +38 -0
  13. package/dist/chunks/go-cardless-DwBgERcA.js +24 -0
  14. package/dist/chunks/google-address-BcTBncyS.js +162 -0
  15. package/dist/chunks/hcaptcha-BchdVCqq.js +56 -0
  16. package/dist/chunks/hidden-D8RqSPt7.js +31 -0
  17. package/dist/chunks/index-BEsfee-D.js +1839 -0
  18. package/dist/chunks/index-BP7Unm5Y.js +863 -0
  19. package/dist/chunks/index-C1ZOKiAi.js +4229 -0
  20. package/dist/chunks/loqate-nXuTX7In.js +55 -0
  21. package/dist/chunks/mollie-qdCynQCd.js +24 -0
  22. package/dist/chunks/moneris-BNEA-laO.js +101 -0
  23. package/dist/chunks/opayo-BJtXOkuK.js +122 -0
  24. package/dist/chunks/paddle-D72Pa8kr.js +60 -0
  25. package/dist/chunks/paypal-Cqt2bned.js +100 -0
  26. package/dist/chunks/payway-BjCqsc0H.js +56 -0
  27. package/dist/chunks/phone-country-K9pYAlzM.js +3765 -0
  28. package/dist/chunks/place-kit-Dg6f_UoM.js +42 -0
  29. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +1299 -0
  30. package/dist/chunks/recaptcha-enterprise--VYAeeqz.js +71 -0
  31. package/dist/chunks/recaptcha-shared-PSIEEEe1.js +15 -0
  32. package/dist/chunks/recaptcha-v2-checkbox-atBNe5ml.js +41 -0
  33. package/dist/chunks/recaptcha-v2-invisible-DnBufNPT.js +59 -0
  34. package/dist/chunks/recaptcha-v3-CF6O8rDj.js +28 -0
  35. package/dist/chunks/repeater-CB7Yojvx.js +124 -0
  36. package/dist/chunks/rich-text-nAV_SQZo.js +304 -0
  37. package/dist/chunks/scripts-BkAAux0i.js +36 -0
  38. package/dist/chunks/sdk-3SicTWby.js +1559 -0
  39. package/dist/chunks/shared-DGqeMvcJ.js +80 -0
  40. package/dist/chunks/signature-BT6CsQ6n.js +550 -0
  41. package/dist/chunks/snaptcha-C7qQo02f.js +8 -0
  42. package/dist/chunks/square-C5AH3trb.js +46 -0
  43. package/dist/chunks/stripe-EJK0RyUv.js +202 -0
  44. package/dist/chunks/styles-C3aqgtek.js +21 -0
  45. package/dist/chunks/summary-DC_ipXCU.js +126 -0
  46. package/dist/chunks/table-BEAI99qo.js +95 -0
  47. package/dist/chunks/text-limit-Blgq5G-G.js +135 -0
  48. package/dist/chunks/turnstile-_uCRwnU-.js +59 -0
  49. package/dist/chunks/utils-BntI3W4S.js +6149 -0
  50. package/dist/index.js +39 -3205
  51. package/package.json +5 -5
  52. package/src/js/modules/fields/file-upload.ts +1 -1
  53. package/src/js/modules/fields/repeater.ts +1 -1
  54. package/src/js/modules/fields/rich-text.ts +2 -2
  55. package/src/js/modules/fields/signature.ts +1 -1
  56. package/src/js/modules/fields/summary.ts +1 -1
  57. package/src/js/modules/fields/table.ts +1 -1
  58. package/src/js/modules/fields/text-limit.ts +1 -1
  59. package/src/js/modules/payments/paypal.ts +1 -1
  60. package/src/js/modules/payments/payway.ts +1 -1
  61. package/src/js/modules/payments/stripe.ts +1 -1
  62. package/dist/chunks/address-finder-DfMCiW89.js +0 -47
  63. package/dist/chunks/api-CbqEMQT5.js +0 -181
  64. package/dist/chunks/api-DE7LfK-R.js +0 -960
  65. package/dist/chunks/api-DOfDzYC_.js +0 -538
  66. package/dist/chunks/async-B3DUf1GZ.js +0 -26
  67. package/dist/chunks/bpoint-Ciy3yY9Q.js +0 -34
  68. package/dist/chunks/calculations-CkYAqO_-.js +0 -197
  69. package/dist/chunks/captcha-eu-DnOWhMwr.js +0 -43
  70. package/dist/chunks/checkbox-radio-0x7Tc0br.js +0 -197
  71. package/dist/chunks/chunk-K6L4z4UQ.js +0 -24
  72. package/dist/chunks/conditions-4fXKhEJS.js +0 -609
  73. package/dist/chunks/date-picker-B6iZkjHS.js +0 -6204
  74. package/dist/chunks/debug-KnZeKYBI.js +0 -39
  75. package/dist/chunks/dist-D09GnXMW.js +0 -2663
  76. package/dist/chunks/event-names-DamGPtXR.js +0 -51
  77. package/dist/chunks/eway-DEAYcwT0.js +0 -86
  78. package/dist/chunks/field-references.keys-BpBZ_quS.js +0 -24
  79. package/dist/chunks/field-references.resolver-Ba6xhiJC.js +0 -183
  80. package/dist/chunks/file-upload-Bh63PQSE.js +0 -430
  81. package/dist/chunks/friendly-captcha-v1-CqO4WVre.js +0 -40
  82. package/dist/chunks/friendly-captcha-v2-CyykcJcM.js +0 -47
  83. package/dist/chunks/friendly-challenge-Dg8XkStd.js +0 -1101
  84. package/dist/chunks/go-cardless-CuND59rR.js +0 -26
  85. package/dist/chunks/google-address--uR8WDSm.js +0 -208
  86. package/dist/chunks/hcaptcha-CmaFUesv.js +0 -72
  87. package/dist/chunks/hidden-CYnZYple.js +0 -36
  88. package/dist/chunks/http-18nn97DZ.js +0 -29
  89. package/dist/chunks/i18n-vUh-KGiH.js +0 -55
  90. package/dist/chunks/loqate-BICNJlVK.js +0 -97
  91. package/dist/chunks/mollie-DwlsgHZ1.js +0 -26
  92. package/dist/chunks/moneris-B_IFZFTx.js +0 -159
  93. package/dist/chunks/opayo-U2x_TOII.js +0 -192
  94. package/dist/chunks/paddle-BqXFrc79.js +0 -75
  95. package/dist/chunks/paypal-Cn_DYGDb.js +0 -121
  96. package/dist/chunks/payway-Rnq796eC.js +0 -75
  97. package/dist/chunks/phone-country-B6Me4lK0.js +0 -3317
  98. package/dist/chunks/place-kit-ldUl-u9w.js +0 -56
  99. package/dist/chunks/placekit-autocomplete.esm-D-lGeaZl.js +0 -1771
  100. package/dist/chunks/recaptcha-enterprise-DPJNyv1X.js +0 -72
  101. package/dist/chunks/recaptcha-shared-DTI4qWVR.js +0 -22
  102. package/dist/chunks/recaptcha-v2-checkbox-zFjpvJ5c.js +0 -49
  103. package/dist/chunks/recaptcha-v2-invisible-CnYtkNvz.js +0 -62
  104. package/dist/chunks/recaptcha-v3-EAlWhnkX.js +0 -33
  105. package/dist/chunks/repeater-CXD1eLSn.js +0 -151
  106. package/dist/chunks/rich-text-DkmZRhGj.js +0 -442
  107. package/dist/chunks/scripts-BGD_iU_6.js +0 -41
  108. package/dist/chunks/sdk-B7u9fTlP.js +0 -2103
  109. package/dist/chunks/shared-DC6_1u8X.js +0 -85
  110. package/dist/chunks/signature-E9KyYXS1.js +0 -765
  111. package/dist/chunks/snaptcha-CCDunGeb.js +0 -8
  112. package/dist/chunks/square-BLqK51rS.js +0 -61
  113. package/dist/chunks/stripe-B8gHpZNC.js +0 -273
  114. package/dist/chunks/styles-BIh6g7V_.js +0 -22
  115. package/dist/chunks/summary-EcNE0cvg.js +0 -191
  116. package/dist/chunks/table-yxEDL6kA.js +0 -124
  117. package/dist/chunks/text-limit-D0H_Ca2c.js +0 -179
  118. package/dist/chunks/theme-classes-vSHpdCUO.js +0 -59
  119. package/dist/chunks/turnstile-DP0bdR7T.js +0 -68
  120. package/dist/chunks/utils-ByrEVYrJ.js +0 -49584
@@ -1,51 +0,0 @@
1
- //#region src/js/utils/event-names.ts
2
- var FORMIE_HTML_EVENT_NAMES = [
3
- "formie:mount:after",
4
- "formie:unmount:before",
5
- "formie:unmount:after",
6
- "formie:validator:ready",
7
- "formie:theme:applied",
8
- "formie:page:navigate",
9
- "formie:page:navigate:after",
10
- "formie:page:navigate:error",
11
- "formie:submit:before",
12
- "formie:submit:after",
13
- "formie:submit:final:before",
14
- "formie:submit:final:after",
15
- "formie:submit:result",
16
- "formie:client-event",
17
- "formie:refresh-tokens:after",
18
- "formie:refresh-tokens:refreshed"
19
- ];
20
- function toDomEventName(eventName) {
21
- return normalizeFormieEventName(eventName);
22
- }
23
- function normalizeFormieEventName(eventName) {
24
- return eventName;
25
- }
26
- function getFieldModuleEventName(moduleId, name) {
27
- return `formie:field:${moduleId}:${name}`;
28
- }
29
- function getValidatorEventName(name) {
30
- return `formie:validator:${name}`;
31
- }
32
- function getAddressProviderEventName(providerId, name) {
33
- return `formie:address:${providerId}:${name}`;
34
- }
35
- function getFileUploadEventName(name) {
36
- return `formie:file-upload:${name}`;
37
- }
38
- function getPaymentProviderActionEventName(providerId, action) {
39
- return `formie:payment:${providerId}:${action}`;
40
- }
41
- function getFormStateEventName(name) {
42
- return `formie:state:${name}`;
43
- }
44
- function getScopedModuleLifecycleEventName(moduleId, phase) {
45
- return `formie:module:${moduleId}:${phase}`;
46
- }
47
- function getGlobalModuleLifecycleEventName(phase) {
48
- return `formie:module:${phase}`;
49
- }
50
- //#endregion
51
- export { getFormStateEventName as a, getScopedModuleLifecycleEventName as c, toDomEventName as d, getFileUploadEventName as i, getValidatorEventName as l, getAddressProviderEventName as n, getGlobalModuleLifecycleEventName as o, getFieldModuleEventName as r, getPaymentProviderActionEventName as s, FORMIE_HTML_EVENT_NAMES as t, normalizeFormieEventName as u };
@@ -1,86 +0,0 @@
1
- import { t as definePaymentModule } from "./api-DE7LfK-R.js";
2
- import { r as waitFor } from "./async-B3DUf1GZ.js";
3
- import { r as loadScriptAndEnsureGlobal } from "./scripts-BGD_iU_6.js";
4
- //#region src/js/modules/payments/eway.ts
5
- var SCRIPT_SOURCES = [{
6
- id: "FORMIE_EWAY_SCRIPT_MIN",
7
- src: "https://secure.ewaypayments.com/scripts/eCrypt.min.js"
8
- }, {
9
- id: "FORMIE_EWAY_SCRIPT",
10
- src: "https://secure.ewaypayments.com/scripts/eCrypt.js"
11
- }];
12
- async function ensureEwayEncryptApi() {
13
- let lastError = null;
14
- for (const source of SCRIPT_SOURCES) {
15
- try {
16
- await loadScriptAndEnsureGlobal("eCrypt", {
17
- id: source.id,
18
- src: source.src,
19
- timeoutMs: 1e4
20
- });
21
- return await waitFor(() => {
22
- const candidate = window.eCrypt;
23
- if (candidate && typeof candidate.encryptValue === "function") return candidate;
24
- return null;
25
- }, {
26
- timeoutMs: 1e4,
27
- intervalMs: 50
28
- });
29
- } catch (error) {
30
- lastError = error instanceof Error ? error : /* @__PURE__ */ new Error("Unknown eWay script load error.");
31
- }
32
- SCRIPT_SOURCES.forEach(({ id }) => {
33
- document.getElementById(id)?.remove();
34
- });
35
- }
36
- throw lastError || /* @__PURE__ */ new Error("Eway encryption script failed to load.");
37
- }
38
- var ewayModule = definePaymentModule({
39
- id: "eway",
40
- defaultRequiredInputSuffixes: ["ewayTokenData"],
41
- load: async (ctx) => {
42
- const { provider } = ctx.options;
43
- if (!provider.cseKey?.trim()) {
44
- console.error("[formie] Missing cseKey for Eway.");
45
- return null;
46
- }
47
- return ensureEwayEncryptApi();
48
- },
49
- onBeforeAuthorize: async (args) => {
50
- const { field, services, provider, api } = args;
51
- const cseKey = provider.cseKey;
52
- if (!cseKey?.trim()) {
53
- services.addError("Missing cseKey for Eway.");
54
- return false;
55
- }
56
- let eCrypt = api;
57
- if (!eCrypt?.encryptValue) try {
58
- eCrypt = await ensureEwayEncryptApi();
59
- } catch (error) {
60
- services.addError(error instanceof Error ? error.message : "Eway encryption script failed to load.");
61
- return false;
62
- }
63
- const cardholderName = field.querySelector("[data-eway-card=\"cardholder-name\"]")?.value ?? "";
64
- const cardNumber = field.querySelector("[data-eway-card=\"card-number\"]")?.value ?? "";
65
- const expiryDate = field.querySelector("[data-eway-card=\"expiry-date\"]")?.value ?? "";
66
- const securityCode = field.querySelector("[data-eway-card=\"security-code\"]")?.value ?? "";
67
- try {
68
- const cardDetails = {
69
- cardholderName,
70
- cardNumber: eCrypt.encryptValue(cardNumber, cseKey),
71
- expiryDate,
72
- securityCode: eCrypt.encryptValue(securityCode, cseKey)
73
- };
74
- services.updateInputs("ewayTokenData", JSON.stringify(cardDetails));
75
- return true;
76
- } catch (e) {
77
- services.addError(e instanceof Error ? e.message : "Failed to encrypt card details.");
78
- return false;
79
- }
80
- },
81
- onAfterSubmit: async ({ services }) => {
82
- services.updateInputs("ewayTokenData", "");
83
- }
84
- });
85
- //#endregion
86
- export { ewayModule };
@@ -1,24 +0,0 @@
1
- //#region src/js/utils/field-references.keys.ts
2
- function stripFieldPrefix(value) {
3
- return value.replace(/^\{field:/, "").replace(/^\{/, "").replace(/\}$/, "").trim();
4
- }
5
- function normalizeFieldKey(value) {
6
- return stripFieldPrefix(value).replace(/\]/g, "").split("[").join(".").replace(/\.+/g, ".").replace(/^\./, "").replace(/\.$/, "");
7
- }
8
- function fieldKeyToInputName(key) {
9
- const parts = normalizeFieldKey(key).split(".").filter(Boolean);
10
- if (!parts.length) return "";
11
- const [head, ...rest] = parts;
12
- return `fields[${head}]${rest.map((part) => `[${part}]`).join("")}`;
13
- }
14
- function inputNameToFieldKey(name) {
15
- const match = String(name || "").trim().match(/^fields\[([^\]]+)\](.*)$/);
16
- if (!match) return "";
17
- const first = match[1] || "";
18
- const tail = match[2] || "";
19
- return [first, ...Array.from(tail.matchAll(/\[([^\]]+)\]/g)).map((part) => {
20
- return part[1] || "";
21
- }).filter(Boolean)].join(".");
22
- }
23
- //#endregion
24
- export { inputNameToFieldKey as n, normalizeFieldKey as r, fieldKeyToInputName as t };
@@ -1,183 +0,0 @@
1
- import { n as inputNameToFieldKey, r as normalizeFieldKey, t as fieldKeyToInputName } from "./field-references.keys-BpBZ_quS.js";
2
- //#region src/js/utils/field-references.parser.ts
3
- function parseTransforms(body) {
4
- const parts = body.split(";").map((part) => {
5
- return part.trim();
6
- }).filter(Boolean);
7
- if (!parts.length) return {
8
- source: "",
9
- transforms: []
10
- };
11
- const [source, ...metadata] = parts;
12
- const transforms = [];
13
- let current = null;
14
- metadata.forEach((entry) => {
15
- if (entry.startsWith("transform=")) {
16
- if (current) transforms.push(current);
17
- current = {
18
- id: decodeURIComponent(entry.slice(10) || "").trim(),
19
- params: {}
20
- };
21
- return;
22
- }
23
- if (!current || !entry.includes("=")) return;
24
- const [rawKey, rawValue] = entry.split("=", 2);
25
- const key = (rawKey || "").trim();
26
- if (!key || key === "transform") return;
27
- current.params[key] = decodeURIComponent(rawValue || "").trim();
28
- });
29
- if (current) transforms.push(current);
30
- return {
31
- source: source || "",
32
- transforms
33
- };
34
- }
35
- function parseFieldReference(rawValue) {
36
- const raw = String(rawValue || "").trim();
37
- if (!raw) return {
38
- raw,
39
- target: "",
40
- key: "",
41
- selector: "",
42
- defaultValue: "",
43
- transforms: [],
44
- isToken: false,
45
- isValid: false
46
- };
47
- const tokenMatch = raw.match(/^\{([a-zA-Z]+)(?::(.*))?\}$/);
48
- if (!tokenMatch) return {
49
- raw,
50
- target: "",
51
- key: normalizeFieldKey(raw),
52
- selector: "",
53
- defaultValue: "",
54
- transforms: [],
55
- isToken: false,
56
- isValid: true
57
- };
58
- const targetRaw = (tokenMatch[1] || "").trim().toLowerCase();
59
- const [beforeDefault, defaultRaw = ""] = (tokenMatch[2] || "").trim().split("|", 2);
60
- const { source, transforms } = parseTransforms(beforeDefault || "");
61
- if (targetRaw !== "field") return {
62
- raw,
63
- target: "",
64
- key: "",
65
- selector: "",
66
- defaultValue: defaultRaw.trim(),
67
- transforms,
68
- isToken: true,
69
- isValid: false
70
- };
71
- const separatorIndex = source.indexOf(":");
72
- const keyRaw = separatorIndex === -1 ? source : source.slice(0, separatorIndex);
73
- const selectorRaw = separatorIndex === -1 ? "" : source.slice(separatorIndex + 1);
74
- const key = normalizeFieldKey(keyRaw);
75
- return {
76
- raw,
77
- target: "field",
78
- key,
79
- selector: selectorRaw.trim(),
80
- defaultValue: defaultRaw.trim(),
81
- transforms,
82
- isToken: true,
83
- isValid: key !== ""
84
- };
85
- }
86
- //#endregion
87
- //#region src/js/utils/field-references.registry.ts
88
- function isFieldValueInput(node) {
89
- return node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement || node instanceof HTMLSelectElement;
90
- }
91
- function addInputEntry(registry, key, input) {
92
- const normalizedKey = key.trim();
93
- const name = String(input.name || "").trim();
94
- if (!normalizedKey || !name) return;
95
- const entry = registry.get(normalizedKey) || {
96
- key: normalizedKey,
97
- names: [],
98
- inputs: []
99
- };
100
- if (!entry.names.includes(name)) entry.names.push(name);
101
- if (!entry.inputs.includes(input)) entry.inputs.push(input);
102
- registry.set(normalizedKey, entry);
103
- }
104
- function buildFieldValueRegistry(root) {
105
- const registry = /* @__PURE__ */ new Map();
106
- Array.from(root.querySelectorAll("[name]")).filter((node) => {
107
- return isFieldValueInput(node);
108
- }).forEach((input) => {
109
- const key = inputNameToFieldKey(input.name);
110
- if (!key) return;
111
- addInputEntry(registry, key, input);
112
- });
113
- return registry;
114
- }
115
- //#endregion
116
- //#region src/js/utils/field-references.resolver.ts
117
- function readInputsValue(inputs) {
118
- if (!inputs.length) return "";
119
- const first = inputs[0];
120
- if (first instanceof HTMLSelectElement && first.multiple) return Array.from(first.selectedOptions).map((option) => {
121
- return option.value;
122
- });
123
- if (inputs.some((input) => {
124
- return input instanceof HTMLInputElement && (input.type === "checkbox" || input.type === "radio");
125
- })) {
126
- const selected = inputs.flatMap((input) => {
127
- if (!(input instanceof HTMLInputElement) || !input.checked) return [];
128
- return [input.value];
129
- });
130
- return selected.length > 1 ? selected : selected[0] || "";
131
- }
132
- return first.value;
133
- }
134
- function getEntry(registry, key) {
135
- return registry.get(normalizeFieldKey(key)) || null;
136
- }
137
- function resolveFieldReferenceLive(reference, registry) {
138
- const parsed = parseFieldReference(reference);
139
- const key = parsed.key;
140
- const entry = getEntry(registry, key);
141
- if (!entry) return {
142
- key,
143
- value: parsed.defaultValue,
144
- found: false
145
- };
146
- const value = readInputsValue(entry.inputs);
147
- return {
148
- key,
149
- value: value === "" && parsed.defaultValue !== "" ? parsed.defaultValue : value,
150
- found: true
151
- };
152
- }
153
- function resolveFieldReferenceFromFormData(reference, formData, registry) {
154
- const parsed = parseFieldReference(reference);
155
- const key = parsed.key;
156
- if (!key) return {
157
- key,
158
- value: parsed.defaultValue,
159
- found: false
160
- };
161
- const entry = registry ? getEntry(registry, key) : null;
162
- const values = (entry?.names?.length ? entry.names : [fieldKeyToInputName(key)]).flatMap((name) => {
163
- const collected = formData.getAll(name).map((value) => {
164
- return String(value ?? "");
165
- });
166
- if (collected.length) return collected;
167
- return formData.getAll(`${name}[]`).map((value) => {
168
- return String(value ?? "");
169
- });
170
- }).filter((value) => value !== "");
171
- if (!values.length) return {
172
- key,
173
- value: parsed.defaultValue,
174
- found: false
175
- };
176
- return {
177
- key,
178
- value: values.length > 1 ? values : values[0],
179
- found: true
180
- };
181
- }
182
- //#endregion
183
- export { parseFieldReference as i, resolveFieldReferenceLive as n, buildFieldValueRegistry as r, resolveFieldReferenceFromFormData as t };