@zonos/elements 1.3.248 → 1.3.250
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart-28310848.js → cart-fcd1359c.js} +321 -22
- package/dist/cjs/{cleanHtmlMarkdown-577d0a77.js → cleanHtmlMarkdown-31da84b7.js} +9 -7
- package/dist/cjs/{debounce-815d1517.js → debounce-0c75ba33.js} +1 -1
- package/dist/cjs/{getBorderRadius-2ef1170d.js → getBorderRadius-27a74844.js} +1 -1
- package/dist/cjs/{getContrastColor-30848800.js → getContrastColor-cc087c53.js} +2 -2
- package/dist/cjs/{hasInclusivePrice-134b0250.js → hasInclusivePrice-745a8f29.js} +1 -1
- package/dist/cjs/index-b1f95d96.js +4065 -0
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{invoice-2e8e5879.js → invoice-f040e147.js} +3 -3
- package/dist/cjs/{isCollectMobileTablet-bd0f4556.js → isCollectMobileTablet-cf92852e.js} +3 -3
- package/dist/cjs/{isContrastColor-09f5924a.js → isContrastColor-d1936a5c.js} +1 -1
- package/dist/cjs/{isDarkColor-878e600e.js → isDarkColor-a68abf7a.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{localization-00e73920.js → localization-523b793a.js} +661 -1
- package/dist/cjs/{paypal-3019ae94.js → paypal-8c98c0a1.js} +79 -21
- package/dist/cjs/{placeTestOrder-b0369cfd.js → placeTestOrder-9b1e09f0.js} +2 -2
- package/dist/cjs/{renderCheckoutCurrency-9e919b9f.js → renderCheckoutCurrency-94b6e51d.js} +2 -2
- package/dist/cjs/{renderFallback-78b54537.js → renderFallback-bc20ee20.js} +1 -1
- package/dist/cjs/{submitGtag-a50ab32e.js → submitGtag-cb4fb332.js} +1 -1
- package/dist/cjs/{throttle-7dd64984.js → throttle-ff483793.js} +2 -2
- package/dist/cjs/{updateCheckoutSessionAttributes-3a1db9de.js → updateCheckoutSessionAttributes-8be63b63.js} +1 -1
- package/dist/cjs/{zonos-address-display_9.cjs.entry.js → zonos-address-display_8.cjs.entry.js} +1294 -1664
- package/dist/cjs/zonos-address_4.cjs.entry.js +8 -8
- package/dist/cjs/zonos-badge.cjs.entry.js +2 -2
- package/dist/cjs/zonos-banner.cjs.entry.js +2 -2
- package/dist/cjs/zonos-button_3.cjs.entry.js +5 -5
- package/dist/cjs/zonos-card_5.cjs.entry.js +9 -9
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +84 -30
- package/dist/cjs/zonos-checkbox_2.cjs.entry.js +113 -0
- package/dist/cjs/zonos-checkout.cjs.entry.js +60 -11
- package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +7 -7
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +13 -13
- package/dist/cjs/zonos-collect.cjs.entry.js +11 -11
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +7 -7
- package/dist/cjs/zonos-country-flag.cjs.entry.js +3 -3
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +4 -4
- package/dist/cjs/zonos-elements.cjs.js +30 -3
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +4 -4
- package/dist/cjs/zonos-hello.cjs.entry.js +4 -4
- package/dist/cjs/zonos-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +9 -9
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +13 -13
- package/dist/cjs/zonos-invoice.cjs.entry.js +10 -10
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-link.cjs.entry.js +1 -1
- package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +6 -6
- package/dist/cjs/zonos-store-credit.cjs.entry.js +113 -0
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-text.cjs.entry.js +2 -2
- package/dist/cjs/zonos-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
- package/dist/cjs/{zonosStore-37a4b4f4.js → zonosStore-f5a61112.js} +110 -25
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +49 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +18 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/assets/StoreCreditIcon.svg +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/zonos-store-credit.css +139 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/zonos-store-credit.js +137 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +52 -1
- package/dist/collection/components/common/zonos-button/zonos-button.css +3 -1
- package/dist/collection/components/common/zonos-input/zonos-input.css +3 -1
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.css +3 -1
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +1 -1
- package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.css +3 -1
- package/dist/collection/components/main/zonos-controller.js +1 -1
- package/dist/collection/components/store/checkout/cart.js +62 -4
- package/dist/collection/components/store/checkout/paypal.js +28 -0
- package/dist/collection/components/store/checkout/storeCredit.js +237 -0
- package/dist/collection/components/store/checkout/stripe.js +2 -1
- package/dist/collection/components/store/translationStore/strings.arabic.js +33 -0
- package/dist/collection/components/store/translationStore/strings.base.js +33 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +33 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +33 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +33 -0
- package/dist/collection/components/store/translationStore/strings.french.js +33 -0
- package/dist/collection/components/store/translationStore/strings.german.js +33 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +33 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +33 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +33 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +33 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +33 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +33 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +33 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +33 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +33 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +33 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +33 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +33 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +33 -0
- package/dist/collection/types/generated/graphql.internal.types.js +589 -0
- package/dist/esm/{cart-ba8f3890.js → cart-6e465f7b.js} +311 -23
- package/dist/esm/{cleanHtmlMarkdown-b5b18743.js → cleanHtmlMarkdown-5f7856f2.js} +9 -7
- package/dist/esm/{debounce-c4785346.js → debounce-efc0e473.js} +1 -1
- package/dist/esm/{getBorderRadius-877f6389.js → getBorderRadius-c21a42e5.js} +1 -1
- package/dist/esm/{getContrastColor-28c18704.js → getContrastColor-98f0d1d5.js} +2 -2
- package/dist/esm/{hasInclusivePrice-6fcc712f.js → hasInclusivePrice-c49d384d.js} +1 -1
- package/dist/esm/index-cfd394c8.js +4028 -0
- package/dist/esm/index.js +7 -7
- package/dist/esm/{invoice-055bb6e5.js → invoice-d416ba65.js} +3 -3
- package/dist/esm/{isCollectMobileTablet-797cea8b.js → isCollectMobileTablet-48040572.js} +3 -3
- package/dist/esm/{isContrastColor-69778cea.js → isContrastColor-c17e83c9.js} +1 -1
- package/dist/esm/{isDarkColor-9ddd90cc.js → isDarkColor-3537021b.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{localization-853b48a9.js → localization-f4a7fb5a.js} +661 -1
- package/dist/esm/{paypal-8d8518c0.js → paypal-6af6b978.js} +79 -21
- package/dist/esm/{placeTestOrder-0a74923e.js → placeTestOrder-d19ac166.js} +2 -2
- package/dist/esm/{renderCheckoutCurrency-bd059ecf.js → renderCheckoutCurrency-c8aa8e7e.js} +2 -2
- package/dist/esm/{renderFallback-3f010b48.js → renderFallback-b250f4e9.js} +1 -1
- package/dist/esm/{submitGtag-89d6e9cb.js → submitGtag-13de9f1f.js} +1 -1
- package/dist/esm/{throttle-ce2432ab.js → throttle-0504ba2c.js} +2 -2
- package/dist/esm/{updateCheckoutSessionAttributes-047a6cd4.js → updateCheckoutSessionAttributes-b9f7e982.js} +1 -1
- package/dist/esm/{zonos-address-display_9.entry.js → zonos-address-display_8.entry.js} +1295 -1664
- package/dist/esm/zonos-address_4.entry.js +8 -8
- package/dist/esm/zonos-badge.entry.js +2 -2
- package/dist/esm/zonos-banner.entry.js +2 -2
- package/dist/esm/zonos-button_3.entry.js +5 -5
- package/dist/esm/zonos-card_5.entry.js +9 -9
- package/dist/esm/zonos-cart-items_12.entry.js +84 -30
- package/dist/esm/zonos-checkbox_2.entry.js +108 -0
- package/dist/esm/zonos-checkout.entry.js +60 -11
- package/dist/esm/zonos-collapse.entry.js +2 -2
- package/dist/esm/zonos-collect-cart-items_3.entry.js +7 -7
- package/dist/esm/zonos-collect-finish_6.entry.js +13 -13
- package/dist/esm/zonos-collect.entry.js +11 -11
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +7 -7
- package/dist/esm/zonos-country-flag.entry.js +3 -3
- package/dist/esm/zonos-country-select_4.entry.js +4 -4
- package/dist/esm/zonos-elements.js +31 -4
- package/dist/esm/zonos-hello-dialog.entry.js +4 -4
- package/dist/esm/zonos-hello.entry.js +4 -4
- package/dist/esm/zonos-input.entry.js +4 -4
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +9 -9
- package/dist/esm/zonos-invoice-finish_5.entry.js +13 -13
- package/dist/esm/zonos-invoice.entry.js +10 -10
- package/dist/esm/zonos-language-select_2.entry.js +3 -3
- package/dist/esm/zonos-link.entry.js +1 -1
- package/dist/esm/zonos-logo.entry.js +2 -2
- package/dist/esm/zonos-shipping-rich-radio.entry.js +6 -6
- package/dist/esm/zonos-store-credit.entry.js +109 -0
- package/dist/esm/zonos-stripe-input.entry.js +4 -4
- package/dist/esm/zonos-text.entry.js +2 -2
- package/dist/esm/zonos-tooltip.entry.js +1 -1
- package/dist/esm/zonos-v-stack.entry.js +2 -2
- package/dist/esm/{zonosStore-b434e436.js → zonosStore-5242a58d.js} +110 -25
- package/dist/esm-es5/cart-6e465f7b.js +1 -0
- package/dist/esm-es5/cleanHtmlMarkdown-5f7856f2.js +1 -0
- package/dist/esm-es5/{debounce-c4785346.js → debounce-efc0e473.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-877f6389.js → getBorderRadius-c21a42e5.js} +1 -1
- package/dist/esm-es5/{getContrastColor-28c18704.js → getContrastColor-98f0d1d5.js} +1 -1
- package/dist/esm-es5/hasInclusivePrice-c49d384d.js +1 -0
- package/dist/esm-es5/index-cfd394c8.js +13 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{invoice-055bb6e5.js → invoice-d416ba65.js} +1 -1
- package/dist/esm-es5/{isCollectMobileTablet-797cea8b.js → isCollectMobileTablet-48040572.js} +1 -1
- package/dist/esm-es5/{isContrastColor-69778cea.js → isContrastColor-c17e83c9.js} +1 -1
- package/dist/esm-es5/{isDarkColor-9ddd90cc.js → isDarkColor-3537021b.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/localization-f4a7fb5a.js +1 -0
- package/dist/esm-es5/paypal-6af6b978.js +17 -0
- package/dist/esm-es5/{placeTestOrder-0a74923e.js → placeTestOrder-d19ac166.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-bd059ecf.js → renderCheckoutCurrency-c8aa8e7e.js} +1 -1
- package/dist/esm-es5/{renderFallback-3f010b48.js → renderFallback-b250f4e9.js} +1 -1
- package/dist/esm-es5/{submitGtag-89d6e9cb.js → submitGtag-13de9f1f.js} +1 -1
- package/dist/esm-es5/{throttle-ce2432ab.js → throttle-0504ba2c.js} +1 -1
- package/dist/esm-es5/{updateCheckoutSessionAttributes-047a6cd4.js → updateCheckoutSessionAttributes-b9f7e982.js} +1 -1
- package/dist/esm-es5/zonos-address-display_8.entry.js +1 -0
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkbox_2.entry.js +1 -0
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +1 -1
- package/dist/esm-es5/zonos-component.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-link.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-store-credit.entry.js +1 -0
- package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/esm-es5/zonosStore-5242a58d.js +1 -0
- package/dist/scripts/index.d.ts +60 -3
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +1 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/zonos-store-credit.d.ts +17 -0
- package/dist/types/components/store/checkout/cart.d.ts +8 -1
- package/dist/types/components/store/checkout/storeCredit.d.ts +111 -0
- package/dist/types/components/store/checkout/stripe.d.ts +1 -1
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +33 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +33 -0
- package/dist/types/components.d.ts +21 -0
- package/dist/types/environment.d.ts +2 -2
- package/dist/types/types/checkout/api/CheckoutSession.d.ts +9 -1
- package/dist/types/types/generated/graphql.internal.types.d.ts +713 -4
- package/dist/types/types/generated/graphql.internal.types.ts +956 -4
- package/dist/types/types/global.d.ts +2 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-058f6124.js +1 -0
- package/dist/zonos-elements/{p-7aa50ef2.entry.js → p-0d18d94b.entry.js} +1 -1
- package/dist/zonos-elements/{p-c01f86b4.entry.js → p-12459b59.entry.js} +1 -1
- package/dist/zonos-elements/{p-de8899bc.js → p-13ed3789.js} +1 -1
- package/dist/zonos-elements/{p-8205ae87.system.entry.js → p-17fbfda0.system.entry.js} +1 -1
- package/dist/zonos-elements/p-18d411c3.system.entry.js +1 -0
- package/dist/zonos-elements/{p-69b9b711.entry.js → p-1b56814d.entry.js} +1 -1
- package/dist/zonos-elements/p-1b8771bb.js +1 -0
- package/dist/zonos-elements/{p-eea7ac64.js → p-1e6509d7.js} +1 -1
- package/dist/zonos-elements/{p-c7311ce5.system.entry.js → p-1f63615f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5062dcf3.system.entry.js → p-234f0339.system.entry.js} +1 -1
- package/dist/zonos-elements/p-2435f196.entry.js +1 -0
- package/dist/zonos-elements/p-26848428.entry.js +1 -0
- package/dist/zonos-elements/p-28d62fc8.system.entry.js +1 -0
- package/dist/zonos-elements/p-29b60bf3.system.js +1 -0
- package/dist/zonos-elements/{p-1c4d12f0.entry.js → p-2aa44601.entry.js} +1 -1
- package/dist/zonos-elements/p-2b7ef406.system.js +18 -0
- package/dist/zonos-elements/p-34d10122.js +1 -0
- package/dist/zonos-elements/{p-e17bbcee.entry.js → p-3827041d.entry.js} +1 -1
- package/dist/zonos-elements/{p-14c920b2.system.entry.js → p-38881641.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c6e3d747.system.js → p-3fbd9cc0.system.js} +1 -1
- package/dist/zonos-elements/p-45bd8072.system.js +1 -0
- package/dist/zonos-elements/{p-bc4bfa06.js → p-48228d76.js} +1 -1
- package/dist/zonos-elements/{p-9c49daa4.entry.js → p-4aefd668.entry.js} +1 -1
- package/dist/zonos-elements/p-4d5932ac.system.entry.js +1 -0
- package/dist/zonos-elements/{p-a359e0a2.system.entry.js → p-4e4fa1fb.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c36696f9.js → p-4f7d64f6.js} +1 -1
- package/dist/zonos-elements/p-53db5f85.system.js +1 -0
- package/dist/zonos-elements/{p-403b9fca.entry.js → p-59fe8416.entry.js} +1 -1
- package/dist/zonos-elements/{p-7b400b5f.system.entry.js → p-5ca50862.system.entry.js} +1 -1
- package/dist/zonos-elements/p-5dd86dd9.system.js +1 -0
- package/dist/zonos-elements/p-5f628e57.entry.js +1 -0
- package/dist/zonos-elements/{p-b54a95ea.system.entry.js → p-5fceccc3.system.entry.js} +1 -1
- package/dist/zonos-elements/p-64ad0854.entry.js +1 -0
- package/dist/zonos-elements/{p-942358eb.system.js → p-65892fa7.system.js} +1 -1
- package/dist/zonos-elements/{p-aa028d91.entry.js → p-66d72216.entry.js} +1 -1
- package/dist/zonos-elements/{p-58248f03.entry.js → p-66e1dc55.entry.js} +1 -1
- package/dist/zonos-elements/{p-57fa64d7.js → p-67897a0d.js} +1 -1
- package/dist/zonos-elements/{p-917f714c.system.entry.js → p-6f19845a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-291f7ccb.system.entry.js → p-7042c6da.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-232b0fb5.system.entry.js → p-70c8a47d.system.entry.js} +1 -1
- package/dist/zonos-elements/p-7261e245.system.js +13 -0
- package/dist/zonos-elements/p-741e07e1.system.entry.js +1 -0
- package/dist/zonos-elements/{p-3e67ca05.entry.js → p-7427dd1e.entry.js} +1 -1
- package/dist/zonos-elements/{p-23d497e3.system.js → p-7501c637.system.js} +1 -1
- package/dist/zonos-elements/p-77113201.system.js +1 -0
- package/dist/zonos-elements/{p-a12cb7ce.entry.js → p-77c0a02b.entry.js} +1 -1
- package/dist/zonos-elements/p-7d7ffb42.js +1 -0
- package/dist/zonos-elements/{p-1acf0a71.system.entry.js → p-85529818.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-cfb9b847.system.entry.js → p-87d89870.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-443e1f30.system.js → p-8c6624b6.system.js} +1 -1
- package/dist/zonos-elements/{p-57cee1b5.system.entry.js → p-8d5f928c.system.entry.js} +1 -1
- package/dist/zonos-elements/p-8f1ab25c.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5762e217.js → p-908f13ae.js} +1 -1
- package/dist/zonos-elements/{p-63a3d3b9.system.js → p-90b8c428.system.js} +1 -1
- package/dist/zonos-elements/{p-8f0f6449.entry.js → p-939ba2a5.entry.js} +1 -1
- package/dist/zonos-elements/p-9581bffb.js +1 -0
- package/dist/zonos-elements/p-959918fe.system.js +1 -0
- package/dist/zonos-elements/p-997b7eef.js +1 -0
- package/dist/zonos-elements/{p-0792688d.system.entry.js → p-9bc5e944.system.entry.js} +1 -1
- package/dist/zonos-elements/p-9c6917ab.system.js +1 -0
- package/dist/zonos-elements/{p-f8d56ba9.system.js → p-9d44fef6.system.js} +1 -1
- package/dist/zonos-elements/p-9d64783a.entry.js +1 -0
- package/dist/zonos-elements/{p-71a8d971.system.entry.js → p-9f49e35a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2f55895c.system.entry.js → p-a026b5ad.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-85e59f3a.system.entry.js → p-a1a3657e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c2f34b10.system.entry.js → p-a1b0e9a5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-fb9fb873.system.entry.js → p-a1c476d6.system.entry.js} +1 -1
- package/dist/zonos-elements/p-a6a401e5.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5edef7c3.system.js → p-ab25379f.system.js} +1 -1
- package/dist/zonos-elements/p-ac30b7a8.system.js +1 -0
- package/dist/zonos-elements/{p-37bb5f2d.entry.js → p-b004146f.entry.js} +1 -1
- package/dist/zonos-elements/{p-3908f78d.system.entry.js → p-b07da3e8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-71f10bf0.entry.js → p-b08bf843.entry.js} +1 -1
- package/dist/zonos-elements/p-b334c76c.entry.js +1 -0
- package/dist/zonos-elements/{p-69212d0f.entry.js → p-b9581a92.entry.js} +1 -1
- package/dist/zonos-elements/{p-84cf1a90.system.entry.js → p-bdaf94a4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-231baaf8.entry.js → p-c1ab70d2.entry.js} +1 -1
- package/dist/zonos-elements/p-c30a155e.js +1 -0
- package/dist/zonos-elements/{p-aedd3911.entry.js → p-c9d4eb42.entry.js} +1 -1
- package/dist/zonos-elements/{p-3e85b9f5.system.entry.js → p-cad67b10.system.entry.js} +1 -1
- package/dist/zonos-elements/p-cc78c9d4.js +17 -0
- package/dist/zonos-elements/p-ce75b047.js +2 -0
- package/dist/zonos-elements/{p-909e2bc3.system.js → p-d18a2b2c.system.js} +1 -1
- package/dist/zonos-elements/{p-83377e23.entry.js → p-d2301d8a.entry.js} +1 -1
- package/dist/zonos-elements/p-d46484aa.entry.js +1 -0
- package/dist/zonos-elements/{p-3972663a.system.entry.js → p-d634f954.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-14735e9a.system.entry.js → p-dbb3db89.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4592ae49.entry.js → p-ddcbea81.entry.js} +1 -1
- package/dist/zonos-elements/p-def2d465.js +1 -0
- package/dist/zonos-elements/p-df316670.system.js +1 -0
- package/dist/zonos-elements/p-e219d011.js +1 -0
- package/dist/zonos-elements/p-e331a235.js +1 -0
- package/dist/zonos-elements/p-e4d58bd7.js +1 -0
- package/dist/zonos-elements/{p-48475755.entry.js → p-e9ca4447.entry.js} +1 -1
- package/dist/zonos-elements/{p-6adfb3af.system.entry.js → p-ed61dedd.system.entry.js} +1 -1
- package/dist/zonos-elements/p-ee217693.entry.js +1 -0
- package/dist/zonos-elements/{p-ae16dda9.system.js → p-f0855df3.system.js} +1 -1
- package/dist/zonos-elements/p-f0938b51.system.entry.js +1 -0
- package/dist/zonos-elements/{p-d5b7d3c3.entry.js → p-f25e7f5a.entry.js} +1 -1
- package/dist/zonos-elements/{p-0ff93ca6.entry.js → p-f4cc124f.entry.js} +1 -1
- package/dist/zonos-elements/p-f830f800.js +1 -0
- package/dist/zonos-elements/p-fa0139c3.system.js +1 -0
- package/dist/zonos-elements/p-fa5767c3.system.js +1 -0
- package/dist/zonos-elements/{p-39fa55c7.entry.js → p-fbfaa4f9.entry.js} +1 -1
- package/dist/zonos-elements/p-fe6cc354.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.css +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/dist/zonos-elements/zonos-elements.js +1 -1
- package/package.json +70 -52
- package/dist/cjs/index-69fa8852.js +0 -1961
- package/dist/cjs/zonos-toggle.cjs.entry.js +0 -35
- package/dist/esm/index-0bbe9693.js +0 -1928
- package/dist/esm/zonos-toggle.entry.js +0 -31
- package/dist/esm-es5/cart-ba8f3890.js +0 -1
- package/dist/esm-es5/cleanHtmlMarkdown-b5b18743.js +0 -1
- package/dist/esm-es5/hasInclusivePrice-6fcc712f.js +0 -1
- package/dist/esm-es5/index-0bbe9693.js +0 -2
- package/dist/esm-es5/localization-853b48a9.js +0 -1
- package/dist/esm-es5/paypal-8d8518c0.js +0 -17
- package/dist/esm-es5/zonos-address-display_9.entry.js +0 -1
- package/dist/esm-es5/zonos-toggle.entry.js +0 -1
- package/dist/esm-es5/zonosStore-b434e436.js +0 -1
- package/dist/zonos-elements/p-002e45f9.system.js +0 -17
- package/dist/zonos-elements/p-01dada4e.js +0 -1
- package/dist/zonos-elements/p-09aabce0.js +0 -1
- package/dist/zonos-elements/p-0b7beb16.system.entry.js +0 -1
- package/dist/zonos-elements/p-0ef2a242.js +0 -1
- package/dist/zonos-elements/p-0f787f5d.entry.js +0 -1
- package/dist/zonos-elements/p-1dbeeab2.entry.js +0 -1
- package/dist/zonos-elements/p-1f894984.js +0 -1
- package/dist/zonos-elements/p-27f6930b.js +0 -1
- package/dist/zonos-elements/p-2c2a1339.system.entry.js +0 -1
- package/dist/zonos-elements/p-3bec13dd.system.js +0 -1
- package/dist/zonos-elements/p-41299ffb.js +0 -1
- package/dist/zonos-elements/p-43a22d85.entry.js +0 -1
- package/dist/zonos-elements/p-4ffbb0d6.system.js +0 -1
- package/dist/zonos-elements/p-64661dd1.js +0 -1
- package/dist/zonos-elements/p-719403e0.system.js +0 -1
- package/dist/zonos-elements/p-71d855b8.system.entry.js +0 -1
- package/dist/zonos-elements/p-72ff005c.entry.js +0 -1
- package/dist/zonos-elements/p-786d1c24.js +0 -1
- package/dist/zonos-elements/p-7dba5f23.system.js +0 -1
- package/dist/zonos-elements/p-866afec1.js +0 -1
- package/dist/zonos-elements/p-94c5fbfc.system.entry.js +0 -1
- package/dist/zonos-elements/p-989d3af9.system.js +0 -2
- package/dist/zonos-elements/p-9fa90292.system.entry.js +0 -1
- package/dist/zonos-elements/p-ab41bab5.js +0 -2
- package/dist/zonos-elements/p-abf38ed6.js +0 -1
- package/dist/zonos-elements/p-ae26aec5.system.js +0 -1
- package/dist/zonos-elements/p-af85846e.system.js +0 -1
- package/dist/zonos-elements/p-b2a0ab4a.js +0 -1
- package/dist/zonos-elements/p-b2ae8eb7.system.js +0 -1
- package/dist/zonos-elements/p-bf5e47e2.entry.js +0 -1
- package/dist/zonos-elements/p-c027a832.system.js +0 -1
- package/dist/zonos-elements/p-c1fb3a2d.entry.js +0 -1
- package/dist/zonos-elements/p-c2442878.system.js +0 -1
- package/dist/zonos-elements/p-d45285aa.system.js +0 -1
- package/dist/zonos-elements/p-dcf999d8.entry.js +0 -1
- package/dist/zonos-elements/p-e9e6bea7.system.entry.js +0 -1
- package/dist/zonos-elements/p-f6c2c743.entry.js +0 -1
- package/dist/zonos-elements/p-fc776473.js +0 -1
- package/dist/zonos-elements/p-fe06c9ea.js +0 -17
- package/dist/zonos-elements/p-fe96e239.system.js +0 -1
|
@@ -1,9 +1,252 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as storageStore, l as localizationStore, e as getOverridenZCountry, t as translate, f as filterValidTests, b as storageStoreSetEnabledVariantTestKeys } from './localization-
|
|
3
|
-
import { f as fallbackApiList, h as handleFetch, g as getIsTestMode, a as getIsStagingMode, s as sendErrorLog, l as logError, j as jsonParse } from './handleFetch-a844cac1.js';
|
|
1
|
+
import { c as createStore, z as zonosStore } from './zonosStore-5242a58d.js';
|
|
2
|
+
import { s as storageStore, l as localizationStore, e as getOverridenZCountry, t as translate, f as filterValidTests, b as storageStoreSetEnabledVariantTestKeys } from './localization-f4a7fb5a.js';
|
|
4
3
|
import { l as log, b as allLogs } from './VarianceTest-572cecf5.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { h as handleFetch, l as logError, f as fallbackApiList, g as getIsTestMode, a as getIsStagingMode, s as sendErrorLog, j as jsonParse } from './handleFetch-a844cac1.js';
|
|
5
|
+
import { i as isDarkColor } from './isDarkColor-3537021b.js';
|
|
6
|
+
import { g as getBorderRadius } from './getBorderRadius-c21a42e5.js';
|
|
7
|
+
|
|
8
|
+
const getCheckoutSession = async () => {
|
|
9
|
+
if (!storageStore.checkoutSessionId) {
|
|
10
|
+
return {
|
|
11
|
+
errors: [{ message: 'No checkout session id found' }],
|
|
12
|
+
json: null,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const searchParams = new URLSearchParams();
|
|
16
|
+
searchParams.set('checkoutSessionId', storageStore.checkoutSessionId);
|
|
17
|
+
const { errors, json } = await handleFetch(`/api/zonos-elements/get-checkout-session?${searchParams.toString()}`);
|
|
18
|
+
return { errors, json };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const { onChange: storeCreditStoreOnChange, reset: reset$2, state: storeCreditStore, } = createStore(() => ({
|
|
22
|
+
amountToApply: null,
|
|
23
|
+
appliedAmount: null,
|
|
24
|
+
availableBalance: null,
|
|
25
|
+
error: null,
|
|
26
|
+
isApplying: false,
|
|
27
|
+
isEnabled: false,
|
|
28
|
+
orderIdCreated: null,
|
|
29
|
+
remainingBalance: null,
|
|
30
|
+
useFullBalance: true,
|
|
31
|
+
}));
|
|
32
|
+
/**
|
|
33
|
+
* Reset store credit store to initial state
|
|
34
|
+
*/
|
|
35
|
+
const storeCreditStoreReset = () => {
|
|
36
|
+
reset$2();
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Set the available balance from the checkout session's customerProfile.storeCreditBalance
|
|
40
|
+
*/
|
|
41
|
+
const storeCreditStoreSetBalanceFromSession = (balance) => {
|
|
42
|
+
log('Store credit balance from session', 'info', balance);
|
|
43
|
+
storeCreditStore.availableBalance = balance;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Re-fetch the store credit balance from the checkout session.
|
|
47
|
+
* Called when the payment step loads to ensure the balance is fresh.
|
|
48
|
+
*/
|
|
49
|
+
const storeCreditStoreRefreshBalance = async () => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const { errors, json } = await getCheckoutSession();
|
|
52
|
+
if (errors.length || !json) {
|
|
53
|
+
logError('Failed to refresh store credit balance');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const balance = (_b = (_a = json.checkoutSession.customerProfile) === null || _a === void 0 ? void 0 : _a.storeCreditBalance) !== null && _b !== void 0 ? _b : null;
|
|
57
|
+
storeCreditStoreSetBalanceFromSession(balance);
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Apply store credit to the checkout session.
|
|
61
|
+
* This must be called BEFORE payment confirmation.
|
|
62
|
+
* The amount/mode are already set via checkout session update with storeCreditApplication.
|
|
63
|
+
*/
|
|
64
|
+
const storeCreditStoreApplyCredit = async () => {
|
|
65
|
+
var _a;
|
|
66
|
+
const checkoutSessionId = storageStore.checkoutSessionId;
|
|
67
|
+
if (!checkoutSessionId) {
|
|
68
|
+
const error = 'No checkout session found';
|
|
69
|
+
logError(error);
|
|
70
|
+
storeCreditStore.error = error;
|
|
71
|
+
return { error, success: false };
|
|
72
|
+
}
|
|
73
|
+
log('Applying store credit', 'info', { checkoutSessionId });
|
|
74
|
+
storeCreditStore.isApplying = true;
|
|
75
|
+
storeCreditStore.error = null;
|
|
76
|
+
try {
|
|
77
|
+
const { errors, json } = await handleFetch('/api/zonos-elements/store-credit/apply', {
|
|
78
|
+
body: {
|
|
79
|
+
checkoutSessionId,
|
|
80
|
+
},
|
|
81
|
+
method: 'POST',
|
|
82
|
+
});
|
|
83
|
+
if (errors.length > 0 || !json) {
|
|
84
|
+
const errorMessage = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) || 'Failed to apply store credit';
|
|
85
|
+
logError(errorMessage);
|
|
86
|
+
storeCreditStore.error = errorMessage;
|
|
87
|
+
storeCreditStore.isApplying = false;
|
|
88
|
+
return { error: errorMessage, success: false };
|
|
89
|
+
}
|
|
90
|
+
storeCreditStore.appliedAmount = json.amountApplied;
|
|
91
|
+
storeCreditStore.remainingBalance = json.remainingBalance;
|
|
92
|
+
storeCreditStore.isApplying = false;
|
|
93
|
+
log('Store credit applied', 'info', {
|
|
94
|
+
amountApplied: json.amountApplied,
|
|
95
|
+
remainingBalance: json.remainingBalance,
|
|
96
|
+
});
|
|
97
|
+
return { error: null, success: true };
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
const errorMessage = e instanceof Error ? e.message : 'Failed to apply store credit';
|
|
101
|
+
logError(errorMessage);
|
|
102
|
+
storeCreditStore.error = errorMessage;
|
|
103
|
+
storeCreditStore.isApplying = false;
|
|
104
|
+
return { error: errorMessage, success: false };
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Enable or disable store credit usage.
|
|
109
|
+
* When enabling, defaults to full balance mode.
|
|
110
|
+
* When disabling, clears the amount.
|
|
111
|
+
*/
|
|
112
|
+
const storeCreditStoreSetEnabled = (enabled) => {
|
|
113
|
+
storeCreditStore.isEnabled = enabled;
|
|
114
|
+
storeCreditStore.error = null;
|
|
115
|
+
if (!enabled) {
|
|
116
|
+
storeCreditStore.amountToApply = null;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Set the amount of store credit to apply
|
|
121
|
+
* Validates against available balance and cart total
|
|
122
|
+
*/
|
|
123
|
+
const storeCreditStoreSetAmount = (amount) => {
|
|
124
|
+
if (amount === null) {
|
|
125
|
+
storeCreditStore.amountToApply = null;
|
|
126
|
+
storeCreditStore.error = null;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
// Validate amount
|
|
130
|
+
if (amount <= 0) {
|
|
131
|
+
storeCreditStore.error = 'Amount must be greater than zero';
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (storeCreditStore.availableBalance !== null &&
|
|
135
|
+
amount > storeCreditStore.availableBalance) {
|
|
136
|
+
storeCreditStore.error = 'Amount exceeds available balance';
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const orderTotal = cartStore.total + (cartStore.storeCredit || 0);
|
|
140
|
+
if (amount > orderTotal) {
|
|
141
|
+
storeCreditStore.error = 'Amount exceeds order total';
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
storeCreditStore.error = null;
|
|
145
|
+
storeCreditStore.amountToApply = amount;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Toggle whether to use full balance or custom amount.
|
|
149
|
+
* When switching to custom mode, clears the applied amount so the user
|
|
150
|
+
* must explicitly apply via the Apply button.
|
|
151
|
+
*/
|
|
152
|
+
const storeCreditStoreSetUseFullBalance = (useFullBalance) => {
|
|
153
|
+
storeCreditStore.useFullBalance = useFullBalance;
|
|
154
|
+
storeCreditStore.error = null;
|
|
155
|
+
if (useFullBalance && storeCreditStore.availableBalance !== null) {
|
|
156
|
+
const orderTotal = cartStore.total + (cartStore.storeCredit || 0);
|
|
157
|
+
const maxAmount = Math.min(storeCreditStore.availableBalance, orderTotal);
|
|
158
|
+
storeCreditStore.amountToApply = maxAmount;
|
|
159
|
+
}
|
|
160
|
+
else if (!useFullBalance) {
|
|
161
|
+
storeCreditStore.amountToApply = null;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Get the storeCreditApplication input for checkout session update.
|
|
166
|
+
* Sends mode: 'NONE' when store credit is not being used to clear any
|
|
167
|
+
* previously applied store credit on the backend.
|
|
168
|
+
*/
|
|
169
|
+
const storeCreditStoreGetInput = () => {
|
|
170
|
+
if (!storeCreditStore.isEnabled || storeCreditStore.amountToApply === null) {
|
|
171
|
+
return { mode: 'NONE' };
|
|
172
|
+
}
|
|
173
|
+
if (storeCreditStore.useFullBalance) {
|
|
174
|
+
return { mode: 'FULL' };
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
amount: storeCreditStore.amountToApply,
|
|
178
|
+
mode: 'PARTIAL',
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Get the effective amount to apply based on settings
|
|
183
|
+
*/
|
|
184
|
+
const storeCreditStoreGetEffectiveAmount = () => {
|
|
185
|
+
if (!storeCreditStore.isEnabled ||
|
|
186
|
+
storeCreditStore.availableBalance === null) {
|
|
187
|
+
return 0;
|
|
188
|
+
}
|
|
189
|
+
if (storeCreditStore.useFullBalance) {
|
|
190
|
+
return Math.min(storeCreditStore.availableBalance, cartStore.total + (cartStore.storeCredit || 0));
|
|
191
|
+
}
|
|
192
|
+
return storeCreditStore.amountToApply || 0;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Check whether the effective store credit amount covers the full order total.
|
|
196
|
+
* When true, the Stripe/PayPal payment flow should be skipped and
|
|
197
|
+
* `storeCreditStoreCreateOrder` should be used instead.
|
|
198
|
+
*
|
|
199
|
+
* Relies on the backend's computed `cartStore.total` (remaining amount to pay
|
|
200
|
+
* after store credit) rather than a client-side comparison, which avoids issues
|
|
201
|
+
* with currency mismatches or rounding.
|
|
202
|
+
*/
|
|
203
|
+
const storeCreditStoreCoversFullAmount = () => {
|
|
204
|
+
// Only consider full coverage after the backend has confirmed store credit
|
|
205
|
+
// was applied (cartStore.storeCredit > 0) and the remaining total is 0.
|
|
206
|
+
return (storeCreditStore.amountToApply !== null &&
|
|
207
|
+
storeCreditStore.amountToApply > 0 &&
|
|
208
|
+
cartStore.storeCredit > 0 &&
|
|
209
|
+
cartStore.total <= 0);
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Create an order paid entirely by store credit.
|
|
213
|
+
* Should only be called when `storeCreditStoreCoversFullAmount()` is true.
|
|
214
|
+
*/
|
|
215
|
+
const storeCreditStoreCreateOrder = async () => {
|
|
216
|
+
var _a, _b, _c;
|
|
217
|
+
const checkoutSessionId = storageStore.checkoutSessionId;
|
|
218
|
+
if (!checkoutSessionId) {
|
|
219
|
+
const error = 'No checkout session found';
|
|
220
|
+
logError(error);
|
|
221
|
+
storeCreditStore.error = error;
|
|
222
|
+
return { error, orderId: null, success: false };
|
|
223
|
+
}
|
|
224
|
+
log('Creating store credit order', 'info', { checkoutSessionId });
|
|
225
|
+
try {
|
|
226
|
+
const { errors, json } = await handleFetch('/api/zonos-elements/store-credit/order-create', {
|
|
227
|
+
body: {
|
|
228
|
+
checkoutSessionId,
|
|
229
|
+
},
|
|
230
|
+
method: 'POST',
|
|
231
|
+
});
|
|
232
|
+
if (errors.length > 0 || !json) {
|
|
233
|
+
const errorMessage = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) || 'Failed to create store credit order';
|
|
234
|
+
logError(errorMessage);
|
|
235
|
+
storeCreditStore.error = errorMessage;
|
|
236
|
+
return { error: errorMessage, orderId: null, success: false };
|
|
237
|
+
}
|
|
238
|
+
const orderId = ((_c = (_b = json.checkoutSessionStoreCreditOrderCreate) === null || _b === void 0 ? void 0 : _b.order) === null || _c === void 0 ? void 0 : _c.id) || null;
|
|
239
|
+
storeCreditStore.orderIdCreated = orderId;
|
|
240
|
+
log('Store credit order created', 'info', { orderId });
|
|
241
|
+
return { error: null, orderId, success: true };
|
|
242
|
+
}
|
|
243
|
+
catch (e) {
|
|
244
|
+
const errorMessage = e instanceof Error ? e.message : 'Failed to create store credit order';
|
|
245
|
+
logError(errorMessage);
|
|
246
|
+
storeCreditStore.error = errorMessage;
|
|
247
|
+
return { error: errorMessage, orderId: null, success: false };
|
|
248
|
+
}
|
|
249
|
+
};
|
|
7
250
|
|
|
8
251
|
/**
|
|
9
252
|
* Extract first name and last name from the name string
|
|
@@ -511,19 +754,6 @@ const sortServiceLevelOptionsByAmount = (serviceLevels) => {
|
|
|
511
754
|
return sortedServiceLevels;
|
|
512
755
|
};
|
|
513
756
|
|
|
514
|
-
const getCheckoutSession = async () => {
|
|
515
|
-
if (!storageStore.checkoutSessionId) {
|
|
516
|
-
return {
|
|
517
|
-
errors: [{ message: 'No checkout session id found' }],
|
|
518
|
-
json: null,
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
const searchParams = new URLSearchParams();
|
|
522
|
-
searchParams.set('checkoutSessionId', storageStore.checkoutSessionId);
|
|
523
|
-
const { errors, json } = await handleFetch(`/api/zonos-elements/get-checkout-session?${searchParams.toString()}`);
|
|
524
|
-
return { errors, json };
|
|
525
|
-
};
|
|
526
|
-
|
|
527
757
|
/**
|
|
528
758
|
* Validate checkout session before confirming payment
|
|
529
759
|
*/
|
|
@@ -1636,7 +1866,7 @@ const stripeStoreUpdateCheckoutSessionBaseCurrency = async () => {
|
|
|
1636
1866
|
/**
|
|
1637
1867
|
* Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
|
|
1638
1868
|
*/
|
|
1639
|
-
const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
|
|
1869
|
+
const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, currency, id, itemsAmount, landedCostId, presentmentCountryCode, storeCreditApplication, }) => {
|
|
1640
1870
|
const varianceTestInput = storageStore.enabledVariantTestKeys || [];
|
|
1641
1871
|
// No need to set loading state here because this function will be called under the hood to update
|
|
1642
1872
|
// landed cost id for the section.
|
|
@@ -1659,6 +1889,7 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
|
|
|
1659
1889
|
presentmentCountryCode,
|
|
1660
1890
|
shipToPartyId: stripeStore.partyShippingId,
|
|
1661
1891
|
skipPaymentIntent: stripeStore.skipPaymentIntent,
|
|
1892
|
+
storeCreditApplication,
|
|
1662
1893
|
varianceTestInput,
|
|
1663
1894
|
},
|
|
1664
1895
|
method: 'POST',
|
|
@@ -1835,6 +2066,7 @@ const { onChange: cartStoreOnChange, reset, state: cartStore, } = createStore(()
|
|
|
1835
2066
|
shippingData: null,
|
|
1836
2067
|
shouldHideDiscountInput: false,
|
|
1837
2068
|
step: 'customer-info',
|
|
2069
|
+
storeCredit: 0,
|
|
1838
2070
|
subtotal: 0,
|
|
1839
2071
|
tabItems: {
|
|
1840
2072
|
'customer-info': {
|
|
@@ -1923,8 +2155,16 @@ const cartStoreCheckItemRestrictions = (itemsWorkflow) => {
|
|
|
1923
2155
|
restrictedItems: mappedRestrictedItems,
|
|
1924
2156
|
};
|
|
1925
2157
|
};
|
|
2158
|
+
let storeCreditUpdateTimeout = null;
|
|
1926
2159
|
const cartStoreReset = () => {
|
|
1927
2160
|
storageStore.checkoutSessionId = null;
|
|
2161
|
+
// clear pending store credit debounce timer
|
|
2162
|
+
if (storeCreditUpdateTimeout) {
|
|
2163
|
+
clearTimeout(storeCreditUpdateTimeout);
|
|
2164
|
+
storeCreditUpdateTimeout = null;
|
|
2165
|
+
}
|
|
2166
|
+
// reset store credit store
|
|
2167
|
+
storeCreditStoreReset();
|
|
1928
2168
|
// reset cart store
|
|
1929
2169
|
reset();
|
|
1930
2170
|
};
|
|
@@ -1938,11 +2178,13 @@ const cartStoreUpdateToErrorState = ({ messages, title, }) => {
|
|
|
1938
2178
|
};
|
|
1939
2179
|
};
|
|
1940
2180
|
const cartStoreApplySubtotals = ({ dutiesTaxesFeesEstimate, method, subtotals, }) => {
|
|
2181
|
+
var _a;
|
|
1941
2182
|
// update exchange rate so we can use it to display cart items
|
|
1942
2183
|
cartStore.exchangeRate = subtotals.exchangeRate;
|
|
1943
2184
|
cartStore.adjustmentTotal = subtotals.adjustments;
|
|
1944
2185
|
cartStore.dutiesTaxesFees =
|
|
1945
2186
|
method === 'DAP' ? null : subtotals.landedCostTotal;
|
|
2187
|
+
cartStore.storeCredit = (_a = subtotals.storeCredit) !== null && _a !== void 0 ? _a : 0;
|
|
1946
2188
|
cartStore.subtotal = subtotals.items;
|
|
1947
2189
|
cartStore.total = subtotals.total;
|
|
1948
2190
|
cartStore.currency = subtotals.presentmentCurrencyCode;
|
|
@@ -1959,13 +2201,15 @@ const cartStoreHasOneEligibleItem = () => {
|
|
|
1959
2201
|
return !!checkItems.find(item => !item.isRestricted);
|
|
1960
2202
|
};
|
|
1961
2203
|
const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
1962
|
-
var _a, _b, _c, _d, _e;
|
|
2204
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1963
2205
|
// update stripe store with updated information
|
|
1964
2206
|
stripeStore.clientSecret = checkoutSession.clientSecret;
|
|
1965
2207
|
stripeStore.stripeCustomerSessionClientSecret =
|
|
1966
2208
|
checkoutSession.customerSessionClientSecret;
|
|
1967
2209
|
stripeStore.customerProfile = checkoutSession.customerProfile;
|
|
1968
2210
|
cartStore.checkoutSession = checkoutSession;
|
|
2211
|
+
// Populate store credit balance from checkout session customer profile
|
|
2212
|
+
storeCreditStoreSetBalanceFromSession((_b = (_a = checkoutSession.customerProfile) === null || _a === void 0 ? void 0 : _a.storeCreditBalance) !== null && _b !== void 0 ? _b : null);
|
|
1969
2213
|
if (!checkoutSession.id) {
|
|
1970
2214
|
// Log error to track down the issue
|
|
1971
2215
|
void sendErrorLog({
|
|
@@ -1985,10 +2229,10 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
|
1985
2229
|
const availableSelectedVariantTestKeys = filterValidTests(checkoutSession.varianceTestResults || []);
|
|
1986
2230
|
storageStoreSetEnabledVariantTestKeys(availableSelectedVariantTestKeys);
|
|
1987
2231
|
// Check if there is a redirect URL in the metadata to override
|
|
1988
|
-
const externalConfirmationPageURL = ((
|
|
2232
|
+
const externalConfirmationPageURL = ((_e = (_d = (_c = cartStore.checkoutSession) === null || _c === void 0 ? void 0 : _c.metadata) === null || _d === void 0 ? void 0 : _d.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'externalConfirmationPageURL')) === null || _e === void 0 ? void 0 : _e.value) ||
|
|
1989
2233
|
(
|
|
1990
2234
|
// Sometimes externalConfirmationPageURL is not in checkoutSession create/update, check if there is a redirect URL in the cart metadata to override
|
|
1991
|
-
(
|
|
2235
|
+
(_g = (_f = window.Zonos.cartData) === null || _f === void 0 ? void 0 : _f.metadata.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'externalConfirmationPageURL')) === null || _g === void 0 ? void 0 : _g.value) ||
|
|
1992
2236
|
null;
|
|
1993
2237
|
if (externalConfirmationPageURL) {
|
|
1994
2238
|
log(`Found externalConfirmationPageURL: ${externalConfirmationPageURL}`);
|
|
@@ -2259,5 +2503,49 @@ const cartStoreResetTabItems = () => {
|
|
|
2259
2503
|
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 }) });
|
|
2260
2504
|
cartStoreResetSelectedShippingOption();
|
|
2261
2505
|
};
|
|
2506
|
+
const cartStoreUpdateStoreCreditImmediate = async () => {
|
|
2507
|
+
var _a, _b;
|
|
2508
|
+
if (!storageStore.checkoutSessionId) {
|
|
2509
|
+
log('Could not update store credit without checkout session id', 'info');
|
|
2510
|
+
return;
|
|
2511
|
+
}
|
|
2512
|
+
const selectedLandedCost = cartStore.selectedLandedCost;
|
|
2513
|
+
const currency = cartStore.currency || ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '';
|
|
2514
|
+
const adjustmentsAmount = cartStore.adjustments.reduce((prev, adj) => prev + adj.amount, 0);
|
|
2515
|
+
const itemsAmount = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
2516
|
+
const { errors, json } = await stripeStoreUpdateCheckoutSession({
|
|
2517
|
+
adjustmentsAmount,
|
|
2518
|
+
cartId: window.Zonos.cartId,
|
|
2519
|
+
currency,
|
|
2520
|
+
id: storageStore.checkoutSessionId,
|
|
2521
|
+
itemsAmount,
|
|
2522
|
+
landedCostId: selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCostId,
|
|
2523
|
+
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
2524
|
+
storeCreditApplication: storeCreditStoreGetInput(),
|
|
2525
|
+
});
|
|
2526
|
+
if (errors.length > 0 || !json) {
|
|
2527
|
+
logError('Error updating checkout session with store credit');
|
|
2528
|
+
return;
|
|
2529
|
+
}
|
|
2530
|
+
// Apply updated subtotals from the response
|
|
2531
|
+
cartStoreApplySubtotals({
|
|
2532
|
+
method: ((_b = json.checkoutSessionUpdate.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
|
|
2533
|
+
subtotals: json.checkoutSessionUpdate.subtotals,
|
|
2534
|
+
});
|
|
2535
|
+
cartStoreSetCheckoutSession(json.checkoutSessionUpdate);
|
|
2536
|
+
};
|
|
2537
|
+
/**
|
|
2538
|
+
* Update the checkout session with the current store credit selection.
|
|
2539
|
+
* Debounced to prevent multiple rapid requests when store changes cascade.
|
|
2540
|
+
*/
|
|
2541
|
+
const cartStoreUpdateStoreCredit = () => {
|
|
2542
|
+
if (storeCreditUpdateTimeout) {
|
|
2543
|
+
clearTimeout(storeCreditUpdateTimeout);
|
|
2544
|
+
}
|
|
2545
|
+
storeCreditUpdateTimeout = setTimeout(() => {
|
|
2546
|
+
storeCreditUpdateTimeout = null;
|
|
2547
|
+
void cartStoreUpdateStoreCreditImmediate();
|
|
2548
|
+
}, 300);
|
|
2549
|
+
};
|
|
2262
2550
|
|
|
2263
|
-
export {
|
|
2551
|
+
export { stripeStoreConfirmPayment as A, stripeStoreHandleInventoryRefund as B, stripeStoreReset as C, cartStoreOnChange as D, storeCreditStoreGetEffectiveAmount as E, stripeStoreOnChange as F, stripeStoreBuildAddressForPartyCreate as G, cartStoreUpdateSelectedShippingOption as H, cartStoreHasOneEligibleItem as I, stripeStoreApplyPromoCode as J, stripeStoreRemovePromoCode as K, stripeStoreResetPromoCode as L, stripeStoreMessageBasedOnStatus as M, storeCreditStore as N, storeCreditStoreReset as O, stripeStoreTranslateAddressToLatin as P, extractName as Q, stripeStoreAsyncAddressUpdate as R, cartStoreGetShippingTransitInfo as S, cartStoreGetMethod as T, sortServiceLevelOptionsByAmount as U, storeCreditStoreSetEnabled as V, storeCreditStoreSetUseFullBalance as W, cartStoreUpdateStoreCredit as X, storeCreditStoreSetAmount as Y, storeCreditStoreRefreshBalance as Z, stripeStoreSaveDomesticShippingSession as a, stripeStore as b, stripeStoreRetrievePayment as c, cartStore as d, cartStoreUpdateItems as e, cartStoreReset as f, cartStoreResetTabItems as g, cartStoreClearCheckoutInterval as h, initStripeElements as i, stripeStoreInitCheckoutSession as j, stripeStoreGetPaymentIntent as k, cartStoreStartCheckoutInterval as l, getCheckoutSessionBody as m, cartStoreUpdateToErrorState as n, stripeStoreCleanupDomesticShippingSession as o, cartStoreSetCheckoutSession as p, stripeStorePrefetchLandedCost as q, cartStoreNextStep as r, stripeStoreGetDomesticShippingSession as s, trackConversionEvent as t, stripeStoreUpdateCheckoutSessionBaseCurrency as u, stripeStoreHandleInventoryCheck as v, storeCreditStoreApplyCredit as w, storeCreditStoreCoversFullAmount as x, validateCheckoutSession as y, storeCreditStoreCreateOrder as z };
|
|
@@ -23,6 +23,10 @@ function trimTrailingNewlines (string) {
|
|
|
23
23
|
return string.substring(0, indexEnd)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
function trimNewlines (string) {
|
|
27
|
+
return trimTrailingNewlines(trimLeadingNewlines(string))
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
var blockElements = [
|
|
27
31
|
'ADDRESS', 'ARTICLE', 'ASIDE', 'AUDIO', 'BLOCKQUOTE', 'BODY', 'CANVAS',
|
|
28
32
|
'CENTER', 'DD', 'DIR', 'DIV', 'DL', 'DT', 'FIELDSET', 'FIGCAPTION', 'FIGURE',
|
|
@@ -114,8 +118,7 @@ rules.blockquote = {
|
|
|
114
118
|
filter: 'blockquote',
|
|
115
119
|
|
|
116
120
|
replacement: function (content) {
|
|
117
|
-
content = content.replace(
|
|
118
|
-
content = content.replace(/^/gm, '> ');
|
|
121
|
+
content = trimNewlines(content).replace(/^/gm, '> ');
|
|
119
122
|
return '\n\n' + content + '\n\n'
|
|
120
123
|
}
|
|
121
124
|
};
|
|
@@ -137,10 +140,6 @@ rules.listItem = {
|
|
|
137
140
|
filter: 'li',
|
|
138
141
|
|
|
139
142
|
replacement: function (content, node, options) {
|
|
140
|
-
content = content
|
|
141
|
-
.replace(/^\n+/, '') // remove leading newlines
|
|
142
|
-
.replace(/\n+$/, '\n') // replace trailing newlines with just a single one
|
|
143
|
-
.replace(/\n/gm, '\n '); // indent
|
|
144
143
|
var prefix = options.bulletListMarker + ' ';
|
|
145
144
|
var parent = node.parentNode;
|
|
146
145
|
if (parent.nodeName === 'OL') {
|
|
@@ -148,8 +147,11 @@ rules.listItem = {
|
|
|
148
147
|
var index = Array.prototype.indexOf.call(parent.children, node);
|
|
149
148
|
prefix = (start ? Number(start) + index : index + 1) + '. ';
|
|
150
149
|
}
|
|
150
|
+
var isParagraph = /\n$/.test(content);
|
|
151
|
+
content = trimNewlines(content) + (isParagraph ? '\n' : '');
|
|
152
|
+
content = content.replace(/\n/gm, '\n' + ' '.repeat(prefix.length)); // indent
|
|
151
153
|
return (
|
|
152
|
-
prefix + content + (node.nextSibling
|
|
154
|
+
prefix + content + (node.nextSibling ? '\n' : '')
|
|
153
155
|
)
|
|
154
156
|
}
|
|
155
157
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as isDarkColor, t as tinycolor } from './isDarkColor-
|
|
2
|
-
import { i as isContrastColor } from './isContrastColor-
|
|
1
|
+
import { i as isDarkColor, t as tinycolor } from './isDarkColor-3537021b.js';
|
|
2
|
+
import { i as isContrastColor } from './isContrastColor-c17e83c9.js';
|
|
3
3
|
|
|
4
4
|
const getContrastColor = ({ backgroundColor, color, }) => {
|
|
5
5
|
if (backgroundColor === color) {
|