@zonos/elements 1.3.233 → 1.3.235
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-bc615014.js → cart-22ced7cc.js} +33 -29
- package/dist/cjs/{shouldRenderTaxIdInput-9b8a8de1.js → containsNonLatinChars-2be5129b.js} +0 -23
- package/dist/cjs/{hasInclusivePrice-84145546.js → hasInclusivePrice-ca85cabd.js} +1 -1
- package/dist/cjs/index.cjs.js +11 -7
- package/dist/cjs/invoice-8fd4242c.js +151 -0
- package/dist/cjs/{renderFallback-c2576fbe.js → isCollectMobileTablet-7962c57f.js} +2 -11
- package/dist/cjs/isInvoiceMobileTablet-dde41e4e.js +15 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{translationStore-08d3ff9c.js → localization-8ef6250a.js} +1059 -1
- package/dist/cjs/{paypal-1d6f1a71.js → paypal-4a086f84.js} +7 -8
- package/dist/cjs/placeTestOrder-f25d08ee.js +45 -0
- package/dist/cjs/{placeTestOrder-a5469e40.js → renderCheckoutCurrency-5494e45b.js} +2 -42
- package/dist/cjs/renderFallback-78b54537.js +12 -0
- package/dist/cjs/shouldRenderTaxIdInput-eda13ef8.js +25 -0
- package/dist/cjs/throttle-7dd64984.js +76 -0
- package/dist/cjs/{zonos-address_11.cjs.entry.js → zonos-address-display_9.cjs.entry.js} +62 -668
- package/dist/cjs/zonos-address_4.cjs.entry.js +715 -0
- package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
- package/dist/cjs/{zonos-banner_2.cjs.entry.js → zonos-banner.cjs.entry.js} +0 -40
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/{zonos-empty-state-payment_4.cjs.entry.js → zonos-card_5.cjs.entry.js} +44 -6
- package/dist/cjs/{zonos-cart-items_13.cjs.entry.js → zonos-cart-items_12.cjs.entry.js} +75 -92
- package/dist/cjs/zonos-checkout.cjs.entry.js +20 -21
- package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +5 -6
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +66 -65
- package/dist/cjs/zonos-collect.cjs.entry.js +25 -25
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +39 -10
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +10 -11
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +30 -31
- package/dist/cjs/zonos-hello.cjs.entry.js +7 -8
- package/dist/cjs/zonos-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +94 -0
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +686 -0
- package/dist/cjs/zonos-invoice.cjs.entry.js +468 -0
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -6
- package/dist/cjs/zonos-link.cjs.entry.js +24 -0
- package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +5 -5
- package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
- package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +8 -0
- package/dist/collection/components/checkout/zonos-invoice/assets/ChevronDownIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/assets/empty-item.jpeg +0 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.css +72 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.js +87 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/assets/RemoveIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/assets/SuccessIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.css +90 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +405 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/chevronDownIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/globe.svg +3 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosIconDark.svg +10 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosIconLight.svg +10 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosWordmark.svg +7 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.css +155 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.js +165 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/assets/ChevronDownIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/assets/ChevronUpIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.css +117 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.js +175 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/assets/CheckmarkLineIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/assets/RemoveLineIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.css +98 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +368 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.css +71 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.js +151 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.css +83 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.js +65 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.css +350 -0
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.js +547 -0
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
- package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
- package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
- package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +3 -3
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +2 -2
- package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
- package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
- package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
- package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +1 -1
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
- package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
- package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +1 -1
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +5 -5
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
- package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
- 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 +45 -4
- package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
- package/dist/collection/components/store/checkout/invoice.js +148 -0
- package/dist/collection/components/store/checkout/stripe.js +8 -3
- package/dist/collection/components/store/translationStore/strings.arabic.js +9 -0
- package/dist/collection/components/store/translationStore/strings.base.js +9 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +9 -0
- package/dist/collection/components/store/translationStore/strings.french.js +9 -0
- package/dist/collection/components/store/translationStore/strings.german.js +9 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +9 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +9 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +9 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +8 -5
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
- package/dist/collection/components/utils/checkout/initInvoice.js +15 -0
- package/dist/collection/components/utils/checkout/isInvoiceMobileTablet.js +10 -0
- package/dist/collection/scripts/_zonosBase.js +4 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +4 -0
- package/dist/collection/types/generated/graphql.internal.types.js +239 -5
- package/dist/esm/{cart-14f305b3.js → cart-66aecbb3.js} +9 -5
- package/dist/esm/{shouldRenderTaxIdInput-8bc112bb.js → containsNonLatinChars-2d8810c3.js} +1 -23
- package/dist/esm/{hasInclusivePrice-0eda8ba9.js → hasInclusivePrice-2a1bf474.js} +1 -1
- package/dist/esm/index.js +11 -7
- package/dist/esm/invoice-c7452847.js +146 -0
- package/dist/esm/{renderFallback-dbf1e3ae.js → isCollectMobileTablet-921002b0.js} +3 -11
- package/dist/esm/isInvoiceMobileTablet-1f7b614e.js +12 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{translationStore-690c4e04.js → localization-04b05867.js} +1041 -2
- package/dist/esm/{paypal-fded8844.js → paypal-56564874.js} +2 -3
- package/dist/esm/placeTestOrder-6b9eda9e.js +43 -0
- package/dist/esm/{placeTestOrder-2250f719.js → renderCheckoutCurrency-cb808110.js} +3 -42
- package/dist/esm/renderFallback-3f010b48.js +10 -0
- package/dist/esm/shouldRenderTaxIdInput-d45ceeb4.js +23 -0
- package/dist/esm/throttle-ce2432ab.js +74 -0
- package/dist/esm/{zonos-address_11.entry.js → zonos-address-display_9.entry.js} +32 -636
- package/dist/esm/zonos-address_4.entry.js +708 -0
- package/dist/esm/zonos-badge.entry.js +3 -3
- package/dist/esm/{zonos-banner_2.entry.js → zonos-banner.entry.js} +1 -40
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/{zonos-empty-state-payment_4.entry.js → zonos-card_5.entry.js} +44 -7
- package/dist/esm/{zonos-cart-items_13.entry.js → zonos-cart-items_12.entry.js} +15 -31
- package/dist/esm/zonos-checkout.entry.js +3 -4
- package/dist/esm/zonos-collapse.entry.js +2 -2
- package/dist/esm/zonos-collect-cart-items_3.entry.js +5 -6
- package/dist/esm/zonos-collect-finish_6.entry.js +7 -6
- package/dist/esm/zonos-collect.entry.js +5 -5
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +39 -10
- package/dist/esm/zonos-country-flag.entry.js +1 -2
- package/dist/esm/zonos-country-select_4.entry.js +10 -11
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +6 -7
- package/dist/esm/zonos-hello.entry.js +1 -2
- package/dist/esm/zonos-input.entry.js +4 -4
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +89 -0
- package/dist/esm/zonos-invoice-finish_5.entry.js +678 -0
- package/dist/esm/zonos-invoice.entry.js +464 -0
- package/dist/esm/zonos-language-select_2.entry.js +5 -6
- package/dist/esm/zonos-link.entry.js +20 -0
- package/dist/esm/zonos-logo.entry.js +2 -2
- package/dist/esm/zonos-stripe-input.entry.js +5 -5
- package/dist/esm/zonos-toggle.entry.js +2 -2
- package/dist/esm/zonos-tooltip.entry.js +2 -2
- package/dist/esm/zonos-v-stack.entry.js +2 -2
- package/dist/esm-es5/cart-66aecbb3.js +1 -0
- package/dist/esm-es5/containsNonLatinChars-2d8810c3.js +1 -0
- package/dist/esm-es5/{hasInclusivePrice-0eda8ba9.js → hasInclusivePrice-2a1bf474.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/invoice-c7452847.js +1 -0
- package/dist/esm-es5/isCollectMobileTablet-921002b0.js +1 -0
- package/dist/esm-es5/isInvoiceMobileTablet-1f7b614e.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/localization-04b05867.js +1 -0
- package/dist/esm-es5/{paypal-fded8844.js → paypal-56564874.js} +1 -1
- package/dist/esm-es5/placeTestOrder-6b9eda9e.js +1 -0
- package/dist/esm-es5/renderCheckoutCurrency-cb808110.js +1 -0
- package/dist/esm-es5/renderFallback-3f010b48.js +1 -0
- package/dist/esm-es5/shouldRenderTaxIdInput-d45ceeb4.js +1 -0
- package/dist/esm-es5/throttle-ce2432ab.js +1 -0
- package/dist/esm-es5/zonos-address-display_9.entry.js +1 -0
- package/dist/esm-es5/zonos-address_4.entry.js +1 -0
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -0
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -0
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -0
- 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-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.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-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-invoice-cart-items_2.entry.js +1 -0
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -0
- package/dist/esm-es5/zonos-invoice.entry.js +1 -0
- package/dist/esm-es5/zonos-language-select_2.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-stripe-input.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/scripts/index.d.ts +356 -0
- 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-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.d.ts +10 -0
- package/dist/types/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.d.ts +50 -0
- package/dist/types/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.d.ts +25 -0
- package/dist/types/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.d.ts +28 -0
- package/dist/types/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.d.ts +62 -0
- package/dist/types/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.d.ts +22 -0
- package/dist/types/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.d.ts +7 -0
- package/dist/types/components/checkout/zonos-invoice/zonos-invoice.d.ts +86 -0
- package/dist/types/components/main/zonos-controller.d.ts +4 -0
- package/dist/types/components/store/checkout/invoice.d.ts +19 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +9 -0
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components/utils/checkout/initInvoice.d.ts +1 -0
- package/dist/types/components/utils/checkout/isInvoiceMobileTablet.d.ts +4 -0
- package/dist/types/components.d.ts +351 -0
- package/dist/types/scripts/_zonosBase.d.ts +5 -0
- package/dist/types/types/checkout/api/CheckoutSession.d.ts +4 -0
- package/dist/types/types/checkout/api/PartyInfo.d.ts +21 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +5 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +5 -1
- package/dist/types/types/generated/graphql.internal.types.d.ts +285 -8
- package/dist/types/types/generated/graphql.internal.types.ts +367 -10
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-00719e49.entry.js +1 -0
- package/dist/zonos-elements/p-01b0a2e2.js +1 -0
- package/dist/zonos-elements/p-01dada4e.js +1 -0
- package/dist/zonos-elements/p-0c64dbbb.js +1 -0
- package/dist/zonos-elements/p-0cd5bcb3.entry.js +1 -0
- package/dist/zonos-elements/p-0e82fcea.entry.js +1 -0
- package/dist/zonos-elements/p-10316d4d.system.entry.js +1 -0
- package/dist/zonos-elements/{p-0a90dd80.system.entry.js → p-121c60c1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-bf9d889f.entry.js → p-14314ad3.entry.js} +1 -1
- package/dist/zonos-elements/p-170314a3.js +1 -0
- package/dist/zonos-elements/p-17a09191.entry.js +1 -0
- package/dist/zonos-elements/p-18bc6c7a.entry.js +1 -0
- package/dist/zonos-elements/{p-a25428eb.system.js → p-18d20206.system.js} +2 -2
- package/dist/zonos-elements/p-1a30fe18.system.entry.js +1 -0
- package/dist/zonos-elements/{p-c7b658cb.entry.js → p-1c4d12f0.entry.js} +1 -1
- package/dist/zonos-elements/p-1f3549c6.js +1 -0
- package/dist/zonos-elements/p-2250e585.entry.js +1 -0
- package/dist/zonos-elements/p-248dd596.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5f398c28.entry.js → p-264690d7.entry.js} +1 -1
- package/dist/zonos-elements/p-2670438c.system.js +1 -0
- package/dist/zonos-elements/p-27f6930b.js +1 -0
- package/dist/zonos-elements/{p-eea0eb57.system.entry.js → p-2f869f2c.system.entry.js} +1 -1
- package/dist/zonos-elements/p-30c661b3.system.entry.js +1 -0
- package/dist/zonos-elements/p-34bf7bbe.system.js +1 -0
- package/dist/zonos-elements/p-38913b2f.entry.js +1 -0
- package/dist/zonos-elements/p-3bec13dd.system.js +1 -0
- package/dist/zonos-elements/{p-00ec22b2.entry.js → p-43a22d85.entry.js} +1 -1
- package/dist/zonos-elements/p-44b50260.entry.js +1 -0
- package/dist/zonos-elements/p-48dc96f9.system.entry.js +1 -0
- package/dist/zonos-elements/p-4aa86184.system.entry.js +1 -0
- package/dist/zonos-elements/p-4d594c8e.system.js +1 -0
- package/dist/zonos-elements/p-4ffbb0d6.system.js +1 -0
- package/dist/zonos-elements/{p-452fb638.system.entry.js → p-5062dcf3.system.entry.js} +1 -1
- package/dist/zonos-elements/p-50f31c12.system.entry.js +1 -0
- package/dist/zonos-elements/{p-c5cb2364.system.entry.js → p-57cee1b5.system.entry.js} +1 -1
- package/dist/zonos-elements/p-59a76f73.entry.js +1 -0
- package/dist/zonos-elements/{p-d556c6d1.system.entry.js → p-5afb9260.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-88ea9f82.entry.js → p-6626d240.entry.js} +1 -1
- package/dist/zonos-elements/p-6688473e.entry.js +1 -0
- package/dist/zonos-elements/p-6f23a26a.system.js +1 -0
- package/dist/zonos-elements/{p-82739127.js → p-73c737aa.js} +2 -2
- package/dist/zonos-elements/p-757d4c62.system.entry.js +1 -0
- package/dist/zonos-elements/p-7aa50ef2.entry.js +1 -0
- package/dist/zonos-elements/p-7e17667d.js +1 -0
- package/dist/zonos-elements/p-7e469c5c.entry.js +1 -0
- package/dist/zonos-elements/p-7f91617c.system.entry.js +1 -0
- package/dist/zonos-elements/p-81e3eb5b.js +1 -0
- package/dist/zonos-elements/p-82febf70.system.js +1 -0
- package/dist/zonos-elements/{p-770852bf.system.entry.js → p-836db369.system.entry.js} +1 -1
- package/dist/zonos-elements/p-83b3f824.system.entry.js +1 -0
- package/dist/zonos-elements/p-851011aa.system.entry.js +1 -0
- package/dist/zonos-elements/{p-936b54c1.entry.js → p-865536f0.entry.js} +1 -1
- package/dist/zonos-elements/{p-b1fd1ec2.system.entry.js → p-8792fef2.system.entry.js} +1 -1
- package/dist/zonos-elements/p-890bfc42.system.entry.js +1 -0
- package/dist/zonos-elements/{p-c288c6da.system.entry.js → p-89a5e936.system.entry.js} +1 -1
- package/dist/zonos-elements/p-8af188f8.system.js +1 -0
- package/dist/zonos-elements/p-8d3a62fb.entry.js +1 -0
- package/dist/zonos-elements/{p-00ac999f.system.entry.js → p-8dc025c7.system.entry.js} +1 -1
- package/dist/zonos-elements/p-944d00da.entry.js +1 -0
- package/dist/zonos-elements/p-9479f155.system.js +1 -0
- package/dist/zonos-elements/p-95dc475b.system.js +1 -0
- package/dist/zonos-elements/p-976afc17.system.js +1 -0
- package/dist/zonos-elements/p-9b9bfb6d.entry.js +1 -0
- package/dist/zonos-elements/{p-55e2e4ed.entry.js → p-9f1bd9b8.entry.js} +1 -1
- package/dist/zonos-elements/p-9fa32fdf.js +1 -0
- package/dist/zonos-elements/p-a2a0bf4e.js +1 -0
- package/dist/zonos-elements/p-a610c24e.system.entry.js +1 -0
- package/dist/zonos-elements/{p-9b8750f3.entry.js → p-aedd3911.entry.js} +1 -1
- package/dist/zonos-elements/{p-db628e49.system.entry.js → p-b5c31ca4.system.entry.js} +1 -1
- package/dist/zonos-elements/p-ba456282.system.entry.js +1 -0
- package/dist/zonos-elements/{p-31af91f0.entry.js → p-bd603c1a.entry.js} +1 -1
- package/dist/zonos-elements/p-c2442878.system.js +1 -1
- package/dist/zonos-elements/p-c8cc20d9.system.js +1 -0
- package/dist/zonos-elements/p-dc5fb21c.js +1 -0
- package/dist/zonos-elements/p-dc94d7eb.js +1 -0
- package/dist/zonos-elements/{p-540cec7e.system.entry.js → p-e9e6bea7.system.entry.js} +1 -1
- package/dist/zonos-elements/p-eb9ee025.system.js +1 -0
- package/dist/zonos-elements/p-ed8ae947.system.entry.js +1 -0
- package/dist/zonos-elements/p-f1d4d6da.entry.js +1 -0
- package/dist/zonos-elements/p-f1d9dd4e.entry.js +1 -0
- package/dist/zonos-elements/p-f3962950.system.entry.js +1 -0
- package/dist/zonos-elements/p-f4e976ae.entry.js +1 -0
- package/dist/zonos-elements/p-f513b231.entry.js +1 -0
- package/dist/zonos-elements/p-f64207fa.system.entry.js +1 -0
- package/dist/zonos-elements/{p-31975752.entry.js → p-fa322dc1.entry.js} +1 -1
- package/dist/zonos-elements/p-fb9fb873.system.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/localization-39516612.js +0 -884
- package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +0 -168
- package/dist/esm/localization-c5029ffc.js +0 -863
- package/dist/esm/zonos-confirm-dialog_2.entry.js +0 -163
- package/dist/esm-es5/cart-14f305b3.js +0 -1
- package/dist/esm-es5/localization-c5029ffc.js +0 -1
- package/dist/esm-es5/placeTestOrder-2250f719.js +0 -1
- package/dist/esm-es5/renderFallback-dbf1e3ae.js +0 -1
- package/dist/esm-es5/shouldRenderTaxIdInput-8bc112bb.js +0 -1
- package/dist/esm-es5/translationStore-690c4e04.js +0 -1
- package/dist/esm-es5/zonos-address_11.entry.js +0 -1
- package/dist/esm-es5/zonos-banner_2.entry.js +0 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +0 -1
- package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +0 -1
- package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +0 -1
- package/dist/zonos-elements/p-03ff7b01.system.entry.js +0 -1
- package/dist/zonos-elements/p-100f6a88.system.entry.js +0 -1
- package/dist/zonos-elements/p-143d706b.entry.js +0 -1
- package/dist/zonos-elements/p-14d7489d.js +0 -1
- package/dist/zonos-elements/p-1bfae137.entry.js +0 -1
- package/dist/zonos-elements/p-1d5aa016.system.js +0 -1
- package/dist/zonos-elements/p-1eae4987.entry.js +0 -1
- package/dist/zonos-elements/p-23b45714.system.entry.js +0 -1
- package/dist/zonos-elements/p-2557b96b.js +0 -1
- package/dist/zonos-elements/p-2ca8b037.entry.js +0 -1
- package/dist/zonos-elements/p-2dbcecf4.entry.js +0 -1
- package/dist/zonos-elements/p-316f9052.system.entry.js +0 -1
- package/dist/zonos-elements/p-3185968f.entry.js +0 -1
- package/dist/zonos-elements/p-4e41143a.system.entry.js +0 -1
- package/dist/zonos-elements/p-52b87408.system.entry.js +0 -1
- package/dist/zonos-elements/p-561be3a2.system.js +0 -1
- package/dist/zonos-elements/p-5c680f72.js +0 -1
- package/dist/zonos-elements/p-5f77d19e.js +0 -1
- package/dist/zonos-elements/p-74ca7739.entry.js +0 -1
- package/dist/zonos-elements/p-767a31a8.system.js +0 -1
- package/dist/zonos-elements/p-78a6e775.system.js +0 -1
- package/dist/zonos-elements/p-7c705c76.system.js +0 -1
- package/dist/zonos-elements/p-81ba2820.system.entry.js +0 -1
- package/dist/zonos-elements/p-84078c57.system.js +0 -1
- package/dist/zonos-elements/p-8a23bbf5.js +0 -1
- package/dist/zonos-elements/p-905d2490.entry.js +0 -1
- package/dist/zonos-elements/p-93f2e1ee.system.entry.js +0 -1
- package/dist/zonos-elements/p-a0a4e43d.system.entry.js +0 -1
- package/dist/zonos-elements/p-a2819807.system.entry.js +0 -1
- package/dist/zonos-elements/p-a6e74856.entry.js +0 -1
- package/dist/zonos-elements/p-ae940a99.js +0 -1
- package/dist/zonos-elements/p-b7ea5f4f.system.entry.js +0 -1
- package/dist/zonos-elements/p-c0c458f7.system.entry.js +0 -1
- package/dist/zonos-elements/p-c1ecab92.entry.js +0 -1
- package/dist/zonos-elements/p-c50cc926.entry.js +0 -1
- package/dist/zonos-elements/p-cf765af3.system.js +0 -1
- package/dist/zonos-elements/p-e03e1a62.entry.js +0 -1
- package/dist/zonos-elements/p-e7874318.system.entry.js +0 -1
- package/dist/zonos-elements/p-e8949e7e.entry.js +0 -1
- package/dist/zonos-elements/p-ea0b5d10.system.js +0 -1
- package/dist/zonos-elements/p-eae3462c.entry.js +0 -1
- package/dist/zonos-elements/p-eeb1081e.js +0 -1
- package/dist/zonos-elements/p-f892595d.system.entry.js +0 -1
- package/dist/zonos-elements/p-fd3b46ee.entry.js +0 -1
|
@@ -0,0 +1,708 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-0bbe9693.js';
|
|
2
|
+
import { t as throttle_1 } from './throttle-ce2432ab.js';
|
|
3
|
+
import { c as stripeStore, t as trackConversionEvent, K as extractName, B as stripeStoreOnChange, q as stripeStorePrefetchLandedCost, e as cartStore } from './cart-66aecbb3.js';
|
|
4
|
+
import { s as storageStore, r as getFallbackDefaultCountryCode, t as translate, q as storageStoreOnChange, l as localizationStore } from './localization-04b05867.js';
|
|
5
|
+
import { z as zonosStore, g as getZonosStoreTheme, f as zonosStoreFontFamily } from './zonosStore-b434e436.js';
|
|
6
|
+
import { l as logError, i as isCheckoutMobile, s as sendErrorLog } from './handleFetch-a844cac1.js';
|
|
7
|
+
import { s as shouldRenderTaxIdInput } from './shouldRenderTaxIdInput-d45ceeb4.js';
|
|
8
|
+
import { c as classes } from './classes-0d95c529.js';
|
|
9
|
+
import { l as log } from './VarianceTest-572cecf5.js';
|
|
10
|
+
import { c as countryRequireTaxId, s as shipToTaxIdLabels } from './TaxId-50d72254.js';
|
|
11
|
+
import { g as getBorderRadius } from './getBorderRadius-877f6389.js';
|
|
12
|
+
import './debounce-c4785346.js';
|
|
13
|
+
import './isDarkColor-9ddd90cc.js';
|
|
14
|
+
|
|
15
|
+
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,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";
|
|
16
|
+
const ZonosAddressStyle0 = zonosAddressCss;
|
|
17
|
+
|
|
18
|
+
const ZonosAddress = class {
|
|
19
|
+
constructor(hostRef) {
|
|
20
|
+
registerInstance(this, hostRef);
|
|
21
|
+
this.invalidCharacters = createEvent(this, "invalidCharacters", 7);
|
|
22
|
+
this.taxIdChanged = createEvent(this, "taxIdChanged", 7);
|
|
23
|
+
this.storeUnsubscribeList = [];
|
|
24
|
+
/**
|
|
25
|
+
* Google autocomplete overlay is conflict with our button, this is to adjust z index of the autocomplete
|
|
26
|
+
*/
|
|
27
|
+
this.isAutoCompleteAdjusted = false;
|
|
28
|
+
/**
|
|
29
|
+
* Default address for stripe
|
|
30
|
+
*/
|
|
31
|
+
this.defaultAddress = [];
|
|
32
|
+
/**
|
|
33
|
+
* Error message for tax id input
|
|
34
|
+
*/
|
|
35
|
+
this.taxIdErrorMessage = '';
|
|
36
|
+
this.stripe = window.Zonos.stripe;
|
|
37
|
+
/**
|
|
38
|
+
* Check if the address is dirty or not to scroll into view. When the component is mounted, if the data is filled with address line 1, it's considered dirty
|
|
39
|
+
*/
|
|
40
|
+
this.isDirtyAddress = false;
|
|
41
|
+
/**
|
|
42
|
+
* Local address event for stripe address element
|
|
43
|
+
*/
|
|
44
|
+
this.isAddressFilled = false;
|
|
45
|
+
/**
|
|
46
|
+
* Local checkout session id to check if the address is filled after checkout is loaded
|
|
47
|
+
*/
|
|
48
|
+
this.checkoutSessionId = storageStore.checkoutSessionId;
|
|
49
|
+
/**
|
|
50
|
+
* Track previous country and postal code to detect changes
|
|
51
|
+
*/
|
|
52
|
+
this.prevCountry = null;
|
|
53
|
+
this.prevPostalCode = null;
|
|
54
|
+
/**
|
|
55
|
+
* Check if the tracking event is sent
|
|
56
|
+
*/
|
|
57
|
+
this.trackingSent = false;
|
|
58
|
+
this.prefetchLandedCost = throttle_1(stripeStorePrefetchLandedCost, 1000);
|
|
59
|
+
}
|
|
60
|
+
getStripeAddressInstance() {
|
|
61
|
+
if (this.type === 'billing') {
|
|
62
|
+
return {
|
|
63
|
+
stripeAddressElement: stripeStore.stripeBillingAddressElement,
|
|
64
|
+
stripeAddressEventData: stripeStore.stripeBillingAddressEventData,
|
|
65
|
+
stripeElements: stripeStore.stripeElementsForBillingAddress,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
stripeAddressElement: stripeStore.stripeAddressElement,
|
|
70
|
+
stripeAddressEventData: stripeStore.stripeAddressEventData,
|
|
71
|
+
stripeElements: stripeStore.stripeElements,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
updateAddressEventData({ event, type, }) {
|
|
75
|
+
switch (type) {
|
|
76
|
+
case 'billing':
|
|
77
|
+
stripeStore.stripeBillingAddressEventData = event;
|
|
78
|
+
break;
|
|
79
|
+
default: {
|
|
80
|
+
stripeStore.stripeAddressEventData = event;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Only trigger landed cost prefetch for shipping address
|
|
85
|
+
if (type === 'shipping') {
|
|
86
|
+
// if line 1 has something, trigger prefetch
|
|
87
|
+
if (event.value.address.line1.length) {
|
|
88
|
+
void this.prefetchLandedCost();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
isAddressFilledChanged() {
|
|
93
|
+
// 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
|
|
94
|
+
if (!storageStore.checkoutSessionId) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// Only need to track the event if the shipping address is filled
|
|
98
|
+
if (this.isAddressFilled &&
|
|
99
|
+
!this.trackingSent &&
|
|
100
|
+
this.type === 'shipping') {
|
|
101
|
+
this.trackingSent = true;
|
|
102
|
+
const checkoutSessionId = storageStore.checkoutSessionId;
|
|
103
|
+
void trackConversionEvent({
|
|
104
|
+
checkoutSessionId,
|
|
105
|
+
eventName: 'checkout_customerInfoFilled',
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
updateAddressElement({ stripeAddressElement, type, }) {
|
|
110
|
+
if (type === 'shipping') {
|
|
111
|
+
stripeStore.stripeAddressElement = stripeAddressElement;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
stripeStore.stripeBillingAddressElement = stripeAddressElement;
|
|
115
|
+
}
|
|
116
|
+
async watchInitStripe() {
|
|
117
|
+
this.stripe = window.Zonos.stripe;
|
|
118
|
+
const { stripeAddressEventData, stripeElements } = this.getStripeAddressInstance();
|
|
119
|
+
if (!this.stripe || !stripeElements) {
|
|
120
|
+
logError("Stripe is not initialized. Couldn't load stripe element.");
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
// remove phone from default address if it's not provided, stripe
|
|
124
|
+
// will throw error if key phone exist and its value is empty or 'undefined'.
|
|
125
|
+
const defaultAddress = this.defaultAddress.map(address => (Object.assign(Object.assign({}, address), { name: address.name, phone: address.phone || undefined })));
|
|
126
|
+
const shippableCountries = localizationStore.shippingZoneCountries;
|
|
127
|
+
const shippingZone = shippableCountries
|
|
128
|
+
? Object.values(shippableCountries).map(country => country.code)
|
|
129
|
+
: [];
|
|
130
|
+
// Show all countries in checkout if the query param is present
|
|
131
|
+
const checkoutAllCountries = new URLSearchParams(window.location.search).has('zonosCheckoutAllCountries');
|
|
132
|
+
const allowedCountries = this.type === 'shipping' ? shippingZone : [];
|
|
133
|
+
const defaultAddressCountry = (stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.address.country) ||
|
|
134
|
+
getFallbackDefaultCountryCode(allowedCountries);
|
|
135
|
+
log(`Stripe country code: ${defaultAddressCountry}`, 'info');
|
|
136
|
+
const addressElement = stripeElements.create('address', {
|
|
137
|
+
allowedCountries: checkoutAllCountries ? [] : allowedCountries,
|
|
138
|
+
// only show the default address if stripeAddressEventData is not provided
|
|
139
|
+
contacts: defaultAddress.length && !stripeAddressEventData
|
|
140
|
+
? this.defaultAddress
|
|
141
|
+
: [],
|
|
142
|
+
defaultValues: {
|
|
143
|
+
address: Object.assign(Object.assign({}, stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.address), { country: defaultAddressCountry }),
|
|
144
|
+
firstName: stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.firstName,
|
|
145
|
+
lastName: stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.lastName,
|
|
146
|
+
phone: stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.phone,
|
|
147
|
+
},
|
|
148
|
+
display: {
|
|
149
|
+
name: 'split',
|
|
150
|
+
},
|
|
151
|
+
fields: {
|
|
152
|
+
phone: 'always',
|
|
153
|
+
},
|
|
154
|
+
mode: this.type,
|
|
155
|
+
validation: {
|
|
156
|
+
phone: {
|
|
157
|
+
required: 'always',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
addressElement.mount(this.el.querySelector('.zonos--address-component'));
|
|
162
|
+
// Initialize previous values if address data exists
|
|
163
|
+
if (stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.address) {
|
|
164
|
+
this.prevCountry = stripeAddressEventData.value.address.country;
|
|
165
|
+
this.prevPostalCode = stripeAddressEventData.value.address.postal_code;
|
|
166
|
+
}
|
|
167
|
+
addressElement.on('change', event => {
|
|
168
|
+
const eventValue = event.value;
|
|
169
|
+
if (!this.isDirtyAddress && eventValue.address.line1.length >= 3) {
|
|
170
|
+
this.isDirtyAddress = true;
|
|
171
|
+
if (!this.isAutoCompleteAdjusted) {
|
|
172
|
+
const googleAutoComplete = this.el.querySelector('iframe[src*="autocomplete-suggestions"]');
|
|
173
|
+
if (googleAutoComplete) {
|
|
174
|
+
googleAutoComplete.style.zIndex = '3';
|
|
175
|
+
}
|
|
176
|
+
this.isAutoCompleteAdjusted = true;
|
|
177
|
+
}
|
|
178
|
+
// stripe element started with just address line 1, so scroll bar is not yet available. Wait for a moment before scrolling
|
|
179
|
+
setTimeout(() => {
|
|
180
|
+
// scroll directly into view if it's mobile
|
|
181
|
+
if (isCheckoutMobile()) {
|
|
182
|
+
this.el.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// scroll into the end of the page so the address placeholder won't be hidden
|
|
186
|
+
const yOffset = this.type === 'shipping' ? 100 : 600;
|
|
187
|
+
const parentWrapper = this.el.closest('.zonos--group');
|
|
188
|
+
const y = this.el.getBoundingClientRect().top + yOffset;
|
|
189
|
+
parentWrapper === null || parentWrapper === void 0 ? void 0 : parentWrapper.scrollTo({ behavior: 'smooth', top: y });
|
|
190
|
+
}
|
|
191
|
+
}, 600);
|
|
192
|
+
}
|
|
193
|
+
const { firstName, lastName } = extractName({
|
|
194
|
+
firstName: eventValue.firstName,
|
|
195
|
+
lastName: eventValue.lastName,
|
|
196
|
+
name: eventValue.name,
|
|
197
|
+
});
|
|
198
|
+
this.updateAddressEventData({
|
|
199
|
+
event: Object.assign(Object.assign({}, event), { elementMode: this.type, elementType: 'address', value: Object.assign(Object.assign({}, eventValue), { firstName,
|
|
200
|
+
lastName }) }),
|
|
201
|
+
type: this.type,
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
this.updateAddressElement({
|
|
205
|
+
stripeAddressElement: addressElement,
|
|
206
|
+
type: this.type,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
defaultAddressChanged(newAddress, oldAddress) {
|
|
210
|
+
// check if stringified json of oldAddress is different from newAddress
|
|
211
|
+
const oldAddressString = JSON.stringify(oldAddress);
|
|
212
|
+
const newAddressString = JSON.stringify(newAddress);
|
|
213
|
+
// No need to reset address element if the default address is the same
|
|
214
|
+
if (oldAddressString === newAddressString) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
log('Reset address element when default address property is changed', 'info', {
|
|
218
|
+
defaultAddress: this.defaultAddress,
|
|
219
|
+
});
|
|
220
|
+
const stripeElement = this.getStripeAddressInstance().stripeAddressElement;
|
|
221
|
+
stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.clear();
|
|
222
|
+
stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.destroy();
|
|
223
|
+
// Reset stripe address event data
|
|
224
|
+
if (this.type === 'shipping') {
|
|
225
|
+
stripeStore.stripeAddressEventData = null;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
stripeStore.stripeBillingAddressEventData = null;
|
|
229
|
+
}
|
|
230
|
+
void this.watchInitStripe();
|
|
231
|
+
}
|
|
232
|
+
isInTaxIdCountry(countryCode) {
|
|
233
|
+
return countryRequireTaxId.includes(countryCode);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Render tax id input based on ship to country code
|
|
237
|
+
*/
|
|
238
|
+
renderTaxIdInput() {
|
|
239
|
+
var _a;
|
|
240
|
+
// No need to render tax id input for billing address
|
|
241
|
+
if (this.type === 'billing') {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
const countryCode = (_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.value.address.country;
|
|
245
|
+
// Don't render tax id input if the country is not provided
|
|
246
|
+
if (!countryCode) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
// This just to type guard the countryCode, if it's able to get to this point it should already be in country that has tax id input
|
|
250
|
+
if (!this.isInTaxIdCountry(countryCode)) {
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
const taxIdInputRendered = shouldRenderTaxIdInput({
|
|
254
|
+
companyName: stripeStore.companyName,
|
|
255
|
+
countryCode,
|
|
256
|
+
});
|
|
257
|
+
// Don't render tax id input if the country doesn't require tax id
|
|
258
|
+
if (!taxIdInputRendered) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
const taxIdInputInfo = shipToTaxIdLabels[countryCode];
|
|
262
|
+
return (h("div", { class: "zonos--tax-id-input" }, h("zonos-stripe-input", { inputLabel: translate(taxIdInputInfo.friendlyName), inputPlaceholder: taxIdInputInfo.placeholder, inputValue: stripeStore.taxId || '', isError: !!this.taxIdErrorMessage, onInputChange: (event) => {
|
|
263
|
+
stripeStore.taxId = event.detail;
|
|
264
|
+
this.taxIdChanged.emit(event.detail);
|
|
265
|
+
} }), this.taxIdErrorMessage && (h("zonos-text", { textColor: 'red-600', type: "caption" }, this.taxIdErrorMessage))));
|
|
266
|
+
}
|
|
267
|
+
renderCompanyNameInput() {
|
|
268
|
+
// No need to render company name for billing address (only allow for Collect and Invoice)
|
|
269
|
+
if (this.type === 'billing' &&
|
|
270
|
+
!window.Zonos.isCollect &&
|
|
271
|
+
!window.Zonos.isInvoice) {
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
// only render the company input if the setting is enabled or the cart is collect
|
|
275
|
+
const isCompanyNameEnabled = zonosStore.checkoutSettings.companyFieldsStatus === 'ENABLED' ||
|
|
276
|
+
!!window.Zonos.isCollect ||
|
|
277
|
+
!!window.Zonos.isInvoice;
|
|
278
|
+
// No need to render company name for billing address (only allow for Collect)
|
|
279
|
+
if (!isCompanyNameEnabled) {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
return (h("zonos-stripe-input", { class: "zonos--company-name-input", inputLabel: translate('Company name (optional)'), inputValue: stripeStore.companyName, onInputChange: (event) => {
|
|
283
|
+
stripeStore.companyName = event.detail;
|
|
284
|
+
} }));
|
|
285
|
+
}
|
|
286
|
+
disconnectedCallback() {
|
|
287
|
+
// destroy the stripe element when this component is removed from the DOM, so that we can re-create the new one with previous value
|
|
288
|
+
const stripeElement = this.getStripeAddressInstance().stripeAddressElement;
|
|
289
|
+
stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.destroy();
|
|
290
|
+
// unsubscribe from store subscriptions
|
|
291
|
+
try {
|
|
292
|
+
this.storeUnsubscribeList.forEach(subscription => subscription());
|
|
293
|
+
}
|
|
294
|
+
catch (_a) { }
|
|
295
|
+
}
|
|
296
|
+
componentDidLoad() {
|
|
297
|
+
const stripeAddressEventData = this.getStripeAddressInstance().stripeAddressEventData;
|
|
298
|
+
this.isDirtyAddress =
|
|
299
|
+
!!stripeAddressEventData &&
|
|
300
|
+
stripeAddressEventData.value.address.line1.length > 0;
|
|
301
|
+
// @Watch doesn't get trigger on initial load
|
|
302
|
+
void this.watchInitStripe();
|
|
303
|
+
this.checkoutSessionId = storageStore.checkoutSessionId;
|
|
304
|
+
this.storeUnsubscribeList = [
|
|
305
|
+
storageStoreOnChange('checkoutSessionId', () => {
|
|
306
|
+
this.checkoutSessionId = storageStore.checkoutSessionId;
|
|
307
|
+
}),
|
|
308
|
+
stripeStoreOnChange('stripeElements', () => {
|
|
309
|
+
if (this.type === 'shipping') {
|
|
310
|
+
void this.watchInitStripe();
|
|
311
|
+
}
|
|
312
|
+
}),
|
|
313
|
+
stripeStoreOnChange('stripeElementsForBillingAddress', () => {
|
|
314
|
+
if (this.type === 'billing') {
|
|
315
|
+
void this.watchInitStripe();
|
|
316
|
+
}
|
|
317
|
+
}),
|
|
318
|
+
];
|
|
319
|
+
}
|
|
320
|
+
render() {
|
|
321
|
+
var _a;
|
|
322
|
+
this.checkoutSessionId = storageStore.checkoutSessionId;
|
|
323
|
+
if ((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) {
|
|
324
|
+
this.isAddressFilled = true;
|
|
325
|
+
}
|
|
326
|
+
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
327
|
+
return (h(Host, { key: '7762b1dbeeff9d45721bf7a2efbe4bf4c2c29551', class: classes([
|
|
328
|
+
'zonos--address',
|
|
329
|
+
'zonos--elements',
|
|
330
|
+
`zonos--${this.type}-address`,
|
|
331
|
+
]) }, this.titleText && (h("zonos-text", { key: '5f266b4562eb78eb8f5b1374f195501abc44c9f7', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("slot", { key: 'bfcee78353455a66c6dec12432bfeff69dc9a10b', name: "below-title" }), this.renderCompanyNameInput(), this.renderTaxIdInput(), h("div", { key: 'd005a517dc93439d13f38750df8e09f884ad898c', class: "zonos--address-component" })));
|
|
332
|
+
}
|
|
333
|
+
get el() { return getElement(this); }
|
|
334
|
+
static get watchers() { return {
|
|
335
|
+
"checkoutSessionId": ["isAddressFilledChanged"],
|
|
336
|
+
"isAddressFilled": ["isAddressFilledChanged"],
|
|
337
|
+
"stripe": ["watchInitStripe"],
|
|
338
|
+
"defaultAddress": ["defaultAddressChanged"]
|
|
339
|
+
}; }
|
|
340
|
+
};
|
|
341
|
+
ZonosAddress.style = ZonosAddressStyle0;
|
|
342
|
+
|
|
343
|
+
const ExclamationMarkDuotoneIcon = `<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
|
|
344
|
+
<path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>
|
|
345
|
+
<path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>
|
|
346
|
+
</svg>`;
|
|
347
|
+
|
|
348
|
+
const HelpDuotoneIcon = `<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
|
|
349
|
+
<path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>
|
|
350
|
+
<path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>
|
|
351
|
+
</svg>`;
|
|
352
|
+
|
|
353
|
+
const WarningDuotoneIcon = `<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
|
|
354
|
+
<path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>
|
|
355
|
+
<path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>
|
|
356
|
+
</svg>`;
|
|
357
|
+
|
|
358
|
+
const zonosConfirmDialogCss = ":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--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-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)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);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 .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";
|
|
359
|
+
const ZonosConfirmDialogStyle0 = zonosConfirmDialogCss;
|
|
360
|
+
|
|
361
|
+
const ZonosConfirmDialog = class {
|
|
362
|
+
constructor(hostRef) {
|
|
363
|
+
registerInstance(this, hostRef);
|
|
364
|
+
this.confirmClicked = createEvent(this, "confirmClicked", 7);
|
|
365
|
+
this.cancelClicked = createEvent(this, "cancelClicked", 7);
|
|
366
|
+
/**
|
|
367
|
+
* Dialog title text
|
|
368
|
+
* @default "Are you sure?"
|
|
369
|
+
*/
|
|
370
|
+
this.dialogTitle = translate('Are you sure?');
|
|
371
|
+
/**
|
|
372
|
+
* Dialog intent (for icon and button color)
|
|
373
|
+
* @default "info"
|
|
374
|
+
*/
|
|
375
|
+
this.dialogIntent = 'info';
|
|
376
|
+
/**
|
|
377
|
+
* Dialog subtitle text
|
|
378
|
+
* @default null No subtitle
|
|
379
|
+
*/
|
|
380
|
+
this.dialogSubtitle = null;
|
|
381
|
+
/**
|
|
382
|
+
* Dialog width
|
|
383
|
+
* @default 350 px
|
|
384
|
+
*/
|
|
385
|
+
this.dialogWidth = 350;
|
|
386
|
+
/**
|
|
387
|
+
* Type of dialog
|
|
388
|
+
* - "alert" - Only confirm button
|
|
389
|
+
* - "confirm" - Both Confirm and cancel buttons
|
|
390
|
+
* @default "confirm"
|
|
391
|
+
*/
|
|
392
|
+
this.dialogType = 'confirm';
|
|
393
|
+
/**
|
|
394
|
+
* Whether or not the dialog is open
|
|
395
|
+
*/
|
|
396
|
+
this.isMobile = false;
|
|
397
|
+
/**
|
|
398
|
+
* Whether or not to close the dialog when clicking outside of it
|
|
399
|
+
* @default false
|
|
400
|
+
*/
|
|
401
|
+
this.noClickOutside = false;
|
|
402
|
+
this.clickOutsideDialogHandler = (event) => {
|
|
403
|
+
if (event.target === event.currentTarget && !this.noClickOutside) {
|
|
404
|
+
this.closeDialogHandler();
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
handleKeyDown(ev) {
|
|
409
|
+
if (ev.key === 'Escape') {
|
|
410
|
+
this.closeDialogHandler();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
focusDialog() {
|
|
414
|
+
if (this.dialogOpen) {
|
|
415
|
+
setTimeout(() => {
|
|
416
|
+
var _a, _b;
|
|
417
|
+
// Focus on a non tabable element (tabIndex=-1), so we will be able to tab to other tabable elements
|
|
418
|
+
(_b = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.zonos--backdrop')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
419
|
+
}, 100);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
confirmDialogHandler() {
|
|
423
|
+
// Only do the action if the dialog is open
|
|
424
|
+
if (!this.dialogOpen) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
// Emit confirm event
|
|
428
|
+
this.confirmClicked.emit();
|
|
429
|
+
}
|
|
430
|
+
closeDialogHandler() {
|
|
431
|
+
// Only do the action if the dialog is open
|
|
432
|
+
if (!this.dialogOpen) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
// Emit cancel event
|
|
436
|
+
this.cancelClicked.emit();
|
|
437
|
+
}
|
|
438
|
+
renderIcon() {
|
|
439
|
+
switch (this.dialogIntent) {
|
|
440
|
+
case 'info':
|
|
441
|
+
return (h("zonos-icon", { content: HelpDuotoneIcon, iconColor: 'blue-800' }));
|
|
442
|
+
case 'danger':
|
|
443
|
+
return (h("zonos-icon", { content: ExclamationMarkDuotoneIcon, iconColor: 'red-800' }));
|
|
444
|
+
case 'warn':
|
|
445
|
+
return (h("zonos-icon", { content: WarningDuotoneIcon, iconColor: 'orange-800' }));
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
getButtonConfirmVariant() {
|
|
449
|
+
switch (this.dialogIntent) {
|
|
450
|
+
case 'warn':
|
|
451
|
+
return 'warning';
|
|
452
|
+
case 'danger':
|
|
453
|
+
return 'danger';
|
|
454
|
+
default:
|
|
455
|
+
return 'primary';
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
render() {
|
|
459
|
+
this.focusDialog();
|
|
460
|
+
const borderStyle = getBorderRadius();
|
|
461
|
+
// Get theme for the update dialog, inherit from the theme, no from this component theme
|
|
462
|
+
const theme = getZonosStoreTheme(zonosStore.appearance.theme);
|
|
463
|
+
return (h(Host, { key: 'db0bfe0b8a125e806a97c9382faa938078000349', class: classes([this.dialogOpen && 'open', 'zonos--elements']), "data-dialog-type": this.dialogType, "data-theme": theme, style: {
|
|
464
|
+
'--zonos--border-radius': borderStyle,
|
|
465
|
+
'--zonos--dialog-width': `${this.dialogWidth}px`,
|
|
466
|
+
'--zonos--font-family': zonosStoreFontFamily(),
|
|
467
|
+
} }, h("div", { key: '1676defad54705df4e9282bda6b5734592d0fb60', class: "zonos--backdrop", tabIndex: -1 }), h("div", { key: '2a6ec6b5df7ea30304cfed5276e55618b40add93', class: classes(['zonos--confirm-layout', this.dialogIntent]), onClick: e => this.clickOutsideDialogHandler(e) }, h("div", { key: 'd1c8358c3fd98c27a469fe7443d1983c1c134a7c', class: "zonos--confirm-dialog", onBlur: () => {
|
|
468
|
+
this.focusDialog();
|
|
469
|
+
} }, h("div", { key: '137e9659aa7aec2e4604acf80809b35bce69ca79', class: "wrapper" }, h("div", { key: '9c1057857ea095e7e88c8950469add2bc4c1318e', class: "icon-wrapper" }, this.renderIcon()), h("div", { key: '48f0e0cd9ce62b425bae831d1387261bbd4162a1', class: "content" }, h("div", { key: '0d3e681f350e5db547181beadf5c6bcf49a8bbd2', class: "title" }, h("zonos-text", { key: 'f16a43d2b3c9504911b1e36ba573873f80093c47', type: "subheader" }, this.dialogTitle)), this.dialogSubtitle && (h("div", { key: 'fd570f98bc736a68c16fedee72b1417dc6906fa6', class: "subtitle" }, h("zonos-text", { key: '6785aa19dd44cf7f6fae7317e3924be6c6ee8af3', textColor: "gray-800" }, this.dialogSubtitle)))), h("div", { key: '4206cad3dcff0055fc5f3ea8e7c217ae33c63263', class: "footer" }, this.dialogType === 'confirm' && (h("zonos-button", { key: '72d1a216641d482bdbeae384963dcdff1cfc3f45', backgroundColor: "gray-0", class: "cancel-button", onClick: () => this.closeDialogHandler(), size: "lg", withBoxShadow: true }, this.dialogCancelBtnText || translate('Cancel'))), h("zonos-button", { key: 'a6a206eff11d1f42c33ef9113cc393d727c60f89', class: "confirm-button", onClick: () => this.confirmDialogHandler(), size: "lg", variant: this.getButtonConfirmVariant() }, this.dialogConfirmBtnText)))))));
|
|
470
|
+
}
|
|
471
|
+
static get assetsDirs() { return ["assets"]; }
|
|
472
|
+
get el() { return getElement(this); }
|
|
473
|
+
};
|
|
474
|
+
ZonosConfirmDialog.style = ZonosConfirmDialogStyle0;
|
|
475
|
+
|
|
476
|
+
const validateEmailValue = (value) => {
|
|
477
|
+
const emailRegex = /^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/;
|
|
478
|
+
return emailRegex.test(value);
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
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)}";
|
|
482
|
+
const ZonosLinkAuthenticationStyle0 = zonosLinkAuthenticationCss;
|
|
483
|
+
|
|
484
|
+
const MAX_RETRIES_INITIALIZE_LINK = 51;
|
|
485
|
+
const ZonosLinkAuthentication = class {
|
|
486
|
+
constructor(hostRef) {
|
|
487
|
+
registerInstance(this, hostRef);
|
|
488
|
+
this.linkAuthenticationChange = createEvent(this, "linkAuthenticationChange", 7);
|
|
489
|
+
this.storeUnsubscribeList = [];
|
|
490
|
+
/**
|
|
491
|
+
* Default email for stripe
|
|
492
|
+
*/
|
|
493
|
+
this.defaultEmail = null;
|
|
494
|
+
/**
|
|
495
|
+
* Email error text to dispaly
|
|
496
|
+
*/
|
|
497
|
+
this.isEmailError = false;
|
|
498
|
+
this.stripe = stripeStore.stripe;
|
|
499
|
+
this.isStagingMode = cartStore.isStagingMode;
|
|
500
|
+
this.clientSecret = stripeStore.clientSecret;
|
|
501
|
+
this.retriesInitializeLink = 0;
|
|
502
|
+
this.setCustomEmailInputToLinkEvent = (emailValue) => {
|
|
503
|
+
// check if the email is valid
|
|
504
|
+
const isValid = validateEmailValue(emailValue);
|
|
505
|
+
const simulateLinkEvent = {
|
|
506
|
+
complete: !!isValid,
|
|
507
|
+
elementType: 'linkAuthentication',
|
|
508
|
+
empty: !emailValue,
|
|
509
|
+
value: {
|
|
510
|
+
email: emailValue,
|
|
511
|
+
},
|
|
512
|
+
};
|
|
513
|
+
stripeStore.stripeLinkEventData = simulateLinkEvent;
|
|
514
|
+
};
|
|
515
|
+
this.handleNormalEmailInput = (event) => {
|
|
516
|
+
var _a;
|
|
517
|
+
const inputValue = event.detail;
|
|
518
|
+
this.setCustomEmailInputToLinkEvent(inputValue);
|
|
519
|
+
(_a = this.linkAuthenticationChange) === null || _a === void 0 ? void 0 : _a.emit();
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
watchIsStagingMode() {
|
|
523
|
+
// Wait for the DOM to be ready before re-initializing Link element
|
|
524
|
+
setTimeout(() => {
|
|
525
|
+
void this.watchInitStripe();
|
|
526
|
+
}, 0);
|
|
527
|
+
}
|
|
528
|
+
async watchInitStripe() {
|
|
529
|
+
if (!this.stripe || !stripeStore.stripeElements) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
// No need to initialize link if this is staging mode since we will render the email input field
|
|
533
|
+
if (cartStore.isStagingMode || !this.clientSecret) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
const defaultValues = this.defaultEmail
|
|
537
|
+
? {
|
|
538
|
+
email: this.defaultEmail,
|
|
539
|
+
}
|
|
540
|
+
: undefined;
|
|
541
|
+
try {
|
|
542
|
+
// Create and mount the Authentication Element in ${type} mode
|
|
543
|
+
const linkAuthenticationElement = stripeStore.stripeLinkElement ||
|
|
544
|
+
stripeStore.stripeElements.create('linkAuthentication', {
|
|
545
|
+
defaultValues: defaultValues,
|
|
546
|
+
});
|
|
547
|
+
const linkAuthenticationElementContainer = this.el.querySelector('.zonos--link-authentication-component');
|
|
548
|
+
if (!linkAuthenticationElementContainer) {
|
|
549
|
+
logError('Cannot find container element for linkAuthenticationElement');
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
linkAuthenticationElement.mount(linkAuthenticationElementContainer);
|
|
553
|
+
linkAuthenticationElement.on('change', event => {
|
|
554
|
+
var _a;
|
|
555
|
+
stripeStore.stripeLinkEventData = event;
|
|
556
|
+
(_a = this.linkAuthenticationChange) === null || _a === void 0 ? void 0 : _a.emit();
|
|
557
|
+
});
|
|
558
|
+
stripeStore.stripeLinkElement = linkAuthenticationElement;
|
|
559
|
+
this.retriesInitializeLink = 0;
|
|
560
|
+
// 10 seconds
|
|
561
|
+
if (this.retriesInitializeLink > 11) {
|
|
562
|
+
log('Stripe link element initialized', 'info', {
|
|
563
|
+
retriesInitializeLink: this.retriesInitializeLink,
|
|
564
|
+
stripe: this.stripe,
|
|
565
|
+
});
|
|
566
|
+
void sendErrorLog({
|
|
567
|
+
endpoint: 'stripe-link-authentication-init-long-running',
|
|
568
|
+
errors: [
|
|
569
|
+
'Stripe link element initialized after 20 retries - 10 seconds',
|
|
570
|
+
],
|
|
571
|
+
metadata: {
|
|
572
|
+
retriesInitializeLink: this.retriesInitializeLink,
|
|
573
|
+
},
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
catch (error) {
|
|
578
|
+
if (error instanceof Error) {
|
|
579
|
+
// Wait for the stripe elements to be ready with the new client secret
|
|
580
|
+
this.retriesInitializeLink++;
|
|
581
|
+
if (this.retriesInitializeLink < MAX_RETRIES_INITIALIZE_LINK) {
|
|
582
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
583
|
+
void this.watchInitStripe();
|
|
584
|
+
}
|
|
585
|
+
if (this.retriesInitializeLink === MAX_RETRIES_INITIALIZE_LINK) {
|
|
586
|
+
void sendErrorLog({
|
|
587
|
+
endpoint: 'stripe-link-authentication-init-error',
|
|
588
|
+
errors: [error.message],
|
|
589
|
+
metadata: {
|
|
590
|
+
retriesInitializeLink: this.retriesInitializeLink,
|
|
591
|
+
},
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
watchDefaultEmail(newDefaultEmail, oldDefaultEmail) {
|
|
598
|
+
var _a, _b;
|
|
599
|
+
log('Default email is changed', 'info', {
|
|
600
|
+
newDefaultEmail,
|
|
601
|
+
oldDefaultEmail,
|
|
602
|
+
});
|
|
603
|
+
if (oldDefaultEmail === newDefaultEmail) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
if (!newDefaultEmail) {
|
|
607
|
+
stripeStore.stripeLinkEventData = null;
|
|
608
|
+
}
|
|
609
|
+
// Only set value for Stripe input input to stripeLinkEventData when checkout is in staging mode
|
|
610
|
+
if (cartStore.isStagingMode) {
|
|
611
|
+
this.setCustomEmailInputToLinkEvent(newDefaultEmail || '');
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
(_a = stripeStore.stripeLinkElement) === null || _a === void 0 ? void 0 : _a.clear();
|
|
615
|
+
(_b = stripeStore.stripeLinkElement) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
616
|
+
stripeStore.stripeLinkElement = null;
|
|
617
|
+
stripeStore.stripeLinkEventData = null;
|
|
618
|
+
log('Reset stripe link element when default email is changed', 'info', {
|
|
619
|
+
defaultEmail: newDefaultEmail,
|
|
620
|
+
});
|
|
621
|
+
void this.watchInitStripe();
|
|
622
|
+
}
|
|
623
|
+
disconnectedCallback() {
|
|
624
|
+
// unsubscribe from store subscriptions
|
|
625
|
+
try {
|
|
626
|
+
this.storeUnsubscribeList.forEach(subscription => subscription());
|
|
627
|
+
}
|
|
628
|
+
catch (_a) { }
|
|
629
|
+
}
|
|
630
|
+
componentDidLoad() {
|
|
631
|
+
this.storeUnsubscribeList = [
|
|
632
|
+
stripeStoreOnChange('stripeElements', async () => {
|
|
633
|
+
void this.watchInitStripe();
|
|
634
|
+
}),
|
|
635
|
+
stripeStoreOnChange('clientSecret', async () => {
|
|
636
|
+
this.clientSecret = stripeStore.clientSecret;
|
|
637
|
+
}),
|
|
638
|
+
stripeStoreOnChange('stripe', async () => {
|
|
639
|
+
this.stripe = stripeStore.stripe;
|
|
640
|
+
}),
|
|
641
|
+
];
|
|
642
|
+
// @Watch doesn't get trigger on initial load
|
|
643
|
+
void this.watchInitStripe();
|
|
644
|
+
if (!this.defaultEmail) {
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
// set default email value to stripeLinkEventData if default email is provided
|
|
648
|
+
this.setCustomEmailInputToLinkEvent(this.defaultEmail);
|
|
649
|
+
}
|
|
650
|
+
render() {
|
|
651
|
+
this.isStagingMode = cartStore.isStagingMode;
|
|
652
|
+
this.clientSecret = stripeStore.clientSecret;
|
|
653
|
+
const renderEmailAddress = () => {
|
|
654
|
+
var _a;
|
|
655
|
+
if (cartStore.isStagingMode) {
|
|
656
|
+
return (h("zonos-stripe-input", { inputLabel: translate('Email'), inputValue: this.defaultEmail ||
|
|
657
|
+
((_a = stripeStore.stripeLinkEventData) === null || _a === void 0 ? void 0 : _a.value.email) ||
|
|
658
|
+
'', isError: this.isEmailError, onBlur: () => {
|
|
659
|
+
var _a;
|
|
660
|
+
const emailValue = ((_a = stripeStore.stripeLinkEventData) === null || _a === void 0 ? void 0 : _a.value.email) || '';
|
|
661
|
+
if (!emailValue) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
// check if the email is valid
|
|
665
|
+
const isValid = validateEmailValue(emailValue);
|
|
666
|
+
this.isEmailError = !isValid;
|
|
667
|
+
}, onInputChange: this.handleNormalEmailInput }));
|
|
668
|
+
}
|
|
669
|
+
return (h("div", { class: `zonos--link-authentication-component ${this.isEmailError && 'zonos--input-invalid'}` }));
|
|
670
|
+
};
|
|
671
|
+
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
672
|
+
return (h(Host, { class: "zonos--link-authentication zonos--elements", style: {
|
|
673
|
+
'--zonos--border-radius': getBorderRadius(),
|
|
674
|
+
} }, this.titleText && (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.')))));
|
|
675
|
+
}
|
|
676
|
+
get el() { return getElement(this); }
|
|
677
|
+
static get watchers() { return {
|
|
678
|
+
"isStagingMode": ["watchIsStagingMode"],
|
|
679
|
+
"stripe": ["watchInitStripe"],
|
|
680
|
+
"clientSecret": ["watchInitStripe"],
|
|
681
|
+
"defaultEmail": ["watchDefaultEmail"]
|
|
682
|
+
}; }
|
|
683
|
+
};
|
|
684
|
+
ZonosLinkAuthentication.style = ZonosLinkAuthenticationStyle0;
|
|
685
|
+
|
|
686
|
+
const zonosLoadingOverlayCss = ":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{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";
|
|
687
|
+
const ZonosLoadingOverlayStyle0 = zonosLoadingOverlayCss;
|
|
688
|
+
|
|
689
|
+
const ZonosLoadingOverlay = class {
|
|
690
|
+
constructor(hostRef) {
|
|
691
|
+
registerInstance(this, hostRef);
|
|
692
|
+
/**
|
|
693
|
+
* Whether or not the overlay is open
|
|
694
|
+
* @default false
|
|
695
|
+
*/
|
|
696
|
+
this.open = false;
|
|
697
|
+
/**
|
|
698
|
+
* Spinner size (optional, default 40)
|
|
699
|
+
*/
|
|
700
|
+
this.size = 40;
|
|
701
|
+
}
|
|
702
|
+
render() {
|
|
703
|
+
return (h(Host, { key: 'eee6eb4eb40c18ccdd24d57d98be8b90eadccf23', class: classes(['zonos--elements', this.open && 'zonos--open']) }, h("div", { key: '4bca110e058cb5cbf4c86351aa56d251792ab325', class: "zonos--loading-overlay" }, h("zonos-spinner", { key: '513b8d669ab13896442c0b1048609a3f3e0ed6f5', size: this.size, spinnerColor: this.spinnerColor }))));
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
ZonosLoadingOverlay.style = ZonosLoadingOverlayStyle0;
|
|
707
|
+
|
|
708
|
+
export { ZonosAddress as zonos_address, ZonosConfirmDialog as zonos_confirm_dialog, ZonosLinkAuthentication as zonos_link_authentication, ZonosLoadingOverlay as zonos_loading_overlay };
|