@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
|
@@ -0,0 +1,1043 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?t(e.value):r(e.value).then(s,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=c(0),s["throw"]=c(1),s["return"]=c(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,i;n<r;n++){if(i||!(n in o)){if(!i)i=Array.prototype.slice.call(o,0,n);i[n]=o[n]}}return e.concat(i||Array.prototype.slice.call(o))};System.register(["./p-CIevpRv_.system.js","./p-DPW1yXt9.system.js","./p-B2EZRfoq.system.js","./p-DIJaXkiE.system.js","./p-CPnR_T0a.system.js","./p-BDopxBpR.system.js","./p-zVLAvre1.system.js","./p-CaAod213.system.js","./p-BbgqQIHv.system.js","./p-smUku7Ku.system.js","./p-C2j7R11h.system.js","./p-DBOI98r5.system.js","./p-BSgVcCxT.system.js","./p-DW-fW8yR.system.js","./p-BNtWsPPP.system.js","./p-0D0aCMu6.system.js","./p-Cby4EkFu.system.js","./p-B3GRrRtL.system.js","./p-uV7m6KrY.system.js","./p-BANhKkF2.system.js","./p-CaUXHglQ.system.js"],(function(e){"use strict";var o,t,n,r,i,s,c,a,u,d,l,f,h,v,m,g,p,w,z,k,y,b,_,C,x,S,T,I,A,O,B,E,P,U,L,D,N,j,R,F,M,H,K,V,Z,G,W,Q,Y,q,X,J,$,ee,oe,te,ne,re,ie,se,ce,ae,ue,de,le,fe,he,ve,me,ge,pe,we,ze,ke,ye,be,_e,Ce,xe,Se,Te,Ie,Ae,Oe,Be;return{setters:[function(e){o=e.r;t=e.h;n=e.F;r=e.a},function(e){i=e.s;s=e.a;c=e.b;a=e.i;u=e.c;d=e.g;l=e.d;f=e.e;h=e.f;v=e.p;m=e.h;g=e.j;p=e.k;w=e.l;z=e.m;k=e.n;y=e.o;b=e.t;_=e.q;C=e.r;x=e.u;S=e.v;T=e.w;I=e.x;A=e.y;O=e.z;B=e.A;E=e.B;P=e.C;U=e.D;L=e.E;D=e.F;N=e.G;j=e.H;R=e.I;F=e.J;M=e.K},function(e){H=e.p;K=e.s;V=e.a;Z=e.b},function(e){G=e.f;W=e.a;Q=e.b;Y=e.i;q=e.l;X=e.c;J=e.g;$=e.s;ee=e.V;oe=e.d;te=e.t;ne=e.e;re=e.h},function(e){ie=e.z;se=e.g;ce=e.m},function(e){ae=e.b},function(e){ue=e.h;de=e.g;le=e.j;fe=e.l;he=e.b;ve=e.s;me=e.a;ge=e.i},function(e){pe=e.u},function(e){we=e.l;ze=e.g;ke=e.b},function(e){ye=e._;be=e.c;_e=e.d;Ce=e.a;xe=e.g},function(e){Se=e.c},function(e){Te=e.c},function(e){Ie=e.g},function(e){Ae=e.i},function(e){Oe=e.s},function(e){Be=e.R},null,null,null,null,null],execute:function(){var Ee=this;
|
|
2
|
+
/**
|
|
3
|
+
* Check if store discount is enabled
|
|
4
|
+
*/var Pe=function(){return __awaiter(Ee,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4/*yield*/,ue("/api/zonos-elements/get-store-discount-enabled-status")];case 1:e=n.sent(),o=e.errors,t=e.json;if(o.length||!(t===null||t===void 0?void 0:t.enabled)){return[2/*return*/,{enabled:false}]}return[2/*return*/,{enabled:true}]}}))}))};var Ue=function(e){return __awaiter(Ee,[e],void 0,(function(e){var o,t,n,r;var i=e.testKeys;return __generator(this,(function(e){switch(e.label){case 0:
|
|
5
|
+
// Do nothing if no test keys are provided
|
|
6
|
+
if(i.length===0){return[2/*return*/,null]}return[4/*yield*/,ue("/api/zonos-elements/select-variance-test",{body:{testKeys:i},method:"POST"})];case 1:o=e.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2/*return*/,null]}r=G(n);
|
|
7
|
+
// Filter the response to only include test keys that we support
|
|
8
|
+
return[2/*return*/,r]}}))}))};var Le=function(e){var o=e.cartId,t=e.checkoutSessionId,n=e.customerAddress1,r=e.customerAddress2,i=e.customerCity,s=e.customerCountry,c=e.customerEmail,a=e.customerFirstName,u=e.customerLastName,d=e.customerPhone,l=e.customerState,f=e.customerZip,h=e.hostedCheckoutUrl,v=e.isTestMode,m=e.isVariantTest;var g=new URLSearchParams;g.set("tempCartUUID",o);if(a){g.set("customerFirstName",a)}if(u){g.set("customerLastName",u)}if(c){g.set("customerEmail",c)}if(d){g.set("customerPhone",d)}if(f){g.set("customerZip",f)}if(i){g.set("customerCity",i)}if(l){g.set("customerState",l)}if(s){g.set("zCountry",s)}if(n){g.set("customerAddress1",n)}if(r){g.set("customerAddress2",r)}if(v){g.set("zonosTestMode","1")}if(t){g.set("zonosCheckoutSessionId",t)}if(m){g.set("zonosVariantTest","1")}return"".concat(h,"?").concat(g.toString())};
|
|
9
|
+
/**
|
|
10
|
+
* The query flag that BigCommerce carries back to `cart.php` after the
|
|
11
|
+
* shopper logs in. When present, Zonos-elements knows to resume the
|
|
12
|
+
* international checkout flow instead of letting BC's native cart UX
|
|
13
|
+
* take over.
|
|
14
|
+
*/var De="isInternationalCheckout";
|
|
15
|
+
/**
|
|
16
|
+
* Build the `from` query value handed to BigCommerce's `/login.php` so that
|
|
17
|
+
* after a successful login the shopper lands back on `cart.php` with the
|
|
18
|
+
* `isInternationalCheckout=true` flag set (plus any `zonosTestMode` /
|
|
19
|
+
* `zonosQaUrl` / `zonosQaUrlApi` that were on the current URL, so the
|
|
20
|
+
* preview build / API host / test credentials carry through the round trip).
|
|
21
|
+
*/var Ne=function(){var e=new URLSearchParams;e.set(De,"true");var o=new URLSearchParams(window.location.search);var t=o.get("zonosQaUrl");if(t){e.set("zonosQaUrl",t)}var n=o.get("zonosQaUrlApi");if(n){e.set("zonosQaUrlApi",n)}if(de()){e.set("zonosTestMode","1")}return"cart.php?".concat(e.toString())};
|
|
22
|
+
/**
|
|
23
|
+
* Build an absolute URL to BigCommerce's `/login.php` with the
|
|
24
|
+
* `from=cart.php?isInternationalCheckout=true` round-trip encoded so the
|
|
25
|
+
* shopper resumes Zonos international checkout after authenticating.
|
|
26
|
+
*
|
|
27
|
+
* Preserves `zonosTestMode` / `zonosQaUrl` / `zonosQaUrlApi` from the current
|
|
28
|
+
* URL across the redirect — the login round trip leaves BC's frontend, so
|
|
29
|
+
* without this the returning `cart.php` would drop back to the production
|
|
30
|
+
* build / API host.
|
|
31
|
+
*/var je=function(e){var o=e===void 0?{}:e,t=o.action;var n=new URL("/login.php",window.location.origin);if(t){n.searchParams.set("action",t)}var r=new URLSearchParams(window.location.search);
|
|
32
|
+
// set zonosQaUrl from the current URL
|
|
33
|
+
var i=r.get("zonosQaUrl");if(i){n.searchParams.set("zonosQaUrl",i)}
|
|
34
|
+
// set zonosQaUrlApi from the current URL
|
|
35
|
+
var s=r.get("zonosQaUrlApi");if(s){n.searchParams.set("zonosQaUrlApi",s)}
|
|
36
|
+
// set zonosTestMode from the current URL
|
|
37
|
+
if(de()){n.searchParams.set("zonosTestMode","1")}n.searchParams.set("from",Ne());return n.toString()};
|
|
38
|
+
/**
|
|
39
|
+
* Build an absolute redirect URL used by the BigCommerce checkout flows to
|
|
40
|
+
* navigate between the BC native `/checkout` page and the Zonos international
|
|
41
|
+
* checkout at `/`.
|
|
42
|
+
*
|
|
43
|
+
* Carries over the `zonosQaUrl` query param from the current URL (when
|
|
44
|
+
* present) so the preview Zonos elements build keeps loading after the
|
|
45
|
+
* redirect, and sets `zonosTestMode=1` when test mode is active so the
|
|
46
|
+
* destination page continues to use the test credentials.
|
|
47
|
+
*/var Re=function(e){var o=new URL(e,window.location.origin);var t=new URLSearchParams(window.location.search);var n=t.get("zonosQaUrl");if(n){o.searchParams.set("zonosQaUrl",n)}
|
|
48
|
+
// zonosDebug=1
|
|
49
|
+
if(t.get("zonosDebug")==="1"){o.searchParams.set("zonosDebug","1")}if(de()){o.searchParams.set("zonosTestMode","1")}return o.toString()};var Fe={customerGroupId:null,shouldBypass:false};
|
|
50
|
+
/**
|
|
51
|
+
* Performs the actual fetch logic to determine if the customer
|
|
52
|
+
* belongs to a bypass group.
|
|
53
|
+
*/var Me=function(e){return __awaiter(Ee,void 0,void 0,(function(){var o,t,n,r,i,s,c,a,u,d,l,f;return __generator(this,(function(h){switch(h.label){case 0:
|
|
54
|
+
// Only relevant for BigCommerce stores — permanent no-op on other platforms
|
|
55
|
+
if(!window.Zonos.isBigCommerce){return[2/*return*/,{conclusive:true,result:Fe}]}i=(o=ie.genericSettings)===null||o===void 0?void 0:o.bigcommerceBypassCustomerGroupIds;if(!(i===null||i===void 0?void 0:i.length)){if(ie.loadedConfig){
|
|
56
|
+
// Settings have finished loading and there are no bypass groups
|
|
57
|
+
// configured — this is a permanent "bypass not configured" answer.
|
|
58
|
+
return[2/*return*/,{conclusive:true,result:Fe}]}
|
|
59
|
+
// Settings haven't loaded yet — the empty list may be transient.
|
|
60
|
+
// Mark as inconclusive so a later caller retries after config loads.
|
|
61
|
+
return[2/*return*/,{conclusive:false,result:Fe}]}if(!e)return[3/*break*/,1];c=e.checkoutId;return[3/*break*/,3];case 1:return[4/*yield*/,W()];case 2:c=h.sent();h.label=3;case 3:s=c;if(!s){
|
|
62
|
+
// No active cart yet — inconclusive. Common on fresh sessions where
|
|
63
|
+
// `initBigCommerceBypassCheck` runs before the user has added anything
|
|
64
|
+
// to their cart; once the cart exists we need to re-fetch.
|
|
65
|
+
we("BigCommerce bypass check: no active cart yet, will retry on next call","info");return[2/*return*/,{conclusive:false,result:Fe}]}if(!e)return[3/*break*/,4];u=e.checkout;return[3/*break*/,6];case 4:return[4/*yield*/,Q(s)];case 5:u=h.sent();h.label=6;case 6:a=u;if(!a){
|
|
66
|
+
// API call failed (network error, non-200, etc.) — inconclusive.
|
|
67
|
+
// Caching this would permanently disable bypass for the session if
|
|
68
|
+
// the logged-in user is actually a reseller.
|
|
69
|
+
we("BigCommerce bypass check: failed to fetch checkout data, will retry","info");return[2/*return*/,{conclusive:false,result:Fe}]}d=(r=(n=(t=a.customer)===null||t===void 0?void 0:t.customerGroup)===null||n===void 0?void 0:n.id)!==null&&r!==void 0?r:null;if(d===null){we("BigCommerce bypass check: no customer group found (guest user)","info");
|
|
70
|
+
// Guest user with an active cart — a definitive "no bypass" answer.
|
|
71
|
+
return[2/*return*/,{conclusive:true,result:Fe}]}l=i.includes(d);f={customerGroupId:d,shouldBypass:l};if(l){we("BigCommerce bypass check: customer group ".concat(String(d)," is in bypass list; caller should keep the user on BC native checkout"),"info")}else{we("BigCommerce bypass check: customer group ".concat(String(d)," is not in bypass list"),"info")}return[2/*return*/,{conclusive:true,result:f}]}}))}))};
|
|
72
|
+
/**
|
|
73
|
+
* Module-level promise that holds the in-flight or resolved bypass check.
|
|
74
|
+
* Set by `initBigCommerceBypassCheck` on page load so the result is ready
|
|
75
|
+
* by the time checkout opens or the watcher fires.
|
|
76
|
+
*
|
|
77
|
+
* Automatically invalidated when a fetch resolves to an inconclusive outcome,
|
|
78
|
+
* so subsequent callers retry (e.g. after the user adds an item to their
|
|
79
|
+
* cart or after settings finish loading).
|
|
80
|
+
*/var He=null;var Ke=function(e){var o=Me(e);var t=o.then((function(e){var o=e.conclusive,n=e.result;if(!o&&He===t){
|
|
81
|
+
// Invalidate cache so the next caller performs a fresh fetch.
|
|
82
|
+
He=null}return n}));He=t;return t};
|
|
83
|
+
/**
|
|
84
|
+
* Start fetching the BigCommerce customer group on page load.
|
|
85
|
+
* Call this once during initialization (e.g. in `zonos-checkout.init()`).
|
|
86
|
+
* The fetch runs in the background; `checkBigCommerceBypassCustomerGroup`
|
|
87
|
+
* will await the result when needed.
|
|
88
|
+
*/var Ve=function(){var e;if(!window.Zonos.isBigCommerce){return}var o=(e=ie.genericSettings)===null||e===void 0?void 0:e.bigcommerceBypassCustomerGroupIds;if(!(o===null||o===void 0?void 0:o.length)){return}
|
|
89
|
+
// Fire the fetch immediately; consumers will await the same promise
|
|
90
|
+
void Ke()};
|
|
91
|
+
/**
|
|
92
|
+
* Check if the current BigCommerce customer belongs to a customer group
|
|
93
|
+
* that should bypass Zonos Checkout.
|
|
94
|
+
*
|
|
95
|
+
* If `initBigCommerceBypassCheck` was called on page load and the resulting
|
|
96
|
+
* outcome was conclusive, this returns the already-resolved (or in-flight)
|
|
97
|
+
* result without making additional API calls. If the previous outcome was
|
|
98
|
+
* inconclusive (no cart, settings not loaded), the cache was invalidated
|
|
99
|
+
* automatically and this triggers a fresh fetch.
|
|
100
|
+
*
|
|
101
|
+
* @param options.forceRefresh - When true, bypasses any cached result and
|
|
102
|
+
* always fetches fresh BigCommerce checkout data. Use this on the
|
|
103
|
+
* BigCommerce domestic checkout page when the shipping country changes,
|
|
104
|
+
* to ensure the customer group reflects the current checkout state.
|
|
105
|
+
*/var Ze=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}return __awaiter(Ee,__spreadArray([],e,true),void 0,(function(e){if(e===void 0){e={}}return __generator(this,(function(o){if(e.forceRefresh||!He){return[2/*return*/,Ke(e.preFetched)]}return[2/*return*/,He]}))}))};var Ge={guestCheckoutType:null};
|
|
106
|
+
/**
|
|
107
|
+
* BigCommerce's `/checkouts/settings` values almost never change after a
|
|
108
|
+
* merchant's initial setup, so we persist the result in `localStorage` and
|
|
109
|
+
* reuse it across page loads up to this TTL. Short enough that if the
|
|
110
|
+
* merchant flips `guest_checkout_type` the change still propagates within
|
|
111
|
+
* an hour.
|
|
112
|
+
*/var We=60*60*1e3;var Qe="zonos--bc-checkout-settings";var Ye=function(e){try{var o=window.localStorage.getItem(Qe);if(!o){return null}var t=le(o);if(!t){return null}
|
|
113
|
+
// Different store on the same origin (e.g. zonosQaUrl preview) — ignore.
|
|
114
|
+
if(t.storeHash!==e){return null}if(t.expiresAt<Date.now()){return null}return{guestCheckoutType:t.guestCheckoutType}}catch(e){
|
|
115
|
+
// localStorage access can throw in blocked-storage contexts (Safari
|
|
116
|
+
// private mode, cross-origin iframes) — treat as a cache miss so the
|
|
117
|
+
// network fallback runs.
|
|
118
|
+
return null}};var qe=function(e,o){try{var t={expiresAt:Date.now()+We,guestCheckoutType:o.guestCheckoutType,storeHash:e};window.localStorage.setItem(Qe,JSON.stringify(t))}catch(e){
|
|
119
|
+
// localStorage can be disabled / quota-exceeded in some browser contexts
|
|
120
|
+
// (private mode, cross-origin iframes) — drop silently since caching
|
|
121
|
+
// is only an optimization.
|
|
122
|
+
}};
|
|
123
|
+
/**
|
|
124
|
+
* Fetch the merchant's BigCommerce `/checkouts/settings` (via the demo-app
|
|
125
|
+
* proxy) so we can inspect `guest_checkout_type` from the storefront. The
|
|
126
|
+
* Store API is auth-gated, which is why we don't call it directly.
|
|
127
|
+
*
|
|
128
|
+
* Results are cached in `localStorage` for `CACHE_TTL_MS` so navigations
|
|
129
|
+
* inside the same store don't all pay the proxy round trip — the setting
|
|
130
|
+
* is merchant-level and rarely changes.
|
|
131
|
+
*/var Xe=function(){return __awaiter(Ee,void 0,void 0,(function(){var e,o,t,n,r,i,s;return __generator(this,(function(c){switch(c.label){case 0:if(!window.Zonos.isBigCommerce){return[2/*return*/,Ge]}o=(e=ie.checkoutSettings.bigCommerceConfig)===null||e===void 0?void 0:e.storeHash;if(!o){we("BigCommerce checkout settings: no storeHash provided — skipping fetch","info");return[2/*return*/,Ge]}t=Ye(o);if(t){return[2/*return*/,t]}return[4/*yield*/,ue("/api/bigcommerce/checkout-settings",{body:{storeHash:o},method:"POST"})];case 1:n=c.sent(),r=n.errors,i=n.json;if(r.length||!i){we("BigCommerce checkout settings: proxy call failed, falling back to guest-allowed behavior","info");return[2/*return*/,Ge]}s={guestCheckoutType:i.guestCheckoutType};qe(o,s);return[2/*return*/,s]}}))}))};var Je={redirectUrl:null,shouldForceLogin:false};
|
|
132
|
+
/**
|
|
133
|
+
* Session cache for the merchant-level "does BC require login?" answer.
|
|
134
|
+
* Hitting `/checkouts/settings` on every checkout open would add a visible
|
|
135
|
+
* round trip to the hot path, so we resolve it once and reuse — the setting
|
|
136
|
+
* is configured at the store level and very rarely changes.
|
|
137
|
+
*
|
|
138
|
+
* `null` means we haven't kicked off the fetch yet; the promise holds the
|
|
139
|
+
* eventual boolean so multiple concurrent callers deduplicate.
|
|
140
|
+
*/var $e=null;var eo=function(){if(!$e){var e=Xe().then((function(o){var t=o.guestCheckoutType;if(!t){
|
|
141
|
+
// `null` here means either the proxy call failed (transient) or the
|
|
142
|
+
// storeHash wasn't known yet. Fail open for this call, but clear
|
|
143
|
+
// the cached promise so the next caller retries instead of
|
|
144
|
+
// permanently disabling force-login for the rest of the session.
|
|
145
|
+
if($e===e){$e=null}return false}return t==="no_guest_checkout"})).catch((function(){
|
|
146
|
+
// Defense-in-depth: `fetchBigCommerceCheckoutSettings` is expected to
|
|
147
|
+
// swallow its own errors, but if anything above does reject we fail
|
|
148
|
+
// open and clear the cached promise so the next caller can retry.
|
|
149
|
+
if($e===e){$e=null}return false}));$e=e}return $e};
|
|
150
|
+
/**
|
|
151
|
+
* Kick off the `/checkouts/settings` fetch in the background on page load
|
|
152
|
+
* so the result is warm by the time the shopper opens checkout. Safe to
|
|
153
|
+
* call more than once — re-invocations reuse the in-flight/resolved
|
|
154
|
+
* promise.
|
|
155
|
+
*/var oo=function(){if(!window.Zonos.isBigCommerce){return}void eo()};
|
|
156
|
+
/**
|
|
157
|
+
* Decide whether the current BigCommerce shopper must sign in before the
|
|
158
|
+
* Zonos international checkout is allowed to open.
|
|
159
|
+
*
|
|
160
|
+
* Required conditions (all must hold):
|
|
161
|
+
* 1. Running on a BigCommerce storefront.
|
|
162
|
+
* 2. BC merchant has `guest_checkout_type === 'no_guest_checkout'` in their
|
|
163
|
+
* live `/v3/checkouts/settings` response.
|
|
164
|
+
* 3. Shopper has an active cart.
|
|
165
|
+
* 4. Shopper is not already logged in to BigCommerce.
|
|
166
|
+
*
|
|
167
|
+
* Returning a `redirectUrl` is an instruction, not an action: callers drive
|
|
168
|
+
* the navigation themselves so they can short-circuit any UI state (loading
|
|
169
|
+
* overlays, dialog open flags) before `window.location.href` flips.
|
|
170
|
+
*/var to=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}return __awaiter(Ee,__spreadArray([],e,true),void 0,(function(e){var o,t,n,r,i;var s=e===void 0?{}:e,c=s.preFetched;return __generator(this,(function(e){switch(e.label){case 0:if(!window.Zonos.isBigCommerce){return[2/*return*/,Je]}return[4/*yield*/,eo()];case 1:o=e.sent();if(!o){return[2/*return*/,Je]}if(!c)return[3/*break*/,2];n=c.checkoutId;return[3/*break*/,4];case 2:return[4/*yield*/,W()];case 3:n=e.sent();e.label=4;case 4:t=n;if(!t){
|
|
171
|
+
// No active cart — nothing to protect. Force-login only matters once
|
|
172
|
+
// the shopper has a cart we're about to carry into Zonos checkout.
|
|
173
|
+
return[2/*return*/,Je]}if(!c)return[3/*break*/,5];i=c.checkout;return[3/*break*/,7];case 5:return[4/*yield*/,Q(t)];case 6:i=e.sent();e.label=7;case 7:r=i;if(!r){
|
|
174
|
+
// Storefront API failure — fail open so a transient outage doesn't
|
|
175
|
+
// block the shopper. The merchant's BC checkout will still enforce
|
|
176
|
+
// login server-side as a last line of defense.
|
|
177
|
+
we("BigCommerce force-login check: failed to fetch checkout data, allowing flow to continue","info");return[2/*return*/,Je]}if(Y(r)){return[2/*return*/,Je]}we("BigCommerce force-login check: guest shopper on no-guest-checkout store, redirecting to /login.php","info");return[2/*return*/,{redirectUrl:je(),shouldForceLogin:true}]}}))}))};
|
|
178
|
+
/**
|
|
179
|
+
* Mark we've already rewritten a given anchor so the MutationObserver
|
|
180
|
+
* doesn't loop on its own mutation.
|
|
181
|
+
*/var no="data-zonos-login-from-rewritten";var ro='a[href*="login.php?action=create_account"]:not(['+no+"])";var io=function(){var e=document.querySelectorAll(ro);if(!e.length){return}var o=je({action:"create_account"});e.forEach((function(e){e.setAttribute("href",o);e.setAttribute(no,"true")}))};
|
|
182
|
+
/**
|
|
183
|
+
* On BigCommerce's `/login.php`, the default **Create account** button links
|
|
184
|
+
* to `login.php?action=create_account` without the `from=cart.php...`
|
|
185
|
+
* parameter that the shopper had when they arrived. Without this, completing
|
|
186
|
+
* signup would drop them on the account home page instead of resuming Zonos
|
|
187
|
+
* international checkout.
|
|
188
|
+
*
|
|
189
|
+
* This watcher finds any create-account anchor on the page (including ones
|
|
190
|
+
* that the BC theme renders later via Stencil bundle load) and rewrites the
|
|
191
|
+
* `href` so the account-creation round trip preserves the
|
|
192
|
+
* `isInternationalCheckout=true` flag as well as `zonosTestMode` /
|
|
193
|
+
* `zonosQaUrl`.
|
|
194
|
+
*
|
|
195
|
+
* Safe to call more than once — idempotent thanks to the `data-zonos-…`
|
|
196
|
+
* attribute on rewritten anchors.
|
|
197
|
+
*/var so=function(){if(!window.Zonos.isBigCommerce){return}if(!window.location.pathname.includes("/login.php")){return}io();
|
|
198
|
+
// BC's login page often renders the auth form asynchronously, so the
|
|
199
|
+
// anchor may not exist yet when this runs. Observe for a short window,
|
|
200
|
+
// then stop so we don't leak a listener for the rest of the session.
|
|
201
|
+
var e=new MutationObserver((function(){io()}));e.observe(document.body,{childList:true,subtree:true});
|
|
202
|
+
// 10 seconds is plenty for the login form to mount; stopping the observer
|
|
203
|
+
// avoids churn from the rest of the page's normal DOM activity.
|
|
204
|
+
setTimeout((function(){return e.disconnect()}),1e4)};var co=function(e,o){
|
|
205
|
+
// Skip entries missing the fields the address form treats as required.
|
|
206
|
+
if(!e.address1||!e.countryCode){return null}var t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim();return{address:{city:e.city||"",country:e.countryCode,line1:e.address1,line2:e.address2||"",postal_code:e.postalCode||"",
|
|
207
|
+
// Prefer the ISO subdivision code when present so it round-trips through
|
|
208
|
+
// Stripe; fall back to the human-readable state name.
|
|
209
|
+
state:e.stateOrProvinceCode||e.stateOrProvince||""},email:o,name:t,phone:e.phone||""}};var ao=function(e){return[e.address.line1,e.address.line2||"",e.address.postal_code,e.address.country].join("|").toLowerCase()};
|
|
210
|
+
/**
|
|
211
|
+
* Extract a logged-in BigCommerce shopper's known addresses from a Storefront
|
|
212
|
+
* API checkout response and convert them into the shape that `zonos-address`
|
|
213
|
+
* consumes (`StripeStoreContactOption[]`).
|
|
214
|
+
*
|
|
215
|
+
* Combines the saved address book (`customer.addresses`) with any address
|
|
216
|
+
* already attached to the active checkout's consignments, so a shopper who
|
|
217
|
+
* just selected a one-off shipping address on BC native checkout still sees
|
|
218
|
+
* that address in the international checkout's address picker. Deduplicates
|
|
219
|
+
* by line1 + line2 + postal code + country.
|
|
220
|
+
*
|
|
221
|
+
* Callers must supply `isShippable` so addresses outside the merchant's
|
|
222
|
+
* shipping zones are filtered out — international checkout can't fulfill
|
|
223
|
+
* them and showing them would just confuse the shopper. The optional
|
|
224
|
+
* `selectedCountryCode` floats addresses in that country to the top of the
|
|
225
|
+
* list so the shopper's current destination is the default choice.
|
|
226
|
+
*
|
|
227
|
+
* Returns an empty list for guest sessions (no `customer.id`) or when the
|
|
228
|
+
* checkout response is missing the relevant includes.
|
|
229
|
+
*/var uo=function(e,o){var t,n,r,i;if(!((t=e===null||e===void 0?void 0:e.customer)===null||t===void 0?void 0:t.id)){return[]}var s=o.isShippable,c=o.selectedCountryCode;var a=e.customer.email||"";var u=(r=(n=e.consignments)===null||n===void 0?void 0:n.flatMap((function(e){return e.shippingAddress?[e.shippingAddress]:[]})))!==null&&r!==void 0?r:[];var d=(i=e.customer.addresses)!==null&&i!==void 0?i:[];var l=new Set;var f=[];
|
|
230
|
+
// Iterate saved addresses first so the dedup key for an address present in
|
|
231
|
+
// both lists keeps the saved-book version (which carries an `id` and is the
|
|
232
|
+
// shopper's canonical entry).
|
|
233
|
+
for(var h=0,v=__spreadArray(__spreadArray([],d,true),u,true);h<v.length;h++){var m=v[h];var g=co(m,a);if(!g){continue}if(!s(g.address.country)){continue}var p=ao(g);if(l.has(p)){continue}l.add(p);f.push(g)}if(!c){return f}
|
|
234
|
+
// Stable-sort the survivors so addresses matching the currently-selected
|
|
235
|
+
// country come first while everything else keeps its original order.
|
|
236
|
+
return f.map((function(e,o){return{index:o,option:e}})).sort((function(e,o){var t=e.option.address.country===c;var n=o.option.address.country===c;if(t===n){return e.index-o.index}return t?-1:1})).map((function(e){return e.option}))};var lo=function(e){if(e===void 0){e=true}if(!q.localizationLoaded){return true}if(q.isDisabledCountry){if(e){we("Checkout: disabled country")}return true}return false};var fo=function(e,
|
|
237
|
+
/**
|
|
238
|
+
* If provided, will check if the country is shippable based on the provided country code instead of the Hello selected country code
|
|
239
|
+
*/
|
|
240
|
+
o){if(e===void 0){e=true}var t;if(!q.localizationLoaded){return false}if(o){var n=!!((t=q.shippingZoneCountries)===null||t===void 0?void 0:t[o])&&!ie.disabledCountries.includes(o);if(e&&!n){we("Checkout: ".concat(o," is not a shippable country: ").concat(n))}return n}
|
|
241
|
+
// if localization is loaded and the localization is not a shippable country, keep the original click event
|
|
242
|
+
if(!q.isShippableCountry){if(e){we("Checkout: not shippable country")}return false}return true};var ho='select[name="shippingAddress.countryCode"]';
|
|
243
|
+
/**
|
|
244
|
+
* Native BigCommerce shipping-step "Continue" button. Clicking it commits the
|
|
245
|
+
* selected shipping address and advances to the payment step.
|
|
246
|
+
*/var vo="#checkout-shipping-continue, #checkout-billing-continue, #checkout-payment-continue";
|
|
247
|
+
/**
|
|
248
|
+
* Check if the logged-in user already has a shipping address on the checkout
|
|
249
|
+
* that is internationally shippable. If so, optionally prompt the user to
|
|
250
|
+
* confirm before saving the address to session and redirecting to the home
|
|
251
|
+
* page to open the international checkout.
|
|
252
|
+
*/var mo=function(e){return __awaiter(Ee,[e],void 0,(function(e){var o,t,n,r,i,c,a,u,d,l,f,h,v,m,g,p,w,z;var k=e.onInternationalCheckoutSelected,y=e.onLoggedInInternationalAddressDetected;return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,W()];case 1:f=e.sent();if(!f){return[2/*return*/,"noAction"]}return[4/*yield*/,Q(f)];case 2:h=e.sent();v={checkout:h,checkoutId:f};return[4/*yield*/,Ze({preFetched:v})];case 3:m=e.sent().shouldBypass;if(m){return[2/*return*/,"noAction"]}g=(t=(o=h===null||h===void 0?void 0:h.consignments)===null||o===void 0?void 0:o[0])===null||t===void 0?void 0:t.shippingAddress;if(!(g===null||g===void 0?void 0:g.countryCode)){return[2/*return*/,"noAction"]}p=g.countryCode;if(!fo(false,p)){return[2/*return*/,"noAction"]}we(y?"Logged-in user has international shipping address: ".concat(p,", prompting user to choose checkout"):"Logged-in user has international shipping address: ".concat(p,", redirecting automatically (legacy behavior)"),"info");if(!y)return[3/*break*/,5];return[4/*yield*/,y()];case 4:w=e.sent();if(w==="stay"){we("User opted to stay on BigCommerce native checkout despite international default address","info");return[2/*return*/,"optedOut"]}e.label=5;case 5:return[4/*yield*/,to({preFetched:v})];case 6:z=e.sent();if(z.shouldForceLogin&&z.redirectUrl){window.location.href=z.redirectUrl;return[2/*return*/,"redirected"]}if(!k)return[3/*break*/,8];return[4/*yield*/,k()];case 7:e.sent();e.label=8;case 8:
|
|
253
|
+
// Update localization store with the detected country
|
|
254
|
+
X({isInitializing:false,newSelectedCountryCode:p});
|
|
255
|
+
// Save the shipping address to session storage for the international checkout
|
|
256
|
+
s({address1:(n=g.address1)!==null&&n!==void 0?n:"",address2:(r=g.address2)!==null&&r!==void 0?r:"",city:(i=g.city)!==null&&i!==void 0?i:"",countryCode:p,firstName:(c=g.firstName)!==null&&c!==void 0?c:"",lastName:(a=g.lastName)!==null&&a!==void 0?a:"",phone:(u=g.phone)!==null&&u!==void 0?u:"",postalCode:(d=g.postalCode)!==null&&d!==void 0?d:"",state:(l=g.stateOrProvince)!==null&&l!==void 0?l:""});
|
|
257
|
+
// Redirect to home page — the home page will open the international checkout
|
|
258
|
+
// when it detects the domestic shipping session. Carry over zonosQaUrl /
|
|
259
|
+
// zonosTestMode so the destination page keeps using the same build/env.
|
|
260
|
+
window.location.href=Re("/");return[2/*return*/,"redirected"]}}))}))};
|
|
261
|
+
/**
|
|
262
|
+
* Watch for changes in domestic checkout step. Redirects user to home page to open international checkout when user selects a country in the international shipping zone.
|
|
263
|
+
* @note Only works on default bigcommerce checkout page
|
|
264
|
+
*/var go=function(e){var o=e.domesticRedirectedBtnSelector,t=e.onInternationalCheckoutSelected,n=e.onLoggedInInternationalAddressDetected,r=e.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}
|
|
265
|
+
/**
|
|
266
|
+
* Keep checking.
|
|
267
|
+
* @returns `true` if the caller should stop polling — either because the user
|
|
268
|
+
* is being redirected to Zonos international checkout, or because the
|
|
269
|
+
* logged-in customer is in a bypass group and should stay on BC checkout.
|
|
270
|
+
*/var c=function(e){return __awaiter(Ee,void 0,void 0,(function(){var o,n,r,i,c,a,u,d,l,f;return __generator(this,(function(h){switch(h.label){case 0:n=document.querySelector(((o=ie.genericSettings)===null||o===void 0?void 0:o.bigcommerceDomesticCheckoutCountrySelector)||ho);r=(n===null||n===void 0?void 0:n.value)||e;if(!r){
|
|
271
|
+
// do nothing if shipping country is not found
|
|
272
|
+
return[2/*return*/,"noAction"]}if(!fo(false,r)){
|
|
273
|
+
// do nothing if shipping country is not shippable
|
|
274
|
+
return[2/*return*/,"noAction"]}return[4/*yield*/,W()];case 1:i=h.sent();if(!i)return[3/*break*/,3];return[4/*yield*/,Q(i)];case 2:a=h.sent();return[3/*break*/,4];case 3:a=null;h.label=4;case 4:c=a;u={checkout:c,checkoutId:i};return[4/*yield*/,Ze({forceRefresh:true,preFetched:u})];case 5:d=h.sent().shouldBypass;if(d){
|
|
275
|
+
// Logged-in customer is in a bypass group — keep them on BC native
|
|
276
|
+
// checkout and stop polling / fetching further.
|
|
277
|
+
we("Bypass customer group detected on BC checkout, stopping interval","info");return[2/*return*/,"bypass"]}return[4/*yield*/,to({preFetched:u})];case 6:l=h.sent();if(l.shouldForceLogin&&l.redirectUrl){window.location.href=l.redirectUrl;return[2/*return*/,"redirected"]}if(!t)return[3/*break*/,8];return[4/*yield*/,t()];case 7:h.sent();h.label=8;case 8:
|
|
278
|
+
// update the country code in localization store and check if it's shippable
|
|
279
|
+
X({isInitializing:false,newSelectedCountryCode:r});f={address1:"",address2:"",city:"",countryCode:r,firstName:"",lastName:"",phone:"",postalCode:"",stateOrProvince:""};
|
|
280
|
+
// save the shipping address to session storage
|
|
281
|
+
s({address1:f.address1,address2:f.address2,city:f.city,countryCode:f.countryCode,firstName:f.firstName,lastName:f.lastName,phone:f.phone,postalCode:f.postalCode,state:f.stateOrProvince});
|
|
282
|
+
// redirect to home page, home page then will open the checkout dialog if
|
|
283
|
+
// having domestic shipping session. Carry over zonosQaUrl / zonosTestMode
|
|
284
|
+
// so the destination page keeps using the same build/env.
|
|
285
|
+
window.location.href=Re("/");return[2/*return*/,"redirected"]}}))}))};
|
|
286
|
+
/**
|
|
287
|
+
* When `true`, the logged-in "Continue" hook re-dispatched the shopper's
|
|
288
|
+
* click so BigCommerce's own handler can run (domestic / bypass case). The
|
|
289
|
+
* hook's listener sees this flag and lets the event through untouched.
|
|
290
|
+
*/var a=false;
|
|
291
|
+
/**
|
|
292
|
+
* Set to `true` once the document-level "Continue" click delegation has been
|
|
293
|
+
* attached, so opting out repeatedly doesn't bind it more than once.
|
|
294
|
+
*/var u=false;
|
|
295
|
+
/**
|
|
296
|
+
* Resolve the shopper's currently-selected shipping country on the BC native
|
|
297
|
+
* checkout. Logged-in shoppers picking a saved address don't expose a
|
|
298
|
+
* country `<select>`, so read it from the active checkout consignment via the
|
|
299
|
+
* Storefront API; fall back to the `<select>` value when one is present.
|
|
300
|
+
*/var d=function(){return __awaiter(Ee,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:return[4/*yield*/,W()];case 1:r=a.sent();if(!r)return[3/*break*/,3];return[4/*yield*/,Q(r)];case 2:i=a.sent();s=(t=(o=(e=i===null||i===void 0?void 0:i.consignments)===null||e===void 0?void 0:e[0])===null||o===void 0?void 0:o.shippingAddress)===null||t===void 0?void 0:t.countryCode;if(s){return[2/*return*/,s]}a.label=3;case 3:c=document.querySelector(((n=ie.genericSettings)===null||n===void 0?void 0:n.bigcommerceDomesticCheckoutCountrySelector)||ho);return[2/*return*/,(c===null||c===void 0?void 0:c.value)||null]}}))}))};
|
|
301
|
+
/**
|
|
302
|
+
* Req 2 (05CHECK-887): once a logged-in shopper with an international default
|
|
303
|
+
* address has chosen to "Stay on this page", we must still force them onto
|
|
304
|
+
* the Zonos international checkout if they end up committing an international
|
|
305
|
+
* shipping address. BC's saved-address flow exposes no country `<select>` to
|
|
306
|
+
* poll, so we hook the native shipping "Continue" button and re-check the
|
|
307
|
+
* selected consignment country when the shopper tries to advance.
|
|
308
|
+
*/
|
|
309
|
+
/**
|
|
310
|
+
* Resolve the selected shipping country when the shopper clicks the native
|
|
311
|
+
* BC "Continue" button and, if it's international, redirect to the Zonos
|
|
312
|
+
* checkout. On any outcome other than a redirect — domestic, bypass group,
|
|
313
|
+
* or an unexpected error — replay the click so BigCommerce's own handler runs
|
|
314
|
+
* and the shopper is never left stuck on the shipping step.
|
|
315
|
+
*/var l=function(e,o){return __awaiter(Ee,void 0,void 0,(function(){var t,n,r,i,s,u;return __generator(this,(function(l){switch(l.label){case 0:t=true;l.label=1;case 1:l.trys.push([1,9,,10]);n=null;l.label=2;case 2:l.trys.push([2,4,,5]);return[4/*yield*/,d()];case 3:n=l.sent();return[3/*break*/,5];case 4:r=l.sent();fe("Error resolving selected shipping country on BC continue",r);return[3/*break*/,5];case 5:
|
|
316
|
+
// When the shopper is committing an international address we're about to
|
|
317
|
+
// save the domestic shipping session and redirect to `/`. Disconnect this
|
|
318
|
+
// /checkout-page observer first: otherwise its own session-detection
|
|
319
|
+
// branch races the save — it would append the hidden redirect button and
|
|
320
|
+
// open checkout locally, consuming and clearing the session before the
|
|
321
|
+
// navigation to `/` lands, leaving the redirect a no-op. (The `/` page
|
|
322
|
+
// runs its own fresh watcher to open checkout.)
|
|
323
|
+
if(n&&fo(false,n)){o.disconnect()}if(!n)return[3/*break*/,7];return[4/*yield*/,c(n)];case 6:s=l.sent();return[3/*break*/,8];case 7:s="noAction";l.label=8;case 8:i=s;
|
|
324
|
+
// `redirected` → the page is navigating to the Zonos international
|
|
325
|
+
// checkout, so don't replay. `bypass` / `noAction` → the shopper stays on
|
|
326
|
+
// BC native checkout, so fall through and replay the click.
|
|
327
|
+
if(i==="redirected"){t=false}return[3/*break*/,10];case 9:u=l.sent();
|
|
328
|
+
// We already blocked BC's native click; if resolving the country or the
|
|
329
|
+
// redirect helper throws, replay so BC can advance rather than leaving
|
|
330
|
+
// the shopper stuck on the shipping step.
|
|
331
|
+
fe("Error handling BC continue international redirect",u);return[3/*break*/,10];case 10:if(t){a=true;e.click();a=false}return[2/*return*/]}}))}))};
|
|
332
|
+
/**
|
|
333
|
+
* Req 2 (05CHECK-887): attach the logged-in international-redirect hook via a
|
|
334
|
+
* single capture-phase listener on `document` (delegation) rather than
|
|
335
|
+
* binding the button node directly. Delegation is resilient to BC
|
|
336
|
+
* re-rendering the shipping step and — crucially — to the MutationObserver
|
|
337
|
+
* disconnecting once the country `<select>` path sets up its polling
|
|
338
|
+
* interval: the "Continue" button may only render after that point, so a
|
|
339
|
+
* node-bound listener attached from the observer could miss it entirely.
|
|
340
|
+
* Attached once, on opt-out.
|
|
341
|
+
*/var f=function(e){if(u){return}u=true;document.addEventListener("click",(function(o){
|
|
342
|
+
// Programmatic replay for the domestic / bypass case — let BC's own
|
|
343
|
+
// handler run without interference.
|
|
344
|
+
if(a){return}var t=o.target;if(!(t instanceof Element)){return}var n=t.closest(vo);if(!n){return}
|
|
345
|
+
// Block BC's native advance until we know whether the selected shipping
|
|
346
|
+
// country forces an international redirect. Capture phase +
|
|
347
|
+
// stopImmediatePropagation (done synchronously here, before the async
|
|
348
|
+
// handler) prevents BC's React click handler from firing.
|
|
349
|
+
o.preventDefault();o.stopImmediatePropagation();void l(n,e)}),true)};var h=false;var v=false;var m=false;
|
|
350
|
+
/**
|
|
351
|
+
* Set to `true` once the logged-in user has been prompted about a detected
|
|
352
|
+
* international default address and chose to stay on the BigCommerce native
|
|
353
|
+
* checkout. Prevents the observer from re-prompting on subsequent DOM
|
|
354
|
+
* mutations.
|
|
355
|
+
*/var g=false;
|
|
356
|
+
/**
|
|
357
|
+
* Set to `true` while the logged-in international-address confirmation
|
|
358
|
+
* dialog is open and we are awaiting the user's response. While this
|
|
359
|
+
* flag is set the polling interval must not call
|
|
360
|
+
* `handleInternationalCheckoutSelected` — otherwise the interval would
|
|
361
|
+
* detect the pre-filled international country, show the loading dialog,
|
|
362
|
+
* and redirect before the user has responded to the confirm prompt.
|
|
363
|
+
*/var p=false;
|
|
364
|
+
// NOTE: We intentionally do NOT await `checkBigCommerceBypassCustomerGroup()`
|
|
365
|
+
// here before attaching the MutationObserver. The bypass check involves two
|
|
366
|
+
// Storefront API round-trips, and awaiting it synchronously would delay
|
|
367
|
+
// observer registration — on fast-rendering BC pages that window can cause
|
|
368
|
+
// us to miss the initial DOM mutations and never trigger the redirect.
|
|
369
|
+
// Bypass is already enforced inside `checkLoggedInUserShippingAddress` and
|
|
370
|
+
// `handleInternationalCheckoutSelected` (both consult the helper), so the
|
|
371
|
+
// top-level gate is redundant. `initBigCommerceBypassCheck()` is called on
|
|
372
|
+
// page load so those inner calls typically resolve against a warm cache.
|
|
373
|
+
var w=new MutationObserver((function(){return __awaiter(Ee,void 0,void 0,(function(){var e,s,a,u,d,l,z,k,y,b;var _=this;return __generator(this,(function(C){switch(C.label){case 0:s=document.querySelector(o);a=i();
|
|
374
|
+
// append a hidden button to the body if the shipping address session is found
|
|
375
|
+
if(!s&&a){u=document.createElement("button");u.style.display="none";u.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(u);r===null||r===void 0?void 0:r(a);
|
|
376
|
+
// disconnect the observer after we found the shipping continue button
|
|
377
|
+
w.disconnect();return[2/*return*/]}d=window.location.pathname.includes("/checkout")&&window.Zonos.isBigCommerce;
|
|
378
|
+
// Should just disconnect the observer if it's not bigcommerce domestic checkout page
|
|
379
|
+
if(!d){w.disconnect();return[2/*return*/]}if(!(!g&&!m))return[3/*break*/,5];m=true;p=true;C.label=1;case 1:C.trys.push([1,3,4,5]);return[4/*yield*/,mo({onInternationalCheckoutSelected:t,onLoggedInInternationalAddressDetected:n})];case 2:l=C.sent();if(l==="redirected"){w.disconnect();return[2/*return*/]}if(l==="optedOut"){
|
|
380
|
+
// User elected to stay on BC native checkout — don't prompt again
|
|
381
|
+
// for the rest of this session. Continue with the rest of the
|
|
382
|
+
// observer logic so the country-change watcher still fires when
|
|
383
|
+
// the user manually picks an international country in BC's UI.
|
|
384
|
+
g=true;
|
|
385
|
+
// Attach the "Continue" redirect hook now (once). Delegation on
|
|
386
|
+
// `document` keeps it working even after this observer disconnects
|
|
387
|
+
// when the country <select> path sets up its interval below.
|
|
388
|
+
f(w)}return[3/*break*/,5];case 3:z=C.sent();fe("Error checking logged-in user shipping address",z);return[3/*break*/,5];case 4:m=false;p=false;return[7/*endfinally*/];case 5:k=document.querySelector(((e=ie.genericSettings)===null||e===void 0?void 0:e.bigcommerceDomesticCheckoutCountrySelector)||ho);
|
|
389
|
+
// Shouldn't do anything if it's not bigcommerce domestic checkout page
|
|
390
|
+
if(!k){
|
|
391
|
+
// do nothing if shipping country and the continue button is not found
|
|
392
|
+
return[2/*return*/]}we("Domestic checkout found - Listening for shipping country change","info",{value:k.value});
|
|
393
|
+
// Should not create a new interval if it's already created
|
|
394
|
+
if(v){return[2/*return*/]}v=true;
|
|
395
|
+
// disconnect the observer after we know that's bigcommerce domestic checkout page
|
|
396
|
+
w.disconnect();y=setInterval((function(){return __awaiter(_,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){switch(t.label){case 0:
|
|
397
|
+
// Don't redirect while the logged-in international-address confirm
|
|
398
|
+
// dialog is open — the user hasn't made their choice yet.
|
|
399
|
+
if(h||p){return[2/*return*/]}h=true;t.label=1;case 1:t.trys.push([1,3,,4]);return[4/*yield*/,c()];case 2:e=t.sent();
|
|
400
|
+
// Stop the interval once either:
|
|
401
|
+
// - the user is being redirected to Zonos international checkout
|
|
402
|
+
// - the logged-in customer is in a bypass group (stay on BC checkout)
|
|
403
|
+
if(e==="redirected"||e==="bypass"){clearInterval(y);return[2/*return*/]}h=false;return[3/*break*/,4];case 3:o=t.sent();h=false;return[3/*break*/,4];case 4:return[2/*return*/]}}))}))}),1e3);b=setInterval((function(){var e;if(!window.bcStripeElements){clearInterval(b);return}var o=(e=window.bcStripeElements)===null||e===void 0?void 0:e.getElement("address");if(!o){return}clearInterval(b);o.on("change",(function(e){var o=e.value.address.country;if(o&&!p){void c(o)}}));
|
|
404
|
+
// we want to attacch event to addressElement as soon as it's loaded
|
|
405
|
+
}),500);return[2/*return*/]}}))}))}));w.observe(document.body,{childList:true,subtree:true})};var po=function(){var e=new URLSearchParams(window.location.search);we("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return""}return t};var t=
|
|
406
|
+
// fallback to selected country code if country is not provided
|
|
407
|
+
J(e)||q.selectedCountryCode||"US";var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerPhone");var u=o("customerZip");var d=o("customerState");var l=o("customerFirstName");var f=o("customerLastName");return{customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:l,customerLastName:f,customerName:c,customerPhone:a,customerState:d,customerZip:u}};var wo=0;var zo=function(){return __awaiter(Ee,void 0,void 0,(function(){var e,o;var t;return __generator(this,(function(n){switch(n.label){case 0:
|
|
408
|
+
// Don't send the log if there are no API calls to send
|
|
409
|
+
if(window.Zonos.loadTimeApiInfoList.length===0){return[2/*return*/]}we("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});e={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};
|
|
410
|
+
// Clear the list after sending the log successfully
|
|
411
|
+
window.Zonos.loadTimeApiInfoList.length=0;return[4/*yield*/,ue("/api/zonos-elements/log-bulk-load-data",{body:e,method:"POST"})];case 1:o=n.sent().errors;if(o.length){
|
|
412
|
+
// If there are errors, add the logs back to the list so we can try again later
|
|
413
|
+
(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);wo++;if(wo>5&&window.Zonos.logIntervalId){
|
|
414
|
+
// If there are more than 3 failures, stop the interval
|
|
415
|
+
clearInterval(window.Zonos.logIntervalId)}}return[2/*return*/]}}))}))};var ko=function(){return __awaiter(Ee,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){e=ze().elapsedTime;o={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:e,metadata:Object.assign({allLogs:ke},he()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId||0};void ue("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2/*return*/]}))}))};var yo=function(e){return __awaiter(Ee,[e],void 0,(function(e){var o;var t=e.loadTime;return __generator(this,(function(e){o={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:ke},he()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId||0};void ue("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2/*return*/]}))}))};var bo=function(e){return(e===null||e===void 0?void 0:e.filter((function(e){if(e.expiresAt&&e.expiresAt<Date.now()||!e.expiresAt){return false}return true})))||[]};var _o=function(e){var o;var t=(o=$.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){return o.testKey===e}));return(t===null||t===void 0?void 0:t.selectedVariantKey)||null};var Co=function(e){return ie.enabledVariantTestKeys.includes(e)};var xo=function(e){var o=e.baseTestObj,t=e.mergeTestObj;return o.map((function(e){var o=e.testKey;
|
|
416
|
+
// We will attempt to get the enabled selection from localStorage first and only re-fetch if the testKeys are changed
|
|
417
|
+
var n=t.find((function(e){var t=e.testKey;return t===o}));return{expiresAt:(n===null||n===void 0?void 0:n.expiresAt)||Date.now()+ee,selectedVariantKey:(n===null||n===void 0?void 0:n.selectedVariantKey)||null,testKey:o}}))};var So=function(e){return __awaiter(Ee,[e],void 0,(function(e){var o,t,n,r,i;var s=e.cartId,c=e.retries;return __generator(this,(function(e){switch(e.label){case 0:o=de();return[4/*yield*/,ue("/api/zonos-elements/get-temp-cart",{body:{isTestMode:o,options:{noOnlineStoreSettings:true},tempCartUUID:s},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=e.sent(),n=t.errors,r=t.json;i=!r||n.length;if(!(i&&c))return[3/*break*/,3];we("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});
|
|
418
|
+
// wait 1 second before retrying
|
|
419
|
+
return[4/*yield*/,new Promise((function(e){return setTimeout(e,500)}))];case 2:
|
|
420
|
+
// wait 1 second before retrying
|
|
421
|
+
e.sent();return[2/*return*/,So({cartId:s,retries:c-1})];case 3:if(i){return[2/*return*/,null]}return[2/*return*/,r]}}))}))};var To=function(e){return __awaiter(Ee,void 0,void 0,(function(){var o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:o=ye(e),t=o.isDgsCartId,n=o.isLegacyCartId;if(!n&&!t){fe("[ZONOS - loadZonos] invalid cart id");return[2/*return*/,null]}return[4/*yield*/,So({cartId:e,retries:5})];case 1:r=i.sent();we("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){fe("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2/*return*/,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2/*return*/,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var Io='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var Ao=function(){return".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h{z-index:2147483647;position:fixed}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}.zonos--processing-payment.sc-zonos-checkout-h{z-index:2147483646}"};
|
|
422
|
+
// 90 minutes
|
|
423
|
+
var Oo=90*60*1e3;
|
|
424
|
+
// 6 hours
|
|
425
|
+
var Bo=6*60*60*1e3;var Eo=e("zonos_checkout",/** @class */function(){function e(e){var t=this;o(this,e);this.storeUnsubscribeList=[];this.isRedirectAfterOrder=false;
|
|
426
|
+
/**
|
|
427
|
+
* Preview checkout without needing to click on the button. This would be useful for demo purpose
|
|
428
|
+
*/this.preview=false;
|
|
429
|
+
/**
|
|
430
|
+
* Hidden mode to hide the checkout modal in preview mode
|
|
431
|
+
*/this.hiddenMode=false;
|
|
432
|
+
/**
|
|
433
|
+
* Flag to determine if the checkout is on mobile
|
|
434
|
+
*/this.mobile=false;
|
|
435
|
+
/**
|
|
436
|
+
* Default address to use for the checkout (preview mode)
|
|
437
|
+
*/this.defaultAddress=[];
|
|
438
|
+
/**
|
|
439
|
+
* Force dialog to be open
|
|
440
|
+
*/this.forceDialogOpen=false;this.defaultAddressParams=[];
|
|
441
|
+
/**
|
|
442
|
+
* List of addresses from authenticated checkout customer
|
|
443
|
+
*/this.defaultCustomerProfileAddress=[];
|
|
444
|
+
/**
|
|
445
|
+
* Customer profile of the authenticated checkout user
|
|
446
|
+
*/this.customerProfile=null;
|
|
447
|
+
/**
|
|
448
|
+
* Whether or not the dialog is open
|
|
449
|
+
*/this.open=this.forceDialogOpen;
|
|
450
|
+
/**
|
|
451
|
+
* Whether or not the overlay is loading (for waiting for fetching test variance)
|
|
452
|
+
*/this.isOverlayLoading=false;
|
|
453
|
+
/**
|
|
454
|
+
* The stripe instance
|
|
455
|
+
*/this.stripe=window.Zonos.stripe;
|
|
456
|
+
/**
|
|
457
|
+
* Whether or not the submit button is loading in `step` component
|
|
458
|
+
*/this.submitLoading=false;
|
|
459
|
+
// default to collapse the review on mobile
|
|
460
|
+
this.collapseReviewMobile=true;
|
|
461
|
+
/**
|
|
462
|
+
* Determine if we should skip and not hijack the Checkout button click event
|
|
463
|
+
* Sometimes stripe or our api has error, we don't want to hijack the click event.
|
|
464
|
+
*/this.isAttachError=false;this.isMobile=false;this.isIframed=false;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;
|
|
465
|
+
/**
|
|
466
|
+
* Confirm dialog open state
|
|
467
|
+
*/this.confirmDialogOpen=false;
|
|
468
|
+
/**
|
|
469
|
+
* Cart expired state to show the cart expired dialog
|
|
470
|
+
*/this.isCartExpired=false;
|
|
471
|
+
/**
|
|
472
|
+
* Pay in USD confirm dialog open state
|
|
473
|
+
*/this.payInUsdConfirmDialogOpen=false;
|
|
474
|
+
/**
|
|
475
|
+
* Error message from onInventoryCheck callback
|
|
476
|
+
*/this.inventoryCheckErrorMessage=null;
|
|
477
|
+
/**
|
|
478
|
+
* Placed order info to show the confirm dialog to the user
|
|
479
|
+
*/this.placedOrderInfo=null;
|
|
480
|
+
/**
|
|
481
|
+
* Whether or not the fedex shipping dialog should be shown
|
|
482
|
+
*/this.shouldShowFedexShippingConsentDialog=false;
|
|
483
|
+
/**
|
|
484
|
+
* Whether or not the domestic checkout dialog should be shown
|
|
485
|
+
*/this.detectedDomesticCheckoutDialogOpen=false;
|
|
486
|
+
/**
|
|
487
|
+
* Whether or not the redirect to domestic checkout dialog should be shown.
|
|
488
|
+
* This is for BigCommerce stores when the user selects a domestic country in the international checkout.
|
|
489
|
+
*/this.redirectToDomesticCheckoutDialogOpen=false;
|
|
490
|
+
/**
|
|
491
|
+
* Whether or not the confirm dialog for a logged-in BigCommerce user with a
|
|
492
|
+
* detected international default shipping address is shown. The user must
|
|
493
|
+
* choose to either continue to the international checkout or stay on the
|
|
494
|
+
* BigCommerce native checkout (and select a domestic address there).
|
|
495
|
+
*/this.loggedInIntlAddressConfirmDialogOpen=false;
|
|
496
|
+
/**
|
|
497
|
+
* Resolver for the promise returned to
|
|
498
|
+
* `watchImmediateBigcommerceDomesticCheckoutRedirect` while we wait for
|
|
499
|
+
* the user's choice in `loggedInIntlAddressConfirmDialogOpen`.
|
|
500
|
+
*/this.loggedInIntlAddressResolver=null;
|
|
501
|
+
/**
|
|
502
|
+
* Client secret value
|
|
503
|
+
*/this.clientSecret=c.clientSecret;
|
|
504
|
+
/**
|
|
505
|
+
* Client secret value of customer session (use to load saved payment method and render saved consent)
|
|
506
|
+
*/this.stripeCustomerSessionClientSecret=c.stripeCustomerSessionClientSecret;this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:r=((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme)||ie.appearance.theme;return[4/*yield*/,a({overrideBorderRadius:(o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,
|
|
507
|
+
// only override theme or theme from appearance if it's mobile
|
|
508
|
+
overrideTheme:this.isMobile?r:undefined,paypalEnabled:H()})];case 1:i.sent();return[2/*return*/]}}))}))};
|
|
509
|
+
/**
|
|
510
|
+
* Check if stripe payment intent is succeeded or in a good state to move forward
|
|
511
|
+
*/this.checkStripePaymentIntentStatus=function(e){return __awaiter(t,[e],void 0,(function(e){var o,t,n,r,i,s,a,d,l;var f=e.triggeredButton;return __generator(this,(function(e){switch(e.label){case 0:o=f===null||f===void 0?void 0:f.matches("#".concat(be));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");i=n.get("zonosCheckoutSessionId");
|
|
512
|
+
// Allow to proceed to order if Checkout is triggered by Checkout button click by user
|
|
513
|
+
if(!o){we("Checkout is triggered by user, no need to check stripe payment intent status");return[2/*return*/,{shouldAllowOrder:true}]}we("Payment intent exist, checking stripe payment intent status");
|
|
514
|
+
// Allow to proceed to order if there's no stripe client secret and cart data is available
|
|
515
|
+
if(!r){we("No stripe client secret found in the URL, proceed to order if cart data is available");return[2/*return*/,{shouldAllowOrder:t}]}return[4/*yield*/,u({clientSecret:r})];case 1:s=e.sent(),a=s.error,d=s.status;l=new URLSearchParams(window.location.search).get("redirect_status");
|
|
516
|
+
// If just redirected from Payment provider, show the success screen or error screen based on the status
|
|
517
|
+
if(l){if(!a){we("Payment intent is succeeded or in a good state to move forward, show success screen")}else{we("Payment intent failed, show status from error")}this.open=true;$.checkoutSessionId=i;c.clientSecret=r;void this.setToFinishStep(d);return[2/*return*/,{shouldAllowOrder:false}]}if(!t){we("Cart data is not available, only check payment intent status, skip order.");return[2/*return*/,{shouldAllowOrder:false}]}we("Payment intent is not succeeded, proceed to order");return[2/*return*/,{shouldAllowOrder:true}]}}))}))};
|
|
518
|
+
/**
|
|
519
|
+
* Recover an order-modification payment-only session that was already
|
|
520
|
+
* completed (or already paid but not yet completed) by the time this cart
|
|
521
|
+
* link is opened/reopened — e.g. the shopper paid, closed the tab before
|
|
522
|
+
* the async order-creation webhook finished, then reopened the same
|
|
523
|
+
* payment link. Without this, re-rendering the payment form would let them
|
|
524
|
+
* attempt to pay again against an already-resolved session. Mirrors
|
|
525
|
+
* zonos-collect's recoverCompletedCollectSession for its own no-shipping
|
|
526
|
+
* flow, minus the Airwallex branch (this checkout only supports Stripe).
|
|
527
|
+
*
|
|
528
|
+
* @returns `true` when it routed to the finish step, `false` when the
|
|
529
|
+
* caller should proceed with a normal init.
|
|
530
|
+
*/this.recoverCompletedOrderModificationSession=function(e){return __awaiter(t,void 0,void 0,(function(){var o,t,n,r,i;return __generator(this,(function(s){switch(s.label){case 0:
|
|
531
|
+
// getCheckoutSession() reads storageStore.checkoutSessionId internally.
|
|
532
|
+
$.checkoutSessionId=e;return[4/*yield*/,d()];case 1:o=s.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2/*return*/,false]}r=n.checkoutSession;
|
|
533
|
+
// Session already finalized → straight to finish. An order-mod
|
|
534
|
+
// payment-only session always has `order` set *before* payment too (see
|
|
535
|
+
// isOrderModificationPaymentOnlySession) - checking `order` alone would
|
|
536
|
+
// treat every first-ever open as already paid, so both must be true.
|
|
537
|
+
if(r.completedAt&&r.order){void this.setToFinishStep("succeeded");return[2/*return*/,true]}if(!r.clientSecret)return[3/*break*/,3];return[4/*yield*/,u({clientSecret:r.clientSecret})];case 2:i=s.sent().status;if(i==="processing"||i==="succeeded"){c.clientSecret=r.clientSecret;void this.setToFinishStep(i);return[2/*return*/,true]}s.label=3;case 3:return[2/*return*/,false]}}))}))};this.initializeTestKeys=function(){
|
|
538
|
+
// cleanup expired test keys
|
|
539
|
+
$.enabledVariantTestKeys=bo($.enabledVariantTestKeys||[]);
|
|
540
|
+
// map existingSelection to the enabled variant test keys from database
|
|
541
|
+
var e=ie.enabledVariantTestKeys.map((function(e){var o;
|
|
542
|
+
// We will attempt to get the enabled selection from localStorage first and only re-fetch if the testKeys are changed
|
|
543
|
+
var t=(o=$.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){var t=o.testKey;return t===e}));return{expiresAt:(t===null||t===void 0?void 0:t.expiresAt)||Date.now()+ee,selectedVariantKey:(t===null||t===void 0?void 0:t.selectedVariantKey)||null,testKey:e}}));oe(e);return{allSelected:false}};this.shouldAllowHostedVsNativeTest=function(){
|
|
544
|
+
// This test is only applicable to checkout that's using createCartid callback
|
|
545
|
+
if(typeof ie.checkoutSettings.createCartId!=="function"){return false}var e=ie.enabledVariantTestKeys.includes("hosted_vs_native");
|
|
546
|
+
// Should not do anything if the test is not enabled
|
|
547
|
+
if(!e){return false}return true};
|
|
548
|
+
// Register test hosted vs native if needed to get the variant selection for this test
|
|
549
|
+
this.registerTestHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:e=this.shouldAllowHostedVsNativeTest();if(!e){return[2/*return*/]}we("[TEST] - Registering hosted vs native test");o=_o("hosted_vs_native");
|
|
550
|
+
// No need to request variant test for this test if the test already has variant selected
|
|
551
|
+
if(o){we("[TEST] - Hosted vs native test already has variant selected: ".concat(o));return[2/*return*/]}return[4/*yield*/,Ue({testKeys:["hosted_vs_native"]})];case 1:t=r.sent();
|
|
552
|
+
// Do not prevent user from proceeding if the test is not enabled or failed to get selection
|
|
553
|
+
if(!t){we("[TEST] - Failed to get selection for hosted vs native test");return[2/*return*/]}n=xo({baseTestObj:$.enabledVariantTestKeys||[],mergeTestObj:t});
|
|
554
|
+
// Set the selected variant to the storage store
|
|
555
|
+
oe(n);return[2/*return*/]}}))}))};
|
|
556
|
+
// Handle hosted vs native test
|
|
557
|
+
this.handleHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:o=this.shouldAllowHostedVsNativeTest();if(!o){return[2/*return*/,{redirected:false}]}t=_o("hosted_vs_native");we("[TEST] - hosted_vs_native: ".concat(t));
|
|
558
|
+
// This test is only applicable to checkout that's using createCartid callback
|
|
559
|
+
if(typeof ie.checkoutSettings.createCartId!=="function"){we("[TEST] - createCartId is not provided, skipping hosted vs native test");return[2/*return*/,{redirected:false}]}
|
|
560
|
+
// No need to do anything if the test is enabled for native
|
|
561
|
+
if(t!=="hosted"){we("[TEST] - Hosted vs native test is enabled for native, skipping");return[2/*return*/,{redirected:false}]}if(!((e=ie.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){we("[TEST] - Hosted checkout URL is not provided");return[2/*return*/,{redirected:false}]}we('"createCartId" is provided, start building cart');return[4/*yield*/,ie.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=po();c=Le(Object.assign(Object.assign({cartId:r,checkoutSessionId:$.checkoutSessionId||undefined,hostedCheckoutUrl:ie.genericSettings.hostedCheckoutUrl,isTestMode:de(),isVariantTest:true},s),i));we("[TEST] - Redirecting to: ".concat(c));
|
|
562
|
+
// Open new page with the cart URL
|
|
563
|
+
window.open(c,"_blank");return[2/*return*/,{redirected:true}]}}))}))};this.formatDate=function(e){if(!e){return""}
|
|
564
|
+
// get date in 24/12/2024 format (without time)
|
|
565
|
+
var o=new Date(e);return o.toLocaleDateString()};this.formatTime=function(e){if(!e){return""}
|
|
566
|
+
// get date in 24/12/2024 format (without time)
|
|
567
|
+
var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(l.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var e=l.selectedLandedCost;if(!e){return null}var o=e.landedCost.amountSubtotals;if(!o){return null}var t=(o.discounts||0)+o.items+o.landedCostTotal+o.shipping;return{settlementAmount:t}};
|
|
568
|
+
/**
|
|
569
|
+
* For BigCommerce stores with a logged-in shopper, seed
|
|
570
|
+
* `defaultCustomerProfileAddress` from the BC Storefront API so the
|
|
571
|
+
* `zonos-address` picker prefills the shopper's saved address book without
|
|
572
|
+
* forcing them to retype anything. Skips when an address has already been
|
|
573
|
+
* prefilled by another path (Stripe customer profile, merchant-provided
|
|
574
|
+
* `defaultAddress`, or the BC redirect's session-storage handoff).
|
|
575
|
+
*/this.prefillBigCommerceCustomerAddresses=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:if(!window.Zonos.isBigCommerce){return[2/*return*/]}if(this.defaultCustomerProfileAddress.length){return[2/*return*/]}e=Array.isArray(this.defaultAddress)&&this.defaultAddress.length>0||!Array.isArray(this.defaultAddress)&&typeof this.defaultAddress==="object"&&this.defaultAddress!==null;if(e){return[2/*return*/]}return[4/*yield*/,W()];case 1:o=r.sent();if(!o){return[2/*return*/]}return[4/*yield*/,Q(o)];case 2:t=r.sent();if(!Y(t)){return[2/*return*/]}n=uo(t,{isShippable:function(e){return fo(false,e)},selectedCountryCode:q.selectedCountryCode||undefined});if(!n.length){return[2/*return*/]}
|
|
576
|
+
// Re-check after the awaits — another prefill path may have populated state
|
|
577
|
+
// while we were waiting on the network.
|
|
578
|
+
if(this.defaultCustomerProfileAddress.length){return[2/*return*/]}this.defaultCustomerProfileAddress=n;we("Prefilled ".concat(String(n.length)," BigCommerce customer address(es) for logged-in shopper"),"info");return[2/*return*/]}}))}))};this.getDefaultAddress=function(){
|
|
579
|
+
// If checkout customer is authenticated, use the address from the customer profile
|
|
580
|
+
if(t.defaultCustomerProfileAddress.length){return t.defaultCustomerProfileAddress}
|
|
581
|
+
// If default address is provided directly from the component, use it
|
|
582
|
+
if(Array.isArray(t.defaultAddress)&&t.defaultAddress.length){return t.defaultAddress}if(!Array.isArray(t.defaultAddress)&&typeof t.defaultAddress==="object"){return[t.defaultAddress]}return t.defaultAddressParams};
|
|
583
|
+
/**
|
|
584
|
+
* Message listener from the hosted checkout tab just openned from the hosted vs native variant test
|
|
585
|
+
*/this.handleHostedOpenWindowCallback=function(e){var o;
|
|
586
|
+
// check if it's from origin of hosted checkout url
|
|
587
|
+
var t=(o=ie.genericSettings)===null||o===void 0?void 0:o.hostedCheckoutUrl;
|
|
588
|
+
// Do nothing if hosted checkout url is not set
|
|
589
|
+
if(!origin){return}
|
|
590
|
+
// Do nothing if it's not from the origin of hosted checkout url
|
|
591
|
+
var n=["dev.checkout.elements.zonos.com"].some((function(o){return e.origin.includes(o)}));
|
|
592
|
+
// Do not allow to receive message if not from origin we expected when it's not dev environment
|
|
593
|
+
if(e.origin!==t&&!n){return}switch(e.data.type){case"zonos-checkout-session-update":
|
|
594
|
+
// Update and set checkout session id to storage so that if user come back to merchant site, it will persist the test variance selection
|
|
595
|
+
$.checkoutSessionId=e.data.checkoutSessionId;break}};
|
|
596
|
+
/**
|
|
597
|
+
* Capture params from the url and set to the store when it's redirected from hosted checkout url for variant test
|
|
598
|
+
*/this.captureParamsRedirectedForVariantTest=function(){var e=new URL(window.location.href);var o=e.searchParams.get("zonosVariantTest")==="1";
|
|
599
|
+
// Do nothing if the url is not loaded from hosted vs native variant test
|
|
600
|
+
if(!o){return}var t=e.searchParams.get("zonosCheckoutSessionId");if(t){$.checkoutSessionId=t}
|
|
601
|
+
// merge variant test input from url to storageStore.enabledVariantTestKeys
|
|
602
|
+
var n=$.enabledVariantTestKeys||[];
|
|
603
|
+
// override the selected variant key if it's not "hosted" since we are in hosted checkout tab
|
|
604
|
+
if(window.Zonos.isLegacyCheckout){var r=_o("hosted_vs_native");
|
|
605
|
+
// Set selected variant key "hosted" to enabledVariantTestKeys if it's not in enabledVariantTestKeys already
|
|
606
|
+
if(!r){n.push({expiresAt:Date.now()+ee,selectedVariantKey:"hosted",testKey:"hosted_vs_native"});oe(n)}else{oe(n.map((function(e){if(e.testKey==="hosted_vs_native"){return Object.assign(Object.assign({},e),{selectedVariantKey:"hosted"})}return e})))}}
|
|
607
|
+
// Remove query params from the url
|
|
608
|
+
e.searchParams.delete("zonosCheckoutSessionId");e.searchParams.delete("zonosVariantTest");window.history.replaceState({},"",e.toString())}}
|
|
609
|
+
/**
|
|
610
|
+
* Init cart info handler event
|
|
611
|
+
*/e.prototype.initCartInfoHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(t){o=e.detail;void f({adjustments:l.adjustments,cartItems:o});return[2/*return*/]}))}))};e.prototype.handleKeyPress=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(e.key==="Escape"){void this.closeDialogHandler()}return[2/*return*/]}))}))};
|
|
612
|
+
/**
|
|
613
|
+
* Close dialog action
|
|
614
|
+
*/e.prototype.closeDialogHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){if(!this.open){
|
|
615
|
+
// Do nothing if the checkout is not even open
|
|
616
|
+
return[2/*return*/]}
|
|
617
|
+
// Only proceed when user select confirmed.
|
|
618
|
+
if(!(e===null||e===void 0?void 0:e.confirmed)){this.confirmDialogOpen=true;return[2/*return*/]}
|
|
619
|
+
// Close the confirm dialog
|
|
620
|
+
this.confirmDialogOpen=false;K({event:"zonos-checkout-close",metadata:{checkoutSessionId:$.checkoutSessionId}});this.open=this.forceDialogOpen||false;if(!this.preview&&l.step==="finish"){
|
|
621
|
+
// reset cart store if it's not preview mode and only when checkout is in the finish step.
|
|
622
|
+
h()}
|
|
623
|
+
// Clear policy consent on every close (not just finish) so a buyer who
|
|
624
|
+
// checked the box mid-flow and then closed can't carry the prior
|
|
625
|
+
// acceptance into a new attempt without a fresh checkbox click.
|
|
626
|
+
if(!this.preview){v()}
|
|
627
|
+
// reset step to customer info
|
|
628
|
+
l.step="customer-info";
|
|
629
|
+
// reset the tab item, so that user needs to click on Continue button to re-quote the landed cost if needed.
|
|
630
|
+
m();
|
|
631
|
+
// clear the checkout session timeout timer when checkout dialog close action is triggered
|
|
632
|
+
g();
|
|
633
|
+
/**
|
|
634
|
+
* Trigger callback when the checkout is closed
|
|
635
|
+
*/(t=(o=ie.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(o);return[2/*return*/]}))}))};e.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,a,u,d,h,s,a,a,v,m,s,g,k,y,b;return __generator(this,(function(_){switch(_.label){case 0:if(!(typeof ie.checkoutSettings.createCartId==="function"))return[3/*break*/,4];we('"createCartId" is provided, start building cart');
|
|
636
|
+
// Reset before awaiting the merchant callback so a stale banner from a
|
|
637
|
+
// previous open is not visible while the network call is in flight.
|
|
638
|
+
l.customMessage=[];return[4/*yield*/,ie.checkoutSettings.createCartId()];case 1:o=_.sent();t=void 0;if(typeof o==="object"){we("object detected, use cartId and prefill address from createCartId","info",o);t=o.cartId;
|
|
639
|
+
// set prefill address if provided in createCartId callback result
|
|
640
|
+
this.useShippingDataFromCreateCartId(o.shippingData);l.customerAuthenticationToken=o.customerAuthenticationToken||null;
|
|
641
|
+
// Normalize against misbehaving merchant callbacks: only accept an
|
|
642
|
+
// array of strings, drop everything else so a bad value can't crash
|
|
643
|
+
// the renderer (`.filter(...)` would throw on non-arrays).
|
|
644
|
+
l.customMessage=Array.isArray(o.customMessage)?o.customMessage.filter((function(e){return typeof e==="string"})):[]}else{t=o}window.Zonos.cartId=t;return[4/*yield*/,To(t)];case 2:n=_.sent();r=n===null||n===void 0?void 0:n.cartData;if(!r){fe("Failed to build cart, please try again.");return[2/*return*/,false]}window.Zonos.cartData=r;i=ae(r),s=i.adjustments,a=i.cartItems;return[4/*yield*/,f({adjustments:s,cartItems:a})];case 3:_.sent();return[3/*break*/,12];case 4:if(!window.Zonos.cartData)return[3/*break*/,9];we("tempCartUUID is provided, start building cart");u=(e=window.Zonos.cartData.references)===null||e===void 0?void 0:e.checkoutSessionId;if(!u)return[3/*break*/,6];we("Setting checkout session id from cart reference","info",u);return[4/*yield*/,this.recoverCompletedOrderModificationSession(u)];case 5:d=_.sent();if(d){
|
|
645
|
+
// Recovery routes straight to the finish step, bypassing the
|
|
646
|
+
// cartStoreUpdateItems call below that would normally clear this -
|
|
647
|
+
// without it, the finish screen would spin forever (dialogLoading
|
|
648
|
+
// stays true while isFetchingSession is true).
|
|
649
|
+
c.isFetchingSession=false;return[2/*return*/,true]}$.checkoutSessionId=u;return[3/*break*/,7];case 6:
|
|
650
|
+
// Same as zonos-collect/zonos-invoice: without this, a checkout
|
|
651
|
+
// session id left over from a previous cart in this tab would leak
|
|
652
|
+
// into this unrelated one.
|
|
653
|
+
we("Clear checkout session id from storage so we start from a fresh session for this cart");$.checkoutSessionId=null;_.label=7;case 7:h=ae(window.Zonos.cartData),s=h.adjustments,a=h.cartItems;return[4/*yield*/,f({adjustments:s,cartItems:a})];case 8:_.sent();return[3/*break*/,12];case 9:if(!(ie.checkoutSettings.buildCartDetail&&q.selectedCountryCode))return[3/*break*/,12];we("build cart detail");return[4/*yield*/,ie.checkoutSettings.buildCartDetail({countryCode:q.selectedCountryCode,currencyCode:q.targetCurrency})];case 10:a=_.sent();v=a.filter((function(e){return e.amount>=0}));m=a.filter((function(e){return e.amount<0}));we("cartItems","info",{cartItems:a});s=m.map((function(e){return{amount:e.amount,currencyCode:e.currencyCode,description:e.name||e.description||"",productId:e.productId||null,sku:e.sku||null,type:"CART_TOTAL"}}));return[4/*yield*/,f({adjustments:s,cartItems:v})];case 11:_.sent();_.label=12;case 12:if(!!$.checkoutSessionId)return[3/*break*/,14];return[4/*yield*/,p()];case 13:g=_.sent();we("stripeStoreInitCheckoutSession: ".concat(g));if(!g){return[2/*return*/,false]}_.label=14;case 14:
|
|
654
|
+
// get and set payment intent async except for staging mode
|
|
655
|
+
if(!l.isStagingMode){void w()}
|
|
656
|
+
// apply theme to stripe elements
|
|
657
|
+
return[4/*yield*/,this.applyStripeTheme()];case 15:
|
|
658
|
+
// apply theme to stripe elements
|
|
659
|
+
_.sent();k=ie.checkoutSettings,y=k.successBehavior,b=k.successRedirectUrl;this.isRedirectAfterOrder=y==="REDIRECT_TO_SUCCESS_PAGE"||y==="CLOSE_MODAL"&&!!b||!!l.externalConfirmationPageURL;
|
|
660
|
+
// A session tied to an order that hasn't completed yet is an
|
|
661
|
+
// order-modification/adjustment collection: the shopper is only paying a
|
|
662
|
+
// delta against an already-approved landed cost, so the address/shipping
|
|
663
|
+
// steps (which would re-quote against the synthetic delta line item
|
|
664
|
+
// instead of the real shipment) are skipped in favor of jumping straight
|
|
665
|
+
// to payment, same as the Collect flow does for its own cart type. Lives
|
|
666
|
+
// here (rather than at each buildCartAndInit call site) so every caller
|
|
667
|
+
// gets it, including the forceDialogOpen/preview init path.
|
|
668
|
+
if(z()){l.step="payment"}return[2/*return*/,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=le(localStorage.getItem("zonos--placed-order-info"));if(!e){localStorage.removeItem("zonos--placed-order-info");return}var o=Date.now()-e.time;we("=== Existing placed order info: ".concat(e.orderId," - ").concat(this.formatDate(e.time)," - elapsed in hh:ss format: ").concat(new Date(o).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||Bo;
|
|
669
|
+
// if the order is placed within 5 minutes, confirm with the user to proceed with the order duplication
|
|
670
|
+
if(o>t){we("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");
|
|
671
|
+
// remove the placed order info if it's older than 5 minutes and do nothing.
|
|
672
|
+
localStorage.removeItem("zonos--placed-order-info");return}
|
|
673
|
+
// Set placed order info to show the confirm notification to the user
|
|
674
|
+
this.placedOrderInfo=e;we("=== Showing order duplication confirmation","warn")};e.prototype.recordCheckoutInfo=function(){if(!$.checkoutSessionId){return}
|
|
675
|
+
// Record the order duplication consent so we know user did see the notification and proceed with the order duplication
|
|
676
|
+
void pe({attributes:[{key:"APP_VERSION",value:window.Zonos.version},{key:"APP_VERSION_NPM_INTEGRATION",value:window.Zonos.isNpm?"1":"0"},{key:"LEGACY_CHECKOUT_FACADE",value:window.Zonos.isLegacyCheckout?"1":"0"}],checkoutSessionId:$.checkoutSessionId})};e.prototype.confirmProceedWithOrderDuplication=function(){
|
|
677
|
+
// Reset the placed order info
|
|
678
|
+
this.placedOrderInfo=null;if(!$.checkoutSessionId){return}
|
|
679
|
+
// Record the order duplication consent so we know user did see the notification and proceed with the order duplication
|
|
680
|
+
void pe({attributes:[{key:"ORDER_DUPLICATION_CONSENT",value:"1"}],checkoutSessionId:$.checkoutSessionId})};e.prototype.markTheSessionAsAbandonedCart=function(){if(!$.checkoutSessionId){return}void pe({attributes:[{key:"WITH_ABANDONED_CART_TOKEN",value:"1"}],checkoutSessionId:$.checkoutSessionId})};e.prototype.handleCancelOrderDuplication=function(){var e;
|
|
681
|
+
// Reset the placed order info
|
|
682
|
+
this.placedOrderInfo=null;
|
|
683
|
+
// Redirect to the vendor store url if this is legacy checkout
|
|
684
|
+
if(this.isLegacyCheckout){var o=((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||ie.onlineStoreSettings.url;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}void this.closeDialogHandler({confirmed:true})};e.prototype.attachCheckout=function(){var e=this;var o=ie.checkoutSettings.placeOrderButtonSelector;var t=ie.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;
|
|
685
|
+
// `_zonosBase` injects this hidden button on page load when Stripe
|
|
686
|
+
// redirects the shopper back with a `payment_intent_client_secret` query
|
|
687
|
+
// param. We must still attach (and auto-click) it even when the merchant
|
|
688
|
+
// is on a `buildCartDetail` only setup (no cartId / no place-order
|
|
689
|
+
// selector configured yet) — otherwise the redirect-back never reopens
|
|
690
|
+
// the checkout dialog to show the success/finish screen.
|
|
691
|
+
var n=!!document.querySelector("#".concat(be));we("attach checkout ".concat(o),"info",{href:window.location.href});we("attach checkout to always trigger international checkout selector: ".concat(t));
|
|
692
|
+
// allow to load checkout if cartData is ready (Checkout can be loaded right away if tempCartUUID is in the URL)
|
|
693
|
+
if(!o&&!t&&!window.Zonos.cartData&&!n){
|
|
694
|
+
// do nothing if button element is not found
|
|
695
|
+
return}var r=[o,t,
|
|
696
|
+
// hidden button for domestic redirected
|
|
697
|
+
"#".concat(_e),
|
|
698
|
+
// hidden button for legacy checkout facade and when client secret is provided in the query param or session storage when user is redirected from stripe
|
|
699
|
+
"#".concat(be),
|
|
700
|
+
// hidden button for international checkout
|
|
701
|
+
"#".concat(Ce)].filter(Boolean);
|
|
702
|
+
// also attach event to hidden button if user was redirected with shipping address session
|
|
703
|
+
var i=document.querySelectorAll(r.join(","));
|
|
704
|
+
// only attach event once, and looping through all of the button elements
|
|
705
|
+
i.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){
|
|
706
|
+
// do nothing if event is already attached
|
|
707
|
+
return}we("attached event to button ".concat(o),"info",{button:n});n.addEventListener("click",(function(o){return __awaiter(e,void 0,void 0,(function(){var e,r,i,s,a,u,d,f,h,v,m,g,p,w,z,x,S,T,I,A;return __generator(this,(function(O){switch(O.label){case 0:i=performance.now();s=t&&n.matches(t);a=n.matches("#".concat(Ce));u=n.matches("#".concat(_e))||n.matches("#".concat(be));
|
|
708
|
+
// Allow no country set for legacy facades. Otherwise enforce it being a shippable country and not disabled.
|
|
709
|
+
if(!window.Zonos.isLegacyCheckout&&(!fo()||lo())&&!s&&!a&&!u){return[2/*return*/]}o.preventDefault();o.stopPropagation();we("zonos checkout button clicked");return[4/*yield*/,this.checkStripePaymentIntentStatus({triggeredButton:o.target})];case 1:d=O.sent().shouldAllowOrder;
|
|
710
|
+
// Only allow order to proceed if payment intent is not succeeded
|
|
711
|
+
if(!d){return[2/*return*/]}
|
|
712
|
+
/**
|
|
713
|
+
* We are checking the payment state when Zonos script is loaded (user clicked "Checkout" button prviously), the hidden checkout button would be injected and clicked when the page is loaded, which leads to recording the load time on page load.
|
|
714
|
+
* Move the logic below checking Stripe payment state so we don't record the load time on page load and only do so when checkout modal is actually showed up.
|
|
715
|
+
*/if(!window.Zonos.logIntervalId){
|
|
716
|
+
// log the load time of all API calls every 2 seconds. This is to track the load time of all API calls for checkout user
|
|
717
|
+
window.Zonos.logIntervalId=setInterval((function(){void zo()}),2e3)}if(!Co("hosted_vs_native"))return[3/*break*/,4];this.isOverlayLoading=true;return[4/*yield*/,this.registerTestHostedVsNative()];case 2:O.sent();return[4/*yield*/,this.handleHostedVsNative()];case 3:f=O.sent().redirected;this.isOverlayLoading=false;
|
|
718
|
+
// Stop the process if the user is being redirected to the hosted checkout page
|
|
719
|
+
if(f){return[2/*return*/]}O.label=4;case 4:if(!window.Zonos.isBigCommerce)return[3/*break*/,7];return[4/*yield*/,Ze()];case 5:h=O.sent().shouldBypass;if(h){we("Bypass customer group detected, redirecting to BigCommerce native checkout","info");
|
|
720
|
+
// Carry over zonosQaUrl / zonosTestMode so the BC native
|
|
721
|
+
// checkout keeps loading the same Zonos elements build/env.
|
|
722
|
+
window.location.href=Re("/checkout");return[2/*return*/]}return[4/*yield*/,to()];case 6:v=O.sent();if(v.shouldForceLogin&&v.redirectUrl){window.location.href=v.redirectUrl;return[2/*return*/]}O.label=7;case 7:
|
|
723
|
+
// start loading
|
|
724
|
+
c.isFetchingSession=true;this.open=true;O.label=8;case 8:O.trys.push([8,16,,17]);return[4/*yield*/,this.buildCartAndInit()];case 9:m=O.sent();if(!m){throw new Error("Error building cart")}if(!!window.Zonos.isLegacyCheckout)return[3/*break*/,14];g=null;O.label=10;case 10:O.trys.push([10,12,,13]);return[4/*yield*/,k()];case 11:g=O.sent();return[3/*break*/,13];case 12:p=O.sent();
|
|
725
|
+
// A throwing merchant callback should stop checkout, not open it.
|
|
726
|
+
g=te("Unable to check inventory. Please try again.");return[3/*break*/,13];case 13:if(g){
|
|
727
|
+
// Surface the same "Couldn't place order" dialog and stop
|
|
728
|
+
// before the checkout is revealed. We return here before the
|
|
729
|
+
// session/analytics setup below runs, so close the (still
|
|
730
|
+
// loading) checkout dialog rather than leaving a
|
|
731
|
+
// half-initialized checkout visible behind the alert. The
|
|
732
|
+
// inventory-failure dialog renders independently of `this.open`,
|
|
733
|
+
// and "Return to cart" resets the message + closes cleanly.
|
|
734
|
+
l.inventoryCheckErrorMessage=g;c.isFetchingSession=false;this.open=false;return[2/*return*/]}O.label=14;case 14:(e=window.opener)===null||e===void 0?void 0:e.postMessage({checkoutSessionId:$.checkoutSessionId,type:"zonos-checkout-session-update"},"*");
|
|
735
|
+
// start the timer to validate the price
|
|
736
|
+
y({isPreview:this.preview,sessionTimeout:Oo});K({event:"zonos-checkout-start",metadata:{checkoutSessionId:$.checkoutSessionId}});w=$.checkoutSessionId;void b({checkoutSessionId:w,eventName:"checkout_open"});return[4/*yield*/,Pe()];case 15:z=O.sent().enabled;
|
|
737
|
+
// Hide discount input if there's no active discount configured for the store
|
|
738
|
+
l.shouldHideDiscountInput=!z;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void ko()}else{x=performance.now();S=x-i;void yo({loadTime:S})}this.recordCheckoutInfo();T=!!xe();if(T){this.markTheSessionAsAbandonedCart()}return[3/*break*/,17];case 16:I=O.sent();if(I instanceof Error){A=I.message;if(A==="Cart is expired."){this.isCartExpired=true}}
|
|
739
|
+
// stop loading
|
|
740
|
+
c.isFetchingSession=false;fe(I);if(this.isCartExpired){c.isFetchingSession=true;return[2/*return*/]}
|
|
741
|
+
// We want to log the error anytime we fail to create a checkout session
|
|
742
|
+
void ve({endpoint:"Error creating Checkout",errors:[I instanceof Error?I.toString():"Unknown error"],metadata:{allLogs:ke,cartId:window.Zonos.cartId,checkoutSessionBody:_(),href:window.location.href,storeBaseUrl:((r=window.Zonos.cartData)===null||r===void 0?void 0:r.storeBaseUrl)||ie.onlineStoreSettings.url}});C({messages:[te("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:te("Error creating Checkout")});return[3/*break*/,17];case 17:return[2/*return*/]}}))}))}),{
|
|
743
|
+
// Trigger this event before any other event
|
|
744
|
+
capture:true,passive:false});if(!ie.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");
|
|
745
|
+
// if this button is the hidden button, trigger the click event
|
|
746
|
+
if(n.matches("#".concat(_e))){n.dispatchEvent(Te("click"));
|
|
747
|
+
// cleanup shipping session after button is clicked
|
|
748
|
+
x();
|
|
749
|
+
// remove the button after it's clicked
|
|
750
|
+
n.remove()}
|
|
751
|
+
// For legacy checkout facade and in case the cart or stripe client secret is provided in the query param, open Checkout right away
|
|
752
|
+
if(n.matches("#".concat(be))){
|
|
753
|
+
// trigger the click event on the button
|
|
754
|
+
n.dispatchEvent(Te("click"));n.remove()}}))};e.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}
|
|
755
|
+
// apply theme to stripe elements
|
|
756
|
+
void this.applyStripeTheme()};e.prototype.useShippingDataFromCreateCartId=function(e){
|
|
757
|
+
// Do only if prefill address is provided
|
|
758
|
+
if(!e){return}we("shipping data from createCartId result","info",Object.entries(e));var o=e.customerAddress1,t=e.customerAddress2,n=e.customerCity,r=e.customerCountry,i=e.customerEmail,s=e.customerFirstName,c=e.customerLastName,a=e.customerName,u=e.customerPhone,d=e.customerState,l=e.customerZip;var f=new URLSearchParams(window.location.search);var h=// fallback to selected country code if country is not provided
|
|
759
|
+
r||J(f)||q.selectedCountryCode;this.applyPrefillAddress({customerAddress1:o,customerAddress2:t,customerCity:n,customerCountry:h,customerEmail:i,customerFirstName:s,customerLastName:c,customerName:a,customerPhone:u,customerState:d,customerZip:l})};
|
|
760
|
+
/**
|
|
761
|
+
* Set default address from query param if it's valid
|
|
762
|
+
*/e.prototype.useLegacyQueryParams=function(){var e=new URLSearchParams(window.location.search);we("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return null}return t};var t=
|
|
763
|
+
// fallback to selected country code if country is not provided
|
|
764
|
+
J(e)||q.selectedCountryCode;var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerFirstName");var u=o("customerLastName");var d=o("customerPhone");var l=o("customerZip");var f=o("customerState");this.applyPrefillAddress({customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:a,customerLastName:u,customerName:c,customerPhone:d,customerState:f,customerZip:l})};e.prototype.applyPrefillAddress=function(e){var o=e.customerAddress1||"";var t=e.customerCountry||"";var n=e.customerAddress2||"";var r=e.customerCity||"";var i=e.customerEmail||"";var s=e.customerFirstName&&e.customerLastName?"".concat(e.customerFirstName," ").concat(e.customerLastName):e.customerName||"";var c=e.customerPhone||"";var a=e.customerZip||"";var u=e.customerState||"";
|
|
765
|
+
/**
|
|
766
|
+
* If one of the value is null, no need to preset the default address.
|
|
767
|
+
* City and state are optional (they are not always provided for example Puerto Rico)
|
|
768
|
+
**/if(!o||!s||!c||!t){we("Missing required query params so it can not be prefilled","info",[!o&&"line1",!s&&"name",!c&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&q.shippingZoneCountries&&!(t in q.shippingZoneCountries)){we('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:o,line2:n,postal_code:a,state:u},email:i,name:s,phone:c}];we("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:e})};e.prototype.overrideStagingModeChanged=function(){l.isStagingMode=!!this.overrideStagingMode};
|
|
769
|
+
/**
|
|
770
|
+
* Setup all of the event listeners for the component on first load
|
|
771
|
+
*/e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var e;var o=this;return __generator(this,(function(t){c.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;
|
|
772
|
+
// Set staging mode on init
|
|
773
|
+
l.isStagingMode=me();
|
|
774
|
+
// Override staging mode if it's provided
|
|
775
|
+
if(typeof this.overrideStagingMode!=="undefined"){l.isStagingMode=this.overrideStagingMode}
|
|
776
|
+
// Start fetching BigCommerce customer group on page load so the bypass
|
|
777
|
+
// result is ready by the time checkout opens or the BC watcher fires
|
|
778
|
+
Ve();
|
|
779
|
+
// Warm the BigCommerce `/checkouts/settings` fetch (merchant's
|
|
780
|
+
// `guest_checkout_type`) so force-login gating resolves instantly when
|
|
781
|
+
// the shopper clicks checkout — otherwise the first checkout open
|
|
782
|
+
// would block on a proxy round trip.
|
|
783
|
+
oo();
|
|
784
|
+
// On BC's `/login.php`, rewrite the "Create account" button href so
|
|
785
|
+
// the post-signup round trip preserves the `from=cart.php?...` flag
|
|
786
|
+
// that carries the shopper back into Zonos international checkout.
|
|
787
|
+
so();
|
|
788
|
+
// If BC redirected the shopper back here after login with the Zonos
|
|
789
|
+
// resume flag, auto-open the international checkout. Strip the flag
|
|
790
|
+
// from the URL so a refresh doesn't keep re-triggering the dialog.
|
|
791
|
+
this.handleBigcommerceInternationalResumeFlag();
|
|
792
|
+
// For BigCommerce + logged-in shopper, prefetch the saved address book
|
|
793
|
+
// (`customer.addresses` include) so the international checkout's address
|
|
794
|
+
// picker is populated by the time the shopper opens it. Fire-and-forget —
|
|
795
|
+
// the prefill itself guards against overwriting other prefill sources.
|
|
796
|
+
void this.prefillBigCommerceCustomerAddresses();
|
|
797
|
+
// check if bigcommerce, if user enters the shipping address that's in the shipping zone at bigcommerce checkout
|
|
798
|
+
go({domesticRedirectedBtnSelector:_e,onInternationalCheckoutSelected:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.detectedDomesticCheckoutDialogOpen=true;
|
|
799
|
+
// wait for 2 secs
|
|
800
|
+
return[4/*yield*/,new Promise((function(e){return setTimeout(e,2e3)}))];case 1:
|
|
801
|
+
// wait for 2 secs
|
|
802
|
+
e.sent();return[2/*return*/]}}))}))},
|
|
803
|
+
// Logged-in user is on the BC native /checkout page with a saved
|
|
804
|
+
// international default address. Ask the user whether to continue to
|
|
805
|
+
// the Zonos international checkout or stay on BC and pick a different
|
|
806
|
+
// (domestic) saved address. This avoids the redirect loop where a user
|
|
807
|
+
// who wants to checkout domestically gets bounced back to international
|
|
808
|
+
// every time they land on /checkout.
|
|
809
|
+
onLoggedInInternationalAddressDetected:function(){return new Promise((function(e){o.loggedInIntlAddressResolver=e;o.loggedInIntlAddressConfirmDialogOpen=true}))},onShippingAddressSessionFound:function(e){
|
|
810
|
+
// prefilled the default address if shipping address session is found for checkout on open
|
|
811
|
+
o.defaultAddress=[{address:{city:e.city,country:e.countryCode,line1:e.address1,line2:e.address2,postal_code:e.postalCode,state:e.state},email:"",name:"".concat(e.firstName," ").concat(e.lastName),phone:e.phone}]}});
|
|
812
|
+
/**
|
|
813
|
+
* When temp cart data is available, set default address if it exists
|
|
814
|
+
*/if(window.Zonos){this.useLegacyQueryParams()}e=setInterval((function(){c.stripe=window.Zonos.stripe;o.stripe=window.Zonos.stripe;if(!o.stripe){we("waiting for stripe to be loaded");return}if(o.storybookPaymentStatusOverride){clearInterval(e);return}we("init checkout");if(o.preview||o.forceDialogOpen){void o.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){
|
|
815
|
+
// With legacy checkout, avoid the mutation observer. We are using a hidden button to trigger checkout.
|
|
816
|
+
o.attachCheckout()}else if(window){o.attachCheckout();
|
|
817
|
+
// create a mutation observer to see if any new elements that match our selector is added to the DOM
|
|
818
|
+
var t=new MutationObserver((function(){o.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(e)}),50);setTimeout((function(){
|
|
819
|
+
// if localization is not loaded after 10 seconds, stop the interval and don't init checkout
|
|
820
|
+
clearInterval(e)}),1e4);return[2/*return*/]}))}))};
|
|
821
|
+
/**
|
|
822
|
+
* After BigCommerce's `/login.php` round trip, the shopper lands back on
|
|
823
|
+
* `cart.php?isInternationalCheckout=true`. Detect the flag, strip it from
|
|
824
|
+
* the URL (so refreshing doesn't re-open the dialog), then fire the
|
|
825
|
+
* international-checkout trigger once three preconditions are all met:
|
|
826
|
+
* 1. Hello localization finished loading (`localizationLoaded`).
|
|
827
|
+
* 2. A country code is selected — otherwise `buildCartDetail` runs
|
|
828
|
+
* without a `countryCode` / `currencyCode` and never builds a cart.
|
|
829
|
+
* 3. The hidden trigger button has mounted.
|
|
830
|
+
*
|
|
831
|
+
* Without the first two gates we race Hello's own init and the click
|
|
832
|
+
* fires against a half-initialized store, which is what happens when
|
|
833
|
+
* the shopper refreshes back into cart.php straight from the login
|
|
834
|
+
* round trip.
|
|
835
|
+
*/e.prototype.handleBigcommerceInternationalResumeFlag=function(){if(!window.Zonos.isBigCommerce){return}var e=new URL(window.location.href);if(e.searchParams.get(De)!=="true"){return}e.searchParams.delete(De);window.history.replaceState({},"",e.toString());var o=Date.now();var t=setInterval((function(){if(!q.localizationLoaded||!q.selectedCountryCode){if(Date.now()-o>15e3){clearInterval(t);we("BigCommerce international checkout resume flag: localization did not initialize within 15s","info")}return}var e=document.querySelector("#".concat(Ce));if(e){clearInterval(t);e.dispatchEvent(Te("click"));return}if(Date.now()-o>15e3){clearInterval(t);we("BigCommerce international checkout resume flag: trigger button did not mount within 15s","info")}}),200)};
|
|
836
|
+
/**
|
|
837
|
+
* For storybook to set to finish step, this is to trigger in the story for zonos-checkout-finish
|
|
838
|
+
*/e.prototype.setToFinishStep=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){l.step="finish";this.storybookPaymentStatusOverride=e;return[2/*return*/]}))}))};
|
|
839
|
+
/**
|
|
840
|
+
* For usage in storybook for a mocked flow.
|
|
841
|
+
*/e.prototype.mockCheckoutSession=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){S(e);return[2/*return*/]}))}))};
|
|
842
|
+
/**
|
|
843
|
+
* Trigger the checkout international button
|
|
844
|
+
*/e.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=document.querySelector("#".concat(Ce));if(e){e.dispatchEvent(Te("click"))}return[2/*return*/]}))}))};e.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,a;var u=this;return __generator(this,(function(d){switch(d.label){case 0:
|
|
845
|
+
// submit google tag when the form is complete
|
|
846
|
+
K({event:"zonos-checkout-customer-info",metadata:{checkoutSessionId:$.checkoutSessionId}});r=$.checkoutSessionId;void b({checkoutSessionId:r,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4/*yield*/,T()];case 1:i=d.sent().isRequestNotReady;
|
|
847
|
+
// If the request is not ready at the time user click Continue, logging it out so we can investigate the issue
|
|
848
|
+
if(i&&l.addressFormRenderType==="stripe"){void ve({endpoint:"ADDRESS_NOT_READY_AT_CUSTOMER_INFO_CONTINUE",errors:["Address not ready at customer info continue"],metadata:{address:(o=(e=c.stripeAddressEventData)===null||e===void 0?void 0:e.value)===null||o===void 0?void 0:o.address,billingAddress:(n=(t=c.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)===null||n===void 0?void 0:n.address,cartId:window.Zonos.cartId}})}s=function(e){if(l.step!=="customer-info"){
|
|
849
|
+
// stop interval if the step is not customer-info
|
|
850
|
+
clearInterval(e);return}if(!c.isFetchingLandedCost){if(l.landedCostData){
|
|
851
|
+
// start init paypal with the presentment currency when landed cost is fetched
|
|
852
|
+
void Z({currency:l.currency});
|
|
853
|
+
// only go to next step if landed cost data is ready
|
|
854
|
+
I()}u.submitLoading=false;if(e){clearInterval(e)}}};
|
|
855
|
+
// Immediately move to the next step
|
|
856
|
+
s();a=setInterval((function(){s(a)}),20);
|
|
857
|
+
// cleanup interval if no data is fetched after 10 seconds
|
|
858
|
+
setTimeout((function(){clearInterval(a)}),1e4);return[2/*return*/]}}))}))};e.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){I();return[2/*return*/]}))}))};e.prototype.handleInventoryCheckDialogConfirm=function(){
|
|
859
|
+
// reset inventory check message to close the inventory check alert
|
|
860
|
+
l.inventoryCheckErrorMessage=null;
|
|
861
|
+
// close the dialog only when it's not hosted checkout
|
|
862
|
+
if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};e.prototype.handleCartExpiredDialogConfirm=function(){var e;this.isCartExpired=false;
|
|
863
|
+
// Redirect to the vendor store url if this is legacy checkout
|
|
864
|
+
if(this.isLegacyCheckout){var o=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}
|
|
865
|
+
/**
|
|
866
|
+
* For normal integration, the checkout modal opens on top of merchant site. Therefore, should reload the page when cart is expired so whole page can be reloaded and merchant cart might also be reset.
|
|
867
|
+
**/if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};e.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,a,u,d,f;return __generator(this,(function(h){switch(h.label){case 0:e=c.checkoutSettlementCurrency==="USD";
|
|
868
|
+
// open the confirm dialog if the settlement currency is in USD, and if call this method again, proceed and confirm with Stripe.
|
|
869
|
+
if(e&&c.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;
|
|
870
|
+
// Don't unlock consent here — the USD-confirm dialog is mid-flow; the
|
|
871
|
+
// lock should hold until the user resolves the dialog and we re-enter.
|
|
872
|
+
return[2/*return*/]}
|
|
873
|
+
// Close the dialog after the user confirms to proceed with the payment in USD
|
|
874
|
+
this.payInUsdConfirmDialogOpen=false;o=A();h.label=1;case 1:h.trys.push([1,,18,19]);
|
|
875
|
+
// reset paypal error message
|
|
876
|
+
V.paypalErrorMessage=null;
|
|
877
|
+
// reset error state
|
|
878
|
+
c.hasPaymentError=false;this.submitLoading=true;
|
|
879
|
+
// reset inventory check message
|
|
880
|
+
l.inventoryCheckErrorMessage=null;return[4/*yield*/,O()];case 2:t=h.sent();
|
|
881
|
+
// Should not proceed to confirm payment if base currency update failed
|
|
882
|
+
if(!t){c.hasPaymentError=true;c.customErrorMessage=te("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:c.checkoutSettlementCurrency});this.submitLoading=false;return[2/*return*/]}h.label=3;case 3:h.trys.push([3,5,,6]);
|
|
883
|
+
// check inventory before proceeding to payment
|
|
884
|
+
n=l;return[4/*yield*/,k()];case 4:
|
|
885
|
+
// check inventory before proceeding to payment
|
|
886
|
+
n.inventoryCheckErrorMessage=h.sent();return[3/*break*/,6];case 5:r=h.sent();
|
|
887
|
+
// If user provide callback and it throw an exception, default to this message and stop the payment.
|
|
888
|
+
l.inventoryCheckErrorMessage=te("Unable to check inventory. Please try again.");return[3/*break*/,6];case 6:
|
|
889
|
+
// Don't proceed to payment if there's an error message
|
|
890
|
+
if(l.inventoryCheckErrorMessage){
|
|
891
|
+
// stop the submit loading state
|
|
892
|
+
this.submitLoading=false;return[2/*return*/]}i=M();if(!(i>0))return[3/*break*/,8];return[4/*yield*/,B()];case 7:s=h.sent();if(!s.success){c.hasPaymentError=true;c.customErrorMessage=s.error||te("Unable to apply store credit. Please try again.");this.submitLoading=false;return[2/*return*/]}h.label=8;case 8:if(!E())return[3/*break*/,14];h.label=9;case 9:h.trys.push([9,12,,13]);return[4/*yield*/,P()];case 10:a=h.sent();if(!a.valid){c.hasPaymentError=true;c.customErrorMessage=a.errorMessage;this.submitLoading=false;return[2/*return*/]}return[4/*yield*/,U()];case 11:u=h.sent();if(!u.success){c.hasPaymentError=true;c.customErrorMessage=u.error||te("Unable to place order with store credit. Please try again.");this.submitLoading=false;return[2/*return*/]}I();g();return[3/*break*/,13];case 12:d=h.sent();fe(d);K({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:$.checkoutSessionId}});c.hasPaymentError=true;return[3/*break*/,13];case 13:this.submitLoading=false;return[2/*return*/];case 14:h.trys.push([14,16,,17]);
|
|
893
|
+
// Order-modification payment-only sessions skip the shipping step,
|
|
894
|
+
// so cartStore.selectedLandedCost is never populated — bypass the
|
|
895
|
+
// landed-cost guard the same way zonos-collect does for its own
|
|
896
|
+
// no-shipping-step flow.
|
|
897
|
+
return[4/*yield*/,L({noLandedCostCheck:z()})];case 15:
|
|
898
|
+
// Order-modification payment-only sessions skip the shipping step,
|
|
899
|
+
// so cartStore.selectedLandedCost is never populated — bypass the
|
|
900
|
+
// landed-cost guard the same way zonos-collect does for its own
|
|
901
|
+
// no-shipping-step flow.
|
|
902
|
+
h.sent();I();
|
|
903
|
+
// clear the checkout session timeout timer when purchase is complete
|
|
904
|
+
g();return[3/*break*/,17];case 16:f=h.sent();fe(f);K({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:$.checkoutSessionId}});c.hasPaymentError=true;
|
|
905
|
+
// should request inventory refund if there's an error during payment
|
|
906
|
+
if(c.shouldInventoryRefund){void D();c.shouldInventoryRefund=false}return[3/*break*/,17];case 17:this.submitLoading=false;return[3/*break*/,19];case 18:
|
|
907
|
+
// Release the consent lock on every terminal exit (success or failure)
|
|
908
|
+
// so the buyer can re-toggle / retry. On success the cart advances and
|
|
909
|
+
// the close-handler reset would clean this up anyway.
|
|
910
|
+
if(o){N.locked=false}return[7/*endfinally*/];case 19:return[2/*return*/]}}))}))};e.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:
|
|
911
|
+
// reset stripe store
|
|
912
|
+
j();if(!this.preview)return[3/*break*/,2];l.step="customer-info";return[4/*yield*/,this.init()];case 1:r.sent();return[2/*return*/];case 2:
|
|
913
|
+
// reset cart store
|
|
914
|
+
h();
|
|
915
|
+
// reset policy consent so the next checkout starts un-accepted
|
|
916
|
+
v();
|
|
917
|
+
// redirect to vendor store url if this is legacy checkout.
|
|
918
|
+
if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData.storeBaseUrl||ie.onlineStoreSettings.url;if(window.parent){window.parent.location.href=e}window.location.href=e;return[2/*return*/]}o=window.location.href;t=o.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");
|
|
919
|
+
/**
|
|
920
|
+
* Update the URL without query parameters only when checkout is not running in dashboard.zonos.com.
|
|
921
|
+
* We don't want to reload the page when dashboard is running it. Test mode should do what live mode does.
|
|
922
|
+
*/
|
|
923
|
+
/**
|
|
924
|
+
* Setting the state to null in window.history.replaceState can cause issues with rendering when using next/link and pressing the back button.
|
|
925
|
+
* @ref https://github.com/vercel/next.js/issues/33233#issuecomment-1052349396
|
|
926
|
+
**/if(!n){window.history.replaceState(window.history.state,document.title,t);
|
|
927
|
+
// Reload the page
|
|
928
|
+
window.location.reload()}return[2/*return*/]}}))}))};e.prototype.handleWindowResize=function(){this.isMobile=ge(this.mobile);
|
|
929
|
+
// apply theme to stripe elements
|
|
930
|
+
void this.applyStripeTheme();we("mobile: ".concat(this.isMobile))};e.prototype.handleMobileChange=function(){this.isMobile=ge(this.mobile);
|
|
931
|
+
// apply theme to stripe elements
|
|
932
|
+
void this.applyStripeTheme();we("mobile: ".concat(this.isMobile))};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){
|
|
933
|
+
// update theme to browser preference theme if appearance theme is system
|
|
934
|
+
this.appearanceSettingsOverride.theme=se(this.appearanceSettingsOverride.theme)}};e.prototype.handleAddressChange=function(){j()};e.prototype.handleCustomerProfileChange=function(){var e,o;if(!this.customerProfile){we("No customer profile","info");this.defaultCustomerProfileAddress=[];return}we("Customer profile found","info",{customerProfile:this.customerProfile});
|
|
935
|
+
// Build and set saved locations from checkout customers
|
|
936
|
+
this.defaultCustomerProfileAddress=((o=(e=c.customerProfile)===null||e===void 0?void 0:e.locations)===null||o===void 0?void 0:o.map((function(e){var o;return{address:{city:e.locality,country:e.countryCode,line1:e.line1,line2:e.line2||"",postal_code:e.postalCode,state:e.administrativeArea},email:e.email||((o=c.customerProfile)===null||o===void 0?void 0:o.email)||"",name:e.name||"",phone:e.phone||""}})))||[]};e.prototype.handleClientSecretChange=function(){we("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});
|
|
937
|
+
// apply theme to stripe elements
|
|
938
|
+
void this.applyStripeTheme()};e.prototype.handleOpenChange=function(){var e="data-zonos-overflow-origin";var o=document.body;var t=document.documentElement;
|
|
939
|
+
// disable scroll on the body when dialog is open
|
|
940
|
+
if(this.open){
|
|
941
|
+
// Close hello dialog if it's open
|
|
942
|
+
window.Zonos.openHelloDialog(false);
|
|
943
|
+
// record overflow state to data-zonos-overflow-origin in body/html element so we can reset it later
|
|
944
|
+
if(o.style.overflow){o.setAttribute(e,o.style.overflow)}o.style.overflow="hidden";if(t.style.overflow){t.setAttribute(e,t.style.overflow)}t.style.overflow="hidden"}else{
|
|
945
|
+
// Should reset stripeCustomerSessionClientSecret state when dialog is closed since merchant would need to re-authenticate, get an OTP again and we will get a new customer session.
|
|
946
|
+
this.stripeCustomerSessionClientSecret=null;var n=o.getAttribute(e);var r=t.getAttribute(e);
|
|
947
|
+
// reset overflow state to original state
|
|
948
|
+
if(n){o.removeAttribute(e);o.style.overflow=n}else{
|
|
949
|
+
// just remove the overflow style if it's not set
|
|
950
|
+
o.style.removeProperty("overflow")}
|
|
951
|
+
// reset overflow state to original state
|
|
952
|
+
if(r){t.removeAttribute(e);t.style.overflow=r}else{
|
|
953
|
+
// just remove the overflow style if it's not set
|
|
954
|
+
t.style.removeProperty("overflow")}}};e.prototype.componentWillLoad=function(){var e=this;void this.init();this.isMobile=ge(this.mobile);this.isIframed=window.self!==window.top;we("iframed: ".concat(this.isIframed));
|
|
955
|
+
// Set checkout session if redirect
|
|
956
|
+
if(window.Zonos.isLegacyCheckout){this.captureParamsRedirectedForVariantTest()}
|
|
957
|
+
// update theme to browser preference theme if appearance theme is system
|
|
958
|
+
this.handleAppearanceSettingsOverrideChange();this.storeUnsubscribeList=[ne("selectedLocale",(function(){
|
|
959
|
+
// Update stripe locale when selected country code is changed
|
|
960
|
+
void e.applyStripeTheme()})),R("selectedShippingOption",(function(){var o,t,n,r;var i=l.selectedShippingOption;
|
|
961
|
+
// Canada requires GAA form to be filled out for FedEx Ground shipping option
|
|
962
|
+
if(((o=ie.genericSettings)===null||o===void 0?void 0:o.shouldFedExShippingConsentForCanadianShopper)&&((n=(t=i===null||i===void 0?void 0:i.shippingProfile)===null||t===void 0?void 0:t.serviceLevel.code)===null||n===void 0?void 0:n.toLowerCase().startsWith("fedex."))&&((r=c.stripeAddressEventData)===null||r===void 0?void 0:r.value.address.country)==="CA"){e.shouldShowFedexShippingConsentDialog=true}})),F("stripeAddressEventData",(function(o){var t;
|
|
963
|
+
// For BigCommerce stores: redirect to domestic checkout when user selects a domestic country
|
|
964
|
+
// Only redirect when the store's native currency is USD and the feature is enabled
|
|
965
|
+
if(!window.Zonos.isBigCommerce||!o||e.redirectToDomesticCheckoutDialogOpen||!((t=ie.genericSettings)===null||t===void 0?void 0:t.isBigcommerceDomesticCheckoutRedirectEnabled)||ie.sourceCurrency!=="USD"){return}
|
|
966
|
+
// Only redirect when checkout modal is opened
|
|
967
|
+
if(!e.open){return}
|
|
968
|
+
// Check if the page is checkout page, if so, do nothing since they're already at the right page
|
|
969
|
+
if(window.location.pathname.includes("/checkout")){return}var n=o.value.address.country;if(n&&ie.disabledCountries.includes(n)){e.redirectToDomesticCheckoutDialogOpen=true;we("Domestic country ".concat(n," selected in international checkout, redirecting to BigCommerce domestic checkout"),"info");setTimeout((function(){
|
|
970
|
+
// Carry over zonosQaUrl / zonosTestMode so the BC native checkout
|
|
971
|
+
// keeps loading the same Zonos elements build/env.
|
|
972
|
+
window.location.href=Re("/checkout")}),2e3)}}))];
|
|
973
|
+
// Initialize test keys
|
|
974
|
+
this.initializeTestKeys();window.addEventListener("message",this.handleHostedOpenWindowCallback);we("mobile: ".concat(this.isMobile))};
|
|
975
|
+
// do clean up when component is unmounted
|
|
976
|
+
e.prototype.disconnectedCallback=function(){
|
|
977
|
+
// reset stripe store
|
|
978
|
+
j();
|
|
979
|
+
// reset cart store
|
|
980
|
+
h();
|
|
981
|
+
// reset policy consent
|
|
982
|
+
v();
|
|
983
|
+
// cleanup onChange listener
|
|
984
|
+
this.storeUnsubscribeList.forEach((function(e){return e()}));window.removeEventListener("message",this.handleHostedOpenWindowCallback)};e.prototype.render=function(){var e=this;var o,i,s,a;this.customerProfile=c.customerProfile;
|
|
985
|
+
// Set client secret so that we can add this to @Watch listener
|
|
986
|
+
this.clientSecret=c.clientSecret;
|
|
987
|
+
// Only set and update stripeCustomerSession state if it's available, since it would only be available at the time checkout session is created, afterward access checkout session the value would be `null`.
|
|
988
|
+
if(c.stripeCustomerSessionClientSecret){
|
|
989
|
+
// Set stripe customer session client secret so that we can add this to @Watch listener
|
|
990
|
+
this.stripeCustomerSessionClientSecret=c.stripeCustomerSessionClientSecret}var u=
|
|
991
|
+
// if it's last step, don't need to check stripe elements
|
|
992
|
+
l.step!=="finish"&&l.step!=="error"&&!c.stripeElements||c.isFetchingSession;
|
|
993
|
+
// An order-modification/adjustment session (order attached, not yet
|
|
994
|
+
// completed) skips straight to payment — see buildCartAndInit. The
|
|
995
|
+
// customer-info/shipping steps never ran, so the progress tabs (which
|
|
996
|
+
// track completion via cartStore.tabItems, only ever flipped by those
|
|
997
|
+
// steps' own continue handlers) would otherwise show a stale, frozen
|
|
998
|
+
// bar instead of reflecting that this is a single-step flow.
|
|
999
|
+
var d=z();var f=ce(ie.appearance,this.appearanceSettingsOverride||null),h=f.colorPrimary,v=f.colorSecondary,m=f.logoUrl,g=f.style;var p=ie.appearance.zonosAttribution==="ENABLED";var w=ie.appearance.theme;var k=h&&Ae(h)?"DARK":"LIGHT";
|
|
1000
|
+
// use right side theme if it's mobile, otherwise use themePrimaryColorBased
|
|
1001
|
+
var y=this.isMobile?w:k;
|
|
1002
|
+
// only use submit button color if it's on desktop
|
|
1003
|
+
var b=!this.isMobile?v:undefined;var _=q.customMessages;var C=(o=_.find((function(e){return e.pageName==="checkout_default"})))===null||o===void 0?void 0:o.message;var x=this.getCurrentLocalePageEnum();var S=_.filter((function(e){return e.pageName===x}));
|
|
1004
|
+
|
|
1005
|
+
var T=this.getBaseCurrencySettlementInfo();var I=function(){
|
|
1006
|
+
// add timestamp to logo url if it's preview mode so browser won't cache it on the dashboard setting
|
|
1007
|
+
var o=e.preview?"".concat(m,"?timestamp=").concat(Date.now()):m;return t("div",{class:"zonos--logo"},o&&t("img",{alt:"".concat(ie.organizationName," logo"),src:o}))};var A=de();var O=function(){var o=new URLSearchParams(window.location.search);var n=o.get("zonosQaUrl");var r=o.get("zonosDebug");var i=o.get("zonosE2ETest");var s=e.overrideStagingMode||me();return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},I(),A&&t("zonos-badge",{badgeColor:"orange",size:"small"},te("Test mode")),s&&t("zonos-badge",{badgeColor:"red",size:"small"},te("Staging mode")),r==="1"&&t("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),n&&t("zonos-badge",{badgeColor:"purple",size:"small"},n),i&&t("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),!d&&t("zonos-checkout-progress-tabs",{backgroundColor:
|
|
1008
|
+
// only use different contrast color when the secondary color is too off with the background in mobile
|
|
1009
|
+
e.isMobile?"--zonos-elements-gray-0":null}),S.map((function(e){return t("zonos-custom-message",{icon:Io,message:e.message})})))};var B=function(){if(l.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:te("Your checkout session has expired. Please reload the page to continue."),restStateTitle:te("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return e.reloadCheckoutSession()},variant:"primary"},te("Reload")))}return t("div",{class:"zonos--content",style:{"--zonos--border-radius":Ie({overrideBorderStyle:g})}},l.step!=="finish"&&l.step!=="error"&&t(n,null,t("div",{class:"zonos--left","data-theme":y,style:Oe({"--zonos--primary-color":!e.isMobile?h:undefined})},!e.isMobile&&O(),l.step==="customer-info"&&t("zonos-customer-info",{continueLoading:e.submitLoading,defaultAddress:e.getDefaultAddress(),isMobile:e.isMobile,onContinueClicked:function(){return e.handleCustomerInfoContinue()},submitBtnColor:b}),l.step==="shipping"&&t("zonos-shipping",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return e.handleShippingContinue()},submitBtnColor:b}),l.step==="payment"&&t("zonos-checkout-payment",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,this.handleStripePaymentContinue()];case 1:e.sent();return[2/*return*/]}}))}))},submitBtnColor:b})),t("div",{class:"zonos--right","data-theme":w},e.isMobile&&O(),t("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&t("zonos-currency-toggle",null),!e.isLegacyCheckout&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:Be}),noBackground:true,onClick:function(){return e.closeDialogHandler()}})),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-review",{collapsed:e.collapseReviewMobile,mobile:e.isMobile,onClick:function(){
|
|
1010
|
+
// do nothing if it's not mobile
|
|
1011
|
+
if(!e.isMobile){return}e.collapseReviewMobile=!e.collapseReviewMobile}}),t("zonos-collapse",{
|
|
1012
|
+
// only collapsible on mobile
|
|
1013
|
+
collapsed:e.collapseReviewMobile&&e.isMobile},t("zonos-cart-items",null),e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:b}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Io,message:C})))),t("zonos-cart-restricted-items",null),!e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Io,message:C}))))),(l.step==="finish"||l.step==="error")&&t("div",{class:"zonos--done","data-theme":w},t("div",{class:"zonos--header"},I(),!e.isRedirectAfterOrder&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:Be}),noBackground:true,onClick:function(){return e.handleFinishClick()},theme:w})),t("zonos-checkout-finish",{borderRadius:g,onCloseClick:function(){return e.handleFinishClick()},overrideNotification:l.step==="error"&&!!l.error?Object.assign(Object.assign({},l.error),{type:"error"}):undefined,storybookForceStatus:e.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":w,mobile:e.isMobile,
|
|
1014
|
+
/**
|
|
1015
|
+
* For this component, use slot instead of passing JSX through prop of other component. Because
|
|
1016
|
+
* the click outside event will be triggered on and targeted to whichever component that it's attached to.
|
|
1017
|
+
* Move it into <slot /> would resolve the issue.
|
|
1018
|
+
*/
|
|
1019
|
+
slot:!e.isMobile?"dialog-footer":undefined}))};return t(r,{class:Se(["zonos--checkout zonos--elements",l.step==="payment"&&"zonos--processing-payment",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?B():t("zonos-dialog",{borderStyle:g,class:"zonos--checkout-dialog","data-theme":w,height:"980px",isLoading:u,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeDialogHandler()},open:this.open,width:"1200px"},B()),t("zonos-dialog",{isLoading:true,loadingText:te("You will be redirected to international checkout shortly."),loadingTitle:te("We detected that you are shipping to an international address."),noClickOutside:true,noCloseButton:true,open:this.detectedDomesticCheckoutDialogOpen,width:"450px"}),t("zonos-dialog",{isLoading:true,loadingText:te("You will be redirected to domestic checkout shortly."),loadingTitle:te("We detected that you are shipping to a domestic address."),noClickOutside:true,noCloseButton:true,open:this.redirectToDomesticCheckoutDialogOpen,width:"450px"}),t("zonos-confirm-dialog",{class:"zonos--logged-in-intl-address-dialog",dialogCancelBtnText:te("Stay on this page"),dialogConfirmBtnText:te("Continue to international checkout"),dialogIntent:"info",dialogOpen:this.loggedInIntlAddressConfirmDialogOpen,dialogSubtitle:te("Your selected address ships internationally. Would you like to continue to international checkout, or stay here and select a domestic address?"),dialogTitle:te("International shipping address detected"),dialogWidth:480,onCancelClicked:function(){var o;e.loggedInIntlAddressConfirmDialogOpen=false;(o=e.loggedInIntlAddressResolver)===null||o===void 0?void 0:o.call(e,"stay");e.loggedInIntlAddressResolver=null},onConfirmClicked:function(){var o;e.loggedInIntlAddressConfirmDialogOpen=false;(o=e.loggedInIntlAddressResolver)===null||o===void 0?void 0:o.call(e,"redirect");e.loggedInIntlAddressResolver=null}}),t("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:te("Don't close"),dialogConfirmBtnText:te("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:te("Would you like to close checkout and return to the site?"),dialogTitle:te("Are you sure?"),onCancelClicked:function(){e.confirmDialogOpen=false},
|
|
1020
|
+
// Mark user selected confirm to close the dialog
|
|
1021
|
+
onConfirmClicked:function(){return e.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:te("Return to merchant site"),dialogConfirmBtnText:te("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:
|
|
1022
|
+
/**
|
|
1023
|
+
* Show order number if it's available, otherwise just show the time
|
|
1024
|
+
*/
|
|
1025
|
+
((i=this.placedOrderInfo)===null||i===void 0?void 0:i.zonosOrderNumber)?te("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):te("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((s=this.placedOrderInfo)===null||s===void 0?void 0:s.time)||null),time:this.formatTime(((a=this.placedOrderInfo)===null||a===void 0?void 0:a.time)||null)}),dialogTitle:te("Are you sure?"),dialogWidth:530,onCancelClicked:function(){e.handleCancelOrderDuplication()},
|
|
1026
|
+
// Mark user selected confirm to close the dialog
|
|
1027
|
+
onConfirmClicked:function(){
|
|
1028
|
+
// Reset the placed order info and close the dialog
|
|
1029
|
+
e.confirmProceedWithOrderDuplication()}}),t("zonos-confirm-dialog",{class:"zonos--fedex-shipping-dialog",dialogConfirmBtnText:te("Confirm"),dialogIntent:"info",dialogOpen:!!this.shouldShowFedexShippingConsentDialog,dialogSubtitle:t(n,null,te("If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly—usually by email or phone—with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request."),t("zonos-link",{href:"https://ftn.fedex.com/us/assets/docs/One-Time_GAA.pdf",target:"_blank"},te("View GAA Form."))),dialogTitle:te("Fedex Shipping Procedure"),dialogType:"alert",dialogWidth:500,onConfirmClicked:function(){return e.shouldShowFedexShippingConsentDialog=false}}),t("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:te("Return to cart"),dialogIntent:"danger",
|
|
1030
|
+
// Show dialog if inventory check error message is not null
|
|
1031
|
+
dialogOpen:!!l.inventoryCheckErrorMessage,
|
|
1032
|
+
// If dialog is in open state, the message should not be null
|
|
1033
|
+
dialogSubtitle:l.inventoryCheckErrorMessage,dialogTitle:te("Couldn't place order"),dialogType:"alert",
|
|
1034
|
+
// Mark user selected confirm to close the dialog
|
|
1035
|
+
onConfirmClicked:function(){return e.handleInventoryCheckDialogConfirm()}}),T&&t("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:te("Cancel"),dialogConfirmBtnText:te("Pay [orderTotal]",{orderTotal:re({amount:T.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:te("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:te("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){e.payInUsdConfirmDialogOpen=false},
|
|
1036
|
+
// Mark user selected confirm to continue with payment
|
|
1037
|
+
onConfirmClicked:function(){return e.handleStripePaymentContinue()}}),t("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:te("OK"),dialogIntent:"danger",
|
|
1038
|
+
// Show dialog if inventory check error message is not null
|
|
1039
|
+
dialogOpen:this.isCartExpired,
|
|
1040
|
+
// If dialog is in open state, the message should not be null
|
|
1041
|
+
dialogSubtitle:te("You are being sent back to the shop to re-add items to your cart."),dialogTitle:te("Shopping cart expired"),dialogType:"alert",
|
|
1042
|
+
// Mark user selected confirm to close the dialog
|
|
1043
|
+
onConfirmClicked:function(){return e.handleCartExpiredDialogConfirm()}}),t("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:[{appearanceSettingsOverrideChanged:0},{handleAppearanceSettingsOverrideChange:0}],overrideStagingMode:[{overrideStagingModeChanged:0}],mobile:[{handleMobileChange:0}],defaultAddress:[{handleAddressChange:0}],customerProfile:[{handleCustomerProfileChange:0}],clientSecret:[{handleClientSecretChange:0}],stripeCustomerSessionClientSecret:[{handleClientSecretChange:0}],open:[{handleOpenChange:0}]}},enumerable:false,configurable:true});return e}());Eo.style=Ao()}}}));
|