@zonos/elements 1.3.20 → 1.3.22
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/dist/cjs/{cart-921f0a47.js → cart-f963b239.js} +69 -30
- package/dist/cjs/{getBorderRadius-9ad763e1.js → getBorderRadius-332422ab.js} +1 -1
- package/dist/cjs/index.cjs.js +5 -4
- package/dist/cjs/{isDarkColor-3d021ecc.js → isDarkColor-3ddf6511.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{submitGtag-71790233.js → submitGtag-8d562ad4.js} +2 -2
- package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
- package/dist/cjs/zonos-badge_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +82 -43
- package/dist/cjs/zonos-card_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-cart-items_11.cjs.entry.js +19 -29
- package/dist/cjs/zonos-checkout.cjs.entry.js +11 -7
- package/dist/cjs/zonos-controller.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-select_3.cjs.entry.js +11 -9
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +12 -12
- package/dist/cjs/zonos-hello.cjs.entry.js +10 -6
- package/dist/cjs/zonos-input.cjs.entry.js +2 -2
- package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification.cjs.entry.js +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +4 -4
- package/dist/cjs/zonos-select-dialog-header_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
- package/dist/cjs/zonos-text.cjs.entry.js +1 -2
- package/dist/cjs/{zonosStore-1063de5e.js → zonosStore-768d6ca0.js} +2 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.css +7 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +4 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.css +7 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +5 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +6 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.css +7 -2
- package/dist/collection/components/common/zonos-button/zonos-button.js +74 -39
- package/dist/collection/components/common/zonos-text/zonos-text.js +0 -18
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +6 -3
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +8 -5
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +8 -8
- package/dist/collection/components/main/zonos-controller.js +2 -2
- package/dist/collection/components/store/hello/localization.js +2 -2
- package/dist/collection/components/store/zonosStore.js +3 -2
- package/dist/collection/components/utils/api/getExchangeRate.js +20 -5
- package/dist/collection/components/utils/hello/currencyConversion/currencyConvertAndFormat.js +1 -1
- package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js +1 -1
- package/dist/collection/components/utils/hello/currencyConversion/currencyFormat.js +32 -17
- package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +12 -2
- package/dist/collection/components/utils/isElementUsingDarkTheme.js +5 -0
- package/dist/collection/scripts/_zonosBase.js +2 -1
- package/dist/esm/{cart-d3c98a81.js → cart-efecbea6.js} +69 -30
- package/dist/esm/{getBorderRadius-393bf797.js → getBorderRadius-a2e46e26.js} +1 -1
- package/dist/esm/index.js +5 -4
- package/dist/esm/{isDarkColor-454ec221.js → isDarkColor-69ed8e39.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{submitGtag-acdb8bd7.js → submitGtag-a7b8a86e.js} +2 -2
- package/dist/esm/zonos-address_8.entry.js +4 -4
- package/dist/esm/zonos-badge_2.entry.js +1 -1
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +82 -43
- package/dist/esm/zonos-card_2.entry.js +4 -4
- package/dist/esm/zonos-cart-items_11.entry.js +19 -29
- package/dist/esm/zonos-checkout.entry.js +11 -7
- package/dist/esm/zonos-controller.entry.js +4 -4
- package/dist/esm/zonos-country-flag.entry.js +4 -4
- package/dist/esm/zonos-country-select_3.entry.js +11 -9
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +12 -12
- package/dist/esm/zonos-hello.entry.js +10 -6
- package/dist/esm/zonos-input.entry.js +2 -2
- package/dist/esm/zonos-logo.entry.js +1 -1
- package/dist/esm/zonos-notification.entry.js +1 -1
- package/dist/esm/zonos-payment.entry.js +4 -4
- package/dist/esm/zonos-select-dialog-header_2.entry.js +1 -1
- package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
- package/dist/esm/zonos-text.entry.js +1 -2
- package/dist/esm/{zonosStore-0ce57f37.js → zonosStore-93da32b4.js} +2 -1
- package/dist/esm-es5/{cart-d3c98a81.js → cart-efecbea6.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-393bf797.js → getBorderRadius-a2e46e26.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-454ec221.js → isDarkColor-69ed8e39.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{submitGtag-acdb8bd7.js → submitGtag-a7b8a86e.js} +1 -1
- package/dist/esm-es5/zonos-address_8.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card_2.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_11.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-notification.entry.js +1 -1
- package/dist/esm-es5/zonos-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-select-dialog-header_2.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-0ce57f37.js → zonosStore-93da32b4.js} +1 -1
- package/dist/scripts/index.d.ts +29 -13
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/common/zonos-button/zonos-button.d.ts +1 -0
- package/dist/types/components/common/zonos-text/zonos-text.d.ts +0 -4
- package/dist/types/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.d.ts +1 -0
- package/dist/types/components/store/hello/localization.d.ts +2 -2
- package/dist/types/components/store/zonosStore.d.ts +6 -2
- package/dist/types/components/utils/api/getExchangeRate.d.ts +9 -10
- package/dist/types/components/utils/api/triggerBuildLandedCost.d.ts +3 -3
- package/dist/types/components/utils/hello/currencyConversion/currencyFormat.d.ts +5 -1
- package/dist/types/components/utils/isElementUsingDarkTheme.d.ts +1 -0
- package/dist/types/components.d.ts +0 -8
- package/dist/types/scripts/_zonosBase.d.ts +21 -1
- package/dist/types/types/checkout/CheckoutConfig.d.ts +7 -3
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-102c670d.entry.js +1 -0
- package/dist/zonos-elements/{p-3668f365.entry.js → p-13940c52.entry.js} +1 -1
- package/dist/zonos-elements/{p-0e6fe6c8.system.entry.js → p-140bb400.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-15c903ff.js → p-18432252.js} +1 -1
- package/dist/zonos-elements/{p-f03b33ec.system.entry.js → p-1e07c616.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-42a7a726.system.entry.js → p-20ab8daf.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-fc2f3e2a.system.entry.js → p-2641f474.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c15b36c1.system.entry.js → p-283aa6f9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3c97c44d.entry.js → p-298b5d95.entry.js} +1 -1
- package/dist/zonos-elements/p-2d3940dc.entry.js +1 -0
- package/dist/zonos-elements/{p-d1b8dcd8.system.entry.js → p-33f83b9a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b13e630b.js → p-348adf28.js} +1 -1
- package/dist/zonos-elements/p-36f8a3df.system.js +1 -0
- package/dist/zonos-elements/{p-b9ed8a66.system.entry.js → p-3bee1a04.system.entry.js} +1 -1
- package/dist/zonos-elements/p-49061c5d.entry.js +1 -0
- package/dist/zonos-elements/{p-b202a015.entry.js → p-57d70603.entry.js} +1 -1
- package/dist/zonos-elements/{p-d18990b0.entry.js → p-5b7438ef.entry.js} +1 -1
- package/dist/zonos-elements/p-5ca32f4f.entry.js +1 -0
- package/dist/zonos-elements/p-5edc4f18.system.entry.js +1 -0
- package/dist/zonos-elements/p-678daa20.system.entry.js +1 -0
- package/dist/zonos-elements/{p-14bea5e6.system.entry.js → p-68e3ef26.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9da3b3b3.system.entry.js → p-6e717c40.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2d3e3735.js → p-795a3ed5.js} +1 -1
- package/dist/zonos-elements/{p-67373528.entry.js → p-7d2fc0fd.entry.js} +1 -1
- package/dist/zonos-elements/{p-1406d696.system.entry.js → p-85a49fb8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3115e7a7.system.js → p-884b41a8.system.js} +1 -1
- package/dist/zonos-elements/p-8a65433a.entry.js +1 -0
- package/dist/zonos-elements/{p-d03e101b.system.entry.js → p-8df58197.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d5feef4c.js → p-95ffff25.js} +1 -1
- package/dist/zonos-elements/{p-ebb36e4d.entry.js → p-968df90a.entry.js} +1 -1
- package/dist/zonos-elements/{p-23393abc.system.entry.js → p-9a299a98.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ce4c48f6.entry.js → p-a20f6ba3.entry.js} +1 -1
- package/dist/zonos-elements/{p-f0afca6c.system.js → p-a52afd83.system.js} +1 -1
- package/dist/zonos-elements/{p-0a4f341b.entry.js → p-bbe5d0f0.entry.js} +1 -1
- package/dist/zonos-elements/{p-dd02f2eb.entry.js → p-c0f0edbe.entry.js} +1 -1
- package/dist/zonos-elements/{p-971e73c3.system.entry.js → p-c2328652.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-474cb030.entry.js → p-c53f7199.entry.js} +1 -1
- package/dist/zonos-elements/{p-8f3f1a1b.system.js → p-c7360a6c.system.js} +1 -1
- package/dist/zonos-elements/{p-72191005.system.entry.js → p-c77c056d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-bfe6f84f.system.entry.js → p-d0a2b1ba.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f16b80a3.system.js → p-d0c53fba.system.js} +1 -1
- package/dist/zonos-elements/p-d6f829c2.entry.js +1 -0
- package/dist/zonos-elements/{p-2c57097c.entry.js → p-d8255adf.entry.js} +1 -1
- package/dist/zonos-elements/{p-824e1e83.system.js → p-dafc6260.system.js} +1 -1
- package/dist/zonos-elements/{p-eb6ddb2f.js → p-df267420.js} +1 -1
- package/dist/zonos-elements/p-e0bf9666.system.js +1 -1
- package/dist/zonos-elements/{p-f4c921f8.entry.js → p-e5f7ff0f.entry.js} +1 -1
- package/dist/zonos-elements/{p-75d52d98.system.entry.js → p-e625f68d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b925e897.system.entry.js → p-ecaed308.system.entry.js} +1 -1
- package/dist/zonos-elements/p-edfb5021.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +4 -1
- package/dist/collection/components/utils/formatCurrency.js +0 -9
- package/dist/types/components/utils/formatCurrency.d.ts +0 -5
- package/dist/zonos-elements/p-14da9ed0.entry.js +0 -1
- package/dist/zonos-elements/p-2d08c612.system.js +0 -1
- package/dist/zonos-elements/p-3edcbb56.entry.js +0 -1
- package/dist/zonos-elements/p-5968c6ad.entry.js +0 -1
- package/dist/zonos-elements/p-59913049.entry.js +0 -1
- package/dist/zonos-elements/p-957301d0.system.entry.js +0 -1
- package/dist/zonos-elements/p-9e4b35d4.system.entry.js +0 -1
- package/dist/zonos-elements/p-d79e83bd.entry.js +0 -1
- package/dist/zonos-elements/p-eb765228.entry.js +0 -1
- package/dist/zonos-elements/p-f3a6de62.entry.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createStore } from "@stencil/store";
|
|
2
2
|
import { mergeConfig } from "../utils/mergeConfig";
|
|
3
|
-
const { reset, state: zonosStore } = createStore(() => ({
|
|
3
|
+
const { dispose: zonosStoreDispose, reset, state: zonosStore, } = createStore(() => ({
|
|
4
4
|
appearance: {
|
|
5
5
|
colorPrimary: 'white',
|
|
6
6
|
fontFamily: 'Inter',
|
|
@@ -119,9 +119,10 @@ const zonosStoreInitSetting = ({ overrideSettings, zonosSettings, }) => {
|
|
|
119
119
|
zonosStore.storeId = ((_d = (_c = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _c === void 0 ? void 0 : _c.references) === null || _d === void 0 ? void 0 : _d.storeId) || null;
|
|
120
120
|
zonosStore.currencyConverter = overrideSettings === null || overrideSettings === void 0 ? void 0 : overrideSettings.currencyConverter;
|
|
121
121
|
zonosStore.onCountryChange = overrideSettings === null || overrideSettings === void 0 ? void 0 : overrideSettings.onCountryChange;
|
|
122
|
+
zonosStore.overrideCurrencyFormat = overrideSettings === null || overrideSettings === void 0 ? void 0 : overrideSettings.overrideCurrencyFormat;
|
|
122
123
|
};
|
|
123
124
|
const zonosStoreFontFamily = () => {
|
|
124
125
|
const fontFamily = zonosStore.appearance.fontFamily || 'Inter';
|
|
125
126
|
return fontFamily;
|
|
126
127
|
};
|
|
127
|
-
export { getZonosStoreTheme, zonosStore, zonosStoreFontFamily, zonosStoreInitSetting, };
|
|
128
|
+
export { getZonosStoreTheme, zonosStore, zonosStoreDispose, zonosStoreFontFamily, zonosStoreInitSetting, };
|
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
import { handleFetch } from "../handleFetch";
|
|
2
2
|
import { logError } from "../logging/logError";
|
|
3
|
+
const defaultUsExchangeRate = {
|
|
4
|
+
exchangeRate: {
|
|
5
|
+
rate: 1,
|
|
6
|
+
targetFormat: {
|
|
7
|
+
currencyCode: 'USD',
|
|
8
|
+
decimalDelimiter: '.',
|
|
9
|
+
scale: 2,
|
|
10
|
+
symbol: '$',
|
|
11
|
+
symbolLocation: 'before',
|
|
12
|
+
thousandsDelimiter: ',',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
maxAge: null,
|
|
16
|
+
};
|
|
3
17
|
export const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCurrency, }) => {
|
|
4
18
|
var _a;
|
|
5
|
-
// If source currency matches target currency (US -> US) and is not a guaranteed rate, return
|
|
19
|
+
// If source currency matches target currency (US -> US) and is not a guaranteed rate, return default exchange rate so we still format properly.
|
|
6
20
|
if (sourceCurrency === targetCurrency && !isGuaranteed) {
|
|
7
|
-
return
|
|
21
|
+
return defaultUsExchangeRate;
|
|
8
22
|
}
|
|
9
23
|
const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}`;
|
|
10
24
|
const { errors, json } = await handleFetch(url);
|
|
11
25
|
if (errors.length || !json) {
|
|
12
26
|
logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
13
|
-
return
|
|
27
|
+
return defaultUsExchangeRate;
|
|
14
28
|
}
|
|
15
|
-
const {
|
|
29
|
+
const { rate, targetFormat } = json.exchangeRateCreate;
|
|
30
|
+
const maxAge = json.maxAge;
|
|
16
31
|
if (rate) {
|
|
17
32
|
sessionStorage.setItem(country + '_rate', JSON.stringify(rate));
|
|
18
33
|
const exchangeRate = { rate, targetFormat };
|
|
19
34
|
return { exchangeRate, maxAge };
|
|
20
35
|
}
|
|
21
|
-
return
|
|
36
|
+
return defaultUsExchangeRate;
|
|
22
37
|
};
|
package/dist/collection/components/utils/hello/currencyConversion/currencyConvertAndFormat.js
CHANGED
|
@@ -2,6 +2,6 @@ import { currencyConvert } from "./currencyConvert";
|
|
|
2
2
|
import { currencyFormat } from "./currencyFormat";
|
|
3
3
|
export const currencyConvertAndFormat = (value) => {
|
|
4
4
|
const convertedValue = currencyConvert(value);
|
|
5
|
-
const formattedValue = currencyFormat(convertedValue);
|
|
5
|
+
const formattedValue = currencyFormat({ amount: convertedValue });
|
|
6
6
|
return formattedValue;
|
|
7
7
|
};
|
|
@@ -12,7 +12,7 @@ export const currencyDisplay = () => {
|
|
|
12
12
|
zonosStore.currencyConverter({
|
|
13
13
|
convert: currencyConvert,
|
|
14
14
|
convertAndFormat: currencyConvertAndFormat,
|
|
15
|
-
format: currencyFormat,
|
|
15
|
+
format: (value) => currencyFormat({ amount: value }),
|
|
16
16
|
selector: currencyElementSelector,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
import { localizationStore } from "../../../store/hello/localization";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { zonosStore } from "../../../store/zonosStore";
|
|
3
|
+
export const currencyFormat = ({ amount, currency, }) => {
|
|
4
|
+
if (isNaN(amount) || (amount !== 0 && !amount)) {
|
|
4
5
|
return '';
|
|
5
6
|
}
|
|
7
|
+
const overrideCurrencyFormat = zonosStore.overrideCurrencyFormat;
|
|
6
8
|
const { exchangeRate } = localizationStore;
|
|
9
|
+
const targetCurrency = currency || localizationStore.targetCurrency;
|
|
10
|
+
// Use user-defined currency format
|
|
11
|
+
if (typeof overrideCurrencyFormat === 'function') {
|
|
12
|
+
return overrideCurrencyFormat({
|
|
13
|
+
amount: amount,
|
|
14
|
+
countryCode: targetCurrency,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
7
17
|
const { targetFormat } = exchangeRate || {};
|
|
8
|
-
if (!targetFormat) {
|
|
9
|
-
|
|
18
|
+
if (!targetFormat || !exchangeRate) {
|
|
19
|
+
// Return the amount as a string if no exchange rate is available
|
|
20
|
+
return `${amount.toString()} ${targetCurrency}`;
|
|
10
21
|
}
|
|
11
|
-
const minimumFractionDigits =
|
|
12
|
-
// browsers can autoformat the currency based on the users language setting
|
|
13
|
-
// unless the browser is Internet Explorer, because Internet Explorer is stupid
|
|
22
|
+
const minimumFractionDigits = targetFormat.scale || 2;
|
|
14
23
|
const isIE = window.navigator.userAgent.indexOf('MSIE ') !== -1;
|
|
15
24
|
const numberFormatExists = typeof Intl === 'object' && Intl && typeof Intl.NumberFormat === 'function';
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
minimumFractionDigits: minimumFractionDigits,
|
|
20
|
-
style: 'currency',
|
|
21
|
-
}).format(value);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
let formattedNumber = Number(value)
|
|
25
|
+
if (isIE || !numberFormatExists) {
|
|
26
|
+
// use native number formatting if it's IE.
|
|
27
|
+
const formattedNumber = Number(amount)
|
|
25
28
|
.toFixed(minimumFractionDigits)
|
|
26
29
|
.replace('.', '|dec|')
|
|
27
30
|
.replace(',', targetFormat.thousandsDelimiter || '')
|
|
28
31
|
.replace('|dec|', targetFormat.decimalDelimiter || '');
|
|
29
|
-
const result = `${
|
|
32
|
+
const result = `${formattedNumber}${targetFormat.currencyCode !== 'USD' ? ` ${targetFormat.currencyCode}` : ''}`;
|
|
30
33
|
return result;
|
|
31
34
|
}
|
|
35
|
+
const currencyDisplay = (overrideCurrencyFormat === null || overrideCurrencyFormat === void 0 ? void 0 : overrideCurrencyFormat.currencyDisplay) || 'symbol';
|
|
36
|
+
const formatedNumber = new Intl.NumberFormat(window.navigator.language, {
|
|
37
|
+
currency: targetCurrency,
|
|
38
|
+
currencyDisplay,
|
|
39
|
+
minimumFractionDigits: minimumFractionDigits,
|
|
40
|
+
style: 'currency',
|
|
41
|
+
}).format(amount);
|
|
42
|
+
// Move currency code to the end of the string if currencyDisplay is 'code'
|
|
43
|
+
const result = currencyDisplay === 'code'
|
|
44
|
+
? `${formatedNumber.replace(new RegExp(`${targetCurrency}\\s+`), '')} ${targetCurrency}`
|
|
45
|
+
: formatedNumber;
|
|
46
|
+
return result;
|
|
32
47
|
};
|
package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js
CHANGED
|
@@ -11,16 +11,26 @@ const convertCurrency = (element) => {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
const currentIntlValue = element.getAttribute('data-zintl');
|
|
14
|
+
// get rate
|
|
15
|
+
const currentIntlRateValue = parseFloat(element.getAttribute('data-zrate') || '1');
|
|
14
16
|
const currentCountryValue = element.getAttribute('data-zcountry-code');
|
|
15
17
|
// do nothing if the target currency is the same
|
|
16
|
-
const isExchangeRateReady = localizationStore.
|
|
17
|
-
|
|
18
|
+
const isExchangeRateReady = localizationStore.exchangeRate &&
|
|
19
|
+
localizationStore.targetCurrency ===
|
|
20
|
+
localizationStore.exchangeRate.targetFormat.currencyCode;
|
|
21
|
+
const rate = ((_a = localizationStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.rate) || 1;
|
|
18
22
|
// if the current value on the element is different from the current intl value, update the data-zintl attribute
|
|
19
23
|
if (isExchangeRateReady &&
|
|
24
|
+
// Update currency if the value is not yet formatted
|
|
20
25
|
(element.textContent !== currentIntlValue ||
|
|
26
|
+
// Update rate when new rate is available
|
|
27
|
+
rate !== currentIntlRateValue ||
|
|
28
|
+
// Update currency when the country code changes
|
|
21
29
|
currentCountryValue !== localizationStore.selectedCountryCode)) {
|
|
22
30
|
const observedFormattedValue = currencyConvertAndFormat(amount);
|
|
23
31
|
element.textContent = observedFormattedValue;
|
|
32
|
+
// save the new rate to the data-zrate attribute
|
|
33
|
+
element.setAttribute('data-zrate', rate.toString());
|
|
24
34
|
// save the new value to the data-zintl attribute
|
|
25
35
|
element.setAttribute('data-zintl', observedFormattedValue);
|
|
26
36
|
element.setAttribute('data-zcountry-code', localizationStore.selectedCountryCode || '');
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { isDarkColor } from "./isDarkColor";
|
|
2
|
+
// This is to determine if variable of the element is using dark theme, so we can invert the color if needed
|
|
3
|
+
export const isElementUsingDarkTheme = (element) => isDarkColor(window
|
|
4
|
+
.getComputedStyle(element)
|
|
5
|
+
.getPropertyValue('--zonos-elements-gray-0'));
|
|
@@ -46,7 +46,7 @@ Zonos.modeAlerted = false;
|
|
|
46
46
|
Zonos.tempCartData = null;
|
|
47
47
|
Zonos.getCurrentTimestamp = () => new Date().getTime();
|
|
48
48
|
Zonos.zonosController = null;
|
|
49
|
-
Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, storeId, zonosApiKey, }) => {
|
|
49
|
+
Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, }) => {
|
|
50
50
|
if (_a.doneInit) {
|
|
51
51
|
// do nothing if zonos is already initializeds
|
|
52
52
|
return;
|
|
@@ -75,6 +75,7 @@ Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSett
|
|
|
75
75
|
currencyConverter,
|
|
76
76
|
helloSettings,
|
|
77
77
|
onCountryChange,
|
|
78
|
+
overrideCurrencyFormat,
|
|
78
79
|
},
|
|
79
80
|
zonosApiKey,
|
|
80
81
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as createStore, z as zonosStore } from './zonosStore-
|
|
1
|
+
import { c as createStore, z as zonosStore } from './zonosStore-93da32b4.js';
|
|
2
2
|
import { a as logError, l as log } from './logError-c456c092.js';
|
|
3
|
-
import { i as isDarkColor } from './isDarkColor-
|
|
4
|
-
import { g as getBorderRadius } from './getBorderRadius-
|
|
3
|
+
import { i as isDarkColor } from './isDarkColor-69ed8e39.js';
|
|
4
|
+
import { g as getBorderRadius } from './getBorderRadius-a2e46e26.js';
|
|
5
5
|
|
|
6
6
|
const stringsArabic = {
|
|
7
7
|
'${percentage} GST due on any order above ${threshold} along with an import entry transaction fee and MPI levy.': {
|
|
@@ -5758,25 +5758,40 @@ const getCountryLandedCost = async (countryCode) => {
|
|
|
5758
5758
|
return json || null;
|
|
5759
5759
|
};
|
|
5760
5760
|
|
|
5761
|
+
const defaultUsExchangeRate = {
|
|
5762
|
+
exchangeRate: {
|
|
5763
|
+
rate: 1,
|
|
5764
|
+
targetFormat: {
|
|
5765
|
+
currencyCode: 'USD',
|
|
5766
|
+
decimalDelimiter: '.',
|
|
5767
|
+
scale: 2,
|
|
5768
|
+
symbol: '$',
|
|
5769
|
+
symbolLocation: 'before',
|
|
5770
|
+
thousandsDelimiter: ',',
|
|
5771
|
+
},
|
|
5772
|
+
},
|
|
5773
|
+
maxAge: null,
|
|
5774
|
+
};
|
|
5761
5775
|
const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCurrency, }) => {
|
|
5762
5776
|
var _a;
|
|
5763
|
-
// If source currency matches target currency (US -> US) and is not a guaranteed rate, return
|
|
5777
|
+
// If source currency matches target currency (US -> US) and is not a guaranteed rate, return default exchange rate so we still format properly.
|
|
5764
5778
|
if (sourceCurrency === targetCurrency && !isGuaranteed) {
|
|
5765
|
-
return
|
|
5779
|
+
return defaultUsExchangeRate;
|
|
5766
5780
|
}
|
|
5767
5781
|
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}`;
|
|
5768
5782
|
const { errors, json } = await handleFetch(url);
|
|
5769
5783
|
if (errors.length || !json) {
|
|
5770
5784
|
logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
5771
|
-
return
|
|
5785
|
+
return defaultUsExchangeRate;
|
|
5772
5786
|
}
|
|
5773
|
-
const {
|
|
5787
|
+
const { rate, targetFormat } = json.exchangeRateCreate;
|
|
5788
|
+
const maxAge = json.maxAge;
|
|
5774
5789
|
if (rate) {
|
|
5775
5790
|
sessionStorage.setItem(country + '_rate', JSON.stringify(rate));
|
|
5776
5791
|
const exchangeRate = { rate, targetFormat };
|
|
5777
5792
|
return { exchangeRate, maxAge };
|
|
5778
5793
|
}
|
|
5779
|
-
return
|
|
5794
|
+
return defaultUsExchangeRate;
|
|
5780
5795
|
};
|
|
5781
5796
|
|
|
5782
5797
|
const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
|
|
@@ -5847,41 +5862,55 @@ const currencyConvert = (value) => {
|
|
|
5847
5862
|
return Number(fixedValue);
|
|
5848
5863
|
};
|
|
5849
5864
|
|
|
5850
|
-
const currencyFormat = (
|
|
5851
|
-
if (
|
|
5865
|
+
const currencyFormat = ({ amount, currency, }) => {
|
|
5866
|
+
if (isNaN(amount) || (amount !== 0 && !amount)) {
|
|
5852
5867
|
return '';
|
|
5853
5868
|
}
|
|
5869
|
+
const overrideCurrencyFormat = zonosStore.overrideCurrencyFormat;
|
|
5854
5870
|
const { exchangeRate } = localizationStore;
|
|
5871
|
+
const targetCurrency = currency || localizationStore.targetCurrency;
|
|
5872
|
+
// Use user-defined currency format
|
|
5873
|
+
if (typeof overrideCurrencyFormat === 'function') {
|
|
5874
|
+
return overrideCurrencyFormat({
|
|
5875
|
+
amount: amount,
|
|
5876
|
+
countryCode: targetCurrency,
|
|
5877
|
+
});
|
|
5878
|
+
}
|
|
5855
5879
|
const { targetFormat } = exchangeRate || {};
|
|
5856
|
-
if (!targetFormat) {
|
|
5857
|
-
|
|
5880
|
+
if (!targetFormat || !exchangeRate) {
|
|
5881
|
+
// Return the amount as a string if no exchange rate is available
|
|
5882
|
+
return `${amount.toString()} ${targetCurrency}`;
|
|
5858
5883
|
}
|
|
5859
|
-
const minimumFractionDigits =
|
|
5860
|
-
// browsers can autoformat the currency based on the users language setting
|
|
5861
|
-
// unless the browser is Internet Explorer, because Internet Explorer is stupid
|
|
5884
|
+
const minimumFractionDigits = targetFormat.scale || 2;
|
|
5862
5885
|
const isIE = window.navigator.userAgent.indexOf('MSIE ') !== -1;
|
|
5863
5886
|
const numberFormatExists = typeof Intl === 'object' && Intl && typeof Intl.NumberFormat === 'function';
|
|
5864
|
-
if (
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
minimumFractionDigits: minimumFractionDigits,
|
|
5868
|
-
style: 'currency',
|
|
5869
|
-
}).format(value);
|
|
5870
|
-
}
|
|
5871
|
-
else {
|
|
5872
|
-
let formattedNumber = Number(value)
|
|
5887
|
+
if (isIE || !numberFormatExists) {
|
|
5888
|
+
// use native number formatting if it's IE.
|
|
5889
|
+
const formattedNumber = Number(amount)
|
|
5873
5890
|
.toFixed(minimumFractionDigits)
|
|
5874
5891
|
.replace('.', '|dec|')
|
|
5875
5892
|
.replace(',', targetFormat.thousandsDelimiter || '')
|
|
5876
5893
|
.replace('|dec|', targetFormat.decimalDelimiter || '');
|
|
5877
|
-
const result = `${
|
|
5894
|
+
const result = `${formattedNumber}${targetFormat.currencyCode !== 'USD' ? ` ${targetFormat.currencyCode}` : ''}`;
|
|
5878
5895
|
return result;
|
|
5879
5896
|
}
|
|
5897
|
+
const currencyDisplay = (overrideCurrencyFormat === null || overrideCurrencyFormat === void 0 ? void 0 : overrideCurrencyFormat.currencyDisplay) || 'symbol';
|
|
5898
|
+
const formatedNumber = new Intl.NumberFormat(window.navigator.language, {
|
|
5899
|
+
currency: targetCurrency,
|
|
5900
|
+
currencyDisplay,
|
|
5901
|
+
minimumFractionDigits: minimumFractionDigits,
|
|
5902
|
+
style: 'currency',
|
|
5903
|
+
}).format(amount);
|
|
5904
|
+
// Move currency code to the end of the string if currencyDisplay is 'code'
|
|
5905
|
+
const result = currencyDisplay === 'code'
|
|
5906
|
+
? `${formatedNumber.replace(new RegExp(`${targetCurrency}\\s+`), '')} ${targetCurrency}`
|
|
5907
|
+
: formatedNumber;
|
|
5908
|
+
return result;
|
|
5880
5909
|
};
|
|
5881
5910
|
|
|
5882
5911
|
const currencyConvertAndFormat = (value) => {
|
|
5883
5912
|
const convertedValue = currencyConvert(value);
|
|
5884
|
-
const formattedValue = currencyFormat(convertedValue);
|
|
5913
|
+
const formattedValue = currencyFormat({ amount: convertedValue });
|
|
5885
5914
|
return formattedValue;
|
|
5886
5915
|
};
|
|
5887
5916
|
|
|
@@ -5942,16 +5971,26 @@ const convertCurrency = (element) => {
|
|
|
5942
5971
|
return;
|
|
5943
5972
|
}
|
|
5944
5973
|
const currentIntlValue = element.getAttribute('data-zintl');
|
|
5974
|
+
// get rate
|
|
5975
|
+
const currentIntlRateValue = parseFloat(element.getAttribute('data-zrate') || '1');
|
|
5945
5976
|
const currentCountryValue = element.getAttribute('data-zcountry-code');
|
|
5946
5977
|
// do nothing if the target currency is the same
|
|
5947
|
-
const isExchangeRateReady = localizationStore.
|
|
5948
|
-
|
|
5978
|
+
const isExchangeRateReady = localizationStore.exchangeRate &&
|
|
5979
|
+
localizationStore.targetCurrency ===
|
|
5980
|
+
localizationStore.exchangeRate.targetFormat.currencyCode;
|
|
5981
|
+
const rate = ((_a = localizationStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.rate) || 1;
|
|
5949
5982
|
// if the current value on the element is different from the current intl value, update the data-zintl attribute
|
|
5950
5983
|
if (isExchangeRateReady &&
|
|
5984
|
+
// Update currency if the value is not yet formatted
|
|
5951
5985
|
(element.textContent !== currentIntlValue ||
|
|
5986
|
+
// Update rate when new rate is available
|
|
5987
|
+
rate !== currentIntlRateValue ||
|
|
5988
|
+
// Update currency when the country code changes
|
|
5952
5989
|
currentCountryValue !== localizationStore.selectedCountryCode)) {
|
|
5953
5990
|
const observedFormattedValue = currencyConvertAndFormat(amount);
|
|
5954
5991
|
element.textContent = observedFormattedValue;
|
|
5992
|
+
// save the new rate to the data-zrate attribute
|
|
5993
|
+
element.setAttribute('data-zrate', rate.toString());
|
|
5955
5994
|
// save the new value to the data-zintl attribute
|
|
5956
5995
|
element.setAttribute('data-zintl', observedFormattedValue);
|
|
5957
5996
|
element.setAttribute('data-zcountry-code', localizationStore.selectedCountryCode || '');
|
|
@@ -5983,7 +6022,7 @@ const currencyDisplay = () => {
|
|
|
5983
6022
|
zonosStore.currencyConverter({
|
|
5984
6023
|
convert: currencyConvert,
|
|
5985
6024
|
convertAndFormat: currencyConvertAndFormat,
|
|
5986
|
-
format: currencyFormat,
|
|
6025
|
+
format: (value) => currencyFormat({ amount: value }),
|
|
5987
6026
|
selector: currencyElementSelector,
|
|
5988
6027
|
});
|
|
5989
6028
|
}
|
|
@@ -6021,7 +6060,7 @@ const setZCountryUrlParam = (selectedCountryCode) => {
|
|
|
6021
6060
|
}
|
|
6022
6061
|
};
|
|
6023
6062
|
|
|
6024
|
-
const { onChange: localizationStoreOnUpdate, state: localizationStore } = createStore({
|
|
6063
|
+
const { dispose: localizationDispose, onChange: localizationStoreOnUpdate, state: localizationStore, } = createStore({
|
|
6025
6064
|
countryLandedCost: null,
|
|
6026
6065
|
customMessages: [],
|
|
6027
6066
|
exchangeRate: null,
|
package/dist/esm/index.js
CHANGED
|
@@ -232,8 +232,8 @@ const zonosLoadUrl = (() => {
|
|
|
232
232
|
}
|
|
233
233
|
return null;
|
|
234
234
|
})();
|
|
235
|
-
const ZONOS_URL = zonosLoadUrl || "https://v1.3.
|
|
236
|
-
const JS_DELIVR_ZONOS_URL = "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
235
|
+
const ZONOS_URL = zonosLoadUrl || "https://v1.3.22.js.zonos.com";
|
|
236
|
+
const JS_DELIVR_ZONOS_URL = "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.22";
|
|
237
237
|
const INTER_FONT_URL = 'https://rsms.me';
|
|
238
238
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
239
239
|
const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
|
|
@@ -253,12 +253,12 @@ Zonos.isBigCommerce = false;
|
|
|
253
253
|
Zonos.isNpm = true;
|
|
254
254
|
Zonos.internationalHideSelector = '';
|
|
255
255
|
Zonos.zonosQaUrl = null;
|
|
256
|
-
Zonos.version = `v${"1.3.
|
|
256
|
+
Zonos.version = `v${"1.3.22"}`;
|
|
257
257
|
Zonos.modeAlerted = false;
|
|
258
258
|
Zonos.tempCartData = null;
|
|
259
259
|
Zonos.getCurrentTimestamp = () => new Date().getTime();
|
|
260
260
|
Zonos.zonosController = null;
|
|
261
|
-
Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, storeId, zonosApiKey, }) => {
|
|
261
|
+
Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, }) => {
|
|
262
262
|
if (_a.doneInit) {
|
|
263
263
|
// do nothing if zonos is already initializeds
|
|
264
264
|
return;
|
|
@@ -287,6 +287,7 @@ Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSett
|
|
|
287
287
|
currencyConverter,
|
|
288
288
|
helloSettings,
|
|
289
289
|
onCountryChange,
|
|
290
|
+
overrideCurrencyFormat,
|
|
290
291
|
},
|
|
291
292
|
zonosApiKey,
|
|
292
293
|
});
|
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["zonos-checkout",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"paymentError":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"domesticRedirectedBtnSelector":[32],"legacyCheckoutHiddenBtnSelector":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"mobile":["handleMobileChange"]}]]],["zonos-hello",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-component",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"
|
|
8
|
+
return bootstrapLazy([["zonos-checkout",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"paymentError":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"domesticRedirectedBtnSelector":[32],"legacyCheckoutHiddenBtnSelector":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"mobile":["handleMobileChange"]}]]],["zonos-hello",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-component",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-hello-dialog",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-notification",[[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-payment",[[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}]]],["zonos-shipping-rich-radio",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"initialSelectedValue":[8,"initial-selected-value"],"selectedItem":[32]}]]],["zonos-badge_2",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4]}],[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-input",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["zonos-banner",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-button_3",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["zonos-select-dialog-header_2",[[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}],[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-card_2",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-card",{"actions":[16],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-country-flag",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-country-select_3",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}]]],["zonos-address_8",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32],"isDirtyAddress":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"stripe":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"],[4,"keydown","handleKeyDown"]]],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-cart-items_11",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[2,"zonos-checkout-payment",{"paymentError":[4,"payment-error"],"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"showErrorBanner":[32]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevels":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-cart-subtotal"],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"order":[32]}],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as handleFetch, d as cartStore, l as localizationStore } from './cart-
|
|
2
|
-
import { z as zonosStore } from './zonosStore-
|
|
1
|
+
import { r as handleFetch, d as cartStore, l as localizationStore } from './cart-efecbea6.js';
|
|
2
|
+
import { z as zonosStore } from './zonosStore-93da32b4.js';
|
|
3
3
|
import { l as log } from './logError-c456c092.js';
|
|
4
4
|
|
|
5
5
|
const trackConversionEvent = async (eventName, metadata) => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, d as getElement } from './index-3b46f3c3.js';
|
|
2
|
-
import { h as stripeStore, l as localizationStore, t as translate } from './cart-
|
|
2
|
+
import { h as stripeStore, l as localizationStore, t as translate } from './cart-efecbea6.js';
|
|
3
3
|
import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
|
|
4
4
|
import { a as logError } from './logError-c456c092.js';
|
|
5
5
|
import { i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './containsNonLatinChars-2d8810c3.js';
|
|
6
|
-
import { z as zonosStore, d as zonosStoreFontFamily } from './zonosStore-
|
|
6
|
+
import { z as zonosStore, d as zonosStoreFontFamily } from './zonosStore-93da32b4.js';
|
|
7
7
|
import { c as classes } from './classes-0d95c529.js';
|
|
8
8
|
import { R as RemoveIcon$1 } from './RemoveIcon-9dc5dd1a.js';
|
|
9
|
-
import { g as getBorderRadius } from './getBorderRadius-
|
|
10
|
-
import { i as isDarkColor } from './isDarkColor-
|
|
9
|
+
import { g as getBorderRadius } from './getBorderRadius-a2e46e26.js';
|
|
10
|
+
import { i as isDarkColor } from './isDarkColor-69ed8e39.js';
|
|
11
11
|
|
|
12
12
|
const zonosAddressCss = ".sc-zonos-address-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";
|
|
13
13
|
const ZonosAddressStyle0 = zonosAddressCss;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host } from './index-3b46f3c3.js';
|
|
2
|
-
import { d as zonosStoreFontFamily } from './zonosStore-
|
|
2
|
+
import { d as zonosStoreFontFamily } from './zonosStore-93da32b4.js';
|
|
3
3
|
import { c as classes } from './classes-0d95c529.js';
|
|
4
4
|
|
|
5
5
|
const zonosBadgeCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .zonos--badge-content{display:-ms-flexbox;display:flex;gap:8px;font-size:var(--zonos-elements-font-size-s);padding:4px 8px;text-align:center;border-radius:var(--zonos-elements-radius-6);background-color:var(--zonos-elements-gray-100);color:var(--zonos-elements-gray-800);-ms-flex-align:center;align-items:center}:host p{font-weight:600;line-height:16px}:host .icon-right svg{-ms-flex-order:2;order:2}:host .small{padding:2px 8px}:host .rounded{border-radius:20px}:host .bold{background-color:var(--zonos-elements-gray-600);color:var(--zonos-elements-gray-100)}:host .blue{background-color:var(--zonos-elements-blue-100);color:var(--zonos-elements-blue-800)}:host .blue.bold{background-color:var(--zonos-elements-blue-600);color:var(--zonos-elements-blue-100)}:host .green{background-color:var(--zonos-elements-green-100);color:var(--zonos-elements-green-800)}:host .green.bold{background-color:var(--zonos-elements-green-600);color:var(--zonos-elements-green-100)}:host .red{background-color:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800)}:host .red.bold{background-color:var(--zonos-elements-red-600);color:var(--zonos-elements-red-100)}:host .orange{background-color:var(--zonos-elements-orange-100);color:var(--zonos-elements-orange-800)}:host .orange.bold{background-color:var(--zonos-elements-orange-600);color:var(--zonos-elements-orange-100)}:host .purple{background-color:var(--zonos-elements-purple-100);color:var(--zonos-elements-purple-800)}:host .purple.bold{background-color:var(--zonos-elements-purple-600);color:var(--zonos-elements-purple-100)}:host .cyan{background-color:var(--zonos-elements-cyan-100);color:var(--zonos-elements-cyan-800)}:host .cyan.bold{background-color:var(--zonos-elements-cyan-600);color:var(--zonos-elements-cyan-100)}";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host } from './index-3b46f3c3.js';
|
|
2
|
-
import { d as zonosStoreFontFamily } from './zonosStore-
|
|
2
|
+
import { d as zonosStoreFontFamily } from './zonosStore-93da32b4.js';
|
|
3
3
|
import { c as classes } from './classes-0d95c529.js';
|
|
4
4
|
|
|
5
5
|
const zonosBannerCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{border-radius:var(--zonos-elements-radius-10);padding:16px;background:var(--zonos-elements-gray-100)}:host .zonos--container{display:grid;-ms-flex-align:center;align-items:center;grid-template-areas:\"icon header\" \". content\";grid-template-columns:32px auto 0}:host .zonos--icon-wrapper{grid-area:icon;display:-ms-flexbox;display:flex;justify-self:start}:host .zonos--header-wrapper{margin-top:0px;grid-area:header}:host .zonos--content-wrapper{grid-area:content;margin-top:4px}:host(.info){background-color:var(--zonos-elements-blue-100);border:1px solid var(--zonos-elements-blue-200)}:host(.success){background-color:var(--zonos-elements-green-100);border:1px solid var(--zonos-elements-green-200)}:host(.error){background-color:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host(.warning){background-color:var(--zonos-elements-orange-100);border:1px solid var(--zonos-elements-orange-200)}";
|