@zonos/elements 1.3.7-alpha.0 → 1.3.7-alpha.1
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-ecc80eb0.js → cart-89d9fff4.js} +150 -95
- package/dist/cjs/formatStringWithLinks-52341fc7.js +17 -0
- package/dist/cjs/{getBorderRadius-834c321d.js → getBorderRadius-d8f18958.js} +1 -1
- package/dist/cjs/{isDarkColor-924e6a7a.js → isDarkColor-57860b44.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/submitGtag-24740560.js +55 -0
- package/dist/cjs/zonos-address_4.cjs.entry.js +20 -14
- package/dist/cjs/zonos-badge_2.cjs.entry.js +6 -6
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +8 -8
- package/dist/cjs/zonos-card_2.cjs.entry.js +8 -8
- package/dist/cjs/zonos-cart-items_9.cjs.entry.js +35 -33
- package/dist/cjs/zonos-checkout.cjs.entry.js +158 -21
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +28 -8
- package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-select_3.cjs.entry.js +18 -10
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +9 -7
- package/dist/cjs/zonos-hello.cjs.entry.js +24 -9
- package/dist/cjs/zonos-link.cjs.entry.js +24 -0
- package/dist/cjs/zonos-logo.cjs.entry.js +3 -3
- package/dist/cjs/zonos-notification.cjs.entry.js +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +5 -5
- package/dist/cjs/zonos-select-dialog-header_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
- package/dist/cjs/zonos-text.cjs.entry.js +1 -1
- package/dist/cjs/{zonosStore-49d4c92a.js → zonosStore-138c5555.js} +5 -3
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +1 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +19 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +39 -18
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +2 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +1 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +5 -0
- package/dist/collection/components/common/component-template/zonos-link/zonos-link.css +54 -0
- package/dist/collection/components/common/component-template/zonos-link/zonos-link.js +97 -0
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.css +2 -0
- package/dist/collection/components/common/zonos-button/zonos-button.js +4 -4
- package/dist/collection/components/common/zonos-card/zonos-card.js +2 -2
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +13 -6
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +8 -2
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +4 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +1 -1
- package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +50 -11
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +5 -3
- package/dist/collection/components/main/zonos-controller.js +1 -1
- package/dist/collection/components/store/checkout/cart.js +2 -2
- package/dist/collection/components/store/checkout/stripe.js +26 -4
- package/dist/collection/components/store/hello/localization.js +7 -6
- package/dist/collection/components/store/zonosStore.js +5 -3
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -1
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
- package/dist/collection/components/utils/api/trackConversionEvent.js +22 -0
- package/dist/collection/components/utils/checkout/isShippableCountry.js +15 -0
- package/dist/collection/components/utils/checkout/watchBigcommerceDomesticCheckout.js +111 -0
- package/dist/collection/components/utils/formatStringWithLinks.js +13 -0
- package/dist/collection/components/utils/handleFetch.js +1 -1
- package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +25 -28
- package/dist/collection/components/utils/hello/currencyConversion/getCurrencyElements.js +2 -1
- package/dist/collection/components/utils/hello/currencyConversion/getInitialElementAmount.js +8 -6
- package/dist/collection/components/utils/hello/initHello.js +23 -3
- package/dist/collection/components/utils/logging/log.js +20 -9
- package/dist/collection/components/utils/logging/logError.js +2 -1
- package/dist/collection/components/utils/logging/sendErrorLog.js +12 -0
- package/dist/collection/scripts/checkIfLoadVersionDomain.js +35 -0
- package/dist/collection/scripts/zonosBase.js +21 -31
- package/dist/collection/styles/stripe/addressRuleStyle.js +4 -0
- package/dist/collection/types/generated/graphql.customer.types.js +1 -4
- package/dist/collection/types/generated/graphql.frontend.types.js +3 -0
- package/dist/components/stripe.js +145 -93
- package/dist/components/trackConversionEvent.js +24 -0
- package/dist/components/zonos-address2.js +1 -1
- package/dist/components/zonos-badge2.js +3 -3
- package/dist/components/zonos-button2.js +5 -5
- package/dist/components/zonos-card2.js +2 -2
- package/dist/components/zonos-cart-subtotal2.js +1 -6
- package/dist/components/zonos-checkbox2.js +3 -3
- package/dist/components/zonos-checkout-finish2.js +32 -12
- package/dist/components/zonos-checkout-payment2.js +1 -1
- package/dist/components/zonos-checkout.js +157 -18
- package/dist/components/zonos-collapse2.js +13 -6
- package/dist/components/zonos-component.js +1 -1
- package/dist/components/zonos-controller.js +25 -5
- package/dist/components/zonos-country-select2.js +9 -3
- package/dist/components/zonos-custom-message2.js +18 -3
- package/dist/components/zonos-customer-info2.js +3 -1
- package/dist/components/zonos-dialog2.js +3 -3
- package/dist/components/zonos-hello-dialog-footer2.js +2 -2
- package/dist/components/zonos-hello-dialog2.js +6 -5
- package/dist/components/zonos-hello.js +23 -7
- package/dist/components/zonos-language-select2.js +3 -3
- package/dist/components/zonos-link-authentication2.js +1 -1
- package/dist/components/zonos-link.d.ts +11 -0
- package/dist/components/zonos-link.js +43 -0
- package/dist/components/zonos-logo.js +2 -2
- package/dist/components/zonos-payment2.js +1 -1
- package/dist/components/zonos-review2.js +1 -6
- package/dist/components/zonos-select-dialog-header2.js +2 -2
- package/dist/components/zonos-shipping-rich-radio2.js +1 -1
- package/dist/components/zonos-shipping2.js +7 -2
- package/dist/components/zonos-tooltip2.js +2 -2
- package/dist/components/zonos-v-stack2.js +2 -2
- package/dist/components/zonosStore.js +5 -3
- package/dist/esm/{cart-2a0a6871.js → cart-1bbb7662.js} +148 -96
- package/dist/esm/formatStringWithLinks-9e819405.js +15 -0
- package/dist/esm/{getBorderRadius-0c7dfcf0.js → getBorderRadius-19787feb.js} +1 -1
- package/dist/esm/{isDarkColor-d0a57fd2.js → isDarkColor-2344e7a5.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/submitGtag-d3d11f1a.js +51 -0
- package/dist/esm/zonos-address_4.entry.js +20 -14
- package/dist/esm/zonos-badge_2.entry.js +6 -6
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +8 -8
- package/dist/esm/zonos-card_2.entry.js +8 -8
- package/dist/esm/zonos-cart-items_9.entry.js +35 -33
- package/dist/esm/zonos-checkout.entry.js +158 -21
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +28 -8
- package/dist/esm/zonos-country-flag.entry.js +4 -4
- package/dist/esm/zonos-country-select_3.entry.js +19 -11
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +9 -7
- package/dist/esm/zonos-hello.entry.js +24 -9
- package/dist/esm/zonos-link.entry.js +20 -0
- package/dist/esm/zonos-logo.entry.js +3 -3
- package/dist/esm/zonos-notification.entry.js +1 -1
- package/dist/esm/zonos-payment.entry.js +5 -5
- package/dist/esm/zonos-select-dialog-header_2.entry.js +5 -5
- package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/{zonosStore-dec6bd7e.js → zonosStore-00bce01b.js} +5 -3
- package/dist/esm-es5/{cart-2a0a6871.js → cart-1bbb7662.js} +1 -1
- package/dist/esm-es5/formatStringWithLinks-9e819405.js +1 -0
- package/dist/esm-es5/{getBorderRadius-0c7dfcf0.js → getBorderRadius-19787feb.js} +1 -1
- package/dist/esm-es5/{isDarkColor-d0a57fd2.js → isDarkColor-2344e7a5.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/submitGtag-d3d11f1a.js +1 -0
- package/dist/esm-es5/zonos-address_4.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_9.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-component.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-link.entry.js +1 -0
- 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-dec6bd7e.js → zonosStore-00bce01b.js} +1 -1
- package/dist/scripts/checkIfLoadVersionDomain.js +1 -0
- package/dist/scripts/loadStripe.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/stripe.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/scripts/zonosBase.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +1 -1
- package/dist/types/components/common/component-template/zonos-link/zonos-link.d.ts +19 -0
- package/dist/types/components/common/zonos-collapse/zonos-collapse.d.ts +1 -0
- package/dist/types/components/common/zonos-country-select/zonos-country-select.d.ts +2 -0
- package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +9 -3
- package/dist/types/components/store/checkout/cart.d.ts +6 -3
- package/dist/types/components/store/checkout/stripe.d.ts +22 -1
- package/dist/types/components/store/hello/localization.d.ts +1 -1
- package/dist/types/components/store/zonosStore.d.ts +1 -0
- package/dist/types/components/utils/api/trackConversionEvent.d.ts +3 -0
- package/dist/types/components/utils/checkout/isShippableCountry.d.ts +1 -0
- package/dist/types/components/utils/checkout/watchBigcommerceDomesticCheckout.d.ts +20 -0
- package/dist/types/components/utils/formatStringWithLinks.d.ts +1 -0
- package/dist/types/components/utils/hello/currencyConversion/getCurrencyElements.d.ts +1 -1
- package/dist/types/components/utils/logging/log.d.ts +1 -1
- package/dist/types/components/utils/logging/sendErrorLog.d.ts +7 -0
- package/dist/types/components.d.ts +53 -3
- package/dist/types/scripts/checkIfLoadVersionDomain.d.ts +13 -0
- package/dist/types/scripts/zonosBase.d.ts +2 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +1 -1
- package/dist/types/types/generated/graphql.customer.types.d.ts +8 -53
- package/dist/types/types/generated/graphql.customer.types.ts +18 -62
- package/dist/types/types/generated/graphql.frontend.types.d.ts +8 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +18 -0
- package/dist/zonos-elements/p-0318632a.entry.js +1 -0
- package/dist/zonos-elements/p-066c5893.system.js +1 -1
- package/dist/zonos-elements/p-07966463.entry.js +1 -0
- package/dist/zonos-elements/p-0c0aa552.js +1 -0
- package/dist/zonos-elements/p-127b480c.entry.js +1 -0
- package/dist/zonos-elements/p-135ab559.system.entry.js +1 -0
- package/dist/zonos-elements/{p-e855966f.system.entry.js → p-143dc0d9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-55970b10.system.entry.js → p-14d27ce1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-a93c594f.entry.js → p-15a80c4a.entry.js} +1 -1
- package/dist/zonos-elements/p-17e87be1.entry.js +1 -0
- package/dist/zonos-elements/{p-a95c034c.entry.js → p-1e0dd491.entry.js} +1 -1
- package/dist/zonos-elements/{p-34efed1d.entry.js → p-279d1c5f.entry.js} +1 -1
- package/dist/zonos-elements/p-2d6557ee.system.js +1 -0
- package/dist/zonos-elements/p-314be538.system.entry.js +1 -0
- package/dist/zonos-elements/{p-79b910bf.system.entry.js → p-328b7f6f.system.entry.js} +1 -1
- package/dist/zonos-elements/p-354603b3.system.entry.js +1 -0
- package/dist/zonos-elements/{p-591eb6dd.system.js → p-49f6a985.system.js} +1 -1
- package/dist/zonos-elements/p-57b65321.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5b44abc8.system.js → p-58c1ddef.system.js} +1 -1
- package/dist/zonos-elements/{p-06652d87.system.entry.js → p-58e2f6a1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7d1d862f.system.entry.js → p-5ee03db0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-88a55076.system.entry.js → p-61e5cf29.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-67737613.system.entry.js → p-799d8a17.system.entry.js} +1 -1
- package/dist/zonos-elements/p-7a32526c.entry.js +1 -0
- package/dist/zonos-elements/p-7b87b82f.js +1 -0
- package/dist/zonos-elements/{p-e2770968.system.entry.js → p-7c45ce37.system.entry.js} +1 -1
- package/dist/zonos-elements/p-84f4f00f.entry.js +1 -0
- package/dist/zonos-elements/{p-2d2e1831.entry.js → p-857cfe35.entry.js} +1 -1
- package/dist/zonos-elements/{p-dfd3edcf.entry.js → p-87e9c42f.entry.js} +1 -1
- package/dist/zonos-elements/{p-ec4d08b3.system.js → p-91797d4e.system.js} +1 -1
- package/dist/zonos-elements/{p-34c03be2.js → p-95e0fc06.js} +1 -1
- package/dist/zonos-elements/{p-afe40057.entry.js → p-a3cc0f84.entry.js} +1 -1
- package/dist/zonos-elements/p-a5f12396.entry.js +1 -0
- package/dist/zonos-elements/p-a87561b8.js +1 -0
- package/dist/zonos-elements/{p-e161a08c.entry.js → p-ac0a7b8f.entry.js} +1 -1
- package/dist/zonos-elements/{p-9878a770.js → p-ae82a9ae.js} +1 -1
- package/dist/zonos-elements/p-b0462325.system.entry.js +1 -0
- package/dist/zonos-elements/{p-1f85a98c.system.entry.js → p-b2c0ec71.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-549c181b.system.js → p-b4725505.system.js} +1 -1
- package/dist/zonos-elements/p-bef54fb1.entry.js +1 -0
- package/dist/zonos-elements/{p-0c72fb79.system.entry.js → p-c0d431f6.system.entry.js} +1 -1
- package/dist/zonos-elements/p-d054788b.system.js +1 -0
- package/dist/zonos-elements/{p-375c472a.system.entry.js → p-d407c93a.system.entry.js} +1 -1
- package/dist/zonos-elements/p-e55dd932.js +1 -0
- package/dist/zonos-elements/p-ec37439e.entry.js +1 -0
- package/dist/zonos-elements/p-edace42b.entry.js +1 -0
- package/dist/zonos-elements/{p-cc63a29f.system.entry.js → p-f478c814.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8aeb4679.system.entry.js → p-f6eaef7b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c7098c3b.entry.js → p-f7c36fcc.entry.js} +1 -1
- package/dist/zonos-elements/p-f862b97f.system.entry.js +1 -0
- package/dist/zonos-elements/p-fd642725.entry.js +1 -0
- package/dist/zonos-elements/p-fdb72530.system.entry.js +1 -0
- package/dist/zonos-elements/{p-a4de3fb2.entry.js → p-ff64ddc5.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/submitGtag-907e71d3.js +0 -21
- package/dist/collection/scripts/extractZonosQaUrl.js +0 -26
- package/dist/esm/submitGtag-a38aed23.js +0 -19
- package/dist/esm-es5/submitGtag-a38aed23.js +0 -1
- package/dist/types/scripts/extractZonosQaUrl.d.ts +0 -11
- package/dist/zonos-elements/p-0057e374.entry.js +0 -1
- package/dist/zonos-elements/p-290c3670.entry.js +0 -1
- package/dist/zonos-elements/p-2f1e1cbb.system.entry.js +0 -1
- package/dist/zonos-elements/p-33080cde.system.entry.js +0 -1
- package/dist/zonos-elements/p-561e44d6.entry.js +0 -1
- package/dist/zonos-elements/p-5c4dc123.js +0 -1
- package/dist/zonos-elements/p-656c836b.entry.js +0 -1
- package/dist/zonos-elements/p-8d645a00.entry.js +0 -1
- package/dist/zonos-elements/p-a219689f.entry.js +0 -1
- package/dist/zonos-elements/p-a3d72a33.entry.js +0 -1
- package/dist/zonos-elements/p-b10ff468.entry.js +0 -1
- package/dist/zonos-elements/p-b6992dc2.system.entry.js +0 -1
- package/dist/zonos-elements/p-bce46c41.js +0 -1
- package/dist/zonos-elements/p-c56d4a44.entry.js +0 -1
- package/dist/zonos-elements/p-cbb1e700.system.js +0 -1
- package/dist/zonos-elements/p-cd8bd5e9.system.entry.js +0 -1
- package/dist/zonos-elements/p-d36faf87.system.entry.js +0 -1
- package/dist/zonos-elements/p-e2c6ad57.entry.js +0 -1
- package/dist/zonos-elements/p-ea93943a.system.entry.js +0 -1
- package/dist/zonos-elements/p-f455e08c.js +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the load version and url based on the loadScriptSrc and version
|
|
3
|
+
* @returns
|
|
4
|
+
*/
|
|
5
|
+
export const checkIfLoadVersionDomain = ({ loadScriptSrc }) => {
|
|
6
|
+
if (!loadScriptSrc) {
|
|
7
|
+
return {
|
|
8
|
+
currentLoadScriptUrl: '',
|
|
9
|
+
isForceLoadVersionDomain: false,
|
|
10
|
+
isWhiteListed: false,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const whiteListedDomains = [
|
|
14
|
+
// local domain
|
|
15
|
+
'dev.elements.zonos.com',
|
|
16
|
+
// any domain with prefix , no need to version it
|
|
17
|
+
'.js.zonos.com',
|
|
18
|
+
// vercel git domain
|
|
19
|
+
'zonos-elements-test-git',
|
|
20
|
+
'zonos-elements-git',
|
|
21
|
+
];
|
|
22
|
+
const forceLoadVersionDomain = [
|
|
23
|
+
// force load version for qa domain, this is to test the load version behavior
|
|
24
|
+
'qa.js.zonos.com',
|
|
25
|
+
];
|
|
26
|
+
// get the domain that's used to load the loadZonos.js
|
|
27
|
+
const currentLoadScriptUrl = new URL(loadScriptSrc).origin;
|
|
28
|
+
const isWhiteListed = whiteListedDomains.some(domain =>
|
|
29
|
+
// check if the current domain is in the white listed domains
|
|
30
|
+
currentLoadScriptUrl.includes(domain));
|
|
31
|
+
const isForceLoadVersionDomain = forceLoadVersionDomain.some(domain =>
|
|
32
|
+
// check if the current domain is in the force load version domains list
|
|
33
|
+
currentLoadScriptUrl.includes(domain));
|
|
34
|
+
return { currentLoadScriptUrl, isForceLoadVersionDomain, isWhiteListed };
|
|
35
|
+
};
|
|
@@ -1,39 +1,22 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { log } from "../components/utils/logging/log";
|
|
3
3
|
import { logError } from "../components/utils/logging/logError";
|
|
4
|
-
import {
|
|
4
|
+
import { checkIfLoadVersionDomain } from "./checkIfLoadVersionDomain";
|
|
5
5
|
import { zonosLoadStripe } from "./loadStripe";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
|
-
console.warn(`[ZONOS-WARNING] using '${fullUrl}' for loading script`);
|
|
15
|
-
// request to the url and check if the request has an error
|
|
16
|
-
void fetch(fullUrl)
|
|
17
|
-
.then(() => {
|
|
18
|
-
// cleanup checkout session to avoid using the prod session in preview domain
|
|
19
|
-
window.sessionStorage.removeItem('zonos--checkout-session-id');
|
|
20
|
-
window.sessionStorage.removeItem('zonos--client-secret');
|
|
21
|
-
})
|
|
22
|
-
.catch(() => {
|
|
23
|
-
// eslint-disable-next-line no-console
|
|
24
|
-
alert(`[ZONOS-WARNING] '${fullUrl}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);
|
|
25
|
-
// remove the zonosQaUrl param from url
|
|
26
|
-
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
27
|
-
urlSearchParams.delete('zonosQaUrl');
|
|
28
|
-
const { pathname } = window.location;
|
|
29
|
-
const newUrl = `${pathname}?${urlSearchParams.toString()}`;
|
|
30
|
-
window.history.replaceState({}, '', newUrl);
|
|
31
|
-
window.location.reload();
|
|
32
|
-
return null;
|
|
6
|
+
/**
|
|
7
|
+
* Get the load version and url based on the loadScriptSrc, if the domain that used to load `zonos.js` is in white listed domains, use currentLoadScriptUrl as the load url instead, if zonosQaUrl exists, it would also fall under the white listed domain
|
|
8
|
+
*/
|
|
9
|
+
const zonosLoadUrl = (() => {
|
|
10
|
+
const scriptExist = document.querySelector(`script[src*="/zonos.js"]`);
|
|
11
|
+
const { currentLoadScriptUrl, isWhiteListed } = checkIfLoadVersionDomain({
|
|
12
|
+
loadScriptSrc: scriptExist === null || scriptExist === void 0 ? void 0 : scriptExist.src,
|
|
33
13
|
});
|
|
34
|
-
|
|
14
|
+
if (isWhiteListed) {
|
|
15
|
+
return currentLoadScriptUrl;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
35
18
|
})();
|
|
36
|
-
const ZONOS_URL =
|
|
19
|
+
const ZONOS_URL = zonosLoadUrl || process.env.NEXT_PUBLIC_ZONOS_CDN_URL;
|
|
37
20
|
const UNPKG_ZONOS_URL = process.env.NEXT_PUBLIC_ZONOS_UNPKG_CDN_URL;
|
|
38
21
|
const INTER_FONT_URL = 'https://rsms.me';
|
|
39
22
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
@@ -46,7 +29,7 @@ Zonos.doneInit = false;
|
|
|
46
29
|
Zonos.debug = !!window.location.search.match(/\?.*(&*)zonosDebug=1/);
|
|
47
30
|
Zonos.isBigCommerce = false;
|
|
48
31
|
Zonos.internationalHideSelector = '';
|
|
49
|
-
Zonos.zonosQaUrl =
|
|
32
|
+
Zonos.zonosQaUrl = null;
|
|
50
33
|
Zonos.version = `v${process.env.NEXT_PUBLIC_ZONOS_PACKAGE_VERSION}`;
|
|
51
34
|
Zonos.modeAlerted = false;
|
|
52
35
|
Zonos.getCurrentTimestamp = () => new Date().getTime();
|
|
@@ -90,6 +73,13 @@ Zonos.displayCurrency = () => {
|
|
|
90
73
|
void zonosHello.displayCurrency();
|
|
91
74
|
}
|
|
92
75
|
};
|
|
76
|
+
// Called openHelloDialog because the main use case is to simply open the dialog
|
|
77
|
+
Zonos.openHelloDialog = (value) => {
|
|
78
|
+
const zonosHello = document.querySelector('zonos-hello');
|
|
79
|
+
if (zonosHello) {
|
|
80
|
+
void zonosHello.openHelloDialog(value !== null && value !== void 0 ? value : true);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
93
83
|
Zonos.showNotification = (notification) => {
|
|
94
84
|
var _b;
|
|
95
85
|
void ((_b = _a.zonosController) === null || _b === void 0 ? void 0 : _b.showNotification(notification));
|
|
@@ -3,6 +3,7 @@ export const addressRuleStyle = ({ theme, }) => {
|
|
|
3
3
|
default:
|
|
4
4
|
return {
|
|
5
5
|
'.Input': {
|
|
6
|
+
boxShadow: 'none',
|
|
6
7
|
// need to reset everything and the paddingTop to default, otherwise the paddingTop will not be updated.
|
|
7
8
|
padding: '0',
|
|
8
9
|
paddingBottom: '8px',
|
|
@@ -11,6 +12,9 @@ export const addressRuleStyle = ({ theme, }) => {
|
|
|
11
12
|
// any value here will be add up to the default paddingTop (20px).
|
|
12
13
|
paddingTop: '6px',
|
|
13
14
|
},
|
|
15
|
+
'.Input:focus': {
|
|
16
|
+
boxShadow: 'none',
|
|
17
|
+
},
|
|
14
18
|
};
|
|
15
19
|
}
|
|
16
20
|
};
|
|
@@ -1014,6 +1014,7 @@ export const emailTemplateStatus = {
|
|
|
1014
1014
|
};
|
|
1015
1015
|
export const emailTemplateType = {
|
|
1016
1016
|
AbandonedCart: 'ABANDONED_CART',
|
|
1017
|
+
CatalogExport: 'CATALOG_EXPORT',
|
|
1017
1018
|
OrderCanceled: 'ORDER_CANCELED',
|
|
1018
1019
|
OrderConfirmation: 'ORDER_CONFIRMATION',
|
|
1019
1020
|
OrderReceipt: 'ORDER_RECEIPT',
|
|
@@ -1209,10 +1210,6 @@ export const invoiceLanguageCode = {
|
|
|
1209
1210
|
ZhHk: 'ZH_HK',
|
|
1210
1211
|
ZhTw: 'ZH_TW',
|
|
1211
1212
|
};
|
|
1212
|
-
export const invoiceLineRecordBehaviorCode = {
|
|
1213
|
-
Finalize: 'FINALIZE',
|
|
1214
|
-
Pending: 'PENDING',
|
|
1215
|
-
};
|
|
1216
1213
|
export const invoiceLineRecordStatusCode = {
|
|
1217
1214
|
Failed: 'FAILED',
|
|
1218
1215
|
Pending: 'PENDING',
|
|
@@ -474,6 +474,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
474
474
|
cleanupTestZonosElementSetting(variables, requestHeaders) {
|
|
475
475
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'cleanupTestZonosElementSetting', 'mutation');
|
|
476
476
|
},
|
|
477
|
+
insertConversionEvent(variables, requestHeaders) {
|
|
478
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'insertConversionEvent', 'mutation');
|
|
479
|
+
},
|
|
477
480
|
zonosElementsSetting(variables, requestHeaders) {
|
|
478
481
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'zonosElementsSetting', 'query');
|
|
479
482
|
},
|
|
@@ -3546,7 +3546,7 @@ const handleFetch = async (url, _opts) => {
|
|
|
3546
3546
|
const modifiedUrl = new URL(url);
|
|
3547
3547
|
modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
|
|
3548
3548
|
// headers content type
|
|
3549
|
-
const headers = Object.assign({ 'Content-Type': 'application/json', 'Zonos-Is-BigCommerce': window.Zonos.isBigCommerce.toString(), 'Zonos-Referer': window.location.hostname, 'Zonos-Version': window.Zonos.version, credentialtoken: window.Zonos.zonosApiKey }, opts.headers);
|
|
3549
|
+
const headers = Object.assign({ 'Content-Type': 'application/json', 'Zonos-Is-BigCommerce': window.Zonos.isBigCommerce.toString(), 'Zonos-Referer': window.location.hostname, 'Zonos-Version': window.Zonos.version, credentialtoken: window.Zonos.zonosApiKey || 'Empty credential token from zonos-elements' }, opts.headers);
|
|
3550
3550
|
const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
|
|
3551
3551
|
method });
|
|
3552
3552
|
return handleRequest(modifiedUrl.toString(), options);
|
|
@@ -3567,9 +3567,65 @@ const getCountries = async () => {
|
|
|
3567
3567
|
}
|
|
3568
3568
|
};
|
|
3569
3569
|
|
|
3570
|
+
const log = (message, type, ...additionalInfo) => {
|
|
3571
|
+
var _a, _b;
|
|
3572
|
+
const isDebug = !((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
|
|
3573
|
+
!window.location.search.match(/\?.*(&*)zonosDebug=1/);
|
|
3574
|
+
// if debug is false, do not log
|
|
3575
|
+
if (!isDebug) {
|
|
3576
|
+
// log errors to the console if the type is error
|
|
3577
|
+
if (type === 'error') {
|
|
3578
|
+
// eslint-disable-next-line no-console
|
|
3579
|
+
console.error(message, ...additionalInfo);
|
|
3580
|
+
}
|
|
3581
|
+
return;
|
|
3582
|
+
}
|
|
3583
|
+
let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
|
|
3584
|
+
if (!loggingIframe) {
|
|
3585
|
+
// add a hidden iframe
|
|
3586
|
+
loggingIframe = document.createElement('iframe');
|
|
3587
|
+
loggingIframe.id = 'zonos---debug-logging-iframe';
|
|
3588
|
+
loggingIframe.style.display = 'none';
|
|
3589
|
+
loggingIframe.style.opacity = '0';
|
|
3590
|
+
loggingIframe.style.position = 'absolute';
|
|
3591
|
+
loggingIframe.style.top = '-9999px';
|
|
3592
|
+
loggingIframe.style.left = '-9999px';
|
|
3593
|
+
loggingIframe.style.width = '1px';
|
|
3594
|
+
loggingIframe.style.height = '1px';
|
|
3595
|
+
loggingIframe.style.border = 'none';
|
|
3596
|
+
loggingIframe.style.overflow = 'hidden';
|
|
3597
|
+
loggingIframe.style.visibility = 'hidden';
|
|
3598
|
+
document.body.appendChild(loggingIframe);
|
|
3599
|
+
}
|
|
3600
|
+
// use the logging iframe's console to log just in case the console is disabled (overriden) by the site owner
|
|
3601
|
+
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
3602
|
+
switch (type) {
|
|
3603
|
+
case 'warn':
|
|
3604
|
+
// eslint-disable-next-line no-console
|
|
3605
|
+
zConsole.warn(message, ...additionalInfo);
|
|
3606
|
+
break;
|
|
3607
|
+
case 'info':
|
|
3608
|
+
// eslint-disable-next-line no-console
|
|
3609
|
+
zConsole.info(message, ...additionalInfo);
|
|
3610
|
+
break;
|
|
3611
|
+
case 'error':
|
|
3612
|
+
// eslint-disable-next-line no-console
|
|
3613
|
+
zConsole.error(message, ...additionalInfo);
|
|
3614
|
+
break;
|
|
3615
|
+
default:
|
|
3616
|
+
// eslint-disable-next-line no-console
|
|
3617
|
+
zConsole.groupCollapsed(message, ...additionalInfo);
|
|
3618
|
+
// eslint-disable-next-line no-console
|
|
3619
|
+
zConsole.trace();
|
|
3620
|
+
// eslint-disable-next-line no-console
|
|
3621
|
+
zConsole.groupEnd();
|
|
3622
|
+
break;
|
|
3623
|
+
}
|
|
3624
|
+
};
|
|
3625
|
+
|
|
3570
3626
|
const logError = (message, ...rest) => {
|
|
3571
3627
|
// eslint-disable-next-line no-console
|
|
3572
|
-
|
|
3628
|
+
log(message, 'error', ...rest);
|
|
3573
3629
|
};
|
|
3574
3630
|
|
|
3575
3631
|
const getCountryLandedCost = async (countryCode) => {
|
|
@@ -3731,51 +3787,6 @@ const isValidSelector = (selector) => {
|
|
|
3731
3787
|
return true;
|
|
3732
3788
|
};
|
|
3733
3789
|
|
|
3734
|
-
const log = (message, type, ...additionalInfo) => {
|
|
3735
|
-
var _a;
|
|
3736
|
-
// if type is error and debug is false, do not log
|
|
3737
|
-
if (!window.Zonos.debug) {
|
|
3738
|
-
return;
|
|
3739
|
-
}
|
|
3740
|
-
let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
|
|
3741
|
-
if (!loggingIframe) {
|
|
3742
|
-
// add a hidden iframe
|
|
3743
|
-
loggingIframe = document.createElement('iframe');
|
|
3744
|
-
loggingIframe.id = 'zonos---debug-logging-iframe';
|
|
3745
|
-
loggingIframe.style.display = 'none';
|
|
3746
|
-
loggingIframe.style.opacity = '0';
|
|
3747
|
-
loggingIframe.style.position = 'absolute';
|
|
3748
|
-
loggingIframe.style.top = '-9999px';
|
|
3749
|
-
loggingIframe.style.left = '-9999px';
|
|
3750
|
-
loggingIframe.style.width = '1px';
|
|
3751
|
-
loggingIframe.style.height = '1px';
|
|
3752
|
-
loggingIframe.style.border = 'none';
|
|
3753
|
-
loggingIframe.style.overflow = 'hidden';
|
|
3754
|
-
loggingIframe.style.visibility = 'hidden';
|
|
3755
|
-
document.body.appendChild(loggingIframe);
|
|
3756
|
-
}
|
|
3757
|
-
// use the logging iframe's console to log just in case the console is disabled (overriden) by the site owner
|
|
3758
|
-
const console = ((_a = loggingIframe.contentWindow) === null || _a === void 0 ? void 0 : _a.window.console) || window.console;
|
|
3759
|
-
switch (type) {
|
|
3760
|
-
case 'warn':
|
|
3761
|
-
// eslint-disable-next-line no-console
|
|
3762
|
-
console.warn(message, ...additionalInfo);
|
|
3763
|
-
break;
|
|
3764
|
-
case 'info':
|
|
3765
|
-
// eslint-disable-next-line no-console
|
|
3766
|
-
console.info(message, ...additionalInfo);
|
|
3767
|
-
break;
|
|
3768
|
-
default:
|
|
3769
|
-
// eslint-disable-next-line no-console
|
|
3770
|
-
console.groupCollapsed(message, ...additionalInfo);
|
|
3771
|
-
// eslint-disable-next-line no-console
|
|
3772
|
-
console.trace();
|
|
3773
|
-
// eslint-disable-next-line no-console
|
|
3774
|
-
console.groupEnd();
|
|
3775
|
-
break;
|
|
3776
|
-
}
|
|
3777
|
-
};
|
|
3778
|
-
|
|
3779
3790
|
const getCurrencyElements = (selector) => {
|
|
3780
3791
|
const currencySelector = selector || '.money';
|
|
3781
3792
|
if (!isValidSelector(currencySelector)) {
|
|
@@ -3789,18 +3800,21 @@ const getCurrencyElements = (selector) => {
|
|
|
3789
3800
|
log(`No currency elements found with selector "${currencySelector}"`, 'warn');
|
|
3790
3801
|
return null;
|
|
3791
3802
|
}
|
|
3792
|
-
return
|
|
3803
|
+
// return array of currency elements instead of a NodeList
|
|
3804
|
+
return Array.from(currencyElements);
|
|
3793
3805
|
};
|
|
3794
3806
|
|
|
3795
3807
|
const getInitialElementAmount = (element) => {
|
|
3796
3808
|
var _a;
|
|
3797
3809
|
const domesticValue = element.getAttribute('data-domestic');
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3810
|
+
const intlValue = element.getAttribute('data-zintl');
|
|
3811
|
+
// Only keep numbers, decimal, and hyphens
|
|
3812
|
+
const cleanedText = (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.replace(/[^\d.-]/g, '');
|
|
3813
|
+
if (!cleanedText) {
|
|
3814
|
+
return null;
|
|
3815
|
+
}
|
|
3816
|
+
// If the element has no data-domestic attribute, or the text content is different from the data-zintl attribute, set the data-domestic attribute
|
|
3817
|
+
if (!domesticValue || element.textContent !== intlValue) {
|
|
3804
3818
|
// Store the original value on the element once, and international on every new conversion
|
|
3805
3819
|
element.setAttribute('data-domestic', cleanedText);
|
|
3806
3820
|
return parseFloat(cleanedText);
|
|
@@ -3808,9 +3822,32 @@ const getInitialElementAmount = (element) => {
|
|
|
3808
3822
|
return parseFloat(domesticValue);
|
|
3809
3823
|
};
|
|
3810
3824
|
|
|
3825
|
+
const convertCurrency = (element) => {
|
|
3826
|
+
var _a;
|
|
3827
|
+
const amount = getInitialElementAmount(element);
|
|
3828
|
+
if (!amount || isNaN(amount)) {
|
|
3829
|
+
return;
|
|
3830
|
+
}
|
|
3831
|
+
const currentIntlValue = element.getAttribute('data-zintl');
|
|
3832
|
+
const currentCountryValue = element.getAttribute('data-zcountry-code');
|
|
3833
|
+
// do nothing if the target currency is the same
|
|
3834
|
+
const isExchangeRateReady = localizationStore.targetCurrency ===
|
|
3835
|
+
((_a = localizationStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.targetFormat.currencyCode);
|
|
3836
|
+
// if the current value on the element is different from the current intl value, update the data-zintl attribute
|
|
3837
|
+
if (isExchangeRateReady &&
|
|
3838
|
+
(element.textContent !== currentIntlValue ||
|
|
3839
|
+
currentCountryValue !== localizationStore.selectedCountryCode)) {
|
|
3840
|
+
const observedFormattedValue = currencyConvertAndFormat(amount);
|
|
3841
|
+
element.textContent = observedFormattedValue;
|
|
3842
|
+
// save the new value to the data-zintl attribute
|
|
3843
|
+
element.setAttribute('data-zintl', observedFormattedValue);
|
|
3844
|
+
element.setAttribute('data-zcountry-code', localizationStore.selectedCountryCode || '');
|
|
3845
|
+
}
|
|
3846
|
+
};
|
|
3811
3847
|
const defaultCurrencyConverter = () => {
|
|
3812
3848
|
const { currencyElementSelector } = zonosStore.helloSettings;
|
|
3813
3849
|
const currencyElements = getCurrencyElements(currencyElementSelector);
|
|
3850
|
+
// do nothing if none of the currency elements are found
|
|
3814
3851
|
if (!(currencyElements === null || currencyElements === void 0 ? void 0 : currencyElements.length)) {
|
|
3815
3852
|
return;
|
|
3816
3853
|
}
|
|
@@ -3819,33 +3856,8 @@ const defaultCurrencyConverter = () => {
|
|
|
3819
3856
|
return;
|
|
3820
3857
|
}
|
|
3821
3858
|
currencyElements.forEach((element) => {
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
return;
|
|
3825
|
-
}
|
|
3826
|
-
element.setAttribute('data-zintl', currencyConvert(amount).toString());
|
|
3827
|
-
// Check if an observer is already attached to the element
|
|
3828
|
-
let observer = element._mutationObserver;
|
|
3829
|
-
if (!observer) {
|
|
3830
|
-
observer = new MutationObserver(() => {
|
|
3831
|
-
const observedFormattedValue = currencyConvertAndFormat(amount);
|
|
3832
|
-
element.textContent = observedFormattedValue;
|
|
3833
|
-
});
|
|
3834
|
-
observer.observe(element, {
|
|
3835
|
-
characterData: true,
|
|
3836
|
-
childList: true,
|
|
3837
|
-
});
|
|
3838
|
-
element._mutationObserver = observer;
|
|
3839
|
-
}
|
|
3840
|
-
// Temporarily disconnect the observer to prevent an infinite loop
|
|
3841
|
-
observer.disconnect();
|
|
3842
|
-
const formattedValue = currencyConvertAndFormat(amount);
|
|
3843
|
-
element.textContent = formattedValue;
|
|
3844
|
-
// Reconnect the observer after the update is complete
|
|
3845
|
-
observer.observe(element, {
|
|
3846
|
-
characterData: true,
|
|
3847
|
-
childList: true,
|
|
3848
|
-
});
|
|
3859
|
+
// convert the currency and save the formatted value to the data-zintl attribute
|
|
3860
|
+
convertCurrency(element);
|
|
3849
3861
|
});
|
|
3850
3862
|
};
|
|
3851
3863
|
|
|
@@ -3927,11 +3939,9 @@ const getNewLocalization = async () => {
|
|
|
3927
3939
|
!selectedCountryCode) {
|
|
3928
3940
|
return;
|
|
3929
3941
|
}
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
startExchangeRateTimeout({ isGuaranteed, maxAge });
|
|
3934
|
-
}
|
|
3942
|
+
const isGuaranteed = zonosStore.checkoutSettings.visibilityStatus === 'ENABLED';
|
|
3943
|
+
const { maxAge } = await triggerGetExchangeRate(isGuaranteed);
|
|
3944
|
+
startExchangeRateTimeout({ isGuaranteed, maxAge });
|
|
3935
3945
|
localizationStore.countryLandedCost = await getCountryLandedCost(localizationStore.selectedCountryCode);
|
|
3936
3946
|
};
|
|
3937
3947
|
const getCustomMessages = async () => {
|
|
@@ -3958,7 +3968,8 @@ const getOverrideLocale = () => {
|
|
|
3958
3968
|
const zonosLocale = currentUrl.searchParams.get('zonosLocale');
|
|
3959
3969
|
return zonosLocale;
|
|
3960
3970
|
};
|
|
3961
|
-
const localizationStoreUpdateSelectedCountryCode =
|
|
3971
|
+
const localizationStoreUpdateSelectedCountryCode = (newSelectedCountryCode) => {
|
|
3972
|
+
var _a;
|
|
3962
3973
|
log('update selected country code');
|
|
3963
3974
|
localizationStore.selectedCountryCode = newSelectedCountryCode;
|
|
3964
3975
|
const { selectedCountryCode, shippingZoneCountries } = localizationStore;
|
|
@@ -3982,6 +3993,8 @@ const localizationStoreUpdateSelectedCountryCode = async (newSelectedCountryCode
|
|
|
3982
3993
|
window.sessionStorage.setItem('zonos--country', selectedCountryCode);
|
|
3983
3994
|
// Update the URL query param with the new country code
|
|
3984
3995
|
setZCountryUrlParam(selectedCountryCode);
|
|
3996
|
+
(_a = document
|
|
3997
|
+
.querySelector('zonos-hello')) === null || _a === void 0 ? void 0 : _a.setAttribute('z-country', selectedCountryCode);
|
|
3985
3998
|
};
|
|
3986
3999
|
const initLocalizationStore = async () => {
|
|
3987
4000
|
// all countries from countries.json, shipping zone and localization
|
|
@@ -4129,14 +4142,14 @@ const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId,
|
|
|
4129
4142
|
logError('Could not update cart total without checkout session id');
|
|
4130
4143
|
return false;
|
|
4131
4144
|
}
|
|
4132
|
-
const { json } = await stripeStoreUpdateCheckoutSession({
|
|
4145
|
+
const { errors, json } = await stripeStoreUpdateCheckoutSession({
|
|
4133
4146
|
currency,
|
|
4134
4147
|
id: cartStore.checkoutSessionId,
|
|
4135
4148
|
itemsAmount,
|
|
4136
4149
|
landedCostId,
|
|
4137
4150
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
4138
4151
|
});
|
|
4139
|
-
if (!json) {
|
|
4152
|
+
if (errors.length > 0 || !json) {
|
|
4140
4153
|
// do nothing if we can't get checkout session
|
|
4141
4154
|
logError('Error occurs when updating checkout session');
|
|
4142
4155
|
cartStoreUpdateToErrorState({
|
|
@@ -4346,11 +4359,26 @@ const calculateLandedCost = async (abortController) => {
|
|
|
4346
4359
|
return json;
|
|
4347
4360
|
};
|
|
4348
4361
|
|
|
4362
|
+
const jsonParse = (_data) => {
|
|
4363
|
+
if (typeof _data === 'string') {
|
|
4364
|
+
try {
|
|
4365
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
4366
|
+
const json = JSON.parse(_data);
|
|
4367
|
+
return json;
|
|
4368
|
+
}
|
|
4369
|
+
catch (_error) {
|
|
4370
|
+
return null;
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
return null;
|
|
4374
|
+
};
|
|
4375
|
+
|
|
4349
4376
|
const addressRuleStyle = ({ theme, }) => {
|
|
4350
4377
|
switch (theme) {
|
|
4351
4378
|
default:
|
|
4352
4379
|
return {
|
|
4353
4380
|
'.Input': {
|
|
4381
|
+
boxShadow: 'none',
|
|
4354
4382
|
// need to reset everything and the paddingTop to default, otherwise the paddingTop will not be updated.
|
|
4355
4383
|
padding: '0',
|
|
4356
4384
|
paddingBottom: '8px',
|
|
@@ -4359,6 +4387,9 @@ const addressRuleStyle = ({ theme, }) => {
|
|
|
4359
4387
|
// any value here will be add up to the default paddingTop (20px).
|
|
4360
4388
|
paddingTop: '6px',
|
|
4361
4389
|
},
|
|
4390
|
+
'.Input:focus': {
|
|
4391
|
+
boxShadow: 'none',
|
|
4392
|
+
},
|
|
4362
4393
|
};
|
|
4363
4394
|
}
|
|
4364
4395
|
};
|
|
@@ -4425,6 +4456,17 @@ const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryC
|
|
|
4425
4456
|
locale: localizationStore.selectedLocale,
|
|
4426
4457
|
};
|
|
4427
4458
|
};
|
|
4459
|
+
const stripeStoreCleanupDomesticShippingSession = () => {
|
|
4460
|
+
window.sessionStorage.removeItem('zonos--bigcommerce-domestic-checkout-shipping');
|
|
4461
|
+
};
|
|
4462
|
+
// Save shipping address to session storage
|
|
4463
|
+
const stripeStoreSaveDomesticShippingSession = (props) => {
|
|
4464
|
+
window.sessionStorage.setItem('zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
|
|
4465
|
+
};
|
|
4466
|
+
const stripeStoreGetDomesticShippingSession = () => {
|
|
4467
|
+
const session = window.sessionStorage.getItem('zonos--bigcommerce-domestic-checkout-shipping');
|
|
4468
|
+
return jsonParse(session);
|
|
4469
|
+
};
|
|
4428
4470
|
const initStripeElements = async (props) => {
|
|
4429
4471
|
var _a, _b;
|
|
4430
4472
|
const clientSecret = stripeStore.clientSecret;
|
|
@@ -4526,12 +4568,18 @@ const stripeStorePrefetchLandedCost = async () => {
|
|
|
4526
4568
|
try {
|
|
4527
4569
|
const abortController = new AbortController();
|
|
4528
4570
|
stripeStore.fetchingLandedCostAbordController = abortController;
|
|
4529
|
-
const { checkoutSessionWorkflow, shipmentRatingCalculateWorkflow } = await calculateLandedCost(abortController);
|
|
4571
|
+
const { checkoutSessionWorkflow, landedCostCalculateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCost(abortController);
|
|
4530
4572
|
// reset abort controller after we are done
|
|
4531
4573
|
stripeStore.fetchingLandedCostAbordController = null;
|
|
4532
4574
|
// update cart store with landed cost info
|
|
4533
4575
|
cartStore.landedCostData =
|
|
4534
|
-
(checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.
|
|
4576
|
+
(checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.map(checkoutSession => {
|
|
4577
|
+
const foundLandedCost = landedCostCalculateWorkflow === null || landedCostCalculateWorkflow === void 0 ? void 0 : landedCostCalculateWorkflow.find(item => { var _a; return (item === null || item === void 0 ? void 0 : item.id) === ((_a = checkoutSession.landedCost) === null || _a === void 0 ? void 0 : _a.id); });
|
|
4578
|
+
if (!foundLandedCost) {
|
|
4579
|
+
return null;
|
|
4580
|
+
}
|
|
4581
|
+
return Object.assign(Object.assign({}, checkoutSession), { landedCost: foundLandedCost });
|
|
4582
|
+
}).filter(Boolean)) || null;
|
|
4535
4583
|
cartStore.shippingData =
|
|
4536
4584
|
(shipmentRatingCalculateWorkflow === null || shipmentRatingCalculateWorkflow === void 0 ? void 0 : shipmentRatingCalculateWorkflow.filter(Boolean)) || null;
|
|
4537
4585
|
// apply new subtotal and total, this is mainly to show items in the presentment currency
|
|
@@ -4616,7 +4664,11 @@ const stripeStoreRetrievePayment = async ({ clientSecret: _clientSecret, storybo
|
|
|
4616
4664
|
const { paymentIntent } = await stripeStore.stripe.retrievePaymentIntent(clientSecret);
|
|
4617
4665
|
const status = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status;
|
|
4618
4666
|
const { isError, messages } = getStripeMessageBasedOnStatus(status);
|
|
4619
|
-
return {
|
|
4667
|
+
return {
|
|
4668
|
+
error: isError,
|
|
4669
|
+
messages,
|
|
4670
|
+
paymentMethod: paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.payment_method,
|
|
4671
|
+
};
|
|
4620
4672
|
};
|
|
4621
4673
|
const stripeStoreConfirmPayment = async () => {
|
|
4622
4674
|
var _a, _b, _c;
|
|
@@ -4717,4 +4769,4 @@ onChange('clientSecret', clientSecret => {
|
|
|
4717
4769
|
}
|
|
4718
4770
|
});
|
|
4719
4771
|
|
|
4720
|
-
export {
|
|
4772
|
+
export { initLocalizationStore as A, getZCountryUrlParam as B, setZCountryUrlParam as C, currencyDisplay as D, currencyConvertAndFormat as E, currencyConvert as F, currencyFormat as G, stripeStorePrefetchLandedCost as a, localizationStore as b, cartStore as c, log as d, stripeStoreGetDomesticShippingSession as e, localizationStoreUpdateSelectedCountryCode as f, stripeStoreCleanupDomesticShippingSession as g, stripeStoreSaveDomesticShippingSession as h, initStripeElements as i, cartStoreUpdateItems as j, cartStoreReset as k, logError as l, stripeStoreInitCheckoutSession as m, cartStoreUpdateToErrorState as n, cartStoreNextStep as o, stripeStoreConfirmPayment as p, stripeStoreReset as q, cartStorePreviousStep as r, stripeStore as s, translate as t, handleFetch as u, stripeStoreRetrievePayment as v, localizationStoreUpdateSelectedLocale as w, cartStoreUpdateSelectedShippingOption as x, cartStoreGetShippingTransitInfo as y, isValidSelector as z };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { u as handleFetch, b as localizationStore } from './stripe.js';
|
|
2
|
+
import { z as zonosStore } from './zonosStore.js';
|
|
3
|
+
|
|
4
|
+
const trackConversionEvent = async (eventName, metadata) => {
|
|
5
|
+
// If a Zonos domain, we don't want analytics to be tracked
|
|
6
|
+
if (window.location.href.includes('zonos.com')) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/track-conversion-event`;
|
|
10
|
+
const countryCode = localizationStore.selectedCountryCode;
|
|
11
|
+
const organizationId = zonosStore.organizationId;
|
|
12
|
+
const body = {
|
|
13
|
+
countryCode,
|
|
14
|
+
eventName,
|
|
15
|
+
metadata,
|
|
16
|
+
organizationId,
|
|
17
|
+
};
|
|
18
|
+
await handleFetch(url, {
|
|
19
|
+
body,
|
|
20
|
+
method: 'POST',
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { trackConversionEvent as t };
|
|
@@ -136,7 +136,7 @@ const ZonosAddress = /*@__PURE__*/ proxyCustomElement(class ZonosAddress extends
|
|
|
136
136
|
}
|
|
137
137
|
render() {
|
|
138
138
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
139
|
-
return (h(Host, { key: '
|
|
139
|
+
return (h(Host, { key: '8d762300d8f599a277806d861d13d2beb6a0a5a6', class: "zonos--address zonos--elements" }, h("zonos-text", { key: 'c355eece2f193cb0595ede434238f062b2c07c7c', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), h("div", { key: '59c3bd68cd67c8d733fd2ca5d9f4b4114c84db4a', class: "zonos--address-component" })));
|
|
140
140
|
}
|
|
141
141
|
get el() { return this; }
|
|
142
142
|
static get watchers() { return {
|
|
@@ -19,16 +19,16 @@ const ZonosBadge = /*@__PURE__*/ proxyCustomElement(class ZonosBadge extends HTM
|
|
|
19
19
|
this.rounded = false;
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
|
-
return (h(Host, { key: '
|
|
22
|
+
return (h(Host, { key: '1cece57ce37e04873f625d05ad5a0bea6368b46b', class: classes(['zonos--elements zonos--badge']), style: {
|
|
23
23
|
'--font-family': zonosStoreFontFamily(),
|
|
24
|
-
} }, h("div", { key: '
|
|
24
|
+
} }, h("div", { key: '8caf3f2ffb7deda215c44ad0c6c0892936d526c2', class: classes([
|
|
25
25
|
'zonos--badge-content',
|
|
26
26
|
this.badgeColor,
|
|
27
27
|
this.rounded && 'rounded',
|
|
28
28
|
this.iconRight && 'icon-right',
|
|
29
29
|
this.size,
|
|
30
30
|
this.bold && 'bold',
|
|
31
|
-
]) }, this.icon, h("zonos-text", { key: '
|
|
31
|
+
]) }, this.icon, h("zonos-text", { key: 'fb8ac7f09675f9cfd829ecea54c61f5c699caa00' }, h("slot", { key: '978bc876e427d932662a0100043e04b105e9df8d' })))));
|
|
32
32
|
}
|
|
33
33
|
static get style() { return ZonosBadgeStyle0; }
|
|
34
34
|
}, [1, "zonos-badge", {
|