@zonos/elements 1.2.4-alpha.7 → 1.3.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/README.md +80 -1
- package/dist/cjs/{cart-90f7c8c0.js → cart-cfa5d5fd.js} +4 -4
- package/dist/cjs/{getBorderRadius-bf4a4276.js → getBorderRadius-c3c63ee6.js} +1 -1
- package/dist/cjs/index.cjs.js +5 -5
- package/dist/cjs/{isDarkColor-ff6ff183.js → isDarkColor-fc8c294a.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{localization-9caf3397.js → localization-4746acf7.js} +2 -2
- package/dist/cjs/{submitGtag-b141b45d.js → submitGtag-ca175427.js} +2 -2
- package/dist/cjs/zonos-address_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-cart-items_10.cjs.entry.js +9 -15
- package/dist/cjs/zonos-checkout.cjs.entry.js +6 -6
- package/dist/cjs/zonos-controller.cjs.entry.js +15 -9
- package/dist/cjs/zonos-country-flag_4.cjs.entry.js +3 -3
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +8 -5
- package/dist/cjs/zonos-icon.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification.cjs.entry.js +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +5 -5
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
- package/dist/cjs/zonos-text.cjs.entry.js +1 -1
- package/dist/cjs/{zonosStore-b43ef5db.js → zonosStore-10d1d6ff.js} +0 -8
- package/dist/collection/__tests__/build-utils/urlCheckOne.js +4 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +4 -10
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +6 -3
- package/dist/collection/components/main/zonos-controller.js +35 -8
- package/dist/collection/components/store/zonosStore.js +0 -8
- package/dist/collection/components/utils/api/{getZonosSetting.js → getZonosSettings.js} +3 -3
- package/dist/collection/components/utils/handleFetch.js +1 -1
- package/dist/collection/environment.js +14 -3
- package/dist/collection/scripts/{zonos.js → zonosBase.js} +7 -19
- package/dist/collection/types/generated/graphql.customer.types.js +52 -4
- package/dist/collection/types/generated/graphql.frontend.types.js +22 -16
- package/dist/components/localization.js +1 -1
- package/dist/components/zonos-checkout-finish2.js +5 -10
- package/dist/components/zonos-controller.js +12 -5
- package/dist/components/zonos-hello.js +6 -3
- package/dist/components/zonosStore.js +0 -8
- package/dist/esm/{cart-b439be00.js → cart-d81b92ea.js} +4 -4
- package/dist/esm/{getBorderRadius-178a0a05.js → getBorderRadius-77e97943.js} +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/{isDarkColor-416d6047.js → isDarkColor-69090b29.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{localization-a51ccbc2.js → localization-0c5b29fd.js} +2 -2
- package/dist/esm/{submitGtag-521826a2.js → submitGtag-8a0fbd41.js} +2 -2
- package/dist/esm/zonos-address_2.entry.js +5 -5
- package/dist/esm/zonos-badge.entry.js +1 -1
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_2.entry.js +3 -3
- package/dist/esm/zonos-card_2.entry.js +1 -1
- package/dist/esm/zonos-cart-items_10.entry.js +9 -15
- package/dist/esm/zonos-checkout.entry.js +6 -6
- package/dist/esm/zonos-controller.entry.js +15 -9
- package/dist/esm/zonos-country-flag_4.entry.js +3 -3
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +8 -5
- package/dist/esm/zonos-icon.entry.js +1 -1
- package/dist/esm/zonos-notification.entry.js +1 -1
- package/dist/esm/zonos-payment.entry.js +5 -5
- package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/{zonosStore-61e74f58.js → zonosStore-34f07ee8.js} +0 -8
- package/dist/esm-es5/{cart-b439be00.js → cart-d81b92ea.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-178a0a05.js → getBorderRadius-77e97943.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-416d6047.js → isDarkColor-69090b29.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{localization-a51ccbc2.js → localization-0c5b29fd.js} +1 -1
- package/dist/esm-es5/{submitGtag-521826a2.js → submitGtag-8a0fbd41.js} +1 -1
- package/dist/esm-es5/zonos-address_2.entry.js +1 -1
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_2.entry.js +1 -1
- package/dist/esm-es5/zonos-card_2.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_10.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_4.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-icon.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-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-61e74f58.js → zonosStore-34f07ee8.js} +1 -1
- package/dist/scripts/extractZonosQaUrl.js +1 -30
- package/dist/scripts/loadStripe.js +1 -118
- package/dist/scripts/loadZonos.js +1 -565
- package/dist/scripts/stripe.js +1 -126
- package/dist/scripts/zonos.js +1 -565
- package/dist/scripts/zonosBase.js +1 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +2 -3
- package/dist/types/components/main/zonos-controller.d.ts +5 -1
- package/dist/types/components/store/zonosStore.d.ts +1 -3
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components/utils/api/{getZonosSetting.d.ts → getZonosSettings.d.ts} +1 -1
- package/dist/types/components.d.ts +6 -2
- package/dist/types/scripts/{zonos.d.ts → zonosBase.d.ts} +6 -3
- package/dist/types/types/checkout/CheckoutConfig.d.ts +3 -2
- package/dist/types/types/generated/graphql.customer.types.d.ts +64 -5
- package/dist/types/types/generated/graphql.customer.types.ts +81 -8
- package/dist/types/types/generated/graphql.frontend.types.d.ts +107 -86
- package/dist/types/types/generated/graphql.frontend.types.ts +159 -110
- package/dist/types/types/global.d.ts +10 -2
- package/dist/types/types/hello/HelloConfig.d.ts +0 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-1685c8df.js → p-06a332cd.js} +1 -1
- package/dist/zonos-elements/{p-4ed71bd7.entry.js → p-124857ae.entry.js} +1 -1
- package/dist/zonos-elements/{p-e98be2d0.system.entry.js → p-1f494581.system.entry.js} +1 -1
- package/dist/zonos-elements/p-24fbe845.system.js +1 -1
- package/dist/zonos-elements/{p-4846796a.js → p-2b41549a.js} +1 -1
- package/dist/zonos-elements/p-2e1e9074.js +1 -0
- package/dist/zonos-elements/{p-2801d868.entry.js → p-3509ffaa.entry.js} +1 -1
- package/dist/zonos-elements/{p-1d4a970b.entry.js → p-3c8763a7.entry.js} +1 -1
- package/dist/zonos-elements/{p-49f09b91.entry.js → p-3e7444c6.entry.js} +1 -1
- package/dist/zonos-elements/p-436faf98.system.entry.js +1 -0
- package/dist/zonos-elements/{p-55f49f1e.js → p-4b3baf99.js} +1 -1
- package/dist/zonos-elements/{p-a504f64f.system.js → p-5066955b.system.js} +1 -1
- package/dist/zonos-elements/{p-e5ae22a9.system.entry.js → p-53ea93c2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f367f2fe.system.entry.js → p-5bada106.system.entry.js} +1 -1
- package/dist/zonos-elements/p-5e87609f.entry.js +1 -0
- package/dist/zonos-elements/{p-b85be1ab.system.js → p-7730250d.system.js} +1 -1
- package/dist/zonos-elements/{p-089ba905.js → p-86f22026.js} +1 -1
- package/dist/zonos-elements/{p-a0e36ed3.entry.js → p-88600956.entry.js} +1 -1
- package/dist/zonos-elements/{p-89c210d6.entry.js → p-8b1cb8a4.entry.js} +1 -1
- package/dist/zonos-elements/p-8bd04aaa.entry.js +1 -0
- package/dist/zonos-elements/{p-47390db7.system.entry.js → p-935fa685.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-639396bb.entry.js → p-9c1f19b6.entry.js} +1 -1
- package/dist/zonos-elements/{p-4d93275c.entry.js → p-a063c4b7.entry.js} +1 -1
- package/dist/zonos-elements/p-a174d834.system.js +1 -0
- package/dist/zonos-elements/{p-3c6988d7.js → p-a244579e.js} +1 -1
- package/dist/zonos-elements/{p-24eed2a8.system.js → p-a54d8db3.system.js} +1 -1
- package/dist/zonos-elements/{p-e1f6ab97.entry.js → p-ab00288a.entry.js} +1 -1
- package/dist/zonos-elements/{p-b51de536.system.js → p-ab179c88.system.js} +1 -1
- package/dist/zonos-elements/{p-afe26069.entry.js → p-ad2b4bda.entry.js} +1 -1
- package/dist/zonos-elements/{p-4bee0bff.system.entry.js → p-b3a71ae4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d856a200.system.entry.js → p-b3e034bb.system.entry.js} +1 -1
- package/dist/zonos-elements/p-b7e061e7.entry.js +1 -0
- package/dist/zonos-elements/{p-3cea383b.system.entry.js → p-bb7de2c4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-da060b1c.system.js → p-c1665c4f.system.js} +1 -1
- package/dist/zonos-elements/{p-2f43da39.system.entry.js → p-c1e298d5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8c5595d9.system.entry.js → p-c520d819.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c9348bb0.system.entry.js → p-ca875e60.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b4601210.system.entry.js → p-ccd1794a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f141519c.system.entry.js → p-daa10b8c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b6148206.entry.js → p-e3bca405.entry.js} +1 -1
- package/dist/zonos-elements/{p-a376a37f.entry.js → p-e58cc024.entry.js} +1 -1
- package/dist/zonos-elements/{p-938803f4.entry.js → p-e6556b0d.entry.js} +1 -1
- package/dist/zonos-elements/{p-d2217f09.system.js → p-ed074fbf.system.js} +1 -1
- package/dist/zonos-elements/{p-560aa686.system.entry.js → p-f1e9b431.system.entry.js} +1 -1
- package/dist/zonos-elements/p-f7b07128.system.entry.js +1 -0
- package/dist/zonos-elements/{p-4a15c5c7.system.entry.js → p-fbc09dae.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +9 -6
- package/dist/collection/types/online-store/OnlineStoreConfig.js +0 -1
- package/dist/types/types/online-store/OnlineStoreConfig.d.ts +0 -3
- package/dist/zonos-elements/p-06fb9d1f.system.entry.js +0 -1
- package/dist/zonos-elements/p-33137e7d.system.entry.js +0 -1
- package/dist/zonos-elements/p-494c77a7.entry.js +0 -1
- package/dist/zonos-elements/p-8c48b75e.system.js +0 -1
- package/dist/zonos-elements/p-e9b832c5.entry.js +0 -1
- package/dist/zonos-elements/p-eb392924.entry.js +0 -1
- package/dist/zonos-elements/p-ff95f098.js +0 -1
|
@@ -2529,7 +2529,6 @@ const { reset, state: zonosStore } = createStore(() => ({
|
|
|
2529
2529
|
zonosAttribution: 'DISABLED',
|
|
2530
2530
|
},
|
|
2531
2531
|
checkoutSettings: {
|
|
2532
|
-
allowedDomains: [],
|
|
2533
2532
|
analyticsProviders: [],
|
|
2534
2533
|
orderNotifications: {
|
|
2535
2534
|
abandonedCart: {
|
|
@@ -2563,7 +2562,6 @@ const { reset, state: zonosStore } = createStore(() => ({
|
|
|
2563
2562
|
},
|
|
2564
2563
|
currentHelloPage: '',
|
|
2565
2564
|
helloSettings: {
|
|
2566
|
-
allowedDomains: [],
|
|
2567
2565
|
anchorElementSelector: '',
|
|
2568
2566
|
cartUrlPattern: '',
|
|
2569
2567
|
currencyBehavior: 'ENABLED',
|
|
@@ -2585,9 +2583,6 @@ const { reset, state: zonosStore } = createStore(() => ({
|
|
|
2585
2583
|
restrictionBehavior: 'DISABLED',
|
|
2586
2584
|
},
|
|
2587
2585
|
loadedConfig: false,
|
|
2588
|
-
onlineStoreSettings: {
|
|
2589
|
-
allowedDomains: [],
|
|
2590
|
-
},
|
|
2591
2586
|
organizationName: '',
|
|
2592
2587
|
sourceCurrency: 'USD',
|
|
2593
2588
|
storeId: null,
|
|
@@ -2613,9 +2608,6 @@ const zonosStoreInitSetting = ({ overrideSettings, zonosSettings, }) => {
|
|
|
2613
2608
|
(zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.checkoutSettings) ||
|
|
2614
2609
|
null, overrideSettings.checkoutSettings);
|
|
2615
2610
|
zonosStore.helloSettings = mergeConfig(zonosStore.helloSettings, (savedZonosSettings === null || savedZonosSettings === void 0 ? void 0 : savedZonosSettings.helloSettings) || (zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.helloSettings) || null, overrideSettings.helloSettings);
|
|
2616
|
-
zonosStore.onlineStoreSettings = mergeConfig(zonosStore.onlineStoreSettings, (savedZonosSettings === null || savedZonosSettings === void 0 ? void 0 : savedZonosSettings.onlineStoreSettings) ||
|
|
2617
|
-
(zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.onlineStoreSettings) ||
|
|
2618
|
-
null, overrideSettings.onlineStoreSettings);
|
|
2619
2611
|
// set flag to true to indicate that config is ready
|
|
2620
2612
|
zonosStore.loadedConfig = true;
|
|
2621
2613
|
zonosStore.organizationName = ((_a = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _a === void 0 ? void 0 : _a.name) || '';
|
|
@@ -15,9 +15,12 @@ export const urlCheckOne = async ({ branch, filePath, packageVersion, }) => {
|
|
|
15
15
|
// no need to check for debug.js.zonos.com since it will not be versioned and be used only for live QA
|
|
16
16
|
'debug.js.zonos.com',
|
|
17
17
|
];
|
|
18
|
+
// these files are load file, no need to check version url here
|
|
19
|
+
const excludeFiles = ['zonosBase', 'zonos', 'loadZonos'];
|
|
18
20
|
result.forEach(([fullUrl]) => {
|
|
19
21
|
if (fullUrl.includes('.js.zonos.com') &&
|
|
20
|
-
!excludeDomainPattern.includes(fullUrl)
|
|
22
|
+
!excludeDomainPattern.includes(fullUrl) &&
|
|
23
|
+
!excludeFiles.some(file => filePath.includes(file))) {
|
|
21
24
|
// match: v1.2.3-alpha.0.qa.js.zonos.com | v1.2.3.qa.js.zonos.com | v1.qa.js.zonos.com
|
|
22
25
|
const versioned = /(v(?<major>\d+)(?<patch>\.\d+(\-alpha\.\d+)*)*)\.*(.*?js\.zonos\.com)/g.exec(fullUrl);
|
|
23
26
|
if (!versioned) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment, h, Host, } from "@stencil/core";
|
|
2
2
|
import { stripeStore, stripeStoreReset, stripeStoreRetrievePayment, } from "../../../store/checkout/stripe";
|
|
3
3
|
import { translate } from "../../../store/translationStore";
|
|
4
|
+
import { zonosStore } from "../../../store/zonosStore";
|
|
4
5
|
import { getBorderRadius } from "../../../utils/getBorderRadius";
|
|
5
6
|
import { handleFetch } from "../../../utils/handleFetch";
|
|
6
|
-
import { logError } from "../../../utils/logging/logError";
|
|
7
7
|
import { submitGtag } from "../../../utils/submitGtag";
|
|
8
8
|
import { cartStore } from "../../../../types/index";
|
|
9
9
|
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
@@ -21,17 +21,11 @@ export class ZonosCheckoutFinish {
|
|
|
21
21
|
if (errors.length || !(json === null || json === void 0 ? void 0 : json.id)) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
const orderId = json === null || json === void 0 ? void 0 : json.id;
|
|
27
|
-
const storeHash = (_b = (_a = json === null || json === void 0 ? void 0 : json.metadata) === null || _a === void 0 ? void 0 : _a.find(x => (x === null || x === void 0 ? void 0 : x.key) === 'storeHash')) === null || _b === void 0 ? void 0 : _b.value;
|
|
28
|
-
if (!orderId || !storeHash) {
|
|
29
|
-
return logError('Unable to trigger BigCommerce /success: Missing orderId or storeHash');
|
|
30
|
-
}
|
|
31
|
-
void handleFetch(`${baseUrl}/api/bigcommerce/success?orderId=${orderId}&storeHash=${storeHash}`);
|
|
32
|
-
}
|
|
24
|
+
// onOrderSuccess callback may be provided on Zonos.init
|
|
25
|
+
await ((_b = (_a = zonosStore.checkoutSettings).onOrderSuccess) === null || _b === void 0 ? void 0 : _b.call(_a, json));
|
|
33
26
|
return json;
|
|
34
27
|
};
|
|
28
|
+
// TODO: This method of pulling orders is temporary. Once we have a working event registry system, we will rely on that to tell us when the order is ready to trigger onOrderSuccess
|
|
35
29
|
this.getPullOrder = async (attempts = 0) => {
|
|
36
30
|
const order = await this.pullOrder();
|
|
37
31
|
if (order) {
|
|
@@ -20,7 +20,7 @@ const PEEK_MESSAGE_CLOSE_DELAY_MS = 3000;
|
|
|
20
20
|
const RESIZE_DEBOUNCE_DELAY_MS = 500;
|
|
21
21
|
export class ZonosHello {
|
|
22
22
|
constructor() {
|
|
23
|
-
this.getHelloPeekMessage = () => {
|
|
23
|
+
this.getHelloPeekMessage = (organizationName) => {
|
|
24
24
|
const isRestrictionPage = zonosStore.currentHelloPage === 'productDetail' ||
|
|
25
25
|
zonosStore.currentHelloPage === 'productList';
|
|
26
26
|
if (isRestrictionPage && this.allRestrictedItems.length) {
|
|
@@ -37,7 +37,7 @@ export class ZonosHello {
|
|
|
37
37
|
case 'productDetail':
|
|
38
38
|
return translate(`See duty and tax thresholds`);
|
|
39
39
|
default:
|
|
40
|
-
return `${translate('Welcome to')} ${
|
|
40
|
+
return `${translate('Welcome to')} ${organizationName}`;
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
this.enableShowPeekMessage = () => {
|
|
@@ -57,7 +57,7 @@ export class ZonosHello {
|
|
|
57
57
|
return newRestrictions;
|
|
58
58
|
};
|
|
59
59
|
this.triggerShowPeekMessage = () => {
|
|
60
|
-
this.peekMessage = this.getHelloPeekMessage();
|
|
60
|
+
this.peekMessage = this.getHelloPeekMessage(zonosStore.organizationName);
|
|
61
61
|
const { peekMessageBehavior, peekMessageDelay } = zonosStore.helloSettings;
|
|
62
62
|
// peek message delay is passed in seconds, but setTimeout expects milliseconds
|
|
63
63
|
const peekMessageDelayToUse = peekMessageDelay * 1000;
|
|
@@ -253,6 +253,9 @@ export class ZonosHello {
|
|
|
253
253
|
const appearanceSettings = mergeConfig(zonosStore.appearance, this.appearanceSettingsOverride);
|
|
254
254
|
const { theme } = appearanceSettings;
|
|
255
255
|
const restrictedItemsOnPage = (_b = this.allRestrictedItems) === null || _b === void 0 ? void 0 : _b.filter(product => this.productsOnPage.some(restriction => restriction.description === product.itemDescription));
|
|
256
|
+
// The organization name can be changed after init with the updateOrganizationName method.
|
|
257
|
+
// This will cause the element to rerender with the new org name when it changes. (used for preview on dashboard)
|
|
258
|
+
this.peekMessage = this.getHelloPeekMessage(zonosStore.organizationName);
|
|
256
259
|
const showHello = this.isShippableCountry() && !!selectedCountryCode;
|
|
257
260
|
return (h(Host, { class: "zonos--hello zonos--elements", "data-theme": theme }, showHello && (h("div", { class: "zonos--hello-wrapper" }, h("button", { class: classes([
|
|
258
261
|
'zonos--hello-widget',
|
|
@@ -2,7 +2,7 @@ import { h, Host, } from "@stencil/core";
|
|
|
2
2
|
import { stripeStore } from "../store/checkout/stripe";
|
|
3
3
|
import { initLocalizationStore, localizationStoreUpdateSelectedCountryCode, } from "../store/hello/localization";
|
|
4
4
|
import { zonosStore, zonosStoreFontFamily, zonosStoreInitSetting, } from "../store/zonosStore";
|
|
5
|
-
import {
|
|
5
|
+
import { getZonosSettings } from "../utils/api/getZonosSettings";
|
|
6
6
|
import { initCheckout } from "../utils/checkout/initCheckout";
|
|
7
7
|
import { handleFetch } from "../utils/handleFetch";
|
|
8
8
|
import { initHello } from "../utils/hello/initHello";
|
|
@@ -113,7 +113,7 @@ export class ZonosController {
|
|
|
113
113
|
// running with scope async function to avoid blocking the main thread
|
|
114
114
|
(async () => {
|
|
115
115
|
var _a, _b;
|
|
116
|
-
const { errors, json } = await
|
|
116
|
+
const { errors, json } = await getZonosSettings();
|
|
117
117
|
if (((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.type.toString()) === '403') {
|
|
118
118
|
log('Failed to load zonos settings. This domain may not have access', 'warn');
|
|
119
119
|
return;
|
|
@@ -192,6 +192,12 @@ export class ZonosController {
|
|
|
192
192
|
async getAppearanceSetting() {
|
|
193
193
|
return zonosStore.appearance;
|
|
194
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Update the organizationName
|
|
197
|
+
*/
|
|
198
|
+
async updateOrganizationName(organizationName) {
|
|
199
|
+
zonosStore.organizationName = organizationName;
|
|
200
|
+
}
|
|
195
201
|
render() {
|
|
196
202
|
return h(Host, { class: "zonos--elements" });
|
|
197
203
|
}
|
|
@@ -214,12 +220,12 @@ export class ZonosController {
|
|
|
214
220
|
"mutable": false,
|
|
215
221
|
"complexType": {
|
|
216
222
|
"original": "LoadZonosParamsConfig",
|
|
217
|
-
"resolved": "{ appearance?: Partial<AppearanceConfig> | undefined; checkoutSettings?: Partial<CheckoutConfig> | undefined; currencyConverter?: CurrencyConverter | undefined; helloSettings?: Partial<HelloConfig> | undefined;
|
|
223
|
+
"resolved": "{ appearance?: Partial<AppearanceConfig> | undefined; checkoutSettings?: Partial<CheckoutConfig> | undefined; currencyConverter?: CurrencyConverter | undefined; helloSettings?: Partial<HelloConfig> | undefined; }",
|
|
218
224
|
"references": {
|
|
219
225
|
"LoadZonosParamsConfig": {
|
|
220
226
|
"location": "import",
|
|
221
|
-
"path": "src/scripts/
|
|
222
|
-
"id": "src/scripts/
|
|
227
|
+
"path": "src/scripts/zonosBase",
|
|
228
|
+
"id": "src/scripts/zonosBase.ts::LoadZonosParamsConfig"
|
|
223
229
|
}
|
|
224
230
|
}
|
|
225
231
|
},
|
|
@@ -347,7 +353,7 @@ export class ZonosController {
|
|
|
347
353
|
"signature": "(config: LoadZonosParamsConfig) => Promise<void>",
|
|
348
354
|
"parameters": [{
|
|
349
355
|
"name": "config",
|
|
350
|
-
"type": "{ appearance?: Partial<AppearanceConfig> | undefined; checkoutSettings?: Partial<CheckoutConfig> | undefined; currencyConverter?: CurrencyConverter | undefined; helloSettings?: Partial<HelloConfig> | undefined;
|
|
356
|
+
"type": "{ appearance?: Partial<AppearanceConfig> | undefined; checkoutSettings?: Partial<CheckoutConfig> | undefined; currencyConverter?: CurrencyConverter | undefined; helloSettings?: Partial<HelloConfig> | undefined; }",
|
|
351
357
|
"docs": "config that need to override the default setting"
|
|
352
358
|
}],
|
|
353
359
|
"references": {
|
|
@@ -357,8 +363,8 @@ export class ZonosController {
|
|
|
357
363
|
},
|
|
358
364
|
"LoadZonosParamsConfig": {
|
|
359
365
|
"location": "import",
|
|
360
|
-
"path": "src/scripts/
|
|
361
|
-
"id": "src/scripts/
|
|
366
|
+
"path": "src/scripts/zonosBase",
|
|
367
|
+
"id": "src/scripts/zonosBase.ts::LoadZonosParamsConfig"
|
|
362
368
|
}
|
|
363
369
|
},
|
|
364
370
|
"return": "Promise<void>"
|
|
@@ -418,6 +424,27 @@ export class ZonosController {
|
|
|
418
424
|
"text": "Get appearance from setting",
|
|
419
425
|
"tags": []
|
|
420
426
|
}
|
|
427
|
+
},
|
|
428
|
+
"updateOrganizationName": {
|
|
429
|
+
"complexType": {
|
|
430
|
+
"signature": "(organizationName: string) => Promise<void>",
|
|
431
|
+
"parameters": [{
|
|
432
|
+
"name": "organizationName",
|
|
433
|
+
"type": "string",
|
|
434
|
+
"docs": ""
|
|
435
|
+
}],
|
|
436
|
+
"references": {
|
|
437
|
+
"Promise": {
|
|
438
|
+
"location": "global",
|
|
439
|
+
"id": "global::Promise"
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
"return": "Promise<void>"
|
|
443
|
+
},
|
|
444
|
+
"docs": {
|
|
445
|
+
"text": "Update the organizationName",
|
|
446
|
+
"tags": []
|
|
447
|
+
}
|
|
421
448
|
}
|
|
422
449
|
};
|
|
423
450
|
}
|
|
@@ -10,7 +10,6 @@ const { reset, state: zonosStore } = createStore(() => ({
|
|
|
10
10
|
zonosAttribution: 'DISABLED',
|
|
11
11
|
},
|
|
12
12
|
checkoutSettings: {
|
|
13
|
-
allowedDomains: [],
|
|
14
13
|
analyticsProviders: [],
|
|
15
14
|
orderNotifications: {
|
|
16
15
|
abandonedCart: {
|
|
@@ -44,7 +43,6 @@ const { reset, state: zonosStore } = createStore(() => ({
|
|
|
44
43
|
},
|
|
45
44
|
currentHelloPage: '',
|
|
46
45
|
helloSettings: {
|
|
47
|
-
allowedDomains: [],
|
|
48
46
|
anchorElementSelector: '',
|
|
49
47
|
cartUrlPattern: '',
|
|
50
48
|
currencyBehavior: 'ENABLED',
|
|
@@ -66,9 +64,6 @@ const { reset, state: zonosStore } = createStore(() => ({
|
|
|
66
64
|
restrictionBehavior: 'DISABLED',
|
|
67
65
|
},
|
|
68
66
|
loadedConfig: false,
|
|
69
|
-
onlineStoreSettings: {
|
|
70
|
-
allowedDomains: [],
|
|
71
|
-
},
|
|
72
67
|
organizationName: '',
|
|
73
68
|
sourceCurrency: 'USD',
|
|
74
69
|
storeId: null,
|
|
@@ -94,9 +89,6 @@ const zonosStoreInitSetting = ({ overrideSettings, zonosSettings, }) => {
|
|
|
94
89
|
(zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.checkoutSettings) ||
|
|
95
90
|
null, overrideSettings.checkoutSettings);
|
|
96
91
|
zonosStore.helloSettings = mergeConfig(zonosStore.helloSettings, (savedZonosSettings === null || savedZonosSettings === void 0 ? void 0 : savedZonosSettings.helloSettings) || (zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.helloSettings) || null, overrideSettings.helloSettings);
|
|
97
|
-
zonosStore.onlineStoreSettings = mergeConfig(zonosStore.onlineStoreSettings, (savedZonosSettings === null || savedZonosSettings === void 0 ? void 0 : savedZonosSettings.onlineStoreSettings) ||
|
|
98
|
-
(zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.onlineStoreSettings) ||
|
|
99
|
-
null, overrideSettings.onlineStoreSettings);
|
|
100
92
|
// set flag to true to indicate that config is ready
|
|
101
93
|
zonosStore.loadedConfig = true;
|
|
102
94
|
zonosStore.organizationName = ((_a = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _a === void 0 ? void 0 : _a.name) || '';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { handleFetch } from "../handleFetch";
|
|
2
2
|
import { logError } from "../logging/logError";
|
|
3
|
-
export const
|
|
4
|
-
const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/zonos-
|
|
3
|
+
export const getZonosSettings = async () => {
|
|
4
|
+
const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/zonos-elements/zonos-settings`;
|
|
5
5
|
const { errors, json } = await handleFetch(url);
|
|
6
6
|
if (errors.length) {
|
|
7
|
-
logError(`Error
|
|
7
|
+
logError(`Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings`);
|
|
8
8
|
return { errors, json: null };
|
|
9
9
|
}
|
|
10
10
|
return { errors: [], json };
|
|
@@ -107,7 +107,7 @@ export const handleFetch = async (url, _opts) => {
|
|
|
107
107
|
const opts = __rest(_opts || {}, []);
|
|
108
108
|
const body = opts.body ? JSON.stringify(opts.body) : undefined;
|
|
109
109
|
const method = opts.method || 'GET';
|
|
110
|
-
// adding
|
|
110
|
+
// adding random encoded token to the url so that the request will be cached differently for each store
|
|
111
111
|
const modifiedUrl = new URL(url);
|
|
112
112
|
modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
|
|
113
113
|
// headers content type
|
|
@@ -80,10 +80,21 @@ export const formattedUrl = ({ branchName, inCI: _inCI, inVercel: _inVercel, isV
|
|
|
80
80
|
}
|
|
81
81
|
const version = type === 'major' ? `${_packageVersion === null || _packageVersion === void 0 ? void 0 : _packageVersion.split('.')[0]}` : _packageVersion;
|
|
82
82
|
const isVersionedUrl = domainOnlyUrl === null || domainOnlyUrl === void 0 ? void 0 : domainOnlyUrl.startsWith('v');
|
|
83
|
+
const shouldAddVersion = (isProdBranch || _inCI) && !isVersionedUrl;
|
|
84
|
+
/**
|
|
85
|
+
* Trimming the `qa` from the domain url only when we add version prefix
|
|
86
|
+
* @reason We've now introduced alpha versioning for the QA branch deployment.
|
|
87
|
+
* However, we've generated the domain as `v1.2.4-alpha.1.js.zonos.com`, while the
|
|
88
|
+
* current CDN URL env uses `qa.js.zonos.com` on qa branch. This discrepancy causes
|
|
89
|
+
* this function to return an invalid alpha domain (v1.2.4-alpha.1.qa.js.zonos.com).
|
|
90
|
+
*/
|
|
91
|
+
const trimmedQaUrl = shouldAddVersion
|
|
92
|
+
? domainOnlyUrl === null || domainOnlyUrl === void 0 ? void 0 : domainOnlyUrl.replace('qa.js.zonos.com', 'js.zonos.com')
|
|
93
|
+
: domainOnlyUrl;
|
|
83
94
|
// only set version for the url once
|
|
84
|
-
return
|
|
85
|
-
? `https://v${version}.${
|
|
86
|
-
: `https://${
|
|
95
|
+
return shouldAddVersion
|
|
96
|
+
? `https://v${version}.${trimmedQaUrl}`
|
|
97
|
+
: `https://${trimmedQaUrl}`;
|
|
87
98
|
};
|
|
88
99
|
if (typeof window === 'undefined') {
|
|
89
100
|
// storybook can't access to any "node" modules
|
|
@@ -51,7 +51,7 @@ Zonos.version = `v${process.env.NEXT_PUBLIC_ZONOS_PACKAGE_VERSION}`;
|
|
|
51
51
|
Zonos.modeAlerted = false;
|
|
52
52
|
Zonos.getCurrentTimestamp = () => new Date().getTime();
|
|
53
53
|
Zonos.zonosController = null;
|
|
54
|
-
Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, zonosApiKey, }) => {
|
|
54
|
+
Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, storeId, zonosApiKey, }) => {
|
|
55
55
|
if (_a.doneInit) {
|
|
56
56
|
// do nothing if zonos is already initializeds
|
|
57
57
|
return;
|
|
@@ -62,6 +62,7 @@ Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSett
|
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
_a.zonosApiKey = zonosApiKey;
|
|
65
|
+
_a.storeId = storeId;
|
|
65
66
|
log('init zonos');
|
|
66
67
|
// add sentry to the project
|
|
67
68
|
_a.injectSentryScript();
|
|
@@ -93,6 +94,10 @@ Zonos.showNotification = (notification) => {
|
|
|
93
94
|
var _b;
|
|
94
95
|
void ((_b = _a.zonosController) === null || _b === void 0 ? void 0 : _b.showNotification(notification));
|
|
95
96
|
};
|
|
97
|
+
Zonos.updateOrganizationName = (organizationName) => {
|
|
98
|
+
var _b;
|
|
99
|
+
void ((_b = _a.zonosController) === null || _b === void 0 ? void 0 : _b.updateOrganizationName(organizationName));
|
|
100
|
+
};
|
|
96
101
|
Zonos.disablePlaceOrderButtons = ({ autoEnable = true, disable, placeOrderButtonSelector, }) => {
|
|
97
102
|
// if placeOrderAnchor is passed in the config for checkoutSettings, disable the place order button until zonos is initialized
|
|
98
103
|
if (placeOrderButtonSelector) {
|
|
@@ -188,24 +193,7 @@ Zonos.injectSentryScript = () => {
|
|
|
188
193
|
script.onload = () => {
|
|
189
194
|
var _b;
|
|
190
195
|
(_b = window.Sentry) === null || _b === void 0 ? void 0 : _b.init({
|
|
191
|
-
|
|
192
|
-
// Facebook flakiness
|
|
193
|
-
/graph\.facebook\.com/i,
|
|
194
|
-
// Facebook blocked
|
|
195
|
-
/connect\.facebook\.net\/en_US\/all\.js/i,
|
|
196
|
-
// Woopra flakiness
|
|
197
|
-
/eatdifferent\.com\.woopra-ns\.com/i,
|
|
198
|
-
/static\.woopra\.com\/js\/woopra\.js/i,
|
|
199
|
-
// Chrome extensions
|
|
200
|
-
/extensions\//i,
|
|
201
|
-
/^chrome:\/\//i,
|
|
202
|
-
/^chrome-extension:\/\//i,
|
|
203
|
-
// Other plugins
|
|
204
|
-
/webappstoolbarba\.texthelp\.com\//i,
|
|
205
|
-
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
|
|
206
|
-
/dev.elements.zonos.com/i,
|
|
207
|
-
/js.zonos.com/,
|
|
208
|
-
],
|
|
196
|
+
allowUrls: [/js.zonos.com/],
|
|
209
197
|
dsn: 'https://19168bd05af0e2e0e7520ad58953e4f2@o446983.ingest.sentry.io/4506400622837760',
|
|
210
198
|
release: `zonos-elements@${_a.version}`,
|
|
211
199
|
});
|
|
@@ -51,10 +51,18 @@ export const carrierAccountApiUsage = {
|
|
|
51
51
|
Label: 'LABEL',
|
|
52
52
|
Rating: 'RATING',
|
|
53
53
|
};
|
|
54
|
+
export const carrierAccountIntegrationType = {
|
|
55
|
+
Rest: 'REST',
|
|
56
|
+
Soap: 'SOAP',
|
|
57
|
+
};
|
|
54
58
|
export const carrierAccountRateType = {
|
|
55
59
|
Negotiated: 'NEGOTIATED',
|
|
56
60
|
Retail: 'RETAIL',
|
|
57
61
|
};
|
|
62
|
+
export const carrierAccountRegistrationType = {
|
|
63
|
+
Other: 'OTHER',
|
|
64
|
+
Zonos: 'ZONOS',
|
|
65
|
+
};
|
|
58
66
|
export const carrierAccountUsageCategoryCode = {
|
|
59
67
|
Shipping: 'SHIPPING',
|
|
60
68
|
};
|
|
@@ -978,6 +986,20 @@ export const elementsUiTheme = {
|
|
|
978
986
|
Light: 'LIGHT',
|
|
979
987
|
System: 'SYSTEM',
|
|
980
988
|
};
|
|
989
|
+
export const emailTemplateProviderType = {
|
|
990
|
+
Sendgrid: 'SENDGRID',
|
|
991
|
+
};
|
|
992
|
+
export const emailTemplateStatus = {
|
|
993
|
+
Primary: 'PRIMARY',
|
|
994
|
+
Standard: 'STANDARD',
|
|
995
|
+
};
|
|
996
|
+
export const emailTemplateType = {
|
|
997
|
+
AbandonedCart: 'ABANDONED_CART',
|
|
998
|
+
OrderCanceled: 'ORDER_CANCELED',
|
|
999
|
+
OrderConfirmation: 'ORDER_CONFIRMATION',
|
|
1000
|
+
OrderShipped: 'ORDER_SHIPPED',
|
|
1001
|
+
Unknown: 'UNKNOWN',
|
|
1002
|
+
};
|
|
981
1003
|
export const endOfDayBehavior = {
|
|
982
1004
|
Exempt: 'EXEMPT',
|
|
983
1005
|
Required: 'REQUIRED',
|
|
@@ -1010,6 +1032,12 @@ export const exchangeRateType = {
|
|
|
1010
1032
|
Guaranteed: 'GUARANTEED',
|
|
1011
1033
|
MidMarket: 'MID_MARKET',
|
|
1012
1034
|
};
|
|
1035
|
+
export const exportJobStatus = {
|
|
1036
|
+
Completed: 'COMPLETED',
|
|
1037
|
+
Error: 'ERROR',
|
|
1038
|
+
Initialized: 'INITIALIZED',
|
|
1039
|
+
Processing: 'PROCESSING',
|
|
1040
|
+
};
|
|
1013
1041
|
export const externalServiceTokenType = {
|
|
1014
1042
|
StripePublishableToken: 'STRIPE_PUBLISHABLE_TOKEN',
|
|
1015
1043
|
};
|
|
@@ -1230,6 +1258,12 @@ export const landedCostAdjustmentType = {
|
|
|
1230
1258
|
Item: 'ITEM',
|
|
1231
1259
|
Shipping: 'SHIPPING',
|
|
1232
1260
|
};
|
|
1261
|
+
export const landedCostBillingPartyType = {
|
|
1262
|
+
Customer: 'CUSTOMER',
|
|
1263
|
+
Merchant: 'MERCHANT',
|
|
1264
|
+
ThirdParty: 'THIRD_PARTY',
|
|
1265
|
+
Zonos: 'ZONOS',
|
|
1266
|
+
};
|
|
1233
1267
|
export const landedCostCalculationMethod = {
|
|
1234
1268
|
Dap: 'DAP',
|
|
1235
1269
|
Ddp: 'DDP',
|
|
@@ -1252,9 +1286,12 @@ export const landedCostFeeType = {
|
|
|
1252
1286
|
CurrencyConversionFee: 'CURRENCY_CONVERSION_FEE',
|
|
1253
1287
|
DdpServiceFee: 'DDP_SERVICE_FEE',
|
|
1254
1288
|
Duty: 'DUTY',
|
|
1289
|
+
InclusivePriceAdjustment: 'INCLUSIVE_PRICE_ADJUSTMENT',
|
|
1290
|
+
InclusivePricing: 'INCLUSIVE_PRICING',
|
|
1255
1291
|
Item: 'ITEM',
|
|
1256
1292
|
Other: 'OTHER',
|
|
1257
1293
|
Shipping: 'SHIPPING',
|
|
1294
|
+
Tax: 'TAX',
|
|
1258
1295
|
ZonosLandedCostGuarantee: 'ZONOS_LANDED_COST_GUARANTEE',
|
|
1259
1296
|
};
|
|
1260
1297
|
export const landedCostGuaranteeCode = {
|
|
@@ -1568,10 +1605,6 @@ export const shipmentAmountType = {
|
|
|
1568
1605
|
PublishedRate: 'PUBLISHED_RATE',
|
|
1569
1606
|
Surcharge: 'SURCHARGE',
|
|
1570
1607
|
};
|
|
1571
|
-
export const shipmentBatchStatus = {
|
|
1572
|
-
Closed: 'CLOSED',
|
|
1573
|
-
Open: 'OPEN',
|
|
1574
|
-
};
|
|
1575
1608
|
export const shipmentCartonSpecialService = {
|
|
1576
1609
|
Alcohol: 'ALCOHOL',
|
|
1577
1610
|
BatteryInsideEquipment: 'BATTERY_INSIDE_EQUIPMENT',
|
|
@@ -1581,6 +1614,10 @@ export const shipmentCartonSpecialService = {
|
|
|
1581
1614
|
DryIce: 'DRY_ICE',
|
|
1582
1615
|
SignatureOption: 'SIGNATURE_OPTION',
|
|
1583
1616
|
};
|
|
1617
|
+
export const shipmentConsolidationStatus = {
|
|
1618
|
+
Closed: 'CLOSED',
|
|
1619
|
+
Open: 'OPEN',
|
|
1620
|
+
};
|
|
1584
1621
|
export const shipmentSpecialService = {
|
|
1585
1622
|
Consolidation: 'CONSOLIDATION',
|
|
1586
1623
|
CutFlowers: 'CUT_FLOWERS',
|
|
@@ -1696,6 +1733,7 @@ export const transitTypeCode = {
|
|
|
1696
1733
|
export const usageRecordTypeCode = {
|
|
1697
1734
|
ApiUsage: 'API_USAGE',
|
|
1698
1735
|
LcgInvoicing: 'LCG_INVOICING',
|
|
1736
|
+
OrderComplete: 'ORDER_COMPLETE',
|
|
1699
1737
|
OrderTransactionInvoicing: 'ORDER_TRANSACTION_INVOICING',
|
|
1700
1738
|
};
|
|
1701
1739
|
export const visibilityCode = {
|
|
@@ -1741,9 +1779,19 @@ export const wcoVersion = {
|
|
|
1741
1779
|
Wco_1997: 'WCO_1997',
|
|
1742
1780
|
Wco_2002: 'WCO_2002',
|
|
1743
1781
|
Wco_2007: 'WCO_2007',
|
|
1782
|
+
Wco_2012: 'WCO_2012',
|
|
1744
1783
|
Wco_2017: 'WCO_2017',
|
|
1745
1784
|
Wco_2022: 'WCO_2022',
|
|
1746
1785
|
Wco_2027: 'WCO_2027',
|
|
1786
|
+
Wco_2032: 'WCO_2032',
|
|
1787
|
+
Wco_2037: 'WCO_2037',
|
|
1788
|
+
Wco_2042: 'WCO_2042',
|
|
1789
|
+
Wco_2047: 'WCO_2047',
|
|
1790
|
+
Wco_2052: 'WCO_2052',
|
|
1791
|
+
Wco_2057: 'WCO_2057',
|
|
1792
|
+
Wco_2062: 'WCO_2062',
|
|
1793
|
+
Wco_2067: 'WCO_2067',
|
|
1794
|
+
Wco_2072: 'WCO_2072',
|
|
1747
1795
|
};
|
|
1748
1796
|
export const weightUnitCode = {
|
|
1749
1797
|
Gram: 'GRAM',
|
|
@@ -417,17 +417,14 @@ export const promptBulkJobStatusEnum = {
|
|
|
417
417
|
const defaultWrapper = (action, _operationName, _operationType) => action();
|
|
418
418
|
export function getSdk(client, withWrapper = defaultWrapper) {
|
|
419
419
|
return {
|
|
420
|
-
Cart(variables, requestHeaders) {
|
|
421
|
-
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'Cart', 'query');
|
|
422
|
-
},
|
|
423
420
|
CreateErrorEvent(variables, requestHeaders) {
|
|
424
421
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'CreateErrorEvent', 'mutation');
|
|
425
422
|
},
|
|
426
423
|
DeleteAllStoreReserveOrders(variables, requestHeaders) {
|
|
427
424
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'DeleteAllStoreReserveOrders', 'mutation');
|
|
428
425
|
},
|
|
429
|
-
|
|
430
|
-
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), '
|
|
426
|
+
DeleteBigCommerceSettings(variables, requestHeaders) {
|
|
427
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'DeleteBigCommerceSettings', 'mutation');
|
|
431
428
|
},
|
|
432
429
|
DeleteOrderImportLock(variables, requestHeaders) {
|
|
433
430
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'DeleteOrderImportLock', 'mutation');
|
|
@@ -438,17 +435,17 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
438
435
|
GetAudienceByAspectKey(variables, requestHeaders) {
|
|
439
436
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'GetAudienceByAspectKey', 'query');
|
|
440
437
|
},
|
|
441
|
-
|
|
442
|
-
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), '
|
|
443
|
-
},
|
|
444
|
-
GetCheckoutReserveOrders(variables, requestHeaders) {
|
|
445
|
-
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'GetCheckoutReserveOrders', 'query');
|
|
438
|
+
GetBigCommerceSettings(variables, requestHeaders) {
|
|
439
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'GetBigCommerceSettings', 'query');
|
|
446
440
|
},
|
|
447
441
|
GetReserveOrder(variables, requestHeaders) {
|
|
448
442
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'GetReserveOrder', 'query');
|
|
449
443
|
},
|
|
450
|
-
|
|
451
|
-
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), '
|
|
444
|
+
GetSettingsReserveOrders(variables, requestHeaders) {
|
|
445
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'GetSettingsReserveOrders', 'query');
|
|
446
|
+
},
|
|
447
|
+
InsertBigCommerceSettingsEvent(variables, requestHeaders) {
|
|
448
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'InsertBigCommerceSettingsEvent', 'mutation');
|
|
452
449
|
},
|
|
453
450
|
InsertOrderImportLock(variables, requestHeaders) {
|
|
454
451
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'InsertOrderImportLock', 'mutation');
|
|
@@ -456,17 +453,26 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
456
453
|
InsertReserveOrder(variables, requestHeaders) {
|
|
457
454
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'InsertReserveOrder', 'mutation');
|
|
458
455
|
},
|
|
459
|
-
|
|
460
|
-
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), '
|
|
456
|
+
InsertReserveOrderEvent(variables, requestHeaders) {
|
|
457
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'InsertReserveOrderEvent', 'mutation');
|
|
461
458
|
},
|
|
462
459
|
LocaleCountryMessages(variables, requestHeaders) {
|
|
463
460
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'LocaleCountryMessages', 'query');
|
|
464
461
|
},
|
|
462
|
+
UpdateCacheStoreVersion(variables, requestHeaders) {
|
|
463
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'UpdateCacheStoreVersion', 'mutation');
|
|
464
|
+
},
|
|
465
465
|
UpdateReserveOrder(variables, requestHeaders) {
|
|
466
466
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'UpdateReserveOrder', 'mutation');
|
|
467
467
|
},
|
|
468
|
-
|
|
469
|
-
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), '
|
|
468
|
+
UpsertBigCommerceSettings(variables, requestHeaders) {
|
|
469
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'UpsertBigCommerceSettings', 'mutation');
|
|
470
|
+
},
|
|
471
|
+
cleanupTestZonosElementSetting(variables, requestHeaders) {
|
|
472
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'cleanupTestZonosElementSetting', 'mutation');
|
|
473
|
+
},
|
|
474
|
+
zonosElementsSetting(variables, requestHeaders) {
|
|
475
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'zonosElementsSetting', 'query');
|
|
470
476
|
},
|
|
471
477
|
};
|
|
472
478
|
}
|
|
@@ -3180,7 +3180,7 @@ const handleFetch = async (url, _opts) => {
|
|
|
3180
3180
|
const opts = __rest(_opts || {}, []);
|
|
3181
3181
|
const body = opts.body ? JSON.stringify(opts.body) : undefined;
|
|
3182
3182
|
const method = opts.method || 'GET';
|
|
3183
|
-
// adding
|
|
3183
|
+
// adding random encoded token to the url so that the request will be cached differently for each store
|
|
3184
3184
|
const modifiedUrl = new URL(url);
|
|
3185
3185
|
modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
|
|
3186
3186
|
// headers content type
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
|
|
2
2
|
import { s as stripeStore, p as stripeStoreRetrievePayment, o as stripeStoreReset, c as cartStore } from './cart.js';
|
|
3
|
-
import { h as handleFetch,
|
|
3
|
+
import { h as handleFetch, t as translate } from './localization.js';
|
|
4
|
+
import { z as zonosStore } from './zonosStore.js';
|
|
4
5
|
import { g as getBorderRadius } from './getBorderRadius.js';
|
|
5
6
|
import { s as submitGtag } from './submitGtag.js';
|
|
6
7
|
import { d as defineCustomElement$4 } from './zonos-button2.js';
|
|
@@ -28,17 +29,11 @@ const ZonosCheckoutFinish = /*@__PURE__*/ proxyCustomElement(class ZonosCheckout
|
|
|
28
29
|
if (errors.length || !(json === null || json === void 0 ? void 0 : json.id)) {
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
const orderId = json === null || json === void 0 ? void 0 : json.id;
|
|
34
|
-
const storeHash = (_b = (_a = json === null || json === void 0 ? void 0 : json.metadata) === null || _a === void 0 ? void 0 : _a.find(x => (x === null || x === void 0 ? void 0 : x.key) === 'storeHash')) === null || _b === void 0 ? void 0 : _b.value;
|
|
35
|
-
if (!orderId || !storeHash) {
|
|
36
|
-
return logError('Unable to trigger BigCommerce /success: Missing orderId or storeHash');
|
|
37
|
-
}
|
|
38
|
-
void handleFetch(`${baseUrl}/api/bigcommerce/success?orderId=${orderId}&storeHash=${storeHash}`);
|
|
39
|
-
}
|
|
32
|
+
// onOrderSuccess callback may be provided on Zonos.init
|
|
33
|
+
await ((_b = (_a = zonosStore.checkoutSettings).onOrderSuccess) === null || _b === void 0 ? void 0 : _b.call(_a, json));
|
|
40
34
|
return json;
|
|
41
35
|
};
|
|
36
|
+
// TODO: This method of pulling orders is temporary. Once we have a working event registry system, we will rely on that to tell us when the order is ready to trigger onOrderSuccess
|
|
42
37
|
this.getPullOrder = async (attempts = 0) => {
|
|
43
38
|
const order = await this.pullOrder();
|
|
44
39
|
if (order) {
|