@zonos/elements 1.3.6 → 1.3.7-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{localization-2c9f5765.js → cart-89d9fff4.js} +863 -89
- package/dist/cjs/formatStringWithLinks-52341fc7.js +17 -0
- package/dist/cjs/{getBorderRadius-b252096d.js → getBorderRadius-d8f18958.js} +1 -1
- package/dist/cjs/{isDarkColor-168002d6.js → isDarkColor-57860b44.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/submitGtag-24740560.js +55 -0
- package/dist/cjs/zonos-address_4.cjs.entry.js +36 -18
- package/dist/cjs/zonos-badge_2.cjs.entry.js +6 -6
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +8 -8
- package/dist/cjs/zonos-card_2.cjs.entry.js +10 -8
- package/dist/cjs/zonos-cart-items_9.cjs.entry.js +66 -56
- package/dist/cjs/zonos-checkout.cjs.entry.js +170 -34
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +51 -32
- package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -3
- package/dist/cjs/zonos-country-select_3.cjs.entry.js +21 -12
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +23 -19
- package/dist/cjs/zonos-hello.cjs.entry.js +51 -34
- package/dist/cjs/zonos-link.cjs.entry.js +24 -0
- package/dist/cjs/zonos-logo.cjs.entry.js +3 -3
- package/dist/cjs/zonos-notification.cjs.entry.js +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +5 -6
- package/dist/cjs/zonos-select-dialog-header_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
- package/dist/cjs/zonos-text.cjs.entry.js +1 -1
- package/dist/cjs/{zonosStore-5d94dabb.js → zonosStore-138c5555.js} +9 -7
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +1 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +27 -13
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +39 -18
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +5 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +2 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +1 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +5 -0
- package/dist/collection/components/common/component-template/zonos-link/zonos-link.css +54 -0
- package/dist/collection/components/common/component-template/zonos-link/zonos-link.js +97 -0
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.css +2 -0
- package/dist/collection/components/common/zonos-button/zonos-button.js +4 -4
- package/dist/collection/components/common/zonos-card/zonos-card.js +2 -2
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +26 -6
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +8 -2
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +4 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +1 -1
- package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +50 -11
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +5 -3
- package/dist/collection/components/main/zonos-controller.js +1 -1
- package/dist/collection/components/store/checkout/cart.js +2 -2
- package/dist/collection/components/store/checkout/stripe.js +29 -4
- package/dist/collection/components/store/hello/localization.js +34 -7
- package/dist/collection/components/store/zonosStore.js +9 -7
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -1
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
- package/dist/collection/components/utils/api/trackConversionEvent.js +22 -0
- package/dist/collection/components/utils/checkout/isShippableCountry.js +15 -0
- package/dist/collection/components/utils/checkout/watchBigcommerceDomesticCheckout.js +111 -0
- package/dist/collection/components/utils/formatStringWithLinks.js +13 -0
- package/dist/collection/components/utils/handleFetch.js +1 -1
- package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +25 -28
- package/dist/collection/components/utils/hello/currencyConversion/getCurrencyElements.js +2 -1
- package/dist/collection/components/utils/hello/currencyConversion/getInitialElementAmount.js +8 -6
- package/dist/collection/components/utils/hello/initHello.js +23 -3
- package/dist/collection/components/utils/logging/log.js +20 -9
- package/dist/collection/components/utils/logging/logError.js +2 -1
- package/dist/collection/components/utils/logging/sendErrorLog.js +12 -0
- package/dist/collection/scripts/checkIfLoadVersionDomain.js +35 -0
- package/dist/collection/scripts/zonosBase.js +21 -31
- package/dist/collection/styles/stripe/addressRuleStyle.js +4 -0
- package/dist/collection/types/generated/graphql.customer.types.js +7 -4
- package/dist/collection/types/generated/graphql.frontend.types.js +3 -0
- package/dist/components/stripe.js +4097 -7
- package/dist/components/submitGtag.js +1 -1
- package/dist/components/trackConversionEvent.js +24 -0
- package/dist/components/zonos-address2.js +2 -3
- package/dist/components/zonos-badge2.js +3 -3
- package/dist/components/zonos-button2.js +5 -5
- package/dist/components/zonos-card2.js +2 -2
- package/dist/components/zonos-cart-subtotal2.js +2 -8
- package/dist/components/zonos-checkbox2.js +3 -3
- package/dist/components/zonos-checkout-finish2.js +44 -16
- package/dist/components/zonos-checkout-footer2.js +1 -1
- package/dist/components/zonos-checkout-payment2.js +2 -3
- package/dist/components/zonos-checkout.js +157 -19
- package/dist/components/zonos-collapse2.js +26 -6
- package/dist/components/zonos-component.js +1 -1
- package/dist/components/zonos-controller.js +25 -6
- package/dist/components/zonos-country-flag2.js +1 -1
- package/dist/components/zonos-country-select2.js +9 -3
- package/dist/components/zonos-custom-message2.js +18 -3
- package/dist/components/zonos-customer-info2.js +4 -3
- package/dist/components/zonos-dialog2.js +3 -3
- package/dist/components/zonos-hello-dialog-footer2.js +3 -3
- package/dist/components/zonos-hello-dialog2.js +6 -5
- package/dist/components/zonos-hello.js +23 -7
- package/dist/components/zonos-language-select2.js +3 -3
- package/dist/components/zonos-link-authentication2.js +1 -1
- package/dist/components/zonos-link.d.ts +11 -0
- package/dist/components/zonos-link.js +43 -0
- package/dist/components/zonos-logo.js +2 -2
- package/dist/components/zonos-payment2.js +1 -1
- package/dist/components/zonos-review2.js +2 -8
- package/dist/components/zonos-select-dialog-header2.js +2 -2
- package/dist/components/zonos-shipping-rich-radio2.js +1 -1
- package/dist/components/zonos-shipping2.js +7 -3
- package/dist/components/zonos-tooltip2.js +2 -2
- package/dist/components/zonos-v-stack2.js +2 -2
- package/dist/components/zonosStore.js +9 -7
- package/dist/esm/{localization-d8f6453b.js → cart-1bbb7662.js} +846 -90
- package/dist/esm/formatStringWithLinks-9e819405.js +15 -0
- package/dist/esm/{getBorderRadius-e9736f7e.js → getBorderRadius-19787feb.js} +1 -1
- package/dist/esm/{isDarkColor-e982fa09.js → isDarkColor-2344e7a5.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/submitGtag-d3d11f1a.js +51 -0
- package/dist/esm/zonos-address_4.entry.js +33 -15
- package/dist/esm/zonos-badge_2.entry.js +6 -6
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +8 -8
- package/dist/esm/zonos-card_2.entry.js +8 -6
- package/dist/esm/zonos-cart-items_9.entry.js +47 -37
- package/dist/esm/zonos-checkout.entry.js +158 -22
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +28 -9
- package/dist/esm/zonos-country-flag.entry.js +4 -2
- package/dist/esm/zonos-country-select_3.entry.js +19 -10
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +9 -5
- package/dist/esm/zonos-hello.entry.js +24 -7
- package/dist/esm/zonos-link.entry.js +20 -0
- package/dist/esm/zonos-logo.entry.js +3 -3
- package/dist/esm/zonos-notification.entry.js +1 -1
- package/dist/esm/zonos-payment.entry.js +5 -6
- package/dist/esm/zonos-select-dialog-header_2.entry.js +5 -5
- package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/{zonosStore-e6c7be3a.js → zonosStore-00bce01b.js} +9 -7
- package/dist/esm-es5/cart-1bbb7662.js +1 -0
- package/dist/esm-es5/formatStringWithLinks-9e819405.js +1 -0
- package/dist/esm-es5/{getBorderRadius-e9736f7e.js → getBorderRadius-19787feb.js} +1 -1
- package/dist/esm-es5/{isDarkColor-e982fa09.js → isDarkColor-2344e7a5.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/submitGtag-d3d11f1a.js +1 -0
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card_2.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_9.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-component.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-link.entry.js +1 -0
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-notification.entry.js +1 -1
- package/dist/esm-es5/zonos-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-select-dialog-header_2.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-e6c7be3a.js → zonosStore-00bce01b.js} +1 -1
- package/dist/scripts/checkIfLoadVersionDomain.js +1 -0
- package/dist/scripts/loadStripe.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/stripe.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/scripts/zonosBase.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +1 -1
- package/dist/types/components/common/component-template/zonos-link/zonos-link.d.ts +19 -0
- package/dist/types/components/common/zonos-collapse/zonos-collapse.d.ts +1 -0
- package/dist/types/components/common/zonos-country-select/zonos-country-select.d.ts +2 -0
- package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +9 -3
- package/dist/types/components/store/checkout/cart.d.ts +6 -3
- package/dist/types/components/store/checkout/stripe.d.ts +26 -1
- package/dist/types/components/store/hello/localization.d.ts +1 -1
- package/dist/types/components/store/zonosStore.d.ts +2 -1
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components/utils/api/trackConversionEvent.d.ts +3 -0
- package/dist/types/components/utils/checkout/isShippableCountry.d.ts +1 -0
- package/dist/types/components/utils/checkout/watchBigcommerceDomesticCheckout.d.ts +20 -0
- package/dist/types/components/utils/formatStringWithLinks.d.ts +1 -0
- package/dist/types/components/utils/hello/currencyConversion/getCurrencyElements.d.ts +1 -1
- package/dist/types/components/utils/hello/currencyConversion/getLanguageCode.d.ts +1 -1
- package/dist/types/components/utils/logging/log.d.ts +1 -1
- package/dist/types/components/utils/logging/sendErrorLog.d.ts +7 -0
- package/dist/types/components.d.ts +53 -3
- package/dist/types/scripts/checkIfLoadVersionDomain.d.ts +13 -0
- package/dist/types/scripts/zonosBase.d.ts +2 -0
- package/dist/types/types/ICountryJson.d.ts +2 -1
- package/dist/types/types/checkout/CheckoutConfig.d.ts +1 -1
- package/dist/types/types/generated/graphql.customer.types.d.ts +23 -53
- package/dist/types/types/generated/graphql.customer.types.ts +42 -62
- package/dist/types/types/generated/graphql.frontend.types.d.ts +9 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +19 -1
- package/dist/zonos-elements/p-0318632a.entry.js +1 -0
- package/dist/zonos-elements/p-066c5893.system.js +1 -1
- package/dist/zonos-elements/p-07966463.entry.js +1 -0
- package/dist/zonos-elements/p-0c0aa552.js +1 -0
- package/dist/zonos-elements/p-127b480c.entry.js +1 -0
- package/dist/zonos-elements/p-135ab559.system.entry.js +1 -0
- package/dist/zonos-elements/{p-b81a0577.system.entry.js → p-143dc0d9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-32bca9c8.system.entry.js → p-14d27ce1.system.entry.js} +1 -1
- package/dist/zonos-elements/p-15a80c4a.entry.js +1 -0
- package/dist/zonos-elements/p-17e87be1.entry.js +1 -0
- package/dist/zonos-elements/{p-0c7480a5.entry.js → p-1e0dd491.entry.js} +1 -1
- package/dist/zonos-elements/{p-a33745e9.entry.js → p-279d1c5f.entry.js} +1 -1
- package/dist/zonos-elements/p-2d6557ee.system.js +1 -0
- package/dist/zonos-elements/p-314be538.system.entry.js +1 -0
- package/dist/zonos-elements/{p-dd7729fd.system.entry.js → p-328b7f6f.system.entry.js} +1 -1
- package/dist/zonos-elements/p-354603b3.system.entry.js +1 -0
- package/dist/zonos-elements/{p-50287643.system.js → p-49f6a985.system.js} +1 -1
- package/dist/zonos-elements/p-57b65321.system.entry.js +1 -0
- package/dist/zonos-elements/p-58c1ddef.system.js +1 -0
- package/dist/zonos-elements/{p-06652d87.system.entry.js → p-58e2f6a1.system.entry.js} +1 -1
- package/dist/zonos-elements/p-5ee03db0.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5a113c3d.system.entry.js → p-61e5cf29.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-49a764e9.system.entry.js → p-799d8a17.system.entry.js} +1 -1
- package/dist/zonos-elements/p-7a32526c.entry.js +1 -0
- package/dist/zonos-elements/p-7b87b82f.js +1 -0
- package/dist/zonos-elements/{p-9cbbf261.system.entry.js → p-7c45ce37.system.entry.js} +1 -1
- package/dist/zonos-elements/p-84f4f00f.entry.js +1 -0
- package/dist/zonos-elements/{p-e8a9bc56.entry.js → p-857cfe35.entry.js} +1 -1
- package/dist/zonos-elements/p-87e9c42f.entry.js +1 -0
- package/dist/zonos-elements/{p-e99d79d9.system.js → p-91797d4e.system.js} +1 -1
- package/dist/zonos-elements/{p-17550a10.js → p-95e0fc06.js} +1 -1
- package/dist/zonos-elements/{p-7a6144b1.entry.js → p-a3cc0f84.entry.js} +1 -1
- package/dist/zonos-elements/p-a5f12396.entry.js +1 -0
- package/dist/zonos-elements/p-a87561b8.js +1 -0
- package/dist/zonos-elements/{p-ba43275e.entry.js → p-ac0a7b8f.entry.js} +1 -1
- package/dist/zonos-elements/p-ae82a9ae.js +1 -0
- package/dist/zonos-elements/p-b0462325.system.entry.js +1 -0
- package/dist/zonos-elements/p-b2c0ec71.system.entry.js +1 -0
- package/dist/zonos-elements/{p-fcc4f140.system.js → p-b4725505.system.js} +1 -1
- package/dist/zonos-elements/p-bef54fb1.entry.js +1 -0
- package/dist/zonos-elements/p-c0d431f6.system.entry.js +1 -0
- package/dist/zonos-elements/p-d054788b.system.js +1 -0
- package/dist/zonos-elements/p-d407c93a.system.entry.js +1 -0
- package/dist/zonos-elements/p-e55dd932.js +1 -0
- package/dist/zonos-elements/p-ec37439e.entry.js +1 -0
- package/dist/zonos-elements/p-edace42b.entry.js +1 -0
- package/dist/zonos-elements/p-f478c814.system.entry.js +1 -0
- package/dist/zonos-elements/{p-7dd8e8ba.system.entry.js → p-f6eaef7b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-bd6a2095.entry.js → p-f7c36fcc.entry.js} +1 -1
- package/dist/zonos-elements/p-f862b97f.system.entry.js +1 -0
- package/dist/zonos-elements/p-fd642725.entry.js +1 -0
- package/dist/zonos-elements/p-fdb72530.system.entry.js +1 -0
- package/dist/zonos-elements/{p-a4de3fb2.entry.js → p-ff64ddc5.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/cart-b8bbf22d.js +0 -698
- package/dist/cjs/submitGtag-792fe45d.js +0 -21
- package/dist/collection/scripts/extractZonosQaUrl.js +0 -26
- package/dist/components/localization.js +0 -4016
- package/dist/esm/cart-bc3bb22e.js +0 -682
- package/dist/esm/submitGtag-bebe2cb0.js +0 -19
- package/dist/esm-es5/cart-bc3bb22e.js +0 -1
- package/dist/esm-es5/localization-d8f6453b.js +0 -1
- package/dist/esm-es5/submitGtag-bebe2cb0.js +0 -1
- package/dist/types/scripts/extractZonosQaUrl.d.ts +0 -11
- package/dist/zonos-elements/p-00d63df1.system.entry.js +0 -1
- package/dist/zonos-elements/p-04f63cea.entry.js +0 -1
- package/dist/zonos-elements/p-16b74c31.system.js +0 -1
- package/dist/zonos-elements/p-1d16a6fb.js +0 -1
- package/dist/zonos-elements/p-1ea68e3b.entry.js +0 -1
- package/dist/zonos-elements/p-1ed530cc.entry.js +0 -1
- package/dist/zonos-elements/p-289c8b1a.system.entry.js +0 -1
- package/dist/zonos-elements/p-2a00c270.system.entry.js +0 -1
- package/dist/zonos-elements/p-37f53a79.entry.js +0 -1
- package/dist/zonos-elements/p-394cf1cf.js +0 -1
- package/dist/zonos-elements/p-3ef27745.js +0 -1
- package/dist/zonos-elements/p-458fd100.system.entry.js +0 -1
- package/dist/zonos-elements/p-47fac33f.js +0 -1
- package/dist/zonos-elements/p-4fafb2a5.system.entry.js +0 -1
- package/dist/zonos-elements/p-4fb71a93.js +0 -1
- package/dist/zonos-elements/p-5276c61b.system.entry.js +0 -1
- package/dist/zonos-elements/p-6308b347.entry.js +0 -1
- package/dist/zonos-elements/p-63d1b1fe.entry.js +0 -1
- package/dist/zonos-elements/p-7347ee7c.system.entry.js +0 -1
- package/dist/zonos-elements/p-8c26a080.system.js +0 -1
- package/dist/zonos-elements/p-96aabe02.entry.js +0 -1
- package/dist/zonos-elements/p-a682fd38.system.entry.js +0 -1
- package/dist/zonos-elements/p-ba1a111a.system.entry.js +0 -1
- package/dist/zonos-elements/p-c4321084.system.entry.js +0 -1
- package/dist/zonos-elements/p-cdf114a2.entry.js +0 -1
- package/dist/zonos-elements/p-d5ae3cbb.system.entry.js +0 -1
- package/dist/zonos-elements/p-d5d7c8f5.entry.js +0 -1
- package/dist/zonos-elements/p-de339fb6.entry.js +0 -1
- package/dist/zonos-elements/p-ec25f180.entry.js +0 -1
- package/dist/zonos-elements/p-f49dfd06.system.js +0 -1
- package/dist/zonos-elements/p-f6f5f644.entry.js +0 -1
|
@@ -3,14 +3,133 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-72767498.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const cart = require('./cart-89d9fff4.js');
|
|
7
|
+
const zonosStore = require('./zonosStore-138c5555.js');
|
|
8
|
+
const submitGtag = require('./submitGtag-24740560.js');
|
|
9
9
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
10
10
|
const classes = require('./classes-b7918f56.js');
|
|
11
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
12
|
-
const isDarkColor = require('./isDarkColor-
|
|
13
|
-
|
|
11
|
+
const getBorderRadius = require('./getBorderRadius-d8f18958.js');
|
|
12
|
+
const isDarkColor = require('./isDarkColor-57860b44.js');
|
|
13
|
+
|
|
14
|
+
const isShippableCountry = (showLog = true) => {
|
|
15
|
+
if (!cart.localizationStore.localizationLoaded) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
// if localization is loaded and the localization is not a shippable country, keep the original click event
|
|
19
|
+
if (!cart.localizationStore.isShippableCountry) {
|
|
20
|
+
if (showLog) {
|
|
21
|
+
cart.log(`Checkout: not shippable country`);
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Watch for changes in domestic checkout step, this is to redirect user to home page and open checkout if user enters the ship to country that's in the shipping zone
|
|
30
|
+
* @note Only works on default bigcommerce checkout page
|
|
31
|
+
*/
|
|
32
|
+
const watchBigcommerceDomesticCheckout = ({ domesticRedirectedBtnSelector, onShippingAddressSessionFound, }) => {
|
|
33
|
+
if (!window.Zonos.isBigCommerce) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const observer = new MutationObserver(async () => {
|
|
37
|
+
const domesticRedirectedButton = document.querySelector(domesticRedirectedBtnSelector);
|
|
38
|
+
const shippingAddressSession = cart.stripeStoreGetDomesticShippingSession();
|
|
39
|
+
// append a hidden button to the body if the shipping address session is found
|
|
40
|
+
if (!domesticRedirectedButton && shippingAddressSession) {
|
|
41
|
+
// create a hidden button to trigger the click event
|
|
42
|
+
const button = document.createElement('button');
|
|
43
|
+
button.style.display = 'none';
|
|
44
|
+
button.id = 'zonos--domestic-redirected-checkout-button';
|
|
45
|
+
document.body.appendChild(button);
|
|
46
|
+
onShippingAddressSessionFound === null || onShippingAddressSessionFound === void 0 ? void 0 : onShippingAddressSessionFound(shippingAddressSession);
|
|
47
|
+
// disconnect the observer after we found the shipping continue button
|
|
48
|
+
observer.disconnect();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const shipToCountryElement = document.querySelector('select[name="shippingAddress.countryCode"]');
|
|
52
|
+
// make sure the continue button is available
|
|
53
|
+
const shippingCountinueBtnEle = document.querySelector('#checkout-shipping-continue');
|
|
54
|
+
if (!shipToCountryElement || !shippingCountinueBtnEle) {
|
|
55
|
+
// do nothing if shipping country and the continue button is not found
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
// disconnect the observer after we found the shipping continue button
|
|
59
|
+
observer.disconnect();
|
|
60
|
+
shippingCountinueBtnEle.addEventListener('click', async (e) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
const shippingCountry = shipToCountryElement.value;
|
|
63
|
+
if (!shippingCountry) {
|
|
64
|
+
// do nothing if shipping country is not found
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// update the country code in localization store and check if it's shippable
|
|
68
|
+
cart.localizationStoreUpdateSelectedCountryCode(shippingCountry);
|
|
69
|
+
// do nothing if the country is still domestic
|
|
70
|
+
if (!isShippableCountry(false)) {
|
|
71
|
+
// cleanup the domestic shipping session if it's domestic because we will open the intl checkout after redirecting
|
|
72
|
+
cart.stripeStoreCleanupDomesticShippingSession();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// get value of shipping address state
|
|
76
|
+
const shipToFormElement = document.querySelector('form');
|
|
77
|
+
if (!shipToFormElement) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const formData = new FormData(shipToFormElement);
|
|
81
|
+
const shipAddress1Element = document.querySelector('input#addressLine1Input');
|
|
82
|
+
const shippingAddress = {
|
|
83
|
+
address1: (_a = formData.get('shippingAddress.address1')) !== null && _a !== void 0 ? _a :
|
|
84
|
+
// in Canada, the address1 is not included in the form, try to get value from input id instead.
|
|
85
|
+
(shipAddress1Element && shipAddress1Element.value),
|
|
86
|
+
address2: formData.get('shippingAddress.address2'),
|
|
87
|
+
city: formData.get('shippingAddress.city'),
|
|
88
|
+
countryCode: formData.get('shippingAddress.countryCode'),
|
|
89
|
+
firstName: formData.get('shippingAddress.firstName'),
|
|
90
|
+
lastName: formData.get('shippingAddress.lastName'),
|
|
91
|
+
phone: formData.get('shippingAddress.phone'),
|
|
92
|
+
postalCode: formData.get('shippingAddress.postalCode'),
|
|
93
|
+
stateOrProvince: (_b = formData.get('shippingAddress.stateOrProvince')) !== null && _b !== void 0 ? _b : formData.get('shippingAddress.stateOrProvinceCode'),
|
|
94
|
+
};
|
|
95
|
+
if (Object.values(shippingAddress).some(value => value === undefined || value === null)) {
|
|
96
|
+
cart.logError('One or more shipping address field is missing', Object.entries(shippingAddress));
|
|
97
|
+
void submitGtag.sendErrorLog({
|
|
98
|
+
endpoint: 'No endpoint, domestic checkout form missing fields',
|
|
99
|
+
errors: [
|
|
100
|
+
'Bigcommerce: One or more shipping address field is missing in the domestic checkout form',
|
|
101
|
+
JSON.stringify(Object.entries(shippingAddress)),
|
|
102
|
+
],
|
|
103
|
+
metadata: {
|
|
104
|
+
domain: window.location.hostname,
|
|
105
|
+
storeId: zonosStore.zonosStore.storeId,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
// save the shipping address to session storage
|
|
111
|
+
cart.stripeStoreSaveDomesticShippingSession({
|
|
112
|
+
address1: shippingAddress.address1,
|
|
113
|
+
address2: shippingAddress.address2,
|
|
114
|
+
city: shippingAddress.city,
|
|
115
|
+
countryCode: shippingAddress.countryCode,
|
|
116
|
+
firstName: shippingAddress.firstName,
|
|
117
|
+
lastName: shippingAddress.lastName,
|
|
118
|
+
phone: shippingAddress.phone,
|
|
119
|
+
postalCode: shippingAddress.postalCode,
|
|
120
|
+
state: shippingAddress.stateOrProvince,
|
|
121
|
+
});
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
e.stopPropagation();
|
|
124
|
+
// redirect to home page, home page then will open the checkout dialog if having domestic shipping session
|
|
125
|
+
window.location.href = '/';
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
observer.observe(document.body, {
|
|
129
|
+
childList: true,
|
|
130
|
+
subtree: true,
|
|
131
|
+
});
|
|
132
|
+
};
|
|
14
133
|
|
|
15
134
|
const LeftArrow = `<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M9.707 16.707a1 1 0 0 1-1.414 0l-3.647-3.646a1.5 1.5 0 0 1 0-2.122l3.647-3.646a1 1 0 0 1 1.414 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l2.293 2.293a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>`;
|
|
16
135
|
|
|
@@ -38,19 +157,6 @@ const ZonosCheckout = class {
|
|
|
38
157
|
overrideTheme: this.isMobile ? theme : undefined,
|
|
39
158
|
});
|
|
40
159
|
};
|
|
41
|
-
this.isShippableCountry = (showLog = true) => {
|
|
42
|
-
if (!localization.localizationStore.localizationLoaded) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
// if localization is loaded and the localization is not a shippable country, keep the original click event
|
|
46
|
-
if (!localization.localizationStore.isShippableCountry) {
|
|
47
|
-
if (showLog) {
|
|
48
|
-
localization.log(`Checkout: not shippable country`);
|
|
49
|
-
}
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
};
|
|
54
160
|
this.getCurrentLocalePageEnum = () => {
|
|
55
161
|
switch (cart.cartStore.step) {
|
|
56
162
|
case 'customer-info':
|
|
@@ -77,6 +183,7 @@ const ZonosCheckout = class {
|
|
|
77
183
|
this.isMobile = false;
|
|
78
184
|
this.zonosReviewRef = undefined;
|
|
79
185
|
this.storybookPaymentStatusOverride = undefined;
|
|
186
|
+
this.domesticRedirectedBtnSelector = '#zonos--domestic-redirected-checkout-button';
|
|
80
187
|
}
|
|
81
188
|
/**
|
|
82
189
|
* Init cart info handler event
|
|
@@ -100,14 +207,14 @@ const ZonosCheckout = class {
|
|
|
100
207
|
}
|
|
101
208
|
async buildCartAndInit() {
|
|
102
209
|
if (zonosStore.zonosStore.checkoutSettings.buildCartDetail) {
|
|
103
|
-
|
|
210
|
+
cart.log('build cart detail');
|
|
104
211
|
const cartItems = await zonosStore.zonosStore.checkoutSettings.buildCartDetail();
|
|
105
212
|
await cart.cartStoreUpdateItems(cartItems);
|
|
106
213
|
}
|
|
107
214
|
// if client secret doesn't exist, request a new one.
|
|
108
215
|
if (!cart.stripeStore.clientSecret) {
|
|
109
216
|
const success = await cart.stripeStoreInitCheckoutSession();
|
|
110
|
-
|
|
217
|
+
cart.log(`stripeStoreInitCheckoutSession: ${success}`);
|
|
111
218
|
if (!success) {
|
|
112
219
|
return false;
|
|
113
220
|
}
|
|
@@ -122,7 +229,8 @@ const ZonosCheckout = class {
|
|
|
122
229
|
// do nothing if button element is not found
|
|
123
230
|
return;
|
|
124
231
|
}
|
|
125
|
-
|
|
232
|
+
// also attach event to hidden button if user was redirected with shipping address session
|
|
233
|
+
const buttonAnchorElements = document.querySelectorAll(`${buttonAnchorSelector}, ${this.domesticRedirectedBtnSelector}`);
|
|
126
234
|
// only attach event once, and looping through all of the button elements
|
|
127
235
|
buttonAnchorElements.forEach(button => {
|
|
128
236
|
const isEventAttached = button.getAttribute('data-zonos-checkout-attached');
|
|
@@ -132,12 +240,12 @@ const ZonosCheckout = class {
|
|
|
132
240
|
}
|
|
133
241
|
button.addEventListener('click', async (e) => {
|
|
134
242
|
// do nothing if it's not shippable country
|
|
135
|
-
if (!
|
|
243
|
+
if (!isShippableCountry()) {
|
|
136
244
|
return;
|
|
137
245
|
}
|
|
138
246
|
e.preventDefault();
|
|
139
247
|
e.stopPropagation();
|
|
140
|
-
|
|
248
|
+
cart.log('zonos checkout button clicked');
|
|
141
249
|
// start loading
|
|
142
250
|
cart.stripeStore.isFetchingSession = true;
|
|
143
251
|
this.open = true;
|
|
@@ -148,20 +256,29 @@ const ZonosCheckout = class {
|
|
|
148
256
|
throw new Error('Error building cart');
|
|
149
257
|
}
|
|
150
258
|
submitGtag.submitGtag('zonos-checkout-start');
|
|
259
|
+
void submitGtag.trackConversionEvent('checkout_open');
|
|
151
260
|
}
|
|
152
261
|
catch (err) {
|
|
153
262
|
// stop loading
|
|
154
263
|
cart.stripeStore.isFetchingSession = false;
|
|
155
264
|
cart.cartStoreUpdateToErrorState({
|
|
156
265
|
messages: [
|
|
157
|
-
|
|
266
|
+
cart.translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
158
267
|
],
|
|
159
|
-
title:
|
|
268
|
+
title: cart.translate('Error creating Checkout'),
|
|
160
269
|
});
|
|
161
270
|
}
|
|
162
271
|
});
|
|
163
272
|
button.removeAttribute('disabled');
|
|
164
273
|
button.setAttribute('data-zonos-checkout-attached', 'true');
|
|
274
|
+
// if this button is the hidden button, trigger the click event
|
|
275
|
+
if (button.matches(this.domesticRedirectedBtnSelector)) {
|
|
276
|
+
button.dispatchEvent(new CustomEvent('click'));
|
|
277
|
+
// cleanup shipping session after button is clicked
|
|
278
|
+
cart.stripeStoreCleanupDomesticShippingSession();
|
|
279
|
+
// remove the button after it's clicked
|
|
280
|
+
button.remove();
|
|
281
|
+
}
|
|
165
282
|
});
|
|
166
283
|
}
|
|
167
284
|
appearanceSettingsOverrideChanged() {
|
|
@@ -177,6 +294,25 @@ const ZonosCheckout = class {
|
|
|
177
294
|
async init() {
|
|
178
295
|
cart.stripeStore.stripe = window.Zonos.stripe;
|
|
179
296
|
this.stripe = window.Zonos.stripe;
|
|
297
|
+
// check if bigcommerce, if user enters the shipping address that's in the shipping zone at bigcommerce checkout
|
|
298
|
+
watchBigcommerceDomesticCheckout({
|
|
299
|
+
domesticRedirectedBtnSelector: this.domesticRedirectedBtnSelector,
|
|
300
|
+
onShippingAddressSessionFound: shippingAddressSession => {
|
|
301
|
+
// prefilled the default address if shipping address session is found for checkout on open
|
|
302
|
+
this.defaultAddress = {
|
|
303
|
+
address: {
|
|
304
|
+
city: shippingAddressSession.city,
|
|
305
|
+
country: shippingAddressSession.countryCode,
|
|
306
|
+
line1: shippingAddressSession.address1,
|
|
307
|
+
line2: shippingAddressSession.address2,
|
|
308
|
+
postal_code: shippingAddressSession.postalCode,
|
|
309
|
+
state: shippingAddressSession.state,
|
|
310
|
+
},
|
|
311
|
+
name: `${shippingAddressSession.firstName} ${shippingAddressSession.lastName}`,
|
|
312
|
+
phone: shippingAddressSession.phone,
|
|
313
|
+
};
|
|
314
|
+
},
|
|
315
|
+
});
|
|
180
316
|
const hideInternationalOrderInterval = setInterval(() => {
|
|
181
317
|
const internationalSelector = window.Zonos.internationalHideSelector;
|
|
182
318
|
if (!internationalSelector) {
|
|
@@ -185,7 +321,7 @@ const ZonosCheckout = class {
|
|
|
185
321
|
return;
|
|
186
322
|
}
|
|
187
323
|
// hide the selector if it's international
|
|
188
|
-
const isInternationalOrder =
|
|
324
|
+
const isInternationalOrder = isShippableCountry(false);
|
|
189
325
|
const selector = document.querySelectorAll(internationalSelector);
|
|
190
326
|
if (!isInternationalOrder) {
|
|
191
327
|
// show the selector when it's domestic
|
|
@@ -211,14 +347,14 @@ const ZonosCheckout = class {
|
|
|
211
347
|
cart.stripeStore.stripe = window.Zonos.stripe;
|
|
212
348
|
this.stripe = window.Zonos.stripe;
|
|
213
349
|
if (!this.stripe) {
|
|
214
|
-
|
|
350
|
+
cart.log('waiting for stripe to be loaded');
|
|
215
351
|
return;
|
|
216
352
|
}
|
|
217
353
|
if (this.storybookPaymentStatusOverride) {
|
|
218
354
|
clearInterval(interval);
|
|
219
355
|
return;
|
|
220
356
|
}
|
|
221
|
-
|
|
357
|
+
cart.log('init checkout');
|
|
222
358
|
if (this.preview || this.forceDialogOpen) {
|
|
223
359
|
void this.buildCartAndInit();
|
|
224
360
|
}
|
|
@@ -318,18 +454,18 @@ const ZonosCheckout = class {
|
|
|
318
454
|
this.isMobile = isCheckoutMobile.isCheckoutMobile(this.mobile);
|
|
319
455
|
// apply theme to stripe elements
|
|
320
456
|
void this.applyStripeTheme();
|
|
321
|
-
|
|
457
|
+
cart.log(`mobile: ${this.isMobile}`);
|
|
322
458
|
}
|
|
323
459
|
handleMobileChange() {
|
|
324
460
|
this.isMobile = isCheckoutMobile.isCheckoutMobile(this.mobile);
|
|
325
461
|
// apply theme to stripe elements
|
|
326
462
|
void this.applyStripeTheme();
|
|
327
|
-
|
|
463
|
+
cart.log(`mobile: ${this.isMobile}`);
|
|
328
464
|
}
|
|
329
465
|
componentWillLoad() {
|
|
330
466
|
void this.init();
|
|
331
467
|
this.isMobile = isCheckoutMobile.isCheckoutMobile(this.mobile);
|
|
332
|
-
|
|
468
|
+
cart.log(`mobile: ${this.isMobile}`);
|
|
333
469
|
}
|
|
334
470
|
// do clean up when component is unmounted
|
|
335
471
|
disconnectedCallback() {
|
|
@@ -356,12 +492,12 @@ const ZonosCheckout = class {
|
|
|
356
492
|
: themePrimaryColorBased;
|
|
357
493
|
// only use submit button color if it's on desktop
|
|
358
494
|
const submitButtonColor = !this.isMobile ? colorSecondary : undefined;
|
|
359
|
-
const { customMessages } =
|
|
495
|
+
const { customMessages } = cart.localizationStore;
|
|
360
496
|
const defaultMessage = (_a = customMessages.find(x => x.pageName === 'checkout_default')) === null || _a === void 0 ? void 0 : _a.message;
|
|
361
497
|
const localePageEnum = this.getCurrentLocalePageEnum();
|
|
362
498
|
const filteredMessages = customMessages.filter(x => x.pageName === localePageEnum);
|
|
363
499
|
const renderLogo = () => (index.h("div", { class: "zonos--logo" }, logoUrl && (index.h("img", { alt: `${zonosStore.zonosStore.organizationName} logo`, src: logoUrl, width: 100 }))));
|
|
364
|
-
const renderTopHeader = () => (index.h("zonos-v-stack", null, renderLogo(), filteredMessages.map(x => (index.h("zonos-custom-message", { icon: MessageIcon, message: x.message }))), index.h("div", null, index.h("zonos-button", { class: "zonos--back-button", icon: index.h("zonos-icon", { "aria-label": "Back to previous step", content: LeftArrow }), noBackground: true, noPaddingLeft: true, noPaddingRight: true, onClick: () => this.handleBackClick(), theme: leftSideTheme },
|
|
500
|
+
const renderTopHeader = () => (index.h("zonos-v-stack", null, renderLogo(), filteredMessages.map(x => (index.h("zonos-custom-message", { icon: MessageIcon, message: x.message }))), index.h("div", null, index.h("zonos-button", { class: "zonos--back-button", icon: index.h("zonos-icon", { "aria-label": "Back to previous step", content: LeftArrow }), noBackground: true, noPaddingLeft: true, noPaddingRight: true, onClick: () => this.handleBackClick(), theme: leftSideTheme }, cart.translate('Back')))));
|
|
365
501
|
const renderContent = () => {
|
|
366
502
|
return (index.h("div", { class: 'zonos--content', style: {
|
|
367
503
|
'--border-radius': getBorderRadius.getBorderRadius(style),
|
|
@@ -22,7 +22,7 @@ const ZonosComponent = class {
|
|
|
22
22
|
return format(this.first, this.middle, this.last);
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
|
-
return index.h("div", { key: '
|
|
25
|
+
return index.h("div", { key: '3b7429a0c03b00f0a80e15a94bebd08aedaafe51' }, "Hello, World! I'm ", this.getText());
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
ZonosComponent.style = ZonosComponentStyle0;
|
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-72767498.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
require('./
|
|
10
|
-
require('./getBorderRadius-b252096d.js');
|
|
6
|
+
const cart = require('./cart-89d9fff4.js');
|
|
7
|
+
const zonosStore = require('./zonosStore-138c5555.js');
|
|
8
|
+
require('./isDarkColor-57860b44.js');
|
|
9
|
+
require('./getBorderRadius-d8f18958.js');
|
|
11
10
|
|
|
12
11
|
const getZonosSettings = async () => {
|
|
13
12
|
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/zonos-settings`;
|
|
14
|
-
const { errors, json } = await
|
|
13
|
+
const { errors, json } = await cart.handleFetch(url);
|
|
15
14
|
if (errors.length) {
|
|
16
|
-
|
|
15
|
+
cart.logError(`Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings`);
|
|
17
16
|
return { errors, json: null };
|
|
18
17
|
}
|
|
19
18
|
return { errors: [], json };
|
|
@@ -33,31 +32,51 @@ const initCheckout = (config) => {
|
|
|
33
32
|
return;
|
|
34
33
|
}
|
|
35
34
|
// check if checkout button anchor selector user pass in is valid
|
|
36
|
-
if (!
|
|
37
|
-
|
|
35
|
+
if (!cart.isValidSelector(config.placeOrderButtonSelector)) {
|
|
36
|
+
cart.logError(`Selector checkoutButtonAnchor "${config.placeOrderButtonSelector}" is not a valid selector`);
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
40
39
|
injectCheckoutElement();
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
const injectHelloComponent = (
|
|
42
|
+
const injectHelloComponent = (anchorElementSelector) => {
|
|
43
|
+
const triggerAnchorElement = document.querySelector(anchorElementSelector);
|
|
44
44
|
// append checkout component if doesn't exist
|
|
45
45
|
const helloElement = document.querySelector('zonos-hello');
|
|
46
46
|
if (!helloElement && triggerAnchorElement) {
|
|
47
47
|
const newHelloElement = document.createElement('zonos-hello');
|
|
48
48
|
triggerAnchorElement.appendChild(newHelloElement);
|
|
49
|
+
return true;
|
|
49
50
|
}
|
|
51
|
+
return false;
|
|
50
52
|
};
|
|
51
53
|
const initHello = async (helloSettings) => {
|
|
52
54
|
const { anchorElementSelector } = helloSettings;
|
|
53
55
|
// check if checkout button anchor selector user pass in is valid to setup hello
|
|
54
|
-
if (!anchorElementSelector || !
|
|
55
|
-
|
|
56
|
+
if (!anchorElementSelector || !cart.isValidSelector(anchorElementSelector)) {
|
|
57
|
+
cart.logError(`Selector anchorElementSelector "${helloSettings.anchorElementSelector}" is not a valid selector.`);
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
cart.log('Hello init complete');
|
|
61
|
+
const isHelloInjected = injectHelloComponent(anchorElementSelector);
|
|
62
|
+
// keep watching for the anchor element to be added to the DOM, then inject hello component
|
|
63
|
+
if (!isHelloInjected) {
|
|
64
|
+
const observer = new MutationObserver(() => {
|
|
65
|
+
const injected = injectHelloComponent(anchorElementSelector);
|
|
66
|
+
if (injected) {
|
|
67
|
+
// disconnect observer if hello is successfully injected
|
|
68
|
+
observer.disconnect();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
observer.observe(document.body, {
|
|
72
|
+
childList: true,
|
|
73
|
+
subtree: true,
|
|
74
|
+
});
|
|
75
|
+
// kill observer after 5 seconds if the hello still not injected, if the hello still not injected after 10 seconds, it's likely that the selector the user doesn't want to use hello
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
observer.disconnect();
|
|
78
|
+
}, 5000);
|
|
79
|
+
}
|
|
61
80
|
};
|
|
62
81
|
|
|
63
82
|
const zonosControllerCss = ":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{visibility:hidden;opacity:0;height:0}";
|
|
@@ -76,12 +95,12 @@ const ZonosController = class {
|
|
|
76
95
|
async initCheckoutElement(stripe) {
|
|
77
96
|
if (!stripe) {
|
|
78
97
|
// eslint-disable-next-line no-console
|
|
79
|
-
|
|
98
|
+
cart.log('Stripe is not loaded yet - cannot init checkout element', 'warn');
|
|
80
99
|
return;
|
|
81
100
|
}
|
|
82
101
|
cart.stripeStore.stripe = stripe;
|
|
83
102
|
void initCheckout(zonosStore.zonosStore.checkoutSettings);
|
|
84
|
-
|
|
103
|
+
cart.log('init checkout element');
|
|
85
104
|
}
|
|
86
105
|
/**
|
|
87
106
|
* Init zonos notification
|
|
@@ -106,13 +125,13 @@ const ZonosController = class {
|
|
|
106
125
|
// Do nothing if font is Inter, since we already inject it on start
|
|
107
126
|
return;
|
|
108
127
|
}
|
|
109
|
-
|
|
128
|
+
cart.log(`[FONT] Just applied Inter , but no need to inject since we already inject Inter on start`, 'warn');
|
|
110
129
|
zonosStore.zonosStore.appearance = Object.assign(Object.assign({}, zonosStore.zonosStore.appearance), { fontFamily: overrideFont });
|
|
111
130
|
}
|
|
112
131
|
const routeUrl = "https://v1.route.js.zonos.com";
|
|
113
|
-
const { errors, json } = await
|
|
132
|
+
const { errors, json } = await cart.handleFetch(`${routeUrl}/api/zonos-elements/get-font-detail?family=${fontSelected}`);
|
|
114
133
|
if (errors.length > 0 || !json) {
|
|
115
|
-
|
|
134
|
+
cart.log(`Failed to load font ${fontSelected}`, 'warn');
|
|
116
135
|
return;
|
|
117
136
|
}
|
|
118
137
|
const fontUrl = json.fontUrl;
|
|
@@ -121,7 +140,7 @@ const ZonosController = class {
|
|
|
121
140
|
return;
|
|
122
141
|
}
|
|
123
142
|
// apply override font
|
|
124
|
-
|
|
143
|
+
cart.log(`[FONT] ${overrideFont} font override applied`);
|
|
125
144
|
zonosStore.zonosStore.appearance = Object.assign(Object.assign({}, zonosStore.zonosStore.appearance), { fontFamily: overrideFont });
|
|
126
145
|
}
|
|
127
146
|
async componentWillLoad() {
|
|
@@ -131,7 +150,7 @@ const ZonosController = class {
|
|
|
131
150
|
var _a, _b;
|
|
132
151
|
const { errors, json } = await getZonosSettings();
|
|
133
152
|
if (((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.type.toString()) === '403') {
|
|
134
|
-
|
|
153
|
+
cart.log('Failed to load zonos settings. This domain may not have access', 'warn');
|
|
135
154
|
return;
|
|
136
155
|
}
|
|
137
156
|
// init zonos notification
|
|
@@ -147,28 +166,28 @@ const ZonosController = class {
|
|
|
147
166
|
void initHello(zonosStore.zonosStore.helloSettings);
|
|
148
167
|
}
|
|
149
168
|
// init localization store
|
|
150
|
-
await
|
|
169
|
+
await cart.initLocalizationStore();
|
|
151
170
|
// checkout init
|
|
152
171
|
const publishableKey = ((_b = json === null || json === void 0 ? void 0 : json.checkoutSettings) === null || _b === void 0 ? void 0 : _b.externalServiceTokens.find(item => item.type === 'STRIPE_PUBLISHABLE_TOKEN')) || null;
|
|
153
172
|
if (!publishableKey || !this.stripeInitEvent) {
|
|
154
|
-
|
|
173
|
+
cart.log('Checkout failed to load -- missing publishable key', 'warn');
|
|
155
174
|
return;
|
|
156
175
|
}
|
|
157
176
|
if (zonosStore.zonosStore.checkoutSettings.subscriptionStatus === 'INACTIVE') {
|
|
158
|
-
|
|
159
|
-
|
|
177
|
+
cart.log('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===', 'warn');
|
|
178
|
+
cart.log('zonos controller loaded');
|
|
160
179
|
return;
|
|
161
180
|
}
|
|
162
181
|
if (zonosStore.zonosStore.checkoutSettings.visibilityStatus === 'DISABLED') {
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
cart.log('=== Checkout is disabled by store owner ===', 'warn');
|
|
183
|
+
cart.log('zonos controller loaded');
|
|
165
184
|
return;
|
|
166
185
|
}
|
|
167
186
|
// send publishable key out to load stripe
|
|
168
187
|
this.stripeInitEvent.emit({
|
|
169
188
|
publishableKey: publishableKey.token,
|
|
170
189
|
});
|
|
171
|
-
|
|
190
|
+
cart.log('zonos controller loaded');
|
|
172
191
|
})();
|
|
173
192
|
}
|
|
174
193
|
/**
|
|
@@ -177,7 +196,7 @@ const ZonosController = class {
|
|
|
177
196
|
async showNotification(notification) {
|
|
178
197
|
const notificationElement = document.querySelector('zonos-notification');
|
|
179
198
|
if (!notificationElement) {
|
|
180
|
-
|
|
199
|
+
cart.log('Failed to show notification - zonos-notification not found', 'warn');
|
|
181
200
|
return;
|
|
182
201
|
}
|
|
183
202
|
void notificationElement.showNotification(notification);
|
|
@@ -196,7 +215,7 @@ const ZonosController = class {
|
|
|
196
215
|
* Override country code for storybook
|
|
197
216
|
*/
|
|
198
217
|
async overrideCountry(countryCode) {
|
|
199
|
-
void
|
|
218
|
+
void cart.localizationStoreUpdateSelectedCountryCode(countryCode);
|
|
200
219
|
}
|
|
201
220
|
/**
|
|
202
221
|
* Get appearance from setting
|
|
@@ -211,7 +230,7 @@ const ZonosController = class {
|
|
|
211
230
|
zonosStore.zonosStore.organizationName = organizationName;
|
|
212
231
|
}
|
|
213
232
|
render() {
|
|
214
|
-
return index.h(index.Host, { key: '
|
|
233
|
+
return index.h(index.Host, { key: 'a220a3ebe75df167eefc892c59efdcaf05a53601', class: "zonos--elements" });
|
|
215
234
|
}
|
|
216
235
|
};
|
|
217
236
|
ZonosController.style = ZonosControllerStyle0;
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-72767498.js');
|
|
6
|
-
const
|
|
7
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const cart = require('./cart-89d9fff4.js');
|
|
7
|
+
const zonosStore = require('./zonosStore-138c5555.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
+
require('./isDarkColor-57860b44.js');
|
|
10
|
+
require('./getBorderRadius-d8f18958.js');
|
|
9
11
|
|
|
10
12
|
const zonosCountryFlagCss = ":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:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";
|
|
11
13
|
const ZonosCountryFlagStyle0 = zonosCountryFlagCss;
|
|
@@ -14,7 +16,7 @@ const FLAG_URL = "https://zonos-store-assets.s3.amazonaws.com/images/elements-fl
|
|
|
14
16
|
const ZonosCountryFlag = class {
|
|
15
17
|
constructor(hostRef) {
|
|
16
18
|
index.registerInstance(this, hostRef);
|
|
17
|
-
this.countryCode =
|
|
19
|
+
this.countryCode = cart.localizationStore.selectedCountryCode;
|
|
18
20
|
this.size = undefined;
|
|
19
21
|
}
|
|
20
22
|
render() {
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-72767498.js');
|
|
6
|
-
const
|
|
7
|
-
const zonosStore = require('./zonosStore-
|
|
8
|
-
const
|
|
6
|
+
const cart = require('./cart-89d9fff4.js');
|
|
7
|
+
const zonosStore = require('./zonosStore-138c5555.js');
|
|
8
|
+
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
|
+
const isDarkColor = require('./isDarkColor-57860b44.js');
|
|
9
10
|
const ILanguage = require('./ILanguage-d247b45b.js');
|
|
11
|
+
require('./getBorderRadius-d8f18958.js');
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Fuse.js v6.6.2 - Lightweight fuzzy-search (http://fusejs.io)
|
|
@@ -1801,7 +1803,7 @@ const ZonosCountrySelect = class {
|
|
|
1801
1803
|
index.registerInstance(this, hostRef);
|
|
1802
1804
|
this.countrySelected = (countryCode) => {
|
|
1803
1805
|
// mutate the selected country code in store
|
|
1804
|
-
void
|
|
1806
|
+
void cart.localizationStoreUpdateSelectedCountryCode(countryCode);
|
|
1805
1807
|
this.handleOnClose();
|
|
1806
1808
|
};
|
|
1807
1809
|
this.handleInputChange = (event) => {
|
|
@@ -1811,8 +1813,13 @@ const ZonosCountrySelect = class {
|
|
|
1811
1813
|
this.handleOnClose = () => { };
|
|
1812
1814
|
this.inputValue = '';
|
|
1813
1815
|
}
|
|
1816
|
+
componentDidRender() {
|
|
1817
|
+
var _a, _b;
|
|
1818
|
+
// focus the input on render
|
|
1819
|
+
(_b = (_a = this.ele.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.zonos--country-select-input')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
1820
|
+
}
|
|
1814
1821
|
render() {
|
|
1815
|
-
const { shippingZoneCountries } =
|
|
1822
|
+
const { shippingZoneCountries } = cart.localizationStore;
|
|
1816
1823
|
const countries = shippingZoneCountries
|
|
1817
1824
|
? Object.values(shippingZoneCountries)
|
|
1818
1825
|
: [];
|
|
@@ -1823,10 +1830,11 @@ const ZonosCountrySelect = class {
|
|
|
1823
1830
|
const filteredCountries = this.inputValue
|
|
1824
1831
|
? fuseObject.map(country => country.item)
|
|
1825
1832
|
: countries.sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
1826
|
-
return (index.h(index.Host, { key: '
|
|
1833
|
+
return (index.h(index.Host, { key: '2b8e15643f92ac489706aff7623b1d1efdebce70', class: "zonos--elements", style: {
|
|
1827
1834
|
'--font-family': zonosStore.zonosStoreFontFamily(),
|
|
1828
|
-
} }, index.h("div", { key: '
|
|
1835
|
+
} }, index.h("div", { key: '06b0c7765d8144ca102c9033e74cf1edb14743ac', class: "zonos--country-select" }, index.h("zonos-v-stack", { key: 'f2af99575f518acb753448f7cb1f7aecd790de9d', class: "zonos--country-select-header", spacing: 8 }, index.h("zonos-select-dialog-header", { key: '296b92c476439aace00f6817b452a3fd3e1d353d', handleOnClose: () => this.handleOnClose(), label: "Select a country" }, index.h("input", { key: 'd988b856392f88a66bcc3016ccf55107bda4a411', class: "zonos--country-select-input", onInput: this.handleInputChange, placeholder: "Search countries", value: this.inputValue }))), index.h("div", { key: '4376bec824141dd7d2dbfb84f465ac4a48e1d050', class: "zonos--country-select-content" }, filteredCountries.map(country => (index.h("button", { class: "zonos--country-select-country", onClick: () => this.countrySelected(country.code) }, index.h("zonos-country-flag", { class: "zonos--country-flag", countryCode: country.code }), index.h("zonos-text", { textColor: "gray-800" }, country.displayName), country.code === cart.localizationStore.selectedCountryCode && (index.h("zonos-icon", { content: GreenCheckDuotoneIcon, size: 20 })))))))));
|
|
1829
1836
|
}
|
|
1837
|
+
get ele() { return index.getElement(this); }
|
|
1830
1838
|
};
|
|
1831
1839
|
ZonosCountrySelect.style = ZonosCountrySelectStyle0;
|
|
1832
1840
|
|
|
@@ -1840,9 +1848,10 @@ const ZonosCustomMessage = class {
|
|
|
1840
1848
|
this.message = '';
|
|
1841
1849
|
}
|
|
1842
1850
|
render() {
|
|
1843
|
-
|
|
1851
|
+
const messageWithLinks = formatStringWithLinks.formatStringWithLinks(this.message);
|
|
1852
|
+
return (index.h(index.Host, { key: '73091a3267f0989e8820800054aebc75168dc5d6', class: "zonos--elements", style: {
|
|
1844
1853
|
'--font-family': zonosStore.zonosStoreFontFamily(),
|
|
1845
|
-
} }, this.message && (index.h("zonos-card", { class: "zonos--custom-message", spacing: "12px" }, index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Custom message", content: this.icon }), index.h("zonos-text",
|
|
1854
|
+
} }, this.message && (index.h("zonos-card", { class: "zonos--custom-message", spacing: "12px" }, index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Custom message icon", content: this.icon }), index.h("zonos-text", { innerHTML: messageWithLinks }))))));
|
|
1846
1855
|
}
|
|
1847
1856
|
};
|
|
1848
1857
|
ZonosCustomMessage.style = ZonosCustomMessageStyle0;
|
|
@@ -1873,10 +1882,10 @@ const ZonosHelloDialogFooter = class {
|
|
|
1873
1882
|
var _a, _b, _c;
|
|
1874
1883
|
const primaryColor = (_a = this.appearanceSettings) === null || _a === void 0 ? void 0 : _a.colorPrimary;
|
|
1875
1884
|
const footerTheme = primaryColor && isDarkColor.isDarkColor(primaryColor) ? 'DARK' : 'LIGHT';
|
|
1876
|
-
const language = (_b = ILanguage.languages.find(x => x.code ===
|
|
1877
|
-
return (index.h(index.Host, { key: '
|
|
1885
|
+
const language = (_b = ILanguage.languages.find(x => x.code === cart.localizationStore.selectedLocale)) === null || _b === void 0 ? void 0 : _b.translatedLabel;
|
|
1886
|
+
return (index.h(index.Host, { key: 'f97688788d9f6d1a640f054a2a22dbae6955b83c', class: "zonos--elements" }, index.h("div", { key: '3539323f9044acef3890fc072bdd981e2495fc18', class: "zonos--hello-dialog-footer", "data-theme": footerTheme, style: {
|
|
1878
1887
|
'--primary-color': (_c = this.appearanceSettings) === null || _c === void 0 ? void 0 : _c.colorPrimary,
|
|
1879
|
-
} }, index.h("a", { key: '
|
|
1888
|
+
} }, index.h("a", { key: '5e30052240f87211c6f0092ef6a27c217f3ecefb', href: "https://zonos.com", target: "_blank", title: "Zonos website" }, index.h("zonos-icon", { key: 'c60142bcd26086c2944ac3464885ca1f96e5cfbe', "aria-label": "Zonos Logo", autoHeight: true, content: ZonosIcon, iconColor: "gray-1200", size: 108 })), index.h("div", { key: '67297b4c557ee5b49a4406a459588f2924183195', class: "zonos--hello-locale-wrapper" }, index.h("zonos-button", { key: '9348bff826187730f36d191f7e01f516f2b9785c', buttonColor: "gray-1200", icon: index.h("zonos-icon", { "aria-label": "Open language select", content: Globe, iconColor: "gray-1200" }), onClick: () => this.setShowLanguageSelect(true), variant: "subtle" }, language), index.h("zonos-button", { key: 'ecf1a8639e8e92a07a0e774abb560de53c19587c', buttonColor: "gray-1200", icon: index.h("zonos-country-flag", { "aria-label": "Open country select", class: "zonos--footer-country-flag", countryCode: cart.localizationStore.selectedCountryCode }), onClick: () => this.setShowCountrySelect(true), variant: "subtle" }, cart.localizationStore.selectedCountryCode)))));
|
|
1880
1889
|
}
|
|
1881
1890
|
};
|
|
1882
1891
|
ZonosHelloDialogFooter.style = ZonosHelloDialogFooterStyle0;
|