@zonos/elements 1.3.267 → 1.3.268
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-ed2de167.js → cart-af7c024e.js} +129 -4
- package/dist/cjs/{debounce-606d1801.js → debounce-7990f5ea.js} +1 -1
- package/dist/cjs/{getBorderRadius-a91911e7.js → getBorderRadius-fc683d94.js} +1 -1
- package/dist/cjs/{getContrastColor-ce80dbe7.js → getContrastColor-d5134ef3.js} +2 -2
- package/dist/cjs/{hasInclusivePrice-bf31fbdb.js → hasInclusivePrice-0fa6e022.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{invoice-542c23e7.js → invoice-c2e3f232.js} +3 -3
- package/dist/cjs/{isCollectMobileTablet-fe8149a5.js → isCollectMobileTablet-6014787b.js} +3 -3
- package/dist/cjs/{isContrastColor-a02c4889.js → isContrastColor-76592c92.js} +1 -1
- package/dist/cjs/{isDarkColor-e317bb06.js → isDarkColor-5d6ca405.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{localization-66d378ab.js → localization-f897bc45.js} +421 -1
- package/dist/cjs/{paypal-d8282578.js → paypal-6756a0da.js} +60 -18
- package/dist/cjs/{placeTestOrder-0a4b9dd7.js → placeTestOrder-a4874e51.js} +2 -2
- package/dist/cjs/{renderCheckoutCurrency-ac9083d9.js → renderCheckoutCurrency-584d50fe.js} +2 -2
- package/dist/cjs/{submitGtag-07a3b09e.js → submitGtag-4906b161.js} +1 -1
- package/dist/cjs/{throttle-8aebac7d.js → throttle-02c2e917.js} +2 -2
- package/dist/cjs/{updateCheckoutSessionAttributes-a9a97194.js → updateCheckoutSessionAttributes-47d73942.js} +1 -1
- package/dist/cjs/zonos-address-display_8.cjs.entry.js +7 -7
- package/dist/cjs/zonos-address_4.cjs.entry.js +7 -7
- package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card_5.cjs.entry.js +8 -8
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +94 -27
- package/dist/cjs/zonos-checkbox_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-checkout.cjs.entry.js +112 -85
- package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +5 -5
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +11 -11
- package/dist/cjs/zonos-collect.cjs.entry.js +9 -9
- package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +3 -3
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
- package/dist/cjs/zonos-hello.cjs.entry.js +3 -3
- package/dist/cjs/zonos-input.cjs.entry.js +2 -2
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +7 -7
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +11 -11
- package/dist/cjs/zonos-invoice.cjs.entry.js +9 -9
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
- package/dist/cjs/{zonos-store-credit.cjs.entry.js → zonos-policy-consent_2.cjs.entry.js} +91 -6
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +5 -5
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +3 -3
- package/dist/cjs/zonos-text.cjs.entry.js +1 -1
- package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
- package/dist/cjs/{zonosStore-0662b95f.js → zonosStore-45a87908.js} +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +7 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +66 -12
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +103 -75
- package/dist/collection/components/checkout/zonos-checkout/zonos-policy-consent/zonos-policy-consent.css +93 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-policy-consent/zonos-policy-consent.js +93 -0
- package/dist/collection/components/store/checkout/paypal.js +57 -14
- package/dist/collection/components/store/checkout/policyConsent.js +58 -0
- package/dist/collection/components/store/checkout/stripe.js +66 -0
- package/dist/collection/components/store/translationStore/strings.arabic.js +21 -0
- package/dist/collection/components/store/translationStore/strings.base.js +21 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +21 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +21 -0
- package/dist/collection/components/store/translationStore/strings.french.js +21 -0
- package/dist/collection/components/store/translationStore/strings.german.js +21 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +21 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +21 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +21 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +21 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +21 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +21 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +21 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +21 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +21 -0
- package/dist/collection/components/store/zonosStore.js +1 -0
- package/dist/collection/types/generated/graphql.internal.types.js +64 -0
- package/dist/esm/{cart-49082718.js → cart-68c16805.js} +125 -5
- package/dist/esm/{debounce-ab526ca0.js → debounce-58e4ff3e.js} +1 -1
- package/dist/esm/{getBorderRadius-98c64be8.js → getBorderRadius-d23f47a6.js} +1 -1
- package/dist/esm/{getContrastColor-0aa643c1.js → getContrastColor-f0bd5b65.js} +2 -2
- package/dist/esm/{hasInclusivePrice-2323d514.js → hasInclusivePrice-f1ca1610.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{invoice-16c688e7.js → invoice-d0eadc6a.js} +3 -3
- package/dist/esm/{isCollectMobileTablet-910aea2e.js → isCollectMobileTablet-11ade63f.js} +3 -3
- package/dist/esm/{isContrastColor-6bad285e.js → isContrastColor-fbddacb6.js} +1 -1
- package/dist/esm/{isDarkColor-0a8453e7.js → isDarkColor-566f04c5.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{localization-33a9f7ff.js → localization-8e81b696.js} +421 -1
- package/dist/esm/{paypal-2e9aa4ba.js → paypal-e32877e9.js} +60 -18
- package/dist/esm/{placeTestOrder-35c9b460.js → placeTestOrder-4cf429d7.js} +2 -2
- package/dist/esm/{renderCheckoutCurrency-b84a6da7.js → renderCheckoutCurrency-9459b8a3.js} +2 -2
- package/dist/esm/{submitGtag-ae9d5d91.js → submitGtag-c7ea1f2a.js} +1 -1
- package/dist/esm/{throttle-882b1f47.js → throttle-f09d0659.js} +2 -2
- package/dist/esm/{updateCheckoutSessionAttributes-da7fdd37.js → updateCheckoutSessionAttributes-40e301a4.js} +1 -1
- package/dist/esm/zonos-address-display_8.entry.js +7 -7
- package/dist/esm/zonos-address_4.entry.js +7 -7
- package/dist/esm/zonos-badge.entry.js +1 -1
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card_5.entry.js +8 -8
- package/dist/esm/zonos-cart-items_12.entry.js +94 -27
- package/dist/esm/zonos-checkbox_2.entry.js +3 -3
- package/dist/esm/zonos-checkout.entry.js +112 -85
- package/dist/esm/zonos-collapse.entry.js +1 -1
- package/dist/esm/zonos-collect-cart-items_3.entry.js +5 -5
- package/dist/esm/zonos-collect-finish_6.entry.js +11 -11
- package/dist/esm/zonos-collect.entry.js +9 -9
- package/dist/esm/zonos-controller.entry.js +6 -6
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +3 -3
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +3 -3
- package/dist/esm/zonos-hello.entry.js +3 -3
- package/dist/esm/zonos-input.entry.js +2 -2
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +7 -7
- package/dist/esm/zonos-invoice-finish_5.entry.js +11 -11
- package/dist/esm/zonos-invoice.entry.js +9 -9
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm/zonos-logo.entry.js +1 -1
- package/dist/esm/{zonos-store-credit.entry.js → zonos-policy-consent_2.entry.js} +91 -7
- package/dist/esm/zonos-shipping-rich-radio.entry.js +5 -5
- package/dist/esm/zonos-stripe-input.entry.js +3 -3
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/zonos-v-stack.entry.js +1 -1
- package/dist/esm/{zonosStore-9662b071.js → zonosStore-8e19daff.js} +1 -0
- package/dist/esm-es5/cart-68c16805.js +1 -0
- package/dist/esm-es5/{debounce-ab526ca0.js → debounce-58e4ff3e.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-98c64be8.js → getBorderRadius-d23f47a6.js} +1 -1
- package/dist/esm-es5/{getContrastColor-0aa643c1.js → getContrastColor-f0bd5b65.js} +1 -1
- package/dist/esm-es5/{hasInclusivePrice-2323d514.js → hasInclusivePrice-f1ca1610.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{invoice-16c688e7.js → invoice-d0eadc6a.js} +1 -1
- package/dist/esm-es5/{isCollectMobileTablet-910aea2e.js → isCollectMobileTablet-11ade63f.js} +1 -1
- package/dist/esm-es5/{isContrastColor-6bad285e.js → isContrastColor-fbddacb6.js} +1 -1
- package/dist/esm-es5/{isDarkColor-0a8453e7.js → isDarkColor-566f04c5.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/localization-8e81b696.js +1 -0
- package/dist/esm-es5/{paypal-2e9aa4ba.js → paypal-e32877e9.js} +2 -2
- package/dist/esm-es5/{placeTestOrder-35c9b460.js → placeTestOrder-4cf429d7.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-b84a6da7.js → renderCheckoutCurrency-9459b8a3.js} +1 -1
- package/dist/esm-es5/{submitGtag-ae9d5d91.js → submitGtag-c7ea1f2a.js} +1 -1
- package/dist/esm-es5/throttle-f09d0659.js +1 -0
- package/dist/esm-es5/{updateCheckoutSessionAttributes-da7fdd37.js → updateCheckoutSessionAttributes-40e301a4.js} +1 -1
- package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- 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_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkbox_2.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-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-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 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -0
- 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-v-stack.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-9662b071.js → zonosStore-8e19daff.js} +1 -1
- package/dist/scripts/index.d.ts +80 -6
- 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-policy-consent/zonos-policy-consent.d.ts +3 -0
- package/dist/types/components/store/checkout/policyConsent.d.ts +41 -0
- package/dist/types/components/store/checkout/stripe.d.ts +13 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +21 -0
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components.d.ts +13 -0
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +23 -6
- package/dist/types/types/checkout/CheckoutConfig.d.ts +23 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
- package/dist/types/types/generated/graphql.internal.types.d.ts +170 -23
- package/dist/types/types/generated/graphql.internal.types.ts +152 -23
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-703fc360.entry.js → p-000b895a.entry.js} +1 -1
- package/dist/zonos-elements/p-01913da8.js +1 -0
- package/dist/zonos-elements/{p-b5a26334.system.entry.js → p-06e7fe2a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-becac995.js → p-0803ad10.js} +1 -1
- package/dist/zonos-elements/{p-79e5a629.system.entry.js → p-0e36a7cf.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-baf0b24c.system.entry.js → p-108b5307.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-029be4a8.entry.js → p-11439d12.entry.js} +1 -1
- package/dist/zonos-elements/{p-b6df4cc2.system.entry.js → p-134c5010.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8d5f413c.system.entry.js → p-1376e67f.system.entry.js} +1 -1
- package/dist/zonos-elements/p-14d6542f.system.js +1 -0
- package/dist/zonos-elements/p-17be8409.entry.js +1 -0
- package/dist/zonos-elements/{p-843ced6c.js → p-17e3cd62.js} +1 -1
- package/dist/zonos-elements/{p-0207c91e.system.js → p-18af6aaa.system.js} +1 -1
- package/dist/zonos-elements/{p-5d823ea7.system.js → p-1eef8c23.system.js} +1 -1
- package/dist/zonos-elements/{p-2c854197.system.entry.js → p-24091606.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6b6cfc59.system.entry.js → p-26ae4ee7.system.entry.js} +1 -1
- package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
- package/dist/zonos-elements/{p-71fb6126.entry.js → p-2afecda7.entry.js} +1 -1
- package/dist/zonos-elements/p-2ccd20c0.system.js +1 -0
- package/dist/zonos-elements/{p-d28be518.js → p-33d4be28.js} +1 -1
- package/dist/zonos-elements/{p-26c85188.entry.js → p-344a1fee.entry.js} +1 -1
- package/dist/zonos-elements/{p-a78bc004.entry.js → p-38311c16.entry.js} +1 -1
- package/dist/zonos-elements/p-3b28fc76.js +1 -0
- package/dist/zonos-elements/{p-db3b101a.js → p-3dc3596b.js} +1 -1
- package/dist/zonos-elements/{p-3689821f.system.js → p-3e7ee89d.system.js} +1 -1
- package/dist/zonos-elements/{p-8570e88a.system.js → p-44b279cc.system.js} +1 -1
- package/dist/zonos-elements/{p-b7e4a020.system.entry.js → p-48805ed6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ab0b23f2.js → p-4df08fc4.js} +1 -1
- package/dist/zonos-elements/p-4fe3d5e0.system.js +18 -0
- package/dist/zonos-elements/{p-90c932fd.entry.js → p-50362897.entry.js} +1 -1
- package/dist/zonos-elements/p-52bd7be3.system.js +1 -0
- package/dist/zonos-elements/{p-deaf0e38.system.entry.js → p-536cbab5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-175c04a4.system.js → p-53a59935.system.js} +1 -1
- package/dist/zonos-elements/{p-cb966d16.system.entry.js → p-593764cf.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-311ba000.system.js → p-5b05b461.system.js} +1 -1
- package/dist/zonos-elements/{p-a49ba3ae.system.entry.js → p-5b4e5608.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1bf9a1b9.system.js → p-5d65be06.system.js} +1 -1
- package/dist/zonos-elements/{p-e850e6e7.system.entry.js → p-5e18d92b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1957af5a.system.entry.js → p-5f92db80.system.entry.js} +1 -1
- package/dist/zonos-elements/p-5fa2395d.system.js +1 -0
- package/dist/zonos-elements/{p-5e1799bc.entry.js → p-620a9013.entry.js} +1 -1
- package/dist/zonos-elements/p-623fc89a.system.entry.js +1 -0
- package/dist/zonos-elements/p-64e8f05d.system.entry.js +1 -0
- package/dist/zonos-elements/{p-2a6be4a5.entry.js → p-658ab5e2.entry.js} +1 -1
- package/dist/zonos-elements/{p-180d3e3d.entry.js → p-673407b8.entry.js} +1 -1
- package/dist/zonos-elements/{p-a1bad0c3.system.entry.js → p-69089a6f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1ec9b3b0.entry.js → p-6f41c193.entry.js} +1 -1
- package/dist/zonos-elements/{p-f3cfd8fa.js → p-701d9a7c.js} +1 -1
- package/dist/zonos-elements/{p-d950b0b4.entry.js → p-7166df08.entry.js} +1 -1
- package/dist/zonos-elements/p-72960738.js +1 -0
- package/dist/zonos-elements/p-72c3756a.js +1 -0
- package/dist/zonos-elements/{p-db5f6b8c.entry.js → p-7628569a.entry.js} +1 -1
- package/dist/zonos-elements/p-774de1ec.system.js +1 -0
- package/dist/zonos-elements/{p-27061873.entry.js → p-777d396e.entry.js} +1 -1
- package/dist/zonos-elements/{p-4f718ef9.system.js → p-7a220941.system.js} +1 -1
- package/dist/zonos-elements/{p-46071125.entry.js → p-7aca66cd.entry.js} +1 -1
- package/dist/zonos-elements/p-7cf8e1f0.js +1 -0
- package/dist/zonos-elements/{p-eb99a625.system.js → p-7d9d2407.system.js} +1 -1
- package/dist/zonos-elements/{p-0ed70279.entry.js → p-7fef8558.entry.js} +1 -1
- package/dist/zonos-elements/{p-7003d093.system.entry.js → p-80df7e0b.system.entry.js} +1 -1
- package/dist/zonos-elements/p-8116d3ba.entry.js +1 -0
- package/dist/zonos-elements/{p-648f3ada.entry.js → p-889a44fc.entry.js} +1 -1
- package/dist/zonos-elements/{p-4c89d04a.js → p-896fb969.js} +1 -1
- package/dist/zonos-elements/{p-1325bbd6.system.entry.js → p-8ddc21f1.system.entry.js} +1 -1
- package/dist/zonos-elements/p-90d22087.system.js +1 -0
- package/dist/zonos-elements/{p-3516340a.system.entry.js → p-95b460e9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-087520f2.system.entry.js → p-95f3bbad.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-71c7a1ff.entry.js → p-97da66f2.entry.js} +1 -1
- package/dist/zonos-elements/{p-55fb4ea3.system.entry.js → p-98bea13e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ba9e2612.system.entry.js → p-990d1495.system.entry.js} +1 -1
- package/dist/zonos-elements/p-9f5fb332.js +1 -0
- package/dist/zonos-elements/{p-ce103c66.system.entry.js → p-a0ee01dd.system.entry.js} +1 -1
- package/dist/zonos-elements/p-ac8cfdc0.js +1 -0
- package/dist/zonos-elements/{p-22ba60f6.system.entry.js → p-af12a1b7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b4b23475.entry.js → p-b35a0b1e.entry.js} +1 -1
- package/dist/zonos-elements/{p-bf5c3dd7.system.entry.js → p-b59fc3fa.system.entry.js} +1 -1
- package/dist/zonos-elements/p-b71ef46e.js +17 -0
- package/dist/zonos-elements/{p-a6db8883.entry.js → p-b93b66c2.entry.js} +1 -1
- package/dist/zonos-elements/p-b9a615bc.system.entry.js +1 -0
- package/dist/zonos-elements/{p-6a195559.system.js → p-bc919de1.system.js} +1 -1
- package/dist/zonos-elements/{p-9e0cb5b3.system.entry.js → p-bc9a30a1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-665bfd4f.entry.js → p-c1463da7.entry.js} +1 -1
- package/dist/zonos-elements/{p-8f9e95c2.entry.js → p-c3459f4a.entry.js} +1 -1
- package/dist/zonos-elements/{p-2a8fcb71.system.entry.js → p-c7ca3e98.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c91fade3.entry.js +1 -0
- package/dist/zonos-elements/{p-79f3c227.system.entry.js → p-c92a5ae5.system.entry.js} +1 -1
- package/dist/zonos-elements/p-cd34ecf2.js +1 -0
- package/dist/zonos-elements/{p-28e2ac3b.entry.js → p-dae881f2.entry.js} +1 -1
- package/dist/zonos-elements/{p-9a5a2043.js → p-dcafbd4e.js} +1 -1
- package/dist/zonos-elements/{p-8571f3ce.entry.js → p-df55536b.entry.js} +1 -1
- package/dist/zonos-elements/{p-01497a20.entry.js → p-e3d6f9b4.entry.js} +1 -1
- package/dist/zonos-elements/{p-928291e5.entry.js → p-e548b8ec.entry.js} +1 -1
- package/dist/zonos-elements/{p-5e6f85f0.system.js → p-f053975e.system.js} +1 -1
- package/dist/zonos-elements/{p-601bb27e.entry.js → p-fc5007e0.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-49082718.js +0 -1
- package/dist/esm-es5/localization-33a9f7ff.js +0 -1
- package/dist/esm-es5/throttle-882b1f47.js +0 -1
- package/dist/esm-es5/zonos-store-credit.entry.js +0 -1
- package/dist/zonos-elements/p-034ab928.system.entry.js +0 -1
- package/dist/zonos-elements/p-07a76716.system.js +0 -1
- package/dist/zonos-elements/p-1f256673.entry.js +0 -1
- package/dist/zonos-elements/p-367a72bc.js +0 -1
- package/dist/zonos-elements/p-3b1b3598.system.js +0 -18
- package/dist/zonos-elements/p-40284821.system.js +0 -1
- package/dist/zonos-elements/p-458df669.js +0 -1
- package/dist/zonos-elements/p-4980facb.js +0 -1
- package/dist/zonos-elements/p-6987f9c9.js +0 -1
- package/dist/zonos-elements/p-6d81901a.js +0 -1
- package/dist/zonos-elements/p-77c2e465.system.js +0 -1
- package/dist/zonos-elements/p-84dbf474.js +0 -17
- package/dist/zonos-elements/p-9b0a6fe5.system.entry.js +0 -1
- package/dist/zonos-elements/p-adb9827c.js +0 -1
- package/dist/zonos-elements/p-b2d276e1.js +0 -1
- package/dist/zonos-elements/p-b6a36c25.system.js +0 -1
- package/dist/zonos-elements/p-c9c17d08.system.entry.js +0 -1
- package/dist/zonos-elements/p-cfb0059f.js +0 -1
- package/dist/zonos-elements/p-e056ae6b.entry.js +0 -1
- package/dist/zonos-elements/p-e3292be8.system.js +0 -1
- package/dist/zonos-elements/p-e5dfccd8.system.js +0 -1
- package/dist/zonos-elements/p-fb712719.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,z as t}from"./p-701d9a7c.js";import{s as o,t as n,l as r,e as s,f as i,b as a}from"./p-01913da8.js";import{l as d,b as l}from"./p-0a377722.js";import{h as c,l as u,f as m,g as p,a as v,s as h,j as y}from"./p-41dd1cb8.js";import{i as w}from"./p-33d4be28.js";import{g as f}from"./p-3dc3596b.js";const g=async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await c(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}},{reset:b,state:S}=e((()=>({amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:!1,isEnabled:!1,orderIdCreated:null,remainingBalance:null,useFullBalance:!0}))),C=()=>{b()},O=e=>{d("Store credit balance from session","info",e),S.availableBalance=e},A=async()=>{var e,t;const{errors:o,json:n}=await g();if(o.length||!n)return void u("Failed to refresh store credit balance");const r=null!==(t=null===(e=n.checkoutSession.customerProfile)||void 0===e?void 0:e.storeCreditBalance)&&void 0!==t?t:null;O(r)},I=async()=>{var e;const t=o.checkoutSessionId;if(!t){const e="No checkout session found";return u(e),S.error=e,{error:e,success:!1}}d("Applying store credit","info",{checkoutSessionId:t}),S.isApplying=!0,S.error=null;try{const{errors:o,json:n}=await c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:t},method:"POST"});if(o.length>0||!n){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}return S.appliedAmount=n.amountApplied,S.remainingBalance=n.remainingBalance,S.isApplying=!1,d("Store credit applied","info",{amountApplied:n.amountApplied,remainingBalance:n.remainingBalance}),{error:null,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}},k=e=>{S.isEnabled=e,S.error=null,e||(S.amountToApply=null)},N=e=>{if(null===e)return S.amountToApply=null,void(S.error=null);e<=0?S.error="Amount must be greater than zero":null!==S.availableBalance&&e>S.availableBalance?S.error="Amount exceeds available balance":e>Ie.total+(Ie.storeCredit||0)?S.error="Amount exceeds order total":(S.error=null,S.amountToApply=e)},T=e=>{if(S.useFullBalance=e,S.error=null,e&&null!==S.availableBalance){const e=Math.min(S.availableBalance,Ie.total+(Ie.storeCredit||0));S.amountToApply=e}else e||(S.amountToApply=null)},j=()=>S.isEnabled&&null!==S.availableBalance?S.useFullBalance?Math.min(S.availableBalance,Ie.total+(Ie.storeCredit||0)):S.amountToApply||0:0,E=()=>null!==S.amountToApply&&S.amountToApply>0&&Ie.storeCredit>0&&Ie.total<=0,P=async()=>{var e,t,n;const r=o.checkoutSessionId;if(!r){const e="No checkout session found";return u(e),S.error=e,{error:e,orderId:null,success:!1}}d("Creating store credit order","info",{checkoutSessionId:r});try{const{errors:o,json:s}=await c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:r},method:"POST"});if(o.length>0||!s){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}const i=(null===(n=null===(t=s.checkoutSessionStoreCreditOrderCreate)||void 0===t?void 0:t.order)||void 0===n?void 0:n.id)||null;return S.orderIdCreated=i,d("Store credit order created","info",{orderId:i}),{error:null,orderId:i,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}},D=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"],L={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"},{reset:x,state:R}=e({accepted:!1,acceptedAt:null,locked:!1,showError:!1}),z=()=>{const e=t.checkoutSettings.merchantPolicyLinks;return e?D.reduce(((t,o)=>{var r,s;const i=null===(s=null===(r=e[o])||void 0===r?void 0:r.link)||void 0===s?void 0:s.trim();return i&&/^https?:\/\//i.test(i)?(t.push({key:o,name:n(L[o]),url:i}),t):t}),[]):[]},U=()=>z().length>0,_=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const r=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=r[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||r.slice(1).join(" ").trim()||""}},F=({currentAddress:e,translatedAddress:t})=>{var o,n,r,s,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:p}=e.value.address,v=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(r=t.line2)||void 0===r?void 0:r[u||""])||u||"",name:(null===(s=t.name)||void 0===s?void 0:s[v])||v,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[p])||p}},B=e=>{var t;const n="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),i=Z.stripeLinkEventData,a=Z.stripeAddressEventData,d=Z.stripeShippingSameAsBilling?Z.stripeAddressEventData:Z.stripeBillingAddressEventData;if(!a||!d)throw new Error("Missing stripe address data");const l=F({currentAddress:a,translatedAddress:Z.translatedAddress.address}),{firstName:c,lastName:u}=_({name:l.name}),m=F({currentAddress:d,translatedAddress:Z.translatedAddress.address}),{firstName:p,lastName:v}=_({name:m.name}),h=s()||"US";return{billingAddress:{addressLine1:m.line1,addressLine2:m.line2||"",city:m.city,country:m.country,postalCode:m.postal_code,state:m.state},billingContact:{firstName:p,lastName:v,phone:m.phone},cartCurrencyCode:null===(t=Ie.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionCountry:h||r.selectedCountryCode||void 0,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:Z.companyName,email:null==i?void 0:i.value.email,firstName:c,lastName:u,phone:l.phone},isTest:!!n,landedCostAdjustments:Ie.promoCode?[{amount:0,productId:null,promoCode:Ie.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:Z.shortAddressCode,shipToTaxId:Z.taxId,shippingAddress:{addressLine1:l.line1,addressLine2:l.line2,city:l.city,country:l.country,postalCode:l.postal_code,state:l.state}}},J=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=Z.stripeLinkEventData,n=Z.stripeAddressEventData,r=Z.stripeShippingSameAsBilling?Z.stripeAddressEventData:Z.stripeBillingAddressEventData;if(d({stripeAddressData:n,stripeBillingAddressData:r},"info"),!n||!r)throw new Error("Missing stripe address data");const s=F({currentAddress:n,translatedAddress:Z.translatedAddress.address}),{firstName:i,lastName:a}=_({name:s.name}),l=F({currentAddress:r,translatedAddress:Z.translatedAddress.address}),{firstName:c,lastName:u}=_({name:l.name}),m=Ie.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),p=Ie.promoCode?[{amount:0,productId:null,promoCode:Ie.promoCode,sku:null,type:"PROMO_CODE"},...m]:m;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:u,phone:l.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:Z.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:a,phone:s.phone},isTest:e,items:Ie.items,landedCostAdjustments:p,shipToShortAddressCode:Z.shortAddressCode,shipToTaxId:Z.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};const M=async e=>{const o=window.Zonos.cartId;if(!o)return await(async e=>{var o;const n=t.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,r,s;const i=J(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:m.vercel},{promoCode:Ie.promoCode});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(r=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===r?void 0:r.message)||"Unknown error"}`);const{errors:d,json:l}=await c("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!l||d.length)throw new Error(`Invalid landed cost object: ${(null===(s=d.find(Boolean))||void 0===s?void 0:s.message)||"Unknown error"}`);return a})(n);return e}const{errors:r,json:s}=await c("/api/zonos-elements/calculate-landed-cost",{body:J(),method:"POST",signal:null==e?void 0:e.signal});if(r.length||!s){if("The user aborted a request."===(null===(o=r[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(r.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!s)throw new Error("Failed to calculate landed cost");return s}return s})(e);const n=await(async({abortController:e,cartId:t})=>{var o,n,r,s,i;const{errors:a,json:d}=await c("/api/zonos-elements/cart-calculate-landed-cost",{body:B(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!d){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(r=a[0])||void 0===r?void 0:r.message.includes("signal is aborted"))||(null===(s=a[0])||void 0===s?void 0:s.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return d})({abortController:e,cartId:o}),{cartWorkflow:r}=n,s=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},s),{itemCreateWorkflow:r.items})},W=async({checkoutSessionId:e,eventName:o,metadata:n})=>{var s,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:e,eventCreated:a,eventName:o});const u=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(s=window.Zonos)||void 0===s?void 0:s.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((p()||v()||u)&&!window.Zonos.zonosConversionTest)return;const m=r.selectedCountryCode,y=t.organizationId;if(!e)return void h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:n,organizationId:y,trackEventLogs:d}});y||h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:n,organizationId:y,trackEventLogs:d}});const w={checkoutSessionId:e,countryCode:m,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},n),{trackEventLogs:d}),organizationId:y};await c("/api/zonos-elements/track-conversion-event",{body:w,method:"POST"})},$=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},q=e=>e.sort(((e,t)=>e.amount-t.amount)),Y=async()=>{var e;const{errors:t,json:o}=await g();return t.length||!o?(u("Failed to retrieve checkout session info before confirming payment ",t),h({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:l}}),{errorMessage:n("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=o.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(u("Landed cost is not found in the checkout session before confirming payment."),h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}}),{errorMessage:n('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},H=({theme:e})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:t.appearance.fontSizeInputValue?`${t.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:t.appearance.fontSizeInputLabel?`${t.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===e?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},K=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:f({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:f({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:G,reset:V,state:Z}=e((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),Q=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},X=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},ee=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return y(e)},te=async e=>{var o,n;const s=Z.clientSecret;if(!Z.stripe)return void d("Skip. Stripe is not initialized");const i=(({clientSecret:e,overrideBorderRadius:o,overridePrimaryColor:n,overrideSecondaryColor:s,overrideTheme:i,paypalEnabled:a})=>{const d=n||t.appearance.colorPrimary,l=s||t.appearance.colorSecondary,c=(window.Zonos.isCollect||window.Zonos.isInvoice?"DARK"===t.appearance.theme:d&&w(d))?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},H({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},K({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:e||void 0,customerSessionClientSecret:Z.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:r.selectedLocale}})({clientSecret:s,overrideBorderRadius:null==e?void 0:e.overrideBorderRadius,overridePrimaryColor:null==e?void 0:e.overridePrimaryColor,overrideSecondaryColor:null==e?void 0:e.overrideSecondaryColor,overrideTheme:null==e?void 0:e.overrideTheme,paypalEnabled:null==e?void 0:e.paypalEnabled}),a=JSON.stringify(i)===JSON.stringify(Z.stripeElementsOptions);if(!Z.stripeElements||!Z.stripeElementsForBillingAddress)return Z.stripeElementsForBillingAddress=null===(o=Z.stripe)||void 0===o?void 0:o.elements(i),d("Stripe elements for billing address initialized"),Z.stripeElements=null===(n=Z.stripe)||void 0===n?void 0:n.elements(i),Z.stripeElementsOptions=i,void d("Stripe elements initialized");a||(Z.stripeElements.update(i),Z.stripeElementsForBillingAddress.update(i),Z.stripeElementsOptions=i,Z.stripeElements.fetchUpdates()),d("Stripe elements updated")},oe=()=>{sessionStorage.removeItem("zonos--client-secret"),V(),Z.stripe=window.Zonos.stripe},ne=({address:e,firstName:t,lastName:n,name:r,phone:s})=>{const{firstName:i,lastName:a}=_({firstName:t,lastName:n,name:r});return i&&a||h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:r}}),s||h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:s}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:s||"",postal_code:e.postal_code,state:e.state}},re=async()=>{var e,t,n,r;if(!(null===(e=Z.stripeAddressEventData)||void 0===e?void 0:e.complete)||!Z.stripeShippingSameAsBilling&&!(null===(t=Z.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!Z.stripeBillingAddressEventData)return{partiesCreated:!1};if(!Ie.landedCostData)return{partiesCreated:!1};const s=null===(n=Ie.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!s)return h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,r,s,i,a;const d=null===(e=Ie.partiesData.find((e=>"DESTINATION"===e.type)))||void 0===e?void 0:e.id,l=null===(t=Ie.partiesData.find((e=>"PAYOR"===e.type)))||void 0===t?void 0:t.id;if(!d||!l)return!1;if(Z.partyShippingId!==d||Z.partyBillingId!==l)return!0;const c=JSON.stringify(null===(o=Z.stripeLinkUsedWhenFetchingLC)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=Z.stripeLinkEventData)||void 0===n?void 0:n.value),u=JSON.stringify(null===(r=Z.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===r?void 0:r.value)!==JSON.stringify(null===(s=Z.stripeAddressEventData)||void 0===s?void 0:s.value),m=!Z.stripeShippingSameAsBilling&&JSON.stringify(null===(i=Z.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===i?void 0:i.value)!==JSON.stringify(null===(a=Z.stripeBillingAddressEventData)||void 0===a?void 0:a.value);return c||u||m||Z.taxIdUsedWhenAsyncAddressUpdate!==Z.taxId||Z.companyNameUsedWhenAsyncAddressUpdate!==Z.companyName})();if(!i)return{partiesCreated:!1};const a=ne({address:Z.stripeAddressEventData.value.address,firstName:Z.stripeAddressEventData.value.firstName,lastName:Z.stripeAddressEventData.value.lastName,name:Z.stripeAddressEventData.value.name,phone:Z.stripeAddressEventData.value.phone}),d=Z.stripeShippingSameAsBilling?a:ne({address:Z.stripeBillingAddressEventData.value.address,firstName:Z.stripeBillingAddressEventData.value.firstName,lastName:Z.stripeBillingAddressEventData.value.lastName,name:Z.stripeBillingAddressEventData.value.name,phone:Z.stripeBillingAddressEventData.value.phone}),m="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:p,json:v}=await c("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:Z.companyName,email:(null===(r=Z.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:m,rootId:s,shortAddressCode:Z.shortAddressCode,taxId:Z.taxId},method:"POST"});return p.length||!v?(u("Error occurs when creating parties",JSON.stringify(p,null,2)),h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:p,json:v}}),{partiesCreated:!1}):(Z.companyNameUsedWhenAsyncAddressUpdate=Z.companyName,Z.stripeAddressUsedWhenAsyncAddressUpdate=Z.stripeAddressEventData,Z.stripeBillingAddressUsedWhenAsyncAddressUpdate=Z.stripeBillingAddressEventData,Z.taxIdUsedWhenAsyncAddressUpdate=Z.taxId,Z.partyBillingId=v.billToPartyId,Z.partyShippingId=v.shipToPartyId,Ie.partiesData=Ie.partiesData.map((e=>"DESTINATION"===e.type&&e.id!==v.shipToPartyId?Object.assign(Object.assign({},e),{id:v.shipToPartyId}):"PAYOR"===e.type&&e.id!==v.billToPartyId?Object.assign(Object.assign({},e),{id:v.billToPartyId}):e)),{partiesCreated:!0})},se=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),ie=async e=>{var n,r,s,i;const a=(null==e?void 0:e.retries)||0,l=!!(null==e?void 0:e.applyingPromocode),c=(()=>{var e;const t=Ie.landedCostData&&(null===(e=Ie.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==Ie.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=Z.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=Z.stripeLinkEventData)||void 0===t?void 0:t.value),n=Z.stripeAddressEventData&&JSON.stringify(se(Z.stripeAddressEventData.value))!==JSON.stringify(Z.stripeAddressUsedWhenFetchingLC),r=!Z.stripeShippingSameAsBilling&&Z.stripeBillingAddressEventData&&JSON.stringify(se(Z.stripeBillingAddressEventData.value))!==JSON.stringify(Z.stripeBillingAddressUsedWhenFetchingLC);return o||n||r})();return d("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!Ie.landedCostData&&!Z.isFetchingLandedCost||o||t})();if(!(()=>{var e,o,n,r;const s=!!(null===(e=Z.stripeLinkEventData)||void 0===e?void 0:e.complete),i=!!(null===(o=Z.stripeAddressEventData)||void 0===o?void 0:o.complete),a=Z.stripeShippingSameAsBilling?i:!!(null===(n=Z.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(e=>{var o,n;const r=null===(o=t.genericSettings)||void 0===o?void 0:o.countryFields,s=null===(n=t.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===Ie.addressFormRenderType&&(s&&e in s?s[e]:null)||(r&&e in r?r[e]:null)})((null===(r=Z.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US");return!!(i&&a&&s)||(d&&Z.stripeAddressEventData?s&&Z.stripeAddressEventData.value.firstName&&Z.stripeAddressEventData.value.lastName&&Z.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&Z.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&Z.stripeAddressEventData.value.address.postal_code.length>=3)&&Z.stripeAddressEventData.value.phone&&Z.stripeAddressEventData.value.phone.length>0:i&&a&&s)})())return{isRequestNotReady:!0};if(c&&(null===(n=Z.fetchingLandedCostAbortController)||void 0===n||n.abort(),Z.fetchingLandedCostAbortController=null),!c&&!l)return{isRequestNotReady:!1};a?(Z.isFetchingLandedCost=!1,setTimeout((()=>{Z.isFetchingLandedCost=!0}),300)):Z.isFetchingLandedCost=!0,Z.stripeAddressEventData&&(Z.stripeAddressUsedWhenFetchingLC={countryCode:Z.stripeAddressEventData.value.address.country,postalCode:Z.stripeAddressEventData.value.address.postal_code,state:Z.stripeAddressEventData.value.address.state}),Z.stripeBillingAddressEventData&&(Z.stripeBillingAddressUsedWhenFetchingLC={countryCode:Z.stripeBillingAddressEventData.value.address.country,postalCode:Z.stripeBillingAddressEventData.value.address.postal_code,state:Z.stripeBillingAddressEventData.value.address.state}),Z.stripeLinkEventData&&(Z.stripeLinkUsedWhenFetchingLC=Object.assign({},Z.stripeLinkEventData));try{Je(),await(async()=>{var e;const t=new AbortController;Z.fetchingLandedCostAbortController=t,Je();const{checkoutSessionWorkflow:n,errors:r,itemCreateWorkflow:s,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await M(t);Ie.customQuotingError=(null===(e=null==r?void 0:r.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,Ie.shippingData=q((null==d?void 0:d.filter(Boolean))||[]),je(s),Z.fetchingLandedCostAbortController=null,Ie.partiesData=(null==a?void 0:a.filter(Boolean))||[],Ie.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&W({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=Ie.promoCodeApplied&&!Ie.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));Ie.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",Ie.promoCode)})();const e=null===(r=Ie.shippingData)||void 0===r?void 0:r.find(Boolean),t=null===(s=Ie.landedCostData)||void 0===s?void 0:s.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&Le({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(t){if(Ie.landedCostData=[],Ie.shippingData=[],t instanceof Error&&t.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(t.message)){if(a<1)return await ie(Object.assign(Object.assign({},e),{retries:(a||0)+1})),{isRequestNotReady:!1};const o=null===(i=Z.stripeAddressEventData)||void 0===i?void 0:i.value;h({endpoint:`Failed to fetch landed cost (${a} retries)`,errors:[t.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}u(t)}return Z.isFetchingLandedCost=!1,{isRequestNotReady:!1}},ae=async()=>{var e,t;await ie({applyingPromocode:!0}),"payment"===Ie.step&&We(),await re();const o=null===(e=Ie.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=Ie.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await _e({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},de=()=>{Ie.promoCode="",sessionStorage.removeItem("zonos--promo-code"),Ie.promoCodeError=!1,Ie.promoCodeApplied=!1},le=async()=>{"payment"===Ie.step&&We(),de(),await ae()},ce=e=>{let t=[],o=!0;const r=window.Zonos.isCollect,s=window.Zonos.isInvoice;switch(e){case"succeeded":t=[n("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",n("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],(r||s)&&(t=[n("Thank you for submitting your payment. We appreciate your prompt attention."),"",n("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]),o=!1;break;case"requires_capture":case"processing":t=[n("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[n("Payment failed. Please try another payment method.")],r&&(t=[n("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[n("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[n("Something went wrong.")]}return{isError:o,messages:t}},ue=async()=>{var e,o;const{onInventoryCheck:r}=t.checkoutSettings,s=!!(null===(o=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(u("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(Z.shouldInventoryRefund=!0,null):null:n("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof r)return null;try{return await r({items:Ie.items},{translate:n,zonosApiRoute:m.vercel})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw h({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Ie.items}}),e}},me=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},pe=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=ce(t);return{error:e,messages:o}}const o=e||Z.clientSecret;if(!Z.stripe||!o)return u("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[n("Something went wrong.")]};const{paymentIntent:r}=await Z.stripe.retrievePaymentIntent(o),s=null==r?void 0:r.status,{isError:i,messages:a}=ce(s);return{amount:null==r?void 0:r.amount,currency:null==r?void 0:r.currency,error:i,messages:a,paymentIntentId:null==r?void 0:r.id,paymentMethod:null==r?void 0:r.payment_method,status:s}},ve=async e=>{var t,r;const s=!!(null===(t=Z.stripePaymentEventData)||void 0===t?void 0:t.complete),i=Z.stripeElements,a=Z.stripe,l=Z.clientSecret;if(Z.customErrorMessage=null,!(null===(r=Ie.selectedLandedCost)||void 0===r?void 0:r.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const c=await Y();if(!c.valid)throw Z.customErrorMessage=c.errorMessage,new Error(c.errorMessage);const u=o.checkoutSessionId;if(a&&i&&s&&l&&u){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",l),e.searchParams.set("zonosCheckoutSessionId",u),W({checkoutSessionId:u,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await a.confirmPayment({confirmParams:{return_url:e.toString()},elements:i,redirect:"if_required"});if(d("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(n("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(n("Payment failed. Please try another payment method."))}},he=()=>{var e;const t=Ie.items.reduce(((e,t)=>e+t.amount*t.quantity),0),n=o.enabledVariantTestKeys||[];return{adjustmentsAmount:Ie.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=Ie.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:Ie.customerAuthenticationToken||void 0,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:t,metadata:[{key:"language",value:r.selectedLocale}],presentmentCountryCode:r.selectedCountryCode,skipPaymentIntent:Z.skipPaymentIntent,varianceTestInput:n}},ye=async()=>{var e;if(!o.checkoutSessionId)return h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}}),void De({messages:[n("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:n("Error creating Checkout")});const{errors:t,json:r}=await c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==r?void 0:r.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return u("Error occurs when getting payment intent",JSON.stringify(t,null,2)),h({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void De({messages:[n("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:n("Error creating Checkout")});Re(r.checkoutSessionPaymentIntentCreate)},we=async()=>{var e,t;if(!r.targetCurrency)return u("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;Z.isFetchingSession=!0;const o=he();d("Checkout session body","info",o);const{errors:n,json:s}=await c("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(Z.isFetchingSession=!1,n.length||!s){const t=null===(e=n.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return u("Error occurred when creating checkout session",JSON.stringify(n,null,2)),!1}const i=s.checkoutSessionCreate;return Re(i),Le({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),d("Exchange rate updated for cart items (checkout session create)","info",Ie.exchangeRate),d("done-init-checkout-session"),!0},fe=async()=>{const e=o.checkoutSessionId;if(!e)return u("Failed to update checkout session base currency"),!1;if("LOCAL"===t.checkoutSettings.allowedSettlementCurrencies)return d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:Z.checkoutSettlementCurrency},method:"POST"}),r=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&r===Z.checkoutSettlementCurrency?(d(`Updated checkout session to settlement currency "${r}".`),!0):(u("Failed to update checkout session base currency"),!1)},ge=async({adjustmentsAmount:e,cartId:t,currency:n,id:s,itemsAmount:i,landedCostId:a,presentmentCountryCode:d,storeCreditApplication:l})=>{const m=o.enabledVariantTestKeys||[],{errors:p,json:v}=await c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:Z.partyBillingId,cartId:t,currency:n,customerAuthenticationToken:Ie.customerAuthenticationToken||void 0,id:s,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:r.selectedLocale}],presentmentCountryCode:d,shipToPartyId:Z.partyShippingId,skipPaymentIntent:Z.skipPaymentIntent,storeCreditApplication:l,varianceTestInput:m},method:"POST"});return p.length||!v?(u("Error occurs when updating checkout session",JSON.stringify(p,null,2)),{errors:p,json:v}):{errors:[],json:v}},be=async()=>{const e=(()=>{if(!R.accepted)return null;const e=z();return e.length?{key:"merchantPolicyConsent",value:JSON.stringify({acceptedAt:R.acceptedAt||(new Date).toISOString(),locale:r.selectedLocale,policies:e.reduce(((e,t)=>(e[t.key]=t.url,e)),{})})}:null})();if(!e)return{errors:[]};if(!o.checkoutSessionId)return{errors:[]};const{errors:t}=await c("/api/zonos-elements/update-checkout-session-metadata",{body:{id:o.checkoutSessionId,metadata:[e]},method:"POST"});return t.length?(u("Failed to record merchant policy consent on checkout session",JSON.stringify(t,null,2)),{errors:t.map((e=>e.message||"Unknown error"))}):{errors:[]}},Se=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:r,line2:s,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&r&&(o.line1={[e.line1]:r}),e.line2&&s&&(o.line2={[e.line2]:s}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},Ce=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,r,s;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:r})=>{const s=!!(null==o?void 0:o.complete);if(!s||!(r?s:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=_({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=_({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),p=u&&m?`${u} ${m}`:"",v=i.address,h=null==a?void 0:a.address;return{address:$({address:Object.assign(Object.assign({},v),{name:c}),invalidAdddressList:e}),billingAddress:r?void 0:$({address:h?Object.assign(Object.assign({},h),{name:p}):null,invalidAdddressList:t}),destinationCountry:v.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:Z.stripeAddressEventData,stripeBillingAddressEventData:Z.stripeBillingAddressEventData,stripeShippingSameAsBilling:Z.stripeShippingSameAsBilling});if(!i)return void(Z.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const r=JSON.stringify(null===(e=Z.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=Z.stripeAddressEventData)||void 0===t?void 0:t.value),s=!Z.stripeShippingSameAsBilling&&JSON.stringify(null===(o=Z.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=Z.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return r||s})();if(!a)return;const{errors:d,json:l}=await c("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!l)return u("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(Z.translatedAddress={address:{},billingAddress:{}});Z.stripeAddressUsedWhenValidatingAddress=Z.stripeAddressEventData,Z.stripeBillingAddressUsedWhenValidatingAddress=Z.stripeBillingAddressEventData;const m=null===(o=Z.stripeAddressEventData)||void 0===o?void 0:o.value.address,p=null===(n=Z.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;Z.translatedAddress={address:m?Se({currentAddress:Object.assign(Object.assign({},m),{name:null===(r=Z.stripeAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:l.address||null}):{},billingAddress:Z.stripeShippingSameAsBilling?{}:Se({currentAddress:Object.assign(Object.assign({},p),{name:null===(s=Z.stripeBillingAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:l.billingAddress||null})}};G("clientSecret",(e=>{e&&Z.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:Oe,reset:Ae,state:Ie}=e((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:v(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),ke=e=>{switch(e){case"DAYS":return n("days");case"WEEKS":return n("weeks");default:return n("business days")}},Ne=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:ke(o.type)}:null},Te=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),je=e=>{d("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=Ie.items.find((t=>Te({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return Ie.restrictedItems=t,Ie.items=Ie.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>Te({item1:t,item2:e})))}))),{cartItems:Ie.items,restrictedItems:t}};let Ee=null;const Pe=()=>{o.checkoutSessionId=null,Ee&&(clearTimeout(Ee),Ee=null),C(),Ae()},De=({messages:e,title:t})=>{Pe(),oe(),Ie.step="error",Ie.error={messages:e,title:t}},Le=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{var n;Ie.exchangeRate=o.exchangeRate,Ie.adjustmentTotal=o.adjustments,Ie.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,Ie.storeCredit=null!==(n=o.storeCredit)&&void 0!==n?n:0,Ie.subtotal=o.items,Ie.total=o.total,Ie.currency=o.presentmentCurrencyCode,Ie.dutiesTaxesFeesEstimate=e||null},xe=()=>!!Ie.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),Re=e=>{var t,n,r,s,c,u,m;Z.clientSecret=e.clientSecret,Z.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,Z.customerProfile=e.customerProfile,Ie.checkoutSession=e,O(null!==(n=null===(t=e.customerProfile)||void 0===t?void 0:t.storeCreditBalance)&&void 0!==n?n:null),e.id||h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const p=i(e.varianceTestResults||[]);a(p);const v=(null===(c=null===(s=null===(r=Ie.checkoutSession)||void 0===r?void 0:r.metadata)||void 0===s?void 0:s.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===c?void 0:c.value)||(null===(m=null===(u=window.Zonos.cartData)||void 0===u?void 0:u.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===m?void 0:m.value)||null;v&&(d(`Found externalConfirmationPageURL: ${v}`),Ie.externalConfirmationPageURL=v)},ze=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:i,itemsAmount:a,landedCostId:l,shouldInitSessionOnFailure:c})=>{var m;if(l&&Ie.selectedLandedCost&&(Le({dutiesTaxesFeesEstimate:i,method:Ie.landedCostMethod,subtotals:Ie.selectedLandedCost.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",Ie.exchangeRate)),!o.checkoutSessionId)return d("Could not update cart total without checkout session id","info"),!1;const{errors:p,json:v}=await ge({adjustmentsAmount:e,billToPartyId:Z.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:l,presentmentCountryCode:r.selectedCountryCode,shipToPartyId:Z.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(p.length>0||!v){if(u("Error occurs when updating checkout session."),c){d("Initiating checkout session on failure","info");const e=await we();return d(`stripeStoreInitCheckoutSession: ${e}`),!!e||(De({messages:[n("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:n("Error creating Checkout")}),!1)}return!1}return l||(Le({method:(null===(m=v.checkoutSessionUpdate.landedCost)||void 0===m?void 0:m.method)||"DDP",subtotals:v.checkoutSessionUpdate.subtotals}),d("Exchange rate updated for cart items (checkout session update)","info",Ie.exchangeRate)),Re(v.checkoutSessionUpdate),!0},Ue=e=>{var o,n,r;return"DAP"===e.method&&(null===(n=null===(o=t.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(r=Z.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US"))||"DAP"===e.method&&e.remittance.length&&"ZONOS"===e.landedCostGuaranteeCode?"DDP":e.method},_e=async({applySubtotalsOnly:e,landedCostId:n,selectedShippingOption:r})=>{var s,i,a,l,c,u,m,p,v,h,y;d("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:r}),Ie.selectedShippingOption=r;const w=Ne(Ie.selectedShippingOption);if(w){const{maxTransit:e,minTransit:t,unit:o}=w;Ie.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else Ie.selectedShippingOptionTransitTime="";const f=null===(s=Ie.landedCostData)||void 0===s?void 0:s.find((e=>e.landedCostId===n));if(Ie.selectedLandedCost=f||null,!f)return!1;const g=((null===(i=f.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*f.subtotals.exchangeRate.rate;g&&d(`DAP quote, using estimate: ${g}`,"info"),Ie.landedCostMethod=Ue(f.landedCost),Ie.shipping=f.subtotals.shipping;const b="ZONOS"===(null===(a=null==f?void 0:f.landedCost)||void 0===a?void 0:a.landedCostGuaranteeCode),S=!!(null===(c=null===(l=null==f?void 0:f.landedCost)||void 0===l?void 0:l.deMinimis)||void 0===c?void 0:c.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));Ie.isSelectedShippingAboveDeminimis=S,Ie.isSelectedShippingGuarantee=b;let C=!1;e?(Le({dutiesTaxesFeesEstimate:g,method:Ie.landedCostMethod,subtotals:f.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",Ie.exchangeRate),C=!0):C=await ze({adjustmentsAmount:Ie.adjustmentTotal,billToPartyId:Z.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:g,landedCostId:null===(u=f.landedCost)||void 0===u?void 0:u.id,shipToPartyId:Z.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(m=Ie.items.find(Boolean))||void 0===m?void 0:m.currencyCode,A=(null===(p=Z.stripeAddressEventData)||void 0===p?void 0:p.value.address.country)||"US";return Z.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===t.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(v=Ie.checkoutSession)||void 0===v?void 0:v.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(h=t.genericSettings)||void 0===h?void 0:h.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},Fe=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;d(`==START CHECKOUT TIMEOUT - ${n}==`),Ie.checkoutTimeoutInterval=setTimeout((()=>{Ie.checkoutSessionTimeoutShow=!0}),n)},Be=()=>{Ie.checkoutTimeoutInterval&&(clearTimeout(Ie.checkoutTimeoutInterval),Ie.checkoutTimeoutInterval=null)},Je=()=>{Ie.items=Ie.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),Ie.restrictedItems=[]},Me=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:r=!0})=>{var s;Ie.adjustments=e,Ie.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(s=t.find(Boolean))||void 0===s?void 0:s.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(Ie.currency=i,Z.isFetchingSession=!0,await ze({adjustmentsAmount:d,billToPartyId:Z.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:Z.partyShippingId,shouldInitSessionOnFailure:r,varianceTestInput:o.enabledVariantTestKeys||[]}),Z.isFetchingSession=!1)},We=()=>{"shipping"===Ie.step?(Ie.step="customer-info",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{"customer-info":Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!1})})):"payment"===Ie.step?(Ie.step="shipping",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{shipping:Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!1})})):"finish"===Ie.step&&(Ie.step="payment",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{payment:Object.assign(Object.assign({},Ie.tabItems.payment),{isDone:!1})}))},$e=()=>{"customer-info"===Ie.step?(Ie.step="shipping",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{"customer-info":Object.assign(Object.assign({},Ie.tabItems["customer-info"]),{isDone:!0})})):"shipping"===Ie.step?(Ie.step="payment",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{shipping:Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!0})})):"payment"===Ie.step&&(Ie.step="finish")},qe=()=>{Ie.step="customer-info",Ie.tabItems=Object.assign(Object.assign({},Ie.tabItems),{"customer-info":Object.assign(Object.assign({},Ie.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},Ie.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},Ie.tabItems.shipping),{isDone:!1})}),Ie.selectedShippingOption=null,Ie.isSelectedShippingAboveDeminimis=!1,Ie.isSelectedShippingGuarantee=!1,Ie.selectedShippingOptionTransitTime="",Ie.dutiesTaxesFees=0,Ie.dutiesTaxesFeesEstimate=0,Ie.shipping=0,Ie.total=Ie.subtotal},Ye=()=>{Ee&&clearTimeout(Ee),Ee=setTimeout((()=>{Ee=null,(async()=>{var e,t;if(!o.checkoutSessionId)return void d("Could not update store credit without checkout session id","info");const n=Ie.selectedLandedCost,s=Ie.currency||(null===(e=Ie.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",i=Ie.adjustments.reduce(((e,t)=>e+t.amount),0),a=Ie.items.reduce(((e,t)=>e+t.amount*t.quantity),0),{errors:l,json:c}=await ge({adjustmentsAmount:i,cartId:window.Zonos.cartId,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:null==n?void 0:n.landedCostId,presentmentCountryCode:r.selectedCountryCode,storeCreditApplication:S.isEnabled&&null!==S.amountToApply?S.useFullBalance?{mode:"FULL"}:{amount:S.amountToApply,mode:"PARTIAL"}:{mode:"NONE"}});l.length>0||!c?u("Error updating checkout session with store credit"):(Le({method:(null===(t=c.checkoutSessionUpdate.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals}),Re(c.checkoutSessionUpdate))})()}),300)};export{T as $,Y as A,P as B,ve as C,me as D,R as E,oe as F,Oe as G,G as H,j as I,be as J,ne as K,_e as L,xe as M,ae as N,le as O,de as P,ce as Q,S as R,C as S,Ce as T,_ as U,re as V,Ne as W,Ue as X,q as Y,z as Z,k as _,X as a,Ye as a0,N as a1,A as a2,Z as b,pe as c,Ie as d,Me as e,Pe as f,qe as g,Be as h,te as i,we as j,ye as k,Fe as l,he as m,De as n,Q as o,x as p,Re as q,ie as r,ee as s,W as t,$e as u,U as v,fe as w,ue as x,I as y,E as z}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,h as s,a as t,g as i}from"./p-ce75b047.js";import{l as a}from"./p-
|
|
1
|
+
import{r as o,h as s,a as t,g as i}from"./p-ce75b047.js";import{l as a}from"./p-01913da8.js";import{f as n}from"./p-701d9a7c.js";import{c as e}from"./p-b4b7f705.js";import"./p-41dd1cb8.js";import"./p-0a377722.js";const h=class{constructor(s){o(this,s),this.countryCode=a.selectedCountryCode}render(){if(!this.el.shadowRoot||!this.countryCode)return null;const o=`https://zonos-store-assets.s3.amazonaws.com/images/elements-flags/${this.countryCode}.svg`,i=n();return s(t,{class:"zonos--elements",style:this.size?{"--zonos--font-family":i,height:`${this.size}px`,width:`${this.size}px`}:{"--zonos--font-family":i}},s("div",{class:e(["flag-container"])},s("div",{class:"flag-icon",style:{backgroundImage:`url(${o})`}})))}get el(){return i(this)}};h.style=":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}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";export{h as zonos_country_flag}
|