@zonos/elements 1.3.286 → 1.3.288
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-0cf8897b.js → cart-CV4buPlT.js} +17 -27
- package/dist/cjs/{collect-79131e52.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-a8f04267.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-254ae23b.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-8ca67278.js → paypal-BLuHeOJH.js} +10 -9
- package/dist/cjs/{placeTestOrder-12b63822.js → placeTestOrder-VK_CMeq0.js} +3 -3
- package/dist/cjs/{renderCheckoutCurrency-a1f71587.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 +85 -83
- package/dist/cjs/zonos-checkbox_2.cjs.entry.js +10 -14
- package/dist/cjs/zonos-checkout.cjs.entry.js +50 -34
- 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 +4 -4
- 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 +18 -14
- 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.css +7 -4
- 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/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/scripts/cart/_setupCartData.js +2 -2
- package/dist/collection/scripts/cart/_setupCartDataWithSettings.js +2 -2
- package/dist/collection/types/generated/graphql.internal.types.js +5 -0
- package/dist/esm/RemoveIcon-C2QMVeWW.js +3 -0
- package/dist/esm/{cart-d04742f5.js → cart-ekBk_gxV.js} +18 -28
- package/dist/esm/{collect-4c310a16.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-f0878e32.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-86487dac.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-997935ab.js → paypal-CW1D2XqZ.js} +10 -9
- package/dist/esm/{placeTestOrder-a53f2056.js → placeTestOrder-nhmsLLOA.js} +3 -3
- package/dist/esm/{renderCheckoutCurrency-e0e16eb7.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 +85 -81
- package/dist/esm/zonos-checkbox_2.entry.js +10 -12
- package/dist/esm/zonos-checkout.entry.js +50 -32
- 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 +1171 -521
- 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/store/checkout/cart.d.ts +9 -9
- 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 +127 -127
- package/dist/types/stencil-public-runtime.d.ts +205 -12
- package/dist/types/types/generated/graphql.frontend.types.d.ts +60 -60
- package/dist/types/types/generated/graphql.frontend.types.ts +55 -55
- package/dist/types/types/generated/graphql.internal.types.d.ts +1290 -1285
- package/dist/types/types/generated/graphql.internal.types.ts +1113 -1108
- 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-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-6de2f9c9.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-BtMauqj_.system.js +227 -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-344a6278.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-a4c7ee17.js → p-DHwpNxG9.js} +1 -1
- 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-LypTHRUC.js +1 -0
- 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-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-5d110c2b.entry.js → p-d4c4a00e.entry.js} +1 -1
- 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-5227aa69.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-f6ba59f6.system.entry.js +171 -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-d04742f5.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-4c310a16.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-f0878e32.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-86487dac.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-997935ab.js +0 -17
- package/dist/esm-es5/placeTestOrder-a53f2056.js +0 -1
- package/dist/esm-es5/renderCheckoutCurrency-e0e16eb7.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-0c327a57.system.entry.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-117953db.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-1cfb5c2a.system.entry.js +0 -1
- package/dist/zonos-elements/p-1f8648c8.system.entry.js +0 -1
- package/dist/zonos-elements/p-23e7c655.system.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-277b77e3.js +0 -1
- package/dist/zonos-elements/p-278abdcf.entry.js +0 -1
- package/dist/zonos-elements/p-29b60bf3.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-2c7a425d.entry.js +0 -1
- package/dist/zonos-elements/p-2cab1746.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-3a26e5e7.system.entry.js +0 -1
- package/dist/zonos-elements/p-40a4c8a2.system.js +0 -1
- package/dist/zonos-elements/p-40af92a1.system.entry.js +0 -1
- package/dist/zonos-elements/p-4160bbc2.system.js +0 -1
- package/dist/zonos-elements/p-41f1697a.system.entry.js +0 -1
- package/dist/zonos-elements/p-4671fde7.entry.js +0 -1
- package/dist/zonos-elements/p-490d7fec.system.entry.js +0 -1
- package/dist/zonos-elements/p-4941c096.system.entry.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-50d088f7.system.entry.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-5b990c91.entry.js +0 -1
- package/dist/zonos-elements/p-60832726.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-6eaf7c9e.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-7352abe9.js +0 -1
- package/dist/zonos-elements/p-74230da8.system.js +0 -1
- package/dist/zonos-elements/p-76834a0a.system.entry.js +0 -1
- package/dist/zonos-elements/p-77993ba1.entry.js +0 -1
- package/dist/zonos-elements/p-78f8e594.entry.js +0 -1
- package/dist/zonos-elements/p-7ac8846c.system.js +0 -1
- package/dist/zonos-elements/p-7b525c75.system.js +0 -1
- package/dist/zonos-elements/p-7f688485.system.entry.js +0 -1
- package/dist/zonos-elements/p-7fbbdb0f.system.js +0 -1
- package/dist/zonos-elements/p-8861d47e.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-8be02f3a.system.js +0 -1
- package/dist/zonos-elements/p-8d14cb66.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-944c1fb3.entry.js +0 -1
- package/dist/zonos-elements/p-947e4402.system.entry.js +0 -1
- package/dist/zonos-elements/p-96ab529e.entry.js +0 -1
- package/dist/zonos-elements/p-998975a3.system.js +0 -18
- 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-a1bd3a53.system.js +0 -1
- package/dist/zonos-elements/p-a553e132.js +0 -1
- package/dist/zonos-elements/p-acb7dee1.system.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-c0af11fe.system.js +0 -1
- package/dist/zonos-elements/p-c112fa12.system.entry.js +0 -1
- package/dist/zonos-elements/p-c4321a1a.system.js +0 -1
- package/dist/zonos-elements/p-c5d1217f.system.js +0 -1
- package/dist/zonos-elements/p-c7329333.entry.js +0 -1
- package/dist/zonos-elements/p-c756a59d.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-ce75b047.js +0 -2
- package/dist/zonos-elements/p-d1a51fac.js +0 -1
- package/dist/zonos-elements/p-d6a73125.system.entry.js +0 -1
- package/dist/zonos-elements/p-d75726e5.system.entry.js +0 -1
- package/dist/zonos-elements/p-d938f42f.system.js +0 -1
- package/dist/zonos-elements/p-dd866ca3.system.entry.js +0 -1
- package/dist/zonos-elements/p-dd8a7bf4.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-e4b07f7d.system.entry.js +0 -1
- package/dist/zonos-elements/p-e4dc24e1.system.js +0 -1
- package/dist/zonos-elements/p-e5865ad9.system.js +0 -1
- package/dist/zonos-elements/p-e7d7afda.entry.js +0 -1
- package/dist/zonos-elements/p-ebbda085.system.js +0 -1
- package/dist/zonos-elements/p-f4720b0a.js +0 -1
- package/dist/zonos-elements/p-f8356934.system.entry.js +0 -1
- package/dist/zonos-elements/p-f9346f1c.entry.js +0 -1
- package/dist/zonos-elements/p-fc5f6113.js +0 -1
- package/dist/zonos-elements/p-fe28dbe6.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,517 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,r,o){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{d(o.next(e))}catch(e){i(e)}}function s(e){try{d(o["throw"](e))}catch(e){i(e)}}function d(e){e.done?r(e.value):n(e.value).then(a,s)}d((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return d([e,t])}}function d(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;n=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++){if(i||!(o in t)){if(!i)i=Array.prototype.slice.call(t,0,o);i[o]=t[o]}}return e.concat(i||Array.prototype.slice.call(t))};import{c as createStore,z as zonosStore}from"./zonosStore-DrIOAz4M.js";import{s as storageStore,t as translate,k as getOverridenZCountry,l as localizationStore,f as filterValidTests,d as storageStoreSetEnabledVariantTestKeys}from"./localization-AOqYXGdP.js";import{l as log,b as allLogs}from"./VarianceTest-BJmZPrZl.js";import{h as handleFetch,l as logError,f as fallbackApiList,g as getIsTestMode,a as getIsStagingMode,s as sendErrorLog,j as jsonParse}from"./handleFetch-D5GYDF-O.js";import{i as isDarkColor}from"./isDarkColor-YdrG78th.js";import{g as getBorderRadius}from"./getBorderRadius-HwG64EKM.js";import{e as euCountryCodes}from"./TaxId-Cye-evFK.js";var getCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(n){switch(n.label){case 0:if(!storageStore.checkoutSessionId){return[2/*return*/,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",storageStore.checkoutSessionId);return[4/*yield*/,handleFetch("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:t=n.sent(),r=t.errors,o=t.json;return[2/*return*/,{errors:r,json:o}]}}))}))};var _o=createStore((function(){return{amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:false,isEnabled:false,orderIdCreated:null,remainingBalance:null,useFullBalance:true}})),reset$2=_o.reset,storeCreditStore=_o.state;
|
|
2
|
+
/**
|
|
3
|
+
* Reset store credit store to initial state
|
|
4
|
+
*/var storeCreditStoreReset=function(){reset$2()};
|
|
5
|
+
/**
|
|
6
|
+
* Set the available balance from the checkout session's customerProfile.storeCreditBalance
|
|
7
|
+
*/var storeCreditStoreSetBalanceFromSession=function(e){log("Store credit balance from session","info",e);storeCreditStore.availableBalance=e};
|
|
8
|
+
/**
|
|
9
|
+
* Re-fetch the store credit balance from the checkout session.
|
|
10
|
+
* Called when the payment step loads to ensure the balance is fresh.
|
|
11
|
+
*/var storeCreditStoreRefreshBalance=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i;return __generator(this,(function(a){switch(a.label){case 0:return[4/*yield*/,getCheckoutSession()];case 1:r=a.sent(),o=r.errors,n=r.json;if(o.length||!n){logError("Failed to refresh store credit balance");return[2/*return*/]}i=(t=(e=n.checkoutSession.customerProfile)===null||e===void 0?void 0:e.storeCreditBalance)!==null&&t!==void 0?t:null;storeCreditStoreSetBalanceFromSession(i);return[2/*return*/]}}))}))};
|
|
12
|
+
/**
|
|
13
|
+
* Apply store credit to the checkout session.
|
|
14
|
+
* This must be called BEFORE payment confirmation.
|
|
15
|
+
* The amount/mode are already set via checkout session update with storeCreditApplication.
|
|
16
|
+
*/var storeCreditStoreApplyCredit=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,a;return __generator(this,(function(d){switch(d.label){case 0:t=storageStore.checkoutSessionId;if(!t){r="No checkout session found";logError(r);storeCreditStore.error=r;return[2/*return*/,{error:r,success:false}]}log("Applying store credit","info",{checkoutSessionId:t});storeCreditStore.isApplying=true;storeCreditStore.error=null;d.label=1;case 1:d.trys.push([1,3,,4]);return[4/*yield*/,handleFetch("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:t},method:"POST"})];case 2:o=d.sent(),n=o.errors,i=o.json;if(n.length>0||!i){a=((e=n[0])===null||e===void 0?void 0:e.message)||"Failed to apply store credit";logError(a);storeCreditStore.error=a;storeCreditStore.isApplying=false;return[2/*return*/,{error:a,success:false}]}storeCreditStore.appliedAmount=i.amountApplied;storeCreditStore.remainingBalance=i.remainingBalance;storeCreditStore.isApplying=false;log("Store credit applied","info",{amountApplied:i.amountApplied,remainingBalance:i.remainingBalance});return[2/*return*/,{error:null,success:true}];case 3:s=d.sent();a=s instanceof Error?s.message:"Failed to apply store credit";logError(a);storeCreditStore.error=a;storeCreditStore.isApplying=false;return[2/*return*/,{error:a,success:false}];case 4:return[2/*return*/]}}))}))};
|
|
17
|
+
/**
|
|
18
|
+
* Enable or disable store credit usage.
|
|
19
|
+
* When enabling, defaults to full balance mode.
|
|
20
|
+
* When disabling, clears the amount.
|
|
21
|
+
*/var storeCreditStoreSetEnabled=function(e){storeCreditStore.isEnabled=e;storeCreditStore.error=null;if(!e){storeCreditStore.amountToApply=null}};
|
|
22
|
+
/**
|
|
23
|
+
* Set the amount of store credit to apply
|
|
24
|
+
* Validates against available balance and cart total
|
|
25
|
+
*/var storeCreditStoreSetAmount=function(e){if(e===null){storeCreditStore.amountToApply=null;storeCreditStore.error=null;return}
|
|
26
|
+
// Validate amount
|
|
27
|
+
if(e<=0){storeCreditStore.error="Amount must be greater than zero";return}if(storeCreditStore.availableBalance!==null&&e>storeCreditStore.availableBalance){storeCreditStore.error="Amount exceeds available balance";return}var t=cartStore.total+(cartStore.storeCredit||0);if(e>t){storeCreditStore.error="Amount exceeds order total";return}storeCreditStore.error=null;storeCreditStore.amountToApply=e};
|
|
28
|
+
/**
|
|
29
|
+
* Toggle whether to use full balance or custom amount.
|
|
30
|
+
* When switching to custom mode, clears the applied amount so the user
|
|
31
|
+
* must explicitly apply via the Apply button.
|
|
32
|
+
*/var storeCreditStoreSetUseFullBalance=function(e){storeCreditStore.useFullBalance=e;storeCreditStore.error=null;if(e&&storeCreditStore.availableBalance!==null){var t=cartStore.total+(cartStore.storeCredit||0);var r=Math.min(storeCreditStore.availableBalance,t);storeCreditStore.amountToApply=r}else if(!e){storeCreditStore.amountToApply=null}};
|
|
33
|
+
/**
|
|
34
|
+
* Get the storeCreditApplication input for checkout session update.
|
|
35
|
+
* Sends mode: 'NONE' when store credit is not being used to clear any
|
|
36
|
+
* previously applied store credit on the backend.
|
|
37
|
+
*/var storeCreditStoreGetInput=function(){if(!storeCreditStore.isEnabled||storeCreditStore.amountToApply===null){return{mode:"NONE"}}if(storeCreditStore.useFullBalance){return{mode:"FULL"}}return{amount:storeCreditStore.amountToApply,mode:"PARTIAL"}};
|
|
38
|
+
/**
|
|
39
|
+
* Get the effective amount to apply based on settings
|
|
40
|
+
*/var storeCreditStoreGetEffectiveAmount=function(){if(!storeCreditStore.isEnabled||storeCreditStore.availableBalance===null){return 0}if(storeCreditStore.useFullBalance){return Math.min(storeCreditStore.availableBalance,cartStore.total+(cartStore.storeCredit||0))}return storeCreditStore.amountToApply||0};
|
|
41
|
+
/**
|
|
42
|
+
* Check whether the effective store credit amount covers the full order total.
|
|
43
|
+
* When true, the Stripe/PayPal payment flow should be skipped and
|
|
44
|
+
* `storeCreditStoreCreateOrder` should be used instead.
|
|
45
|
+
*
|
|
46
|
+
* Relies on the backend's computed `cartStore.total` (remaining amount to pay
|
|
47
|
+
* after store credit) rather than a client-side comparison, which avoids issues
|
|
48
|
+
* with currency mismatches or rounding.
|
|
49
|
+
*/var storeCreditStoreCoversFullAmount=function(){
|
|
50
|
+
// Only consider full coverage after the backend has confirmed store credit
|
|
51
|
+
// was applied (cartStore.storeCredit > 0) and the remaining total is 0.
|
|
52
|
+
return storeCreditStore.amountToApply!==null&&storeCreditStore.amountToApply>0&&cartStore.storeCredit>0&&cartStore.total<=0};
|
|
53
|
+
/**
|
|
54
|
+
* Create an order paid entirely by store credit.
|
|
55
|
+
* Should only be called when `storeCreditStoreCoversFullAmount()` is true.
|
|
56
|
+
*/var storeCreditStoreCreateOrder=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,c,l,d;return __generator(this,(function(u){switch(u.label){case 0:o=storageStore.checkoutSessionId;if(!o){n="No checkout session found";logError(n);storeCreditStore.error=n;return[2/*return*/,{error:n,orderId:null,success:false}]}log("Creating store credit order","info",{checkoutSessionId:o});u.label=1;case 1:u.trys.push([1,3,,4]);return[4/*yield*/,handleFetch("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:o},method:"POST"})];case 2:i=u.sent(),a=i.errors,s=i.json;if(a.length>0||!s){d=((e=a[0])===null||e===void 0?void 0:e.message)||"Failed to create store credit order";logError(d);storeCreditStore.error=d;return[2/*return*/,{error:d,orderId:null,success:false}]}c=((r=(t=s.checkoutSessionStoreCreditOrderCreate)===null||t===void 0?void 0:t.order)===null||r===void 0?void 0:r.id)||null;storeCreditStore.orderIdCreated=c;log("Store credit order created","info",{orderId:c});return[2/*return*/,{error:null,orderId:c,success:true}];case 3:l=u.sent();d=l instanceof Error?l.message:"Failed to create store credit order";logError(d);storeCreditStore.error=d;return[2/*return*/,{error:d,orderId:null,success:false}];case 4:return[2/*return*/]}}))}))};var POLICY_ORDER=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"];
|
|
57
|
+
// Reuses the lowercase `'Privacy policy'` key already translated in 19 locales
|
|
58
|
+
// (also used by the checkout footer) — the other four are new keys that follow
|
|
59
|
+
// the same lowercase convention for visual consistency in the joined consent line.
|
|
60
|
+
var POLICY_NAME_KEY={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"};var _p=createStore({accepted:false,acceptedAt:null,locked:false,showError:false}),policyConsentStoreReset=_p.reset,policyConsentStore=_p.state;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the list of policies the merchant has configured (non-empty link).
|
|
63
|
+
* Policies are returned in a fixed display order so the rendered list is
|
|
64
|
+
* deterministic across renders and across locales. URLs that aren't absolute
|
|
65
|
+
* http(s) URLs are filtered out as defense-in-depth against `javascript:` or
|
|
66
|
+
* other unexpected schemes slipping through the backend validation.
|
|
67
|
+
*
|
|
68
|
+
* Reads from `zonosStore.checkoutSettings` (not `window.Zonos.cartSettings`)
|
|
69
|
+
* so the consent UI works when zonos-elements is consumed via the npm package,
|
|
70
|
+
* where `cartSettings` is not populated.
|
|
71
|
+
*/var getEnabledPolicies=function(){var e=zonosStore.checkoutSettings.merchantPolicyLinks;if(!e){return[]}return POLICY_ORDER.reduce((function(t,r){var o,n;var i=(n=(o=e[r])===null||o===void 0?void 0:o.link)===null||n===void 0?void 0:n.trim();if(!i||!/^https?:\/\//i.test(i)){return t}t.push({key:r,name:translate(POLICY_NAME_KEY[r]),url:i});return t}),[])};var isPolicyConsentRequired=function(){return getEnabledPolicies().length>0};
|
|
72
|
+
/**
|
|
73
|
+
* Extract first name and last name from the name string
|
|
74
|
+
* If first name and last name are provided, use them
|
|
75
|
+
* If name is provided, extract and return the first and last name from the name string
|
|
76
|
+
* If neither are provided, return an empty object
|
|
77
|
+
*/var extractName=function(e){var t=e.firstName,r=e.lastName,o=e.name;var n;if(!o&&!t&&!r){return{firstName:"",lastName:""}}
|
|
78
|
+
// Use first name and last name if they are provided
|
|
79
|
+
var i=(o===null||o===void 0?void 0:o.split(/\s+/))||[];var a=(t===null||t===void 0?void 0:t.trim())||((n=i[0])===null||n===void 0?void 0:n.trim())||"";var s=(r===null||r===void 0?void 0:r.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}};
|
|
80
|
+
/**
|
|
81
|
+
* Extract value from translated object
|
|
82
|
+
*/var getTranslatedAddress=function(e){var t=e.currentAddress,r=e.translatedAddress;var o,n,i,a,s,d;var c=t.value.address,l=c.city,u=c.country,S=c.line1,v=c.line2,p=c.postal_code,f=c.state;var h=t.value.name||[t.value.firstName,t.value.lastName].join(" ");return{city:((o=r.city)===null||o===void 0?void 0:o[l])||l,country:u,line1:((n=r.line1)===null||n===void 0?void 0:n[S])||S,line2:((i=r.line2)===null||i===void 0?void 0:i[v||""])||v||"",name:((a=r.name)===null||a===void 0?void 0:a[h])||h,phone:t.value.phone||"",postal_code:((s=r.postal_code)===null||s===void 0?void 0:s[p])||p,state:((d=r.state)===null||d===void 0?void 0:d[f])||f}};
|
|
83
|
+
/**
|
|
84
|
+
* Similar to prepCalculateLandedCost except it only uses cart ID
|
|
85
|
+
*/var prepCartCalculateLandedCost=function(e){var t;var r=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";
|
|
86
|
+
// maybe we don't need email now for prefetch the landed cost
|
|
87
|
+
var o=stripeStore.stripeLinkEventData;var n=stripeStore.stripeAddressEventData;var i=stripeStore.stripeShippingSameAsBilling?stripeStore.stripeAddressEventData:stripeStore.stripeBillingAddressEventData;if(!n||!i){throw new Error("Missing stripe address data")}
|
|
88
|
+
// Attempt to get translated address if available
|
|
89
|
+
var a=getTranslatedAddress({currentAddress:n,translatedAddress:stripeStore.translatedAddress.address});var s=extractName({name:a.name}),d=s.firstName,c=s.lastName;var l=getTranslatedAddress({currentAddress:i,translatedAddress:stripeStore.translatedAddress.address});var u=extractName({name:l.name}),S=u.firstName,v=u.lastName;var p=getOverridenZCountry()||"US";return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{
|
|
90
|
+
// firstName and lastName should be valid now since stripe only mark
|
|
91
|
+
// the address as complete when both fields are filled.
|
|
92
|
+
firstName:S,lastName:v,phone:l.phone},
|
|
93
|
+
// Use the first item's currency code
|
|
94
|
+
cartCurrencyCode:(t=cartStore.items[0])===null||t===void 0?void 0:t.currencyCode,cartId:e,checkoutSessionCountry:p||localizationStore.selectedCountryCode||undefined,checkoutSessionId:storageStore.checkoutSessionId||"",contact:{companyName:stripeStore.companyName,email:o===null||o===void 0?void 0:o.value.email,
|
|
95
|
+
// firstName and lastName should be valid now since stripe only mark
|
|
96
|
+
// the address as complete when both fields are filled.
|
|
97
|
+
firstName:d,lastName:c,phone:a.phone},isTest:!!r,landedCostAdjustments:cartStore.promoCode?[{amount:0,productId:null,promoCode:cartStore.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:stripeStore.shortAddressCode,shipToTaxId:stripeStore.taxId,shippingAddress:{addressLine1:a.line1,addressLine2:a.line2,city:a.city,country:a.country,postalCode:a.postal_code,state:a.state}}};var prepCalculateLandedCost=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";
|
|
98
|
+
// maybe we don't need email now for prefetch the landed cost
|
|
99
|
+
var t=stripeStore.stripeLinkEventData;var r=stripeStore.stripeAddressEventData;var o=stripeStore.stripeShippingSameAsBilling?stripeStore.stripeAddressEventData:stripeStore.stripeBillingAddressEventData;log({stripeAddressData:r,stripeBillingAddressData:o},"info");if(!r||!o){throw new Error("Missing stripe address data")}
|
|
100
|
+
// Attempt to get translated address if available
|
|
101
|
+
var n=getTranslatedAddress({currentAddress:r,translatedAddress:stripeStore.translatedAddress.address});var i=extractName({name:n.name}),a=i.firstName,s=i.lastName;var d=getTranslatedAddress({currentAddress:o,translatedAddress:stripeStore.translatedAddress.address});var c=extractName({name:d.name}),l=c.firstName,u=c.lastName;var S=cartStore.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var v=cartStore.promoCode?__spreadArray([{amount:0,productId:null,promoCode:cartStore.promoCode,sku:null,type:"PROMO_CODE"}],S,true):S;return{billingAddress:{addressLine1:d.line1,addressLine2:d.line2||"",city:d.city,country:d.country,postalCode:d.postal_code,state:d.state},billingContact:{
|
|
102
|
+
// firstName and lastName should be valid now since stripe only mark
|
|
103
|
+
// the address as complete when both fields are filled.
|
|
104
|
+
firstName:l,lastName:u,phone:d.phone},checkoutSessionId:storageStore.checkoutSessionId||"",contact:{companyName:stripeStore.companyName,email:t===null||t===void 0?void 0:t.value.email,
|
|
105
|
+
// firstName and lastName should be valid now since stripe only mark
|
|
106
|
+
// the address as complete when both fields are filled.
|
|
107
|
+
firstName:a,lastName:s,phone:n.phone},isTest:e,items:cartStore.items,landedCostAdjustments:v,shipToShortAddressCode:stripeStore.shortAddressCode,shipToTaxId:stripeStore.taxId,shippingAddress:{addressLine1:n.line1,addressLine2:n.line2,city:n.city,country:n.country,postalCode:n.postal_code,state:n.state}}};var triggerBuildLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,d,c,l;return __generator(this,(function(u){switch(u.label){case 0:a=prepCalculateLandedCost();return[4/*yield*/,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,
|
|
108
|
+
// zonosApiKey should always be available
|
|
109
|
+
publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:fallbackApiList["vercel"]},{promoCode:cartStore.promoCode})];case 1:s=u.sent();if(!s||
|
|
110
|
+
// Only show errors if there are no rate back (checkoutSessionWorkflow) and there are errors
|
|
111
|
+
!((t=s.checkoutSessionWorkflow)===null||t===void 0?void 0:t.length)&&((r=s.errors)===null||r===void 0?void 0:r.length)){throw new Error("Failed to build landed cost: ".concat(((n=(o=s===null||s===void 0?void 0:s.errors)===null||o===void 0?void 0:o[0])===null||n===void 0?void 0:n.message)||"Unknown error"))}return[4/*yield*/,handleFetch("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:d=u.sent(),c=d.errors,l=d.json;if(!l||c.length){throw new Error("Invalid landed cost object: ".concat(((i=c.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2/*return*/,s]}}))}))};var calculateLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s;return __generator(this,(function(d){switch(d.label){case 0:r=zonosStore.checkoutSettings.buildLandedCost;if(!r)return[3/*break*/,2];return[4/*yield*/,triggerBuildLandedCost(r)];case 1:o=d.sent();return[2/*return*/,o];case 2:return[4/*yield*/,handleFetch("/api/zonos-elements/calculate-landed-cost",{body:prepCalculateLandedCost(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:n=d.sent(),i=n.errors,a=n.json;if(i.length||!a){s=((t=i[0])===null||t===void 0?void 0:t.message)==="The user aborted a request.";if(s){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}
|
|
112
|
+
// We want to show any successful quotes even if there are errors
|
|
113
|
+
i.forEach((function(e){
|
|
114
|
+
// eslint-disable-next-line no-console
|
|
115
|
+
console.warn("Error calculating landed cost: ".concat(e.message))}));if(!a){throw new Error("Failed to calculate landed cost")}return[2/*return*/,a]}return[2/*return*/,a]}}))}))};var cartCalculateLandedCost=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c,l;var u=e.abortController,S=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,handleFetch("/api/zonos-elements/cart-calculate-landed-cost",{body:prepCartCalculateLandedCost(S),method:"POST",signal:u===null||u===void 0?void 0:u.signal})];case 1:a=e.sent(),s=a.errors,d=a.json;if(s.length||!d){c=typeof((t=s[0])===null||t===void 0?void 0:t.message)==="string"&&(((r=s[0])===null||r===void 0?void 0:r.message)==="The user aborted a request."||((o=s[0])===null||o===void 0?void 0:o.message.includes("signal is aborted"))||((n=s[0])===null||n===void 0?void 0:n.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));l=c?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2/*return*/,d]}}))}))};var __rest=undefined&&undefined.__rest||function(e,t){var r={};for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0)r[o]=e[o];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++){if(t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n]))r[o[n]]=e[o[n]]}return r};var calculateLandedCostNormalized=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i;return __generator(this,(function(a){switch(a.label){case 0:t=window.Zonos.cartId;if(!!t)return[3/*break*/,2];return[4/*yield*/,calculateLandedCost(e)];case 1:r=a.sent();return[2/*return*/,r];case 2:return[4/*yield*/,cartCalculateLandedCost({abortController:e,cartId:t})];case 3:o=a.sent(),n=o.cartWorkflow,i=__rest(o,["cartWorkflow"]);return[2/*return*/,Object.assign(Object.assign({},i),{itemCreateWorkflow:n.items})]}}))}))};var trackConversionEvent=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c;var l=e.checkoutSessionId,u=e.eventName,S=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();n=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:l,eventCreated:o,eventName:u});i=
|
|
116
|
+
// if the url includes zonos.com and not hosted checkout (checkout.zonos.com), it means we are on the development site (dashboard, preview zonos domain or main zonos.com)
|
|
117
|
+
window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((t=window.Zonos)===null||t===void 0?void 0:t.zonosQaUrl)||!!((r=window.Zonos)===null||r===void 0?void 0:r.debug);a=getIsTestMode()||getIsStagingMode();if((a||i)&&
|
|
118
|
+
// if found, it means we want to test the conversion event in development site, or test mode and staging mode
|
|
119
|
+
!window.Zonos.zonosConversionTest){return[2/*return*/]}s=localizationStore.selectedCountryCode;d=zonosStore.organizationId;if(!l){void sendErrorLog({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(u,'" - No checkout session id found')],metadata:{allLogs:allLogs,checkoutSessionId:l,eventName:u,metadata:S,organizationId:d,trackEventLogs:n}});
|
|
120
|
+
// checkoutSessionId is required for tracking conversion events to work properly
|
|
121
|
+
return[2/*return*/]}if(!d){void sendErrorLog({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(u,'" - No organization id found')],metadata:{allLogs:allLogs,checkoutSessionId:l,eventName:u,metadata:S,organizationId:d,trackEventLogs:n}})}c={checkoutSessionId:l,countryCode:s,eventCreated:o,eventName:u,metadata:Object.assign(Object.assign({},S),{trackEventLogs:n}),organizationId:d};return[4/*yield*/,handleFetch("/api/zonos-elements/track-conversion-event",{body:c,method:"POST"})];case 1:e.sent();return[2/*return*/]}}))}))};
|
|
122
|
+
/**
|
|
123
|
+
* This function generates an object that contains the fields of an address that have invalid characters.
|
|
124
|
+
*
|
|
125
|
+
* @param {Object} params - The parameters for the function.
|
|
126
|
+
* @param {Address | null} params.address - The address to check for invalid characters.
|
|
127
|
+
* @param {ReturnType<typeof containsNonLatinChars> | null} params.invalidAdddressList - The list of address fields that contain invalid characters.
|
|
128
|
+
*
|
|
129
|
+
* @returns {Partial<Address> | undefined} - An object that contains the fields of the address that have invalid characters. If no fields have invalid characters, the function returns undefined.
|
|
130
|
+
*/var getExcludeAddressFieldsObject=function(e){var t=e.address,r=e.invalidAdddressList;if(!t){return}
|
|
131
|
+
// if there are no invalid characters, return an empty object
|
|
132
|
+
if(!r){return}var o={};if(r.city){o.city=t.city}if(r.line1){o.line1=t.line1}if(r.line2){o.line2=t.line2}if(r.postal_code){o.postal_code=t.postal_code}if(r.state){o.state=t.state}if(r.name){o.name=t.name}
|
|
133
|
+
// return null if there are no fields to exclude
|
|
134
|
+
return Object.keys(o).length?o:undefined};
|
|
135
|
+
/**
|
|
136
|
+
* This function builds the request body for validating an address. It checks if the address and billing address are ready and if they contain any invalid characters.
|
|
137
|
+
* If there are non-latin character to translate, returns an object with the address fields that have invalid characters, the destination country, and the first and last name.
|
|
138
|
+
* If the conditions are not met, it returns null.
|
|
139
|
+
*
|
|
140
|
+
* @param {Object} params - The parameters for the function.
|
|
141
|
+
* @param {ReturnType<typeof containsNonLatinChars> | null} params.addressInvalidCharactersList - The list of address fields that contain invalid characters.
|
|
142
|
+
* @param {ReturnType<typeof containsNonLatinChars> | null} params.billingAddressInvalidCharactersList - The list of billing address fields that contain invalid characters.
|
|
143
|
+
* @param {StripeAddressEventData} params.stripeAddressEventData - The Stripe event data for the address.
|
|
144
|
+
* @param {StripeAddressEventData} params.stripeBillingAddressEventData - The Stripe event data for the billing address.
|
|
145
|
+
* @param {boolean} params.stripeShippingSameAsBilling - A flag indicating whether the shipping address is the same as the billing address.
|
|
146
|
+
*
|
|
147
|
+
* @returns {ValidateAddressRequest | null} - An object that contains the address fields that have invalid characters, the destination country, and the first and last name. If the conditions are not met, the function returns null.
|
|
148
|
+
*/var buildTranslateRequest=function(e){var t=e.addressInvalidCharactersList,r=e.billingAddressInvalidCharactersList,o=e.stripeAddressEventData,n=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(o===null||o===void 0?void 0:o.complete);var s=i?a:!!(n===null||n===void 0?void 0:n.complete);
|
|
149
|
+
// only translate if both address and billing address are ready
|
|
150
|
+
if(!a||!s){return null}
|
|
151
|
+
// only translate if there are invalid characters
|
|
152
|
+
if(!t&&!r){return null}var d=o.value;var c=(n===null||n===void 0?void 0:n.value)||null;
|
|
153
|
+
// Returns undefined if the name is Latin so it won't be included in the request body
|
|
154
|
+
var l=extractName({firstName:d.firstName,lastName:d.lastName,name:d.name}),u=l.firstName,S=l.lastName;var v="".concat(u," ").concat(S);var p=extractName({firstName:c===null||c===void 0?void 0:c.firstName,lastName:c===null||c===void 0?void 0:c.lastName,name:(c===null||c===void 0?void 0:c.name)||""}),f=p.firstName,h=p.lastName;var m=f&&h?"".concat(f," ").concat(h):"";var g=d.address;var C=c===null||c===void 0?void 0:c.address;return{address:getExcludeAddressFieldsObject({address:Object.assign(Object.assign({},g),{name:v}),invalidAdddressList:t}),
|
|
155
|
+
// only include billing address if it's different from the shipping address
|
|
156
|
+
billingAddress:!i?getExcludeAddressFieldsObject({address:C?Object.assign(Object.assign({},C),{name:m}):null,invalidAdddressList:r}):undefined,destinationCountry:g.country}};
|
|
157
|
+
/**
|
|
158
|
+
* Sorts service levels with lower cost first
|
|
159
|
+
*/var sortServiceLevelOptionsByAmount=function(e){var t=e.sort((function(e,t){return e.amount-t.amount}));return t};
|
|
160
|
+
/**
|
|
161
|
+
* Validate checkout session before confirming payment
|
|
162
|
+
*/var validateCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i;return __generator(this,(function(a){switch(a.label){case 0:return[4/*yield*/,getCheckoutSession()];case 1:r=a.sent(),o=r.errors,n=r.json;if(o.length||!n){logError("Failed to retrieve checkout session info before confirming payment ",o);void sendErrorLog({endpoint:"validateCheckoutSession",errors:o.map((function(e){return e.message})),metadata:{allLogs:allLogs}});return[2/*return*/,{errorMessage:translate("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}i=!!(((e=n.checkoutSession.order)===null||e===void 0?void 0:e.id)&&!n.checkoutSession.completedAt);if(!i&&!((t=n.checkoutSession.landedCost)===null||t===void 0?void 0:t.id)){logError("Landed cost is not found in the checkout session before confirming payment.");void sendErrorLog({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:allLogs}});return[2/*return*/,{errorMessage:translate('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:false}]}return[2/*return*/,{errorMessage:"",valid:true}]}}))}))};var addressRuleStyle=function(e){var t=e.theme;var r={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:zonosStore.appearance.fontSizeInputValue?"".concat(zonosStore.appearance.fontSizeInputValue,"px"):undefined,
|
|
163
|
+
// need to reset everything and the paddingTop to default, otherwise the paddingTop will not be updated.
|
|
164
|
+
padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",
|
|
165
|
+
// any value here will be add up to the default paddingTop (20px).
|
|
166
|
+
paddingTop:"6px"},".Label--resting":{fontSize:zonosStore.appearance.fontSizeInputLabel?"".concat(zonosStore.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(t){case"DARK":{return Object.assign(Object.assign({},r),{".Action":Object.assign(Object.assign({},r[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},r[".PickerItem--new"]),{color:"white"})})}default:return r}};var defaultVariable=function(e){var t=e.borderStyle,r=e.theme;switch(r){case"DARK":return{borderRadius:getBorderRadius({overrideBorderStyle:t}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:getBorderRadius({overrideBorderStyle:t}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var checkoutPaymentProcessorType={Airwallex:"AIRWALLEX",Paypal:"PAYPAL",Stripe:"STRIPE"};var _q=createStore((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:false,shouldRenderPayInUsdButton:false,
|
|
167
|
+
/**
|
|
168
|
+
* Default to skip payment intent, only create payment intent when "skipPaymentIntent" in url's query params is set "0"
|
|
169
|
+
* @default true
|
|
170
|
+
*/
|
|
171
|
+
skipPaymentIntent:new URLSearchParams(window.location.search).get("skipPaymentIntent")==="0"?false:true,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:true,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}})),stripeStoreOnChange=_q.onChange,reset$1=_q.reset,stripeStore=_q.state;var getStripeOptions=function(e){var t=e.clientSecret,r=e.overrideBorderRadius,o=e.overridePrimaryColor,n=e.overrideSecondaryColor,i=e.overrideTheme,a=e.paypalEnabled;var s=o||zonosStore.appearance.colorPrimary;var d=n||zonosStore.appearance.colorSecondary;var c=window.Zonos.isCollect||window.Zonos.isInvoice?zonosStore.appearance.theme==="DARK":s&&isDarkColor(s);var l=c?"night":"flat";
|
|
172
|
+
// if overrideTheme is provided, use it. Otherwise, use theme based on primary color
|
|
173
|
+
var u=i==="DARK"?"night":"flat";var S=a?["external_paypal"]:[];
|
|
174
|
+
// If client secret is Stripe format, use it
|
|
175
|
+
var v=(t===null||t===void 0?void 0:t.includes("_secret_"))?t:undefined;return{appearance:{labels:"floating",rules:Object.assign({},addressRuleStyle({theme:i||"LIGHT"})),
|
|
176
|
+
// get contrast theme color base on primary color
|
|
177
|
+
theme:i?u:l,variables:Object.assign(Object.assign({},defaultVariable({borderStyle:r,theme:"LIGHT"})),{
|
|
178
|
+
// use the button background color for input glow color
|
|
179
|
+
colorPrimary:d})},
|
|
180
|
+
// Client secret can be undefined since we will load other elements that doesn't require client secret first, then load client secret and render one that requires it later
|
|
181
|
+
clientSecret:v,customerSessionClientSecret:stripeStore.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],S,true),locale:localizationStore.selectedLocale}};var stripeStoreCleanupDomesticShippingSession=function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")};
|
|
182
|
+
// Save shipping address to session storage
|
|
183
|
+
var stripeStoreSaveDomesticShippingSession=function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))};var stripeStoreGetDomesticShippingSession=function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return jsonParse(e)};var initStripeElements=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i;return __generator(this,(function(a){o=stripeStore.clientSecret;if(!stripeStore.stripe){log("Skip. Stripe is not initialized");return[2/*return*/]}n=getStripeOptions({clientSecret:o,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(n)===JSON.stringify(stripeStore.stripeElementsOptions);if(!stripeStore.stripeElements||!stripeStore.stripeElementsForBillingAddress){
|
|
184
|
+
// init stripe elements for billing address
|
|
185
|
+
stripeStore.stripeElementsForBillingAddress=(t=stripeStore.stripe)===null||t===void 0?void 0:t.elements(n);log("Stripe elements for billing address initialized");
|
|
186
|
+
// init stripe elements if it doesn't exist
|
|
187
|
+
stripeStore.stripeElements=(r=stripeStore.stripe)===null||r===void 0?void 0:r.elements(n);
|
|
188
|
+
// save stripe elements options for later comparison
|
|
189
|
+
stripeStore.stripeElementsOptions=n;log("Stripe elements initialized");return[2/*return*/]}if(!i){
|
|
190
|
+
// update elements with new option if it already exists
|
|
191
|
+
stripeStore.stripeElements.update(n);
|
|
192
|
+
// update elements for stripe billing address
|
|
193
|
+
stripeStore.stripeElementsForBillingAddress.update(n);
|
|
194
|
+
// save stripe elements options for later comparison
|
|
195
|
+
stripeStore.stripeElementsOptions=n;void stripeStore.stripeElements.fetchUpdates()}log("Stripe elements updated");return[2/*return*/]}))}))};var stripeStoreReset=function(){
|
|
196
|
+
// clean clientSecret so that we can start the new one.
|
|
197
|
+
sessionStorage.removeItem("zonos--client-secret");
|
|
198
|
+
// cleanup stripe elements
|
|
199
|
+
reset$1();
|
|
200
|
+
// set stripe back to window.Zonos.stripe
|
|
201
|
+
stripeStore.stripe=window.Zonos.stripe};var checkIsAddressOutdatedForValidation=function(){var e,t,r,o;var n=JSON.stringify((e=stripeStore.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeAddressEventData)===null||t===void 0?void 0:t.value);var i=!stripeStore.stripeShippingSameAsBilling&&JSON.stringify((r=stripeStore.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value)!==JSON.stringify((o=stripeStore.stripeBillingAddressUsedWhenValidatingAddress)===null||o===void 0?void 0:o.value);return n||i};var checkIsAddressOutdatedForAsyncAddressUpdate=function(){var e,t,r,o,n,i,a,s;
|
|
202
|
+
/**
|
|
203
|
+
* If user updates the address after prefetching the landed cost, should always create and attach
|
|
204
|
+
* @caveat this will cause the scenario goes wrong after prefetching landed cost, with the current logic, it won't create party because nothing change after the prefetch happened
|
|
205
|
+
*/var d=(e=cartStore.partiesData.find((function(e){return e.type==="DESTINATION"})))===null||e===void 0?void 0:e.id;var c=(t=cartStore.partiesData.find((function(e){return e.type==="PAYOR"})))===null||t===void 0?void 0:t.id;
|
|
206
|
+
// If haven't prefetched landed cost, there is no need to update address async
|
|
207
|
+
if(!d||!c){return false}
|
|
208
|
+
// If we don't have landed cost parties data, should way
|
|
209
|
+
if(stripeStore.partyShippingId!==d||stripeStore.partyBillingId!==c){return true}var l=JSON.stringify((r=stripeStore.stripeLinkUsedWhenFetchingLC)===null||r===void 0?void 0:r.value)!==JSON.stringify((o=stripeStore.stripeLinkEventData)===null||o===void 0?void 0:o.value);var u=JSON.stringify((n=stripeStore.stripeAddressUsedWhenAsyncAddressUpdate)===null||n===void 0?void 0:n.value)!==JSON.stringify((i=stripeStore.stripeAddressEventData)===null||i===void 0?void 0:i.value);var S=!stripeStore.stripeShippingSameAsBilling&&JSON.stringify((a=stripeStore.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||a===void 0?void 0:a.value)!==JSON.stringify((s=stripeStore.stripeBillingAddressEventData)===null||s===void 0?void 0:s.value);var v=stripeStore.taxIdUsedWhenAsyncAddressUpdate!==stripeStore.taxId;var p=stripeStore.companyNameUsedWhenAsyncAddressUpdate!==stripeStore.companyName;return l||u||S||v||p};var stripeStoreBuildAddressForPartyCreate=function(e){var t=e.address,r=e.firstName,o=e.lastName,n=e.name,i=e.phone;var a=extractName({firstName:r,lastName:o,name:n}),s=a.firstName,d=a.lastName;if(!s||!d){void sendErrorLog({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,firstName:r,lastName:o,name:n}})}if(!i){void sendErrorLog({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,phone:i}})}return{city:t.city,country:t.country,firstName:s,lastName:d,line1:t.line1,line2:t.line2,phone:i||"",postal_code:t.postal_code,state:t.state}};var stripeStoreAsyncAddressUpdate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,c,l,u;return __generator(this,(function(S){switch(S.label){case 0:if(!((e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!stripeStore.stripeShippingSameAsBilling&&!((t=stripeStore.stripeBillingAddressEventData)===null||t===void 0?void 0:t.complete)||!stripeStore.stripeBillingAddressEventData){return[2/*return*/,{partiesCreated:false}]}
|
|
210
|
+
// If there is no landed cost data, no need to create parties
|
|
211
|
+
if(!cartStore.landedCostData){return[2/*return*/,{partiesCreated:false}]}n=(r=cartStore.landedCostData.find(Boolean))===null||r===void 0?void 0:r.landedCost.rootId;if(!n){
|
|
212
|
+
// do nothing if we don't have selected landed cost
|
|
213
|
+
void sendErrorLog({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId}});return[2/*return*/,{partiesCreated:false}]}i=checkIsAddressOutdatedForAsyncAddressUpdate();if(!i){return[2/*return*/,{partiesCreated:false}]}a=stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeAddressEventData.value.address,firstName:stripeStore.stripeAddressEventData.value.firstName,lastName:stripeStore.stripeAddressEventData.value.lastName,name:stripeStore.stripeAddressEventData.value.name,phone:stripeStore.stripeAddressEventData.value.phone});s=stripeStore.stripeShippingSameAsBilling?a:stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeBillingAddressEventData.value.address,firstName:stripeStore.stripeBillingAddressEventData.value.firstName,lastName:stripeStore.stripeBillingAddressEventData.value.lastName,name:stripeStore.stripeBillingAddressEventData.value.name,phone:stripeStore.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4/*yield*/,handleFetch("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:s,companyName:stripeStore.companyName,email:((o=stripeStore.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:n,shortAddressCode:stripeStore.shortAddressCode,taxId:stripeStore.taxId},method:"POST"})];case 1:c=S.sent(),l=c.errors,u=c.json;if(l.length||!u){logError("Error occurs when creating parties",JSON.stringify(l,null,2));void sendErrorLog({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,errors:l,json:u}});return[2/*return*/,{partiesCreated:false}]}stripeStore.companyNameUsedWhenAsyncAddressUpdate=stripeStore.companyName;stripeStore.stripeAddressUsedWhenAsyncAddressUpdate=stripeStore.stripeAddressEventData;stripeStore.stripeBillingAddressUsedWhenAsyncAddressUpdate=stripeStore.stripeBillingAddressEventData;stripeStore.taxIdUsedWhenAsyncAddressUpdate=stripeStore.taxId;stripeStore.partyBillingId=u.billToPartyId;stripeStore.partyShippingId=u.shipToPartyId;
|
|
214
|
+
// Update parties data with the new parties id
|
|
215
|
+
cartStore.partiesData=cartStore.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!==u.shipToPartyId){return Object.assign(Object.assign({},e),{id:u.shipToPartyId})}if(e.type==="PAYOR"&&e.id!==u.billToPartyId){return Object.assign(Object.assign({},e),{id:u.billToPartyId})}return e}));return[2/*return*/,{partiesCreated:true}]}}))}))};
|
|
216
|
+
/**
|
|
217
|
+
* Extract only the necessary address info for landed cost prefetch
|
|
218
|
+
*/var buildAddressForLCPrefetch=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var checkIsAddressOutdatedForLCPrefetch=function(){var e,t;var r=JSON.stringify((e=stripeStore.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value);var o=stripeStore.stripeAddressEventData&&JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeAddressEventData.value))!==JSON.stringify(stripeStore.stripeAddressUsedWhenFetchingLC);var n=!stripeStore.stripeShippingSameAsBilling&&stripeStore.stripeBillingAddressEventData&&JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeBillingAddressEventData.value))!==JSON.stringify(stripeStore.stripeBillingAddressUsedWhenFetchingLC);return r||o||n};
|
|
219
|
+
/**
|
|
220
|
+
* Check if the address and email info used when fetching landed cost with the current email and address info are different
|
|
221
|
+
* Purpose is to resend the request if the info used when fetching landed cost is different from the current info
|
|
222
|
+
*/var isPrefetchInfoOutdated=function(){var e;
|
|
223
|
+
// Mark the landed cost is outdated since the item total amount has changed (items total didn't match with the cart subtotal)
|
|
224
|
+
var t=cartStore.landedCostData&&((e=cartStore.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==cartStore.subtotal;var r=checkIsAddressOutdatedForLCPrefetch();log("isPrefetchInfoOutdated","info",{isAddressOutdated:r});
|
|
225
|
+
// if landed cost data is not available, we need to fetch it
|
|
226
|
+
return!cartStore.landedCostData&&!stripeStore.isFetchingLandedCost||r||t};var getCountryField=function(e){var t,r;var o=(t=zonosStore.genericSettings)===null||t===void 0?void 0:t.countryFields;var n=(r=zonosStore.genericSettings)===null||r===void 0?void 0:r.stripeCountryFieldLabels;var i=n&&e in n?n[e]:null;var a=o&&e in o?o[e]:null;
|
|
227
|
+
/**
|
|
228
|
+
* If the address form is using Stripe component, use Stripe country field label if there is one, if not just use one from our countryFieldLabel data
|
|
229
|
+
* stripeCountryFieldLabels is the list we collect from Stripe, and extract only country that state/zip is required and different from what we have in our countryFieldLabel data
|
|
230
|
+
**/if(cartStore.addressFormRenderType==="stripe"){return i||a}return a};var isAddressReadyToRequestLandedCost=function(){var e,t,r,o;var n=!!((e=stripeStore.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((t=stripeStore.stripeAddressEventData)===null||t===void 0?void 0:t.complete);var a=stripeStore.stripeShippingSameAsBilling?i:!!((r=stripeStore.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete);var s=((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value.address.country)||"US";var d=getCountryField(s);if(i&&a&&n){return true}
|
|
231
|
+
// Only send landed cost request if the address is complete when we can't get the country field
|
|
232
|
+
if(!d||!stripeStore.stripeAddressEventData){return i&&a&&n}var c=stripeStore.stripeAddressEventData.value.address.line1.length>0;var l=stripeStore.stripeAddressEventData.value.firstName&&stripeStore.stripeAddressEventData.value.lastName;var u=!d.stateRequired||d.stateRequired&&stripeStore.stripeAddressEventData.value.address.state.length>0;var S=!d.zipRequired||d.zipRequired&&stripeStore.stripeAddressEventData.value.address.postal_code.length>=3;var v=stripeStore.stripeAddressEventData.value.phone&&stripeStore.stripeAddressEventData.value.phone.length>0;return n&&l&&c&&u&&S&&v};var stripeCalculateLandedCost=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,c,l;return __generator(this,(function(u){switch(u.label){case 0:t=new AbortController;stripeStore.fetchingLandedCostAbortController=t;
|
|
233
|
+
// Reset cart items to non-restricted state and restricted item list
|
|
234
|
+
cartStoreResetCartItems();return[4/*yield*/,calculateLandedCostNormalized(t)];case 1:r=u.sent(),o=r.checkoutSessionWorkflow,n=r.errors,i=r.itemCreateWorkflow,a=r.landedCostCalculateWorkflow,s=r.partyCreateWorkflow,d=r.shipmentRatingCalculateWorkflow;
|
|
235
|
+
// Surface a custom "no quote" message when either a rule (ruleMessageType CUSTOM) or a country
|
|
236
|
+
// constraint (source COUNTRY_CONSTRAINT) blocked shipment rating with an authored message.
|
|
237
|
+
cartStore.customQuotingError=((e=n===null||n===void 0?void 0:n.find((function(e){var t,r;return((t=e.extensions)===null||t===void 0?void 0:t.ruleMessageType)==="CUSTOM"||((r=e.extensions)===null||r===void 0?void 0:r.source)==="COUNTRY_CONSTRAINT"})))===null||e===void 0?void 0:e.message)||null;cartStore.shippingData=sortServiceLevelOptionsByAmount((d===null||d===void 0?void 0:d.filter(Boolean))||[]);
|
|
238
|
+
// check and update cart items with restrictions
|
|
239
|
+
cartStoreCheckItemRestrictions(i);
|
|
240
|
+
// reset abort controller after we are done
|
|
241
|
+
stripeStore.fetchingLandedCostAbortController=null;cartStore.partiesData=(s===null||s===void 0?void 0:s.filter(Boolean))||[];
|
|
242
|
+
// update cart store with landed cost info
|
|
243
|
+
cartStore.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var t=a===null||a===void 0?void 0:a.find((function(t){return(t===null||t===void 0?void 0:t.id)===e.landedCostId}));if(!t){return null}return Object.assign(Object.assign({},e),{landedCost:t})})).filter(Boolean))||[];c=storageStore.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void trackConversionEvent({checkoutSessionId:c,eventName:"checkout_quoteReceived"})}l=cartStore.promoCodeApplied&&!cartStore.landedCostData.find((function(e){var t;return(t=e.landedCost.appliedAdjustments)===null||t===void 0?void 0:t.find((function(e){return e.type==="PROMO_CODE"}))}));cartStore.promoCodeError=l;
|
|
244
|
+
// When promocode is valid, set promoCode to session storage so if user close the modal, we can still reapply for them
|
|
245
|
+
if(!l){sessionStorage.setItem("zonos--promo-code",cartStore.promoCode)}return[2/*return*/]}}))}))};var stripeStorePrefetchLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,d,c,l,u,S,v,p;return __generator(this,(function(f){switch(f.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=isPrefetchInfoOutdated();d=isAddressReadyToRequestLandedCost();
|
|
246
|
+
// Should not do anything if the address is not ready to request landed cost
|
|
247
|
+
if(!d){return[2/*return*/,{isRequestNotReady:true}]}if(s){
|
|
248
|
+
// if the info used when fetching landed cost is different from the current info, abort the previous request
|
|
249
|
+
(t=stripeStore.fetchingLandedCostAbortController)===null||t===void 0?void 0:t.abort();stripeStore.fetchingLandedCostAbortController=null}
|
|
250
|
+
// Do not fetch if we are not ready or data is not outdated
|
|
251
|
+
if(!s&&!a){return[2/*return*/,{isRequestNotReady:false}]}
|
|
252
|
+
// If there is retries, stop loading for a moment and then showing the spinner again (this is just so customer can see that checkout is doing something and not stuck)
|
|
253
|
+
if(i){stripeStore.isFetchingLandedCost=false;setTimeout((function(){stripeStore.isFetchingLandedCost=true}),300)}else{stripeStore.isFetchingLandedCost=true}if(stripeStore.stripeAddressEventData){stripeStore.stripeAddressUsedWhenFetchingLC={countryCode:stripeStore.stripeAddressEventData.value.address.country,postalCode:stripeStore.stripeAddressEventData.value.address.postal_code,state:stripeStore.stripeAddressEventData.value.address.state}}if(stripeStore.stripeBillingAddressEventData){stripeStore.stripeBillingAddressUsedWhenFetchingLC={countryCode:stripeStore.stripeBillingAddressEventData.value.address.country,postalCode:stripeStore.stripeBillingAddressEventData.value.address.postal_code,state:stripeStore.stripeBillingAddressEventData.value.address.state}}if(stripeStore.stripeLinkEventData){stripeStore.stripeLinkUsedWhenFetchingLC=Object.assign({},stripeStore.stripeLinkEventData)}f.label=1;case 1:f.trys.push([1,3,,7]);
|
|
254
|
+
// Reset cart items to non-restricted state and restricted item list
|
|
255
|
+
cartStoreResetCartItems();
|
|
256
|
+
// fetch and apply landed cost
|
|
257
|
+
return[4/*yield*/,stripeCalculateLandedCost()];case 2:
|
|
258
|
+
// fetch and apply landed cost
|
|
259
|
+
f.sent();c=(r=cartStore.shippingData)===null||r===void 0?void 0:r.find(Boolean);l=(o=cartStore.landedCostData)===null||o===void 0?void 0:o.find((function(e){return e.landedCost.shipmentRating.id===(c===null||c===void 0?void 0:c.id)}));u=!!l?l.subtotals:null;if(u){
|
|
260
|
+
// prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
|
|
261
|
+
cartStoreApplySubtotals({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:u})}return[3/*break*/,7];case 3:S=f.sent();
|
|
262
|
+
// default to empty array if we failed to fetch landed cost, so we can show the error message
|
|
263
|
+
cartStore.landedCostData=[];cartStore.shippingData=[];v=["The landed cost calculation request was aborted to initiate a new one."];if(!(S instanceof Error&&S.message&&!v.includes(S.message)))return[3/*break*/,6];if(!(i<1))return[3/*break*/,5];
|
|
264
|
+
// retry fetching landed cost one more time
|
|
265
|
+
return[4/*yield*/,stripeStorePrefetchLandedCost(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:
|
|
266
|
+
// retry fetching landed cost one more time
|
|
267
|
+
f.sent();return[2/*return*/,{isRequestNotReady:false}];case 5:p=(n=stripeStore.stripeAddressEventData)===null||n===void 0?void 0:n.value;void sendErrorLog({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[S.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:p}});f.label=6;case 6:logError(S);return[3/*break*/,7];case 7:stripeStore.isFetchingLandedCost=false;return[2/*return*/,{isRequestNotReady:false}]}}))}))};var stripeStoreApplyPromoCode=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(n){switch(n.label){case 0:return[4/*yield*/,stripeStorePrefetchLandedCost({applyingPromocode:true})];case 1:n.sent();
|
|
268
|
+
// Go back to shipping step if we are in payment step so user can reselect shipping method
|
|
269
|
+
if(cartStore.step==="payment"){cartStorePreviousStep()}
|
|
270
|
+
// async update address with new root id from the new quote
|
|
271
|
+
return[4/*yield*/,stripeStoreAsyncAddressUpdate()];case 2:
|
|
272
|
+
// async update address with new root id from the new quote
|
|
273
|
+
n.sent();r=(e=cartStore.shippingData)===null||e===void 0?void 0:e.find(Boolean);o=(t=cartStore.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.id===(r===null||r===void 0?void 0:r.id)}));if(!r||!o){return[2/*return*/]}return[4/*yield*/,cartStoreUpdateSelectedShippingOption({applySubtotalsOnly:false,landedCostId:o.landedCostId,selectedShippingOption:r})];case 3:n.sent();return[2/*return*/]}}))}))};var stripeStoreResetPromoCode=function(){cartStore.promoCode="";sessionStorage.removeItem("zonos--promo-code");
|
|
274
|
+
// reset promocode error state
|
|
275
|
+
cartStore.promoCodeError=false;cartStore.promoCodeApplied=false};var stripeStoreRemovePromoCode=function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:
|
|
276
|
+
// Go back to shipping step if we are in payment step so user can reselect shipping method
|
|
277
|
+
if(cartStore.step==="payment"){cartStorePreviousStep()}stripeStoreResetPromoCode();return[4/*yield*/,stripeStoreApplyPromoCode()];case 1:e.sent();return[2/*return*/]}}))}))};var stripeStoreMessageBasedOnStatus=function(e){var t=[];var r=true;var o=window.Zonos.isCollect;var n=window.Zonos.isInvoice;
|
|
278
|
+
// Inspect the PaymentIntent `status` to indicate the status of the payment
|
|
279
|
+
// to your customer.
|
|
280
|
+
|
|
281
|
+
// Some payment methods will [immediately succeed or fail][0] upon
|
|
282
|
+
// confirmation, while others will first enter a `processing` state.
|
|
283
|
+
|
|
284
|
+
// [0]: https://stripe.com/docs/payments/payment-methods#payment-notification
|
|
285
|
+
switch(e){case"succeeded":{t=[translate("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",translate("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")];if(o||n){t=[translate("Thank you for submitting your payment. We appreciate your prompt attention."),"",translate("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]}r=false;break}case"requires_capture":case"processing":{t=[translate("Payment processing. We'll update you when payment is received.")];r=false;break}case"requires_payment_method":{t=[translate("Payment failed. Please try another payment method.")];if(o){t=[translate("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{r=false;t=[translate("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{t=[translate("Something went wrong.")];break}}return{isError:r,messages:t}};
|
|
286
|
+
/**
|
|
287
|
+
* Handle inventory check and returns error message if the callback provided.
|
|
288
|
+
*/var stripeStoreHandleInventoryCheck=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,s;return __generator(this,(function(c){switch(c.label){case 0:r=zonosStore.checkoutSettings.onInventoryCheck;o=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o))return[3/*break*/,2];return[4/*yield*/,handleFetch("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:n=c.sent(),i=n.errors,a=n.json;if(i.length||!a){logError("Error occurs when handling inventory refund","warn",JSON.stringify(i));return[2/*return*/,null]}
|
|
289
|
+
// Proceed if the item is available
|
|
290
|
+
if(!a.available||a.status===204){return[2/*return*/,translate("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(a.available||a.status===200){stripeStore.shouldInventoryRefund=true;return[2/*return*/,null]}return[2/*return*/,null];case 2:if(typeof r!=="function"){return[2/*return*/,null]}c.label=3;case 3:c.trys.push([3,5,,6]);return[4/*yield*/,r({items:cartStore.items},{translate:translate,zonosApiRoute:fallbackApiList["vercel"]})];case 4:s=c.sent();return[2/*return*/,s];case 5:d=c.sent();s=d instanceof Error?d.message:"Unknown error";void sendErrorLog({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(s)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:cartStore.items}});throw d;case 6:return[2/*return*/]}}))}))};
|
|
291
|
+
/**
|
|
292
|
+
* Handle inventory check and returns error message if the callback provided.
|
|
293
|
+
*/var stripeStoreHandleInventoryRefund=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r;return __generator(this,(function(o){switch(o.label){case 0:r=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.value);
|
|
294
|
+
// inventory refund is only available for legacy checkout and store has referenceId in metadata
|
|
295
|
+
if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!r){return[2/*return*/]}
|
|
296
|
+
// handle inventory check on legacy checkout
|
|
297
|
+
return[4/*yield*/,handleFetch("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:
|
|
298
|
+
// handle inventory check on legacy checkout
|
|
299
|
+
o.sent();return[2/*return*/]}}))}))};var stripeStoreRetrievePayment=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c;var l=e.clientSecret,u=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(u){t=stripeStoreMessageBasedOnStatus(u),r=t.isError,o=t.messages;return[2/*return*/,{error:r,messages:o}]}n=l||stripeStore.clientSecret;if(!stripeStore.stripe||!n){logError("Failed to retrieve payment intent. Stripe is not initialized");return[2/*return*/,{error:true,message:[translate("Something went wrong.")]}]}
|
|
300
|
+
// A client secret that isn't a Stripe payment intent secret (e.g. an Airwallex
|
|
301
|
+
// secret) can't be evaluated by Stripe. Do not treat it as a successful Stripe
|
|
302
|
+
// payment — return an error so callers don't run success analytics / order
|
|
303
|
+
// polling off a secret Stripe never confirmed.
|
|
304
|
+
if(!n.includes("_secret_")){return[2/*return*/,{error:true,messages:[translate("Something went wrong.")]}]}return[4/*yield*/,stripeStore.stripe.retrievePaymentIntent(n)];case 1:i=e.sent().paymentIntent;a=i===null||i===void 0?void 0:i.status;s=stripeStoreMessageBasedOnStatus(a),d=s.isError,c=s.messages;return[2/*return*/,{amount:i===null||i===void 0?void 0:i.amount,currency:i===null||i===void 0?void 0:i.currency,error:d,messages:c,paymentIntentId:i===null||i===void 0?void 0:i.id,paymentMethod:i===null||i===void 0?void 0:i.payment_method,status:a}]}}))}))};var stripeStoreConfirmPayment=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,d,c,l,u,S;return __generator(this,(function(v){switch(v.label){case 0:o=!!((t=stripeStore.stripePaymentEventData)===null||t===void 0?void 0:t.complete);n=stripeStore.stripeElements;i=stripeStore.stripe;a=stripeStore.clientSecret;stripeStore.customErrorMessage=null;if(!((r=cartStore.selectedLandedCost)===null||r===void 0?void 0:r.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4/*yield*/,validateCheckoutSession()];case 1:s=v.sent();if(!s.valid){stripeStore.customErrorMessage=s.errorMessage;throw new Error(s.errorMessage)}d=storageStore.checkoutSessionId;if(!(i&&n&&o&&a&&d))return[3/*break*/,3];c=new URL(window.location.href);c.searchParams.set("payment_intent_client_secret",a);c.searchParams.set("zonosCheckoutSessionId",d);void trackConversionEvent({checkoutSessionId:d,eventName:"checkout_paymentInfoCompleted"});return[4/*yield*/,i.confirmPayment({confirmParams:{return_url:c.toString()},elements:n,redirect:"if_required"})];case 2:l=v.sent(),u=l.error,S=l.paymentIntent;log("Payment intent confirmed","info",{error:u,paymentIntent:S});if((S===null||S===void 0?void 0:S.status)==="requires_action"){throw new Error(translate("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(u){if(u.type==="card_error"||u.type==="validation_error"){throw new Error(u.message)}if(u.type==="invalid_request_error"){if(u.code==="payment_intent_unexpected_state"){
|
|
305
|
+
// PaymentIntent was canceled or expired, or status is `require_capture`.
|
|
306
|
+
// don't throw error here because we will reset the checkout session last step
|
|
307
|
+
return[2/*return*/]}}throw new Error("An unexpected error occurred.")}if(S.status==="requires_payment_method"){
|
|
308
|
+
// Failed to confirm payment, allows user to try another payment method
|
|
309
|
+
throw new Error(translate("Payment failed. Please try another payment method."))}v.label=3;case 3:return[2/*return*/]}}))}))};
|
|
310
|
+
/**
|
|
311
|
+
* Builds the single `merchantPolicyConsent` metadata entry that records the buyer's
|
|
312
|
+
* acceptance of the merchant policies (Terms and Conditions, Privacy Policy, etc.).
|
|
313
|
+
* Returns null when consent has not been accepted or when no policies are configured.
|
|
314
|
+
*
|
|
315
|
+
* The recorded value captures which policies were shown, the URLs the buyer
|
|
316
|
+
* agreed to, the active locale, and the snapshotted acceptance timestamp.
|
|
317
|
+
*/var buildPolicyConsentMetadataEntry=function(){if(!policyConsentStore.accepted){return null}var e=getEnabledPolicies();if(!e.length){return null}return{key:"merchantPolicyConsent",value:JSON.stringify({
|
|
318
|
+
// Use the timestamp snapshotted when the buyer first accepted, so any
|
|
319
|
+
// later session-metadata update keeps the original moment of consent
|
|
320
|
+
// for audit purposes. Fall back to "now" as a safety net for the
|
|
321
|
+
// unlikely case the store value was cleared between accept and write.
|
|
322
|
+
acceptedAt:policyConsentStore.acceptedAt||(new Date).toISOString(),locale:localizationStore.selectedLocale,policies:e.reduce((function(e,t){e[t.key]=t.url;return e}),{})})}};
|
|
323
|
+
/**
|
|
324
|
+
* Allow overriding the checkout session payment processor via a `paymentProcessor`
|
|
325
|
+
* URL query param (e.g. `?paymentProcessor=AIRWALLEX`). The processor is normally
|
|
326
|
+
* determined server-side by the billing company; this override is primarily used
|
|
327
|
+
* for testing. Returns `undefined` when the param is missing or not a valid
|
|
328
|
+
* processor.
|
|
329
|
+
*/var getPaymentProcessorFromUrl=function(){var e=new URLSearchParams(window.location.search).get("paymentProcessor");var t=function(e){return Object.values(checkoutPaymentProcessorType).some((function(t){return t===e}))};return e&&t(e)?e:undefined};var getCheckoutSessionBody=function(){var e;var t=cartStore.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);var r=storageStore.enabledVariantTestKeys||[];var o={adjustmentsAmount:cartStore.adjustments.reduce((function(e,t){return e+t.amount}),0),cartId:window.Zonos.cartId,currency:((e=cartStore.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:cartStore.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:t,metadata:[{key:"language",value:localizationStore.selectedLocale}],paymentProcessor:getPaymentProcessorFromUrl(),presentmentCountryCode:localizationStore.selectedCountryCode,skipPaymentIntent:stripeStore.skipPaymentIntent,varianceTestInput:r};return o};var stripeStoreGetPaymentIntent=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n;return __generator(this,(function(i){switch(i.label){case 0:if(!storageStore.checkoutSessionId){
|
|
330
|
+
// We want to log the error anytime we fail to create a checkout session
|
|
331
|
+
void sendErrorLog({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId}});cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[2/*return*/]}return[4/*yield*/,handleFetch("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:storageStore.checkoutSessionId},method:"POST"})];case 1:t=i.sent(),r=t.errors,o=t.json;n=(e=o===null||o===void 0?void 0:o.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(r.length||!n){logError("Error occurs when getting payment intent",JSON.stringify(r,null,2));
|
|
332
|
+
// We want to log the error anytime we fail to create a payment intent
|
|
333
|
+
void sendErrorLog({endpoint:"Error creating payment intent",errors:r.map((function(e){return e.message})),metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,clientSecret:n}});cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[2/*return*/]}
|
|
334
|
+
// update cart store checkout session with updated from checkout session payment intent creation call so the checkout session and payment intent are in sync
|
|
335
|
+
cartStoreSetCheckoutSession(o.checkoutSessionPaymentIntentCreate);return[2/*return*/]}}))}))};
|
|
336
|
+
/**
|
|
337
|
+
* Init checkout session
|
|
338
|
+
* @returns {boolean} whether or not the checkout session is successfully created
|
|
339
|
+
*/var stripeStoreInitCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s;return __generator(this,(function(d){switch(d.label){case 0:if(!localizationStore.targetCurrency){logError("Failed to create checkout session - missing localizationStore.targetCurrency");return[2/*return*/,false]}stripeStore.isFetchingSession=true;r=getCheckoutSessionBody();log("Checkout session body","info",r);return[4/*yield*/,handleFetch("/api/zonos-elements/create-checkout-session",{body:r,method:"POST"})];case 1:o=d.sent(),n=o.errors,i=o.json;stripeStore.isFetchingSession=false;if(n.length||!i){a=(e=n.find((function(e){return e.message})))===null||e===void 0?void 0:e.message;
|
|
340
|
+
// check if the error is related to expired cart and thow error so we can show error message accordingly
|
|
341
|
+
if(Array.isArray(a)&&a.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}logError("Error occurred when creating checkout session",JSON.stringify(n,null,2));return[2/*return*/,false]}s=i.checkoutSessionCreate;
|
|
342
|
+
// update cart store with updated information
|
|
343
|
+
cartStoreSetCheckoutSession(s);cartStoreApplySubtotals({method:((t=s.landedCost)===null||t===void 0?void 0:t.method)||"DDP",subtotals:s.subtotals});log("Exchange rate updated for cart items (checkout session create)","info",cartStore.exchangeRate);log("done-init-checkout-session");return[2/*return*/,true]}}))}))};var stripeStoreUpdateCheckoutSessionBaseCurrency=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r;return __generator(this,(function(o){switch(o.label){case 0:e=storageStore.checkoutSessionId;
|
|
344
|
+
// Checkout session id should be available at this point
|
|
345
|
+
if(!e){logError("Failed to update checkout session base currency");return[2/*return*/,false]}
|
|
346
|
+
// Only update checkout session currency if setting is enabled
|
|
347
|
+
if(zonosStore.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){log('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2/*return*/,true]}return[4/*yield*/,handleFetch("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:stripeStore.checkoutSettlementCurrency},method:"POST"})];case 1:t=o.sent().json;r=t===null||t===void 0?void 0:t.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;
|
|
348
|
+
// S
|
|
349
|
+
if(!t||r!==stripeStore.checkoutSettlementCurrency){logError("Failed to update checkout session base currency");return[2/*return*/,false]}log('Updated checkout session to settlement currency "'.concat(r,'".'));return[2/*return*/,true]}}))}))};
|
|
350
|
+
/**
|
|
351
|
+
* Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
|
|
352
|
+
*/var stripeStoreUpdateCheckoutSession=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n;var i=e.adjustmentsAmount,a=e.cartId,s=e.currency,d=e.id,c=e.itemsAmount,l=e.landedCostId,u=e.presentmentCountryCode,S=e.storeCreditApplication;return __generator(this,(function(e){switch(e.label){case 0:t=storageStore.enabledVariantTestKeys||[];return[4/*yield*/,handleFetch("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:i,billToPartyId:stripeStore.partyBillingId,cartId:a,currency:s,customerAuthenticationToken:cartStore.customerAuthenticationToken||undefined,id:d,itemsAmount:c,landedCostId:l,metadata:[{key:"language",value:localizationStore.selectedLocale}],presentmentCountryCode:u,shipToPartyId:stripeStore.partyShippingId,skipPaymentIntent:stripeStore.skipPaymentIntent,storeCreditApplication:S,varianceTestInput:t},method:"POST"})];case 1:r=e.sent(),o=r.errors,n=r.json;if(o.length||!n){logError("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2/*return*/,{errors:o,json:n}]}return[2/*return*/,{errors:[],json:n}]}}))}))};
|
|
353
|
+
/**
|
|
354
|
+
* Pushes the buyer's policy consent into the checkout session's metadata via the
|
|
355
|
+
* dedicated metadata-only mutation. Called from the payment continue handler so
|
|
356
|
+
* consent is persisted to the session before Stripe's confirmPayment fires.
|
|
357
|
+
*
|
|
358
|
+
* Uses `checkoutSessionUpdateMetadata` — not the full `checkoutSessionUpdate` —
|
|
359
|
+
* because this fires at the end of the payment phase, when we don't want to
|
|
360
|
+
* touch landed-cost / cart / party state. No-op when no policies are configured,
|
|
361
|
+
* when consent hasn't been accepted, or when there is no active session ID.
|
|
362
|
+
*/var stripeStoreRecordPolicyConsent=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:e=buildPolicyConsentMetadataEntry();if(!e){return[2/*return*/,{errors:[]}]}if(!storageStore.checkoutSessionId){return[2/*return*/,{errors:[]}]}return[4/*yield*/,handleFetch("/api/zonos-elements/update-checkout-session-metadata",{body:{id:storageStore.checkoutSessionId,metadata:[e]},method:"POST"})];case 1:t=r.sent().errors;if(t.length){
|
|
363
|
+
// Surface failures loudly so we have observability on consent records that
|
|
364
|
+
// didn't persist — callers don't block payment, but the failure is logged.
|
|
365
|
+
logError("Failed to record merchant policy consent on checkout session",JSON.stringify(t,null,2));return[2/*return*/,{errors:t.map((function(e){return e.message||"Unknown error"}))}]}return[2/*return*/,{errors:[]}]}}))}))};
|
|
366
|
+
/**
|
|
367
|
+
* This function builds a translated address object from the current address and the translated address result.
|
|
368
|
+
* It checks each field in the current address and if it exists in the translated address result, it adds it to the translated address object.
|
|
369
|
+
* The key of each field in the translated address object is the current address's field value and the value is the corresponding translated address's field value.
|
|
370
|
+
*
|
|
371
|
+
* @param {Object} params - The parameters for the function.
|
|
372
|
+
* @param {Address} params.currentAddress - The current address information.
|
|
373
|
+
* @param {Address} params.translatedAddressResult - The translated address result.
|
|
374
|
+
*
|
|
375
|
+
* @returns {TranslatedAddress} - An object containing the translated address. Each field is an object with the current address's field value as the key and the translated address's field value as the value.
|
|
376
|
+
*/var buildTranslatedAddress=function(e){var t,r,o,n,i,a;var s=e.currentAddress,d=e.translatedAddressResult;var c={};if(!d){return c}var l=d.city,u=d.line1,S=d.line2,v=d.name,p=d.postal_code,f=d.state;
|
|
377
|
+
// If we have translated address, add it to the translated address object
|
|
378
|
+
if(s.city&&l){c.city=(t={},t[s.city]=l,t)}if(s.line1&&u){c.line1=(r={},r[s.line1]=u,r)}if(s.line2&&S){c.line2=(o={},o[s.line2]=S,o)}if(s.postal_code&&p){c.postal_code=(n={},n[s.postal_code]=p,n)}if(s.state&&f){c.state=(i={},i[s.state]=f,i)}if(s.name&&v){c.name=(a={},a[s.name]=v,a)}return c};
|
|
379
|
+
/**
|
|
380
|
+
* This function translates an address to Latin characters using the Zonos API.
|
|
381
|
+
* It first builds the request body for the API call. If there's no request body, it resets the translated address in the store and returns.
|
|
382
|
+
* If the address is not outdated, it returns without making the API call.
|
|
383
|
+
* It then makes a POST request to the Zonos API to validate and translate the address. If the API call fails, it resets the translated address in the store and returns.
|
|
384
|
+
* If the API call is successful, it sets the current address and billing address in the store and builds the translated address and billing address from the API response.
|
|
385
|
+
*
|
|
386
|
+
* @param {Object} params - The parameters for the function.
|
|
387
|
+
* @param {ReturnType<typeof containsNonLatinChars> | null} params.addressInvalidCharactersList - The list of address fields that contain invalid characters.
|
|
388
|
+
* @param {ReturnType<typeof containsNonLatinChars> | null} params.billingAddressInvalidCharactersList - The list of billing address fields that contain invalid characters.
|
|
389
|
+
*/var stripeStoreTranslateAddressToLatin=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c,l,u;var S=e.addressInvalidCharactersList,v=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=buildTranslateRequest({addressInvalidCharactersList:S,billingAddressInvalidCharactersList:v,stripeAddressEventData:stripeStore.stripeAddressEventData,stripeBillingAddressEventData:stripeStore.stripeBillingAddressEventData,stripeShippingSameAsBilling:stripeStore.stripeShippingSameAsBilling});if(!i){
|
|
390
|
+
// reset translated address if we don't have any address to translate
|
|
391
|
+
stripeStore.translatedAddress={address:{},billingAddress:{}};return[2/*return*/]}a=checkIsAddressOutdatedForValidation();if(!a){return[2/*return*/]}return[4/*yield*/,handleFetch("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),d=s.errors,c=s.json;if(d.length||!c){logError("Error occurs when translating address to latin",JSON.stringify(d,null,2));
|
|
392
|
+
// reset translated address if we Failed to translate and let user manually fix it
|
|
393
|
+
stripeStore.translatedAddress={address:{},billingAddress:{}};return[2/*return*/]}
|
|
394
|
+
// Set current address to the store so we can compare it later to determine if we need to re-translate the address
|
|
395
|
+
stripeStore.stripeAddressUsedWhenValidatingAddress=stripeStore.stripeAddressEventData;stripeStore.stripeBillingAddressUsedWhenValidatingAddress=stripeStore.stripeBillingAddressEventData;l=(t=stripeStore.stripeAddressEventData)===null||t===void 0?void 0:t.value.address;u=(r=stripeStore.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value.address;
|
|
396
|
+
// Set the translated address to the store so we can populate it to the address element for user to update
|
|
397
|
+
stripeStore.translatedAddress={address:l?buildTranslatedAddress({currentAddress:Object.assign(Object.assign({},l),{name:(o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:!stripeStore.stripeShippingSameAsBilling?buildTranslatedAddress({currentAddress:Object.assign(Object.assign({},u),{name:(n=stripeStore.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value.name}),translatedAddressResult:c.billingAddress||null}):{}};return[2/*return*/]}}))}))};stripeStoreOnChange("clientSecret",(function(e){
|
|
398
|
+
// update stripe elements when client secret changes
|
|
399
|
+
if(e&&stripeStore.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));
|
|
400
|
+
/**
|
|
401
|
+
* EU 3-EUR cutover (05CHECK-893): when shipping to an EU country with a POSTAL
|
|
402
|
+
* service level whose DAP landed cost has remittance available, we keep treating
|
|
403
|
+
* the quote as DAP (duties paid upon delivery) instead of converting it to DDP.
|
|
404
|
+
* The cart subtotals then show taxes and fees as collected while duties are
|
|
405
|
+
* estimated and paid on delivery.
|
|
406
|
+
*
|
|
407
|
+
* @see [[cartStoreGetMethod]] for the DAP/DDP conversion this guards.
|
|
408
|
+
*/var isEuDapRemittance=function(e){var t=e.deliveryType,r=e.landedCost,o=e.shipToCountry;return r.method==="DAP"&&t==="POSTAL"&&r.remittance.length>0&&!!o&&euCountryCodes.includes(o)};var _r=createStore((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:getIsStagingMode(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",
|
|
409
|
+
// When user clicked applied button, save promocode into session storage for later use. So if session has promocode, applied button is clicked
|
|
410
|
+
promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},
|
|
411
|
+
// eslint-disable-next-line sort-keys/sort-keys-fix
|
|
412
|
+
payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),cartStoreOnChange=_r.onChange,reset=_r.reset,cartStore=_r.state;var getTransitUnit=function(e){switch(e){case"DAYS":return translate("days");case"WEEKS":return translate("weeks");case"BUSINESS_DAYS":default:return translate("business days")}};
|
|
413
|
+
/**
|
|
414
|
+
* Format shipping transit info to be displayed on UI
|
|
415
|
+
* @returns
|
|
416
|
+
* - expectedDate: Thursday, Aug 12
|
|
417
|
+
* - maxTransit: 5
|
|
418
|
+
* - minTransit: 3
|
|
419
|
+
*/var cartStoreGetShippingTransitInfo=function(e){var t;var r=(t=e.shippingProfile)===null||t===void 0?void 0:t.transitTime;
|
|
420
|
+
// Don't care about falsy 0 values because this is international shipping and 0 days is not feasible
|
|
421
|
+
if(!(r===null||r===void 0?void 0:r.min)||!(r===null||r===void 0?void 0:r.max)||!(r===null||r===void 0?void 0:r.type)){return null}return{maxTransit:r.max,minTransit:r.min,unit:getTransitUnit(r.type)}};var getMatchItem=function(e){var t=e.item1,r=e.item2;if(!t||!r){return false}return r.sku&&t.sku&&t.sku===r.sku||r.description&&t.description&&t.description===r.description||t.name&&r.name&&t.name===r.name};
|
|
422
|
+
/**
|
|
423
|
+
* Check and set restricted items in cart
|
|
424
|
+
*/var cartStoreCheckItemRestrictions=function(e){log("Checking item restrictions");var t=e.map((function(e){if(!e.restriction){return null}var t=e.restriction;var r=cartStore.items.find((function(t){return getMatchItem({item1:t,item2:e})}));return Object.assign(Object.assign({matchedItem:r},e),{restriction:t})})).filter(Boolean);cartStore.restrictedItems=t;
|
|
425
|
+
// remove items that are restricted from cart
|
|
426
|
+
cartStore.items=cartStore.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!t.find((function(t){return getMatchItem({item1:t,item2:e})}))})}));return{cartItems:cartStore.items,restrictedItems:t}};var storeCreditUpdateTimeout=null;var cartStoreReset=function(){storageStore.checkoutSessionId=null;
|
|
427
|
+
// clear pending store credit debounce timer
|
|
428
|
+
if(storeCreditUpdateTimeout){clearTimeout(storeCreditUpdateTimeout);storeCreditUpdateTimeout=null}
|
|
429
|
+
// reset store credit store
|
|
430
|
+
storeCreditStoreReset();
|
|
431
|
+
// reset cart store
|
|
432
|
+
reset()};var cartStoreUpdateToErrorState=function(e){var t=e.messages,r=e.title;cartStoreReset();stripeStoreReset();cartStore.step="error";cartStore.error={messages:t,title:r}};var cartStoreApplySubtotals=function(e){var t=e.dutiesTaxesFeesEstimate,r=e.method,o=e.subtotals;var n;
|
|
433
|
+
// update exchange rate so we can use it to display cart items
|
|
434
|
+
cartStore.exchangeRate=o.exchangeRate;cartStore.adjustmentTotal=o.adjustments;cartStore.dutiesTaxesFees=r==="DAP"?null:o.landedCostTotal;cartStore.storeCredit=(n=o.storeCredit)!==null&&n!==void 0?n:0;cartStore.subtotal=o.items;cartStore.total=o.total;cartStore.currency=o.presentmentCurrencyCode;cartStore.dutiesTaxesFeesEstimate=t||null};
|
|
435
|
+
/**
|
|
436
|
+
* Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
|
|
437
|
+
*/var cartStoreHasOneEligibleItem=function(){
|
|
438
|
+
// filter all items with positive amount
|
|
439
|
+
var e=cartStore.items.filter((function(e){return e.amount>0}));
|
|
440
|
+
// only check restricted status for items with positive amount
|
|
441
|
+
// if there is no item restricted found => all items are restricted
|
|
442
|
+
return!!e.find((function(e){return!e.isRestricted}))};
|
|
443
|
+
/**
|
|
444
|
+
* An order-modification payment-only session (skip-to-payment, no shipping
|
|
445
|
+
* step): a session tied to an order that hasn't completed yet, meaning the
|
|
446
|
+
* shopper is only paying a delta against an already-approved landed cost.
|
|
447
|
+
* Single source of truth for this detection — previously duplicated inline
|
|
448
|
+
* at each call site, which let one of them (the forceDialogOpen/preview init
|
|
449
|
+
* path) miss it entirely.
|
|
450
|
+
*/var cartStoreIsOrderModificationPaymentOnlySession=function(){var e,t;return!!(((t=(e=cartStore.checkoutSession)===null||e===void 0?void 0:e.order)===null||t===void 0?void 0:t.id)&&!cartStore.checkoutSession.completedAt)};var cartStoreSetCheckoutSession=function(e){var t,r,o,n,i,a,s;
|
|
451
|
+
// update stripe store with updated information
|
|
452
|
+
stripeStore.clientSecret=e.clientSecret;stripeStore.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;stripeStore.customerProfile=e.customerProfile;cartStore.checkoutSession=e;
|
|
453
|
+
// Populate store credit balance from checkout session customer profile
|
|
454
|
+
storeCreditStoreSetBalanceFromSession((r=(t=e.customerProfile)===null||t===void 0?void 0:t.storeCreditBalance)!==null&&r!==void 0?r:null);if(!e.id){
|
|
455
|
+
// Log error to track down the issue
|
|
456
|
+
void sendErrorLog({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:allLogs,checkoutSession:e}})}
|
|
457
|
+
// Only update checkout session id if it's not empty
|
|
458
|
+
if(e.id){storageStore.checkoutSessionId=e.id}
|
|
459
|
+
// Filter the response to only include test keys that we support and then save it to the session
|
|
460
|
+
var d=filterValidTests(e.varianceTestResults||[]);storageStoreSetEnabledVariantTestKeys(d);
|
|
461
|
+
// Check if there is a redirect URL in the metadata to override
|
|
462
|
+
var c=((i=(n=(o=cartStore.checkoutSession)===null||o===void 0?void 0:o.metadata)===null||n===void 0?void 0:n.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||i===void 0?void 0:i.value)||(
|
|
463
|
+
// Sometimes externalConfirmationPageURL is not in checkoutSession create/update, check if there is a redirect URL in the cart metadata to override
|
|
464
|
+
(s=(a=window.Zonos.cartData)===null||a===void 0?void 0:a.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||s===void 0?void 0:s.value)||null;if(c){log("Found externalConfirmationPageURL: ".concat(c));cartStore.externalConfirmationPageURL=c}};var cartStoreReCalculateTotal=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a;var s=e.adjustmentsAmount,d=e.cartId,c=e.currency,l=e.dutiesTaxesFeesEstimate,u=e.itemsAmount,S=e.landedCostId,v=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(S&&cartStore.selectedLandedCost){r=cartStore.selectedLandedCost.subtotals;cartStoreApplySubtotals({dutiesTaxesFeesEstimate:l,method:cartStore.landedCostMethod,subtotals:r});log("Exchange rate updated for cart items (landed cost subtotal)","info",cartStore.exchangeRate)}
|
|
465
|
+
// update checkout session
|
|
466
|
+
if(!storageStore.checkoutSessionId){log("Could not update cart total without checkout session id","info");return[2/*return*/,false]}return[4/*yield*/,stripeStoreUpdateCheckoutSession({adjustmentsAmount:s,cartId:d,currency:c,id:storageStore.checkoutSessionId,itemsAmount:u,landedCostId:S,presentmentCountryCode:localizationStore.selectedCountryCode})];case 1:o=e.sent(),n=o.errors,i=o.json;if(!(n.length>0||!i))return[3/*break*/,4];logError("Error occurs when updating checkout session.");if(!v)return[3/*break*/,3];log("Initiating checkout session on failure","info");return[4/*yield*/,stripeStoreInitCheckoutSession()];case 2:a=e.sent();log("stripeStoreInitCheckoutSession: ".concat(a));if(!a){cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[2/*return*/,false]}return[2/*return*/,true];case 3:return[2/*return*/,false];case 4:if(!S){
|
|
467
|
+
// This is when we first open the checkout modal and we just want to get info from the old cart session.
|
|
468
|
+
// use subtotals from checkout session to update cart total
|
|
469
|
+
cartStoreApplySubtotals({method:((t=i.checkoutSessionUpdate.landedCost)===null||t===void 0?void 0:t.method)||"DDP",subtotals:i.checkoutSessionUpdate.subtotals});log("Exchange rate updated for cart items (checkout session update)","info",cartStore.exchangeRate)}cartStoreSetCheckoutSession(i.checkoutSessionUpdate);return[2/*return*/,true]}}))}))};
|
|
470
|
+
/**
|
|
471
|
+
* For some service levels, the landed cost that's DAP and we do remittance on behalf of the merchant, these landed cost should be treated as DDP
|
|
472
|
+
*/var cartStoreGetMethod=function(e,t){var r,o,n,i;
|
|
473
|
+
// If the landed cost is DAP and the country is domestic, then treat it as DDP since no duty or fee is due at the door
|
|
474
|
+
if(e.method==="DAP"&&((o=(r=zonosStore.genericSettings)===null||r===void 0?void 0:r.domesticCountries)===null||o===void 0?void 0:o.includes(((n=stripeStore.stripeAddressEventData)===null||n===void 0?void 0:n.value.address.country)||"US"))){return"DDP"}
|
|
475
|
+
// EU 3-EUR cutover (05CHECK-893): keep EU POSTAL remittance quotes as DAP so
|
|
476
|
+
// the shopper is told duties are paid upon delivery, even though we remit.
|
|
477
|
+
if(isEuDapRemittance({deliveryType:t,landedCost:e,shipToCountry:(i=stripeStore.stripeAddressEventData)===null||i===void 0?void 0:i.value.address.country})){return"DAP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method};var cartStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c,l,u,S,v,p,f,h,m,g,C,y,w,b,A,O,_,k;var E=e.applySubtotalsOnly,I=e.landedCostId,P=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:log("Updating selected shipping option","info",{landedCostId:I,selectedShippingOption:P});cartStore.selectedShippingOption=P;v=cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption);if(v){p=v.maxTransit,f=v.minTransit,h=v.unit;cartStore.selectedShippingOptionTransitTime="".concat(f,"-").concat(p," ").concat(h)}else{cartStore.selectedShippingOptionTransitTime=""}m=(t=cartStore.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCostId===I}));
|
|
478
|
+
// save selected landed cost for later use
|
|
479
|
+
cartStore.selectedLandedCost=m||null;if(!m){
|
|
480
|
+
// do nothing if we can't find landed cost for selected shipping option
|
|
481
|
+
return[2/*return*/,false]}g=((r=m.landedCost.amountSubtotals)===null||r===void 0?void 0:r.landedCostTotal)||0;C=m.subtotals.exchangeRate.rate;y=g*C;if(y){log("DAP quote, using estimate: ".concat(y),"info")}cartStore.landedCostMethod=cartStoreGetMethod(m.landedCost,(o=P.shippingProfile)===null||o===void 0?void 0:o.serviceLevel.deliveryType);
|
|
482
|
+
// update shipping value and dutiesTaxFees on selectedShippingOption change
|
|
483
|
+
cartStore.shipping=m.subtotals.shipping;w=((n=m===null||m===void 0?void 0:m.landedCost)===null||n===void 0?void 0:n.landedCostGuaranteeCode)==="ZONOS";b=!!((a=(i=m===null||m===void 0?void 0:m.landedCost)===null||i===void 0?void 0:i.deMinimis)===null||a===void 0?void 0:a.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));cartStore.isSelectedShippingAboveDeminimis=b;cartStore.isSelectedShippingGuarantee=w;A=false;if(!E)return[3/*break*/,1];O=m.subtotals;cartStoreApplySubtotals({dutiesTaxesFeesEstimate:y,method:cartStore.landedCostMethod,subtotals:O});log("Exchange rate updated for cart items (landed cost subtotal)","info",cartStore.exchangeRate);A=true;return[3/*break*/,3];case 1:return[4/*yield*/,cartStoreReCalculateTotal({adjustmentsAmount:cartStore.adjustmentTotal,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:y,landedCostId:(s=m.landedCost)===null||s===void 0?void 0:s.id})];case 2:
|
|
484
|
+
// update session with selected landed cost
|
|
485
|
+
A=e.sent();e.label=3;case 3:_=(d=cartStore.items.find(Boolean))===null||d===void 0?void 0:d.currencyCode;k=((c=stripeStore.stripeAddressEventData)===null||c===void 0?void 0:c.value.address.country)||"US";
|
|
486
|
+
// Only show pay in USD button if item's currency is in USD, the setting is enabled and the order presentment currency is not USD, also only in USD settlement ship to country list
|
|
487
|
+
stripeStore.shouldRenderPayInUsdButton=_==="USD"&&zonosStore.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((l=cartStore.checkoutSession)===null||l===void 0?void 0:l.subtotals.presentmentCurrencyCode)!=="USD"&&!!((S=(u=zonosStore.genericSettings)===null||u===void 0?void 0:u.usdSettlementCountryEnabled)===null||S===void 0?void 0:S.includes(k));return[2/*return*/,A]}}))}))};var cartStoreStartCheckoutInterval=function(e){var t=e.isPreview,r=e.sessionTimeout;
|
|
488
|
+
// do nothing if in preview mode
|
|
489
|
+
if(t){return}var o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var n=
|
|
490
|
+
// timeout query is mainly for testing purpose
|
|
491
|
+
o&&!isNaN(parseInt(o,10))?parseInt(o,10):r;log("==START CHECKOUT TIMEOUT - ".concat(n,"=="));cartStore.checkoutTimeoutInterval=setTimeout((function(){cartStore.checkoutSessionTimeoutShow=true}),n)};var cartStoreClearCheckoutInterval=function(){if(cartStore.checkoutTimeoutInterval){clearTimeout(cartStore.checkoutTimeoutInterval);cartStore.checkoutTimeoutInterval=null}};var getCartItemToUse=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var cartStoreResetCartItems=function(){
|
|
492
|
+
// mark all items as not restricted
|
|
493
|
+
cartStore.items=cartStore.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));cartStore.restrictedItems=[]};var cartStoreUpdateItems=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n;var i=e.adjustments,a=e.cartItems,s=e.landedCostId,d=e.shouldInitSessionOnFailure,c=d===void 0?true:d;return __generator(this,(function(e){switch(e.label){case 0:
|
|
494
|
+
// Update adjustments and items
|
|
495
|
+
cartStore.adjustments=i;cartStore.items=getCartItemToUse(a);r=(t=a.find(Boolean))===null||t===void 0?void 0:t.currencyCode;o=a.reduce((function(e,t){return e+t.amount*t.quantity}),0);n=i.reduce((function(e,t){return e+t.amount}),0);if(!r||!o){
|
|
496
|
+
// do nothing if we can't get currency or total
|
|
497
|
+
return[2/*return*/]}cartStore.currency=r;
|
|
498
|
+
// set loading state here because this is the first load checkout session when we already have checkout session id stored
|
|
499
|
+
stripeStore.isFetchingSession=true;return[4/*yield*/,cartStoreReCalculateTotal({adjustmentsAmount:n,cartId:window.Zonos.cartId,currency:r,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:s,shouldInitSessionOnFailure:c})];case 1:e.sent();stripeStore.isFetchingSession=false;return[2/*return*/]}}))}))};var cartStoreResetSelectedShippingOption=function(){cartStore.selectedShippingOption=null;cartStore.isSelectedShippingAboveDeminimis=false;cartStore.isSelectedShippingGuarantee=false;cartStore.selectedShippingOptionTransitTime="";cartStore.dutiesTaxesFees=0;cartStore.dutiesTaxesFeesEstimate=0;cartStore.shipping=0;
|
|
500
|
+
// reset total to subtotal
|
|
501
|
+
cartStore.total=cartStore.subtotal};var cartStorePreviousStep=function(){if(cartStore.step==="shipping"){cartStore.step="customer-info";
|
|
502
|
+
// set shipping step to done
|
|
503
|
+
cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{"customer-info":Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:false})})}else if(cartStore.step==="payment"){cartStore.step="shipping";
|
|
504
|
+
// set shipping step to done
|
|
505
|
+
cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{shipping:Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:false})})}else if(cartStore.step==="finish"){cartStore.step="payment";
|
|
506
|
+
// set shipping step to done
|
|
507
|
+
cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{payment:Object.assign(Object.assign({},cartStore.tabItems.payment),{isDone:false})})}};var cartStoreNextStep=function(){if(cartStore.step==="customer-info"){cartStore.step="shipping";
|
|
508
|
+
// set customer-info step to done
|
|
509
|
+
cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{"customer-info":Object.assign(Object.assign({},cartStore.tabItems["customer-info"]),{isDone:true})})}else if(cartStore.step==="shipping"){cartStore.step="payment";
|
|
510
|
+
// set shipping step to done
|
|
511
|
+
cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{shipping:Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:true})})}else if(cartStore.step==="payment"){cartStore.step="finish"}};var cartStoreResetTabItems=function(){cartStore.step="customer-info";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{"customer-info":Object.assign(Object.assign({},cartStore.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},cartStore.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:false})});cartStoreResetSelectedShippingOption()};var cartStoreUpdateStoreCreditImmediate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d;return __generator(this,(function(c){switch(c.label){case 0:if(!storageStore.checkoutSessionId){log("Could not update store credit without checkout session id","info");return[2/*return*/]}r=cartStore.selectedLandedCost;o=cartStore.currency||((e=cartStore.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"";n=cartStore.adjustments.reduce((function(e,t){return e+t.amount}),0);i=cartStore.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);return[4/*yield*/,stripeStoreUpdateCheckoutSession({adjustmentsAmount:n,cartId:window.Zonos.cartId,currency:o,id:storageStore.checkoutSessionId,itemsAmount:i,landedCostId:r===null||r===void 0?void 0:r.landedCostId,presentmentCountryCode:localizationStore.selectedCountryCode,storeCreditApplication:storeCreditStoreGetInput()})];case 1:a=c.sent(),s=a.errors,d=a.json;if(s.length>0||!d){logError("Error updating checkout session with store credit");return[2/*return*/]}
|
|
512
|
+
// Apply updated subtotals from the response
|
|
513
|
+
cartStoreApplySubtotals({method:((t=d.checkoutSessionUpdate.landedCost)===null||t===void 0?void 0:t.method)||"DDP",subtotals:d.checkoutSessionUpdate.subtotals});cartStoreSetCheckoutSession(d.checkoutSessionUpdate);return[2/*return*/]}}))}))};
|
|
514
|
+
/**
|
|
515
|
+
* Update the checkout session with the current store credit selection.
|
|
516
|
+
* Debounced to prevent multiple rapid requests when store changes cascade.
|
|
517
|
+
*/var cartStoreUpdateStoreCredit=function(){if(storeCreditUpdateTimeout){clearTimeout(storeCreditUpdateTimeout)}storeCreditUpdateTimeout=setTimeout((function(){storeCreditUpdateTimeout=null;void cartStoreUpdateStoreCreditImmediate()}),300)};export{sortServiceLevelOptionsByAmount as $,storeCreditStoreApplyCredit as A,storeCreditStoreCoversFullAmount as B,validateCheckoutSession as C,storeCreditStoreCreateOrder as D,stripeStoreConfirmPayment as E,stripeStoreHandleInventoryRefund as F,policyConsentStore as G,stripeStoreReset as H,cartStoreOnChange as I,stripeStoreOnChange as J,storeCreditStoreGetEffectiveAmount as K,cartStoreHasOneEligibleItem as L,isEuDapRemittance as M,stripeStoreApplyPromoCode as N,stripeStoreRemovePromoCode as O,stripeStoreResetPromoCode as P,stripeStoreMessageBasedOnStatus as Q,storeCreditStore as R,storeCreditStoreReset as S,stripeStoreRecordPolicyConsent as T,extractName as U,stripeStoreTranslateAddressToLatin as V,getCountryField as W,stripeStoreAsyncAddressUpdate as X,cartStoreUpdateSelectedShippingOption as Y,cartStoreGetShippingTransitInfo as Z,cartStoreGetMethod as _,stripeStoreSaveDomesticShippingSession as a,stripeStoreBuildAddressForPartyCreate as a0,getEnabledPolicies as a1,storeCreditStoreSetEnabled as a2,storeCreditStoreSetUseFullBalance as a3,cartStoreUpdateStoreCredit as a4,storeCreditStoreSetAmount as a5,storeCreditStoreRefreshBalance as a6,stripeStore as b,stripeStoreRetrievePayment as c,cartStore as d,cartStoreUpdateItems as e,cartStoreReset as f,getCheckoutSession as g,cartStoreResetTabItems as h,initStripeElements as i,cartStoreClearCheckoutInterval as j,stripeStoreInitCheckoutSession as k,stripeStoreGetPaymentIntent as l,cartStoreIsOrderModificationPaymentOnlySession as m,stripeStoreHandleInventoryCheck as n,cartStoreStartCheckoutInterval as o,policyConsentStoreReset as p,getCheckoutSessionBody as q,cartStoreUpdateToErrorState as r,stripeStoreGetDomesticShippingSession as s,trackConversionEvent as t,stripeStoreCleanupDomesticShippingSession as u,cartStoreSetCheckoutSession as v,stripeStorePrefetchLandedCost as w,cartStoreNextStep as x,isPolicyConsentRequired as y,stripeStoreUpdateCheckoutSessionBaseCurrency as z};
|