@zonos/elements 1.3.18-alpha.2 → 1.3.18-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +341 -96
- package/dist/cjs/{cart-941a31dd.js → cart-72b0bccc.js} +34 -85
- package/dist/cjs/index.cjs.js +628 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/logError-4e2f2020.js +58 -0
- package/dist/cjs/{submitGtag-9210b4fe.js → submitGtag-b0c8de90.js} +3 -2
- package/dist/cjs/zonos-address_8.cjs.entry.js +13 -12
- package/dist/cjs/zonos-badge_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card_2.cjs.entry.js +7 -6
- package/dist/cjs/zonos-cart-items_11.cjs.entry.js +11 -10
- package/dist/cjs/zonos-checkout.cjs.entry.js +20 -15
- package/dist/cjs/zonos-controller.cjs.entry.js +47 -20
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -1
- package/dist/cjs/zonos-country-select_3.cjs.entry.js +6 -5
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +10 -9
- package/dist/cjs/zonos-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-link.cjs.entry.js +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +3 -2
- package/dist/collection/__mocks__/zonos-url/index.js +1 -0
- package/dist/collection/__tests__/build-utils/urlCheckOne.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +4 -9
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +8 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +3 -3
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
- package/dist/collection/components/common/zonos-card/zonos-card.js +3 -3
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
- package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
- package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +2 -2
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
- package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
- package/dist/collection/components/common/{component-template/zonos-link → zonos-link}/zonos-link.js +1 -1
- package/dist/collection/components/main/zonos-controller.js +41 -6
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +3 -3
- package/dist/collection/components/utils/hello/setZCountryUrlParam.js +5 -1
- package/dist/collection/environment.js +0 -2
- package/dist/collection/index.js +1 -0
- package/dist/collection/scripts/_extractZonosQaUrl.js +26 -0
- package/dist/collection/scripts/_getZonosQaUrl.js +44 -0
- package/dist/collection/scripts/{loadStripe.js → _loadStripe.js} +1 -1
- package/dist/collection/scripts/{zonosBase.js → _zonosBase.js} +29 -6
- package/dist/collection/scripts/index.js +2 -0
- package/dist/collection/types/generated/graphql.customer.types.js +1 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +1 -0
- package/dist/esm/{cart-cc593c2b.js → cart-1a37e002.js} +7 -56
- package/dist/esm/index.js +625 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/logError-c456c092.js +55 -0
- package/dist/esm/{submitGtag-e50f903f.js → submitGtag-754935b4.js} +2 -1
- package/dist/esm/zonos-address_8.entry.js +11 -10
- package/dist/esm/zonos-badge_2.entry.js +3 -3
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card_2.entry.js +7 -6
- package/dist/esm/zonos-cart-items_11.entry.js +11 -10
- package/dist/esm/zonos-checkout.entry.js +8 -3
- package/dist/esm/zonos-controller.entry.js +30 -3
- package/dist/esm/zonos-country-flag.entry.js +2 -1
- package/dist/esm/zonos-country-select_3.entry.js +6 -5
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +2 -1
- package/dist/esm/zonos-hello.entry.js +2 -1
- package/dist/esm/zonos-input.entry.js +4 -4
- package/dist/esm/zonos-link.entry.js +1 -1
- package/dist/esm/zonos-payment.entry.js +2 -1
- package/dist/esm-es5/cart-1a37e002.js +1 -0
- package/dist/esm-es5/index.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/logError-c456c092.js +1 -0
- package/dist/esm-es5/submitGtag-754935b4.js +1 -0
- package/dist/esm-es5/zonos-address_8.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card_2.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_11.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-link.entry.js +1 -1
- package/dist/esm-es5/zonos-payment.entry.js +1 -1
- package/dist/scripts/index.d.ts +3908 -0
- package/dist/scripts/index.js +1 -0
- package/dist/scripts/loadZonos.d.ts +3954 -0
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +5 -7
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +2 -2
- package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +2 -2
- package/dist/types/components/main/zonos-controller.d.ts +6 -1
- package/dist/types/components/store/checkout/stripe.d.ts +1 -1
- package/dist/types/components/store/zonosStore.d.ts +1 -1
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +2 -2
- package/dist/types/components/utils/styles.d.ts +1 -0
- package/dist/types/components.d.ts +22 -14
- package/dist/types/index.d.ts +1 -0
- package/dist/types/scripts/_extractZonosQaUrl.d.ts +11 -0
- package/dist/types/scripts/_getZonosQaUrl.d.ts +4 -0
- package/dist/types/scripts/{loadStripe.d.ts → _loadStripe.d.ts} +1 -1
- package/dist/types/scripts/{zonosBase.d.ts → _zonosBase.d.ts} +36 -2
- package/dist/types/scripts/index.d.ts +2 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +5 -0
- package/dist/types/types/checkout/api/CalculateLandedCostRequest.d.ts +9 -0
- package/dist/types/types/generated/graphql.customer.types.d.ts +1 -0
- package/dist/types/types/generated/graphql.customer.types.ts +3 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +1 -0
- package/dist/types/types/global.d.ts +1 -1
- package/dist/zonos-elements/index.esm.js +1 -0
- package/dist/zonos-elements/p-0878369a.entry.js +1 -0
- package/dist/zonos-elements/p-0d1c06d7.entry.js +1 -0
- package/dist/zonos-elements/{p-9aab3ad7.entry.js → p-0d5b5bcc.entry.js} +1 -1
- package/dist/zonos-elements/p-1491717a.entry.js +1 -0
- package/dist/zonos-elements/p-14ff42fe.system.entry.js +1 -0
- package/dist/zonos-elements/p-2800c274.system.entry.js +1 -0
- package/dist/zonos-elements/p-2e02a76f.system.entry.js +1 -0
- package/dist/zonos-elements/{p-020a9b86.entry.js → p-3ba8838a.entry.js} +1 -1
- package/dist/zonos-elements/p-4594a125.js +1 -0
- package/dist/zonos-elements/p-483e1724.entry.js +1 -0
- package/dist/zonos-elements/{p-d0bc8902.system.entry.js → p-4f72bfee.system.entry.js} +1 -1
- package/dist/zonos-elements/p-58be220f.system.js +1 -0
- package/dist/zonos-elements/{p-9e9c318b.entry.js → p-58fc8ec1.entry.js} +1 -1
- package/dist/zonos-elements/p-63db40b9.system.js +1 -0
- package/dist/zonos-elements/p-6449c92b.js +1 -0
- package/dist/zonos-elements/p-6746455b.system.entry.js +1 -0
- package/dist/zonos-elements/{p-c20e5430.entry.js → p-6cb9812b.entry.js} +1 -1
- package/dist/zonos-elements/p-7487ef47.entry.js +1 -0
- package/dist/zonos-elements/p-7b2d367b.entry.js +1 -0
- package/dist/zonos-elements/p-9389cc42.system.entry.js +1 -0
- package/dist/zonos-elements/p-9be6c62b.system.js +1 -0
- package/dist/zonos-elements/p-9c242e4b.system.entry.js +1 -0
- package/dist/zonos-elements/p-a37796e1.entry.js +1 -0
- package/dist/zonos-elements/p-afb89d65.entry.js +1 -0
- package/dist/zonos-elements/p-bbb84165.system.entry.js +1 -0
- package/dist/zonos-elements/{p-96b8c9ba.system.entry.js → p-bdfa3705.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c195e980.system.entry.js +1 -0
- package/dist/zonos-elements/p-c87c76d4.entry.js +1 -0
- package/dist/zonos-elements/p-d9011df9.entry.js +1 -0
- package/dist/zonos-elements/{p-3e26d7b3.system.entry.js → p-dda78e8e.system.entry.js} +1 -1
- package/dist/zonos-elements/p-de9e610d.system.entry.js +1 -0
- package/dist/zonos-elements/p-e0bf9666.system.js +1 -1
- package/dist/zonos-elements/p-eaa335e1.js +1 -0
- package/dist/zonos-elements/{p-e13bfbda.system.entry.js → p-ed3524ae.system.entry.js} +1 -1
- package/dist/zonos-elements/p-f5b14bab.system.js +1 -0
- package/dist/zonos-elements/p-f9a42a3c.system.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +4 -2
- package/dist/components/ILanguage.js +0 -24
- package/dist/components/classes.js +0 -12
- package/dist/components/containsNonLatinChars.js +0 -21
- package/dist/components/formatCurrency.js +0 -11
- package/dist/components/getBorderRadius.js +0 -18
- package/dist/components/index.d.ts +0 -33
- package/dist/components/index.js +0 -1
- package/dist/components/isCheckoutMobile.js +0 -6
- package/dist/components/isColorVariable.js +0 -14
- package/dist/components/isDarkColor.js +0 -1199
- package/dist/components/stripe.js +0 -1691
- package/dist/components/submitGtag.js +0 -19
- package/dist/components/trackConversionEvent.js +0 -37
- package/dist/components/translationStore.js +0 -5611
- package/dist/components/zonos-address-display.d.ts +0 -11
- package/dist/components/zonos-address-display.js +0 -6
- package/dist/components/zonos-address-display2.js +0 -64
- package/dist/components/zonos-address-form.d.ts +0 -11
- package/dist/components/zonos-address-form.js +0 -6
- package/dist/components/zonos-address-form2.js +0 -84
- package/dist/components/zonos-address-update-dialog.d.ts +0 -11
- package/dist/components/zonos-address-update-dialog.js +0 -6
- package/dist/components/zonos-address-update-dialog2.js +0 -264
- package/dist/components/zonos-address.d.ts +0 -11
- package/dist/components/zonos-address.js +0 -6
- package/dist/components/zonos-address2.js +0 -176
- package/dist/components/zonos-badge.d.ts +0 -11
- package/dist/components/zonos-badge.js +0 -6
- package/dist/components/zonos-badge2.js +0 -61
- package/dist/components/zonos-banner.d.ts +0 -11
- package/dist/components/zonos-banner.js +0 -6
- package/dist/components/zonos-banner2.js +0 -95
- package/dist/components/zonos-button.d.ts +0 -11
- package/dist/components/zonos-button.js +0 -6
- package/dist/components/zonos-button2.js +0 -186
- package/dist/components/zonos-card.d.ts +0 -11
- package/dist/components/zonos-card.js +0 -6
- package/dist/components/zonos-card2.js +0 -57
- package/dist/components/zonos-cart-items.d.ts +0 -11
- package/dist/components/zonos-cart-items.js +0 -6
- package/dist/components/zonos-cart-items2.js +0 -57
- package/dist/components/zonos-cart-restricted-items.d.ts +0 -11
- package/dist/components/zonos-cart-restricted-items.js +0 -6
- package/dist/components/zonos-cart-restricted-items2.js +0 -135
- package/dist/components/zonos-cart-subtotal.d.ts +0 -11
- package/dist/components/zonos-cart-subtotal.js +0 -6
- package/dist/components/zonos-cart-subtotal2.js +0 -91
- package/dist/components/zonos-checkbox.d.ts +0 -11
- package/dist/components/zonos-checkbox.js +0 -6
- package/dist/components/zonos-checkbox2.js +0 -96
- package/dist/components/zonos-checkout-finish.d.ts +0 -11
- package/dist/components/zonos-checkout-finish.js +0 -6
- package/dist/components/zonos-checkout-finish2.js +0 -246
- package/dist/components/zonos-checkout-footer.d.ts +0 -11
- package/dist/components/zonos-checkout-footer.js +0 -6
- package/dist/components/zonos-checkout-footer2.js +0 -125
- package/dist/components/zonos-checkout-payment.d.ts +0 -11
- package/dist/components/zonos-checkout-payment.js +0 -6
- package/dist/components/zonos-checkout-payment2.js +0 -104
- package/dist/components/zonos-checkout-progress-tabs.d.ts +0 -11
- package/dist/components/zonos-checkout-progress-tabs.js +0 -6
- package/dist/components/zonos-checkout-progress-tabs2.js +0 -138
- package/dist/components/zonos-checkout.d.ts +0 -11
- package/dist/components/zonos-checkout.js +0 -1051
- package/dist/components/zonos-collapse.d.ts +0 -11
- package/dist/components/zonos-collapse.js +0 -6
- package/dist/components/zonos-collapse2.js +0 -78
- package/dist/components/zonos-component.d.ts +0 -11
- package/dist/components/zonos-component.js +0 -48
- package/dist/components/zonos-confirm-dialog.d.ts +0 -11
- package/dist/components/zonos-confirm-dialog.js +0 -6
- package/dist/components/zonos-confirm-dialog2.js +0 -161
- package/dist/components/zonos-controller.d.ts +0 -11
- package/dist/components/zonos-controller.js +0 -309
- package/dist/components/zonos-country-flag.d.ts +0 -11
- package/dist/components/zonos-country-flag.js +0 -6
- package/dist/components/zonos-country-flag2.js +0 -54
- package/dist/components/zonos-country-select.d.ts +0 -11
- package/dist/components/zonos-country-select.js +0 -6
- package/dist/components/zonos-country-select2.js +0 -1891
- package/dist/components/zonos-custom-message.d.ts +0 -11
- package/dist/components/zonos-custom-message.js +0 -6
- package/dist/components/zonos-custom-message2.js +0 -72
- package/dist/components/zonos-customer-info.d.ts +0 -11
- package/dist/components/zonos-customer-info.js +0 -6
- package/dist/components/zonos-customer-info2.js +0 -316
- package/dist/components/zonos-dialog.d.ts +0 -11
- package/dist/components/zonos-dialog.js +0 -6
- package/dist/components/zonos-dialog2.js +0 -136
- package/dist/components/zonos-hello-dialog-footer.d.ts +0 -11
- package/dist/components/zonos-hello-dialog-footer.js +0 -6
- package/dist/components/zonos-hello-dialog-footer2.js +0 -83
- package/dist/components/zonos-hello-dialog.d.ts +0 -11
- package/dist/components/zonos-hello-dialog.js +0 -6
- package/dist/components/zonos-hello-dialog2.js +0 -305
- package/dist/components/zonos-hello.d.ts +0 -11
- package/dist/components/zonos-hello.js +0 -879
- package/dist/components/zonos-icon.d.ts +0 -11
- package/dist/components/zonos-icon.js +0 -6
- package/dist/components/zonos-icon2.js +0 -55
- package/dist/components/zonos-input.d.ts +0 -11
- package/dist/components/zonos-input.js +0 -6
- package/dist/components/zonos-input2.js +0 -78
- package/dist/components/zonos-language-select.d.ts +0 -11
- package/dist/components/zonos-language-select.js +0 -6
- package/dist/components/zonos-language-select2.js +0 -88
- package/dist/components/zonos-link-authentication.d.ts +0 -11
- package/dist/components/zonos-link-authentication.js +0 -6
- package/dist/components/zonos-link-authentication2.js +0 -80
- package/dist/components/zonos-link.d.ts +0 -11
- package/dist/components/zonos-link.js +0 -43
- package/dist/components/zonos-logo.d.ts +0 -11
- package/dist/components/zonos-logo.js +0 -49
- package/dist/components/zonos-notification.d.ts +0 -11
- package/dist/components/zonos-notification.js +0 -6
- package/dist/components/zonos-notification2.js +0 -92
- package/dist/components/zonos-payment.d.ts +0 -11
- package/dist/components/zonos-payment.js +0 -6
- package/dist/components/zonos-payment2.js +0 -77
- package/dist/components/zonos-review.d.ts +0 -11
- package/dist/components/zonos-review.js +0 -6
- package/dist/components/zonos-review2.js +0 -89
- package/dist/components/zonos-select-dialog-header.d.ts +0 -11
- package/dist/components/zonos-select-dialog-header.js +0 -6
- package/dist/components/zonos-select-dialog-header2.js +0 -71
- package/dist/components/zonos-shipping-rich-radio.d.ts +0 -11
- package/dist/components/zonos-shipping-rich-radio.js +0 -6
- package/dist/components/zonos-shipping-rich-radio2.js +0 -88
- package/dist/components/zonos-shipping.d.ts +0 -11
- package/dist/components/zonos-shipping.js +0 -6
- package/dist/components/zonos-shipping2.js +0 -159
- package/dist/components/zonos-spinner.d.ts +0 -11
- package/dist/components/zonos-spinner.js +0 -6
- package/dist/components/zonos-spinner2.js +0 -43
- package/dist/components/zonos-text.d.ts +0 -11
- package/dist/components/zonos-text.js +0 -6
- package/dist/components/zonos-text2.js +0 -182
- package/dist/components/zonos-tooltip.d.ts +0 -11
- package/dist/components/zonos-tooltip.js +0 -6
- package/dist/components/zonos-tooltip2.js +0 -48
- package/dist/components/zonos-v-stack.d.ts +0 -11
- package/dist/components/zonos-v-stack.js +0 -6
- package/dist/components/zonos-v-stack2.js +0 -38
- package/dist/components/zonosStore.js +0 -2881
- package/dist/esm-es5/cart-cc593c2b.js +0 -1
- package/dist/esm-es5/submitGtag-e50f903f.js +0 -1
- package/dist/scripts/checkIfLoadVersionDomain.js +0 -1
- package/dist/scripts/extractZonosQaUrl.js +0 -1
- package/dist/scripts/getTempCartById.js +0 -1
- package/dist/scripts/loadStripe.js +0 -1
- package/dist/scripts/stripe.js +0 -1
- package/dist/scripts/zonosBase.js +0 -1
- package/dist/zonos-elements/p-04030a48.entry.js +0 -1
- package/dist/zonos-elements/p-0e892292.entry.js +0 -1
- package/dist/zonos-elements/p-0fac99e7.entry.js +0 -1
- package/dist/zonos-elements/p-1795c760.system.entry.js +0 -1
- package/dist/zonos-elements/p-24ac1c6f.entry.js +0 -1
- package/dist/zonos-elements/p-26a60a6e.entry.js +0 -1
- package/dist/zonos-elements/p-32744531.entry.js +0 -1
- package/dist/zonos-elements/p-35ac375a.system.entry.js +0 -1
- package/dist/zonos-elements/p-3bc88c3c.system.entry.js +0 -1
- package/dist/zonos-elements/p-4caaaaeb.system.entry.js +0 -1
- package/dist/zonos-elements/p-50ea2036.system.js +0 -1
- package/dist/zonos-elements/p-5e783394.entry.js +0 -1
- package/dist/zonos-elements/p-6366e7e3.entry.js +0 -1
- package/dist/zonos-elements/p-7c8ee4b9.system.entry.js +0 -1
- package/dist/zonos-elements/p-80ea85b8.entry.js +0 -1
- package/dist/zonos-elements/p-8da16d53.system.js +0 -1
- package/dist/zonos-elements/p-98a0b694.system.entry.js +0 -1
- package/dist/zonos-elements/p-b98cdf39.system.entry.js +0 -1
- package/dist/zonos-elements/p-d7b8c1c1.system.entry.js +0 -1
- package/dist/zonos-elements/p-dd0fd351.entry.js +0 -1
- package/dist/zonos-elements/p-e015cb0e.js +0 -1
- package/dist/zonos-elements/p-e1fbd05d.system.entry.js +0 -1
- package/dist/zonos-elements/p-e553dd19.js +0 -1
- package/dist/zonos-elements/p-e6fa0ebc.system.js +0 -1
- package/dist/zonos-elements/p-f6546bf4.system.entry.js +0 -1
- /package/dist/collection/components/common/{component-template/zonos-link → zonos-link}/zonos-link.css +0 -0
- /package/dist/collection/scripts/{checkIfLoadVersionDomain.js → _checkIfLoadVersionDomain.js} +0 -0
- /package/dist/collection/scripts/{stripe.js → _stripe.js} +0 -0
- /package/dist/types/components/common/{component-template/zonos-link → zonos-link}/zonos-link.d.ts +0 -0
- /package/dist/types/scripts/{checkIfLoadVersionDomain.d.ts → _checkIfLoadVersionDomain.d.ts} +0 -0
- /package/dist/types/scripts/{stripe.d.ts → _stripe.d.ts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-7c6205ca.js');
|
|
4
|
+
const logError = require('./logError-4e2f2020.js');
|
|
4
5
|
const isDarkColor = require('./isDarkColor-b0393089.js');
|
|
5
6
|
const getBorderRadius = require('./getBorderRadius-bcb309a8.js');
|
|
6
7
|
|
|
@@ -5745,60 +5746,6 @@ const getCountries = async () => {
|
|
|
5745
5746
|
}
|
|
5746
5747
|
};
|
|
5747
5748
|
|
|
5748
|
-
const log = (message, type, ...additionalInfo) => {
|
|
5749
|
-
var _a, _b;
|
|
5750
|
-
const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
|
|
5751
|
-
!!window.location.search.match(/\?.*(&*)zonosDebug=1/);
|
|
5752
|
-
// if debug is false, do not log
|
|
5753
|
-
if (!isDebug) {
|
|
5754
|
-
// log errors to the console if the type is error
|
|
5755
|
-
if (type === 'error') {
|
|
5756
|
-
// eslint-disable-next-line no-console
|
|
5757
|
-
console.error(message, ...additionalInfo);
|
|
5758
|
-
}
|
|
5759
|
-
return;
|
|
5760
|
-
}
|
|
5761
|
-
let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
|
|
5762
|
-
if (!loggingIframe) {
|
|
5763
|
-
// add a hidden iframe
|
|
5764
|
-
loggingIframe = document.createElement('iframe');
|
|
5765
|
-
loggingIframe.id = 'zonos---debug-logging-iframe';
|
|
5766
|
-
loggingIframe.style.display = 'none';
|
|
5767
|
-
loggingIframe.style.opacity = '0';
|
|
5768
|
-
loggingIframe.style.position = 'absolute';
|
|
5769
|
-
loggingIframe.style.top = '-9999px';
|
|
5770
|
-
loggingIframe.style.left = '-9999px';
|
|
5771
|
-
loggingIframe.style.width = '1px';
|
|
5772
|
-
loggingIframe.style.height = '1px';
|
|
5773
|
-
loggingIframe.style.border = 'none';
|
|
5774
|
-
loggingIframe.style.overflow = 'hidden';
|
|
5775
|
-
loggingIframe.style.visibility = 'hidden';
|
|
5776
|
-
document.body.appendChild(loggingIframe);
|
|
5777
|
-
}
|
|
5778
|
-
// use the logging iframe's console to log just in case the console is disabled (overriden) by the site owner
|
|
5779
|
-
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
5780
|
-
switch (type) {
|
|
5781
|
-
case 'warn':
|
|
5782
|
-
zConsole.warn(message, ...additionalInfo);
|
|
5783
|
-
break;
|
|
5784
|
-
case 'info':
|
|
5785
|
-
zConsole.info(message, ...additionalInfo);
|
|
5786
|
-
break;
|
|
5787
|
-
case 'error':
|
|
5788
|
-
zConsole.error(message, ...additionalInfo);
|
|
5789
|
-
break;
|
|
5790
|
-
default:
|
|
5791
|
-
zConsole.groupCollapsed(message, ...additionalInfo);
|
|
5792
|
-
zConsole.trace();
|
|
5793
|
-
zConsole.groupEnd();
|
|
5794
|
-
break;
|
|
5795
|
-
}
|
|
5796
|
-
};
|
|
5797
|
-
|
|
5798
|
-
const logError = (message, ...rest) => {
|
|
5799
|
-
log(message, 'error', ...rest);
|
|
5800
|
-
};
|
|
5801
|
-
|
|
5802
5749
|
const getCountryLandedCost = async (countryCode) => {
|
|
5803
5750
|
var _a;
|
|
5804
5751
|
if (!countryCode) {
|
|
@@ -5807,7 +5754,7 @@ const getCountryLandedCost = async (countryCode) => {
|
|
|
5807
5754
|
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/country-landed-cost/${countryCode}`;
|
|
5808
5755
|
const { errors, json } = await handleFetch(url);
|
|
5809
5756
|
if (errors.length || !json) {
|
|
5810
|
-
logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
5757
|
+
logError.logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
5811
5758
|
return null;
|
|
5812
5759
|
}
|
|
5813
5760
|
return json || null;
|
|
@@ -5822,7 +5769,7 @@ const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCu
|
|
|
5822
5769
|
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}`;
|
|
5823
5770
|
const { errors, json } = await handleFetch(url);
|
|
5824
5771
|
if (errors.length || !json) {
|
|
5825
|
-
logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
5772
|
+
logError.logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
5826
5773
|
return { exchangeRate: null, maxAge: null };
|
|
5827
5774
|
}
|
|
5828
5775
|
const { maxAge, rate, targetFormat } = json.exchangeRateCreate;
|
|
@@ -5839,7 +5786,7 @@ const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
|
|
|
5839
5786
|
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/locale-messages?countryCode=${countryCode}&storeId=${storeId}&localeTo=${localeTo}`;
|
|
5840
5787
|
const { errors, json } = await handleFetch(url);
|
|
5841
5788
|
if (errors.length || !json) {
|
|
5842
|
-
logError('Error fetching exchange rate', (_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message);
|
|
5789
|
+
logError.logError('Error fetching exchange rate', (_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message);
|
|
5843
5790
|
return [];
|
|
5844
5791
|
}
|
|
5845
5792
|
return json.locale_countryCodesPage;
|
|
@@ -5883,7 +5830,7 @@ const getShippingZones = async () => {
|
|
|
5883
5830
|
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/shipping-zones`;
|
|
5884
5831
|
const { errors, json } = await handleFetch(url);
|
|
5885
5832
|
if (errors.length || !json) {
|
|
5886
|
-
logError(`Error fetching shipping zones: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
5833
|
+
logError.logError(`Error fetching shipping zones: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
5887
5834
|
return null;
|
|
5888
5835
|
}
|
|
5889
5836
|
const shippingZones = (_b = json === null || json === void 0 ? void 0 : json.shippingZones) === null || _b === void 0 ? void 0 : _b.flatMap(zone => zone === null || zone === void 0 ? void 0 : zone.countryCodes).filter(Boolean);
|
|
@@ -5960,12 +5907,12 @@ const isValidSelector = (selector) => {
|
|
|
5960
5907
|
const getCurrencyElements = (selector) => {
|
|
5961
5908
|
const currencySelector = selector || '.money';
|
|
5962
5909
|
if (!isValidSelector(currencySelector)) {
|
|
5963
|
-
logError(`Currency element selector "${currencySelector}" is not valid.`);
|
|
5910
|
+
logError.logError(`Currency element selector "${currencySelector}" is not valid.`);
|
|
5964
5911
|
return null;
|
|
5965
5912
|
}
|
|
5966
5913
|
const currencyElements = document.querySelectorAll(currencySelector);
|
|
5967
5914
|
if (!currencyElements.length) {
|
|
5968
|
-
log(`No currency elements found with selector "${currencySelector}"`, 'warn');
|
|
5915
|
+
logError.log(`No currency elements found with selector "${currencySelector}"`, 'warn');
|
|
5969
5916
|
return null;
|
|
5970
5917
|
}
|
|
5971
5918
|
// return array of currency elements instead of a NodeList
|
|
@@ -6020,7 +5967,7 @@ const defaultCurrencyConverter = () => {
|
|
|
6020
5967
|
return;
|
|
6021
5968
|
}
|
|
6022
5969
|
if (!localizationStore.exchangeRate) {
|
|
6023
|
-
logError('Could not display currency. Exchange rate and format data is not available.');
|
|
5970
|
+
logError.logError('Could not display currency. Exchange rate and format data is not available.');
|
|
6024
5971
|
return;
|
|
6025
5972
|
}
|
|
6026
5973
|
currencyElements.forEach((element) => {
|
|
@@ -6063,7 +6010,11 @@ const setZCountryUrlParam = (selectedCountryCode) => {
|
|
|
6063
6010
|
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
6064
6011
|
urlSearchParams.set('zCountry', selectedCountryCode);
|
|
6065
6012
|
const newUrl = `${window.location.pathname}?${urlSearchParams.toString()}`;
|
|
6066
|
-
|
|
6013
|
+
/**
|
|
6014
|
+
* Setting the state to null in window.history.replaceState can cause issues with rendering when using next/link and pressing the back button.
|
|
6015
|
+
* @ref https://github.com/vercel/next.js/issues/33233#issuecomment-1052349396
|
|
6016
|
+
**/
|
|
6017
|
+
window.history.replaceState(window.history.state, document.title, newUrl);
|
|
6067
6018
|
};
|
|
6068
6019
|
|
|
6069
6020
|
const { onChange: localizationStoreOnUpdate, state: localizationStore } = zonosStore.createStore({
|
|
@@ -6105,7 +6056,7 @@ const startExchangeRateTimeout = ({ isGuaranteed, maxAge, }) => {
|
|
|
6105
6056
|
}, maxAgeToUse * 1000);
|
|
6106
6057
|
};
|
|
6107
6058
|
const getNewLocalization = async () => {
|
|
6108
|
-
log('get new localization store');
|
|
6059
|
+
logError.log('get new localization store');
|
|
6109
6060
|
const { isShippableCountry, selectedCountryCode } = localizationStore;
|
|
6110
6061
|
if (zonosStore.zonosStore.helloSettings.currencyBehavior === 'DISABLED' ||
|
|
6111
6062
|
!isShippableCountry ||
|
|
@@ -6143,7 +6094,7 @@ const getOverrideLocale = () => {
|
|
|
6143
6094
|
};
|
|
6144
6095
|
const localizationStoreUpdateSelectedCountryCode = (newSelectedCountryCode) => {
|
|
6145
6096
|
var _a, _b;
|
|
6146
|
-
log('update selected country code');
|
|
6097
|
+
logError.log('update selected country code');
|
|
6147
6098
|
localizationStore.selectedCountryCode = newSelectedCountryCode;
|
|
6148
6099
|
const { selectedCountryCode, shippingZoneCountries } = localizationStore;
|
|
6149
6100
|
const isShippableCountry = shippingZoneCountries &&
|
|
@@ -6151,7 +6102,7 @@ const localizationStoreUpdateSelectedCountryCode = (newSelectedCountryCode) => {
|
|
|
6151
6102
|
!!shippingZoneCountries[selectedCountryCode];
|
|
6152
6103
|
// update shippable country
|
|
6153
6104
|
localizationStore.isShippableCountry = !!isShippableCountry;
|
|
6154
|
-
log(`Is shippable country: ${localizationStore.isShippableCountry}`);
|
|
6105
|
+
logError.log(`Is shippable country: ${localizationStore.isShippableCountry}`);
|
|
6155
6106
|
if (!selectedCountryCode) {
|
|
6156
6107
|
return;
|
|
6157
6108
|
}
|
|
@@ -6223,7 +6174,7 @@ const updateCheckoutSessionLanguage = async () => {
|
|
|
6223
6174
|
method: 'POST',
|
|
6224
6175
|
});
|
|
6225
6176
|
if (errors.length || !json) {
|
|
6226
|
-
logError('Error occurs when updating checkout session', JSON.stringify(errors, null, 2));
|
|
6177
|
+
logError.logError('Error occurs when updating checkout session', JSON.stringify(errors, null, 2));
|
|
6227
6178
|
return { errors, json };
|
|
6228
6179
|
}
|
|
6229
6180
|
return { errors: [], json };
|
|
@@ -6568,7 +6519,7 @@ const initStripeElements = async (props) => {
|
|
|
6568
6519
|
var _a, _b;
|
|
6569
6520
|
const clientSecret = stripeStore.clientSecret;
|
|
6570
6521
|
if (!stripeStore.stripe) {
|
|
6571
|
-
log('Skip. Stripe is not initialized');
|
|
6522
|
+
logError.log('Skip. Stripe is not initialized');
|
|
6572
6523
|
return;
|
|
6573
6524
|
}
|
|
6574
6525
|
if (clientSecret) {
|
|
@@ -6588,11 +6539,11 @@ const initStripeElements = async (props) => {
|
|
|
6588
6539
|
stripeStore.stripeElements = (_a = stripeStore.stripe) === null || _a === void 0 ? void 0 : _a.elements(stripeOptions);
|
|
6589
6540
|
// save stripe elements options for later comparison
|
|
6590
6541
|
stripeStore.stripeElementsOptions = stripeOptions;
|
|
6591
|
-
log('Stripe elements initialized');
|
|
6542
|
+
logError.log('Stripe elements initialized');
|
|
6592
6543
|
// init stripe elements for billing address
|
|
6593
6544
|
stripeStore.stripeElementsForBillingAddress =
|
|
6594
6545
|
(_b = stripeStore.stripe) === null || _b === void 0 ? void 0 : _b.elements(stripeOptions);
|
|
6595
|
-
log('Stripe elements for billing address initialized');
|
|
6546
|
+
logError.log('Stripe elements for billing address initialized');
|
|
6596
6547
|
return;
|
|
6597
6548
|
}
|
|
6598
6549
|
if (!isSameOptions) {
|
|
@@ -6603,7 +6554,7 @@ const initStripeElements = async (props) => {
|
|
|
6603
6554
|
// save stripe elements options for later comparison
|
|
6604
6555
|
stripeStore.stripeElementsOptions = stripeOptions;
|
|
6605
6556
|
}
|
|
6606
|
-
log('Stripe elements initialized');
|
|
6557
|
+
logError.log('Stripe elements initialized');
|
|
6607
6558
|
}
|
|
6608
6559
|
};
|
|
6609
6560
|
const stripeStoreReset = () => {
|
|
@@ -6718,7 +6669,7 @@ const stripeStorePrefetchLandedCost = async () => {
|
|
|
6718
6669
|
// default to empty array if we fail to fetch landed cost, so we can show the error message
|
|
6719
6670
|
cartStore.landedCostData = [];
|
|
6720
6671
|
cartStore.shippingData = [];
|
|
6721
|
-
logError(err);
|
|
6672
|
+
logError.logError(err);
|
|
6722
6673
|
}
|
|
6723
6674
|
stripeStore.isFetchingLandedCost = false;
|
|
6724
6675
|
}
|
|
@@ -6776,7 +6727,7 @@ const stripeStoreRetrievePayment = async ({ clientSecret: _clientSecret, storybo
|
|
|
6776
6727
|
}
|
|
6777
6728
|
const clientSecret = _clientSecret || stripeStore.clientSecret;
|
|
6778
6729
|
if (!stripeStore.stripe || !clientSecret) {
|
|
6779
|
-
logError('Failed to retrieve payment intent. Stripe is not initialized');
|
|
6730
|
+
logError.logError('Failed to retrieve payment intent. Stripe is not initialized');
|
|
6780
6731
|
return { error: true, message: [translate('Something went wrong.')] };
|
|
6781
6732
|
}
|
|
6782
6733
|
const { paymentIntent } = await stripeStore.stripe.retrievePaymentIntent(clientSecret);
|
|
@@ -6829,7 +6780,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
6829
6780
|
var _a;
|
|
6830
6781
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
6831
6782
|
if (!total || !localizationStore.targetCurrency) {
|
|
6832
|
-
logError('Fail to create checkout session - invalid total or currency');
|
|
6783
|
+
logError.logError('Fail to create checkout session - invalid total or currency');
|
|
6833
6784
|
return false;
|
|
6834
6785
|
}
|
|
6835
6786
|
stripeStore.isFetchingSession = true;
|
|
@@ -6846,7 +6797,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
6846
6797
|
});
|
|
6847
6798
|
stripeStore.isFetchingSession = false;
|
|
6848
6799
|
if (errors.length || !json) {
|
|
6849
|
-
logError('Error occurs when creating checkout session', JSON.stringify(errors, null, 2));
|
|
6800
|
+
logError.logError('Error occurs when creating checkout session', JSON.stringify(errors, null, 2));
|
|
6850
6801
|
return false;
|
|
6851
6802
|
}
|
|
6852
6803
|
const result = json.checkoutSessionCreate;
|
|
@@ -6854,8 +6805,8 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
6854
6805
|
// update cart store with updated informations
|
|
6855
6806
|
cartStore.checkoutSessionId = result.id;
|
|
6856
6807
|
cartStoreApplySubtotals(Object.assign(Object.assign({}, result.subtotals), { landedCostTotal: 0, shipping: 0, total: result.subtotals.items }));
|
|
6857
|
-
log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
|
6858
|
-
log('done-init-checkout-session');
|
|
6808
|
+
logError.log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
|
6809
|
+
logError.log('done-init-checkout-session');
|
|
6859
6810
|
return true;
|
|
6860
6811
|
};
|
|
6861
6812
|
/**
|
|
@@ -6875,7 +6826,7 @@ const stripeStoreUpdateCheckoutSession = async ({ currency, id, itemsAmount, lan
|
|
|
6875
6826
|
method: 'POST',
|
|
6876
6827
|
});
|
|
6877
6828
|
if (errors.length || !json) {
|
|
6878
|
-
logError('Error occurs when updating checkout session', JSON.stringify(errors, null, 2));
|
|
6829
|
+
logError.logError('Error occurs when updating checkout session', JSON.stringify(errors, null, 2));
|
|
6879
6830
|
return { errors, json };
|
|
6880
6831
|
}
|
|
6881
6832
|
return { errors: [], json };
|
|
@@ -6969,7 +6920,7 @@ const stripeStoreTranslateAddressToLatin = async ({ addressInvalidCharactersList
|
|
|
6969
6920
|
method: 'POST',
|
|
6970
6921
|
});
|
|
6971
6922
|
if (errors.length || !json) {
|
|
6972
|
-
logError('Error occurs when translating address to latin', JSON.stringify(errors, null, 2));
|
|
6923
|
+
logError.logError('Error occurs when translating address to latin', JSON.stringify(errors, null, 2));
|
|
6973
6924
|
// reset translated address if we fail to translate and let user manually fix it
|
|
6974
6925
|
stripeStore.translatedAddress = {
|
|
6975
6926
|
address: {},
|
|
@@ -7108,7 +7059,7 @@ const getMatchItem = ({ item1, item2, }) => {
|
|
|
7108
7059
|
* Check and set restricted items in cart
|
|
7109
7060
|
*/
|
|
7110
7061
|
const cartStoreCheckItemRestrictions = (itemsWorkflow) => {
|
|
7111
|
-
log('Checking item restrictions');
|
|
7062
|
+
logError.log('Checking item restrictions');
|
|
7112
7063
|
const mappedRestrictedItems = itemsWorkflow
|
|
7113
7064
|
.map(item => {
|
|
7114
7065
|
if (!item.restriction) {
|
|
@@ -7164,11 +7115,11 @@ const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId,
|
|
|
7164
7115
|
// update cart total right away if we have landed cost id to avoid order total flickering
|
|
7165
7116
|
const subtotals = cartStore.selectedLandedCost.subtotals;
|
|
7166
7117
|
cartStoreApplySubtotals(subtotals);
|
|
7167
|
-
log('Exchange rate updated for cart items (landed cost subtotal)', 'info', cartStore.exchangeRate);
|
|
7118
|
+
logError.log('Exchange rate updated for cart items (landed cost subtotal)', 'info', cartStore.exchangeRate);
|
|
7168
7119
|
}
|
|
7169
7120
|
// update checkout session
|
|
7170
7121
|
if (!cartStore.checkoutSessionId) {
|
|
7171
|
-
logError('Could not update cart total without checkout session id');
|
|
7122
|
+
logError.logError('Could not update cart total without checkout session id');
|
|
7172
7123
|
return false;
|
|
7173
7124
|
}
|
|
7174
7125
|
const { errors, json } = await stripeStoreUpdateCheckoutSession({
|
|
@@ -7180,7 +7131,7 @@ const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId,
|
|
|
7180
7131
|
});
|
|
7181
7132
|
if (errors.length > 0 || !json) {
|
|
7182
7133
|
// do nothing if we can't get checkout session
|
|
7183
|
-
logError('Error occurs when updating checkout session');
|
|
7134
|
+
logError.logError('Error occurs when updating checkout session');
|
|
7184
7135
|
cartStoreUpdateToErrorState({
|
|
7185
7136
|
messages: [
|
|
7186
7137
|
translate("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
@@ -7193,7 +7144,7 @@ const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId,
|
|
|
7193
7144
|
// This is when first open the checkout modal and we just want to get info from the old cart session.
|
|
7194
7145
|
// use subtotals from checkout session to update cart total
|
|
7195
7146
|
cartStoreApplySubtotals(json.checkoutSessionUpdate.subtotals);
|
|
7196
|
-
log('Exchange rate updated for cart items (checkout session update)', 'info', cartStore.exchangeRate);
|
|
7147
|
+
logError.log('Exchange rate updated for cart items (checkout session update)', 'info', cartStore.exchangeRate);
|
|
7197
7148
|
}
|
|
7198
7149
|
return true;
|
|
7199
7150
|
};
|
|
@@ -7319,8 +7270,6 @@ exports.localizationStore = localizationStore;
|
|
|
7319
7270
|
exports.localizationStoreOnUpdate = localizationStoreOnUpdate;
|
|
7320
7271
|
exports.localizationStoreUpdateSelectedCountryCode = localizationStoreUpdateSelectedCountryCode;
|
|
7321
7272
|
exports.localizationStoreUpdateSelectedLocale = localizationStoreUpdateSelectedLocale;
|
|
7322
|
-
exports.log = log;
|
|
7323
|
-
exports.logError = logError;
|
|
7324
7273
|
exports.setZCountryUrlParam = setZCountryUrlParam;
|
|
7325
7274
|
exports.stripeStore = stripeStore;
|
|
7326
7275
|
exports.stripeStoreCleanupDomesticShippingSession = stripeStoreCleanupDomesticShippingSession;
|