@zonos/elements 1.3.285 → 1.3.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/cjs/RemoveIcon-CuM1YmjP.js +5 -0
- package/dist/cjs/{cart-94908542.js → cart-CV4buPlT.js} +43 -30
- package/dist/cjs/{collect-0c05e2b4.js → collect-jzWKzrV7.js} +17 -113
- package/dist/cjs/debounce-5sZmmlCI.js +9 -0
- package/dist/cjs/debounce-Nu2lJW4A.js +405 -0
- package/dist/cjs/{formatStringWithLinks-c25b4018.js → formatStringWithLinks-vOVkAjlu.js} +1 -1
- package/dist/cjs/{getBorderRadius-97fd5e02.js → getBorderRadius-DGZiQu09.js} +1 -1
- package/dist/cjs/{getContrastColor-956dfaf7.js → getContrastColor-B2Kn8XHA.js} +2 -2
- package/dist/cjs/{getMissingRequiredShippingFields-124b3f20.js → getMissingRequiredShippingFields-r5vYIqoX.js} +1 -1
- package/dist/cjs/{handleFetch-954f30e1.js → handleFetch-DQLhurnE.js} +4 -3
- package/dist/cjs/{hasInclusivePrice-d0cd2007.js → hasInclusivePrice-BZMQohG9.js} +1 -1
- package/dist/cjs/{helpers-5bdbb68c.js → helpers-ClOZ11A9.js} +0 -3
- package/dist/cjs/{index-b1f95d96.js → index-DAAr465v.js} +1252 -580
- package/dist/cjs/index.cjs.js +17 -21
- package/dist/cjs/{invoice-205fb5bc.js → invoice-CHw-mJdS.js} +6 -6
- package/dist/cjs/{isContrastColor-30f84a91.js → isContrastColor-B9ldIdpa.js} +1 -1
- package/dist/cjs/isDarkColor-f-fD9c2l.js +1187 -0
- package/dist/cjs/loader.cjs.js +3 -5
- package/dist/cjs/{localization-fb2ece37.js → localization-CxXsmxs5.js} +4 -4
- package/dist/cjs/{paypal-45ca5301.js → paypal-BLuHeOJH.js} +10 -9
- package/dist/cjs/{placeTestOrder-302b6862.js → placeTestOrder-VK_CMeq0.js} +3 -3
- package/dist/cjs/{renderCheckoutCurrency-1b0cd5f2.js → renderCheckoutCurrency-CC4CAy-a.js} +2 -2
- package/dist/cjs/{renderFallback-bc20ee20.js → renderFallback-Bme86uk8.js} +1 -1
- package/dist/cjs/{shouldRenderTaxIdInput-7d19556c.js → shouldRenderTaxIdInput-TxekHCp7.js} +2 -2
- package/dist/cjs/{shouldShowLanguageSelect-82985128.js → shouldShowLanguageSelect-Bj_jKWPK.js} +1 -1
- package/dist/cjs/{submitGtag-8a25f001.js → submitGtag-CcEL-w5D.js} +3 -3
- package/dist/cjs/throttle-BcxGntLr.js +87 -0
- package/dist/cjs/{updateCheckoutSessionAttributes-de7b1466.js → updateCheckoutSessionAttributes-Dltl5RBx.js} +3 -3
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +644 -692
- package/dist/cjs/zonos-address-display_2.cjs.entry.js +13 -17
- package/dist/cjs/zonos-address_4.cjs.entry.js +50 -40
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +15 -16
- package/dist/cjs/zonos-badge.cjs.entry.js +7 -10
- package/dist/cjs/zonos-banner.cjs.entry.js +6 -9
- package/dist/cjs/zonos-button_3.cjs.entry.js +18 -21
- package/dist/cjs/zonos-card_5.cjs.entry.js +34 -35
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +101 -87
- package/dist/cjs/zonos-checkbox_2.cjs.entry.js +10 -14
- package/dist/cjs/zonos-checkout.cjs.entry.js +151 -37
- package/dist/cjs/zonos-collapse.cjs.entry.js +5 -8
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +18 -23
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +59 -55
- package/dist/cjs/zonos-collect.cjs.entry.js +20 -23
- package/dist/cjs/zonos-component.cjs.entry.js +3 -6
- package/dist/cjs/zonos-controller.cjs.entry.js +13 -16
- package/dist/cjs/zonos-country-flag.cjs.entry.js +8 -11
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +68 -57
- package/dist/cjs/zonos-elements.cjs.js +7 -7
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +22 -23
- package/dist/cjs/zonos-hello.cjs.entry.js +19 -17
- package/dist/cjs/zonos-input.cjs.entry.js +10 -11
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +17 -21
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +57 -52
- package/dist/cjs/zonos-invoice.cjs.entry.js +19 -22
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +11 -15
- package/dist/cjs/zonos-link.cjs.entry.js +3 -6
- package/dist/cjs/zonos-logo.cjs.entry.js +6 -9
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +15 -19
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +11 -14
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +15 -14
- package/dist/cjs/zonos-text.cjs.entry.js +8 -11
- package/dist/cjs/zonos-tooltip.cjs.entry.js +4 -7
- package/dist/cjs/zonos-v-stack.cjs.entry.js +6 -9
- package/dist/cjs/zonosStore-BCNYr6Tk.js +3808 -0
- package/dist/collection/__tests__/jsxWithChildren.types.js +13 -0
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-completion-dialog/zonos-address-completion-dialog.js +13 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.js +4 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.js +8 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.js +17 -13
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +21 -9
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +7 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +5 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +8 -8
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-empty-state-payment/zonos-empty-state-payment.js +5 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/zonos-store-credit.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +121 -18
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +13 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +7 -7
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +8 -6
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.js +6 -5
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.js +4 -4
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +7 -7
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.js +3 -3
- package/dist/collection/components/checkout/zonos-collect/zonos-collect.js +2 -2
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.js +1 -1
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +8 -6
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.js +6 -5
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.js +4 -4
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +7 -7
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.js +3 -3
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.js +1 -1
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.js +2 -2
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +8 -7
- package/dist/collection/components/common/zonos-banner/zonos-banner.js +4 -4
- package/dist/collection/components/common/zonos-button/zonos-button.js +29 -25
- package/dist/collection/components/common/zonos-card/zonos-card.js +9 -8
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +15 -12
- package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +9 -6
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
- package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +15 -15
- package/dist/collection/components/common/zonos-country-flag/zonos-country-flag.js +6 -5
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +22 -21
- package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +3 -2
- package/dist/collection/components/common/zonos-icon/zonos-icon.js +8 -7
- package/dist/collection/components/common/zonos-input/zonos-input.js +7 -7
- package/dist/collection/components/common/zonos-link/zonos-link.js +7 -7
- package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +4 -4
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +4 -3
- package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +8 -7
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +1 -1
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +15 -12
- package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +2 -2
- package/dist/collection/components/common/zonos-spinner/zonos-spinner.js +3 -3
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +17 -17
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +23 -20
- package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +19 -19
- package/dist/collection/components/common/zonos-text/zonos-text.js +15 -11
- package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +4 -3
- package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +3 -2
- package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +7 -6
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +3 -3
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +16 -12
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +3 -2
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +14 -11
- package/dist/collection/components/main/zonos-controller.js +18 -10
- package/dist/collection/components/store/checkout/cart.js +14 -1
- package/dist/collection/components/store/checkout/stripe.js +1 -1
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +9 -8
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +6 -4
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +13 -10
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +4 -4
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +2 -2
- package/dist/collection/components/utils/checkout/isEuDapRemittance.js +1 -1
- package/dist/collection/components/utils/checkout/shouldRenderTaxIdInput.js +1 -1
- package/dist/collection/components/utils/validateCheckoutSession.js +11 -3
- package/dist/collection/scripts/cart/_setupCartData.js +2 -2
- package/dist/collection/scripts/cart/_setupCartDataWithSettings.js +2 -2
- package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
- package/dist/collection/types/generated/graphql.internal.types.js +76 -6
- package/dist/esm/RemoveIcon-C2QMVeWW.js +3 -0
- package/dist/esm/{cart-2e407f7b.js → cart-ekBk_gxV.js} +42 -31
- package/dist/esm/{collect-19428e18.js → collect-33rMINDo.js} +17 -113
- package/dist/esm/debounce-D4ko2kvZ.js +403 -0
- package/dist/esm/debounce-DWPsxJsW.js +7 -0
- package/dist/esm/{formatStringWithLinks-0d48f183.js → formatStringWithLinks-BcMPqGl0.js} +1 -1
- package/dist/esm/{getBorderRadius-1f7be586.js → getBorderRadius-HwG64EKM.js} +1 -1
- package/dist/esm/{getContrastColor-4c0ae8c1.js → getContrastColor-CfCPlW9U.js} +2 -2
- package/dist/esm/{getMissingRequiredShippingFields-719b206f.js → getMissingRequiredShippingFields-u1nhQzJ1.js} +1 -1
- package/dist/esm/{handleFetch-a844cac1.js → handleFetch-D5GYDF-O.js} +4 -3
- package/dist/esm/{hasInclusivePrice-d801be22.js → hasInclusivePrice-CAVXi310.js} +1 -1
- package/dist/esm/{helpers-2f6955b1.js → helpers-DJIdCwJ5.js} +0 -3
- package/dist/esm/{index-cfd394c8.js → index-_lt63o7c.js} +1253 -561
- package/dist/esm/index.js +20 -22
- package/dist/esm/{invoice-67a47785.js → invoice-BNDWuVsD.js} +6 -6
- package/dist/esm/{isContrastColor-9fa0d013.js → isContrastColor-CWLU13s9.js} +1 -1
- package/dist/esm/isDarkColor-YdrG78th.js +1184 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{localization-36a4dc22.js → localization-AOqYXGdP.js} +5 -5
- package/dist/esm/{paypal-6dca6567.js → paypal-CW1D2XqZ.js} +10 -9
- package/dist/esm/{placeTestOrder-9563c89a.js → placeTestOrder-nhmsLLOA.js} +3 -3
- package/dist/esm/{renderCheckoutCurrency-282384f0.js → renderCheckoutCurrency-BQANmZyM.js} +2 -2
- package/dist/esm/{renderFallback-b250f4e9.js → renderFallback-Cy03ZcWE.js} +1 -1
- package/dist/esm/{shouldRenderTaxIdInput-ef7b5860.js → shouldRenderTaxIdInput-CKyZ6Zni.js} +2 -2
- package/dist/esm/{shouldShowLanguageSelect-328f50e2.js → shouldShowLanguageSelect-BQFCXouB.js} +1 -1
- package/dist/esm/{submitGtag-71c450b6.js → submitGtag-CCGQS060.js} +4 -4
- package/dist/esm/throttle-D5GyA3yr.js +85 -0
- package/dist/esm/{updateCheckoutSessionAttributes-23b222de.js → updateCheckoutSessionAttributes-eRSqdC74.js} +3 -3
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +644 -690
- package/dist/esm/zonos-address-display_2.entry.js +13 -15
- package/dist/esm/zonos-address_4.entry.js +50 -38
- package/dist/esm/zonos-airwallex-payment.entry.js +15 -14
- package/dist/esm/zonos-badge.entry.js +7 -8
- package/dist/esm/zonos-banner.entry.js +6 -7
- package/dist/esm/zonos-button_3.entry.js +18 -19
- package/dist/esm/zonos-card_5.entry.js +34 -33
- package/dist/esm/zonos-cart-items_12.entry.js +101 -85
- package/dist/esm/zonos-checkbox_2.entry.js +10 -12
- package/dist/esm/zonos-checkout.entry.js +151 -35
- package/dist/esm/zonos-collapse.entry.js +5 -6
- package/dist/esm/zonos-collect-cart-items_3.entry.js +18 -21
- package/dist/esm/zonos-collect-finish_6.entry.js +59 -53
- package/dist/esm/zonos-collect.entry.js +20 -21
- package/dist/esm/zonos-component.entry.js +3 -4
- package/dist/esm/zonos-controller.entry.js +13 -14
- package/dist/esm/zonos-country-flag.entry.js +8 -9
- package/dist/esm/zonos-country-select_4.entry.js +68 -55
- package/dist/esm/zonos-elements.js +6 -5
- package/dist/esm/zonos-hello-dialog.entry.js +22 -21
- package/dist/esm/zonos-hello.entry.js +19 -15
- package/dist/esm/zonos-input.entry.js +10 -9
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +17 -19
- package/dist/esm/zonos-invoice-finish_5.entry.js +57 -50
- package/dist/esm/zonos-invoice.entry.js +19 -20
- package/dist/esm/zonos-language-select_2.entry.js +11 -13
- package/dist/esm/zonos-link.entry.js +3 -4
- package/dist/esm/zonos-logo.entry.js +6 -7
- package/dist/esm/zonos-policy-consent_2.entry.js +15 -17
- package/dist/esm/zonos-shipping-rich-radio.entry.js +11 -12
- package/dist/esm/zonos-stripe-input.entry.js +15 -12
- package/dist/esm/zonos-text.entry.js +8 -9
- package/dist/esm/zonos-tooltip.entry.js +4 -5
- package/dist/esm/zonos-v-stack.entry.js +6 -7
- package/dist/esm/zonosStore-DrIOAz4M.js +3795 -0
- package/dist/esm-es5/{CheckoutConfig-724d7bae.js → CheckoutConfig-D5SpFsQJ.js} +5 -1
- package/dist/esm-es5/VarianceTest-BJmZPrZl.js +9 -0
- package/dist/esm-es5/{buildCartItemsByTempCart-a117f75d.js → buildCartItemsByTempCart-BycjkdlE.js} +4 -0
- package/dist/esm-es5/cart-ekBk_gxV.js +517 -0
- package/dist/esm-es5/classes-BJHSB96f.js +10 -0
- package/dist/esm-es5/cleanHtmlMarkdown-ByGDytaN.js +191 -0
- package/dist/esm-es5/collect-33rMINDo.js +241 -0
- package/dist/esm-es5/containsNonLatinChars-C04AWRC2.js +11 -0
- package/dist/esm-es5/createCustomEvent-XQfWgQLB.js +6 -0
- package/dist/esm-es5/debounce-D4ko2kvZ.js +153 -0
- package/dist/esm-es5/debounce-DWPsxJsW.js +1 -0
- package/dist/esm-es5/formatStringWithLinks-BcMPqGl0.js +8 -0
- package/dist/esm-es5/getBorderRadius-HwG64EKM.js +8 -0
- package/dist/esm-es5/getContrastColor-CfCPlW9U.js +14 -0
- package/dist/esm-es5/getGenericSettingsOverride-HeAZDwVW.js +4 -0
- package/dist/esm-es5/getMissingRequiredShippingFields-u1nhQzJ1.js +20 -0
- package/dist/esm-es5/handleFetch-D5GYDF-O.js +60 -0
- package/dist/esm-es5/hasInclusivePrice-CAVXi310.js +6 -0
- package/dist/esm-es5/helpers-DJIdCwJ5.js +23 -0
- package/dist/esm-es5/index-_lt63o7c.js +162 -0
- package/dist/esm-es5/index.js +227 -1
- package/dist/esm-es5/invoice-BNDWuVsD.js +13 -0
- package/dist/esm-es5/isColorVariable-DXXUq2Lv.js +11 -0
- package/dist/esm-es5/isContrastColor-CWLU13s9.js +5 -0
- package/dist/esm-es5/isDarkColor-YdrG78th.js +204 -0
- package/dist/esm-es5/isSameHostCheckoutLink-BxAHnL5J.js +16 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/localization-AOqYXGdP.js +332 -0
- package/dist/esm-es5/paypal-CW1D2XqZ.js +192 -0
- package/dist/esm-es5/placeTestOrder-nhmsLLOA.js +1 -0
- package/dist/esm-es5/renderCheckoutCurrency-BQANmZyM.js +13 -0
- package/dist/esm-es5/{renderFallback-b250f4e9.js → renderFallback-Cy03ZcWE.js} +1 -1
- package/dist/esm-es5/shouldRenderTaxIdInput-CKyZ6Zni.js +17 -0
- package/dist/esm-es5/shouldShowLanguageSelect-BQFCXouB.js +7 -0
- package/dist/esm-es5/styles-BTIeCf3T.js +6 -0
- package/dist/esm-es5/submitGtag-CCGQS060.js +45 -0
- package/dist/esm-es5/throttle-D5GyA3yr.js +46 -0
- package/dist/esm-es5/updateCheckoutSessionAttributes-eRSqdC74.js +8 -0
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +2966 -1
- package/dist/esm-es5/zonos-address-display_2.entry.js +46 -1
- package/dist/esm-es5/zonos-address_4.entry.js +179 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +49 -1
- package/dist/esm-es5/zonos-badge.entry.js +25 -1
- package/dist/esm-es5/zonos-banner.entry.js +7 -1
- package/dist/esm-es5/zonos-button_3.entry.js +116 -1
- package/dist/esm-es5/zonos-card_5.entry.js +33 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +666 -1
- package/dist/esm-es5/zonos-checkbox_2.entry.js +21 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1043 -1
- package/dist/esm-es5/zonos-collapse.entry.js +15 -1
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +13 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +157 -1
- package/dist/esm-es5/zonos-collect.entry.js +171 -1
- package/dist/esm-es5/zonos-component.entry.js +10 -1
- package/dist/esm-es5/zonos-controller.entry.js +198 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +6 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +152 -1
- package/dist/esm-es5/zonos-elements.js +4 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +63 -1
- package/dist/esm-es5/zonos-hello.entry.js +121 -1
- package/dist/esm-es5/zonos-input.entry.js +16 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +7 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +133 -1
- package/dist/esm-es5/zonos-invoice.entry.js +115 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +14 -1
- package/dist/esm-es5/zonos-link.entry.js +4 -1
- package/dist/esm-es5/zonos-logo.entry.js +7 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +31 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +5 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +27 -1
- package/dist/esm-es5/zonos-text.entry.js +24 -1
- package/dist/esm-es5/zonos-tooltip.entry.js +7 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +5 -1
- package/dist/esm-es5/zonosStore-DrIOAz4M.js +1153 -0
- package/dist/scripts/index.d.ts +1167 -514
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/__tests__/jsxWithChildren.types.d.ts +14 -0
- package/dist/types/__tests__/vitest-globals.d.ts +1 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +14 -0
- package/dist/types/components/store/checkout/cart.d.ts +19 -10
- package/dist/types/components/utils/api/checkItemRestrictions.d.ts +2 -2
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +5 -5
- package/dist/types/components/utils/checkout/isShippableCountry.d.ts +5 -1
- package/dist/types/components/utils/hello/detectItemRestrictions.d.ts +2 -2
- package/dist/types/components.d.ts +797 -147
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +124 -124
- package/dist/types/stencil-public-runtime.d.ts +205 -12
- package/dist/types/types/generated/graphql.frontend.types.d.ts +62 -60
- package/dist/types/types/generated/graphql.frontend.types.ts +57 -55
- package/dist/types/types/generated/graphql.internal.types.d.ts +1346 -1251
- package/dist/types/types/generated/graphql.internal.types.ts +1187 -1075
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-02ef0f99.system.entry.js +6 -0
- package/dist/zonos-elements/{p-1be53c82.entry.js → p-0466650f.entry.js} +1 -1
- package/dist/zonos-elements/p-04bfcd72.system.entry.js +152 -0
- package/dist/zonos-elements/p-04cc0dac.system.entry.js +198 -0
- package/dist/zonos-elements/p-058f07aa.system.entry.js +7 -0
- package/dist/zonos-elements/p-0f603278.system.entry.js +5 -0
- package/dist/zonos-elements/{p-bb09ee50.entry.js → p-128485dc.entry.js} +1 -1
- package/dist/zonos-elements/p-1568ab06.system.entry.js +117 -0
- package/dist/zonos-elements/p-2ba738ec.entry.js +1 -0
- package/dist/zonos-elements/{p-6afd5fab.entry.js → p-31ac495f.entry.js} +1 -1
- package/dist/zonos-elements/p-34d1545a.entry.js +1 -0
- package/dist/zonos-elements/p-39c8a898.entry.js +1 -0
- package/dist/zonos-elements/p-3ERbuo5a.js +1 -0
- package/dist/zonos-elements/p-450ed170.system.entry.js +46 -0
- package/dist/zonos-elements/p-4973f8d8.system.entry.js +180 -0
- package/dist/zonos-elements/p-49e7bb1e.system.entry.js +7 -0
- package/dist/zonos-elements/p-4a54f664.entry.js +1 -0
- package/dist/zonos-elements/p-4ab1c533.system.entry.js +4 -0
- package/dist/zonos-elements/p-5024df2d.system.entry.js +666 -0
- package/dist/zonos-elements/p-5562a955.system.entry.js +7 -0
- package/dist/zonos-elements/p-5836d426.system.entry.js +49 -0
- package/dist/zonos-elements/p-5a631080.system.entry.js +13 -0
- package/dist/zonos-elements/{p-2ce039e5.entry.js → p-5c08d36b.entry.js} +1 -1
- package/dist/zonos-elements/{p-aed4ffb2.entry.js → p-5d3079e8.entry.js} +1 -1
- package/dist/zonos-elements/p-629f09dc.system.entry.js +171 -0
- package/dist/zonos-elements/p-64e7bc5b.entry.js +1 -0
- package/dist/zonos-elements/p-6b0afaa7.entry.js +1 -0
- package/dist/zonos-elements/p-6f742021.entry.js +1 -0
- package/dist/zonos-elements/p-7681798d.entry.js +1 -0
- package/dist/zonos-elements/p-7a5d2211.system.entry.js +115 -0
- package/dist/zonos-elements/{p-b1e95f95.entry.js → p-7ae48e31.entry.js} +1 -1
- package/dist/zonos-elements/{p-f37150e8.entry.js → p-8328f44d.entry.js} +1 -1
- package/dist/zonos-elements/{p-171a7e1e.entry.js → p-844a743a.entry.js} +1 -1
- package/dist/zonos-elements/p-891b47d7.entry.js +1 -0
- package/dist/zonos-elements/p-89ddab88.entry.js +1 -0
- package/dist/zonos-elements/p-8cd3f1e2.entry.js +1 -0
- package/dist/zonos-elements/p-9818f823.entry.js +1 -0
- package/dist/zonos-elements/p-9b399685.system.entry.js +10 -0
- package/dist/zonos-elements/p-9b6482ef.entry.js +1 -0
- package/dist/zonos-elements/{p-2c44e013.entry.js → p-9ebe9a36.entry.js} +1 -1
- package/dist/zonos-elements/p-B2EZRfoq.system.js +193 -0
- package/dist/zonos-elements/p-B3GRrRtL.system.js +5 -0
- package/dist/zonos-elements/p-BANhKkF2.system.js +1 -0
- package/dist/zonos-elements/p-BDopxBpR.system.js +6 -0
- package/dist/zonos-elements/p-BJufDgh3.js +1 -0
- package/dist/zonos-elements/p-BLQFeIez.system.js +191 -0
- package/dist/zonos-elements/p-BNtWsPPP.system.js +7 -0
- package/dist/zonos-elements/p-BSgVcCxT.system.js +9 -0
- package/dist/zonos-elements/p-BXjdMMUy.js +1 -0
- package/dist/zonos-elements/p-BbgqQIHv.system.js +9 -0
- package/dist/zonos-elements/p-BgSx82zO.system.js +11 -0
- package/dist/zonos-elements/p-Bi-s0fp_.system.js +17 -0
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +5 -0
- package/dist/zonos-elements/p-C19J2XSh.js +1 -0
- package/dist/zonos-elements/p-C2QMVeWW.js +1 -0
- package/dist/zonos-elements/p-C2j7R11h.system.js +11 -0
- package/dist/zonos-elements/p-CEl4pzNq.js +1 -0
- package/dist/zonos-elements/p-CICjAi70.js +1 -0
- package/dist/zonos-elements/p-CIevpRv_.system.js +162 -0
- package/dist/zonos-elements/{p-e5c76a9b.js → p-CJCoACvU.js} +2 -2
- package/dist/zonos-elements/p-CKBbIU4b.system.js +14 -0
- package/dist/zonos-elements/p-CKTIJ2Gr.js +1 -0
- package/dist/zonos-elements/p-CKhl__Kc.system.js +4 -0
- package/dist/zonos-elements/p-CPnR_T0a.system.js +1153 -0
- package/dist/zonos-elements/p-CQqNJo0D.system.js +13 -0
- package/dist/zonos-elements/p-CYdt69j5.system.js +241 -0
- package/dist/zonos-elements/p-CZl1nwqv.system.js +46 -0
- package/dist/zonos-elements/p-CaAod213.system.js +8 -0
- package/dist/zonos-elements/p-CaUXHglQ.system.js +153 -0
- package/dist/zonos-elements/{p-45bd8072.system.js → p-CeLaK0Ff.system.js} +1 -1
- package/dist/zonos-elements/p-CtEsvWI6.js +1 -0
- package/dist/zonos-elements/p-D-DawUYF.system.js +1 -0
- package/dist/zonos-elements/p-D0erXw7p.js +1 -0
- package/dist/zonos-elements/p-D31lQiWo.system.js +21 -0
- package/dist/zonos-elements/p-D5AtAlJx.system.js +13 -0
- package/dist/zonos-elements/p-DBOI98r5.system.js +7 -0
- package/dist/zonos-elements/{p-41dd1cb8.js → p-DE4a-QD5.js} +1 -1
- package/dist/zonos-elements/p-DGsEWFDU.system.js +8 -0
- package/dist/zonos-elements/p-DHwpNxG9.js +1 -0
- package/dist/zonos-elements/p-DIJaXkiE.system.js +332 -0
- package/dist/zonos-elements/{p-eef5b0cc.js → p-DJIdCwJ5.js} +1 -1
- package/dist/zonos-elements/p-DPW1yXt9.system.js +517 -0
- package/dist/zonos-elements/{p-6bdc5c96.js → p-DTgv0QpG.js} +1 -1
- package/dist/zonos-elements/p-DW-fW8yR.system.js +205 -0
- package/dist/zonos-elements/p-Dj-O6VfM.system.js +7 -0
- package/dist/zonos-elements/p-DjuFsKLG.js +1 -0
- package/dist/zonos-elements/p-DkpYo2Fs.js +1 -0
- package/dist/zonos-elements/p-DnjGkbEy.js +1 -0
- package/dist/zonos-elements/p-Dw-5yD9y.system.js +227 -0
- package/dist/zonos-elements/{p-46cd14e5.js → p-LypTHRUC.js} +1 -1
- package/dist/zonos-elements/p-MfsSJh_D.system.js +8 -0
- package/dist/zonos-elements/p-YdrG78th.js +1 -0
- package/dist/zonos-elements/p-_lt63o7c.js +3 -0
- package/dist/zonos-elements/p-a38e62cc.entry.js +1 -0
- package/dist/zonos-elements/p-a6faab6a.entry.js +1 -0
- package/dist/zonos-elements/p-adfee3a3.entry.js +1 -0
- package/dist/zonos-elements/p-b14819ab.system.entry.js +14 -0
- package/dist/zonos-elements/{p-0c972ddf.entry.js → p-b68ca96f.entry.js} +1 -1
- package/dist/zonos-elements/p-b6deae2b.system.entry.js +5 -0
- package/dist/zonos-elements/p-bdba7d9e.system.entry.js +25 -0
- package/dist/zonos-elements/p-be64d823.system.entry.js +16 -0
- package/dist/zonos-elements/p-beeb9d36.system.entry.js +21 -0
- package/dist/zonos-elements/p-cadf6b63.system.entry.js +33 -0
- package/dist/zonos-elements/p-cc5306fe.system.entry.js +24 -0
- package/dist/zonos-elements/p-cc949df1.system.entry.js +7 -0
- package/dist/zonos-elements/{p-bced320e.entry.js → p-cdffc9b6.entry.js} +1 -1
- package/dist/zonos-elements/p-cf5688f7.entry.js +1 -0
- package/dist/zonos-elements/p-d05Ku7gM.system.js +24 -0
- package/dist/zonos-elements/p-d33dfc78.system.entry.js +2966 -0
- package/dist/zonos-elements/p-d55b9664.system.entry.js +157 -0
- package/dist/zonos-elements/p-daf9fa07.system.entry.js +133 -0
- package/dist/zonos-elements/p-dcdbc610.system.entry.js +27 -0
- package/dist/zonos-elements/p-e101d722.system.entry.js +63 -0
- package/dist/zonos-elements/{p-9639a8ed.entry.js → p-e284d329.entry.js} +1 -1
- package/dist/zonos-elements/{p-8311edc7.entry.js → p-e9320825.entry.js} +1 -1
- package/dist/zonos-elements/p-ea8790aa.entry.js +1 -0
- package/dist/zonos-elements/{p-6ee4e027.entry.js → p-eadaefdc.entry.js} +1 -1
- package/dist/zonos-elements/p-f27317d3.system.entry.js +31 -0
- package/dist/zonos-elements/p-f2cedbcd.system.entry.js +121 -0
- package/dist/zonos-elements/p-f57495dc.entry.js +1 -0
- package/dist/zonos-elements/p-f6e0aeba.system.entry.js +1043 -0
- package/dist/zonos-elements/p-f8fd756a.system.entry.js +15 -0
- package/dist/zonos-elements/{p-7ada039e.entry.js → p-fe778437.entry.js} +1 -1
- package/dist/zonos-elements/{p-adfbf57b.js → p-i1iCWKdv.js} +1 -1
- package/dist/zonos-elements/p-lGLcGvEA.js +1 -0
- package/dist/zonos-elements/p-nOb4xPLF.system.js +17 -0
- package/dist/zonos-elements/p-nU86HJ5w.js +1 -0
- package/dist/zonos-elements/p-pfIceXbY.js +1 -0
- package/dist/zonos-elements/p-smUku7Ku.system.js +5 -0
- package/dist/zonos-elements/p-t_ClFAJR.js +1 -0
- package/dist/zonos-elements/p-uV7m6KrY.system.js +46 -0
- package/dist/zonos-elements/p-vN6p_rO1.system.js +11 -0
- package/dist/zonos-elements/p-zRjRcLMp.js +1 -0
- package/dist/zonos-elements/p-zVLAvre1.system.js +60 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/dist/zonos-elements/zonos-elements.js +1 -1
- package/loader/index.d.ts +1 -1
- package/package.json +28 -32
- package/dist/cjs/RemoveIcon-081ac073.js +0 -5
- package/dist/cjs/debounce-7ca3c878.js +0 -357
- package/dist/cjs/isDarkColor-a6e6fd5e.js +0 -1202
- package/dist/cjs/throttle-366c204b.js +0 -76
- package/dist/cjs/zonosStore-0af0b937.js +0 -3030
- package/dist/esm/RemoveIcon-9dc5dd1a.js +0 -3
- package/dist/esm/debounce-84ade9c2.js +0 -355
- package/dist/esm/isDarkColor-939d8e9c.js +0 -1199
- package/dist/esm/throttle-c4c24e86.js +0 -74
- package/dist/esm/zonosStore-eca1e364.js +0 -3017
- package/dist/esm-es5/VarianceTest-572cecf5.js +0 -1
- package/dist/esm-es5/cart-2e407f7b.js +0 -1
- package/dist/esm-es5/classes-0d95c529.js +0 -1
- package/dist/esm-es5/cleanHtmlMarkdown-87d195f6.js +0 -1
- package/dist/esm-es5/collect-19428e18.js +0 -1
- package/dist/esm-es5/containsNonLatinChars-2d8810c3.js +0 -1
- package/dist/esm-es5/createCustomEvent-58159025.js +0 -1
- package/dist/esm-es5/debounce-84ade9c2.js +0 -1
- package/dist/esm-es5/formatStringWithLinks-0d48f183.js +0 -1
- package/dist/esm-es5/getBorderRadius-1f7be586.js +0 -1
- package/dist/esm-es5/getContrastColor-4c0ae8c1.js +0 -1
- package/dist/esm-es5/getGenericSettingsOverride-0bc3e118.js +0 -1
- package/dist/esm-es5/getMissingRequiredShippingFields-719b206f.js +0 -1
- package/dist/esm-es5/handleFetch-a844cac1.js +0 -1
- package/dist/esm-es5/hasInclusivePrice-d801be22.js +0 -1
- package/dist/esm-es5/helpers-2f6955b1.js +0 -1
- package/dist/esm-es5/index-cfd394c8.js +0 -13
- package/dist/esm-es5/invoice-67a47785.js +0 -1
- package/dist/esm-es5/isColorVariable-0a94004f.js +0 -1
- package/dist/esm-es5/isContrastColor-9fa0d013.js +0 -1
- package/dist/esm-es5/isDarkColor-939d8e9c.js +0 -1
- package/dist/esm-es5/isSameHostCheckoutLink-c1b88ab7.js +0 -1
- package/dist/esm-es5/localization-36a4dc22.js +0 -1
- package/dist/esm-es5/paypal-6dca6567.js +0 -17
- package/dist/esm-es5/placeTestOrder-9563c89a.js +0 -1
- package/dist/esm-es5/renderCheckoutCurrency-282384f0.js +0 -1
- package/dist/esm-es5/shouldRenderTaxIdInput-ef7b5860.js +0 -1
- package/dist/esm-es5/shouldShowLanguageSelect-328f50e2.js +0 -1
- package/dist/esm-es5/styles-6fc2fad9.js +0 -1
- package/dist/esm-es5/submitGtag-71c450b6.js +0 -1
- package/dist/esm-es5/throttle-c4c24e86.js +0 -1
- package/dist/esm-es5/updateCheckoutSessionAttributes-23b222de.js +0 -1
- package/dist/esm-es5/zonosStore-eca1e364.js +0 -1
- package/dist/zonos-elements/p-01174496.system.js +0 -1
- package/dist/zonos-elements/p-06f798ee.system.js +0 -1
- package/dist/zonos-elements/p-083a11cd.system.entry.js +0 -1
- package/dist/zonos-elements/p-08e7107d.js +0 -1
- package/dist/zonos-elements/p-0b29169b.js +0 -1
- package/dist/zonos-elements/p-0c9fec73.js +0 -1
- package/dist/zonos-elements/p-0d2f81ce.system.js +0 -1
- package/dist/zonos-elements/p-0e199a6c.system.entry.js +0 -1
- package/dist/zonos-elements/p-0ff845ec.js +0 -1
- package/dist/zonos-elements/p-1277abac.system.entry.js +0 -1
- package/dist/zonos-elements/p-14afffa8.system.js +0 -1
- package/dist/zonos-elements/p-1834f486.js +0 -1
- package/dist/zonos-elements/p-1aa93d1e.system.js +0 -1
- package/dist/zonos-elements/p-1ac0c631.system.js +0 -1
- package/dist/zonos-elements/p-1b8771bb.js +0 -1
- package/dist/zonos-elements/p-1cdd27ec.js +0 -1
- package/dist/zonos-elements/p-1f8648c8.system.entry.js +0 -1
- package/dist/zonos-elements/p-22e10b7d.entry.js +0 -1
- package/dist/zonos-elements/p-23e7c655.system.js +0 -1
- package/dist/zonos-elements/p-260ad739.system.entry.js +0 -1
- package/dist/zonos-elements/p-2670438c.system.js +0 -1
- package/dist/zonos-elements/p-27660512.js +0 -1
- package/dist/zonos-elements/p-29b60bf3.system.js +0 -1
- package/dist/zonos-elements/p-2b8c96e3.system.js +0 -1
- package/dist/zonos-elements/p-2b97f7ed.js +0 -1
- package/dist/zonos-elements/p-2bbe9d91.js +0 -1
- package/dist/zonos-elements/p-2c2afed4.entry.js +0 -1
- package/dist/zonos-elements/p-2c7a425d.entry.js +0 -1
- package/dist/zonos-elements/p-2cab1746.system.entry.js +0 -1
- package/dist/zonos-elements/p-2cdd1b49.system.entry.js +0 -1
- package/dist/zonos-elements/p-3490b6d0.entry.js +0 -1
- package/dist/zonos-elements/p-398d9022.system.js +0 -1
- package/dist/zonos-elements/p-3a13e58c.system.js +0 -1
- package/dist/zonos-elements/p-40a4c8a2.system.js +0 -1
- package/dist/zonos-elements/p-4160bbc2.system.js +0 -1
- package/dist/zonos-elements/p-4671fde7.entry.js +0 -1
- package/dist/zonos-elements/p-4a20893e.system.js +0 -1
- package/dist/zonos-elements/p-4b159ff3.system.js +0 -1
- package/dist/zonos-elements/p-502d6eeb.js +0 -1
- package/dist/zonos-elements/p-51e4e61a.system.entry.js +0 -1
- package/dist/zonos-elements/p-551fa762.system.js +0 -1
- package/dist/zonos-elements/p-5a491f28.js +0 -1
- package/dist/zonos-elements/p-5b990c91.entry.js +0 -1
- package/dist/zonos-elements/p-5ebb7ae6.entry.js +0 -1
- package/dist/zonos-elements/p-60832726.system.js +0 -1
- package/dist/zonos-elements/p-60a6b71d.system.js +0 -1
- package/dist/zonos-elements/p-62f6a757.entry.js +0 -1
- package/dist/zonos-elements/p-65c1f51e.entry.js +0 -1
- package/dist/zonos-elements/p-6695de06.system.js +0 -1
- package/dist/zonos-elements/p-67426156.system.js +0 -1
- package/dist/zonos-elements/p-6890e060.system.js +0 -1
- package/dist/zonos-elements/p-6dde1e85.system.entry.js +0 -1
- package/dist/zonos-elements/p-7176f582.entry.js +0 -1
- package/dist/zonos-elements/p-7261e245.system.js +0 -13
- package/dist/zonos-elements/p-76834a0a.system.entry.js +0 -1
- package/dist/zonos-elements/p-7ac8846c.system.js +0 -1
- package/dist/zonos-elements/p-7fbbdb0f.system.js +0 -1
- package/dist/zonos-elements/p-8a0b8175.system.entry.js +0 -1
- package/dist/zonos-elements/p-8a6c4017.js +0 -1
- package/dist/zonos-elements/p-8b298971.system.entry.js +0 -1
- package/dist/zonos-elements/p-8be02f3a.system.js +0 -1
- package/dist/zonos-elements/p-8bfe5b2b.entry.js +0 -1
- package/dist/zonos-elements/p-8e6338b9.entry.js +0 -1
- package/dist/zonos-elements/p-916228fb.system.js +0 -1
- package/dist/zonos-elements/p-94722bf6.system.entry.js +0 -1
- package/dist/zonos-elements/p-947e4402.system.entry.js +0 -1
- package/dist/zonos-elements/p-9ad640b2.system.entry.js +0 -1
- package/dist/zonos-elements/p-9ecb9afc.system.entry.js +0 -1
- package/dist/zonos-elements/p-a04e2750.system.entry.js +0 -1
- package/dist/zonos-elements/p-a07e5011.entry.js +0 -1
- package/dist/zonos-elements/p-a1bd3a53.system.js +0 -1
- package/dist/zonos-elements/p-a553e132.js +0 -1
- package/dist/zonos-elements/p-a9ad74e5.system.entry.js +0 -1
- package/dist/zonos-elements/p-acb7dee1.system.entry.js +0 -1
- package/dist/zonos-elements/p-ae0de3e4.entry.js +0 -1
- package/dist/zonos-elements/p-aecb5d61.entry.js +0 -1
- package/dist/zonos-elements/p-af19722c.system.js +0 -1
- package/dist/zonos-elements/p-b4ae66cb.system.entry.js +0 -1
- package/dist/zonos-elements/p-bcaffb85.system.entry.js +0 -1
- package/dist/zonos-elements/p-be6cd28c.system.entry.js +0 -1
- package/dist/zonos-elements/p-bf37ccc7.system.js +0 -1
- package/dist/zonos-elements/p-c1631c9c.js +0 -1
- package/dist/zonos-elements/p-c5d1217f.system.js +0 -1
- package/dist/zonos-elements/p-c77b049c.entry.js +0 -1
- package/dist/zonos-elements/p-ca87ada5.system.entry.js +0 -1
- package/dist/zonos-elements/p-cb49dcfe.entry.js +0 -1
- package/dist/zonos-elements/p-cb4cb5a3.system.js +0 -1
- package/dist/zonos-elements/p-ce75b047.js +0 -2
- package/dist/zonos-elements/p-d20fe2c2.system.entry.js +0 -1
- package/dist/zonos-elements/p-d42bd250.system.entry.js +0 -1
- package/dist/zonos-elements/p-d6a73125.system.entry.js +0 -1
- package/dist/zonos-elements/p-d938f42f.system.js +0 -1
- package/dist/zonos-elements/p-dc80cb87.js +0 -1
- package/dist/zonos-elements/p-dd3c00d6.system.entry.js +0 -1
- package/dist/zonos-elements/p-de58684b.system.js +0 -1
- package/dist/zonos-elements/p-e160b75f.js +0 -1
- package/dist/zonos-elements/p-e1ef3984.system.entry.js +0 -1
- package/dist/zonos-elements/p-e27b8e18.entry.js +0 -1
- package/dist/zonos-elements/p-e2b4c082.system.entry.js +0 -1
- package/dist/zonos-elements/p-e32ee011.system.entry.js +0 -1
- package/dist/zonos-elements/p-e4b07f7d.system.entry.js +0 -1
- package/dist/zonos-elements/p-e8587f9f.system.entry.js +0 -1
- package/dist/zonos-elements/p-eb5f3451.system.js +0 -18
- package/dist/zonos-elements/p-ebbda085.system.js +0 -1
- package/dist/zonos-elements/p-f4720b0a.js +0 -1
- package/dist/zonos-elements/p-f4acce01.js +0 -1
- package/dist/zonos-elements/p-f59a0129.system.entry.js +0 -1
- package/dist/zonos-elements/p-f8356934.system.entry.js +0 -1
- package/dist/zonos-elements/p-fe5f05fc.system.js +0 -1
- package/dist/zonos-elements/p-ff4e6811.entry.js +0 -1
- package/loader/package.json +0 -11
- /package/dist/cjs/{CheckoutConfig-27c82f94.js → CheckoutConfig-B7JRM7yr.js} +0 -0
- /package/dist/cjs/{ShortAddressCode-bec338b0.js → ShortAddressCode-C5l520-F.js} +0 -0
- /package/dist/cjs/{TaxId-cd9d490e.js → TaxId-Q6aDqqWv.js} +0 -0
- /package/dist/cjs/{VarianceTest-bec00ea8.js → VarianceTest-C98whVgO.js} +0 -0
- /package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -0
- /package/dist/cjs/{buildCartItemsByTempCart-edddbf4b.js → buildCartItemsByTempCart-ILzonEjb.js} +0 -0
- /package/dist/cjs/{classes-b7918f56.js → classes-D_DL168u.js} +0 -0
- /package/dist/cjs/{cleanHtmlMarkdown-57147de7.js → cleanHtmlMarkdown-DpT-nZLH.js} +0 -0
- /package/dist/cjs/{containsNonLatinChars-2be5129b.js → containsNonLatinChars-D_OggJN6.js} +0 -0
- /package/dist/cjs/{createCustomEvent-7b6fad95.js → createCustomEvent-Cs5zGImL.js} +0 -0
- /package/dist/cjs/{getGenericSettingsOverride-c0ca32b9.js → getGenericSettingsOverride-CL6l6wvX.js} +0 -0
- /package/dist/cjs/{getHasMoreSpaceOnRight-4c94667f.js → getHasMoreSpaceOnRight-Cl50u1mb.js} +0 -0
- /package/dist/cjs/{isCollectMobileTablet-884d4280.js → isCollectMobileTablet-Cx2nZ15_.js} +0 -0
- /package/dist/cjs/{isColorVariable-525dbfa7.js → isColorVariable-CKoJdu9G.js} +0 -0
- /package/dist/cjs/{isInvoiceMobileTablet-dde41e4e.js → isInvoiceMobileTablet-CCqFYV6m.js} +0 -0
- /package/dist/cjs/{isSameHostCheckoutLink-6148cabb.js → isSameHostCheckoutLink-DbmQ7Ha4.js} +0 -0
- /package/dist/cjs/{styles-d1e64fb9.js → styles-nowYls3K.js} +0 -0
- /package/dist/esm/{CheckoutConfig-724d7bae.js → CheckoutConfig-D5SpFsQJ.js} +0 -0
- /package/dist/esm/{ShortAddressCode-7620e622.js → ShortAddressCode-nJ6oI8-n.js} +0 -0
- /package/dist/esm/{TaxId-63a14057.js → TaxId-Cye-evFK.js} +0 -0
- /package/dist/esm/{VarianceTest-572cecf5.js → VarianceTest-BJmZPrZl.js} +0 -0
- /package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
- /package/dist/esm/{buildCartItemsByTempCart-a117f75d.js → buildCartItemsByTempCart-BycjkdlE.js} +0 -0
- /package/dist/esm/{classes-0d95c529.js → classes-BJHSB96f.js} +0 -0
- /package/dist/esm/{cleanHtmlMarkdown-87d195f6.js → cleanHtmlMarkdown-ByGDytaN.js} +0 -0
- /package/dist/esm/{containsNonLatinChars-2d8810c3.js → containsNonLatinChars-C04AWRC2.js} +0 -0
- /package/dist/esm/{createCustomEvent-58159025.js → createCustomEvent-XQfWgQLB.js} +0 -0
- /package/dist/esm/{getGenericSettingsOverride-0bc3e118.js → getGenericSettingsOverride-HeAZDwVW.js} +0 -0
- /package/dist/esm/{getHasMoreSpaceOnRight-70eb913a.js → getHasMoreSpaceOnRight-DAscqB23.js} +0 -0
- /package/dist/esm/{isCollectMobileTablet-111b0dd7.js → isCollectMobileTablet-DGlnuxEX.js} +0 -0
- /package/dist/esm/{isColorVariable-0a94004f.js → isColorVariable-DXXUq2Lv.js} +0 -0
- /package/dist/esm/{isInvoiceMobileTablet-1f7b614e.js → isInvoiceMobileTablet-Clej0Ffe.js} +0 -0
- /package/dist/esm/{isSameHostCheckoutLink-c1b88ab7.js → isSameHostCheckoutLink-BxAHnL5J.js} +0 -0
- /package/dist/esm/{styles-6fc2fad9.js → styles-BTIeCf3T.js} +0 -0
- /package/dist/esm-es5/{RemoveIcon-9dc5dd1a.js → RemoveIcon-C2QMVeWW.js} +0 -0
- /package/dist/esm-es5/{ShortAddressCode-7620e622.js → ShortAddressCode-nJ6oI8-n.js} +0 -0
- /package/dist/esm-es5/{TaxId-63a14057.js → TaxId-Cye-evFK.js} +0 -0
- /package/dist/esm-es5/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
- /package/dist/esm-es5/{getHasMoreSpaceOnRight-70eb913a.js → getHasMoreSpaceOnRight-DAscqB23.js} +0 -0
- /package/dist/esm-es5/{isCollectMobileTablet-111b0dd7.js → isCollectMobileTablet-DGlnuxEX.js} +0 -0
- /package/dist/esm-es5/{isInvoiceMobileTablet-1f7b614e.js → isInvoiceMobileTablet-Clej0Ffe.js} +0 -0
- /package/dist/zonos-elements/{p-2770ba48.system.js → p-0D0aCMu6.system.js} +0 -0
- /package/dist/zonos-elements/{p-b4b7f705.js → p-BJHSB96f.js} +0 -0
- /package/dist/zonos-elements/{p-0a377722.js → p-BJmZPrZl.js} +0 -0
- /package/dist/zonos-elements/{p-96d77739.js → p-BTIeCf3T.js} +0 -0
- /package/dist/zonos-elements/{p-56ba5cbf.system.js → p-BbPAtVJG.system.js} +0 -0
- /package/dist/zonos-elements/{p-11206fe2.js → p-BxAHnL5J.js} +0 -0
- /package/dist/zonos-elements/{p-cc6ad18a.js → p-ByGDytaN.js} +0 -0
- /package/dist/zonos-elements/{p-83666056.js → p-BycjkdlE.js} +0 -0
- /package/dist/zonos-elements/{p-0c64dbbb.js → p-C04AWRC2.js} +0 -0
- /package/dist/zonos-elements/{p-655ec440.system.js → p-C29tlYn0.system.js} +0 -0
- /package/dist/zonos-elements/{p-2adbbce7.system.js → p-CLDnjFm5.system.js} +0 -0
- /package/dist/zonos-elements/{p-989cb22b.system.js → p-Cby4EkFu.system.js} +0 -0
- /package/dist/zonos-elements/{p-1f3549c6.js → p-Clej0Ffe.js} +0 -0
- /package/dist/zonos-elements/{p-bcf5cffb.js → p-Cye-evFK.js} +0 -0
- /package/dist/zonos-elements/{p-b2d81c98.js → p-D5SpFsQJ.js} +0 -0
- /package/dist/zonos-elements/{p-5883217a.js → p-DAscqB23.js} +0 -0
- /package/dist/zonos-elements/{p-579932a7.js → p-DGlnuxEX.js} +0 -0
- /package/dist/zonos-elements/{p-e1255160.js → p-DQuL1Twl.js} +0 -0
- /package/dist/zonos-elements/{p-ae393255.js → p-DXXUq2Lv.js} +0 -0
- /package/dist/zonos-elements/{p-e7b0c156.js → p-HeAZDwVW.js} +0 -0
- /package/dist/zonos-elements/{p-595f5dd2.js → p-XQfWgQLB.js} +0 -0
- /package/dist/zonos-elements/{p-bc7bf53e.system.js → p-Z99tSPFR.system.js} +0 -0
- /package/dist/zonos-elements/{p-6f23a26a.system.js → p-_GDmY2H7.system.js} +0 -0
- /package/dist/zonos-elements/{p-1d42cd20.js → p-nJ6oI8-n.js} +0 -0
package/dist/scripts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},y=w[m],h=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:d}:e),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=h(i),k=d.find(({type:e})=>"unknown"===e),Z=d.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),j=z&&I;return I&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},t)};try{fetch(`${y}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=h();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:j,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),j?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(s).forEach(e=>void 0===s[e]&&delete s[e]);const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.3.285.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null}),n},Z="https://js.stripe.com/v3",I=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let j=null;const O=e=>(null!==j||(j=new Promise((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&I.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(()=>{const e=document.createElement("script");e.src=`${Z}`;const o=document.head||document.body;return o?(o.appendChild(e),e):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))}),null==n||n.addEventListener("error",()=>{t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else o(null)})),j),A=Promise.resolve().then(()=>(()=>{var e,o;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(o=window.Zonos)||void 0===o?void 0:o.buildCartDetail))})()?O(null):null);let E=!1;A.catch(e=>{E||console.warn(e)});const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise(e=>setTimeout(e,500)),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,P=new RegExp(`^${L.source}$`),$=new RegExp(`^cart_${L.source}$`),D=/^[a-zA-Z0-9]{2,}$/,U=/^cart_[a-zA-Z0-9]{2,}$/,N=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:P.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},R="zonos--checkout-hidden-international-button";var F;const x=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),n=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),M=Date.now(),B="https://v1.3.285.js.zonos.com",q=x||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.285",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}F=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1787351986715",G.isLegacyCheckout=!1,G.googleAnalyticId=null,G.googleAnalyticReady=!1,G.facebookPixelId=null,G.facebookPixelReady=!1,G.startLoadTime=M,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.285",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(F.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),F.createCartId=null==t?void 0:t.createCartId,F.buildCartDetail=null==t?void 0:t.buildCartDetail,F.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${F.version}) ======`),F.zonosApiKey=p,F.storeId=u,"undefined"!=typeof window&&window.parent===window&&(F.googleAnalyticReady=!0,F.facebookPixelReady=!0),F.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",()=>{window.Zonos.isNpm=F.isNpm,window.Zonos.isBigCommerce=F.isBigCommerce,window.Zonos.isLegacyCheckout=F.isLegacyCheckout,window.Zonos.zonosMode=F.zonosMode,window.Zonos.init(e)}),t.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)}),void(window.isZonosPreview=!0)}if(!p&&!F.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!F.cartData&&F.cartId){r("Initialize cart data");const e=await N(F.cartId);if(!e)return void s("Failed to get cart data");F.cartData=e.cartData,F.zonosApiKey=e.zonosApiKey,F.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(F.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(F.cartId&&F.cartData||!!m){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}r("init zonos"),F.restoreNativeBrowserFunctions(),F.injectCustomScriptForHostedCheckout(),F.injectZonosCdn(),F.injectZonosCss(),F.injectFonts(),F.injectCheckoutInternationalButton(),F.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),F.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${R}`)){const e=document.createElement("button");e.id=R,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=F.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find(e=>"customHeaderScript"===e.key),n=o.find(e=>"customFooterScript"===e.key);if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${R}`);setTimeout(()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))},10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=F.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=F.zonosController)||void 0===o||o.updateOrganizationName(e)},G.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach(e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))}),e&&t&&setTimeout(()=>{o.forEach(e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)})},5e3)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},G.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=F.zonosApiKey||"",n.addEventListener("stripeInitEvent",async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{var o;E=!0;const t=Date.now();return((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(null!==(o=await A)&&void 0!==o?o:await O(null),e,t)})(o.publishableKey);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")}),document.body.appendChild(n),F.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${F.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&F.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.285";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.285";case"vercel":return B}};if(F.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{F.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),F.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=F.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&F.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(F.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},G.setupGoogleFont=e=>{var o;null===(o=F.zonosController)||void 0===o||o.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},exports.Zonos=G})();
|
|
1
|
+
(function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},y=w[m],h=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:d}:e),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=h(i),k=d.find(({type:e})=>"unknown"===e),Z=d.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),j=z&&I;return I&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},t)};try{fetch(`${y}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=h();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:j,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),j?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(s).forEach(e=>void 0===s[e]&&delete s[e]);const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.3.287.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null}),n},Z="https://js.stripe.com/v3",I=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let j=null;const O=e=>(null!==j||(j=new Promise((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&I.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(()=>{const e=document.createElement("script");e.src=`${Z}`;const o=document.head||document.body;return o?(o.appendChild(e),e):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))}),null==n||n.addEventListener("error",()=>{t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else o(null)})),j),A=Promise.resolve().then(()=>(()=>{var e,o;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(o=window.Zonos)||void 0===o?void 0:o.buildCartDetail))})()?O(null):null);let E=!1;A.catch(e=>{E||console.warn(e)});const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise(e=>setTimeout(e,500)),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,P=new RegExp(`^${L.source}$`),$=new RegExp(`^cart_${L.source}$`),D=/^[a-zA-Z0-9]{2,}$/,U=/^cart_[a-zA-Z0-9]{2,}$/,N=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:P.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},R="zonos--checkout-hidden-international-button";var F;const x=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),n=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),M=Date.now(),B="https://v1.3.287.js.zonos.com",q=x||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.287",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}F=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1788370143519",G.isLegacyCheckout=!1,G.googleAnalyticId=null,G.googleAnalyticReady=!1,G.facebookPixelId=null,G.facebookPixelReady=!1,G.startLoadTime=M,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.287",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(F.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),F.createCartId=null==t?void 0:t.createCartId,F.buildCartDetail=null==t?void 0:t.buildCartDetail,F.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${F.version}) ======`),F.zonosApiKey=p,F.storeId=u,"undefined"!=typeof window&&window.parent===window&&(F.googleAnalyticReady=!0,F.facebookPixelReady=!0),F.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",()=>{window.Zonos.isNpm=F.isNpm,window.Zonos.isBigCommerce=F.isBigCommerce,window.Zonos.isLegacyCheckout=F.isLegacyCheckout,window.Zonos.zonosMode=F.zonosMode,window.Zonos.init(e)}),t.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)}),void(window.isZonosPreview=!0)}if(!p&&!F.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!F.cartData&&F.cartId){r("Initialize cart data");const e=await N(F.cartId);if(!e)return void s("Failed to get cart data");F.cartData=e.cartData,F.zonosApiKey=e.zonosApiKey,F.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(F.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(F.cartId&&F.cartData||!!m){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}r("init zonos"),F.restoreNativeBrowserFunctions(),F.injectCustomScriptForHostedCheckout(),F.injectZonosCdn(),F.injectZonosCss(),F.injectFonts(),F.injectCheckoutInternationalButton(),F.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),F.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${R}`)){const e=document.createElement("button");e.id=R,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=F.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find(e=>"customHeaderScript"===e.key),n=o.find(e=>"customFooterScript"===e.key);if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${R}`);setTimeout(()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))},10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=F.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=F.zonosController)||void 0===o||o.updateOrganizationName(e)},G.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach(e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))}),e&&t&&setTimeout(()=>{o.forEach(e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)})},5e3)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},G.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=F.zonosApiKey||"",n.addEventListener("stripeInitEvent",async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{var o;E=!0;const t=Date.now();return((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(null!==(o=await A)&&void 0!==o?o:await O(null),e,t)})(o.publishableKey);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")}),document.body.appendChild(n),F.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${F.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&F.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.287";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.287";case"vercel":return B}};if(F.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{F.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),F.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=F.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&F.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(F.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},G.setupGoogleFont=e=>{var o;null===(o=F.zonosController)||void 0===o||o.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},exports.Zonos=G})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}},o=()=>{const e=new URL(window.location.href),o=window.sessionStorage.getItem("zonos--country");return(e=>{const o=new URLSearchParams(e||window.location.search),n=e=>{return(n=o.get(e))&&/^[A-Z]{2}$/.test(n)?n:null;var n},t=n("zCountry"),r=n("country"),s=n("customerCountry");return t||r||s})(e.searchParams)||o};function n(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)o.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const t=()=>window.location.search.includes("zonosStagingMode=1"),r=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")},s=["cloudflare","vercel"],i=s[0],a={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},d=a[i],l=(e=i)=>{const o=s.indexOf(e),n=s[o+1];return n||null},c=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},u=performance.now(),p=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},w=(e,o,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-u,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(p).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let a=document.querySelector("iframe#zonos---debug-logging-iframe");a||(a=document.createElement("iframe"),a.id="zonos---debug-logging-iframe",a.style.display="none",a.style.opacity="0",a.style.position="absolute",a.style.top="-9999px",a.style.left="-9999px",a.style.width="1px",a.style.height="1px",a.style.border="none",a.style.overflow="hidden",a.style.visibility="hidden",document.body.appendChild(a));const d=(null===(r=a.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":d.warn(e,...i);break;case"info":d.info(e,...i);break;case"error":d.error(e,...i);break;default:d.groupCollapsed(e,...i),d.trace(),d.groupEnd()}},g=()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n},m=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],y=({apiPath:e,apiType:o,loadTimeInternal:n,loadTimeTotal:t})=>{if(m.includes(e))return;const r=t-n;if(r<0)return;const s=e.split("?")[0]||e,i=(()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=g();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(l=a,l||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:n,loadTimeTotal:t,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var l;window.Zonos.loadTimeApiInfoList.push(d)},f=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(w("sendErrorLog","warn",e,n,o),t){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};try{fetch(`${d}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=l();if(!o)return;fetch(`${a[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}},h=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{const o=await e.text(),n=c(o);if(!n)throw new Error(`Failed to parse content: ${o}`);return n}catch(e){if(n)throw e;return o&&console.error(e),null}},v=async({basePathType:e,options:o,path:n})=>{let t;const r=window.Zonos.zonosQaUrlApi||a[e]||i,s=new URL(r+n),d=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(d));try{t=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const l=t.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&l&&c&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:r,errors:[],json:await h({response:t}),response:t,zonosMode:l}}const u=t.status.toString();try{const e=await h({response:t,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:u}:e),json:null,response:t,zonosMode:l}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:u}],json:null,response:t,zonosMode:l}}catch(e){return{baseUrl:r,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:l}}},S=async({basePathType:e,options:o,path:t})=>{var r,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,d=performance.now(),u=await v({basePathType:i,options:o,path:t}),{errors:p,response:g}=u,m=n(u,["errors","response"]),h=performance.now()-d;w(`${t} (${h.toFixed(2)}ms)`,"info");const z=null==g?void 0:g.headers.get("Zonos-Duration");200===(null==g?void 0:g.status)&&y({apiPath:t,apiType:i,loadTimeInternal:z?Number(z):0,loadTimeTotal:h});const Z=l(i),C=p.find(({type:e})=>"unknown"===e),b=p.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!C||404===(null==g?void 0:g.status)||500===(null==g?void 0:g.status),L=Z&&I;return I&&!b&&f({endpoint:a[i]+t,errors:p.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:Z,requestHeaders:null==o?void 0:o.headers,requestPayload:c(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:L,status:null==g?void 0:g.status,statusText:null==g?void 0:g.statusText},shouldPostReleaseErrorReporting:!0}),L?(w(`=== "${t}" failed to fetch, trying next fallback ${Z}`),S({basePathType:Z,options:o,path:t})):Object.assign({errors:p,response:g},m)},z=async(e,o)=>{const s=n(o||{},[]),a=s.body?JSON.stringify(s.body):void 0,d=s.method||"GET",l=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":t()?"1":void 0,"Zonos-Test-Mode":r()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},s.headers);Object.keys(l).forEach(e=>void 0===l[e]&&delete l[e]);const c=Object.assign(Object.assign({},s),{body:"GET"===d?void 0:a,headers:l,method:d}),u=new URLSearchParams(window.location.search).get("useFallbackApi");return S({basePathType:u||i,options:c,path:e})},Z=(e,...o)=>{w(e,"error",...o)},C=["jsdelivr","cdnjs","unpkg","vercel"],b=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},I=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,L=new RegExp(`^${I.source}$`),O=new RegExp(`^cart_${I.source}$`),A=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,k=e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:O.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:L.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},U=async({cartId:o,retries:n})=>{const t=r(),s=e(),i=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,a=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&a.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:d,json:l,zonosMode:c}=await z(`/api/zonos-elements/get-cart?${a.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:i,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||d.length;return u&&n?(w("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise(e=>setTimeout(e,500)),U({cartId:o,retries:n-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:c})},j="z--blur",E=async()=>{const e=window.zonosBlurCurrencyOnInitIntervalId;if(!e)return;await new Promise(e=>setTimeout(e,500)),clearInterval(e);document.querySelectorAll(`.${j}`).forEach(e=>{e.classList.remove(j)}),window.zonosBlurCurrencyOnInitIntervalId=void 0},$=({currencySelector:e,specificSelector:o})=>{if(e||o)if(o)o.classList.add(j);else{document.querySelectorAll([e].filter(Boolean).join(",")).forEach(e=>{e.classList.add(j)})}};var P;const N=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=b(window.location.href),n="https://v1.3.285.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const t=`https://${o}.preview.js.zonos.com`;return w(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null}),t})(),D=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=b(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!e)return null;const t=`https://${e}.route.js.zonos.com`;return w(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})(),R=Date.now();class F{}P=F,F.isNpm=!1,F.isBigCommerce=!1,F.googleAnalyticId=null,F.googleAnalyticReady=!1,F.facebookPixelId=null,F.facebookPixelReady=!1,F.requested=!1,F.zonosMode=null,F.cartData=null,F.startLoadTime=R,F.overrideUseCustomAddressForm=!1,F.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,F.version="v1.3.285",F.isLegacyCheckout=!1,F.isCollect=!1,F.isInvoice=!1,F.legacyStoreLogo=null,F.legacyStoreFavicon=null,F.parallelLoadTimes=[],F.parallelLoadState="off",F.releaseDate="1787351986715",F.loadTimeApiInfoList=[],F.cartSettings=null,F.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find(e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType});null==e||e.transferSize;(async()=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},t)))}catch(e){}},F.loadScriptLogParallelHandler=async e=>{try{if(P.parallelLoadTimes.push(e),2===P.parallelLoadTimes.length){const e=P.parallelLoadTimes.find(e=>"vercel"===e.type),o=P.parallelLoadTimes.find(e=>"jsdelivr"===e.type);if(!e||!o)return;if(e.isError&&o.isError)return void f({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});P.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},F.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{Z(`[ZONOS - loadZonos] ${e}`),f({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:P.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},F.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.285";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.285":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.285");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},F.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;o=Object.assign(Object.assign({},o),{zonosApiKey:P.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===e?t:P.getGithubCdn({type:e,version:r}),a=N||i,d=a.replace("https://","").replace("http://",""),l=document.createElement("script"),c=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";l.src=`https://${d}/dist/scripts/${c}?timestamp=${Date.now()}`,w(`[ZONOS - loadZonos] Injecting "${c}" from "${d}"`,"info");const u="4g"===(null===(s=g())||void 0===s?void 0:s.effectiveType),p=["dev.elements.zonos.com","zonos.com"].some(e=>window.location.href.includes(e)),m=C[0]===e,y=C[1],h="on"===P.parallelLoadState&&u&&m&&y&&!p;h&&P.injectZonos({cdnType:y,initConfig:o,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();l.addEventListener("load",async()=>{if(h||n?P.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e}):P.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e}),P.isBigCommerce||(P.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=N,window.Zonos.zonosQaUrlApi=D,window.Zonos.zonosMode=P.zonosMode,window.Zonos.isBigCommerce=P.isBigCommerce,window.Zonos.loadTimeApiInfoList=P.loadTimeApiInfoList,window.Zonos.overrideUseCustomAddressForm=P.overrideUseCustomAddressForm,window.Zonos.startLoadTime=P.startLoadTime,P.cartSettings&&(window.Zonos.cartSettings=P.cartSettings),P.cartId){const e=P.isCollect?"Collect":"hosted Checkout";if(!P.zonosApiKey)throw P.legacyCheckoutErrorHandler({message:`zonosApiKey is missing to initiate ${e}`}),new Error(`zonosApiKey is required for ${e}`);if(!P.cartData)throw P.legacyCheckoutErrorHandler({message:`cartData is missing to initiate ${e}`}),new Error(`cartData is required for ${e}`);if(P.legacyStoreFavicon&&P.isLegacyCheckout&&!P.isCollect)try{if(200!==(await fetch(P.legacyStoreFavicon)).status)throw new Error("Custom favicon is not available");const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=P.legacyStoreFavicon,document.head.appendChild(e)}catch(e){}window.Zonos.cartData=P.cartData,window.Zonos.isLegacyCheckout=P.isLegacyCheckout,window.Zonos.cartSettings=P.cartSettings,window.Zonos.isCollect=P.isCollect,window.Zonos.isInvoice=P.isInvoice;const n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:P.isLegacyCheckout&&!P.isCollect&&P.legacyStoreLogo?P.legacyStoreLogo:void 0}),zonosApiKey:P.zonosApiKey});o=n}window.Zonos.version&&(w(`[ZONOS - loadZonos] Execute "Zonos.init" from "${c}" from "${d}"`,"info"),window.Zonos.init(o))}),l.addEventListener("error",async()=>{const s=(e=>{const o=C.indexOf(e);return C[o+1]||null})(e);if(!h&&!n){if(!s)return;P.injectZonos({cdnType:s,initConfig:o,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some(e=>window.location.href.includes(e))||N)return;if(h||n)return void P.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e});["unpkg","cdnjs","vercel"].includes(e)?f({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:e,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):f({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-v}})}),document.head.appendChild(l)},F.handlePerformBlurCurrency=()=>{var e,o,n;!(null===(o=null===(e=P.cartSettings)||void 0===e?void 0:e.genericSettings)||void 0===o?void 0:o.blurCurrencyOnInit)?E():(window.zonosBlurCurrencyOnInitCurrencySelector=window.zonosBlurCurrencyOnInitCurrencySelector||(null===(n=P.cartSettings)||void 0===n?void 0:n.helloSettings.currencyElementSelector),(()=>{if("undefined"==typeof window)return;if(window.zonosBlurCurrencyOnInitIntervalId)return;$({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});const e=setInterval(()=>{$({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})},10);window.zonosBlurCurrencyOnInitIntervalId=e,setTimeout(()=>{E()},7e3)})())},F.init=async n=>{var s,i;if(w("=== Init zonos script release date","info",P.releaseDate),N&&!window.isZonosPreview){w(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${N}`,"info");const e=document.createElement("script");return e.src=`${N}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=P.isBigCommerce,window.Zonos.isLegacyCheckout=P.isLegacyCheckout,window.Zonos.startLoadTime=P.startLoadTime,window.Zonos.init(n)}),e.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${N}`)}),void(window.isZonosPreview=!0)}const a=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:d,isLegacyCartId:l}=k(a);if(a&&!l&&!d)return void P.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${a}`,metadata:{invalidCartId:!0}});P.cartId=a;const c=document.querySelector('script[src*="/zonos.js"]'),u=null===(s=document.querySelector("script[src*='/loadZonos.js']"))||void 0===s?void 0:s.src;w(`[ZONOS - init] first load script src: ${u}`,"info"),window.Zonos.zonosQaUrl=N,window.Zonos.zonosQaUrlApi=D,window.Zonos.zonosQaUrl&&w(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&w(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const p=null==u?void 0:u.includes("timestamp=");if(!(P.isNpm||u&&p))return void Z("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(c||!u||P.requested)return void w("[ZONOS - loadZonos] script is already loaded or requested","info");if(!n.zonosApiKey&&!P.cartId)return P.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void Z("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(P.requested=!0,P.zonosApiKey=n.zonosApiKey,P.storeId=n.storeId,P.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=k(e);if(!n&&!o)return Z("[ZONOS - loadZonos] invalid cart id"),null;const t=await U({cartId:e,retries:5});return w("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(Z("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(P.cartId);if(!e)throw P.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");P.cartData=e.cartData,P.cartSettings=e.settings,P.legacyStoreLogo=e.storeLogo,P.legacyStoreFavicon=e.storeFavicon,P.storeId=e.storeId,P.zonosApiKey=e.zonosApiKey,P.isCollect=e.cartData.type.includes("COLLECT"),P.isInvoice="INVOICE"===e.cartData.type}if(!P.zonosApiKey)return void Z('"zonosApiKey" is required to initialize Zonos');const g=await(async()=>{const e=r(),o=t();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(w("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return w("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:n,json:s}=await z("/api/get-test-public-credential");if(n.length||!s)return Z("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",n),null;const i=s.publicCredential;return i?(w(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(Z("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(g&&(w(`[ZONOS - loadZonos] Using test API key: ${g} for test mode`,"info"),P.zonosApiKey=g),!P.cartId){const{json:n,zonosMode:t}=await(async()=>{if(window.Zonos.cartSettings)return w("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const n=e(),t=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&t.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const r=o();r&&t.set("zCountry",r);const{errors:s,json:i,zonosMode:a}=await z(`/api/zonos-elements/zonos-settings?${t.toString()}`);return s.length?(Z("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:s,json:null,zonosMode:a}):{errors:[],json:i,zonosMode:a}})();(null==n?void 0:n.appearanceSettings)&&(null==n?void 0:n.checkoutSettings)&&(null==n?void 0:n.helloSettings)&&(null==n?void 0:n.organization)&&(w("[ZONOS - loadZonos] Prefetching zonos settings","info"),P.cartSettings={appearanceSettings:n.appearanceSettings,checkoutSettings:n.checkoutSettings,credentialTokenId:P.zonosApiKey,genericSettings:n.genericSettings,helloSettings:n.helloSettings,inclusivePriceConfigurations:n.inclusivePriceConfigurations,landedCostSettings:n.landedCostSettings,onlineStoreSettings:n.onlineStoreSettings,organization:n.organization,organizationId:(null===(i=n.organization)||void 0===i?void 0:i.id)||"",shippingZones:n.shippingZones},P.zonosMode=t)}P.handlePerformBlurCurrency();const m=P.storeId||n.storeId||0;w(`[ZONOS - loadZonos] Store ID: ${m}`,"info");const y=new URLSearchParams;y.set("storeId",m.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&y.set("_enableStoreVersionPinned","1");const{errors:f,json:h}=await z(`/api/get-store-version?${y.toString()}`);if(f.length||!h)return w("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void P.injectZonos({initConfig:n,vercelUrl:"https://v1.3.285.js.zonos.com",version:null});const{isDifferent:v,source:S,version:C}=h;if(w(`[ZONOS - loadZonos] Store version: ${C}, source: ${S}`,"info"),v){w(`[ZONOS - loadZonos] Updating saved store version to ${C}`,"info");const e={storeId:m,version:C};z(`/api/set-store-version?${y.toString()}`,{body:e,method:"POST"}).catch(e=>Z("Unable to save store's vesrion",e))}if(!c){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),t=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:u}),r=t&&!o?e:`${"alpha"===C?"alpha":`v${C}`}.js.zonos.com`,s=t&&!o?null:C;w("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:o,isWhiteListed:t,loadUrl:r,loadVersion:s,version:C}),P.injectZonos({initConfig:n,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=F)})();
|
|
1
|
+
(function(){"use strict";const e=()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}},o=()=>{const e=new URL(window.location.href),o=window.sessionStorage.getItem("zonos--country");return(e=>{const o=new URLSearchParams(e||window.location.search),n=e=>{return(n=o.get(e))&&/^[A-Z]{2}$/.test(n)?n:null;var n},t=n("zCountry"),r=n("country"),s=n("customerCountry");return t||r||s})(e.searchParams)||o};function n(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)o.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const t=()=>window.location.search.includes("zonosStagingMode=1"),r=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")},s=["cloudflare","vercel"],i=s[0],a={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},d=a[i],l=(e=i)=>{const o=s.indexOf(e),n=s[o+1];return n||null},c=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},u=performance.now(),p=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},w=(e,o,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-u,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(p).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let a=document.querySelector("iframe#zonos---debug-logging-iframe");a||(a=document.createElement("iframe"),a.id="zonos---debug-logging-iframe",a.style.display="none",a.style.opacity="0",a.style.position="absolute",a.style.top="-9999px",a.style.left="-9999px",a.style.width="1px",a.style.height="1px",a.style.border="none",a.style.overflow="hidden",a.style.visibility="hidden",document.body.appendChild(a));const d=(null===(r=a.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":d.warn(e,...i);break;case"info":d.info(e,...i);break;case"error":d.error(e,...i);break;default:d.groupCollapsed(e,...i),d.trace(),d.groupEnd()}},g=()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n},m=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],y=({apiPath:e,apiType:o,loadTimeInternal:n,loadTimeTotal:t})=>{if(m.includes(e))return;const r=t-n;if(r<0)return;const s=e.split("?")[0]||e,i=(()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=g();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(l=a,l||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:n,loadTimeTotal:t,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var l;window.Zonos.loadTimeApiInfoList.push(d)},f=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(w("sendErrorLog","warn",e,n,o),t){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};try{fetch(`${d}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=l();if(!o)return;fetch(`${a[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}},h=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{const o=await e.text(),n=c(o);if(!n)throw new Error(`Failed to parse content: ${o}`);return n}catch(e){if(n)throw e;return o&&console.error(e),null}},v=async({basePathType:e,options:o,path:n})=>{let t;const r=window.Zonos.zonosQaUrlApi||a[e]||i,s=new URL(r+n),d=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(d));try{t=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const l=t.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&l&&c&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:r,errors:[],json:await h({response:t}),response:t,zonosMode:l}}const u=t.status.toString();try{const e=await h({response:t,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:u}:e),json:null,response:t,zonosMode:l}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:u}],json:null,response:t,zonosMode:l}}catch(e){return{baseUrl:r,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:l}}},S=async({basePathType:e,options:o,path:t})=>{var r,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,d=performance.now(),u=await v({basePathType:i,options:o,path:t}),{errors:p,response:g}=u,m=n(u,["errors","response"]),h=performance.now()-d;w(`${t} (${h.toFixed(2)}ms)`,"info");const z=null==g?void 0:g.headers.get("Zonos-Duration");200===(null==g?void 0:g.status)&&y({apiPath:t,apiType:i,loadTimeInternal:z?Number(z):0,loadTimeTotal:h});const Z=l(i),C=p.find(({type:e})=>"unknown"===e),b=p.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!C||404===(null==g?void 0:g.status)||500===(null==g?void 0:g.status),L=Z&&I;return I&&!b&&f({endpoint:a[i]+t,errors:p.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:Z,requestHeaders:null==o?void 0:o.headers,requestPayload:c(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:L,status:null==g?void 0:g.status,statusText:null==g?void 0:g.statusText},shouldPostReleaseErrorReporting:!0}),L?(w(`=== "${t}" failed to fetch, trying next fallback ${Z}`),S({basePathType:Z,options:o,path:t})):Object.assign({errors:p,response:g},m)},z=async(e,o)=>{const s=n(o||{},[]),a=s.body?JSON.stringify(s.body):void 0,d=s.method||"GET",l=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":t()?"1":void 0,"Zonos-Test-Mode":r()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},s.headers);Object.keys(l).forEach(e=>void 0===l[e]&&delete l[e]);const c=Object.assign(Object.assign({},s),{body:"GET"===d?void 0:a,headers:l,method:d}),u=new URLSearchParams(window.location.search).get("useFallbackApi");return S({basePathType:u||i,options:c,path:e})},Z=(e,...o)=>{w(e,"error",...o)},C=["jsdelivr","cdnjs","unpkg","vercel"],b=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},I=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,L=new RegExp(`^${I.source}$`),O=new RegExp(`^cart_${I.source}$`),A=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,k=e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:O.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:L.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},U=async({cartId:o,retries:n})=>{const t=r(),s=e(),i=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,a=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&a.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:d,json:l,zonosMode:c}=await z(`/api/zonos-elements/get-cart?${a.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:i,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||d.length;return u&&n?(w("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise(e=>setTimeout(e,500)),U({cartId:o,retries:n-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:c})},j="z--blur",E=async()=>{const e=window.zonosBlurCurrencyOnInitIntervalId;if(!e)return;await new Promise(e=>setTimeout(e,500)),clearInterval(e);document.querySelectorAll(`.${j}`).forEach(e=>{e.classList.remove(j)}),window.zonosBlurCurrencyOnInitIntervalId=void 0},$=({currencySelector:e,specificSelector:o})=>{if(e||o)if(o)o.classList.add(j);else{document.querySelectorAll([e].filter(Boolean).join(",")).forEach(e=>{e.classList.add(j)})}};var P;const N=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=b(window.location.href),n="https://v1.3.287.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const t=`https://${o}.preview.js.zonos.com`;return w(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null}),t})(),D=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=b(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!e)return null;const t=`https://${e}.route.js.zonos.com`;return w(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})(),R=Date.now();class F{}P=F,F.isNpm=!1,F.isBigCommerce=!1,F.googleAnalyticId=null,F.googleAnalyticReady=!1,F.facebookPixelId=null,F.facebookPixelReady=!1,F.requested=!1,F.zonosMode=null,F.cartData=null,F.startLoadTime=R,F.overrideUseCustomAddressForm=!1,F.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,F.version="v1.3.287",F.isLegacyCheckout=!1,F.isCollect=!1,F.isInvoice=!1,F.legacyStoreLogo=null,F.legacyStoreFavicon=null,F.parallelLoadTimes=[],F.parallelLoadState="off",F.releaseDate="1788370143519",F.loadTimeApiInfoList=[],F.cartSettings=null,F.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find(e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType});null==e||e.transferSize;(async()=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},t)))}catch(e){}},F.loadScriptLogParallelHandler=async e=>{try{if(P.parallelLoadTimes.push(e),2===P.parallelLoadTimes.length){const e=P.parallelLoadTimes.find(e=>"vercel"===e.type),o=P.parallelLoadTimes.find(e=>"jsdelivr"===e.type);if(!e||!o)return;if(e.isError&&o.isError)return void f({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});P.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},F.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{Z(`[ZONOS - loadZonos] ${e}`),f({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:P.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},F.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.287";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.287":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.287");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},F.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;o=Object.assign(Object.assign({},o),{zonosApiKey:P.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===e?t:P.getGithubCdn({type:e,version:r}),a=N||i,d=a.replace("https://","").replace("http://",""),l=document.createElement("script"),c=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";l.src=`https://${d}/dist/scripts/${c}?timestamp=${Date.now()}`,w(`[ZONOS - loadZonos] Injecting "${c}" from "${d}"`,"info");const u="4g"===(null===(s=g())||void 0===s?void 0:s.effectiveType),p=["dev.elements.zonos.com","zonos.com"].some(e=>window.location.href.includes(e)),m=C[0]===e,y=C[1],h="on"===P.parallelLoadState&&u&&m&&y&&!p;h&&P.injectZonos({cdnType:y,initConfig:o,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();l.addEventListener("load",async()=>{if(h||n?P.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e}):P.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e}),P.isBigCommerce||(P.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=N,window.Zonos.zonosQaUrlApi=D,window.Zonos.zonosMode=P.zonosMode,window.Zonos.isBigCommerce=P.isBigCommerce,window.Zonos.loadTimeApiInfoList=P.loadTimeApiInfoList,window.Zonos.overrideUseCustomAddressForm=P.overrideUseCustomAddressForm,window.Zonos.startLoadTime=P.startLoadTime,P.cartSettings&&(window.Zonos.cartSettings=P.cartSettings),P.cartId){const e=P.isCollect?"Collect":"hosted Checkout";if(!P.zonosApiKey)throw P.legacyCheckoutErrorHandler({message:`zonosApiKey is missing to initiate ${e}`}),new Error(`zonosApiKey is required for ${e}`);if(!P.cartData)throw P.legacyCheckoutErrorHandler({message:`cartData is missing to initiate ${e}`}),new Error(`cartData is required for ${e}`);if(P.legacyStoreFavicon&&P.isLegacyCheckout&&!P.isCollect)try{if(200!==(await fetch(P.legacyStoreFavicon)).status)throw new Error("Custom favicon is not available");const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=P.legacyStoreFavicon,document.head.appendChild(e)}catch(e){}window.Zonos.cartData=P.cartData,window.Zonos.isLegacyCheckout=P.isLegacyCheckout,window.Zonos.cartSettings=P.cartSettings,window.Zonos.isCollect=P.isCollect,window.Zonos.isInvoice=P.isInvoice;const n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:P.isLegacyCheckout&&!P.isCollect&&P.legacyStoreLogo?P.legacyStoreLogo:void 0}),zonosApiKey:P.zonosApiKey});o=n}window.Zonos.version&&(w(`[ZONOS - loadZonos] Execute "Zonos.init" from "${c}" from "${d}"`,"info"),window.Zonos.init(o))}),l.addEventListener("error",async()=>{const s=(e=>{const o=C.indexOf(e);return C[o+1]||null})(e);if(!h&&!n){if(!s)return;P.injectZonos({cdnType:s,initConfig:o,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some(e=>window.location.href.includes(e))||N)return;if(h||n)return void P.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e});["unpkg","cdnjs","vercel"].includes(e)?f({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:e,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):f({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-v}})}),document.head.appendChild(l)},F.handlePerformBlurCurrency=()=>{var e,o,n;!(null===(o=null===(e=P.cartSettings)||void 0===e?void 0:e.genericSettings)||void 0===o?void 0:o.blurCurrencyOnInit)?E():(window.zonosBlurCurrencyOnInitCurrencySelector=window.zonosBlurCurrencyOnInitCurrencySelector||(null===(n=P.cartSettings)||void 0===n?void 0:n.helloSettings.currencyElementSelector),(()=>{if("undefined"==typeof window)return;if(window.zonosBlurCurrencyOnInitIntervalId)return;$({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});const e=setInterval(()=>{$({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})},10);window.zonosBlurCurrencyOnInitIntervalId=e,setTimeout(()=>{E()},7e3)})())},F.init=async n=>{var s,i;if(w("=== Init zonos script release date","info",P.releaseDate),N&&!window.isZonosPreview){w(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${N}`,"info");const e=document.createElement("script");return e.src=`${N}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=P.isBigCommerce,window.Zonos.isLegacyCheckout=P.isLegacyCheckout,window.Zonos.startLoadTime=P.startLoadTime,window.Zonos.init(n)}),e.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${N}`)}),void(window.isZonosPreview=!0)}const a=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:d,isLegacyCartId:l}=k(a);if(a&&!l&&!d)return void P.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${a}`,metadata:{invalidCartId:!0}});P.cartId=a;const c=document.querySelector('script[src*="/zonos.js"]'),u=null===(s=document.querySelector("script[src*='/loadZonos.js']"))||void 0===s?void 0:s.src;w(`[ZONOS - init] first load script src: ${u}`,"info"),window.Zonos.zonosQaUrl=N,window.Zonos.zonosQaUrlApi=D,window.Zonos.zonosQaUrl&&w(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&w(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const p=null==u?void 0:u.includes("timestamp=");if(!(P.isNpm||u&&p))return void Z("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(c||!u||P.requested)return void w("[ZONOS - loadZonos] script is already loaded or requested","info");if(!n.zonosApiKey&&!P.cartId)return P.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void Z("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(P.requested=!0,P.zonosApiKey=n.zonosApiKey,P.storeId=n.storeId,P.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=k(e);if(!n&&!o)return Z("[ZONOS - loadZonos] invalid cart id"),null;const t=await U({cartId:e,retries:5});return w("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(Z("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(P.cartId);if(!e)throw P.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");P.cartData=e.cartData,P.cartSettings=e.settings,P.legacyStoreLogo=e.storeLogo,P.legacyStoreFavicon=e.storeFavicon,P.storeId=e.storeId,P.zonosApiKey=e.zonosApiKey,P.isCollect=e.cartData.type.includes("COLLECT"),P.isInvoice="INVOICE"===e.cartData.type}if(!P.zonosApiKey)return void Z('"zonosApiKey" is required to initialize Zonos');const g=await(async()=>{const e=r(),o=t();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(w("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return w("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:n,json:s}=await z("/api/get-test-public-credential");if(n.length||!s)return Z("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",n),null;const i=s.publicCredential;return i?(w(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(Z("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(g&&(w(`[ZONOS - loadZonos] Using test API key: ${g} for test mode`,"info"),P.zonosApiKey=g),!P.cartId){const{json:n,zonosMode:t}=await(async()=>{if(window.Zonos.cartSettings)return w("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const n=e(),t=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&t.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const r=o();r&&t.set("zCountry",r);const{errors:s,json:i,zonosMode:a}=await z(`/api/zonos-elements/zonos-settings?${t.toString()}`);return s.length?(Z("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:s,json:null,zonosMode:a}):{errors:[],json:i,zonosMode:a}})();(null==n?void 0:n.appearanceSettings)&&(null==n?void 0:n.checkoutSettings)&&(null==n?void 0:n.helloSettings)&&(null==n?void 0:n.organization)&&(w("[ZONOS - loadZonos] Prefetching zonos settings","info"),P.cartSettings={appearanceSettings:n.appearanceSettings,checkoutSettings:n.checkoutSettings,credentialTokenId:P.zonosApiKey,genericSettings:n.genericSettings,helloSettings:n.helloSettings,inclusivePriceConfigurations:n.inclusivePriceConfigurations,landedCostSettings:n.landedCostSettings,onlineStoreSettings:n.onlineStoreSettings,organization:n.organization,organizationId:(null===(i=n.organization)||void 0===i?void 0:i.id)||"",shippingZones:n.shippingZones},P.zonosMode=t)}P.handlePerformBlurCurrency();const m=P.storeId||n.storeId||0;w(`[ZONOS - loadZonos] Store ID: ${m}`,"info");const y=new URLSearchParams;y.set("storeId",m.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&y.set("_enableStoreVersionPinned","1");const{errors:f,json:h}=await z(`/api/get-store-version?${y.toString()}`);if(f.length||!h)return w("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void P.injectZonos({initConfig:n,vercelUrl:"https://v1.3.287.js.zonos.com",version:null});const{isDifferent:v,source:S,version:C}=h;if(w(`[ZONOS - loadZonos] Store version: ${C}, source: ${S}`,"info"),v){w(`[ZONOS - loadZonos] Updating saved store version to ${C}`,"info");const e={storeId:m,version:C};z(`/api/set-store-version?${y.toString()}`,{body:e,method:"POST"}).catch(e=>Z("Unable to save store's vesrion",e))}if(!c){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),t=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:u}),r=t&&!o?e:`${"alpha"===C?"alpha":`v${C}`}.js.zonos.com`,s=t&&!o?null:C;w("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:o,isWhiteListed:t,loadUrl:r,loadVersion:s,version:C}),P.injectZonos({initConfig:n,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=F)})();
|
package/dist/scripts/zonos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},y=w[m],h=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:d}:e),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=h(i),k=d.find(({type:e})=>"unknown"===e),Z=d.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),j=z&&I;return I&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},t)};try{fetch(`${y}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=h();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:j,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),j?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(s).forEach(e=>void 0===s[e]&&delete s[e]);const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.3.285.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null}),n},Z="https://js.stripe.com/v3",I=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let j=null;const O=e=>(null!==j||(j=new Promise((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&I.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(()=>{const e=document.createElement("script");e.src=`${Z}`;const o=document.head||document.body;return o?(o.appendChild(e),e):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))}),null==n||n.addEventListener("error",()=>{t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else o(null)})),j),A=Promise.resolve().then(()=>(()=>{var e,o;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(o=window.Zonos)||void 0===o?void 0:o.buildCartDetail))})()?O(null):null);let E=!1;A.catch(e=>{E||console.warn(e)});const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise(e=>setTimeout(e,500)),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,P=new RegExp(`^${L.source}$`),$=new RegExp(`^cart_${L.source}$`),D=/^[a-zA-Z0-9]{2,}$/,U=/^cart_[a-zA-Z0-9]{2,}$/,N=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:P.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},R="zonos--checkout-hidden-international-button";var F;const x=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),n=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),M=Date.now(),B="https://v1.3.285.js.zonos.com",q=x||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.285",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}F=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1787351986715",G.isLegacyCheckout=!1,G.googleAnalyticId=null,G.googleAnalyticReady=!1,G.facebookPixelId=null,G.facebookPixelReady=!1,G.startLoadTime=M,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.285",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(F.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),F.createCartId=null==t?void 0:t.createCartId,F.buildCartDetail=null==t?void 0:t.buildCartDetail,F.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${F.version}) ======`),F.zonosApiKey=p,F.storeId=u,"undefined"!=typeof window&&window.parent===window&&(F.googleAnalyticReady=!0,F.facebookPixelReady=!0),F.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",()=>{window.Zonos.isNpm=F.isNpm,window.Zonos.isBigCommerce=F.isBigCommerce,window.Zonos.isLegacyCheckout=F.isLegacyCheckout,window.Zonos.zonosMode=F.zonosMode,window.Zonos.init(e)}),t.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)}),void(window.isZonosPreview=!0)}if(!p&&!F.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!F.cartData&&F.cartId){r("Initialize cart data");const e=await N(F.cartId);if(!e)return void s("Failed to get cart data");F.cartData=e.cartData,F.zonosApiKey=e.zonosApiKey,F.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(F.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(F.cartId&&F.cartData||!!m){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}r("init zonos"),F.restoreNativeBrowserFunctions(),F.injectCustomScriptForHostedCheckout(),F.injectZonosCdn(),F.injectZonosCss(),F.injectFonts(),F.injectCheckoutInternationalButton(),F.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),F.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${R}`)){const e=document.createElement("button");e.id=R,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=F.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find(e=>"customHeaderScript"===e.key),n=o.find(e=>"customFooterScript"===e.key);if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${R}`);setTimeout(()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))},10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=F.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=F.zonosController)||void 0===o||o.updateOrganizationName(e)},G.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach(e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))}),e&&t&&setTimeout(()=>{o.forEach(e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)})},5e3)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},G.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=F.zonosApiKey||"",n.addEventListener("stripeInitEvent",async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{var o;E=!0;const t=Date.now();return((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(null!==(o=await A)&&void 0!==o?o:await O(null),e,t)})(o.publishableKey);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")}),document.body.appendChild(n),F.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${F.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&F.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.285";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.285";case"vercel":return B}};if(F.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{F.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),F.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=F.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&F.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(F.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},G.setupGoogleFont=e=>{var o;null===(o=F.zonosController)||void 0===o||o.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=G)})();
|
|
1
|
+
(function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},y=w[m],h=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:d}:e),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=h(i),k=d.find(({type:e})=>"unknown"===e),Z=d.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),j=z&&I;return I&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},t)};try{fetch(`${y}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=h();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:j,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),j?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(s).forEach(e=>void 0===s[e]&&delete s[e]);const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.3.287.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null}),n},Z="https://js.stripe.com/v3",I=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let j=null;const O=e=>(null!==j||(j=new Promise((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&I.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(()=>{const e=document.createElement("script");e.src=`${Z}`;const o=document.head||document.body;return o?(o.appendChild(e),e):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))}),null==n||n.addEventListener("error",()=>{t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else o(null)})),j),A=Promise.resolve().then(()=>(()=>{var e,o;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(o=window.Zonos)||void 0===o?void 0:o.buildCartDetail))})()?O(null):null);let E=!1;A.catch(e=>{E||console.warn(e)});const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise(e=>setTimeout(e,500)),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,P=new RegExp(`^${L.source}$`),$=new RegExp(`^cart_${L.source}$`),D=/^[a-zA-Z0-9]{2,}$/,U=/^cart_[a-zA-Z0-9]{2,}$/,N=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:P.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},R="zonos--checkout-hidden-international-button";var F;const x=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),n=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),M=Date.now(),B="https://v1.3.287.js.zonos.com",q=x||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.287",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}F=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1788370143519",G.isLegacyCheckout=!1,G.googleAnalyticId=null,G.googleAnalyticReady=!1,G.facebookPixelId=null,G.facebookPixelReady=!1,G.startLoadTime=M,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.287",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(F.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),F.createCartId=null==t?void 0:t.createCartId,F.buildCartDetail=null==t?void 0:t.buildCartDetail,F.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${F.version}) ======`),F.zonosApiKey=p,F.storeId=u,"undefined"!=typeof window&&window.parent===window&&(F.googleAnalyticReady=!0,F.facebookPixelReady=!0),F.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",()=>{window.Zonos.isNpm=F.isNpm,window.Zonos.isBigCommerce=F.isBigCommerce,window.Zonos.isLegacyCheckout=F.isLegacyCheckout,window.Zonos.zonosMode=F.zonosMode,window.Zonos.init(e)}),t.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)}),void(window.isZonosPreview=!0)}if(!p&&!F.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!F.cartData&&F.cartId){r("Initialize cart data");const e=await N(F.cartId);if(!e)return void s("Failed to get cart data");F.cartData=e.cartData,F.zonosApiKey=e.zonosApiKey,F.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(F.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(F.cartId&&F.cartData||!!m){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}r("init zonos"),F.restoreNativeBrowserFunctions(),F.injectCustomScriptForHostedCheckout(),F.injectZonosCdn(),F.injectZonosCss(),F.injectFonts(),F.injectCheckoutInternationalButton(),F.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),F.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${R}`)){const e=document.createElement("button");e.id=R,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=F.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find(e=>"customHeaderScript"===e.key),n=o.find(e=>"customFooterScript"===e.key);if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${R}`);setTimeout(()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))},10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=F.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=F.zonosController)||void 0===o||o.updateOrganizationName(e)},G.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach(e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))}),e&&t&&setTimeout(()=>{o.forEach(e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)})},5e3)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},G.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=F.zonosApiKey||"",n.addEventListener("stripeInitEvent",async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{var o;E=!0;const t=Date.now();return((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(null!==(o=await A)&&void 0!==o?o:await O(null),e,t)})(o.publishableKey);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")}),document.body.appendChild(n),F.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${F.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&F.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.287";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.287";case"vercel":return B}};if(F.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{F.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),F.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=F.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&F.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(F.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},G.setupGoogleFont=e=>{var o;null===(o=F.zonosController)||void 0===o||o.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=G)})();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JSXWithChildren } from '.storybook/all.d';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
type ButtonAttrs = JSXWithChildren['zonos-button'];
|
|
4
|
+
type CustomAddressAttrs = JSXWithChildren['zonos-custom-address'];
|
|
5
|
+
type CustomAddressStory = StoryObj<Meta<CustomAddressAttrs>>;
|
|
6
|
+
/**
|
|
7
|
+
* Stencil 4.44 IntrinsicElements uses OneOf/attr:/prop: unions. Storybook args
|
|
8
|
+
* must stay a plain kebab-case attribute object so stories without args typecheck.
|
|
9
|
+
*/
|
|
10
|
+
declare const lightModeWithoutArgs: CustomAddressStory;
|
|
11
|
+
declare const buttonVariant: Pick<ButtonAttrs, 'variant'>;
|
|
12
|
+
declare const assertHasTitleText: 'title-text' extends keyof CustomAddressAttrs ? true : never;
|
|
13
|
+
declare const assertNoAttrPrefix: 'attr:type' extends keyof CustomAddressAttrs ? never : true;
|
|
14
|
+
export { assertHasTitleText, assertNoAttrPrefix, buttonVariant, lightModeWithoutArgs, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vitest/globals" />
|
|
@@ -144,6 +144,20 @@ export declare class ZonosCheckout {
|
|
|
144
144
|
* Check if stripe payment intent is succeeded or in a good state to move forward
|
|
145
145
|
*/
|
|
146
146
|
private checkStripePaymentIntentStatus;
|
|
147
|
+
/**
|
|
148
|
+
* Recover an order-modification payment-only session that was already
|
|
149
|
+
* completed (or already paid but not yet completed) by the time this cart
|
|
150
|
+
* link is opened/reopened — e.g. the shopper paid, closed the tab before
|
|
151
|
+
* the async order-creation webhook finished, then reopened the same
|
|
152
|
+
* payment link. Without this, re-rendering the payment form would let them
|
|
153
|
+
* attempt to pay again against an already-resolved session. Mirrors
|
|
154
|
+
* zonos-collect's recoverCompletedCollectSession for its own no-shipping
|
|
155
|
+
* flow, minus the Airwallex branch (this checkout only supports Stripe).
|
|
156
|
+
*
|
|
157
|
+
* @returns `true` when it routed to the finish step, `false` when the
|
|
158
|
+
* caller should proceed with a normal init.
|
|
159
|
+
*/
|
|
160
|
+
private recoverCompletedOrderModificationSession;
|
|
147
161
|
private buildCartAndInit;
|
|
148
162
|
private reloadCheckoutSession;
|
|
149
163
|
private handleOrderDuplication;
|
|
@@ -157,24 +157,24 @@ declare const cartStoreCheckItemRestrictions: (itemsWorkflow: ItemWorkflowInfo[]
|
|
|
157
157
|
cartItems: CartItemToUse[];
|
|
158
158
|
restrictedItems: {
|
|
159
159
|
restriction: {
|
|
160
|
-
action: import("src/types/generated/graphql.internal.types").RestrictedItemAction;
|
|
161
160
|
reason: string;
|
|
161
|
+
action: import("src/types/generated/graphql.internal.types").RestrictedItemAction;
|
|
162
162
|
};
|
|
163
|
+
id: string;
|
|
163
164
|
amount: number;
|
|
164
|
-
|
|
165
|
-
key: string | null;
|
|
166
|
-
value: string | null;
|
|
167
|
-
} | null> | null;
|
|
165
|
+
name: string | null;
|
|
168
166
|
description: string | null;
|
|
169
|
-
id: string;
|
|
170
167
|
imageUrl: string | null;
|
|
171
|
-
name: string | null;
|
|
172
|
-
productId: string;
|
|
173
168
|
quantity: number;
|
|
169
|
+
sku: string | null;
|
|
170
|
+
productId: string;
|
|
174
171
|
reverseAmountDetail: Array<{
|
|
175
172
|
inclusivePriceConfigurationId: string | null;
|
|
176
173
|
}> | null;
|
|
177
|
-
|
|
174
|
+
attributes: Array<{
|
|
175
|
+
key: string | null;
|
|
176
|
+
value: string | null;
|
|
177
|
+
} | null> | null;
|
|
178
178
|
matchedItem: CartItemToUse | undefined;
|
|
179
179
|
}[];
|
|
180
180
|
};
|
|
@@ -212,6 +212,15 @@ type CartStoreRecalculateTotalParams = Omit<Parameters<typeof stripeStoreUpdateC
|
|
|
212
212
|
* Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
|
|
213
213
|
*/
|
|
214
214
|
declare const cartStoreHasOneEligibleItem: () => boolean;
|
|
215
|
+
/**
|
|
216
|
+
* An order-modification payment-only session (skip-to-payment, no shipping
|
|
217
|
+
* step): a session tied to an order that hasn't completed yet, meaning the
|
|
218
|
+
* shopper is only paying a delta against an already-approved landed cost.
|
|
219
|
+
* Single source of truth for this detection — previously duplicated inline
|
|
220
|
+
* at each call site, which let one of them (the forceDialogOpen/preview init
|
|
221
|
+
* path) miss it entirely.
|
|
222
|
+
*/
|
|
223
|
+
declare const cartStoreIsOrderModificationPaymentOnlySession: () => boolean;
|
|
215
224
|
declare const cartStoreSetCheckoutSession: (checkoutSession: CheckoutSessionDetailsFragment) => void;
|
|
216
225
|
declare const cartStoreReCalculateTotal: ({ adjustmentsAmount, cartId, currency, dutiesTaxesFeesEstimate, itemsAmount, landedCostId, shouldInitSessionOnFailure, }: CartStoreRecalculateTotalParams) => Promise<boolean>;
|
|
217
226
|
/**
|
|
@@ -254,4 +263,4 @@ declare const cartStoreResetTabItems: () => void;
|
|
|
254
263
|
* Debounced to prevent multiple rapid requests when store changes cascade.
|
|
255
264
|
*/
|
|
256
265
|
declare const cartStoreUpdateStoreCredit: () => void;
|
|
257
|
-
export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetMethod, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStoreOnChange, cartStorePreviousStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateStoreCredit, cartStoreUpdateToErrorState, };
|
|
266
|
+
export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetMethod, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreIsOrderModificationPaymentOnlySession, cartStoreNextStep, cartStoreOnChange, cartStorePreviousStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateStoreCredit, cartStoreUpdateToErrorState, };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { CheckItemRestrictionRequest } from "../../../types/hello/RestrictedItem";
|
|
2
2
|
export declare const checkItemRestrictions: ({ items, shipFrom, shipTo, }: CheckItemRestrictionRequest) => Promise<{
|
|
3
|
-
action: import("src/types/generated/graphql.internal.types").ItemRestrictionAction | null;
|
|
4
3
|
id: string;
|
|
4
|
+
action: import("src/types/generated/graphql.internal.types").ItemRestrictionAction | null;
|
|
5
5
|
itemDescription: string | null;
|
|
6
6
|
itemRestrictions: Array<{
|
|
7
7
|
hsCode: string;
|
|
8
8
|
id: string;
|
|
9
9
|
note: string;
|
|
10
|
-
sources: Array<string | null> | null;
|
|
11
10
|
type: import("src/types/generated/graphql.internal.types").ItemRestrictionType;
|
|
11
|
+
sources: Array<string | null> | null;
|
|
12
12
|
} | null> | null;
|
|
13
13
|
}[]>;
|
|
@@ -5,16 +5,16 @@ export declare const getLocaleMessages: ({ countryCode, localeTo, storeId, }: {
|
|
|
5
5
|
storeId: number;
|
|
6
6
|
}) => Promise<{
|
|
7
7
|
countryCodes: Array<string>;
|
|
8
|
+
pageName: import("src/types/generated/graphql.frontend.types").Locale_PageName_Enum;
|
|
9
|
+
id: number;
|
|
8
10
|
countryCodesPageMessageLinks: Array<{
|
|
9
11
|
id: number;
|
|
10
12
|
message: {
|
|
11
|
-
id: number;
|
|
12
|
-
localeFrom: string;
|
|
13
|
-
localeTo: string;
|
|
14
13
|
textFrom: string;
|
|
15
14
|
textTo: string;
|
|
15
|
+
localeFrom: string;
|
|
16
|
+
localeTo: string;
|
|
17
|
+
id: number;
|
|
16
18
|
};
|
|
17
19
|
}>;
|
|
18
|
-
id: number;
|
|
19
|
-
pageName: import("src/types/generated/graphql.frontend.types").Locale_PageName_Enum;
|
|
20
20
|
}[]>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { CountryCode } from "../../../types/generated/graphql.internal.types";
|
|
2
|
-
export declare const isShippableCountry: (showLog?: boolean,
|
|
2
|
+
export declare const isShippableCountry: (showLog?: boolean,
|
|
3
|
+
/**
|
|
4
|
+
* If provided, will check if the country is shippable based on the provided country code instead of the Hello selected country code
|
|
5
|
+
*/
|
|
6
|
+
providedCountryCode?: CountryCode) => boolean;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Product } from "../../../types/hello/Product";
|
|
2
2
|
export declare const detectItemRestrictions: (newProducts: Product[]) => Promise<{
|
|
3
3
|
name: string;
|
|
4
|
-
action: import("../../../types/generated/graphql.internal.types").ItemRestrictionAction | null;
|
|
5
4
|
id: string;
|
|
5
|
+
action: import("../../../types/generated/graphql.internal.types").ItemRestrictionAction | null;
|
|
6
6
|
itemDescription: string | null;
|
|
7
7
|
itemRestrictions: Array<{
|
|
8
8
|
hsCode: string;
|
|
9
9
|
id: string;
|
|
10
10
|
note: string;
|
|
11
|
-
sources: Array<string | null> | null;
|
|
12
11
|
type: import("../../../types/generated/graphql.internal.types").ItemRestrictionType;
|
|
12
|
+
sources: Array<string | null> | null;
|
|
13
13
|
} | null> | null;
|
|
14
14
|
}[]>;
|