@zonos/elements 1.3.183 → 1.3.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart-3d0c0f0b.js → cart-f9df3ac8.js} +3209 -10
- package/dist/cjs/debounce-3eaa4f7e.js +357 -0
- package/dist/cjs/{getBorderRadius-94ef609c.js → getBorderRadius-87f3b69c.js} +1 -1
- package/dist/cjs/getGenericSettingsOverride-c0ca32b9.js +104 -0
- package/dist/cjs/helpers-5bdbb68c.js +100 -0
- package/dist/cjs/{index-2f90486e.js → index-0993f42d.js} +15 -3
- package/dist/cjs/index.cjs.js +41 -9
- package/dist/cjs/{isDarkColor-ec4a4e7d.js → isDarkColor-d0c67c3d.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{paypal-9eaa9196.js → paypal-5e73c8f5.js} +3 -3
- package/dist/cjs/zonos-address_11.cjs.entry.js +7917 -0
- package/dist/cjs/zonos-badge.cjs.entry.js +2 -2
- package/dist/cjs/zonos-banner.cjs.entry.js +2 -2
- package/dist/cjs/zonos-button_3.cjs.entry.js +18 -7
- package/dist/cjs/zonos-card.cjs.entry.js +3 -3
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +113 -21
- package/dist/cjs/zonos-checkout.cjs.entry.js +24 -10
- package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
- package/dist/cjs/zonos-component.cjs.entry.js +2 -2
- package/dist/cjs/zonos-controller.cjs.entry.js +233 -8
- package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -5
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +10 -10
- package/dist/cjs/zonos-elements.cjs.js +2 -2
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +8 -8
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +9 -9
- package/dist/cjs/zonos-hello.cjs.entry.js +7 -358
- package/dist/cjs/zonos-input.cjs.entry.js +3 -3
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-link.cjs.entry.js +1 -1
- package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +31 -12
- package/dist/cjs/zonos-text.cjs.entry.js +2 -2
- package/dist/cjs/zonos-toggle.cjs.entry.js +4 -4
- package/dist/cjs/zonos-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/zonos-v-stack.cjs.entry.js +4 -4
- package/dist/cjs/{zonosStore-3812b318.js → zonosStore-adc42868.js} +2 -1
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.js +3 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +11 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +37 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +162 -17
- package/dist/collection/components/common/zonos-button/zonos-button.js +14 -3
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +5 -3
- package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +2 -2
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.css +0 -6
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +2 -2
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.css +2 -3
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +105 -8
- package/dist/collection/components/common/zonos-stripe-phone-input/assets/ChevronDownIcon.svg +1 -0
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.css +222 -0
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +481 -0
- package/dist/collection/components/common/zonos-stripe-select/assets/ChevronDownIcon.svg +1 -0
- package/dist/collection/components/common/zonos-stripe-select/assets/RemoveLineIcon.svg +1 -0
- package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.css +178 -0
- package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +455 -0
- package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
- 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/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
- 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 +4 -4
- package/dist/collection/components/main/zonos-controller.js +24 -1
- package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
- package/dist/collection/components/store/checkout/stripe.js +24 -7
- package/dist/collection/components/store/translationStore/strings.arabic.js +159 -0
- package/dist/collection/components/store/translationStore/strings.base.js +161 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +159 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +159 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +159 -0
- package/dist/collection/components/store/translationStore/strings.french.js +159 -0
- package/dist/collection/components/store/translationStore/strings.german.js +159 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +159 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +159 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +159 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +159 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +159 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +159 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +159 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +159 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +159 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +159 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +159 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +159 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +159 -0
- package/dist/collection/components/store/zonosStore.js +1 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -1
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/assets/RemoveIcon.svg +1 -0
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.css +86 -0
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +192 -0
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.css +67 -0
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +978 -0
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
- package/dist/collection/components/utils/api/getGenericSettingsOverride.js +10 -0
- package/dist/collection/components/utils/api/getZonosSettings.js +7 -1
- package/dist/collection/components/utils/checkout/form/helpers.js +95 -0
- package/dist/collection/components/utils/checkout/form/isValidZip.js +18 -0
- package/dist/collection/components/utils/checkout/initCheckout.js +8 -1
- package/dist/collection/components/utils/iframe/CheckoutAddressService.js +193 -0
- package/dist/collection/components/utils/iframe/IframeHelpers.js +86 -0
- package/dist/collection/components/utils/mergeAddress.js +5 -0
- package/dist/collection/constants/phone-formats.js +658 -0
- package/dist/collection/scripts/_getCartInfoById.js +7 -1
- package/dist/collection/scripts/_zonosBase.js +29 -1
- package/dist/collection/types/CountryFields.js +1 -0
- package/dist/collection/types/checkout/form/CustomAddressErrors.js +1 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +11 -0
- package/dist/collection/types/generated/graphql.internal.types.js +129 -0
- package/dist/collection/types/index.js +0 -1
- package/dist/esm/{cart-3fb04f1f.js → cart-4725a63b.js} +3209 -10
- package/dist/esm/debounce-3cf0793c.js +355 -0
- package/dist/esm/{getBorderRadius-ada3ccad.js → getBorderRadius-a9a48f79.js} +1 -1
- package/dist/esm/getGenericSettingsOverride-0bc3e118.js +99 -0
- package/dist/esm/helpers-2f6955b1.js +97 -0
- package/dist/esm/{index-d82f06f2.js → index-a457c60c.js} +15 -3
- package/dist/esm/index.js +41 -9
- package/dist/esm/{isDarkColor-446fccb7.js → isDarkColor-62cbddb5.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{paypal-1f2e863c.js → paypal-a09943f4.js} +3 -3
- package/dist/esm/zonos-address_11.entry.js +7903 -0
- package/dist/esm/zonos-badge.entry.js +2 -2
- package/dist/esm/zonos-banner.entry.js +2 -2
- package/dist/esm/zonos-button_3.entry.js +18 -7
- package/dist/esm/zonos-card.entry.js +3 -3
- package/dist/esm/zonos-cart-items_13.entry.js +113 -21
- package/dist/esm/zonos-checkout.entry.js +24 -10
- package/dist/esm/zonos-collapse.entry.js +2 -2
- package/dist/esm/zonos-component.entry.js +2 -2
- package/dist/esm/zonos-controller.entry.js +233 -8
- package/dist/esm/zonos-country-flag.entry.js +5 -5
- package/dist/esm/zonos-country-select_4.entry.js +10 -10
- package/dist/esm/zonos-elements.js +3 -3
- package/dist/esm/zonos-empty-state-payment_4.entry.js +8 -8
- package/dist/esm/zonos-hello-dialog.entry.js +9 -9
- package/dist/esm/zonos-hello.entry.js +6 -357
- package/dist/esm/zonos-input.entry.js +3 -3
- package/dist/esm/zonos-language-select_2.entry.js +5 -5
- package/dist/esm/zonos-link.entry.js +1 -1
- package/dist/esm/zonos-logo.entry.js +2 -2
- package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
- package/dist/esm/zonos-stripe-input.entry.js +31 -12
- package/dist/esm/zonos-text.entry.js +2 -2
- package/dist/esm/zonos-toggle.entry.js +4 -4
- package/dist/esm/zonos-tooltip.entry.js +3 -3
- package/dist/esm/zonos-v-stack.entry.js +4 -4
- package/dist/esm/{zonosStore-d3c5a0a5.js → zonosStore-1ce34e04.js} +2 -1
- package/dist/esm-es5/cart-4725a63b.js +1 -0
- package/dist/esm-es5/debounce-3cf0793c.js +1 -0
- package/dist/esm-es5/{getBorderRadius-ada3ccad.js → getBorderRadius-a9a48f79.js} +1 -1
- package/dist/esm-es5/getGenericSettingsOverride-0bc3e118.js +1 -0
- package/dist/esm-es5/helpers-2f6955b1.js +1 -0
- package/dist/esm-es5/index-a457c60c.js +2 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-446fccb7.js → isDarkColor-62cbddb5.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-1f2e863c.js → paypal-a09943f4.js} +1 -1
- package/dist/esm-es5/zonos-address_11.entry.js +1 -0
- package/dist/esm-es5/zonos-badge.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.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.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_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-empty-state-payment_4.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-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-link.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/zonos-toggle.entry.js +1 -1
- package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-d3c5a0a5.js → zonosStore-1ce34e04.js} +1 -1
- package/dist/scripts/index.d.ts +3905 -3284
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +4 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +28 -1
- package/dist/types/components/common/zonos-button/zonos-button.d.ts +4 -0
- package/dist/types/components/common/zonos-checkbox/zonos-checkbox.d.ts +1 -0
- package/dist/types/components/common/zonos-stripe-input/zonos-stripe-input.d.ts +22 -0
- package/dist/types/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.d.ts +88 -0
- package/dist/types/components/common/zonos-stripe-select/zonos-stripe-select.d.ts +86 -0
- package/dist/types/components/main/zonos-controller.d.ts +1 -0
- package/dist/types/components/store/checkout/stripe.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +159 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +159 -0
- package/dist/types/components/store/zonosStore.d.ts +6 -1
- package/dist/types/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.d.ts +38 -0
- package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +150 -0
- package/dist/types/components/utils/api/getGenericSettingsOverride.d.ts +5 -0
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components/utils/api/getZonosSettings.d.ts +2 -2
- package/dist/types/components/utils/checkout/form/helpers.d.ts +19 -0
- package/dist/types/components/utils/checkout/form/isValidZip.d.ts +5 -0
- package/dist/types/components/utils/iframe/CheckoutAddressService.d.ts +38 -0
- package/dist/types/components/utils/iframe/IframeHelpers.d.ts +81 -0
- package/dist/types/components/utils/mergeAddress.d.ts +4 -0
- package/dist/types/components/utils/resetToSelectedTab.d.ts +1 -1
- package/dist/types/components.d.ts +472 -4
- package/dist/types/constants/phone-formats.d.ts +5 -0
- package/dist/types/environment.d.ts +1 -1
- package/dist/types/scripts/_zonosBase.d.ts +13 -1
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +1 -0
- package/dist/types/types/CountryFields.d.ts +40 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +7 -0
- package/dist/types/types/checkout/form/CustomAddressErrors.d.ts +13 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +166 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +148 -1
- package/dist/types/types/generated/graphql.internal.types.d.ts +180 -8
- package/dist/types/types/generated/graphql.internal.types.ts +218 -8
- package/dist/types/types/global.d.ts +1 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/utils/ZonosSettings.d.ts +17 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-4622cca6.entry.js → p-0104d3ba.entry.js} +1 -1
- package/dist/zonos-elements/{p-7cb87ea7.system.entry.js → p-04303b56.system.entry.js} +1 -1
- package/dist/zonos-elements/p-06f798ee.system.js +1 -0
- package/dist/zonos-elements/{p-739014f8.system.entry.js → p-0fdd7034.system.entry.js} +1 -1
- package/dist/zonos-elements/p-15dd7ea4.system.entry.js +1 -0
- package/dist/zonos-elements/{p-a1cfbd0a.js → p-17299200.js} +1 -1
- package/dist/zonos-elements/{p-58f660d4.system.entry.js → p-1b29bc5f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-fe2c27c4.entry.js → p-1e612c29.entry.js} +1 -1
- package/dist/zonos-elements/{p-98aa88b1.js → p-2097fae5.js} +1 -1
- package/dist/zonos-elements/{p-81084be5.system.entry.js → p-240ee490.system.entry.js} +1 -1
- package/dist/zonos-elements/p-2416aaa1.system.entry.js +1 -0
- package/dist/zonos-elements/{p-cedf08f0.entry.js → p-313ef896.entry.js} +1 -1
- package/dist/zonos-elements/{p-fa65b53d.entry.js → p-314fbfe1.entry.js} +1 -1
- package/dist/zonos-elements/{p-5187ba8f.system.js → p-31e90130.system.js} +1 -1
- package/dist/zonos-elements/{p-4ca666ea.system.entry.js → p-341f40c2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d49c6a3e.system.entry.js → p-35f33601.system.entry.js} +1 -1
- package/dist/zonos-elements/p-4160bbc2.system.js +1 -0
- package/dist/zonos-elements/p-43633269.system.js +2 -0
- package/dist/zonos-elements/p-443b5db2.entry.js +1 -0
- package/dist/zonos-elements/p-46d3e378.system.entry.js +1 -0
- package/dist/zonos-elements/{p-3d221556.system.entry.js → p-488ad646.system.entry.js} +1 -1
- package/dist/zonos-elements/p-53ffdb91.js +1 -0
- package/dist/zonos-elements/p-56b56caa.system.entry.js +1 -0
- package/dist/zonos-elements/p-5e15616f.entry.js +1 -0
- package/dist/zonos-elements/{p-3eac4b10.entry.js → p-5f896e9a.entry.js} +1 -1
- package/dist/zonos-elements/{p-e8c70c7d.system.entry.js → p-609c32a3.system.entry.js} +1 -1
- package/dist/zonos-elements/p-64ea232c.system.entry.js +1 -0
- package/dist/zonos-elements/{p-f378b4d3.system.entry.js → p-678ccc3f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8048932d.entry.js → p-67b904c2.entry.js} +1 -1
- package/dist/zonos-elements/p-6b40da70.system.js +1 -0
- package/dist/zonos-elements/p-70d4d436.entry.js +1 -0
- package/dist/zonos-elements/{p-64dbc282.entry.js → p-818d6f17.entry.js} +1 -1
- package/dist/zonos-elements/{p-b5b9aa6c.entry.js → p-81ee1683.entry.js} +1 -1
- package/dist/zonos-elements/{p-236f32c8.system.entry.js → p-89fcd305.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c4fa8524.system.entry.js → p-94a80d93.system.entry.js} +1 -1
- package/dist/zonos-elements/p-961620ae.entry.js +1 -0
- package/dist/zonos-elements/{p-4eff2f8a.system.entry.js → p-98e4a965.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5bebcfc2.system.js → p-9913c186.system.js} +1 -1
- package/dist/zonos-elements/{p-29e8c9e8.system.entry.js → p-991c85f1.system.entry.js} +1 -1
- package/dist/zonos-elements/p-995761ea.system.entry.js +1 -0
- package/dist/zonos-elements/p-9a6eb099.entry.js +1 -0
- package/dist/zonos-elements/p-9a7a9b1c.entry.js +1 -0
- package/dist/zonos-elements/{p-d367c9ae.system.entry.js → p-9f7b9d66.system.entry.js} +1 -1
- package/dist/zonos-elements/p-a2dab25e.system.entry.js +1 -0
- package/dist/zonos-elements/{p-587568b5.entry.js → p-aaff5dcc.entry.js} +1 -1
- package/dist/zonos-elements/{p-3731e7f5.entry.js → p-abc66a0b.entry.js} +1 -1
- package/dist/zonos-elements/{p-eb294265.entry.js → p-aca3a2bb.entry.js} +1 -1
- package/dist/zonos-elements/p-afa34aff.system.js +1 -0
- package/dist/zonos-elements/{p-69f84611.entry.js → p-b2241919.entry.js} +1 -1
- package/dist/zonos-elements/p-b5edee66.system.js +1 -0
- package/dist/zonos-elements/p-b610f70c.system.js +1 -0
- package/dist/zonos-elements/{p-69255ed2.system.js → p-bbbaea3a.system.js} +1 -1
- package/dist/zonos-elements/p-c137dc82.js +2 -0
- package/dist/zonos-elements/{p-be9e1818.system.entry.js → p-c140a0bd.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-de221545.entry.js → p-cf6ae7dc.entry.js} +1 -1
- package/dist/zonos-elements/{p-90633d63.entry.js → p-d0f4b6c3.entry.js} +1 -1
- package/dist/zonos-elements/{p-112aecac.js → p-de462b9b.js} +2 -2
- package/dist/zonos-elements/{p-107b08c1.entry.js → p-e5d081d8.entry.js} +1 -1
- package/dist/zonos-elements/p-e7b0c156.js +1 -0
- package/dist/zonos-elements/{p-30fdcbee.js → p-e892fb29.js} +1 -1
- package/dist/zonos-elements/p-e90cb997.entry.js +1 -0
- package/dist/zonos-elements/{p-db3f381d.entry.js → p-e91b244c.entry.js} +1 -1
- package/dist/zonos-elements/{p-41dfc828.entry.js → p-e99354d5.entry.js} +1 -1
- package/dist/zonos-elements/p-ea6d87a1.system.js +1 -0
- package/dist/zonos-elements/p-eef5b0cc.js +1 -0
- package/dist/zonos-elements/{p-d0944cc8.system.entry.js → p-f3f27bf2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0e63259c.system.entry.js → p-f4cc688e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-cc6d9f7d.entry.js → p-f7d3e48b.entry.js} +1 -1
- package/dist/zonos-elements/p-fa6de0f3.js +1 -0
- package/dist/zonos-elements/{p-c5c8f803.system.entry.js → p-fd348fd4.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/dist/zonos-elements/zonos-elements.js +1 -1
- package/package.json +3 -1
- package/dist/cjs/zonos-address_7.cjs.entry.js +0 -772
- package/dist/esm/zonos-address_7.entry.js +0 -762
- package/dist/esm-es5/cart-3fb04f1f.js +0 -1
- package/dist/esm-es5/index-d82f06f2.js +0 -2
- package/dist/esm-es5/zonos-address_7.entry.js +0 -1
- package/dist/zonos-elements/p-358043a2.system.entry.js +0 -1
- package/dist/zonos-elements/p-43feb95e.entry.js +0 -1
- package/dist/zonos-elements/p-46f6e5e9.system.js +0 -1
- package/dist/zonos-elements/p-4aca92c5.system.entry.js +0 -1
- package/dist/zonos-elements/p-4caffd96.system.js +0 -2
- package/dist/zonos-elements/p-59e31080.system.js +0 -1
- package/dist/zonos-elements/p-6c0c8722.system.entry.js +0 -1
- package/dist/zonos-elements/p-7decb19b.entry.js +0 -1
- package/dist/zonos-elements/p-829f6a40.entry.js +0 -1
- package/dist/zonos-elements/p-8f640b28.entry.js +0 -1
- package/dist/zonos-elements/p-a69dbe14.js +0 -1
- package/dist/zonos-elements/p-ab68ad11.js +0 -2
- package/dist/zonos-elements/p-ac889f52.entry.js +0 -1
- package/dist/zonos-elements/p-b998494a.entry.js +0 -1
- package/dist/zonos-elements/p-bc0f885e.system.entry.js +0 -1
- package/dist/zonos-elements/p-c6d96a42.system.js +0 -1
- package/dist/zonos-elements/p-ce853f8f.system.entry.js +0 -1
- package/dist/zonos-elements/p-e4f8114a.system.js +0 -1
- package/dist/zonos-elements/p-e99e75dd.system.entry.js +0 -1
- package/dist/zonos-elements/p-f66a5c7c.system.entry.js +0 -1
- package/dist/zonos-elements/p-febb90e0.entry.js +0 -1
|
@@ -1,762 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, d as getElement } from './index-d82f06f2.js';
|
|
2
|
-
import { e as cartStore, f as stripeStore, t as trackConversionEvent, V as getFallbackDefaultCountryCode, r as translate, l as localizationStore } from './cart-3fb04f1f.js';
|
|
3
|
-
import { z as zonosStore, d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
|
|
4
|
-
import { b as logError, l as log, i as isCheckoutMobile } from './handleFetch-621e45bc.js';
|
|
5
|
-
import { i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './containsNonLatinChars-2d8810c3.js';
|
|
6
|
-
import { c as classes } from './classes-0d95c529.js';
|
|
7
|
-
import { R as RemoveIcon$1 } from './RemoveIcon-9dc5dd1a.js';
|
|
8
|
-
import { g as getBorderRadius } from './getBorderRadius-ada3ccad.js';
|
|
9
|
-
import { i as isDarkColor } from './isDarkColor-446fccb7.js';
|
|
10
|
-
|
|
11
|
-
const zonosAddressCss = ".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";
|
|
12
|
-
const ZonosAddressStyle0 = zonosAddressCss;
|
|
13
|
-
|
|
14
|
-
const ZonosAddress = class {
|
|
15
|
-
constructor(hostRef) {
|
|
16
|
-
registerInstance(this, hostRef);
|
|
17
|
-
this.invalidCharacters = createEvent(this, "invalidCharacters", 7);
|
|
18
|
-
/**
|
|
19
|
-
* Google autocomplete overlay is conflict with our button, this is to adjust z index of the autocomplete
|
|
20
|
-
*/
|
|
21
|
-
this.isAutoCompleteAdjusted = false;
|
|
22
|
-
/**
|
|
23
|
-
* Check if the tracking event is sent
|
|
24
|
-
*/
|
|
25
|
-
this.trackingSent = false;
|
|
26
|
-
this.type = undefined;
|
|
27
|
-
this.titleText = undefined;
|
|
28
|
-
this.defaultAddress = [];
|
|
29
|
-
this.stripe = window.Zonos.stripe;
|
|
30
|
-
this.isDirtyAddress = false;
|
|
31
|
-
this.isAddressFilled = false;
|
|
32
|
-
this.checkoutSessionId = cartStore.checkoutSessionId;
|
|
33
|
-
}
|
|
34
|
-
getStripeAddressInstance() {
|
|
35
|
-
if (this.type === 'billing') {
|
|
36
|
-
return {
|
|
37
|
-
stripeAddressElement: stripeStore.stripeBillingAddressElement,
|
|
38
|
-
stripeAddressEventData: stripeStore.stripeBillingAddressEventData,
|
|
39
|
-
stripeElements: stripeStore.stripeElementsForBillingAddress,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
stripeAddressElement: stripeStore.stripeAddressElement,
|
|
44
|
-
stripeAddressEventData: stripeStore.stripeAddressEventData,
|
|
45
|
-
stripeElements: stripeStore.stripeElements,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
updateAddressEventData({ event, type, }) {
|
|
49
|
-
switch (type) {
|
|
50
|
-
case 'billing':
|
|
51
|
-
stripeStore.stripeBillingAddressEventData = event;
|
|
52
|
-
break;
|
|
53
|
-
default: {
|
|
54
|
-
stripeStore.stripeAddressEventData = event;
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
isAddressFilledChanged() {
|
|
60
|
-
// Sometimes address elements is loaded with prefilled data before checkout is loaded, need to not send the event if checkout session id is not available, and send the event after checkout is loaded
|
|
61
|
-
if (!cartStore.checkoutSessionId) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
// Only need to track the event if the shipping address is filled
|
|
65
|
-
if (this.isAddressFilled &&
|
|
66
|
-
!this.trackingSent &&
|
|
67
|
-
this.type === 'shipping') {
|
|
68
|
-
this.trackingSent = true;
|
|
69
|
-
const checkoutSessionId = cartStore.checkoutSessionId;
|
|
70
|
-
void trackConversionEvent({
|
|
71
|
-
checkoutSessionId,
|
|
72
|
-
eventName: 'checkout_customerInfoFilled',
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
updateAddressElement({ stripeAddressElement, type, }) {
|
|
77
|
-
if (type === 'shipping') {
|
|
78
|
-
stripeStore.stripeAddressElement = stripeAddressElement;
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
stripeStore.stripeBillingAddressElement = stripeAddressElement;
|
|
82
|
-
}
|
|
83
|
-
async watchInitStripe() {
|
|
84
|
-
this.stripe = window.Zonos.stripe;
|
|
85
|
-
const { stripeAddressEventData, stripeElements } = this.getStripeAddressInstance();
|
|
86
|
-
if (!this.stripe || !stripeElements) {
|
|
87
|
-
logError("Stripe is not initialized. Couldn't load stripe element.");
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
// remove phone from default address if it's not provided, stripe
|
|
91
|
-
// will throw error if key phone exist and its value is empty or 'undefined'.
|
|
92
|
-
const defaultAddress = this.defaultAddress.map(address => (Object.assign(Object.assign({}, address), { name: address.name, phone: address.phone || undefined })));
|
|
93
|
-
const shippableCountries = localizationStore.shippingZoneCountries;
|
|
94
|
-
const shippingZone = shippableCountries
|
|
95
|
-
? Object.values(shippableCountries).map(country => country.code)
|
|
96
|
-
: [];
|
|
97
|
-
// Show all countries in checkout if the query param is present
|
|
98
|
-
const checkoutAllCountries = new URLSearchParams(window.location.search).has('zonosCheckoutAllCountries');
|
|
99
|
-
const allowedCountries = this.type === 'shipping' ? shippingZone : [];
|
|
100
|
-
const defaultAddressCountry = (stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.address.country) ||
|
|
101
|
-
getFallbackDefaultCountryCode(allowedCountries);
|
|
102
|
-
log(`Stripe country code: ${defaultAddressCountry}`, 'info');
|
|
103
|
-
const addressElement = stripeElements.create('address', {
|
|
104
|
-
allowedCountries: checkoutAllCountries ? [] : allowedCountries,
|
|
105
|
-
// only show the default address if stripeAddressEventData is not provided
|
|
106
|
-
contacts: defaultAddress.length && !stripeAddressEventData
|
|
107
|
-
? this.defaultAddress
|
|
108
|
-
: [],
|
|
109
|
-
defaultValues: {
|
|
110
|
-
address: Object.assign(Object.assign({}, stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.address), { country: defaultAddressCountry }),
|
|
111
|
-
firstName: stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.firstName,
|
|
112
|
-
lastName: stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.lastName,
|
|
113
|
-
phone: stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.phone,
|
|
114
|
-
},
|
|
115
|
-
display: {
|
|
116
|
-
name: 'split',
|
|
117
|
-
},
|
|
118
|
-
fields: {
|
|
119
|
-
phone: 'always',
|
|
120
|
-
},
|
|
121
|
-
mode: this.type,
|
|
122
|
-
validation: {
|
|
123
|
-
phone: {
|
|
124
|
-
required: 'always',
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
addressElement.mount(this.el.querySelector('.zonos--address-component'));
|
|
129
|
-
addressElement.on('change', event => {
|
|
130
|
-
const eventValue = event.value;
|
|
131
|
-
if (!this.isDirtyAddress && eventValue.address.line1.length >= 3) {
|
|
132
|
-
this.isDirtyAddress = true;
|
|
133
|
-
// stripe element started with just address line 1, so scroll bar is not yet available. Wait for a moment before scrolling
|
|
134
|
-
setTimeout(() => {
|
|
135
|
-
if (!this.isAutoCompleteAdjusted) {
|
|
136
|
-
const googleAutoComplete = this.el.querySelector('iframe[src*="autocomplete-suggestions"]');
|
|
137
|
-
if (googleAutoComplete) {
|
|
138
|
-
googleAutoComplete.style.zIndex = '2';
|
|
139
|
-
}
|
|
140
|
-
this.isAutoCompleteAdjusted = true;
|
|
141
|
-
}
|
|
142
|
-
// scroll directly into view if it's mobile
|
|
143
|
-
if (isCheckoutMobile()) {
|
|
144
|
-
this.el.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
// scroll into the end of the page so the address placeholder won't be hidden
|
|
148
|
-
const yOffset = this.type === 'shipping' ? 100 : 600;
|
|
149
|
-
const parentWrapper = this.el.closest('.zonos--group');
|
|
150
|
-
const y = this.el.getBoundingClientRect().top + yOffset;
|
|
151
|
-
parentWrapper === null || parentWrapper === void 0 ? void 0 : parentWrapper.scrollTo({ behavior: 'smooth', top: y });
|
|
152
|
-
}
|
|
153
|
-
}, 600);
|
|
154
|
-
}
|
|
155
|
-
this.updateAddressEventData({
|
|
156
|
-
event: Object.assign(Object.assign({}, event), { elementMode: this.type, elementType: 'address', value: Object.assign(Object.assign({}, eventValue), { firstName: eventValue.firstName || eventValue.name.split(' ')[0], lastName: eventValue.lastName || eventValue.name.split(' ')[1] }) }),
|
|
157
|
-
type: this.type,
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
this.updateAddressElement({
|
|
161
|
-
stripeAddressElement: addressElement,
|
|
162
|
-
type: this.type,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
defaultAddressChanged(newAddress, oldAddress) {
|
|
166
|
-
// check if stringified json of oldAddress is different from newAddress
|
|
167
|
-
const oldAddressString = JSON.stringify(oldAddress);
|
|
168
|
-
const newAddressString = JSON.stringify(newAddress);
|
|
169
|
-
// No need to reset address element if the default address is the same
|
|
170
|
-
if (oldAddressString === newAddressString) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
log('Reset address element when default address property is changed', 'info', {
|
|
174
|
-
defaultAddress: this.defaultAddress,
|
|
175
|
-
});
|
|
176
|
-
const stripeElement = this.getStripeAddressInstance().stripeAddressElement;
|
|
177
|
-
stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.clear();
|
|
178
|
-
stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.destroy();
|
|
179
|
-
// Reset stripe address event data
|
|
180
|
-
if (this.type === 'shipping') {
|
|
181
|
-
stripeStore.stripeAddressEventData = null;
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
stripeStore.stripeBillingAddressEventData = null;
|
|
185
|
-
}
|
|
186
|
-
void this.watchInitStripe();
|
|
187
|
-
}
|
|
188
|
-
renderCompanyNameInput() {
|
|
189
|
-
var _a;
|
|
190
|
-
// No need to render company name for billing address
|
|
191
|
-
if (this.type === 'billing') {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
// No need to render company name if it's not enabled
|
|
195
|
-
if (!((_a = zonosStore.genericSettings) === null || _a === void 0 ? void 0 : _a.companyNameInputEnabled)) {
|
|
196
|
-
// Clear the company name when it's not enabled
|
|
197
|
-
stripeStore.companyName = '';
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
return (h("zonos-stripe-input", { class: "zonos--company-name-input", inputLabel: translate('Company name (optional)'), inputValue: stripeStore.companyName, onInputChange: (event) => {
|
|
201
|
-
stripeStore.companyName = event.detail;
|
|
202
|
-
} }));
|
|
203
|
-
}
|
|
204
|
-
disconnectedCallback() {
|
|
205
|
-
// destroy the stripe element when this component is removed from the DOM, so that we can re-create the new one with previous value
|
|
206
|
-
const stripeElement = this.getStripeAddressInstance().stripeAddressElement;
|
|
207
|
-
stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.destroy();
|
|
208
|
-
}
|
|
209
|
-
componentDidLoad() {
|
|
210
|
-
const stripeAddressEventData = this.getStripeAddressInstance().stripeAddressEventData;
|
|
211
|
-
this.isDirtyAddress =
|
|
212
|
-
!!stripeAddressEventData &&
|
|
213
|
-
stripeAddressEventData.value.address.line1.length > 0;
|
|
214
|
-
// @Watch doesn't get trigger on initial load
|
|
215
|
-
void this.watchInitStripe();
|
|
216
|
-
}
|
|
217
|
-
render() {
|
|
218
|
-
var _a;
|
|
219
|
-
this.checkoutSessionId = cartStore.checkoutSessionId;
|
|
220
|
-
if ((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) {
|
|
221
|
-
this.isAddressFilled = true;
|
|
222
|
-
}
|
|
223
|
-
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
224
|
-
return (h(Host, { key: 'f31fc745e5c024dd2b594a26a0a81ebe3a5f8060', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '7b51df49edb4d7abbff9733b1e220771caca7f12', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), h("div", { key: '781cd2076d8319979bb5ed2ea3bb24dfa97f7010', class: "zonos--address-component" })));
|
|
225
|
-
}
|
|
226
|
-
get el() { return getElement(this); }
|
|
227
|
-
static get watchers() { return {
|
|
228
|
-
"checkoutSessionId": ["isAddressFilledChanged"],
|
|
229
|
-
"isAddressFilled": ["isAddressFilledChanged"],
|
|
230
|
-
"stripe": ["watchInitStripe"],
|
|
231
|
-
"defaultAddress": ["defaultAddressChanged"]
|
|
232
|
-
}; }
|
|
233
|
-
};
|
|
234
|
-
ZonosAddress.style = ZonosAddressStyle0;
|
|
235
|
-
|
|
236
|
-
const zonosAddressDisplayCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--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 .zonos--title{margin-bottom:12px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:4px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-line{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .zonos--address-line zonos-text+zonos-text::before{content:\", \";color:var(--zonos-elements-gray-1000);margin-right:4px}:host .zonos--country-flag{width:20px;height:14px;border-radius:2px;margin:1px;position:relative;overflow:hidden;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);margin-right:8px;z-index:10;justify-self:center}";
|
|
237
|
-
const ZonosAddressDisplayStyle0 = zonosAddressDisplayCss;
|
|
238
|
-
|
|
239
|
-
const ZonosAddressDisplay = class {
|
|
240
|
-
constructor(hostRef) {
|
|
241
|
-
registerInstance(this, hostRef);
|
|
242
|
-
this.currentAddress = undefined;
|
|
243
|
-
this.addressType = undefined;
|
|
244
|
-
}
|
|
245
|
-
render() {
|
|
246
|
-
var _a;
|
|
247
|
-
const { city, country, email, line1, line2, name, phone, postal_code, state, } = this.currentAddress;
|
|
248
|
-
const shippingZoneCountry = (_a = localizationStore.shippingZoneCountries) === null || _a === void 0 ? void 0 : _a[country];
|
|
249
|
-
const renderEnteredInfoText = ({ bold, content, }) => {
|
|
250
|
-
const textColor = isTextContainsNonLatinChars(content)
|
|
251
|
-
? 'red-600'
|
|
252
|
-
: 'gray-1000';
|
|
253
|
-
return (h("zonos-text", { textColor: textColor, type: bold ? 'boldLabel' : 'body' }, content));
|
|
254
|
-
};
|
|
255
|
-
return (h(Host, { class: "zonos--address-form zonos--elements" }, h("div", { class: "zonos--title" }, h("zonos-text", { textColor: "gray-700", type: "smallHeader" }, this.addressType === 'shipping'
|
|
256
|
-
? translate('Shipping')
|
|
257
|
-
: translate('Billing'))), h("div", { class: "zonos--address-group" }, name && (h("div", { class: "zonos--address-line" }, renderEnteredInfoText({ bold: true, content: name }))), email && (h("div", { class: "zonos--address-line" }, renderEnteredInfoText({ content: email }))), phone && (h("div", { class: "zonos--address-line" }, renderEnteredInfoText({ content: phone }))), line1 && (h("div", { class: "zonos--address-line" }, renderEnteredInfoText({ content: line1 }))), line2 && (h("div", { class: "zonos--address-line" }, renderEnteredInfoText({ content: line2 }))), h("div", { class: "zonos--address-line" }, city && renderEnteredInfoText({ content: city }), state && renderEnteredInfoText({ content: state }), postal_code && renderEnteredInfoText({ content: postal_code })), shippingZoneCountry && (h("div", { class: "zonos--address-line" }, h("zonos-country-flag", { class: "zonos--country-flag", countryCode: shippingZoneCountry.code }), ' ', renderEnteredInfoText({
|
|
258
|
-
content: shippingZoneCountry.displayName,
|
|
259
|
-
}))))));
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
ZonosAddressDisplay.style = ZonosAddressDisplayStyle0;
|
|
263
|
-
|
|
264
|
-
const zonosAddressFormCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--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 .zonos--title{margin-bottom:20px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:20px;-ms-flex-direction:column;flex-direction:column;margin:1px}:host .zonos--contact{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--address-row>*{-ms-flex:1;flex:1}:host .zonos--address{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}";
|
|
265
|
-
const ZonosAddressFormStyle0 = zonosAddressFormCss;
|
|
266
|
-
|
|
267
|
-
const ZonosAddressForm = class {
|
|
268
|
-
constructor(hostRef) {
|
|
269
|
-
registerInstance(this, hostRef);
|
|
270
|
-
this.addressChange = createEvent(this, "addressChange", 7);
|
|
271
|
-
this.onInputChange = ({ key, value, }) => {
|
|
272
|
-
this.addressChange.emit(Object.assign(Object.assign({}, this.localAddress), { [key]: value }));
|
|
273
|
-
};
|
|
274
|
-
this.currentAddress = undefined;
|
|
275
|
-
this.translatedAddress = undefined;
|
|
276
|
-
this.addressType = undefined;
|
|
277
|
-
this.localAddress = this.currentAddress;
|
|
278
|
-
}
|
|
279
|
-
watchCurrentAddress() {
|
|
280
|
-
var _a, _b, _c, _d, _e, _f;
|
|
281
|
-
const { city, line1, line2, name, postal_code, state } = this.currentAddress;
|
|
282
|
-
// Update the local address when the current address changes
|
|
283
|
-
// If translated address is available, use that instead
|
|
284
|
-
this.localAddress = Object.assign(Object.assign({}, this.currentAddress), { city: ((_a = this.translatedAddress.city) === null || _a === void 0 ? void 0 : _a[city]) || city, line1: ((_b = this.translatedAddress.line1) === null || _b === void 0 ? void 0 : _b[line1]) || line1, line2: ((_c = this.translatedAddress.line2) === null || _c === void 0 ? void 0 : _c[line2]) || line2, name: ((_d = this.translatedAddress.name) === null || _d === void 0 ? void 0 : _d[name]) || name, postal_code: ((_e = this.translatedAddress.postal_code) === null || _e === void 0 ? void 0 : _e[postal_code]) || postal_code, state: ((_f = this.translatedAddress.state) === null || _f === void 0 ? void 0 : _f[state]) || state });
|
|
285
|
-
}
|
|
286
|
-
componentWillLoad() {
|
|
287
|
-
this.watchCurrentAddress();
|
|
288
|
-
}
|
|
289
|
-
render() {
|
|
290
|
-
const { city, country, line1, line2, name, phone, postal_code, state } = this.localAddress;
|
|
291
|
-
const firstName = name.split(' ')[0] || '';
|
|
292
|
-
// get the rest of the name if it exists
|
|
293
|
-
const lastName = name.split(' ').slice(1).join(' ') || '';
|
|
294
|
-
return (h(Host, { key: '8b578737e33203a23563be7e9be0778deec99bbf', class: "zonos--address-form zonos--elements" }, h("div", { key: '793675a1348547bf3f781788956befe325191011', class: "zonos--title" }, h("zonos-text", { key: '13de35cb0a7c98a48342e3fb86ae3ade9f5b88d9', textColor: "gray-700", type: "smallHeader" }, this.addressType === 'shipping'
|
|
295
|
-
? translate('Shipping')
|
|
296
|
-
: translate('Billing'))), h("div", { key: '2c5de5b5283fb99ee5f8b61d7a217177986fc2db', class: "zonos--address-group" }, h("div", { key: '23bf3c893071000d5995a5f175867bab11929193', class: "zonos--contact" }, h("zonos-text", { key: '7cdfe2a84ebad89ba5b16498d75def99cf392384', type: "label" }, translate('Contact')), h("zonos-input", { key: '1c39c38767fd306c5eb1164cdc989b8291209cf0', class: "zonos--form-email", inputLabel: translate('Email'), inputValue: this.currentAddress.email, isDisabled: true }), h("div", { key: 'cbdf61217125e22b1a6cec9a340ef0aca2c75670', class: "zonos--name zonos--address-row" }, h("zonos-input", { key: '360c99e7b2c6caa64580d5768b5bb53368927275', class: "zonos--form-first-name", inputLabel: translate('First name'), inputValue: firstName, isError: isTextContainsNonLatinChars(firstName), onInputChange: e => this.onInputChange({
|
|
297
|
-
key: 'name',
|
|
298
|
-
value: `${e.detail} ${lastName}`,
|
|
299
|
-
}) }), h("zonos-input", { key: '8ce5fa5c15c6f7928339ea10009ce0e68954a91f', class: "zonos--form-last-name", inputLabel: translate('Last name'), inputValue: lastName, isError: isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
|
|
300
|
-
key: 'name',
|
|
301
|
-
value: `${firstName} ${e.detail}`,
|
|
302
|
-
}) }))), h("div", { key: '7b4fa2d3baa6cb257e7688e5ba6777123898b3fd', class: "zonos--address" }, h("zonos-text", { key: '9d5782331b2642755a755aeb7f98c9f4d87f9a20', type: "label" }, translate('Address')), h("zonos-input", { key: 'a622025924ca86bdbf1d3c04b79e6dee172b4c42', class: "zonos--form-country", inputLabel: translate('Country'), inputValue: country, isDisabled: true }), h("zonos-input", { key: 'f99b3a74db09ab5730878e80705b9aeac76bf800', class: "zonos--form-line1", inputLabel: translate('Address line 1'), inputValue: line1, isError: isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), h("zonos-input", { key: '5d16aefa45a78045c87d166aaaec0255606e455e', class: "zonos--form-line2", inputLabel: translate('Address line 2'), inputValue: line2, isError: isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), h("div", { key: 'dc166be9381142835d72e731cb38a718522a068a', class: "zonos--address-row" }, h("zonos-input", { key: '4f1a98f9d10ce0cff3ef18a3037a12382552b31d', class: "zonos--form-city", inputLabel: translate('City'), inputValue: city, isError: isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), h("zonos-input", { key: 'd4f97900b5fe2e1619950a52d1d1f716a8bc19ff', class: "zonos--form-state", inputLabel: translate('State/Province'), inputValue: state, isError: isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), h("zonos-input", { key: 'cf1eb0ca5cd15c8412a2e1246aaf2e39361dc733', class: "zonos--form-postal-code", inputLabel: translate('Postal code'), inputValue: postal_code, isError: isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), h("zonos-input", { key: '7421c82847eded6bdbcce49ef8196124d8e50c1d', class: "zonos--form-phone", inputLabel: translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
|
|
303
|
-
}
|
|
304
|
-
static get watchers() { return {
|
|
305
|
-
"translatedAddress": ["watchCurrentAddress"]
|
|
306
|
-
}; }
|
|
307
|
-
};
|
|
308
|
-
ZonosAddressForm.style = ZonosAddressFormStyle0;
|
|
309
|
-
|
|
310
|
-
const zonosAddressUpdateDialogCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--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 .zonos--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";
|
|
311
|
-
const ZonosAddressUpdateDialogStyle0 = zonosAddressUpdateDialogCss;
|
|
312
|
-
|
|
313
|
-
const ZonosAddressUpdateDialog = class {
|
|
314
|
-
constructor(hostRef) {
|
|
315
|
-
registerInstance(this, hostRef);
|
|
316
|
-
this.closeUpdateDialog = createEvent(this, "closeUpdateDialog", 7);
|
|
317
|
-
this.continueClicked = createEvent(this, "continueClicked", 7);
|
|
318
|
-
/**
|
|
319
|
-
* handler for close button click
|
|
320
|
-
*/
|
|
321
|
-
this.closeUpdateDialogHandler = () => {
|
|
322
|
-
this.closeUpdateDialog.emit();
|
|
323
|
-
};
|
|
324
|
-
/**
|
|
325
|
-
* Extract value from translated object
|
|
326
|
-
*/
|
|
327
|
-
this.getTranslatedAddress = ({ currentAddress, translatedAddress, }) => {
|
|
328
|
-
var _a, _b, _c, _d, _e, _f;
|
|
329
|
-
const { city, line1, line2, name, postal_code, state } = currentAddress;
|
|
330
|
-
return {
|
|
331
|
-
city: ((_a = translatedAddress.city) === null || _a === void 0 ? void 0 : _a[city]) || city,
|
|
332
|
-
line1: ((_b = translatedAddress.line1) === null || _b === void 0 ? void 0 : _b[line1]) || line1,
|
|
333
|
-
line2: ((_c = translatedAddress.line2) === null || _c === void 0 ? void 0 : _c[line2]) || line2,
|
|
334
|
-
name: ((_d = translatedAddress.name) === null || _d === void 0 ? void 0 : _d[name]) || name,
|
|
335
|
-
postal_code: ((_e = translatedAddress.postal_code) === null || _e === void 0 ? void 0 : _e[postal_code]) || postal_code,
|
|
336
|
-
state: ((_f = translatedAddress.state) === null || _f === void 0 ? void 0 : _f[state]) || state,
|
|
337
|
-
};
|
|
338
|
-
};
|
|
339
|
-
/**
|
|
340
|
-
* handler for continue button click
|
|
341
|
-
*/
|
|
342
|
-
this.continueClickHandler = async () => {
|
|
343
|
-
var _a, _b, _c;
|
|
344
|
-
// set spinner for the continue button
|
|
345
|
-
this.continueLoading = true;
|
|
346
|
-
const translatedBillingAddress = this.billingAddress
|
|
347
|
-
? this.getTranslatedAddress({
|
|
348
|
-
currentAddress: this.billingAddress,
|
|
349
|
-
translatedAddress: this.translatedBillingAddressState,
|
|
350
|
-
})
|
|
351
|
-
: null;
|
|
352
|
-
const translatedShippingAddress = this.getTranslatedAddress({
|
|
353
|
-
currentAddress: this.shippingAddress,
|
|
354
|
-
translatedAddress: this.translatedShippingAddressState,
|
|
355
|
-
});
|
|
356
|
-
// check to see if there are still non-latin characters in the translated address
|
|
357
|
-
const shippingNonlatinChars = containsNonLatinChars(Object.assign(Object.assign({}, translatedShippingAddress), { country: this.shippingAddress.country }));
|
|
358
|
-
// get list of non-latin characters field in the billing address
|
|
359
|
-
const billingNonLatinChars = translatedBillingAddress &&
|
|
360
|
-
this.billingAddress &&
|
|
361
|
-
containsNonLatinChars(Object.assign(Object.assign({}, translatedBillingAddress), { country: this.billingAddress.country }));
|
|
362
|
-
const shippingHasNonLatinChars = !!Object.keys(shippingNonlatinChars)
|
|
363
|
-
.length;
|
|
364
|
-
const billingHasNonLatinChars = !!billingNonLatinChars && !!Object.keys(billingNonLatinChars).length;
|
|
365
|
-
// if there are non-latin characters in the translated address, scroll to the error input so user can see and fix it
|
|
366
|
-
if (shippingHasNonLatinChars || billingHasNonLatinChars) {
|
|
367
|
-
// get scroll top of the first input has "has-error" class
|
|
368
|
-
const addressForms = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('zonos-address-form');
|
|
369
|
-
const shippingAddressForm = addressForms === null || addressForms === void 0 ? void 0 : addressForms[0];
|
|
370
|
-
const billingAddressForm = addressForms === null || addressForms === void 0 ? void 0 : addressForms[1];
|
|
371
|
-
const errorInput = ((_b = shippingAddressForm === null || shippingAddressForm === void 0 ? void 0 : shippingAddressForm.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.has-error')) ||
|
|
372
|
-
((_c = billingAddressForm === null || billingAddressForm === void 0 ? void 0 : billingAddressForm.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.has-error'));
|
|
373
|
-
// scroll to the first error input
|
|
374
|
-
if (errorInput) {
|
|
375
|
-
errorInput.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
376
|
-
}
|
|
377
|
-
this.continueLoading = false;
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
// Submit the translated address to the parent component
|
|
381
|
-
this.continueClicked.emit({
|
|
382
|
-
billingAddress: translatedBillingAddress,
|
|
383
|
-
shippingAddress: translatedShippingAddress,
|
|
384
|
-
});
|
|
385
|
-
};
|
|
386
|
-
/**
|
|
387
|
-
* This function builds a state object for a translated address.
|
|
388
|
-
* It takes the current and translated address as input and returns an object where each field is an object itself.
|
|
389
|
-
* The key of each field's object is the current address's field value and the value is the corresponding translated address's field value.
|
|
390
|
-
*
|
|
391
|
-
* @param {Object} params - The parameters for the function.
|
|
392
|
-
* @param {EnteredInfo} params.currentAddress - The current address information.
|
|
393
|
-
* @param {EnteredInfo} params.translatedAddress - The translated address information.
|
|
394
|
-
*
|
|
395
|
-
*/
|
|
396
|
-
this.buildTranslateAddressState = ({ currentAddress, translatedAddress, }) => {
|
|
397
|
-
const { city, line1, line2, name, postal_code, state } = currentAddress;
|
|
398
|
-
return {
|
|
399
|
-
city: {
|
|
400
|
-
[city]: translatedAddress.city,
|
|
401
|
-
},
|
|
402
|
-
line1: {
|
|
403
|
-
[line1]: translatedAddress.line1,
|
|
404
|
-
},
|
|
405
|
-
line2: {
|
|
406
|
-
[line2]: translatedAddress.line2,
|
|
407
|
-
},
|
|
408
|
-
name: {
|
|
409
|
-
[name]: translatedAddress.name,
|
|
410
|
-
},
|
|
411
|
-
postal_code: {
|
|
412
|
-
[postal_code]: translatedAddress.postal_code,
|
|
413
|
-
},
|
|
414
|
-
state: {
|
|
415
|
-
[state]: translatedAddress.state,
|
|
416
|
-
},
|
|
417
|
-
};
|
|
418
|
-
};
|
|
419
|
-
this.continueLoading = false;
|
|
420
|
-
this.dialogLoading = undefined;
|
|
421
|
-
this.dialogOpen = false;
|
|
422
|
-
this.submitBtnType = undefined;
|
|
423
|
-
this.submitBtnColor = undefined;
|
|
424
|
-
this.isMobile = false;
|
|
425
|
-
this.shippingAddress = undefined;
|
|
426
|
-
this.billingAddress = undefined;
|
|
427
|
-
this.translatedShippingAddress = undefined;
|
|
428
|
-
this.translatedBillingAddress = undefined;
|
|
429
|
-
this.showErrorBanner = false;
|
|
430
|
-
this.translatedShippingAddressState = {};
|
|
431
|
-
this.translatedBillingAddressState = {};
|
|
432
|
-
}
|
|
433
|
-
watchTranslatedShippingAddress() {
|
|
434
|
-
this.translatedShippingAddressState = this.translatedShippingAddress;
|
|
435
|
-
}
|
|
436
|
-
watchTranslatedBillingAddress() {
|
|
437
|
-
this.translatedBillingAddressState = this.translatedBillingAddress;
|
|
438
|
-
}
|
|
439
|
-
componentWillLoad() {
|
|
440
|
-
// update the state with the initial props
|
|
441
|
-
this.watchTranslatedBillingAddress();
|
|
442
|
-
this.watchTranslatedShippingAddress();
|
|
443
|
-
}
|
|
444
|
-
render() {
|
|
445
|
-
// dialog background white, so when the button background is also white, we need to change the button type to outline so it's visible
|
|
446
|
-
const submitBtnColor = this.submitBtnColor || zonosStore.appearance.colorSecondary;
|
|
447
|
-
const submitBtnType = submitBtnColor === '#ffffff'
|
|
448
|
-
? 'outline'
|
|
449
|
-
: this.submitBtnType || 'standard';
|
|
450
|
-
const billing = this.billingAddress;
|
|
451
|
-
const shipping = this.shippingAddress;
|
|
452
|
-
return (h(Host, { key: '655845cef04f4af526b1a1c4e49243c4f2b4c7f6', class: classes([
|
|
453
|
-
'zonos--address-update-dialog zonos--elements',
|
|
454
|
-
this.isMobile && 'mobile',
|
|
455
|
-
]) }, h("zonos-dialog", { key: 'eab429bb78ce6f05ba463d8748d7edd5499402fa', isLoading: this.dialogLoading, mobile: this.isMobile, noBodyPadding: true, noBorder: true, noClickOutside: true, noCloseButton: true, onCloseDialog: () => this.closeUpdateDialog.emit(), open: this.dialogOpen, width: "568px" }, h("div", { key: '08f0400e62addfcaffd91bf5200999d29bbd2da9', class: "zonos--body" }, h("div", { key: '8699df5e2f823e19066fbb552ba2a66c127c05e9', class: "zonos--dialog-header" }, h("div", { key: '92e0ff932dcdb0e5b59ea34b688d1ef8e31bfeb3', class: "zonos--dialog-title" }, h("zonos-text", { key: 'aaac3375526bddb319ce7c8f49bde30da7210264', type: "title" }, translate('Update your address')), h("zonos-button", { key: '66abf7b74045e68e84e631298504236d32ca9c4e', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close checkout dialog", content: RemoveIcon$1 }), noBackground: true, onClick: () => this.closeUpdateDialogHandler() })), h("zonos-text", { key: 'ffb3d8f169867d5f6dff269e1becd99c98c5a7da' }, translate('To ensure delivery all address details must be in Latin characters.'))), h("div", { key: '2cb61f06ce174e2317870decfdd337c67c5cf128', class: "zonos--group" }, h("zonos-text", { key: 'a616c540984120b468e52bccfb380ea3974ced22', class: "zonos--what-you-entered", type: "semiBoldLabel" }, translate('What you entered')), h("div", { key: '6ac8f9c14472370c501af1b0d50bd8f8746b7694', class: "zonos--address-display-group" }, h("zonos-address-display", { key: 'ea2c67a7bba51c99f80be968e448beeffcf1f863', addressType: "shipping", currentAddress: shipping }), billing && (h("zonos-address-display", { key: '7ea1683dc04a292810e04ed6550d86086f25186f', addressType: "billing", currentAddress: billing }))), h("div", { key: '4d1cd9096943518b8b4e267608a5e1542befb6a9', class: "zonos--address-form-section" }, h("zonos-text", { key: 'e4184a2cc618d26d43979fa8cfe06070cf8b5af8', type: "semiBoldLabel" }, translate('Translated address')), h("zonos-address-form", { key: 'c55d9d3c658565ceb7c7b879f444e3937b9f7ad6', addressType: "shipping", class: "zonos--shipping-address-form", currentAddress: shipping, onAddressChange: e => {
|
|
456
|
-
const address = e.detail;
|
|
457
|
-
this.translatedShippingAddressState =
|
|
458
|
-
this.buildTranslateAddressState({
|
|
459
|
-
currentAddress: shipping,
|
|
460
|
-
translatedAddress: address,
|
|
461
|
-
});
|
|
462
|
-
}, translatedAddress: this.translatedShippingAddressState }), billing && (h("zonos-address-form", { key: 'c3facc295b1322bb00baa6081f343dcea4f10777', addressType: "billing", class: "zonos--billing-address-form", currentAddress: billing, onAddressChange: e => {
|
|
463
|
-
const address = e.detail;
|
|
464
|
-
this.translatedBillingAddressState =
|
|
465
|
-
this.buildTranslateAddressState({
|
|
466
|
-
currentAddress: billing,
|
|
467
|
-
translatedAddress: address,
|
|
468
|
-
});
|
|
469
|
-
}, translatedAddress: this.translatedBillingAddressState })))), h("div", { key: '1c89c9604ba0dece40275fcfac97e7f93706b430', class: "zonos--group-btn" }, h("div", { key: 'e47d393940b094b4e123864e4070daa87f0616f0', class: "zonos--button-wrapper" }, h("zonos-button", { key: '216b7afe268a4acd6bb8a76b7f5a32dc09bdd4f6', class: "zonos--cancel-btn", onClick: () => this.closeUpdateDialogHandler(), variant: "subtle" }, translate('Cancel')), h("zonos-button", { key: 'acbacb92cedb325b46843d8f3aff13f4e7c86ab5', backgroundColor: this.submitBtnColor, class: "zonos--update-btn", loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "sm", variant: submitBtnType }, translate('Update address'))))))));
|
|
470
|
-
}
|
|
471
|
-
get el() { return getElement(this); }
|
|
472
|
-
static get watchers() { return {
|
|
473
|
-
"translatedShippingAddress": ["watchTranslatedShippingAddress"],
|
|
474
|
-
"translatedBillingAddress": ["watchTranslatedBillingAddress"]
|
|
475
|
-
}; }
|
|
476
|
-
};
|
|
477
|
-
ZonosAddressUpdateDialog.style = ZonosAddressUpdateDialogStyle0;
|
|
478
|
-
|
|
479
|
-
const colorPrefixes = [
|
|
480
|
-
'blue',
|
|
481
|
-
'cyan',
|
|
482
|
-
'green',
|
|
483
|
-
'orange',
|
|
484
|
-
'purple',
|
|
485
|
-
'red',
|
|
486
|
-
'gray',
|
|
487
|
-
'glass',
|
|
488
|
-
];
|
|
489
|
-
|
|
490
|
-
const zonosCheckboxCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--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;cursor:pointer}:host label{display:-ms-inline-flexbox;display:inline-flex;position:relative;gap:8px;-ms-flex-align:center;align-items:center}:host label.disabled{cursor:not-allowed;opacity:0.6}:host input[type=checkbox]{opacity:0;position:absolute;left:0;width:0;height:0;top:0;z-index:-99999}:host svg{opacity:0}:host .checkmark-container{height:var(--zonos--size);width:var(--zonos--size);background-color:transparent;border:1.5px solid var(--zonos-elements-gray-400);position:relative;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-4))}:host .checkmark{opacity:0;position:absolute;top:-1.5px;left:-1.5px;right:-1.5px;bottom:-1.5px;width:calc(100% + 3px);-webkit-transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);-webkit-transform:scale(0.4);transform:scale(0.4);background-color:var(--zonos--background-color);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-4))}:host input[type=checkbox]:checked~.checkmark-container .checkmark{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";
|
|
491
|
-
const ZonosCheckboxStyle0 = zonosCheckboxCss;
|
|
492
|
-
|
|
493
|
-
const ZonosCheckbox = class {
|
|
494
|
-
constructor(hostRef) {
|
|
495
|
-
registerInstance(this, hostRef);
|
|
496
|
-
this.checkboxSelected = createEvent(this, "checkboxSelected", 7);
|
|
497
|
-
this.backgroundColor = 'blue';
|
|
498
|
-
this.label = undefined;
|
|
499
|
-
this.isChecked = false;
|
|
500
|
-
this.isDisabled = false;
|
|
501
|
-
this.size = 12;
|
|
502
|
-
this.fontSize = 'base';
|
|
503
|
-
this.borderStyle = undefined;
|
|
504
|
-
}
|
|
505
|
-
onClick() {
|
|
506
|
-
if (this.isDisabled) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
this.checkboxSelected.emit(!this.isChecked);
|
|
510
|
-
}
|
|
511
|
-
render() {
|
|
512
|
-
const isBackgroundVariable = colorPrefixes.includes(this.backgroundColor);
|
|
513
|
-
const backgroundColor = isBackgroundVariable
|
|
514
|
-
? `var(--zonos-elements-${this.backgroundColor}-600)`
|
|
515
|
-
: this.backgroundColor;
|
|
516
|
-
const checkmarkColor = isBackgroundVariable
|
|
517
|
-
? // use lighter color if the color is amino variable
|
|
518
|
-
`var(--zonos-elements-${this.backgroundColor}-200)`
|
|
519
|
-
: // if it's not an amino variable, use white if the background is dark, and dark if the background is light
|
|
520
|
-
!isDarkColor(backgroundColor)
|
|
521
|
-
? 'var(--zonos-elements-gray-800)'
|
|
522
|
-
: 'var(--zonos-elements-gray-0)';
|
|
523
|
-
const borderStyle = getBorderRadius({
|
|
524
|
-
customRoundRadius: '4px',
|
|
525
|
-
overrideBorderStyle: this.borderStyle,
|
|
526
|
-
});
|
|
527
|
-
return (h(Host, { key: '7a2972128b04d5dffe09f60b5292d90f7201066a', class: classes(['zonos--elements zonos--checkbox']), style: {
|
|
528
|
-
'--zonos--background-color': backgroundColor,
|
|
529
|
-
'--zonos--border-radius': borderStyle,
|
|
530
|
-
'--zonos--font-family': zonosStoreFontFamily(),
|
|
531
|
-
'--zonos--size': `${this.size}px`,
|
|
532
|
-
} }, h("label", { key: 'b18d0f091b783555b4b3a1fc2b5d5cb1c62a9d41', class: classes([this.isDisabled && 'disabled']) }, h("input", { key: 'f3b86525ef7988d6df87f9147f5aa22b447c1303', checked: this.isChecked, disabled: this.isDisabled, hidden: true, onChange: e => {
|
|
533
|
-
this.checkboxSelected.emit(e.target.checked);
|
|
534
|
-
}, type: "checkbox" }), h("span", { key: '2007c2fbc4d8437f75b9a3d7a4e65d394922abf4', class: "checkmark-container" }, h("svg", { key: '481b9272c99cf464d8d88ab24a8dba35de921abf', class: "checkmark", color: checkmarkColor, fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'ab7690fba113135175248c8926907312dfe478d5', "clip-rule": "evenodd", d: "M17.456 7.404a.75.75 0 0 1 .14 1.052l-6.5 8.5a.75.75 0 0 1-1.126.074l-4-4a.75.75 0 0 1 1.06-1.06l3.395 3.394 5.98-7.82a.75.75 0 0 1 1.05-.14Z", fill: "currentColor", "fill-rule": "evenodd" }))), this.label && (h("zonos-text", { key: '99689099e7469f2ff928619daa2fcee0ce35a418', size: this.fontSize }, this.label)))));
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
|
-
ZonosCheckbox.style = ZonosCheckboxStyle0;
|
|
538
|
-
|
|
539
|
-
const RemoveIcon = `<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>`;
|
|
540
|
-
|
|
541
|
-
const zonosDialogCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--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 .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:2147483009;background:var(--zonos-elements-gray-0);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:2147483008;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;min-height:var(--zonos--min-height, auto);height:var(--zonos--height, auto);width:var(--zonos--width, auto);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:16px 24px}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--zonos-elements-radius-10);-ms-flex-item-align:start;align-self:flex-start}:host .zonos--header .zonos--close-button:hover{background:var(--zonos-elements-hover-color)}:host .zonos--body{padding:8px 24px;max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:16px 24px}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483008;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:2147483009;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";
|
|
542
|
-
const ZonosDialogStyle0 = zonosDialogCss;
|
|
543
|
-
|
|
544
|
-
const ZonosDialog = class {
|
|
545
|
-
constructor(hostRef) {
|
|
546
|
-
registerInstance(this, hostRef);
|
|
547
|
-
this.closeDialog = createEvent(this, "closeDialog", 3);
|
|
548
|
-
this.isMobileMode = () => {
|
|
549
|
-
return this.mobile || window.innerWidth <= 768;
|
|
550
|
-
};
|
|
551
|
-
this.closeButtonHandler = () => {
|
|
552
|
-
// Only do the action if the dialog is open
|
|
553
|
-
if (!this.open) {
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
this.closeDialog.emit();
|
|
557
|
-
};
|
|
558
|
-
this.clickOutsideDialogHandler = (event) => {
|
|
559
|
-
if (event.target === event.currentTarget && !this.noClickOutside) {
|
|
560
|
-
this.closeDialog.emit();
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
this.open = false;
|
|
564
|
-
this.headerText = '';
|
|
565
|
-
this.width = '460px';
|
|
566
|
-
this.height = undefined;
|
|
567
|
-
this.minHeight = undefined;
|
|
568
|
-
this.noHeader = false;
|
|
569
|
-
this.noBodyPadding = false;
|
|
570
|
-
this.noBorder = false;
|
|
571
|
-
this.borderStyle = undefined;
|
|
572
|
-
this.noCloseButton = false;
|
|
573
|
-
this.noClickOutside = false;
|
|
574
|
-
this.mobile = false;
|
|
575
|
-
this.isLoading = true;
|
|
576
|
-
this.isMobile = false;
|
|
577
|
-
}
|
|
578
|
-
handleWindowResize() {
|
|
579
|
-
this.isMobile = this.isMobileMode();
|
|
580
|
-
}
|
|
581
|
-
handleKeyDown(ev) {
|
|
582
|
-
if (ev.key === 'Escape') {
|
|
583
|
-
this.closeButtonHandler();
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
componentDidLoad() {
|
|
587
|
-
this.isMobile = this.isMobileMode();
|
|
588
|
-
}
|
|
589
|
-
render() {
|
|
590
|
-
const borderStyle = getBorderRadius({
|
|
591
|
-
overrideBorderStyle: this.borderStyle,
|
|
592
|
-
});
|
|
593
|
-
return (h(Host, { key: 'a9932187bccf8e7fa505c7e07175d03541d66852', class: classes([
|
|
594
|
-
'zonos--elements',
|
|
595
|
-
this.open && 'open',
|
|
596
|
-
this.isLoading && 'is-loading',
|
|
597
|
-
this.noBorder && 'no-border',
|
|
598
|
-
this.isMobile && 'mobile',
|
|
599
|
-
]), style: {
|
|
600
|
-
'--zonos--border-radius': borderStyle,
|
|
601
|
-
'--zonos--font-family': zonosStoreFontFamily(),
|
|
602
|
-
'--zonos--height': this.height || 'initial',
|
|
603
|
-
'--zonos--min-height': this.minHeight || '500px',
|
|
604
|
-
'--zonos--width': this.width,
|
|
605
|
-
} }, h("div", { key: '0298cf365a50e3544656a6d27ae59e922b9e3aed', class: "zonos--backdrop" }), h("div", { key: '9fce580a07147d51f17c898a22204c3d9ce6ac7b', class: "zonos--dialog-layout", inert: !this.open, onClick: this.clickOutsideDialogHandler }, h("div", { key: 'b168439cd985cc5c0166a653db206688504cf7dd', class: "zonos--dialog" }, this.isLoading && (h("div", { key: 'e0b6215f3c7bc939721669069bc294e08558d8b5', class: "zonos--loading" }, h("zonos-spinner", { key: '687bcd6d2695933de828484c34aff1230bf71d49', size: 30 }))), (this.headerText || !this.noCloseButton) && (h("div", { key: '04a57a4add896e3d96faca8b77321bba5f00b889', class: "zonos--header" }, this.headerText && (h("h3", { key: 'd084cb3aedcb7e5bb8fd82012b57f441d7dce4a2', class: "zonos--header-text" }, this.headerText)), !this.noCloseButton && (h("zonos-button", { key: '7b73bd57b8651fd3f3ebd29e3c252bd83d9375ee', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close dialog", content: RemoveIcon }), noBackground: true, onClick: this.closeButtonHandler, variant: "subtle" })))), h("div", { key: '7af04c281b6410b87bfe53913e74fa215f6de24b', class: classes([
|
|
606
|
-
'zonos--body',
|
|
607
|
-
this.noBodyPadding && 'zonos--no-body-padding',
|
|
608
|
-
]) }, h("slot", { key: '8c6ce4437d2bc98f9eccea0280cee31794883b77' })), h("slot", { key: '11f97e705b3cc1bad11c037ede940d2f392d67e7', name: "dialog-footer" })))));
|
|
609
|
-
}
|
|
610
|
-
static get assetsDirs() { return ["assets"]; }
|
|
611
|
-
};
|
|
612
|
-
ZonosDialog.style = ZonosDialogStyle0;
|
|
613
|
-
|
|
614
|
-
const validateEmailValue = (value) => {
|
|
615
|
-
const emailRegex = /^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/;
|
|
616
|
-
return emailRegex.test(value);
|
|
617
|
-
};
|
|
618
|
-
|
|
619
|
-
const zonosLinkAuthenticationCss = ".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";
|
|
620
|
-
const ZonosLinkAuthenticationStyle0 = zonosLinkAuthenticationCss;
|
|
621
|
-
|
|
622
|
-
const ZonosLinkAuthentication = class {
|
|
623
|
-
constructor(hostRef) {
|
|
624
|
-
registerInstance(this, hostRef);
|
|
625
|
-
this.linkAuthenticationChange = createEvent(this, "linkAuthenticationChange", 7);
|
|
626
|
-
this.setCustomEmailInputToLinkEvent = (emailValue) => {
|
|
627
|
-
// check if the email is valid
|
|
628
|
-
const isValid = validateEmailValue(emailValue);
|
|
629
|
-
const simulateLinkEvent = {
|
|
630
|
-
complete: !!isValid,
|
|
631
|
-
elementType: 'linkAuthentication',
|
|
632
|
-
empty: !emailValue,
|
|
633
|
-
value: {
|
|
634
|
-
email: emailValue,
|
|
635
|
-
},
|
|
636
|
-
};
|
|
637
|
-
stripeStore.stripeLinkEventData = simulateLinkEvent;
|
|
638
|
-
};
|
|
639
|
-
this.handleNormalEmailInput = (event) => {
|
|
640
|
-
var _a;
|
|
641
|
-
const inputValue = event.detail;
|
|
642
|
-
this.setCustomEmailInputToLinkEvent(inputValue);
|
|
643
|
-
(_a = this.linkAuthenticationChange) === null || _a === void 0 ? void 0 : _a.emit();
|
|
644
|
-
};
|
|
645
|
-
this.titleText = undefined;
|
|
646
|
-
this.defaultEmail = null;
|
|
647
|
-
this.isEmailError = false;
|
|
648
|
-
this.stripe = stripeStore.stripe;
|
|
649
|
-
this.isStagingMode = cartStore.isStagingMode;
|
|
650
|
-
this.clientSecret = stripeStore.clientSecret;
|
|
651
|
-
}
|
|
652
|
-
watchIsStagingMode() {
|
|
653
|
-
// Wait for the DOM to be ready before re-initializing Link element
|
|
654
|
-
setTimeout(() => {
|
|
655
|
-
this.watchInitStripe();
|
|
656
|
-
}, 0);
|
|
657
|
-
}
|
|
658
|
-
watchInitStripe() {
|
|
659
|
-
if (!this.stripe || !stripeStore.stripeElements) {
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
// No need to initialize link if this is staging mode since we will render the email input field
|
|
663
|
-
if (cartStore.isStagingMode || !this.clientSecret) {
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
const defaultValues = this.defaultEmail
|
|
667
|
-
? {
|
|
668
|
-
email: this.defaultEmail,
|
|
669
|
-
}
|
|
670
|
-
: undefined;
|
|
671
|
-
// Create and mount the Authentication Element in ${type} mode
|
|
672
|
-
const linkAuthenticationElement = stripeStore.stripeLinkElement ||
|
|
673
|
-
stripeStore.stripeElements.create('linkAuthentication', {
|
|
674
|
-
defaultValues: defaultValues,
|
|
675
|
-
});
|
|
676
|
-
const linkAuthenticationElementContainer = this.el.querySelector('.zonos--link-authentication-component');
|
|
677
|
-
if (!linkAuthenticationElementContainer) {
|
|
678
|
-
logError('Cannot find container element for linkAuthenticationElement');
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
linkAuthenticationElement.mount(linkAuthenticationElementContainer);
|
|
682
|
-
linkAuthenticationElement.on('change', event => {
|
|
683
|
-
var _a;
|
|
684
|
-
stripeStore.stripeLinkEventData = event;
|
|
685
|
-
(_a = this.linkAuthenticationChange) === null || _a === void 0 ? void 0 : _a.emit();
|
|
686
|
-
});
|
|
687
|
-
stripeStore.stripeLinkElement = linkAuthenticationElement;
|
|
688
|
-
}
|
|
689
|
-
watchDefaultEmail(newDefaultEmail, oldDefaultEmail) {
|
|
690
|
-
var _a, _b;
|
|
691
|
-
log('Default email is changed', 'info', {
|
|
692
|
-
newDefaultEmail,
|
|
693
|
-
oldDefaultEmail,
|
|
694
|
-
});
|
|
695
|
-
if (oldDefaultEmail === newDefaultEmail) {
|
|
696
|
-
return;
|
|
697
|
-
}
|
|
698
|
-
if (!newDefaultEmail) {
|
|
699
|
-
stripeStore.stripeLinkEventData = null;
|
|
700
|
-
}
|
|
701
|
-
// Only set value for Stripe input input to stripeLinkEventData when checkout is in staging mode
|
|
702
|
-
if (cartStore.isStagingMode) {
|
|
703
|
-
this.setCustomEmailInputToLinkEvent(newDefaultEmail || '');
|
|
704
|
-
return;
|
|
705
|
-
}
|
|
706
|
-
(_a = stripeStore.stripeLinkElement) === null || _a === void 0 ? void 0 : _a.clear();
|
|
707
|
-
(_b = stripeStore.stripeLinkElement) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
708
|
-
stripeStore.stripeLinkElement = null;
|
|
709
|
-
stripeStore.stripeLinkEventData = null;
|
|
710
|
-
log('Reset stripe link element when default email is changed', 'info', {
|
|
711
|
-
defaultEmail: newDefaultEmail,
|
|
712
|
-
});
|
|
713
|
-
setTimeout(() => {
|
|
714
|
-
void this.watchInitStripe();
|
|
715
|
-
}, 5);
|
|
716
|
-
}
|
|
717
|
-
componentDidLoad() {
|
|
718
|
-
// @Watch doesn't get trigger on initial load
|
|
719
|
-
this.watchInitStripe();
|
|
720
|
-
if (!this.defaultEmail) {
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
// set default email value to stripeLinkEventData if default email is provided
|
|
724
|
-
this.setCustomEmailInputToLinkEvent(this.defaultEmail);
|
|
725
|
-
}
|
|
726
|
-
render() {
|
|
727
|
-
this.isStagingMode = cartStore.isStagingMode;
|
|
728
|
-
this.clientSecret = stripeStore.clientSecret;
|
|
729
|
-
const renderEmailAddress = () => {
|
|
730
|
-
var _a;
|
|
731
|
-
if (cartStore.isStagingMode) {
|
|
732
|
-
return (h("zonos-stripe-input", { inputLabel: translate('Email'), inputValue: this.defaultEmail ||
|
|
733
|
-
((_a = stripeStore.stripeLinkEventData) === null || _a === void 0 ? void 0 : _a.value.email) ||
|
|
734
|
-
'', isError: this.isEmailError, onBlur: () => {
|
|
735
|
-
var _a;
|
|
736
|
-
const emailValue = ((_a = stripeStore.stripeLinkEventData) === null || _a === void 0 ? void 0 : _a.value.email) || '';
|
|
737
|
-
if (!emailValue) {
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
// check if the email is valid
|
|
741
|
-
const isValid = validateEmailValue(emailValue);
|
|
742
|
-
this.isEmailError = !isValid;
|
|
743
|
-
}, onInputChange: this.handleNormalEmailInput }));
|
|
744
|
-
}
|
|
745
|
-
return (h("div", { class: `zonos--link-authentication-component ${this.isEmailError && 'zonos--input-invalid'}` }));
|
|
746
|
-
};
|
|
747
|
-
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
748
|
-
return (h(Host, { class: "zonos--link-authentication zonos--elements", style: {
|
|
749
|
-
'--zonos--border-radius': getBorderRadius(),
|
|
750
|
-
} }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, this.titleText), renderEmailAddress(), this.isEmailError && (h("zonos-text", { textColor: "red-600" }, translate('Please enter a valid email address.')))));
|
|
751
|
-
}
|
|
752
|
-
get el() { return getElement(this); }
|
|
753
|
-
static get watchers() { return {
|
|
754
|
-
"isStagingMode": ["watchIsStagingMode"],
|
|
755
|
-
"stripe": ["watchInitStripe"],
|
|
756
|
-
"clientSecret": ["watchInitStripe"],
|
|
757
|
-
"defaultEmail": ["watchDefaultEmail"]
|
|
758
|
-
}; }
|
|
759
|
-
};
|
|
760
|
-
ZonosLinkAuthentication.style = ZonosLinkAuthenticationStyle0;
|
|
761
|
-
|
|
762
|
-
export { ZonosAddress as zonos_address, ZonosAddressDisplay as zonos_address_display, ZonosAddressForm as zonos_address_form, ZonosAddressUpdateDialog as zonos_address_update_dialog, ZonosCheckbox as zonos_checkbox, ZonosDialog as zonos_dialog, ZonosLinkAuthentication as zonos_link_authentication };
|