@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,11 +1,254 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const zonosStore = require('./zonosStore-
|
|
4
|
-
const localization = require('./localization-
|
|
5
|
-
const handleFetch = require('./handleFetch-954f30e1.js');
|
|
3
|
+
const zonosStore = require('./zonosStore-f5a61112.js');
|
|
4
|
+
const localization = require('./localization-523b793a.js');
|
|
6
5
|
const VarianceTest = require('./VarianceTest-bec00ea8.js');
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const handleFetch = require('./handleFetch-954f30e1.js');
|
|
7
|
+
const isDarkColor = require('./isDarkColor-a68abf7a.js');
|
|
8
|
+
const getBorderRadius = require('./getBorderRadius-27a74844.js');
|
|
9
|
+
|
|
10
|
+
const getCheckoutSession = async () => {
|
|
11
|
+
if (!localization.storageStore.checkoutSessionId) {
|
|
12
|
+
return {
|
|
13
|
+
errors: [{ message: 'No checkout session id found' }],
|
|
14
|
+
json: null,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const searchParams = new URLSearchParams();
|
|
18
|
+
searchParams.set('checkoutSessionId', localization.storageStore.checkoutSessionId);
|
|
19
|
+
const { errors, json } = await handleFetch.handleFetch(`/api/zonos-elements/get-checkout-session?${searchParams.toString()}`);
|
|
20
|
+
return { errors, json };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const { onChange: storeCreditStoreOnChange, reset: reset$2, state: storeCreditStore, } = zonosStore.createStore(() => ({
|
|
24
|
+
amountToApply: null,
|
|
25
|
+
appliedAmount: null,
|
|
26
|
+
availableBalance: null,
|
|
27
|
+
error: null,
|
|
28
|
+
isApplying: false,
|
|
29
|
+
isEnabled: false,
|
|
30
|
+
orderIdCreated: null,
|
|
31
|
+
remainingBalance: null,
|
|
32
|
+
useFullBalance: true,
|
|
33
|
+
}));
|
|
34
|
+
/**
|
|
35
|
+
* Reset store credit store to initial state
|
|
36
|
+
*/
|
|
37
|
+
const storeCreditStoreReset = () => {
|
|
38
|
+
reset$2();
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Set the available balance from the checkout session's customerProfile.storeCreditBalance
|
|
42
|
+
*/
|
|
43
|
+
const storeCreditStoreSetBalanceFromSession = (balance) => {
|
|
44
|
+
VarianceTest.log('Store credit balance from session', 'info', balance);
|
|
45
|
+
storeCreditStore.availableBalance = balance;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Re-fetch the store credit balance from the checkout session.
|
|
49
|
+
* Called when the payment step loads to ensure the balance is fresh.
|
|
50
|
+
*/
|
|
51
|
+
const storeCreditStoreRefreshBalance = async () => {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const { errors, json } = await getCheckoutSession();
|
|
54
|
+
if (errors.length || !json) {
|
|
55
|
+
handleFetch.logError('Failed to refresh store credit balance');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const balance = (_b = (_a = json.checkoutSession.customerProfile) === null || _a === void 0 ? void 0 : _a.storeCreditBalance) !== null && _b !== void 0 ? _b : null;
|
|
59
|
+
storeCreditStoreSetBalanceFromSession(balance);
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Apply store credit to the checkout session.
|
|
63
|
+
* This must be called BEFORE payment confirmation.
|
|
64
|
+
* The amount/mode are already set via checkout session update with storeCreditApplication.
|
|
65
|
+
*/
|
|
66
|
+
const storeCreditStoreApplyCredit = async () => {
|
|
67
|
+
var _a;
|
|
68
|
+
const checkoutSessionId = localization.storageStore.checkoutSessionId;
|
|
69
|
+
if (!checkoutSessionId) {
|
|
70
|
+
const error = 'No checkout session found';
|
|
71
|
+
handleFetch.logError(error);
|
|
72
|
+
storeCreditStore.error = error;
|
|
73
|
+
return { error, success: false };
|
|
74
|
+
}
|
|
75
|
+
VarianceTest.log('Applying store credit', 'info', { checkoutSessionId });
|
|
76
|
+
storeCreditStore.isApplying = true;
|
|
77
|
+
storeCreditStore.error = null;
|
|
78
|
+
try {
|
|
79
|
+
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/store-credit/apply', {
|
|
80
|
+
body: {
|
|
81
|
+
checkoutSessionId,
|
|
82
|
+
},
|
|
83
|
+
method: 'POST',
|
|
84
|
+
});
|
|
85
|
+
if (errors.length > 0 || !json) {
|
|
86
|
+
const errorMessage = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) || 'Failed to apply store credit';
|
|
87
|
+
handleFetch.logError(errorMessage);
|
|
88
|
+
storeCreditStore.error = errorMessage;
|
|
89
|
+
storeCreditStore.isApplying = false;
|
|
90
|
+
return { error: errorMessage, success: false };
|
|
91
|
+
}
|
|
92
|
+
storeCreditStore.appliedAmount = json.amountApplied;
|
|
93
|
+
storeCreditStore.remainingBalance = json.remainingBalance;
|
|
94
|
+
storeCreditStore.isApplying = false;
|
|
95
|
+
VarianceTest.log('Store credit applied', 'info', {
|
|
96
|
+
amountApplied: json.amountApplied,
|
|
97
|
+
remainingBalance: json.remainingBalance,
|
|
98
|
+
});
|
|
99
|
+
return { error: null, success: true };
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
const errorMessage = e instanceof Error ? e.message : 'Failed to apply store credit';
|
|
103
|
+
handleFetch.logError(errorMessage);
|
|
104
|
+
storeCreditStore.error = errorMessage;
|
|
105
|
+
storeCreditStore.isApplying = false;
|
|
106
|
+
return { error: errorMessage, success: false };
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Enable or disable store credit usage.
|
|
111
|
+
* When enabling, defaults to full balance mode.
|
|
112
|
+
* When disabling, clears the amount.
|
|
113
|
+
*/
|
|
114
|
+
const storeCreditStoreSetEnabled = (enabled) => {
|
|
115
|
+
storeCreditStore.isEnabled = enabled;
|
|
116
|
+
storeCreditStore.error = null;
|
|
117
|
+
if (!enabled) {
|
|
118
|
+
storeCreditStore.amountToApply = null;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Set the amount of store credit to apply
|
|
123
|
+
* Validates against available balance and cart total
|
|
124
|
+
*/
|
|
125
|
+
const storeCreditStoreSetAmount = (amount) => {
|
|
126
|
+
if (amount === null) {
|
|
127
|
+
storeCreditStore.amountToApply = null;
|
|
128
|
+
storeCreditStore.error = null;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
// Validate amount
|
|
132
|
+
if (amount <= 0) {
|
|
133
|
+
storeCreditStore.error = 'Amount must be greater than zero';
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (storeCreditStore.availableBalance !== null &&
|
|
137
|
+
amount > storeCreditStore.availableBalance) {
|
|
138
|
+
storeCreditStore.error = 'Amount exceeds available balance';
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const orderTotal = cartStore.total + (cartStore.storeCredit || 0);
|
|
142
|
+
if (amount > orderTotal) {
|
|
143
|
+
storeCreditStore.error = 'Amount exceeds order total';
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
storeCreditStore.error = null;
|
|
147
|
+
storeCreditStore.amountToApply = amount;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Toggle whether to use full balance or custom amount.
|
|
151
|
+
* When switching to custom mode, clears the applied amount so the user
|
|
152
|
+
* must explicitly apply via the Apply button.
|
|
153
|
+
*/
|
|
154
|
+
const storeCreditStoreSetUseFullBalance = (useFullBalance) => {
|
|
155
|
+
storeCreditStore.useFullBalance = useFullBalance;
|
|
156
|
+
storeCreditStore.error = null;
|
|
157
|
+
if (useFullBalance && storeCreditStore.availableBalance !== null) {
|
|
158
|
+
const orderTotal = cartStore.total + (cartStore.storeCredit || 0);
|
|
159
|
+
const maxAmount = Math.min(storeCreditStore.availableBalance, orderTotal);
|
|
160
|
+
storeCreditStore.amountToApply = maxAmount;
|
|
161
|
+
}
|
|
162
|
+
else if (!useFullBalance) {
|
|
163
|
+
storeCreditStore.amountToApply = null;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Get the storeCreditApplication input for checkout session update.
|
|
168
|
+
* Sends mode: 'NONE' when store credit is not being used to clear any
|
|
169
|
+
* previously applied store credit on the backend.
|
|
170
|
+
*/
|
|
171
|
+
const storeCreditStoreGetInput = () => {
|
|
172
|
+
if (!storeCreditStore.isEnabled || storeCreditStore.amountToApply === null) {
|
|
173
|
+
return { mode: 'NONE' };
|
|
174
|
+
}
|
|
175
|
+
if (storeCreditStore.useFullBalance) {
|
|
176
|
+
return { mode: 'FULL' };
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
amount: storeCreditStore.amountToApply,
|
|
180
|
+
mode: 'PARTIAL',
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Get the effective amount to apply based on settings
|
|
185
|
+
*/
|
|
186
|
+
const storeCreditStoreGetEffectiveAmount = () => {
|
|
187
|
+
if (!storeCreditStore.isEnabled ||
|
|
188
|
+
storeCreditStore.availableBalance === null) {
|
|
189
|
+
return 0;
|
|
190
|
+
}
|
|
191
|
+
if (storeCreditStore.useFullBalance) {
|
|
192
|
+
return Math.min(storeCreditStore.availableBalance, cartStore.total + (cartStore.storeCredit || 0));
|
|
193
|
+
}
|
|
194
|
+
return storeCreditStore.amountToApply || 0;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Check whether the effective store credit amount covers the full order total.
|
|
198
|
+
* When true, the Stripe/PayPal payment flow should be skipped and
|
|
199
|
+
* `storeCreditStoreCreateOrder` should be used instead.
|
|
200
|
+
*
|
|
201
|
+
* Relies on the backend's computed `cartStore.total` (remaining amount to pay
|
|
202
|
+
* after store credit) rather than a client-side comparison, which avoids issues
|
|
203
|
+
* with currency mismatches or rounding.
|
|
204
|
+
*/
|
|
205
|
+
const storeCreditStoreCoversFullAmount = () => {
|
|
206
|
+
// Only consider full coverage after the backend has confirmed store credit
|
|
207
|
+
// was applied (cartStore.storeCredit > 0) and the remaining total is 0.
|
|
208
|
+
return (storeCreditStore.amountToApply !== null &&
|
|
209
|
+
storeCreditStore.amountToApply > 0 &&
|
|
210
|
+
cartStore.storeCredit > 0 &&
|
|
211
|
+
cartStore.total <= 0);
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Create an order paid entirely by store credit.
|
|
215
|
+
* Should only be called when `storeCreditStoreCoversFullAmount()` is true.
|
|
216
|
+
*/
|
|
217
|
+
const storeCreditStoreCreateOrder = async () => {
|
|
218
|
+
var _a, _b, _c;
|
|
219
|
+
const checkoutSessionId = localization.storageStore.checkoutSessionId;
|
|
220
|
+
if (!checkoutSessionId) {
|
|
221
|
+
const error = 'No checkout session found';
|
|
222
|
+
handleFetch.logError(error);
|
|
223
|
+
storeCreditStore.error = error;
|
|
224
|
+
return { error, orderId: null, success: false };
|
|
225
|
+
}
|
|
226
|
+
VarianceTest.log('Creating store credit order', 'info', { checkoutSessionId });
|
|
227
|
+
try {
|
|
228
|
+
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/store-credit/order-create', {
|
|
229
|
+
body: {
|
|
230
|
+
checkoutSessionId,
|
|
231
|
+
},
|
|
232
|
+
method: 'POST',
|
|
233
|
+
});
|
|
234
|
+
if (errors.length > 0 || !json) {
|
|
235
|
+
const errorMessage = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) || 'Failed to create store credit order';
|
|
236
|
+
handleFetch.logError(errorMessage);
|
|
237
|
+
storeCreditStore.error = errorMessage;
|
|
238
|
+
return { error: errorMessage, orderId: null, success: false };
|
|
239
|
+
}
|
|
240
|
+
const orderId = ((_c = (_b = json.checkoutSessionStoreCreditOrderCreate) === null || _b === void 0 ? void 0 : _b.order) === null || _c === void 0 ? void 0 : _c.id) || null;
|
|
241
|
+
storeCreditStore.orderIdCreated = orderId;
|
|
242
|
+
VarianceTest.log('Store credit order created', 'info', { orderId });
|
|
243
|
+
return { error: null, orderId, success: true };
|
|
244
|
+
}
|
|
245
|
+
catch (e) {
|
|
246
|
+
const errorMessage = e instanceof Error ? e.message : 'Failed to create store credit order';
|
|
247
|
+
handleFetch.logError(errorMessage);
|
|
248
|
+
storeCreditStore.error = errorMessage;
|
|
249
|
+
return { error: errorMessage, orderId: null, success: false };
|
|
250
|
+
}
|
|
251
|
+
};
|
|
9
252
|
|
|
10
253
|
/**
|
|
11
254
|
* Extract first name and last name from the name string
|
|
@@ -513,19 +756,6 @@ const sortServiceLevelOptionsByAmount = (serviceLevels) => {
|
|
|
513
756
|
return sortedServiceLevels;
|
|
514
757
|
};
|
|
515
758
|
|
|
516
|
-
const getCheckoutSession = async () => {
|
|
517
|
-
if (!localization.storageStore.checkoutSessionId) {
|
|
518
|
-
return {
|
|
519
|
-
errors: [{ message: 'No checkout session id found' }],
|
|
520
|
-
json: null,
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
const searchParams = new URLSearchParams();
|
|
524
|
-
searchParams.set('checkoutSessionId', localization.storageStore.checkoutSessionId);
|
|
525
|
-
const { errors, json } = await handleFetch.handleFetch(`/api/zonos-elements/get-checkout-session?${searchParams.toString()}`);
|
|
526
|
-
return { errors, json };
|
|
527
|
-
};
|
|
528
|
-
|
|
529
759
|
/**
|
|
530
760
|
* Validate checkout session before confirming payment
|
|
531
761
|
*/
|
|
@@ -1638,7 +1868,7 @@ const stripeStoreUpdateCheckoutSessionBaseCurrency = async () => {
|
|
|
1638
1868
|
/**
|
|
1639
1869
|
* Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
|
|
1640
1870
|
*/
|
|
1641
|
-
const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
|
|
1871
|
+
const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, currency, id, itemsAmount, landedCostId, presentmentCountryCode, storeCreditApplication, }) => {
|
|
1642
1872
|
const varianceTestInput = localization.storageStore.enabledVariantTestKeys || [];
|
|
1643
1873
|
// No need to set loading state here because this function will be called under the hood to update
|
|
1644
1874
|
// landed cost id for the section.
|
|
@@ -1661,6 +1891,7 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
|
|
|
1661
1891
|
presentmentCountryCode,
|
|
1662
1892
|
shipToPartyId: stripeStore.partyShippingId,
|
|
1663
1893
|
skipPaymentIntent: stripeStore.skipPaymentIntent,
|
|
1894
|
+
storeCreditApplication,
|
|
1664
1895
|
varianceTestInput,
|
|
1665
1896
|
},
|
|
1666
1897
|
method: 'POST',
|
|
@@ -1837,6 +2068,7 @@ const { onChange: cartStoreOnChange, reset, state: cartStore, } = zonosStore.cre
|
|
|
1837
2068
|
shippingData: null,
|
|
1838
2069
|
shouldHideDiscountInput: false,
|
|
1839
2070
|
step: 'customer-info',
|
|
2071
|
+
storeCredit: 0,
|
|
1840
2072
|
subtotal: 0,
|
|
1841
2073
|
tabItems: {
|
|
1842
2074
|
'customer-info': {
|
|
@@ -1925,8 +2157,16 @@ const cartStoreCheckItemRestrictions = (itemsWorkflow) => {
|
|
|
1925
2157
|
restrictedItems: mappedRestrictedItems,
|
|
1926
2158
|
};
|
|
1927
2159
|
};
|
|
2160
|
+
let storeCreditUpdateTimeout = null;
|
|
1928
2161
|
const cartStoreReset = () => {
|
|
1929
2162
|
localization.storageStore.checkoutSessionId = null;
|
|
2163
|
+
// clear pending store credit debounce timer
|
|
2164
|
+
if (storeCreditUpdateTimeout) {
|
|
2165
|
+
clearTimeout(storeCreditUpdateTimeout);
|
|
2166
|
+
storeCreditUpdateTimeout = null;
|
|
2167
|
+
}
|
|
2168
|
+
// reset store credit store
|
|
2169
|
+
storeCreditStoreReset();
|
|
1930
2170
|
// reset cart store
|
|
1931
2171
|
reset();
|
|
1932
2172
|
};
|
|
@@ -1940,11 +2180,13 @@ const cartStoreUpdateToErrorState = ({ messages, title, }) => {
|
|
|
1940
2180
|
};
|
|
1941
2181
|
};
|
|
1942
2182
|
const cartStoreApplySubtotals = ({ dutiesTaxesFeesEstimate, method, subtotals, }) => {
|
|
2183
|
+
var _a;
|
|
1943
2184
|
// update exchange rate so we can use it to display cart items
|
|
1944
2185
|
cartStore.exchangeRate = subtotals.exchangeRate;
|
|
1945
2186
|
cartStore.adjustmentTotal = subtotals.adjustments;
|
|
1946
2187
|
cartStore.dutiesTaxesFees =
|
|
1947
2188
|
method === 'DAP' ? null : subtotals.landedCostTotal;
|
|
2189
|
+
cartStore.storeCredit = (_a = subtotals.storeCredit) !== null && _a !== void 0 ? _a : 0;
|
|
1948
2190
|
cartStore.subtotal = subtotals.items;
|
|
1949
2191
|
cartStore.total = subtotals.total;
|
|
1950
2192
|
cartStore.currency = subtotals.presentmentCurrencyCode;
|
|
@@ -1961,13 +2203,15 @@ const cartStoreHasOneEligibleItem = () => {
|
|
|
1961
2203
|
return !!checkItems.find(item => !item.isRestricted);
|
|
1962
2204
|
};
|
|
1963
2205
|
const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
1964
|
-
var _a, _b, _c, _d, _e;
|
|
2206
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1965
2207
|
// update stripe store with updated information
|
|
1966
2208
|
stripeStore.clientSecret = checkoutSession.clientSecret;
|
|
1967
2209
|
stripeStore.stripeCustomerSessionClientSecret =
|
|
1968
2210
|
checkoutSession.customerSessionClientSecret;
|
|
1969
2211
|
stripeStore.customerProfile = checkoutSession.customerProfile;
|
|
1970
2212
|
cartStore.checkoutSession = checkoutSession;
|
|
2213
|
+
// Populate store credit balance from checkout session customer profile
|
|
2214
|
+
storeCreditStoreSetBalanceFromSession((_b = (_a = checkoutSession.customerProfile) === null || _a === void 0 ? void 0 : _a.storeCreditBalance) !== null && _b !== void 0 ? _b : null);
|
|
1971
2215
|
if (!checkoutSession.id) {
|
|
1972
2216
|
// Log error to track down the issue
|
|
1973
2217
|
void handleFetch.sendErrorLog({
|
|
@@ -1987,10 +2231,10 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
|
1987
2231
|
const availableSelectedVariantTestKeys = localization.filterValidTests(checkoutSession.varianceTestResults || []);
|
|
1988
2232
|
localization.storageStoreSetEnabledVariantTestKeys(availableSelectedVariantTestKeys);
|
|
1989
2233
|
// Check if there is a redirect URL in the metadata to override
|
|
1990
|
-
const externalConfirmationPageURL = ((
|
|
2234
|
+
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) ||
|
|
1991
2235
|
(
|
|
1992
2236
|
// Sometimes externalConfirmationPageURL is not in checkoutSession create/update, check if there is a redirect URL in the cart metadata to override
|
|
1993
|
-
(
|
|
2237
|
+
(_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) ||
|
|
1994
2238
|
null;
|
|
1995
2239
|
if (externalConfirmationPageURL) {
|
|
1996
2240
|
VarianceTest.log(`Found externalConfirmationPageURL: ${externalConfirmationPageURL}`);
|
|
@@ -2261,6 +2505,50 @@ const cartStoreResetTabItems = () => {
|
|
|
2261
2505
|
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 }) });
|
|
2262
2506
|
cartStoreResetSelectedShippingOption();
|
|
2263
2507
|
};
|
|
2508
|
+
const cartStoreUpdateStoreCreditImmediate = async () => {
|
|
2509
|
+
var _a, _b;
|
|
2510
|
+
if (!localization.storageStore.checkoutSessionId) {
|
|
2511
|
+
VarianceTest.log('Could not update store credit without checkout session id', 'info');
|
|
2512
|
+
return;
|
|
2513
|
+
}
|
|
2514
|
+
const selectedLandedCost = cartStore.selectedLandedCost;
|
|
2515
|
+
const currency = cartStore.currency || ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '';
|
|
2516
|
+
const adjustmentsAmount = cartStore.adjustments.reduce((prev, adj) => prev + adj.amount, 0);
|
|
2517
|
+
const itemsAmount = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
2518
|
+
const { errors, json } = await stripeStoreUpdateCheckoutSession({
|
|
2519
|
+
adjustmentsAmount,
|
|
2520
|
+
cartId: window.Zonos.cartId,
|
|
2521
|
+
currency,
|
|
2522
|
+
id: localization.storageStore.checkoutSessionId,
|
|
2523
|
+
itemsAmount,
|
|
2524
|
+
landedCostId: selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCostId,
|
|
2525
|
+
presentmentCountryCode: localization.localizationStore.selectedCountryCode,
|
|
2526
|
+
storeCreditApplication: storeCreditStoreGetInput(),
|
|
2527
|
+
});
|
|
2528
|
+
if (errors.length > 0 || !json) {
|
|
2529
|
+
handleFetch.logError('Error updating checkout session with store credit');
|
|
2530
|
+
return;
|
|
2531
|
+
}
|
|
2532
|
+
// Apply updated subtotals from the response
|
|
2533
|
+
cartStoreApplySubtotals({
|
|
2534
|
+
method: ((_b = json.checkoutSessionUpdate.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
|
|
2535
|
+
subtotals: json.checkoutSessionUpdate.subtotals,
|
|
2536
|
+
});
|
|
2537
|
+
cartStoreSetCheckoutSession(json.checkoutSessionUpdate);
|
|
2538
|
+
};
|
|
2539
|
+
/**
|
|
2540
|
+
* Update the checkout session with the current store credit selection.
|
|
2541
|
+
* Debounced to prevent multiple rapid requests when store changes cascade.
|
|
2542
|
+
*/
|
|
2543
|
+
const cartStoreUpdateStoreCredit = () => {
|
|
2544
|
+
if (storeCreditUpdateTimeout) {
|
|
2545
|
+
clearTimeout(storeCreditUpdateTimeout);
|
|
2546
|
+
}
|
|
2547
|
+
storeCreditUpdateTimeout = setTimeout(() => {
|
|
2548
|
+
storeCreditUpdateTimeout = null;
|
|
2549
|
+
void cartStoreUpdateStoreCreditImmediate();
|
|
2550
|
+
}, 300);
|
|
2551
|
+
};
|
|
2264
2552
|
|
|
2265
2553
|
exports.cartStore = cartStore;
|
|
2266
2554
|
exports.cartStoreClearCheckoutInterval = cartStoreClearCheckoutInterval;
|
|
@@ -2275,11 +2563,22 @@ exports.cartStoreSetCheckoutSession = cartStoreSetCheckoutSession;
|
|
|
2275
2563
|
exports.cartStoreStartCheckoutInterval = cartStoreStartCheckoutInterval;
|
|
2276
2564
|
exports.cartStoreUpdateItems = cartStoreUpdateItems;
|
|
2277
2565
|
exports.cartStoreUpdateSelectedShippingOption = cartStoreUpdateSelectedShippingOption;
|
|
2566
|
+
exports.cartStoreUpdateStoreCredit = cartStoreUpdateStoreCredit;
|
|
2278
2567
|
exports.cartStoreUpdateToErrorState = cartStoreUpdateToErrorState;
|
|
2279
2568
|
exports.extractName = extractName;
|
|
2280
2569
|
exports.getCheckoutSessionBody = getCheckoutSessionBody;
|
|
2281
2570
|
exports.initStripeElements = initStripeElements;
|
|
2282
2571
|
exports.sortServiceLevelOptionsByAmount = sortServiceLevelOptionsByAmount;
|
|
2572
|
+
exports.storeCreditStore = storeCreditStore;
|
|
2573
|
+
exports.storeCreditStoreApplyCredit = storeCreditStoreApplyCredit;
|
|
2574
|
+
exports.storeCreditStoreCoversFullAmount = storeCreditStoreCoversFullAmount;
|
|
2575
|
+
exports.storeCreditStoreCreateOrder = storeCreditStoreCreateOrder;
|
|
2576
|
+
exports.storeCreditStoreGetEffectiveAmount = storeCreditStoreGetEffectiveAmount;
|
|
2577
|
+
exports.storeCreditStoreRefreshBalance = storeCreditStoreRefreshBalance;
|
|
2578
|
+
exports.storeCreditStoreReset = storeCreditStoreReset;
|
|
2579
|
+
exports.storeCreditStoreSetAmount = storeCreditStoreSetAmount;
|
|
2580
|
+
exports.storeCreditStoreSetEnabled = storeCreditStoreSetEnabled;
|
|
2581
|
+
exports.storeCreditStoreSetUseFullBalance = storeCreditStoreSetUseFullBalance;
|
|
2283
2582
|
exports.stripeStore = stripeStore;
|
|
2284
2583
|
exports.stripeStoreApplyPromoCode = stripeStoreApplyPromoCode;
|
|
2285
2584
|
exports.stripeStoreAsyncAddressUpdate = stripeStoreAsyncAddressUpdate;
|
|
@@ -25,6 +25,10 @@ function trimTrailingNewlines (string) {
|
|
|
25
25
|
return string.substring(0, indexEnd)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
function trimNewlines (string) {
|
|
29
|
+
return trimTrailingNewlines(trimLeadingNewlines(string))
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
var blockElements = [
|
|
29
33
|
'ADDRESS', 'ARTICLE', 'ASIDE', 'AUDIO', 'BLOCKQUOTE', 'BODY', 'CANVAS',
|
|
30
34
|
'CENTER', 'DD', 'DIR', 'DIV', 'DL', 'DT', 'FIELDSET', 'FIGCAPTION', 'FIGURE',
|
|
@@ -116,8 +120,7 @@ rules.blockquote = {
|
|
|
116
120
|
filter: 'blockquote',
|
|
117
121
|
|
|
118
122
|
replacement: function (content) {
|
|
119
|
-
content = content.replace(
|
|
120
|
-
content = content.replace(/^/gm, '> ');
|
|
123
|
+
content = trimNewlines(content).replace(/^/gm, '> ');
|
|
121
124
|
return '\n\n' + content + '\n\n'
|
|
122
125
|
}
|
|
123
126
|
};
|
|
@@ -139,10 +142,6 @@ rules.listItem = {
|
|
|
139
142
|
filter: 'li',
|
|
140
143
|
|
|
141
144
|
replacement: function (content, node, options) {
|
|
142
|
-
content = content
|
|
143
|
-
.replace(/^\n+/, '') // remove leading newlines
|
|
144
|
-
.replace(/\n+$/, '\n') // replace trailing newlines with just a single one
|
|
145
|
-
.replace(/\n/gm, '\n '); // indent
|
|
146
145
|
var prefix = options.bulletListMarker + ' ';
|
|
147
146
|
var parent = node.parentNode;
|
|
148
147
|
if (parent.nodeName === 'OL') {
|
|
@@ -150,8 +149,11 @@ rules.listItem = {
|
|
|
150
149
|
var index = Array.prototype.indexOf.call(parent.children, node);
|
|
151
150
|
prefix = (start ? Number(start) + index : index + 1) + '. ';
|
|
152
151
|
}
|
|
152
|
+
var isParagraph = /\n$/.test(content);
|
|
153
|
+
content = trimNewlines(content) + (isParagraph ? '\n' : '');
|
|
154
|
+
content = content.replace(/\n/gm, '\n' + ' '.repeat(prefix.length)); // indent
|
|
153
155
|
return (
|
|
154
|
-
prefix + content + (node.nextSibling
|
|
156
|
+
prefix + content + (node.nextSibling ? '\n' : '')
|
|
155
157
|
)
|
|
156
158
|
}
|
|
157
159
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const isDarkColor = require('./isDarkColor-
|
|
4
|
-
const isContrastColor = require('./isContrastColor-
|
|
3
|
+
const isDarkColor = require('./isDarkColor-a68abf7a.js');
|
|
4
|
+
const isContrastColor = require('./isContrastColor-d1936a5c.js');
|
|
5
5
|
|
|
6
6
|
const getContrastColor = ({ backgroundColor, color, }) => {
|
|
7
7
|
if (backgroundColor === color) {
|