@zonos/elements 1.3.18-alpha.2 → 1.3.18-alpha.3
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-5468dfd1.js} +29 -84
- package/dist/cjs/index.cjs.js +624 -0
- package/dist/cjs/logError-4e2f2020.js +58 -0
- package/dist/cjs/{submitGtag-9210b4fe.js → submitGtag-127a220f.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 +15 -14
- package/dist/cjs/zonos-controller.cjs.entry.js +25 -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-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 +3 -3
- 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 +10 -6
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +3 -3
- 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 +40 -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-63d120e1.js} +2 -55
- package/dist/esm/index.js +621 -0
- package/dist/esm/logError-c456c092.js +55 -0
- package/dist/esm/{submitGtag-e50f903f.js → submitGtag-35bb3945.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 +3 -2
- package/dist/esm/zonos-controller.entry.js +8 -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-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-63d120e1.js +1 -0
- package/dist/esm-es5/index.js +1 -0
- package/dist/esm-es5/logError-c456c092.js +1 -0
- package/dist/esm-es5/submitGtag-35bb3945.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-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 +1 -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-023c764c.system.entry.js +1 -0
- package/dist/zonos-elements/p-06b6ce37.system.entry.js +1 -0
- package/dist/zonos-elements/p-07c53d83.entry.js +1 -0
- package/dist/zonos-elements/{p-9aab3ad7.entry.js → p-0d5b5bcc.entry.js} +1 -1
- package/dist/zonos-elements/p-200b661c.entry.js +1 -0
- package/dist/zonos-elements/p-3b66df06.system.entry.js +1 -0
- package/dist/zonos-elements/{p-020a9b86.entry.js → p-3ba8838a.entry.js} +1 -1
- package/dist/zonos-elements/p-428c034a.entry.js +1 -0
- package/dist/zonos-elements/p-43b2d28d.system.entry.js +1 -0
- package/dist/zonos-elements/p-47a42a30.js +1 -0
- package/dist/zonos-elements/{p-d0bc8902.system.entry.js → p-4f72bfee.system.entry.js} +1 -1
- package/dist/zonos-elements/p-4fc1459c.entry.js +1 -0
- package/dist/zonos-elements/p-4fca8fd5.system.entry.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-c20e5430.entry.js → p-6cb9812b.entry.js} +1 -1
- package/dist/zonos-elements/p-6df1fc3a.system.entry.js +1 -0
- package/dist/zonos-elements/p-6f6f160d.entry.js +1 -0
- package/dist/zonos-elements/p-7c78e340.entry.js +1 -0
- package/dist/zonos-elements/p-808fa731.js +1 -0
- package/dist/zonos-elements/p-80f174b9.system.js +1 -0
- package/dist/zonos-elements/p-85f3d13f.system.js +1 -0
- package/dist/zonos-elements/p-8aeb0629.entry.js +1 -0
- package/dist/zonos-elements/p-9288fd21.system.entry.js +1 -0
- package/dist/zonos-elements/p-98ad4ab3.system.entry.js +1 -0
- package/dist/zonos-elements/p-b1567fa3.system.entry.js +1 -0
- package/dist/zonos-elements/p-b81562f5.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-cfae51c1.system.js +1 -0
- package/dist/zonos-elements/p-d6eb260c.entry.js +1 -0
- package/dist/zonos-elements/p-dc40a60c.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-de405d7e.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/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,879 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { _ as _root, e as _baseGetTag, i as isObjectLike_1, f as isObject_1, z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore.js';
|
|
3
|
-
import { v as handleFetch, l as logError, a as localizationStore, B as isValidSelector, D as getZCountryUrlParam, E as setZCountryUrlParam, d as log, F as currencyDisplay, G as currencyConvertAndFormat, H as currencyConvert, I as currencyFormat } from './stripe.js';
|
|
4
|
-
import { a as translate } from './translationStore.js';
|
|
5
|
-
import { c as classes } from './classes.js';
|
|
6
|
-
import { g as getHasMoreSpaceOnRight, d as defineCustomElement$9 } from './zonos-hello-dialog2.js';
|
|
7
|
-
import { d as defineCustomElement$f } from './zonos-banner2.js';
|
|
8
|
-
import { d as defineCustomElement$e } from './zonos-button2.js';
|
|
9
|
-
import { d as defineCustomElement$d } from './zonos-card2.js';
|
|
10
|
-
import { d as defineCustomElement$c } from './zonos-country-flag2.js';
|
|
11
|
-
import { d as defineCustomElement$b } from './zonos-country-select2.js';
|
|
12
|
-
import { d as defineCustomElement$a } from './zonos-custom-message2.js';
|
|
13
|
-
import { d as defineCustomElement$8 } from './zonos-hello-dialog-footer2.js';
|
|
14
|
-
import { d as defineCustomElement$7 } from './zonos-icon2.js';
|
|
15
|
-
import { d as defineCustomElement$6 } from './zonos-language-select2.js';
|
|
16
|
-
import { d as defineCustomElement$5 } from './zonos-select-dialog-header2.js';
|
|
17
|
-
import { d as defineCustomElement$4 } from './zonos-spinner2.js';
|
|
18
|
-
import { d as defineCustomElement$3 } from './zonos-text2.js';
|
|
19
|
-
import { d as defineCustomElement$2 } from './zonos-v-stack2.js';
|
|
20
|
-
|
|
21
|
-
var root = _root;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
25
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
26
|
-
*
|
|
27
|
-
* @static
|
|
28
|
-
* @memberOf _
|
|
29
|
-
* @since 2.4.0
|
|
30
|
-
* @category Date
|
|
31
|
-
* @returns {number} Returns the timestamp.
|
|
32
|
-
* @example
|
|
33
|
-
*
|
|
34
|
-
* _.defer(function(stamp) {
|
|
35
|
-
* console.log(_.now() - stamp);
|
|
36
|
-
* }, _.now());
|
|
37
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
38
|
-
*/
|
|
39
|
-
var now$1 = function() {
|
|
40
|
-
return root.Date.now();
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
var now_1 = now$1;
|
|
44
|
-
|
|
45
|
-
/** Used to match a single whitespace character. */
|
|
46
|
-
|
|
47
|
-
var reWhitespace = /\s/;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
51
|
-
* character of `string`.
|
|
52
|
-
*
|
|
53
|
-
* @private
|
|
54
|
-
* @param {string} string The string to inspect.
|
|
55
|
-
* @returns {number} Returns the index of the last non-whitespace character.
|
|
56
|
-
*/
|
|
57
|
-
function trimmedEndIndex$1(string) {
|
|
58
|
-
var index = string.length;
|
|
59
|
-
|
|
60
|
-
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
61
|
-
return index;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
var _trimmedEndIndex = trimmedEndIndex$1;
|
|
65
|
-
|
|
66
|
-
var trimmedEndIndex = _trimmedEndIndex;
|
|
67
|
-
|
|
68
|
-
/** Used to match leading whitespace. */
|
|
69
|
-
var reTrimStart = /^\s+/;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The base implementation of `_.trim`.
|
|
73
|
-
*
|
|
74
|
-
* @private
|
|
75
|
-
* @param {string} string The string to trim.
|
|
76
|
-
* @returns {string} Returns the trimmed string.
|
|
77
|
-
*/
|
|
78
|
-
function baseTrim$1(string) {
|
|
79
|
-
return string
|
|
80
|
-
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
81
|
-
: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
var _baseTrim = baseTrim$1;
|
|
85
|
-
|
|
86
|
-
var baseGetTag = _baseGetTag,
|
|
87
|
-
isObjectLike = isObjectLike_1;
|
|
88
|
-
|
|
89
|
-
/** `Object#toString` result references. */
|
|
90
|
-
var symbolTag = '[object Symbol]';
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
94
|
-
*
|
|
95
|
-
* @static
|
|
96
|
-
* @memberOf _
|
|
97
|
-
* @since 4.0.0
|
|
98
|
-
* @category Lang
|
|
99
|
-
* @param {*} value The value to check.
|
|
100
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
101
|
-
* @example
|
|
102
|
-
*
|
|
103
|
-
* _.isSymbol(Symbol.iterator);
|
|
104
|
-
* // => true
|
|
105
|
-
*
|
|
106
|
-
* _.isSymbol('abc');
|
|
107
|
-
* // => false
|
|
108
|
-
*/
|
|
109
|
-
function isSymbol$1(value) {
|
|
110
|
-
return typeof value == 'symbol' ||
|
|
111
|
-
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
var isSymbol_1 = isSymbol$1;
|
|
115
|
-
|
|
116
|
-
var baseTrim = _baseTrim,
|
|
117
|
-
isObject$1 = isObject_1,
|
|
118
|
-
isSymbol = isSymbol_1;
|
|
119
|
-
|
|
120
|
-
/** Used as references for various `Number` constants. */
|
|
121
|
-
var NAN = 0 / 0;
|
|
122
|
-
|
|
123
|
-
/** Used to detect bad signed hexadecimal string values. */
|
|
124
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
125
|
-
|
|
126
|
-
/** Used to detect binary string values. */
|
|
127
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
128
|
-
|
|
129
|
-
/** Used to detect octal string values. */
|
|
130
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
131
|
-
|
|
132
|
-
/** Built-in method references without a dependency on `root`. */
|
|
133
|
-
var freeParseInt = parseInt;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Converts `value` to a number.
|
|
137
|
-
*
|
|
138
|
-
* @static
|
|
139
|
-
* @memberOf _
|
|
140
|
-
* @since 4.0.0
|
|
141
|
-
* @category Lang
|
|
142
|
-
* @param {*} value The value to process.
|
|
143
|
-
* @returns {number} Returns the number.
|
|
144
|
-
* @example
|
|
145
|
-
*
|
|
146
|
-
* _.toNumber(3.2);
|
|
147
|
-
* // => 3.2
|
|
148
|
-
*
|
|
149
|
-
* _.toNumber(Number.MIN_VALUE);
|
|
150
|
-
* // => 5e-324
|
|
151
|
-
*
|
|
152
|
-
* _.toNumber(Infinity);
|
|
153
|
-
* // => Infinity
|
|
154
|
-
*
|
|
155
|
-
* _.toNumber('3.2');
|
|
156
|
-
* // => 3.2
|
|
157
|
-
*/
|
|
158
|
-
function toNumber$1(value) {
|
|
159
|
-
if (typeof value == 'number') {
|
|
160
|
-
return value;
|
|
161
|
-
}
|
|
162
|
-
if (isSymbol(value)) {
|
|
163
|
-
return NAN;
|
|
164
|
-
}
|
|
165
|
-
if (isObject$1(value)) {
|
|
166
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
167
|
-
value = isObject$1(other) ? (other + '') : other;
|
|
168
|
-
}
|
|
169
|
-
if (typeof value != 'string') {
|
|
170
|
-
return value === 0 ? value : +value;
|
|
171
|
-
}
|
|
172
|
-
value = baseTrim(value);
|
|
173
|
-
var isBinary = reIsBinary.test(value);
|
|
174
|
-
return (isBinary || reIsOctal.test(value))
|
|
175
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
176
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
var toNumber_1 = toNumber$1;
|
|
180
|
-
|
|
181
|
-
var isObject = isObject_1,
|
|
182
|
-
now = now_1,
|
|
183
|
-
toNumber = toNumber_1;
|
|
184
|
-
|
|
185
|
-
/** Error message constants. */
|
|
186
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
187
|
-
|
|
188
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
189
|
-
var nativeMax = Math.max,
|
|
190
|
-
nativeMin = Math.min;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
194
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
195
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
196
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
197
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
|
198
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
199
|
-
* with the last arguments provided to the debounced function. Subsequent
|
|
200
|
-
* calls to the debounced function return the result of the last `func`
|
|
201
|
-
* invocation.
|
|
202
|
-
*
|
|
203
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
204
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
205
|
-
* is invoked more than once during the `wait` timeout.
|
|
206
|
-
*
|
|
207
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
208
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
209
|
-
*
|
|
210
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
211
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
212
|
-
*
|
|
213
|
-
* @static
|
|
214
|
-
* @memberOf _
|
|
215
|
-
* @since 0.1.0
|
|
216
|
-
* @category Function
|
|
217
|
-
* @param {Function} func The function to debounce.
|
|
218
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
219
|
-
* @param {Object} [options={}] The options object.
|
|
220
|
-
* @param {boolean} [options.leading=false]
|
|
221
|
-
* Specify invoking on the leading edge of the timeout.
|
|
222
|
-
* @param {number} [options.maxWait]
|
|
223
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
224
|
-
* @param {boolean} [options.trailing=true]
|
|
225
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
226
|
-
* @returns {Function} Returns the new debounced function.
|
|
227
|
-
* @example
|
|
228
|
-
*
|
|
229
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
230
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
231
|
-
*
|
|
232
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
233
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
234
|
-
* 'leading': true,
|
|
235
|
-
* 'trailing': false
|
|
236
|
-
* }));
|
|
237
|
-
*
|
|
238
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
239
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
240
|
-
* var source = new EventSource('/stream');
|
|
241
|
-
* jQuery(source).on('message', debounced);
|
|
242
|
-
*
|
|
243
|
-
* // Cancel the trailing debounced invocation.
|
|
244
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
245
|
-
*/
|
|
246
|
-
function debounce(func, wait, options) {
|
|
247
|
-
var lastArgs,
|
|
248
|
-
lastThis,
|
|
249
|
-
maxWait,
|
|
250
|
-
result,
|
|
251
|
-
timerId,
|
|
252
|
-
lastCallTime,
|
|
253
|
-
lastInvokeTime = 0,
|
|
254
|
-
leading = false,
|
|
255
|
-
maxing = false,
|
|
256
|
-
trailing = true;
|
|
257
|
-
|
|
258
|
-
if (typeof func != 'function') {
|
|
259
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
260
|
-
}
|
|
261
|
-
wait = toNumber(wait) || 0;
|
|
262
|
-
if (isObject(options)) {
|
|
263
|
-
leading = !!options.leading;
|
|
264
|
-
maxing = 'maxWait' in options;
|
|
265
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
266
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function invokeFunc(time) {
|
|
270
|
-
var args = lastArgs,
|
|
271
|
-
thisArg = lastThis;
|
|
272
|
-
|
|
273
|
-
lastArgs = lastThis = undefined;
|
|
274
|
-
lastInvokeTime = time;
|
|
275
|
-
result = func.apply(thisArg, args);
|
|
276
|
-
return result;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function leadingEdge(time) {
|
|
280
|
-
// Reset any `maxWait` timer.
|
|
281
|
-
lastInvokeTime = time;
|
|
282
|
-
// Start the timer for the trailing edge.
|
|
283
|
-
timerId = setTimeout(timerExpired, wait);
|
|
284
|
-
// Invoke the leading edge.
|
|
285
|
-
return leading ? invokeFunc(time) : result;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function remainingWait(time) {
|
|
289
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
290
|
-
timeSinceLastInvoke = time - lastInvokeTime,
|
|
291
|
-
timeWaiting = wait - timeSinceLastCall;
|
|
292
|
-
|
|
293
|
-
return maxing
|
|
294
|
-
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
295
|
-
: timeWaiting;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function shouldInvoke(time) {
|
|
299
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
300
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
301
|
-
|
|
302
|
-
// Either this is the first call, activity has stopped and we're at the
|
|
303
|
-
// trailing edge, the system time has gone backwards and we're treating
|
|
304
|
-
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
305
|
-
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
306
|
-
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
function timerExpired() {
|
|
310
|
-
var time = now();
|
|
311
|
-
if (shouldInvoke(time)) {
|
|
312
|
-
return trailingEdge(time);
|
|
313
|
-
}
|
|
314
|
-
// Restart the timer.
|
|
315
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function trailingEdge(time) {
|
|
319
|
-
timerId = undefined;
|
|
320
|
-
|
|
321
|
-
// Only invoke if we have `lastArgs` which means `func` has been
|
|
322
|
-
// debounced at least once.
|
|
323
|
-
if (trailing && lastArgs) {
|
|
324
|
-
return invokeFunc(time);
|
|
325
|
-
}
|
|
326
|
-
lastArgs = lastThis = undefined;
|
|
327
|
-
return result;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function cancel() {
|
|
331
|
-
if (timerId !== undefined) {
|
|
332
|
-
clearTimeout(timerId);
|
|
333
|
-
}
|
|
334
|
-
lastInvokeTime = 0;
|
|
335
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function flush() {
|
|
339
|
-
return timerId === undefined ? result : trailingEdge(now());
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function debounced() {
|
|
343
|
-
var time = now(),
|
|
344
|
-
isInvoking = shouldInvoke(time);
|
|
345
|
-
|
|
346
|
-
lastArgs = arguments;
|
|
347
|
-
lastThis = this;
|
|
348
|
-
lastCallTime = time;
|
|
349
|
-
|
|
350
|
-
if (isInvoking) {
|
|
351
|
-
if (timerId === undefined) {
|
|
352
|
-
return leadingEdge(lastCallTime);
|
|
353
|
-
}
|
|
354
|
-
if (maxing) {
|
|
355
|
-
// Handle invocations in a tight loop.
|
|
356
|
-
clearTimeout(timerId);
|
|
357
|
-
timerId = setTimeout(timerExpired, wait);
|
|
358
|
-
return invokeFunc(lastCallTime);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (timerId === undefined) {
|
|
362
|
-
timerId = setTimeout(timerExpired, wait);
|
|
363
|
-
}
|
|
364
|
-
return result;
|
|
365
|
-
}
|
|
366
|
-
debounced.cancel = cancel;
|
|
367
|
-
debounced.flush = flush;
|
|
368
|
-
return debounced;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
var debounce_1 = debounce;
|
|
372
|
-
|
|
373
|
-
const checkItemRestrictions = async ({ items, shipFrom, shipTo, }) => {
|
|
374
|
-
var _a;
|
|
375
|
-
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/check-item-restrictions`;
|
|
376
|
-
const body = {
|
|
377
|
-
items,
|
|
378
|
-
shipFrom,
|
|
379
|
-
shipTo,
|
|
380
|
-
};
|
|
381
|
-
const { errors, json } = await handleFetch(url, { body, method: 'POST' });
|
|
382
|
-
if (errors.length || !json) {
|
|
383
|
-
logError(`Error fetching item restrictions: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
384
|
-
return [];
|
|
385
|
-
}
|
|
386
|
-
return json.filter(Boolean);
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
const detectItemRestrictions = async (newProducts) => {
|
|
390
|
-
if (!newProducts.length) {
|
|
391
|
-
return [];
|
|
392
|
-
}
|
|
393
|
-
const { selectedCountryCode } = localizationStore;
|
|
394
|
-
if (!selectedCountryCode) {
|
|
395
|
-
logError('Hello Could not check item restrictions - No country code selected');
|
|
396
|
-
return [];
|
|
397
|
-
}
|
|
398
|
-
const items = newProducts.map(product => ({
|
|
399
|
-
description: product.description,
|
|
400
|
-
name: product.title,
|
|
401
|
-
}));
|
|
402
|
-
const restrictedItems = await checkItemRestrictions({
|
|
403
|
-
items: items,
|
|
404
|
-
shipFrom: 'AD',
|
|
405
|
-
shipTo: selectedCountryCode,
|
|
406
|
-
});
|
|
407
|
-
const restrictedItemsWithName = restrictedItems.map(item => {
|
|
408
|
-
var _a;
|
|
409
|
-
const name = ((_a = items.filter(x => x.description === item.itemDescription).find(Boolean)) === null || _a === void 0 ? void 0 : _a.name) || '';
|
|
410
|
-
return Object.assign(Object.assign({}, item), { name });
|
|
411
|
-
});
|
|
412
|
-
return restrictedItemsWithName;
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
const getCurrentHelloLocalePage = () => {
|
|
416
|
-
const { href } = window.location;
|
|
417
|
-
const { cartUrlPattern, homepageUrlPattern, productDetailUrlPattern, productListUrlPattern, } = zonosStore.helloSettings;
|
|
418
|
-
// The 'if' statements are sorted by most specific to least specific to help with regex matching
|
|
419
|
-
if (cartUrlPattern && new RegExp(cartUrlPattern).test(href)) {
|
|
420
|
-
return 'cart';
|
|
421
|
-
}
|
|
422
|
-
if (productDetailUrlPattern &&
|
|
423
|
-
new RegExp(productDetailUrlPattern).test(href)) {
|
|
424
|
-
return 'productDetail';
|
|
425
|
-
}
|
|
426
|
-
if (productListUrlPattern && new RegExp(productListUrlPattern).test(href)) {
|
|
427
|
-
return 'productList';
|
|
428
|
-
}
|
|
429
|
-
if (homepageUrlPattern && new RegExp(homepageUrlPattern).test(href)) {
|
|
430
|
-
return 'home';
|
|
431
|
-
}
|
|
432
|
-
return '';
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
const getProductsOnPage = () => {
|
|
436
|
-
var _a, _b;
|
|
437
|
-
const { productAddToCartElementSelector, productDescriptionElementSelector, productTitleElementSelector, restrictionBehavior, } = zonosStore.helloSettings;
|
|
438
|
-
if (!productTitleElementSelector || !productDescriptionElementSelector) {
|
|
439
|
-
logError(`Hello Could not check item restrictions - must provide title and description selectors.`);
|
|
440
|
-
}
|
|
441
|
-
const titleNodes = (productTitleElementSelector &&
|
|
442
|
-
isValidSelector(productTitleElementSelector) &&
|
|
443
|
-
document.querySelectorAll(productTitleElementSelector)) ||
|
|
444
|
-
[];
|
|
445
|
-
const descriptionNodes = (productDescriptionElementSelector &&
|
|
446
|
-
isValidSelector(productDescriptionElementSelector) &&
|
|
447
|
-
document.querySelectorAll(productDescriptionElementSelector)) ||
|
|
448
|
-
[];
|
|
449
|
-
if (titleNodes.length !== descriptionNodes.length) {
|
|
450
|
-
// If the title and description selectors don't match, kill item restrictions altogether
|
|
451
|
-
logError('Hello Could not check item restrictions - Title and description selectors do not match');
|
|
452
|
-
return [];
|
|
453
|
-
}
|
|
454
|
-
const shouldDisableCart = restrictionBehavior === 'RESTRICT_AND_BLOCK';
|
|
455
|
-
const cartButtonNodes = (shouldDisableCart &&
|
|
456
|
-
productAddToCartElementSelector &&
|
|
457
|
-
isValidSelector(productAddToCartElementSelector) &&
|
|
458
|
-
document.querySelectorAll(productAddToCartElementSelector)) ||
|
|
459
|
-
[];
|
|
460
|
-
if (shouldDisableCart && cartButtonNodes.length !== descriptionNodes.length) {
|
|
461
|
-
// If the "add to cart" selectors don't match, log the error and continue
|
|
462
|
-
logError('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match');
|
|
463
|
-
}
|
|
464
|
-
const mergedElements = [];
|
|
465
|
-
for (let i = 0; i < titleNodes.length; i++) {
|
|
466
|
-
const titleNode = titleNodes[i];
|
|
467
|
-
const descriptionNode = descriptionNodes[i];
|
|
468
|
-
const cartButtonNode = cartButtonNodes[i];
|
|
469
|
-
if (titleNode && descriptionNode) {
|
|
470
|
-
const element = {
|
|
471
|
-
cartButtonNode: cartButtonNode || null,
|
|
472
|
-
description: ((_a = descriptionNode.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '',
|
|
473
|
-
title: ((_b = titleNode.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '',
|
|
474
|
-
};
|
|
475
|
-
mergedElements.push(element);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return mergedElements;
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
const zonosHelloCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:inline-block}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:6px;border-radius:30px;background:var(--zonos-elements-page-background);font-size:var(--zonos-elements-font-size-s);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--zonos-elements-text-color);position:absolute;background:var(--zonos-elements-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:30px;border-bottom-left-radius:30px;left:0;-webkit-transform:translateX(calc(-100% + 16px));transform:translateX(calc(-100% + 16px));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--zonos-elements-border);border-bottom:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 6px;padding-right:16px;border:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:0;border-bottom-left-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:0;border-bottom-right-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{border-left:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:16px;padding-right:6px;border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - 16px));transform:translateX(calc(100% - 16px));right:0;left:auto;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:30px;border-bottom-right-radius:30px}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center}@media (max-width: 768px){:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:24px}}@media (max-width: 768px){:host .zonos--hello-widget{position:fixed;bottom:32px;right:32px;border-radius:var(--zonos-elements-radius-4);padding:4px;border:1px solid transparent}:host .zonos--hello-widget.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--zonos-elements-radius-4);border-bottom-left-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--zonos-elements-radius-4);border-bottom-right-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--zonos-elements-radius-4)}}:host .zonos--hello-mobile-override.zonos--hello-widget{position:fixed;bottom:32px;right:32px;border-radius:var(--zonos-elements-radius-4);padding:4px;border:1px solid transparent}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--zonos-elements-radius-4);border-bottom-left-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--zonos-elements-radius-4);border-bottom-right-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:24px}";
|
|
482
|
-
const ZonosHelloStyle0 = zonosHelloCss;
|
|
483
|
-
|
|
484
|
-
const PEEK_MESSAGE_CLOSE_DELAY_MS = 3000;
|
|
485
|
-
const RESIZE_DEBOUNCE_DELAY_MS = 500;
|
|
486
|
-
const ZonosHello$1 = /*@__PURE__*/ proxyCustomElement(class ZonosHello extends HTMLElement {
|
|
487
|
-
constructor() {
|
|
488
|
-
super();
|
|
489
|
-
this.__registerHost();
|
|
490
|
-
this.__attachShadow();
|
|
491
|
-
this.getHelloPeekMessage = (organizationName) => {
|
|
492
|
-
const isRestrictionPage = zonosStore.currentHelloPage === 'productDetail' ||
|
|
493
|
-
zonosStore.currentHelloPage === 'productList';
|
|
494
|
-
if (isRestrictionPage && this.allRestrictedItems.length) {
|
|
495
|
-
const clickMessage = translate('click to learn more');
|
|
496
|
-
const restrictMessage = zonosStore.currentHelloPage === 'productDetail'
|
|
497
|
-
? translate('Restricted item')
|
|
498
|
-
: translate('Restricted items found');
|
|
499
|
-
return `${restrictMessage} - ${clickMessage}`;
|
|
500
|
-
}
|
|
501
|
-
switch (zonosStore.currentHelloPage) {
|
|
502
|
-
case 'cart':
|
|
503
|
-
return translate(`Prepay duties and taxes at checkout`);
|
|
504
|
-
case 'productList':
|
|
505
|
-
case 'productDetail':
|
|
506
|
-
return translate(`See duty and tax thresholds`);
|
|
507
|
-
default:
|
|
508
|
-
return `${translate('Welcome to')} ${organizationName}`;
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
this.enableShowPeekMessage = () => {
|
|
512
|
-
if (this.peekMessage) {
|
|
513
|
-
this.showPeekMessage = true;
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
this.getNewItemRestrictions = async (newProducts) => {
|
|
517
|
-
const isRestrictionPage = zonosStore.currentHelloPage === 'productDetail' ||
|
|
518
|
-
zonosStore.currentHelloPage === 'productList';
|
|
519
|
-
// Only run detectItemRestrictions on product pages if the restrictionBehavior is not DISABLED
|
|
520
|
-
if (!isRestrictionPage ||
|
|
521
|
-
zonosStore.helloSettings.restrictionBehavior === 'DISABLED') {
|
|
522
|
-
return [];
|
|
523
|
-
}
|
|
524
|
-
const newRestrictions = await detectItemRestrictions(newProducts);
|
|
525
|
-
return newRestrictions;
|
|
526
|
-
};
|
|
527
|
-
this.triggerShowPeekMessage = () => {
|
|
528
|
-
this.peekMessage = this.getHelloPeekMessage(zonosStore.organizationName);
|
|
529
|
-
const { peekMessageBehavior, peekMessageDelay } = zonosStore.helloSettings;
|
|
530
|
-
// peek message delay is passed in seconds, but setTimeout expects milliseconds
|
|
531
|
-
const peekMessageDelayToUse = peekMessageDelay * 1000;
|
|
532
|
-
if (peekMessageBehavior === 'ENABLED') {
|
|
533
|
-
setTimeout(() => {
|
|
534
|
-
this.enableShowPeekMessage();
|
|
535
|
-
const hasRestrictions = this.allRestrictedItems.some(item => this.productsOnPage.some(product => product.description === item.itemDescription));
|
|
536
|
-
if (!hasRestrictions) {
|
|
537
|
-
// If restrictions, persist the message until they hover over the hello widget
|
|
538
|
-
setTimeout(() => {
|
|
539
|
-
this.showPeekMessage = false;
|
|
540
|
-
}, PEEK_MESSAGE_CLOSE_DELAY_MS);
|
|
541
|
-
}
|
|
542
|
-
}, peekMessageDelayToUse);
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
this.disableAddToCartButtons = () => {
|
|
546
|
-
// Remove disabled attribute from all "add to cart" buttons
|
|
547
|
-
if (this.productsOnPage.length) {
|
|
548
|
-
this.productsOnPage.forEach(product => {
|
|
549
|
-
var _a, _b;
|
|
550
|
-
const isRestricted = this.allRestrictedItems.some(item => item.itemDescription === product.description);
|
|
551
|
-
// if a product description matches a restrictedItems itemDescription, then disable the add to cart button. Otherwise, enable it.
|
|
552
|
-
if (isRestricted) {
|
|
553
|
-
(_a = product.cartButtonNode) === null || _a === void 0 ? void 0 : _a.setAttribute('disabled', 'disabled');
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
(_b = product.cartButtonNode) === null || _b === void 0 ? void 0 : _b.removeAttribute('disabled');
|
|
557
|
-
}
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
this.handleItemRestrictions = async () => {
|
|
562
|
-
this.productsOnPage = getProductsOnPage();
|
|
563
|
-
const newProducts = this.productsOnPage.filter(product => !this.allFoundProducts.some(foundProduct => foundProduct.title === product.title));
|
|
564
|
-
const newRestrictions = await this.getNewItemRestrictions(newProducts);
|
|
565
|
-
this.allRestrictedItems.push(...newRestrictions);
|
|
566
|
-
this.allFoundProducts.push(...newProducts);
|
|
567
|
-
this.disableAddToCartButtons();
|
|
568
|
-
};
|
|
569
|
-
this.reloadHelloData = async () => {
|
|
570
|
-
await this.handleItemRestrictions();
|
|
571
|
-
this.triggerShowPeekMessage();
|
|
572
|
-
};
|
|
573
|
-
this.handleProductCountChange = debounce_1(() => {
|
|
574
|
-
const { productTitleElementSelector } = zonosStore.helloSettings;
|
|
575
|
-
if (productTitleElementSelector) {
|
|
576
|
-
const allProductsOnPage = getProductsOnPage();
|
|
577
|
-
if (this.allFoundProducts.length !== allProductsOnPage.length &&
|
|
578
|
-
window.location.href === this.initialUrl) {
|
|
579
|
-
// if allFoundProducts length is 0 (first render or no products), kill item restriction process as initial restrictions are handled in updateHelloOnPageChange
|
|
580
|
-
if (!this.allFoundProducts.length) {
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
void this.reloadHelloData();
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
}, 1000);
|
|
587
|
-
this.watchProductCountChange = () => {
|
|
588
|
-
const observer = new MutationObserver(this.handleProductCountChange);
|
|
589
|
-
observer.observe(document.body, {
|
|
590
|
-
childList: true,
|
|
591
|
-
subtree: true,
|
|
592
|
-
});
|
|
593
|
-
};
|
|
594
|
-
this.watchPriceChange = () => {
|
|
595
|
-
const observer = new MutationObserver(() => void this.displayCurrency());
|
|
596
|
-
observer.observe(document.body, {
|
|
597
|
-
attributes: true,
|
|
598
|
-
childList: true,
|
|
599
|
-
subtree: true,
|
|
600
|
-
});
|
|
601
|
-
};
|
|
602
|
-
this.updateHelloOnPageChange = () => {
|
|
603
|
-
// If the product count changes on the same url (loading more products), update the peek message and item restrictions
|
|
604
|
-
this.watchProductCountChange();
|
|
605
|
-
// Check url change on interval. If changed, update the peek message and item restrictions
|
|
606
|
-
setInterval(() => {
|
|
607
|
-
if (window.location.href !== this.initialUrl) {
|
|
608
|
-
const prevUrl = this.initialUrl && new URL(this.initialUrl);
|
|
609
|
-
const initialZonosCountry = prevUrl && getZCountryUrlParam(prevUrl.searchParams);
|
|
610
|
-
// If the zCountry url param changes, reset current item restriction tracking
|
|
611
|
-
if (initialZonosCountry !== localizationStore.selectedCountryCode) {
|
|
612
|
-
this.allFoundProducts = [];
|
|
613
|
-
this.allRestrictedItems = [];
|
|
614
|
-
this.productsOnPage = [];
|
|
615
|
-
}
|
|
616
|
-
this.initialUrl = window.location.href;
|
|
617
|
-
zonosStore.currentHelloPage = getCurrentHelloLocalePage();
|
|
618
|
-
const currentUrl = new URL(window.location.href);
|
|
619
|
-
const zCountry = getZCountryUrlParam(currentUrl.searchParams);
|
|
620
|
-
if (!zCountry) {
|
|
621
|
-
setZCountryUrlParam(localizationStore.selectedCountryCode);
|
|
622
|
-
return;
|
|
623
|
-
}
|
|
624
|
-
void this.reloadHelloData();
|
|
625
|
-
}
|
|
626
|
-
}, 1000);
|
|
627
|
-
};
|
|
628
|
-
this.changeShowDialog = (value) => {
|
|
629
|
-
this.showDialog = value;
|
|
630
|
-
};
|
|
631
|
-
this.shouldAnimateLeftDesktop = () => {
|
|
632
|
-
// Get Hello position (relative = desktop, fixed = mobile)
|
|
633
|
-
const elPosition = this.helloRef && getComputedStyle(this.helloRef).position;
|
|
634
|
-
// If relative position, determine if peek message should animate left or right. Mobile is pre-determined.
|
|
635
|
-
if (this.helloRef && elPosition === 'relative') {
|
|
636
|
-
const hasMoreSpaceOnRight = getHasMoreSpaceOnRight(this.helloRef);
|
|
637
|
-
return hasMoreSpaceOnRight;
|
|
638
|
-
}
|
|
639
|
-
};
|
|
640
|
-
this.isShippableCountry = (showLog = true) => {
|
|
641
|
-
if (!localizationStore.localizationLoaded) {
|
|
642
|
-
return false;
|
|
643
|
-
}
|
|
644
|
-
// if localization is loaded and the localization is not a shippable country, keep the original click event
|
|
645
|
-
if (!localizationStore.isShippableCountry) {
|
|
646
|
-
if (showLog) {
|
|
647
|
-
log(`Hello: not shippable country`);
|
|
648
|
-
}
|
|
649
|
-
return false;
|
|
650
|
-
}
|
|
651
|
-
return true;
|
|
652
|
-
};
|
|
653
|
-
this.mobileLocationOverride = undefined;
|
|
654
|
-
this.animateFromLeftOverride = undefined;
|
|
655
|
-
this.appearanceSettingsOverride = undefined;
|
|
656
|
-
this.showPeekMessage = false;
|
|
657
|
-
this.zonosStoreHelloSettings = zonosStore.helloSettings;
|
|
658
|
-
this.showDialog = false;
|
|
659
|
-
this.peekMessage = '';
|
|
660
|
-
this.initialUrl = '';
|
|
661
|
-
this.allRestrictedItems = [];
|
|
662
|
-
this.allFoundProducts = [];
|
|
663
|
-
this.productsOnPage = [];
|
|
664
|
-
}
|
|
665
|
-
componentWillLoad() {
|
|
666
|
-
const initInterval = setInterval(async () => {
|
|
667
|
-
if (!this.helloRef) {
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
if (zonosStore.loadedConfig) {
|
|
671
|
-
this.helloRef.setAttribute('data-zonos-hello-loaded', '');
|
|
672
|
-
this.updateHelloOnPageChange();
|
|
673
|
-
this.watchPriceChange();
|
|
674
|
-
// update theme to browser preference theme if appearance theme is system
|
|
675
|
-
this.handleAppearanceSettingsOverrideChange();
|
|
676
|
-
clearInterval(initInterval);
|
|
677
|
-
}
|
|
678
|
-
}, 100);
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* This method will trigger the currency conversion and display the converted value
|
|
682
|
-
* @returns void
|
|
683
|
-
*/
|
|
684
|
-
async displayCurrency() {
|
|
685
|
-
if (!localizationStore.exchangeRate) {
|
|
686
|
-
logError('Could not display currency. Exchange rate and format data is not available.');
|
|
687
|
-
return;
|
|
688
|
-
}
|
|
689
|
-
currencyDisplay();
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* This method will call convert and format, and return the converted and formatted string
|
|
693
|
-
* @returns string
|
|
694
|
-
*/
|
|
695
|
-
async convertAndFormat(value) {
|
|
696
|
-
return currencyConvertAndFormat(value);
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* This method will convert the currency and return the converted value
|
|
700
|
-
* @returns number
|
|
701
|
-
*/
|
|
702
|
-
async convert(value) {
|
|
703
|
-
return currencyConvert(value);
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* This method will format the currency and return the formatted string
|
|
707
|
-
* @returns number
|
|
708
|
-
*/
|
|
709
|
-
async format(value) {
|
|
710
|
-
return currencyFormat(value);
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* This method show the hello dialog
|
|
714
|
-
* @returns void
|
|
715
|
-
*/
|
|
716
|
-
async openHelloDialog(value) {
|
|
717
|
-
this.changeShowDialog(value);
|
|
718
|
-
}
|
|
719
|
-
handleResize() {
|
|
720
|
-
debounce_1(this.render.bind(this), RESIZE_DEBOUNCE_DELAY_MS);
|
|
721
|
-
}
|
|
722
|
-
handleAppearanceSettingsOverrideChange() {
|
|
723
|
-
var _a;
|
|
724
|
-
if ((_a = this.appearanceSettingsOverride) === null || _a === void 0 ? void 0 : _a.theme) {
|
|
725
|
-
// update theme to browser preference theme if appearance theme is system
|
|
726
|
-
this.appearanceSettingsOverride.theme = getZonosStoreTheme(this.appearanceSettingsOverride.theme);
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
render() {
|
|
730
|
-
var _a, _b;
|
|
731
|
-
const isExcludedUrl = (_a = zonosStore.helloSettings.excludedUrlPatterns) === null || _a === void 0 ? void 0 : _a.some(pattern => new RegExp(pattern).test(window.location.href));
|
|
732
|
-
if (isExcludedUrl) {
|
|
733
|
-
log('Hello is excluded on this url', 'warn');
|
|
734
|
-
return null;
|
|
735
|
-
}
|
|
736
|
-
const { selectedCountryCode } = localizationStore;
|
|
737
|
-
const mobileLocation = this.mobileLocationOverride || zonosStore.helloSettings.mobileLocation;
|
|
738
|
-
const isMobileWindow = window.innerWidth < 768;
|
|
739
|
-
const isOnLeft = this.animateFromLeftOverride ||
|
|
740
|
-
(isMobileWindow && mobileLocation.includes('LEFT')) ||
|
|
741
|
-
this.shouldAnimateLeftDesktop() ||
|
|
742
|
-
false;
|
|
743
|
-
const isOnTop = mobileLocation.includes('TOP');
|
|
744
|
-
const appearanceSettings = mergeConfig(zonosStore.appearance, this.appearanceSettingsOverride);
|
|
745
|
-
const { theme } = appearanceSettings;
|
|
746
|
-
const restrictedItemsOnPage = (_b = this.allRestrictedItems) === null || _b === void 0 ? void 0 : _b.filter(product => this.productsOnPage.some(restriction => restriction.description === product.itemDescription));
|
|
747
|
-
// The organization name can be changed after init with the updateOrganizationName method.
|
|
748
|
-
// This will cause the element to rerender with the new org name when it changes. (used for preview on dashboard)
|
|
749
|
-
this.peekMessage = this.getHelloPeekMessage(zonosStore.organizationName);
|
|
750
|
-
const showHello = this.isShippableCountry() && !!selectedCountryCode;
|
|
751
|
-
return (h(Host, { class: "zonos--hello zonos--elements", "data-theme": theme }, showHello && (h("div", { class: "zonos--hello-wrapper" }, h("button", { class: classes([
|
|
752
|
-
'zonos--hello-widget',
|
|
753
|
-
this.showPeekMessage && 'zonos--hello-show-peek-message',
|
|
754
|
-
this.mobileLocationOverride && 'zonos--hello-mobile-override',
|
|
755
|
-
isOnLeft &&
|
|
756
|
-
'zonos--hello-widget-left zonos--hello-widget-animate-from-left',
|
|
757
|
-
isOnTop && 'zonos--hello-widget-top',
|
|
758
|
-
!!this.allRestrictedItems.length &&
|
|
759
|
-
'zonos--hello-has-restrictions',
|
|
760
|
-
]), onClick: () => {
|
|
761
|
-
void this.changeShowDialog(!this.showDialog);
|
|
762
|
-
}, onMouseEnter: () => this.enableShowPeekMessage(), onMouseLeave: () => (this.showPeekMessage = false), ref: el => el && (this.helloRef = el) }, h("zonos-text", { class: "zonos--hello-message" }, this.peekMessage), selectedCountryCode && (h("div", { class: "zonos--hello-country-flag-wrapper" }, h("zonos-country-flag", { class: "zonos--hello-country-flag", countryCode: selectedCountryCode })))), h("div", { class: classes([
|
|
763
|
-
'zonos--hello-dialog-wrapper',
|
|
764
|
-
this.mobileLocationOverride &&
|
|
765
|
-
'zonos--hello-dialog-wrapper-mobile-override',
|
|
766
|
-
]), style: { height: this.showDialog ? 'fit-content' : '0px' } }, h("zonos-hello-dialog", { animateFromLeftOverride: this.animateFromLeftOverride, appearanceSettings: appearanceSettings, isOpen: this.showDialog, mobileLocationOverride: this.mobileLocationOverride, restrictedItems: restrictedItemsOnPage, setIsOpen: this.changeShowDialog }))))));
|
|
767
|
-
}
|
|
768
|
-
static get watchers() { return {
|
|
769
|
-
"appearanceSettingsOverride": ["handleAppearanceSettingsOverrideChange"]
|
|
770
|
-
}; }
|
|
771
|
-
static get style() { return ZonosHelloStyle0; }
|
|
772
|
-
}, [1, "zonos-hello", {
|
|
773
|
-
"mobileLocationOverride": [1, "mobile-location-override"],
|
|
774
|
-
"animateFromLeftOverride": [4, "animate-from-left-override"],
|
|
775
|
-
"appearanceSettingsOverride": [16],
|
|
776
|
-
"showPeekMessage": [32],
|
|
777
|
-
"zonosStoreHelloSettings": [32],
|
|
778
|
-
"showDialog": [32],
|
|
779
|
-
"peekMessage": [32],
|
|
780
|
-
"initialUrl": [32],
|
|
781
|
-
"allRestrictedItems": [32],
|
|
782
|
-
"allFoundProducts": [32],
|
|
783
|
-
"productsOnPage": [32],
|
|
784
|
-
"displayCurrency": [64],
|
|
785
|
-
"convertAndFormat": [64],
|
|
786
|
-
"convert": [64],
|
|
787
|
-
"format": [64],
|
|
788
|
-
"openHelloDialog": [64]
|
|
789
|
-
}, [[9, "resize", "handleResize"]], {
|
|
790
|
-
"appearanceSettingsOverride": ["handleAppearanceSettingsOverrideChange"]
|
|
791
|
-
}]);
|
|
792
|
-
function defineCustomElement$1() {
|
|
793
|
-
if (typeof customElements === "undefined") {
|
|
794
|
-
return;
|
|
795
|
-
}
|
|
796
|
-
const components = ["zonos-hello", "zonos-banner", "zonos-button", "zonos-card", "zonos-country-flag", "zonos-country-select", "zonos-custom-message", "zonos-hello-dialog", "zonos-hello-dialog-footer", "zonos-icon", "zonos-language-select", "zonos-select-dialog-header", "zonos-spinner", "zonos-text", "zonos-v-stack"];
|
|
797
|
-
components.forEach(tagName => { switch (tagName) {
|
|
798
|
-
case "zonos-hello":
|
|
799
|
-
if (!customElements.get(tagName)) {
|
|
800
|
-
customElements.define(tagName, ZonosHello$1);
|
|
801
|
-
}
|
|
802
|
-
break;
|
|
803
|
-
case "zonos-banner":
|
|
804
|
-
if (!customElements.get(tagName)) {
|
|
805
|
-
defineCustomElement$f();
|
|
806
|
-
}
|
|
807
|
-
break;
|
|
808
|
-
case "zonos-button":
|
|
809
|
-
if (!customElements.get(tagName)) {
|
|
810
|
-
defineCustomElement$e();
|
|
811
|
-
}
|
|
812
|
-
break;
|
|
813
|
-
case "zonos-card":
|
|
814
|
-
if (!customElements.get(tagName)) {
|
|
815
|
-
defineCustomElement$d();
|
|
816
|
-
}
|
|
817
|
-
break;
|
|
818
|
-
case "zonos-country-flag":
|
|
819
|
-
if (!customElements.get(tagName)) {
|
|
820
|
-
defineCustomElement$c();
|
|
821
|
-
}
|
|
822
|
-
break;
|
|
823
|
-
case "zonos-country-select":
|
|
824
|
-
if (!customElements.get(tagName)) {
|
|
825
|
-
defineCustomElement$b();
|
|
826
|
-
}
|
|
827
|
-
break;
|
|
828
|
-
case "zonos-custom-message":
|
|
829
|
-
if (!customElements.get(tagName)) {
|
|
830
|
-
defineCustomElement$a();
|
|
831
|
-
}
|
|
832
|
-
break;
|
|
833
|
-
case "zonos-hello-dialog":
|
|
834
|
-
if (!customElements.get(tagName)) {
|
|
835
|
-
defineCustomElement$9();
|
|
836
|
-
}
|
|
837
|
-
break;
|
|
838
|
-
case "zonos-hello-dialog-footer":
|
|
839
|
-
if (!customElements.get(tagName)) {
|
|
840
|
-
defineCustomElement$8();
|
|
841
|
-
}
|
|
842
|
-
break;
|
|
843
|
-
case "zonos-icon":
|
|
844
|
-
if (!customElements.get(tagName)) {
|
|
845
|
-
defineCustomElement$7();
|
|
846
|
-
}
|
|
847
|
-
break;
|
|
848
|
-
case "zonos-language-select":
|
|
849
|
-
if (!customElements.get(tagName)) {
|
|
850
|
-
defineCustomElement$6();
|
|
851
|
-
}
|
|
852
|
-
break;
|
|
853
|
-
case "zonos-select-dialog-header":
|
|
854
|
-
if (!customElements.get(tagName)) {
|
|
855
|
-
defineCustomElement$5();
|
|
856
|
-
}
|
|
857
|
-
break;
|
|
858
|
-
case "zonos-spinner":
|
|
859
|
-
if (!customElements.get(tagName)) {
|
|
860
|
-
defineCustomElement$4();
|
|
861
|
-
}
|
|
862
|
-
break;
|
|
863
|
-
case "zonos-text":
|
|
864
|
-
if (!customElements.get(tagName)) {
|
|
865
|
-
defineCustomElement$3();
|
|
866
|
-
}
|
|
867
|
-
break;
|
|
868
|
-
case "zonos-v-stack":
|
|
869
|
-
if (!customElements.get(tagName)) {
|
|
870
|
-
defineCustomElement$2();
|
|
871
|
-
}
|
|
872
|
-
break;
|
|
873
|
-
} });
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
const ZonosHello = ZonosHello$1;
|
|
877
|
-
const defineCustomElement = defineCustomElement$1;
|
|
878
|
-
|
|
879
|
-
export { ZonosHello, defineCustomElement };
|