@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.
- package/CHANGELOG.md +16 -0
- package/dist/chunks/address-finder-CQW81kY0.js +37 -0
- package/dist/chunks/bpoint-D8OjLmsn.js +26 -0
- package/dist/chunks/calculations-BqZsENCq.js +147 -0
- package/dist/chunks/captcha-eu-DIa6aUWz.js +34 -0
- package/dist/chunks/checkbox-radio-BI-UjgMF.js +136 -0
- package/dist/chunks/conditions-BVl6jTYo.js +433 -0
- package/dist/chunks/date-picker-69TgvErA.js +4994 -0
- package/dist/chunks/eway-1GPxH6DU.js +74 -0
- package/dist/chunks/file-upload-BDZZftgL.js +281 -0
- package/dist/chunks/friendly-captcha-v1-DA2QPKA3.js +33 -0
- package/dist/chunks/friendly-captcha-v2-BorOWiz_.js +38 -0
- package/dist/chunks/go-cardless-DwBgERcA.js +24 -0
- package/dist/chunks/google-address-BcTBncyS.js +162 -0
- package/dist/chunks/hcaptcha-BchdVCqq.js +56 -0
- package/dist/chunks/hidden-D8RqSPt7.js +31 -0
- package/dist/chunks/index-BEsfee-D.js +1839 -0
- package/dist/chunks/index-BP7Unm5Y.js +863 -0
- package/dist/chunks/index-C1ZOKiAi.js +4229 -0
- package/dist/chunks/loqate-nXuTX7In.js +55 -0
- package/dist/chunks/mollie-qdCynQCd.js +24 -0
- package/dist/chunks/moneris-BNEA-laO.js +101 -0
- package/dist/chunks/opayo-BJtXOkuK.js +122 -0
- package/dist/chunks/paddle-D72Pa8kr.js +60 -0
- package/dist/chunks/paypal-Cqt2bned.js +100 -0
- package/dist/chunks/payway-BjCqsc0H.js +56 -0
- package/dist/chunks/phone-country-K9pYAlzM.js +3765 -0
- package/dist/chunks/place-kit-Dg6f_UoM.js +42 -0
- package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +1299 -0
- package/dist/chunks/recaptcha-enterprise--VYAeeqz.js +71 -0
- package/dist/chunks/recaptcha-shared-PSIEEEe1.js +15 -0
- package/dist/chunks/recaptcha-v2-checkbox-atBNe5ml.js +41 -0
- package/dist/chunks/recaptcha-v2-invisible-DnBufNPT.js +59 -0
- package/dist/chunks/recaptcha-v3-CF6O8rDj.js +28 -0
- package/dist/chunks/repeater-CB7Yojvx.js +124 -0
- package/dist/chunks/rich-text-nAV_SQZo.js +304 -0
- package/dist/chunks/scripts-BkAAux0i.js +36 -0
- package/dist/chunks/sdk-3SicTWby.js +1559 -0
- package/dist/chunks/shared-DGqeMvcJ.js +80 -0
- package/dist/chunks/signature-BT6CsQ6n.js +550 -0
- package/dist/chunks/snaptcha-C7qQo02f.js +8 -0
- package/dist/chunks/square-C5AH3trb.js +46 -0
- package/dist/chunks/stripe-EJK0RyUv.js +202 -0
- package/dist/chunks/styles-C3aqgtek.js +21 -0
- package/dist/chunks/summary-DC_ipXCU.js +126 -0
- package/dist/chunks/table-BEAI99qo.js +95 -0
- package/dist/chunks/text-limit-Blgq5G-G.js +135 -0
- package/dist/chunks/turnstile-_uCRwnU-.js +59 -0
- package/dist/chunks/utils-BntI3W4S.js +6149 -0
- package/dist/index.js +39 -3205
- package/package.json +5 -5
- package/src/js/modules/fields/file-upload.ts +1 -1
- package/src/js/modules/fields/repeater.ts +1 -1
- package/src/js/modules/fields/rich-text.ts +2 -2
- package/src/js/modules/fields/signature.ts +1 -1
- package/src/js/modules/fields/summary.ts +1 -1
- package/src/js/modules/fields/table.ts +1 -1
- package/src/js/modules/fields/text-limit.ts +1 -1
- package/src/js/modules/payments/paypal.ts +1 -1
- package/src/js/modules/payments/payway.ts +1 -1
- package/src/js/modules/payments/stripe.ts +1 -1
- package/dist/chunks/address-finder-DfMCiW89.js +0 -47
- package/dist/chunks/api-CbqEMQT5.js +0 -181
- package/dist/chunks/api-DE7LfK-R.js +0 -960
- package/dist/chunks/api-DOfDzYC_.js +0 -538
- package/dist/chunks/async-B3DUf1GZ.js +0 -26
- package/dist/chunks/bpoint-Ciy3yY9Q.js +0 -34
- package/dist/chunks/calculations-CkYAqO_-.js +0 -197
- package/dist/chunks/captcha-eu-DnOWhMwr.js +0 -43
- package/dist/chunks/checkbox-radio-0x7Tc0br.js +0 -197
- package/dist/chunks/chunk-K6L4z4UQ.js +0 -24
- package/dist/chunks/conditions-4fXKhEJS.js +0 -609
- package/dist/chunks/date-picker-B6iZkjHS.js +0 -6204
- package/dist/chunks/debug-KnZeKYBI.js +0 -39
- package/dist/chunks/dist-D09GnXMW.js +0 -2663
- package/dist/chunks/event-names-DamGPtXR.js +0 -51
- package/dist/chunks/eway-DEAYcwT0.js +0 -86
- package/dist/chunks/field-references.keys-BpBZ_quS.js +0 -24
- package/dist/chunks/field-references.resolver-Ba6xhiJC.js +0 -183
- package/dist/chunks/file-upload-Bh63PQSE.js +0 -430
- package/dist/chunks/friendly-captcha-v1-CqO4WVre.js +0 -40
- package/dist/chunks/friendly-captcha-v2-CyykcJcM.js +0 -47
- package/dist/chunks/friendly-challenge-Dg8XkStd.js +0 -1101
- package/dist/chunks/go-cardless-CuND59rR.js +0 -26
- package/dist/chunks/google-address--uR8WDSm.js +0 -208
- package/dist/chunks/hcaptcha-CmaFUesv.js +0 -72
- package/dist/chunks/hidden-CYnZYple.js +0 -36
- package/dist/chunks/http-18nn97DZ.js +0 -29
- package/dist/chunks/i18n-vUh-KGiH.js +0 -55
- package/dist/chunks/loqate-BICNJlVK.js +0 -97
- package/dist/chunks/mollie-DwlsgHZ1.js +0 -26
- package/dist/chunks/moneris-B_IFZFTx.js +0 -159
- package/dist/chunks/opayo-U2x_TOII.js +0 -192
- package/dist/chunks/paddle-BqXFrc79.js +0 -75
- package/dist/chunks/paypal-Cn_DYGDb.js +0 -121
- package/dist/chunks/payway-Rnq796eC.js +0 -75
- package/dist/chunks/phone-country-B6Me4lK0.js +0 -3317
- package/dist/chunks/place-kit-ldUl-u9w.js +0 -56
- package/dist/chunks/placekit-autocomplete.esm-D-lGeaZl.js +0 -1771
- package/dist/chunks/recaptcha-enterprise-DPJNyv1X.js +0 -72
- package/dist/chunks/recaptcha-shared-DTI4qWVR.js +0 -22
- package/dist/chunks/recaptcha-v2-checkbox-zFjpvJ5c.js +0 -49
- package/dist/chunks/recaptcha-v2-invisible-CnYtkNvz.js +0 -62
- package/dist/chunks/recaptcha-v3-EAlWhnkX.js +0 -33
- package/dist/chunks/repeater-CXD1eLSn.js +0 -151
- package/dist/chunks/rich-text-DkmZRhGj.js +0 -442
- package/dist/chunks/scripts-BGD_iU_6.js +0 -41
- package/dist/chunks/sdk-B7u9fTlP.js +0 -2103
- package/dist/chunks/shared-DC6_1u8X.js +0 -85
- package/dist/chunks/signature-E9KyYXS1.js +0 -765
- package/dist/chunks/snaptcha-CCDunGeb.js +0 -8
- package/dist/chunks/square-BLqK51rS.js +0 -61
- package/dist/chunks/stripe-B8gHpZNC.js +0 -273
- package/dist/chunks/styles-BIh6g7V_.js +0 -22
- package/dist/chunks/summary-EcNE0cvg.js +0 -191
- package/dist/chunks/table-yxEDL6kA.js +0 -124
- package/dist/chunks/text-limit-D0H_Ca2c.js +0 -179
- package/dist/chunks/theme-classes-vSHpdCUO.js +0 -59
- package/dist/chunks/turnstile-DP0bdR7T.js +0 -68
- package/dist/chunks/utils-ByrEVYrJ.js +0 -49584
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbb/formie-browser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/verbb/formie/issues"
|
|
22
22
|
},
|
|
23
|
-
"homepage": "https://docs.verbb.io/formie/
|
|
23
|
+
"homepage": "https://docs.verbb.io/formie/browser",
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=20.0.0"
|
|
26
26
|
},
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"**/*.css"
|
|
29
29
|
],
|
|
30
30
|
"imports": {
|
|
31
|
-
"#theme/*": "./src/
|
|
31
|
+
"#theme/*": "./src/js/theme/*",
|
|
32
|
+
"#theme-css/*": "./src/css/theme/*",
|
|
32
33
|
"#theme-base/*": "./src/css/theme-base/*",
|
|
33
34
|
"#icons/*": "./src/icons/*",
|
|
34
35
|
"#contracts/*": "./src/js/contracts/*",
|
|
@@ -36,7 +37,6 @@
|
|
|
36
37
|
"#core/*": "./src/js/core/*",
|
|
37
38
|
"#events/*": "./src/js/events/*",
|
|
38
39
|
"#modules/*": "./src/js/modules/*",
|
|
39
|
-
"#theme/*": "./src/js/theme/*",
|
|
40
40
|
"#submit/*": "./src/js/submit/*",
|
|
41
41
|
"#transport/*": "./src/js/transport/*",
|
|
42
42
|
"#utils/*": "./src/js/utils/*",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"vite": "^8.0.10"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@verbb/formie-core": "1.0.
|
|
68
|
+
"@verbb/formie-core": "1.0.2",
|
|
69
69
|
"@friendlycaptcha/sdk": "^1.0.0",
|
|
70
70
|
"@placekit/autocomplete-js": "^2.2.1",
|
|
71
71
|
"expression-language": "^2.5.4",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fileUploadCss from '#theme/fields/_file.css?inline';
|
|
1
|
+
import fileUploadCss from '#theme-css/fields/_file.css?inline';
|
|
2
2
|
|
|
3
3
|
import type { FormieModuleDefinition } from '#contracts/modules';
|
|
4
4
|
import { dispatchFieldEvent, getModuleFieldTarget, releaseFormValidators, retainFormValidators } from '#modules/fields/shared';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import repeaterCss from '#theme/fields/_repeater.css?inline';
|
|
1
|
+
import repeaterCss from '#theme-css/fields/_repeater.css?inline';
|
|
2
2
|
|
|
3
3
|
import type { FormieModuleDefinition } from '#contracts/modules';
|
|
4
4
|
import { dispatchFieldEvent, getTemplateSource, getTemplateSourceHtml } from '#modules/fields/shared';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { exec, init as initPell } from 'pell';
|
|
2
2
|
import pellCss from 'pell/dist/pell.min.css?inline';
|
|
3
|
-
import tokensCss from '#theme/_tokens.css?inline';
|
|
4
|
-
import richTextCss from '#theme/fields/_rich-text.css?inline';
|
|
3
|
+
import tokensCss from '#theme-css/_tokens.css?inline';
|
|
4
|
+
import richTextCss from '#theme-css/fields/_rich-text.css?inline';
|
|
5
5
|
import alignCenterIcon from '#icons/rich-text/aligncenter.svg?raw';
|
|
6
6
|
import alignLeftIcon from '#icons/rich-text/alignleft.svg?raw';
|
|
7
7
|
import alignRightIcon from '#icons/rich-text/alignright.svg?raw';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import SignaturePad from 'signature_pad';
|
|
2
|
-
import signatureCss from '#theme/fields/_signature.css?inline';
|
|
2
|
+
import signatureCss from '#theme-css/fields/_signature.css?inline';
|
|
3
3
|
|
|
4
4
|
import type { FormieModuleDefinition } from '#contracts/modules';
|
|
5
5
|
import { dispatchFieldEvent, getModuleFieldContainers } from '#modules/fields/shared';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import summaryCss from '#theme/fields/_summary.css?inline';
|
|
1
|
+
import summaryCss from '#theme-css/fields/_summary.css?inline';
|
|
2
2
|
|
|
3
3
|
import type { FormieModuleDefinition } from '#contracts/modules';
|
|
4
4
|
import { dispatchFieldEvent, getModuleFieldContainers } from '#modules/fields/shared';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import tableCss from '#theme/fields/_table.css?inline';
|
|
1
|
+
import tableCss from '#theme-css/fields/_table.css?inline';
|
|
2
2
|
|
|
3
3
|
import type { FormieModuleDefinition } from '#contracts/modules';
|
|
4
4
|
import { dispatchFieldEvent, getTemplateSource, getTemplateSourceHtml } from '#modules/fields/shared';
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { n as getAddressProviderEventName } from "./event-names-DamGPtXR.js";
|
|
2
|
-
import { t as defineAddressModule } from "./api-CbqEMQT5.js";
|
|
3
|
-
import { r as loadScriptAndEnsureGlobal } from "./scripts-BGD_iU_6.js";
|
|
4
|
-
//#region src/js/modules/address/address-finder.ts
|
|
5
|
-
var SCRIPT_ID = "FORMIE_ADDRESS_FINDER_SCRIPT";
|
|
6
|
-
var addressFinderModule = defineAddressModule({
|
|
7
|
-
id: "address-finder",
|
|
8
|
-
load: async () => {
|
|
9
|
-
return loadScriptAndEnsureGlobal("AddressFinder", {
|
|
10
|
-
id: SCRIPT_ID,
|
|
11
|
-
src: "https://api.addressfinder.io/assets/v3/widget.js",
|
|
12
|
-
async: true,
|
|
13
|
-
defer: true
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
mount: ({ api, field, services, provider }) => {
|
|
17
|
-
const input = services.input.getAutocomplete();
|
|
18
|
-
if (!input || typeof api === "undefined" || !api.Widget) throw new Error("AddressFinder API not ready");
|
|
19
|
-
const apiKey = provider.apiKey || "";
|
|
20
|
-
const countryCode = provider.countryCode || "au";
|
|
21
|
-
const widget = new api.Widget(input, apiKey, countryCode, provider.widgetOptions);
|
|
22
|
-
widget.on("result:select", (fullAddress, metaData) => {
|
|
23
|
-
if (metaData.address_line_2) {
|
|
24
|
-
services.input.setValue("address1", metaData.address_line_2);
|
|
25
|
-
services.input.setValue("address2", metaData.address_line_1);
|
|
26
|
-
} else {
|
|
27
|
-
services.input.setValue("address1", metaData.address_line_1 || "");
|
|
28
|
-
services.input.setValue("address2", "");
|
|
29
|
-
}
|
|
30
|
-
services.input.setValue("city", metaData.locality_name || "");
|
|
31
|
-
services.input.setValue("zip", metaData.postcode || "");
|
|
32
|
-
services.input.setValue("state", metaData.state_territory || "");
|
|
33
|
-
services.input.setValue("country", countryCode);
|
|
34
|
-
field.dispatchEvent(new CustomEvent(getAddressProviderEventName("address-finder", "populate"), {
|
|
35
|
-
bubbles: true,
|
|
36
|
-
detail: {
|
|
37
|
-
addressProvider: "address-finder",
|
|
38
|
-
fullAddress,
|
|
39
|
-
metaData
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
42
|
-
});
|
|
43
|
-
return widget;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
//#endregion
|
|
47
|
-
export { addressFinderModule };
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { t as createDebug } from "./debug-KnZeKYBI.js";
|
|
2
|
-
//#region src/js/modules/address/constants.ts
|
|
3
|
-
/** Default selector for the autocomplete input within an address field. */
|
|
4
|
-
var DEFAULT_AUTOCOMPLETE_SELECTOR = "[data-formie-address-autocomplete-input]";
|
|
5
|
-
var ADDRESS_LOCATION_SELECTOR = "[data-formie-address-location]";
|
|
6
|
-
/** Selector for address sub-field inputs used when populating from provider. */
|
|
7
|
-
var ADDRESS_SELECTORS = {
|
|
8
|
-
autoComplete: "[data-formie-address-autocomplete-input]",
|
|
9
|
-
address1: "[data-formie-address-line1-input]",
|
|
10
|
-
address2: "[data-formie-address-line2-input]",
|
|
11
|
-
address3: "[data-formie-address-line3-input]",
|
|
12
|
-
city: "[data-formie-address-city-input]",
|
|
13
|
-
state: "[data-formie-address-state-input]",
|
|
14
|
-
zip: "[data-formie-address-zip-input]",
|
|
15
|
-
country: "[data-formie-address-country-input]"
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/js/modules/address/host.ts
|
|
19
|
-
var ADDRESS_OPTION_KEYS = new Set(["handle"]);
|
|
20
|
-
function getAddressProviderHandle(id, options) {
|
|
21
|
-
return (typeof options.handle === "string" && options.handle.trim() !== "" ? options.handle.trim() : "") || id;
|
|
22
|
-
}
|
|
23
|
-
function normalizeAddressModuleOptions(id, rawOptions) {
|
|
24
|
-
const options = rawOptions || {};
|
|
25
|
-
const provider = Object.entries(options).reduce((carry, [key, value]) => {
|
|
26
|
-
if (ADDRESS_OPTION_KEYS.has(key)) return carry;
|
|
27
|
-
carry[key] = value;
|
|
28
|
-
return carry;
|
|
29
|
-
}, {});
|
|
30
|
-
return {
|
|
31
|
-
handle: getAddressProviderHandle(id, options),
|
|
32
|
-
provider
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function bindDomEvent(target, eventName, callback) {
|
|
36
|
-
target.addEventListener(eventName, callback);
|
|
37
|
-
return () => {
|
|
38
|
-
target.removeEventListener(eventName, callback);
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function createAddressHostServices(ctx) {
|
|
42
|
-
const field = ctx.target;
|
|
43
|
-
const form = ctx.form;
|
|
44
|
-
const root = ctx.root;
|
|
45
|
-
const autocompleteSelector = DEFAULT_AUTOCOMPLETE_SELECTOR;
|
|
46
|
-
return {
|
|
47
|
-
root,
|
|
48
|
-
field,
|
|
49
|
-
form,
|
|
50
|
-
input: {
|
|
51
|
-
getAutocomplete: () => {
|
|
52
|
-
return field.querySelector(autocompleteSelector);
|
|
53
|
-
},
|
|
54
|
-
setValue: (selectorKey, value, fallback) => {
|
|
55
|
-
const selector = ADDRESS_SELECTORS[selectorKey];
|
|
56
|
-
const el = field.querySelector(selector);
|
|
57
|
-
if (el) el.value = value || fallback || "";
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
location: {
|
|
61
|
-
getButton: () => {
|
|
62
|
-
return field.querySelector(ADDRESS_LOCATION_SELECTOR);
|
|
63
|
-
},
|
|
64
|
-
onUseLocation: (callback) => {
|
|
65
|
-
const btn = field.querySelector(ADDRESS_LOCATION_SELECTOR);
|
|
66
|
-
if (!btn) return () => {};
|
|
67
|
-
const handler = (e) => {
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
if (!navigator.geolocation) return;
|
|
70
|
-
navigator.geolocation.getCurrentPosition(callback, () => {}, { enableHighAccuracy: true });
|
|
71
|
-
};
|
|
72
|
-
btn.addEventListener("click", handler);
|
|
73
|
-
return () => {
|
|
74
|
-
btn.removeEventListener("click", handler);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
events: { onField: (eventName, callback) => bindDomEvent(field, eventName, callback) }
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/js/modules/address/factories.ts
|
|
83
|
-
var debug = createDebug("address");
|
|
84
|
-
function isTargetVisible(element) {
|
|
85
|
-
const node = element;
|
|
86
|
-
return !node.closest("[data-formie-page-hidden]") && !node.closest("[hidden]");
|
|
87
|
-
}
|
|
88
|
-
function createManagedAddressModule(adapter) {
|
|
89
|
-
return {
|
|
90
|
-
id: adapter.id,
|
|
91
|
-
kind: "address",
|
|
92
|
-
match: (ctx) => {
|
|
93
|
-
return !!ctx.target.querySelector("[data-formie-address-autocomplete-input]");
|
|
94
|
-
},
|
|
95
|
-
setup: async (ctx) => {
|
|
96
|
-
const options = normalizeAddressModuleOptions(adapter.id, ctx.options || {});
|
|
97
|
-
const services = createAddressHostServices(ctx);
|
|
98
|
-
debug.log("Setup module.", { moduleId: adapter.id });
|
|
99
|
-
const setupCtx = {
|
|
100
|
-
...ctx,
|
|
101
|
-
options,
|
|
102
|
-
services
|
|
103
|
-
};
|
|
104
|
-
const cleanups = [];
|
|
105
|
-
let apiPromise = null;
|
|
106
|
-
let widget = null;
|
|
107
|
-
if (!services.input.getAutocomplete()) {
|
|
108
|
-
console.warn(`[formie] Address module "${adapter.id}" skipped: no autocomplete input found in target. Ensure the Address field has the Auto-Complete subfield enabled.`);
|
|
109
|
-
debug.warn("Autocomplete input missing; skipping module.", { moduleId: adapter.id });
|
|
110
|
-
return { destroy: () => {} };
|
|
111
|
-
}
|
|
112
|
-
const getApi = async () => {
|
|
113
|
-
if (!apiPromise) {
|
|
114
|
-
debug.log("Loading provider API.", { moduleId: adapter.id });
|
|
115
|
-
apiPromise = adapter.load(setupCtx);
|
|
116
|
-
}
|
|
117
|
-
return apiPromise;
|
|
118
|
-
};
|
|
119
|
-
const ensureMounted = async () => {
|
|
120
|
-
if (widget || !isTargetVisible(ctx.target)) return;
|
|
121
|
-
const api = await getApi();
|
|
122
|
-
widget = await adapter.mount({
|
|
123
|
-
api,
|
|
124
|
-
field: ctx.target,
|
|
125
|
-
services,
|
|
126
|
-
options,
|
|
127
|
-
provider: options.provider
|
|
128
|
-
});
|
|
129
|
-
debug.log("Widget mounted.", { moduleId: adapter.id });
|
|
130
|
-
};
|
|
131
|
-
if (isTargetVisible(ctx.target)) await ensureMounted();
|
|
132
|
-
["formie:page:navigate:after", "formie:submit:result"].forEach((eventName) => {
|
|
133
|
-
const handleVisibility = () => {
|
|
134
|
-
ensureMounted();
|
|
135
|
-
};
|
|
136
|
-
ctx.root.addEventListener(eventName, handleVisibility);
|
|
137
|
-
cleanups.push(() => {
|
|
138
|
-
ctx.root.removeEventListener(eventName, handleVisibility);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
const locationCleanup = services.location.onUseLocation((position) => {
|
|
142
|
-
if (!adapter.onCurrentLocation) return;
|
|
143
|
-
(async () => {
|
|
144
|
-
await ensureMounted();
|
|
145
|
-
if (!widget) return;
|
|
146
|
-
const api = await getApi();
|
|
147
|
-
await adapter.onCurrentLocation?.(position, {
|
|
148
|
-
api,
|
|
149
|
-
widget,
|
|
150
|
-
field: ctx.target,
|
|
151
|
-
services,
|
|
152
|
-
options,
|
|
153
|
-
provider: options.provider
|
|
154
|
-
});
|
|
155
|
-
})();
|
|
156
|
-
});
|
|
157
|
-
if (locationCleanup) cleanups.push(locationCleanup);
|
|
158
|
-
return { destroy: async () => {
|
|
159
|
-
debug.log("Destroying module.", { moduleId: adapter.id });
|
|
160
|
-
cleanups.forEach((c) => c());
|
|
161
|
-
if (widget && adapter.unmount) {
|
|
162
|
-
const api = await getApi();
|
|
163
|
-
await adapter.unmount({
|
|
164
|
-
api,
|
|
165
|
-
widget,
|
|
166
|
-
field: ctx.target,
|
|
167
|
-
services,
|
|
168
|
-
options,
|
|
169
|
-
provider: options.provider
|
|
170
|
-
});
|
|
171
|
-
debug.log("Widget unmounted.", { moduleId: adapter.id });
|
|
172
|
-
}
|
|
173
|
-
} };
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
//#endregion
|
|
178
|
-
//#region src/js/modules/address/api.ts
|
|
179
|
-
var defineAddressModule = createManagedAddressModule;
|
|
180
|
-
//#endregion
|
|
181
|
-
export { ADDRESS_SELECTORS as n, defineAddressModule as t };
|