@zonos/elements 1.3.7-alpha.0 → 1.3.7
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-eee85bda.js} +145 -100
- 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-a2e1f652.js +55 -0
- package/dist/cjs/zonos-address_4.cjs.entry.js +21 -16
- 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 +159 -23
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +28 -9
- 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 +25 -11
- 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 +6 -7
- 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 +41 -20
- 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 +52 -13
- 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 -2
- 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 +3 -3
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +3 -3
- package/dist/collection/components/utils/api/getLocaleMessages.js +2 -2
- 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 -3
- 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 +19 -14
- package/dist/collection/components/utils/logging/logError.js +2 -2
- 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 -34
- 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 +140 -98
- 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 +158 -20
- package/dist/components/zonos-collapse2.js +13 -6
- package/dist/components/zonos-component.js +1 -1
- package/dist/components/zonos-controller.js +25 -6
- 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 +24 -9
- package/dist/components/zonos-language-select2.js +3 -3
- package/dist/components/zonos-link-authentication2.js +3 -4
- 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 +3 -4
- 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-e261efc1.js} +143 -101
- 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-dfc6f1dc.js +51 -0
- package/dist/esm/zonos-address_4.entry.js +21 -16
- 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 +159 -23
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +28 -9
- 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 +25 -11
- 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 +6 -7
- 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-e261efc1.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-dfc6f1dc.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 +2 -3
- 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-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-dfd3edcf.entry.js → p-0c91720b.entry.js} +1 -1
- package/dist/zonos-elements/p-1119dddf.system.entry.js +1 -0
- package/dist/zonos-elements/p-127b480c.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-14c3ef38.entry.js +1 -0
- package/dist/zonos-elements/{p-55970b10.system.entry.js → p-14d27ce1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7d1d862f.system.entry.js → p-165d469e.system.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-1f85a98c.system.entry.js → p-389599d3.system.entry.js} +1 -1
- package/dist/zonos-elements/p-3a1e685f.entry.js +1 -0
- package/dist/zonos-elements/{p-a219689f.entry.js → p-3b23e462.entry.js} +1 -1
- package/dist/zonos-elements/{p-591eb6dd.system.js → p-49f6a985.system.js} +1 -1
- package/dist/zonos-elements/p-4fb77a38.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5b44abc8.system.js → p-5496951a.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-cc63a29f.system.entry.js → p-5c176b23.system.entry.js} +1 -1
- package/dist/zonos-elements/p-5d9a000a.system.entry.js +1 -0
- package/dist/zonos-elements/p-5f4ba44c.entry.js +1 -0
- package/dist/zonos-elements/{p-88a55076.system.entry.js → p-61e5cf29.system.entry.js} +1 -1
- package/dist/zonos-elements/p-69e2c59e.entry.js +1 -0
- package/dist/zonos-elements/p-745cd869.system.entry.js +1 -0
- package/dist/zonos-elements/p-78ba2928.system.js +1 -0
- package/dist/zonos-elements/{p-67737613.system.entry.js → p-799d8a17.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-375c472a.system.entry.js → p-79b24786.system.entry.js} +1 -1
- 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-7f4f45b3.entry.js +1 -0
- package/dist/zonos-elements/{p-2d2e1831.entry.js → p-857cfe35.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-9e6b489d.system.entry.js +1 -0
- package/dist/zonos-elements/p-9f4e02a1.entry.js +1 -0
- package/dist/zonos-elements/{p-afe40057.entry.js → p-a3cc0f84.entry.js} +1 -1
- 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-549c181b.system.js → p-b4725505.system.js} +1 -1
- package/dist/zonos-elements/p-c060d475.js +1 -0
- package/dist/zonos-elements/p-c2e58ee1.system.entry.js +1 -0
- package/dist/zonos-elements/{p-9878a770.js → p-da767f8b.js} +1 -1
- package/dist/zonos-elements/p-dd9e8589.entry.js +1 -0
- package/dist/zonos-elements/p-f11a3d9e.entry.js +1 -0
- 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-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-0c72fb79.system.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-a3d72a33.entry.js +0 -1
- package/dist/zonos-elements/p-a93c594f.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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const zonosStore = require('./zonosStore-
|
|
4
|
-
const isDarkColor = require('./isDarkColor-
|
|
5
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
3
|
+
const zonosStore = require('./zonosStore-138c5555.js');
|
|
4
|
+
const isDarkColor = require('./isDarkColor-57860b44.js');
|
|
5
|
+
const getBorderRadius = require('./getBorderRadius-d8f18958.js');
|
|
6
6
|
|
|
7
7
|
const stringsArabic = {
|
|
8
8
|
'Above de minimis threshold for': {
|
|
@@ -3548,7 +3548,7 @@ const handleFetch = async (url, _opts) => {
|
|
|
3548
3548
|
const modifiedUrl = new URL(url);
|
|
3549
3549
|
modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
|
|
3550
3550
|
// headers content type
|
|
3551
|
-
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);
|
|
3551
|
+
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);
|
|
3552
3552
|
const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
|
|
3553
3553
|
method });
|
|
3554
3554
|
return handleRequest(modifiedUrl.toString(), options);
|
|
@@ -3569,9 +3569,58 @@ const getCountries = async () => {
|
|
|
3569
3569
|
}
|
|
3570
3570
|
};
|
|
3571
3571
|
|
|
3572
|
+
const log = (message, type, ...additionalInfo) => {
|
|
3573
|
+
var _a, _b;
|
|
3574
|
+
const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
|
|
3575
|
+
!!window.location.search.match(/\?.*(&*)zonosDebug=1/);
|
|
3576
|
+
// if debug is false, do not log
|
|
3577
|
+
if (!isDebug) {
|
|
3578
|
+
// log errors to the console if the type is error
|
|
3579
|
+
if (type === 'error') {
|
|
3580
|
+
// eslint-disable-next-line no-console
|
|
3581
|
+
console.error(message, ...additionalInfo);
|
|
3582
|
+
}
|
|
3583
|
+
return;
|
|
3584
|
+
}
|
|
3585
|
+
let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
|
|
3586
|
+
if (!loggingIframe) {
|
|
3587
|
+
// add a hidden iframe
|
|
3588
|
+
loggingIframe = document.createElement('iframe');
|
|
3589
|
+
loggingIframe.id = 'zonos---debug-logging-iframe';
|
|
3590
|
+
loggingIframe.style.display = 'none';
|
|
3591
|
+
loggingIframe.style.opacity = '0';
|
|
3592
|
+
loggingIframe.style.position = 'absolute';
|
|
3593
|
+
loggingIframe.style.top = '-9999px';
|
|
3594
|
+
loggingIframe.style.left = '-9999px';
|
|
3595
|
+
loggingIframe.style.width = '1px';
|
|
3596
|
+
loggingIframe.style.height = '1px';
|
|
3597
|
+
loggingIframe.style.border = 'none';
|
|
3598
|
+
loggingIframe.style.overflow = 'hidden';
|
|
3599
|
+
loggingIframe.style.visibility = 'hidden';
|
|
3600
|
+
document.body.appendChild(loggingIframe);
|
|
3601
|
+
}
|
|
3602
|
+
// use the logging iframe's console to log just in case the console is disabled (overriden) by the site owner
|
|
3603
|
+
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
3604
|
+
switch (type) {
|
|
3605
|
+
case 'warn':
|
|
3606
|
+
zConsole.warn(message, ...additionalInfo);
|
|
3607
|
+
break;
|
|
3608
|
+
case 'info':
|
|
3609
|
+
zConsole.info(message, ...additionalInfo);
|
|
3610
|
+
break;
|
|
3611
|
+
case 'error':
|
|
3612
|
+
zConsole.error(message, ...additionalInfo);
|
|
3613
|
+
break;
|
|
3614
|
+
default:
|
|
3615
|
+
zConsole.groupCollapsed(message, ...additionalInfo);
|
|
3616
|
+
zConsole.trace();
|
|
3617
|
+
zConsole.groupEnd();
|
|
3618
|
+
break;
|
|
3619
|
+
}
|
|
3620
|
+
};
|
|
3621
|
+
|
|
3572
3622
|
const logError = (message, ...rest) => {
|
|
3573
|
-
|
|
3574
|
-
console.error(message, ...rest);
|
|
3623
|
+
log(message, 'error', ...rest);
|
|
3575
3624
|
};
|
|
3576
3625
|
|
|
3577
3626
|
const getCountryLandedCost = async (countryCode) => {
|
|
@@ -3614,8 +3663,7 @@ const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
|
|
|
3614
3663
|
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/locale-messages?countryCode=${countryCode}&storeId=${storeId}&localeTo=${localeTo}`;
|
|
3615
3664
|
const { errors, json } = await handleFetch(url);
|
|
3616
3665
|
if (errors.length || !json) {
|
|
3617
|
-
|
|
3618
|
-
console.error('Error fetching exchange rate', (_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message);
|
|
3666
|
+
logError('Error fetching exchange rate', (_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message);
|
|
3619
3667
|
return [];
|
|
3620
3668
|
}
|
|
3621
3669
|
return json.locale_countryCodesPage;
|
|
@@ -3733,76 +3781,32 @@ const isValidSelector = (selector) => {
|
|
|
3733
3781
|
return true;
|
|
3734
3782
|
};
|
|
3735
3783
|
|
|
3736
|
-
const log = (message, type, ...additionalInfo) => {
|
|
3737
|
-
var _a;
|
|
3738
|
-
// if type is error and debug is false, do not log
|
|
3739
|
-
if (!window.Zonos.debug) {
|
|
3740
|
-
return;
|
|
3741
|
-
}
|
|
3742
|
-
let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
|
|
3743
|
-
if (!loggingIframe) {
|
|
3744
|
-
// add a hidden iframe
|
|
3745
|
-
loggingIframe = document.createElement('iframe');
|
|
3746
|
-
loggingIframe.id = 'zonos---debug-logging-iframe';
|
|
3747
|
-
loggingIframe.style.display = 'none';
|
|
3748
|
-
loggingIframe.style.opacity = '0';
|
|
3749
|
-
loggingIframe.style.position = 'absolute';
|
|
3750
|
-
loggingIframe.style.top = '-9999px';
|
|
3751
|
-
loggingIframe.style.left = '-9999px';
|
|
3752
|
-
loggingIframe.style.width = '1px';
|
|
3753
|
-
loggingIframe.style.height = '1px';
|
|
3754
|
-
loggingIframe.style.border = 'none';
|
|
3755
|
-
loggingIframe.style.overflow = 'hidden';
|
|
3756
|
-
loggingIframe.style.visibility = 'hidden';
|
|
3757
|
-
document.body.appendChild(loggingIframe);
|
|
3758
|
-
}
|
|
3759
|
-
// use the logging iframe's console to log just in case the console is disabled (overriden) by the site owner
|
|
3760
|
-
const console = ((_a = loggingIframe.contentWindow) === null || _a === void 0 ? void 0 : _a.window.console) || window.console;
|
|
3761
|
-
switch (type) {
|
|
3762
|
-
case 'warn':
|
|
3763
|
-
// eslint-disable-next-line no-console
|
|
3764
|
-
console.warn(message, ...additionalInfo);
|
|
3765
|
-
break;
|
|
3766
|
-
case 'info':
|
|
3767
|
-
// eslint-disable-next-line no-console
|
|
3768
|
-
console.info(message, ...additionalInfo);
|
|
3769
|
-
break;
|
|
3770
|
-
default:
|
|
3771
|
-
// eslint-disable-next-line no-console
|
|
3772
|
-
console.groupCollapsed(message, ...additionalInfo);
|
|
3773
|
-
// eslint-disable-next-line no-console
|
|
3774
|
-
console.trace();
|
|
3775
|
-
// eslint-disable-next-line no-console
|
|
3776
|
-
console.groupEnd();
|
|
3777
|
-
break;
|
|
3778
|
-
}
|
|
3779
|
-
};
|
|
3780
|
-
|
|
3781
3784
|
const getCurrencyElements = (selector) => {
|
|
3782
3785
|
const currencySelector = selector || '.money';
|
|
3783
3786
|
if (!isValidSelector(currencySelector)) {
|
|
3784
|
-
// eslint-disable-next-line no-console
|
|
3785
3787
|
logError(`Currency element selector "${currencySelector}" is not valid.`);
|
|
3786
3788
|
return null;
|
|
3787
3789
|
}
|
|
3788
3790
|
const currencyElements = document.querySelectorAll(currencySelector);
|
|
3789
3791
|
if (!currencyElements.length) {
|
|
3790
|
-
// eslint-disable-next-line no-console
|
|
3791
3792
|
log(`No currency elements found with selector "${currencySelector}"`, 'warn');
|
|
3792
3793
|
return null;
|
|
3793
3794
|
}
|
|
3794
|
-
return
|
|
3795
|
+
// return array of currency elements instead of a NodeList
|
|
3796
|
+
return Array.from(currencyElements);
|
|
3795
3797
|
};
|
|
3796
3798
|
|
|
3797
3799
|
const getInitialElementAmount = (element) => {
|
|
3798
3800
|
var _a;
|
|
3799
3801
|
const domesticValue = element.getAttribute('data-domestic');
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3802
|
+
const intlValue = element.getAttribute('data-zintl');
|
|
3803
|
+
// Only keep numbers, decimal, and hyphens
|
|
3804
|
+
const cleanedText = (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.replace(/[^\d.-]/g, '');
|
|
3805
|
+
if (!cleanedText) {
|
|
3806
|
+
return null;
|
|
3807
|
+
}
|
|
3808
|
+
// If the element has no data-domestic attribute, or the text content is different from the data-zintl attribute, set the data-domestic attribute
|
|
3809
|
+
if (!domesticValue || element.textContent !== intlValue) {
|
|
3806
3810
|
// Store the original value on the element once, and international on every new conversion
|
|
3807
3811
|
element.setAttribute('data-domestic', cleanedText);
|
|
3808
3812
|
return parseFloat(cleanedText);
|
|
@@ -3810,9 +3814,32 @@ const getInitialElementAmount = (element) => {
|
|
|
3810
3814
|
return parseFloat(domesticValue);
|
|
3811
3815
|
};
|
|
3812
3816
|
|
|
3817
|
+
const convertCurrency = (element) => {
|
|
3818
|
+
var _a;
|
|
3819
|
+
const amount = getInitialElementAmount(element);
|
|
3820
|
+
if (!amount || isNaN(amount)) {
|
|
3821
|
+
return;
|
|
3822
|
+
}
|
|
3823
|
+
const currentIntlValue = element.getAttribute('data-zintl');
|
|
3824
|
+
const currentCountryValue = element.getAttribute('data-zcountry-code');
|
|
3825
|
+
// do nothing if the target currency is the same
|
|
3826
|
+
const isExchangeRateReady = localizationStore.targetCurrency ===
|
|
3827
|
+
((_a = localizationStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.targetFormat.currencyCode);
|
|
3828
|
+
// if the current value on the element is different from the current intl value, update the data-zintl attribute
|
|
3829
|
+
if (isExchangeRateReady &&
|
|
3830
|
+
(element.textContent !== currentIntlValue ||
|
|
3831
|
+
currentCountryValue !== localizationStore.selectedCountryCode)) {
|
|
3832
|
+
const observedFormattedValue = currencyConvertAndFormat(amount);
|
|
3833
|
+
element.textContent = observedFormattedValue;
|
|
3834
|
+
// save the new value to the data-zintl attribute
|
|
3835
|
+
element.setAttribute('data-zintl', observedFormattedValue);
|
|
3836
|
+
element.setAttribute('data-zcountry-code', localizationStore.selectedCountryCode || '');
|
|
3837
|
+
}
|
|
3838
|
+
};
|
|
3813
3839
|
const defaultCurrencyConverter = () => {
|
|
3814
3840
|
const { currencyElementSelector } = zonosStore.zonosStore.helloSettings;
|
|
3815
3841
|
const currencyElements = getCurrencyElements(currencyElementSelector);
|
|
3842
|
+
// do nothing if none of the currency elements are found
|
|
3816
3843
|
if (!(currencyElements === null || currencyElements === void 0 ? void 0 : currencyElements.length)) {
|
|
3817
3844
|
return;
|
|
3818
3845
|
}
|
|
@@ -3821,33 +3848,8 @@ const defaultCurrencyConverter = () => {
|
|
|
3821
3848
|
return;
|
|
3822
3849
|
}
|
|
3823
3850
|
currencyElements.forEach((element) => {
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
return;
|
|
3827
|
-
}
|
|
3828
|
-
element.setAttribute('data-zintl', currencyConvert(amount).toString());
|
|
3829
|
-
// Check if an observer is already attached to the element
|
|
3830
|
-
let observer = element._mutationObserver;
|
|
3831
|
-
if (!observer) {
|
|
3832
|
-
observer = new MutationObserver(() => {
|
|
3833
|
-
const observedFormattedValue = currencyConvertAndFormat(amount);
|
|
3834
|
-
element.textContent = observedFormattedValue;
|
|
3835
|
-
});
|
|
3836
|
-
observer.observe(element, {
|
|
3837
|
-
characterData: true,
|
|
3838
|
-
childList: true,
|
|
3839
|
-
});
|
|
3840
|
-
element._mutationObserver = observer;
|
|
3841
|
-
}
|
|
3842
|
-
// Temporarily disconnect the observer to prevent an infinite loop
|
|
3843
|
-
observer.disconnect();
|
|
3844
|
-
const formattedValue = currencyConvertAndFormat(amount);
|
|
3845
|
-
element.textContent = formattedValue;
|
|
3846
|
-
// Reconnect the observer after the update is complete
|
|
3847
|
-
observer.observe(element, {
|
|
3848
|
-
characterData: true,
|
|
3849
|
-
childList: true,
|
|
3850
|
-
});
|
|
3851
|
+
// convert the currency and save the formatted value to the data-zintl attribute
|
|
3852
|
+
convertCurrency(element);
|
|
3851
3853
|
});
|
|
3852
3854
|
};
|
|
3853
3855
|
|
|
@@ -3929,11 +3931,9 @@ const getNewLocalization = async () => {
|
|
|
3929
3931
|
!selectedCountryCode) {
|
|
3930
3932
|
return;
|
|
3931
3933
|
}
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
startExchangeRateTimeout({ isGuaranteed, maxAge });
|
|
3936
|
-
}
|
|
3934
|
+
const isGuaranteed = zonosStore.zonosStore.checkoutSettings.visibilityStatus === 'ENABLED';
|
|
3935
|
+
const { maxAge } = await triggerGetExchangeRate(isGuaranteed);
|
|
3936
|
+
startExchangeRateTimeout({ isGuaranteed, maxAge });
|
|
3937
3937
|
localizationStore.countryLandedCost = await getCountryLandedCost(localizationStore.selectedCountryCode);
|
|
3938
3938
|
};
|
|
3939
3939
|
const getCustomMessages = async () => {
|
|
@@ -3960,7 +3960,8 @@ const getOverrideLocale = () => {
|
|
|
3960
3960
|
const zonosLocale = currentUrl.searchParams.get('zonosLocale');
|
|
3961
3961
|
return zonosLocale;
|
|
3962
3962
|
};
|
|
3963
|
-
const localizationStoreUpdateSelectedCountryCode =
|
|
3963
|
+
const localizationStoreUpdateSelectedCountryCode = (newSelectedCountryCode) => {
|
|
3964
|
+
var _a;
|
|
3964
3965
|
log('update selected country code');
|
|
3965
3966
|
localizationStore.selectedCountryCode = newSelectedCountryCode;
|
|
3966
3967
|
const { selectedCountryCode, shippingZoneCountries } = localizationStore;
|
|
@@ -3984,6 +3985,8 @@ const localizationStoreUpdateSelectedCountryCode = async (newSelectedCountryCode
|
|
|
3984
3985
|
window.sessionStorage.setItem('zonos--country', selectedCountryCode);
|
|
3985
3986
|
// Update the URL query param with the new country code
|
|
3986
3987
|
setZCountryUrlParam(selectedCountryCode);
|
|
3988
|
+
(_a = document
|
|
3989
|
+
.querySelector('zonos-hello')) === null || _a === void 0 ? void 0 : _a.setAttribute('z-country', selectedCountryCode);
|
|
3987
3990
|
};
|
|
3988
3991
|
const initLocalizationStore = async () => {
|
|
3989
3992
|
// all countries from countries.json, shipping zone and localization
|
|
@@ -4139,11 +4142,26 @@ const calculateLandedCost = async (abortController) => {
|
|
|
4139
4142
|
return json;
|
|
4140
4143
|
};
|
|
4141
4144
|
|
|
4145
|
+
const jsonParse = (_data) => {
|
|
4146
|
+
if (typeof _data === 'string') {
|
|
4147
|
+
try {
|
|
4148
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
4149
|
+
const json = JSON.parse(_data);
|
|
4150
|
+
return json;
|
|
4151
|
+
}
|
|
4152
|
+
catch (_error) {
|
|
4153
|
+
return null;
|
|
4154
|
+
}
|
|
4155
|
+
}
|
|
4156
|
+
return null;
|
|
4157
|
+
};
|
|
4158
|
+
|
|
4142
4159
|
const addressRuleStyle = ({ theme, }) => {
|
|
4143
4160
|
switch (theme) {
|
|
4144
4161
|
default:
|
|
4145
4162
|
return {
|
|
4146
4163
|
'.Input': {
|
|
4164
|
+
boxShadow: 'none',
|
|
4147
4165
|
// need to reset everything and the paddingTop to default, otherwise the paddingTop will not be updated.
|
|
4148
4166
|
padding: '0',
|
|
4149
4167
|
paddingBottom: '8px',
|
|
@@ -4152,6 +4170,9 @@ const addressRuleStyle = ({ theme, }) => {
|
|
|
4152
4170
|
// any value here will be add up to the default paddingTop (20px).
|
|
4153
4171
|
paddingTop: '6px',
|
|
4154
4172
|
},
|
|
4173
|
+
'.Input:focus': {
|
|
4174
|
+
boxShadow: 'none',
|
|
4175
|
+
},
|
|
4155
4176
|
};
|
|
4156
4177
|
}
|
|
4157
4178
|
};
|
|
@@ -4218,6 +4239,17 @@ const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryC
|
|
|
4218
4239
|
locale: localizationStore.selectedLocale,
|
|
4219
4240
|
};
|
|
4220
4241
|
};
|
|
4242
|
+
const stripeStoreCleanupDomesticShippingSession = () => {
|
|
4243
|
+
window.sessionStorage.removeItem('zonos--bigcommerce-domestic-checkout-shipping');
|
|
4244
|
+
};
|
|
4245
|
+
// Save shipping address to session storage
|
|
4246
|
+
const stripeStoreSaveDomesticShippingSession = (props) => {
|
|
4247
|
+
window.sessionStorage.setItem('zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
|
|
4248
|
+
};
|
|
4249
|
+
const stripeStoreGetDomesticShippingSession = () => {
|
|
4250
|
+
const session = window.sessionStorage.getItem('zonos--bigcommerce-domestic-checkout-shipping');
|
|
4251
|
+
return jsonParse(session);
|
|
4252
|
+
};
|
|
4221
4253
|
const initStripeElements = async (props) => {
|
|
4222
4254
|
var _a, _b;
|
|
4223
4255
|
const clientSecret = stripeStore.clientSecret;
|
|
@@ -4319,12 +4351,18 @@ const stripeStorePrefetchLandedCost = async () => {
|
|
|
4319
4351
|
try {
|
|
4320
4352
|
const abortController = new AbortController();
|
|
4321
4353
|
stripeStore.fetchingLandedCostAbordController = abortController;
|
|
4322
|
-
const { checkoutSessionWorkflow, shipmentRatingCalculateWorkflow } = await calculateLandedCost(abortController);
|
|
4354
|
+
const { checkoutSessionWorkflow, landedCostCalculateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCost(abortController);
|
|
4323
4355
|
// reset abort controller after we are done
|
|
4324
4356
|
stripeStore.fetchingLandedCostAbordController = null;
|
|
4325
4357
|
// update cart store with landed cost info
|
|
4326
4358
|
cartStore.landedCostData =
|
|
4327
|
-
(checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.
|
|
4359
|
+
(checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.map(checkoutSession => {
|
|
4360
|
+
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); });
|
|
4361
|
+
if (!foundLandedCost) {
|
|
4362
|
+
return null;
|
|
4363
|
+
}
|
|
4364
|
+
return Object.assign(Object.assign({}, checkoutSession), { landedCost: foundLandedCost });
|
|
4365
|
+
}).filter(Boolean)) || null;
|
|
4328
4366
|
cartStore.shippingData =
|
|
4329
4367
|
(shipmentRatingCalculateWorkflow === null || shipmentRatingCalculateWorkflow === void 0 ? void 0 : shipmentRatingCalculateWorkflow.filter(Boolean)) || null;
|
|
4330
4368
|
// apply new subtotal and total, this is mainly to show items in the presentment currency
|
|
@@ -4409,7 +4447,11 @@ const stripeStoreRetrievePayment = async ({ clientSecret: _clientSecret, storybo
|
|
|
4409
4447
|
const { paymentIntent } = await stripeStore.stripe.retrievePaymentIntent(clientSecret);
|
|
4410
4448
|
const status = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status;
|
|
4411
4449
|
const { isError, messages } = getStripeMessageBasedOnStatus(status);
|
|
4412
|
-
return {
|
|
4450
|
+
return {
|
|
4451
|
+
error: isError,
|
|
4452
|
+
messages,
|
|
4453
|
+
paymentMethod: paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.payment_method,
|
|
4454
|
+
};
|
|
4413
4455
|
};
|
|
4414
4456
|
const stripeStoreConfirmPayment = async () => {
|
|
4415
4457
|
var _a, _b, _c;
|
|
@@ -4601,14 +4643,14 @@ const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId,
|
|
|
4601
4643
|
logError('Could not update cart total without checkout session id');
|
|
4602
4644
|
return false;
|
|
4603
4645
|
}
|
|
4604
|
-
const { json } = await stripeStoreUpdateCheckoutSession({
|
|
4646
|
+
const { errors, json } = await stripeStoreUpdateCheckoutSession({
|
|
4605
4647
|
currency,
|
|
4606
4648
|
id: cartStore.checkoutSessionId,
|
|
4607
4649
|
itemsAmount,
|
|
4608
4650
|
landedCostId,
|
|
4609
4651
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
4610
4652
|
});
|
|
4611
|
-
if (!json) {
|
|
4653
|
+
if (errors.length > 0 || !json) {
|
|
4612
4654
|
// do nothing if we can't get checkout session
|
|
4613
4655
|
logError('Error occurs when updating checkout session');
|
|
4614
4656
|
cartStoreUpdateToErrorState({
|
|
@@ -4743,9 +4785,12 @@ exports.log = log;
|
|
|
4743
4785
|
exports.logError = logError;
|
|
4744
4786
|
exports.setZCountryUrlParam = setZCountryUrlParam;
|
|
4745
4787
|
exports.stripeStore = stripeStore;
|
|
4788
|
+
exports.stripeStoreCleanupDomesticShippingSession = stripeStoreCleanupDomesticShippingSession;
|
|
4746
4789
|
exports.stripeStoreConfirmPayment = stripeStoreConfirmPayment;
|
|
4790
|
+
exports.stripeStoreGetDomesticShippingSession = stripeStoreGetDomesticShippingSession;
|
|
4747
4791
|
exports.stripeStoreInitCheckoutSession = stripeStoreInitCheckoutSession;
|
|
4748
4792
|
exports.stripeStorePrefetchLandedCost = stripeStorePrefetchLandedCost;
|
|
4749
4793
|
exports.stripeStoreReset = stripeStoreReset;
|
|
4750
4794
|
exports.stripeStoreRetrievePayment = stripeStoreRetrievePayment;
|
|
4795
|
+
exports.stripeStoreSaveDomesticShippingSession = stripeStoreSaveDomesticShippingSession;
|
|
4751
4796
|
exports.translate = translate;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const formatStringWithLinks = (str) => {
|
|
4
|
+
// Match Markdown-style links or standalone URLs not in Markdown format
|
|
5
|
+
const linkRegex = /\[([^\]]+)\]\((https?:\/\/[^\s\)]+)\)|(https?:\/\/[^\s]+)/g;
|
|
6
|
+
const messageWithLinks = str.replace(linkRegex, (_match, text, markdownUrl, url) => {
|
|
7
|
+
if (markdownUrl) {
|
|
8
|
+
return `<zonos-link href="${markdownUrl}" target="_blank" rel="noopener noreferrer">${text}</zonos-link>`;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return `<zonos-link href="${url}" target="_blank" rel="noopener noreferrer">${url}</zonos-link>`;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return messageWithLinks;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.formatStringWithLinks = formatStringWithLinks;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"paymentError":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged"],"mobile":["handleMobileChange"]}]]],["zonos-hello.cjs",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64]},[[9,"resize","handleResize"]]]]],["zonos-controller.cjs",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]}]]],["zonos-component.cjs",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-logo.cjs",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-payment.cjs",[[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}]]],["zonos-shipping-rich-radio.cjs",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"selectedItem":[32]}]]],["zonos-
|
|
11
|
+
return index.bootstrapLazy([["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"paymentError":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"domesticRedirectedBtnSelector":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged"],"mobile":["handleMobileChange"]}]]],["zonos-hello.cjs",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]]]]],["zonos-controller.cjs",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]}]]],["zonos-component.cjs",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link.cjs",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo.cjs",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text.cjs",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"content":[1],"ready":[32]}]]],["zonos-hello-dialog.cjs",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-notification.cjs",[[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-payment.cjs",[[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}]]],["zonos-shipping-rich-radio.cjs",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"selectedItem":[32]}]]],["zonos-badge_2.cjs",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4]}],[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-country-flag.cjs",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-banner.cjs",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-button_3.cjs",[[1,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}]]],["zonos-select-dialog-header_2.cjs",[[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}],[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-card_2.cjs",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-card",{"actions":[16],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-country-select_3.cjs",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}]]],["zonos-address_4.cjs",[[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32],"isDirtyAddress":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]}],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"stripe":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-cart-items_9.cjs",[[1,"zonos-checkout-footer",{"showDialog":[32]},[[4,"click","handleGlobalClick"]]],[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"defaultAddress":[16],"disabled":[32]},null,{"disabled":["watchFormComplete"]}],[2,"zonos-checkout-payment",{"paymentError":[4,"payment-error"],"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"disabled":[32]},null,{"disabled":["watchFormComplete"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"disabled":[32]},null,{"disabled":["watchFormComplete"]}],[1,"zonos-cart-subtotal"],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"order":[32]}],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"footerRightAction":[16],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const cart = require('./cart-eee85bda.js');
|
|
4
|
+
const zonosStore = require('./zonosStore-138c5555.js');
|
|
5
|
+
|
|
6
|
+
const trackConversionEvent = async (eventName, metadata) => {
|
|
7
|
+
// If a Zonos domain, we don't want analytics to be tracked
|
|
8
|
+
if (window.location.href.includes('zonos.com')) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/track-conversion-event`;
|
|
12
|
+
const countryCode = cart.localizationStore.selectedCountryCode;
|
|
13
|
+
const organizationId = zonosStore.zonosStore.organizationId;
|
|
14
|
+
const body = {
|
|
15
|
+
countryCode,
|
|
16
|
+
eventName,
|
|
17
|
+
metadata,
|
|
18
|
+
organizationId,
|
|
19
|
+
};
|
|
20
|
+
await cart.handleFetch(url, {
|
|
21
|
+
body,
|
|
22
|
+
method: 'POST',
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const sendErrorLog = async ({ endpoint, errors, metadata }) => {
|
|
27
|
+
const errorObject = {
|
|
28
|
+
endpoint,
|
|
29
|
+
errors,
|
|
30
|
+
metadata,
|
|
31
|
+
};
|
|
32
|
+
void cart.handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/log-error`, {
|
|
33
|
+
body: errorObject,
|
|
34
|
+
method: 'POST',
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Submit a gtag event if the gtag function is available.
|
|
40
|
+
*/
|
|
41
|
+
const submitGtag = (event) => {
|
|
42
|
+
const googleAnalyticSetting = zonosStore.zonosStore.checkoutSettings.analyticsProviders.find(item => item.type === 'GOOGLE_ANALYTICS');
|
|
43
|
+
// only submit if googleAnalytic in checkout setting is on.
|
|
44
|
+
if (!googleAnalyticSetting || (googleAnalyticSetting === null || googleAnalyticSetting === void 0 ? void 0 : googleAnalyticSetting.status) === 'DISABLED') {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (typeof window.gtag === 'function') {
|
|
48
|
+
cart.log('Zonos submits gtag event', 'log', event);
|
|
49
|
+
window.gtag('event', event, {});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.sendErrorLog = sendErrorLog;
|
|
54
|
+
exports.submitGtag = submitGtag;
|
|
55
|
+
exports.trackConversionEvent = trackConversionEvent;
|