@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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
font-family: var(--zonos--font-family, Inter), Inter;
|
|
3
|
+
display: block;
|
|
4
|
+
white-space: normal;
|
|
5
|
+
}
|
|
6
|
+
:host * {
|
|
7
|
+
font-family: var(--zonos--font-family, Inter), Inter;
|
|
8
|
+
}
|
|
9
|
+
:host img {
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
}
|
|
12
|
+
:host dl,
|
|
13
|
+
:host dd,
|
|
14
|
+
:host h1,
|
|
15
|
+
:host h2,
|
|
16
|
+
:host h3,
|
|
17
|
+
:host h4,
|
|
18
|
+
:host h5,
|
|
19
|
+
:host h6,
|
|
20
|
+
:host hr,
|
|
21
|
+
:host figure,
|
|
22
|
+
:host p,
|
|
23
|
+
:host pre {
|
|
24
|
+
margin: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* All sets of variable are here */
|
|
28
|
+
/* smooth font rendering */
|
|
29
|
+
:host {
|
|
30
|
+
-moz-osx-font-smoothing: grayscale;
|
|
31
|
+
-webkit-font-smoothing: antialiased;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host {
|
|
35
|
+
display: block;
|
|
36
|
+
margin-bottom: var(--zonos-elements-font-size-xl);
|
|
37
|
+
}
|
|
38
|
+
:host .zonos--store-credit-container {
|
|
39
|
+
background: linear-gradient(180deg, var(--zonos-elements-gray-0) 0%, var(--zonos-elements-gray-50) 100%);
|
|
40
|
+
border: 1px solid var(--zonos-elements-gray-200);
|
|
41
|
+
border-radius: var(--zonos--border-radius, var(--zonos-elements-radius-8));
|
|
42
|
+
box-shadow: var(--zonos-elements-v3-shadow-base);
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
padding: 0;
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
:host .zonos--store-credit-container::before {
|
|
48
|
+
background: var(--zonos--primary-color, var(--zonos-elements-gray-400));
|
|
49
|
+
content: "";
|
|
50
|
+
height: 3px;
|
|
51
|
+
left: 0;
|
|
52
|
+
position: absolute;
|
|
53
|
+
right: 0;
|
|
54
|
+
top: 0;
|
|
55
|
+
}
|
|
56
|
+
:host .zonos--store-credit-header {
|
|
57
|
+
padding: var(--zonos-elements-radius-12) var(--zonos-elements-font-size-l) 0;
|
|
58
|
+
}
|
|
59
|
+
:host .zonos--store-credit-title-row {
|
|
60
|
+
align-items: center;
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
}
|
|
64
|
+
:host .zonos--store-credit-title-left {
|
|
65
|
+
align-items: center;
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: var(--zonos-elements-font-size-s);
|
|
68
|
+
}
|
|
69
|
+
:host .zonos--store-credit-title-icon {
|
|
70
|
+
align-items: center;
|
|
71
|
+
background: color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 14%, transparent);
|
|
72
|
+
border-radius: calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.75);
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-shrink: 0;
|
|
75
|
+
height: 22px;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
width: 22px;
|
|
78
|
+
}
|
|
79
|
+
:host .zonos--store-credit-balance-badge {
|
|
80
|
+
background: color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 8%, var(--zonos-elements-gray-50));
|
|
81
|
+
border: 1px solid color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 22%, var(--zonos-elements-gray-200));
|
|
82
|
+
border-radius: calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);
|
|
83
|
+
padding: 2px var(--zonos-elements-font-size-s);
|
|
84
|
+
}
|
|
85
|
+
:host .zonos--store-credit-content {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
gap: var(--zonos-elements-font-size-s);
|
|
89
|
+
padding: var(--zonos-elements-font-size-s) var(--zonos-elements-font-size-l) var(--zonos-elements-radius-12);
|
|
90
|
+
}
|
|
91
|
+
:host .zonos--store-credit-checkbox {
|
|
92
|
+
align-items: center;
|
|
93
|
+
display: flex;
|
|
94
|
+
}
|
|
95
|
+
:host .zonos--store-credit-options {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
gap: var(--zonos-elements-font-size-s);
|
|
99
|
+
}
|
|
100
|
+
:host .zonos--store-credit-toggle-row {
|
|
101
|
+
display: flex;
|
|
102
|
+
}
|
|
103
|
+
:host .zonos--store-credit-custom-amount {
|
|
104
|
+
max-width: 240px;
|
|
105
|
+
}
|
|
106
|
+
:host .zonos--store-credit-custom-amount-row {
|
|
107
|
+
align-items: flex-end;
|
|
108
|
+
display: flex;
|
|
109
|
+
gap: var(--zonos-elements-font-size-s);
|
|
110
|
+
}
|
|
111
|
+
:host .zonos--store-credit-custom-amount-row zonos-input {
|
|
112
|
+
flex: 1;
|
|
113
|
+
}
|
|
114
|
+
:host .zonos--store-credit-error {
|
|
115
|
+
margin-top: 2px;
|
|
116
|
+
}
|
|
117
|
+
:host .zonos--store-credit-summary {
|
|
118
|
+
background: color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 6%, var(--zonos-elements-gray-50));
|
|
119
|
+
border-radius: calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);
|
|
120
|
+
padding: var(--zonos-elements-radius-10) var(--zonos-elements-font-size-s);
|
|
121
|
+
}
|
|
122
|
+
:host .zonos--store-credit-empty {
|
|
123
|
+
align-items: center;
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: var(--zonos-elements-font-size-s);
|
|
127
|
+
padding: var(--zonos-elements-font-size-xl) var(--zonos-elements-font-size-l) 22px;
|
|
128
|
+
text-align: center;
|
|
129
|
+
}
|
|
130
|
+
:host .zonos--store-credit-empty-icon {
|
|
131
|
+
align-items: center;
|
|
132
|
+
background: var(--zonos-elements-gray-100);
|
|
133
|
+
border-radius: 50%;
|
|
134
|
+
display: flex;
|
|
135
|
+
height: 52px;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
opacity: 0.95;
|
|
138
|
+
width: 52px;
|
|
139
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Fragment, h, Host, } from "@stencil/core";
|
|
2
|
+
import { cartStoreUpdateStoreCredit } from "../../../../store/checkout/cart";
|
|
3
|
+
import { storeCreditStore, storeCreditStoreGetEffectiveAmount, storeCreditStoreRefreshBalance, storeCreditStoreSetAmount, storeCreditStoreSetEnabled, storeCreditStoreSetUseFullBalance, } from "../../../../store/checkout/storeCredit";
|
|
4
|
+
import { translate } from "../../../../store/translationStore";
|
|
5
|
+
import { zonosStore, zonosStoreFontFamily, } from "../../../../store/zonosStore";
|
|
6
|
+
import { renderCheckoutCurrency } from "../../../../utils/checkout/renderCheckoutCurrency";
|
|
7
|
+
import { getBorderRadius } from "../../../../utils/getBorderRadius";
|
|
8
|
+
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
9
|
+
import StoreCreditIcon from "./assets/StoreCreditIcon.svg";
|
|
10
|
+
const AMOUNT_MODE_FULL = 'full';
|
|
11
|
+
const AMOUNT_MODE_CUSTOM = 'custom';
|
|
12
|
+
export class ZonosStoreCredit {
|
|
13
|
+
constructor() {
|
|
14
|
+
/**
|
|
15
|
+
* Whether the component is enabled
|
|
16
|
+
*/
|
|
17
|
+
this.enabled = true;
|
|
18
|
+
/**
|
|
19
|
+
* Local state for custom amount input
|
|
20
|
+
*/
|
|
21
|
+
this.customAmountInput = '';
|
|
22
|
+
this.handleUseStoreCreditChange = (checked) => {
|
|
23
|
+
storeCreditStoreSetEnabled(checked);
|
|
24
|
+
if (checked) {
|
|
25
|
+
// Enable store credit usage with full balance by default
|
|
26
|
+
storeCreditStoreSetUseFullBalance(true);
|
|
27
|
+
}
|
|
28
|
+
void cartStoreUpdateStoreCredit();
|
|
29
|
+
};
|
|
30
|
+
this.handleAmountModeChange = (mode) => {
|
|
31
|
+
const isFullBalance = mode === AMOUNT_MODE_FULL;
|
|
32
|
+
storeCreditStoreSetUseFullBalance(isFullBalance);
|
|
33
|
+
if (!isFullBalance) {
|
|
34
|
+
this.customAmountInput = '';
|
|
35
|
+
}
|
|
36
|
+
void cartStoreUpdateStoreCredit();
|
|
37
|
+
};
|
|
38
|
+
this.handleCustomAmountChange = (value) => {
|
|
39
|
+
this.customAmountInput = value;
|
|
40
|
+
// Clear error when user types
|
|
41
|
+
storeCreditStore.error = null;
|
|
42
|
+
};
|
|
43
|
+
this.handleApplyCustomAmount = () => {
|
|
44
|
+
const amount = parseFloat(this.customAmountInput);
|
|
45
|
+
if (!isNaN(amount) && amount > 0) {
|
|
46
|
+
storeCreditStoreSetAmount(amount);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
storeCreditStoreSetAmount(null);
|
|
50
|
+
}
|
|
51
|
+
if (!storeCreditStore.error) {
|
|
52
|
+
void cartStoreUpdateStoreCredit();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async componentWillLoad() {
|
|
57
|
+
await storeCreditStoreRefreshBalance();
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
60
|
+
if (!this.enabled) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const { colorPrimary } = zonosStore.appearance;
|
|
64
|
+
const borderRadius = getBorderRadius({});
|
|
65
|
+
const availableBalance = storeCreditStore.availableBalance;
|
|
66
|
+
const hasBalance = availableBalance !== null && availableBalance > 0;
|
|
67
|
+
const isUsingStoreCredit = storeCreditStore.isEnabled;
|
|
68
|
+
const useFullBalance = storeCreditStore.useFullBalance;
|
|
69
|
+
const error = storeCreditStore.error;
|
|
70
|
+
const effectiveAmount = storeCreditStoreGetEffectiveAmount();
|
|
71
|
+
const formattedBalance = renderCheckoutCurrency({
|
|
72
|
+
amount: availableBalance !== null && availableBalance !== void 0 ? availableBalance : 0,
|
|
73
|
+
isForeign: true,
|
|
74
|
+
});
|
|
75
|
+
return (h(Host, { class: "zonos--elements zonos--store-credit", style: {
|
|
76
|
+
'--zonos--border-radius': borderRadius,
|
|
77
|
+
'--zonos--font-family': zonosStoreFontFamily(),
|
|
78
|
+
'--zonos--primary-color': colorPrimary,
|
|
79
|
+
} }, h("div", { class: "zonos--store-credit-container" }, h("div", { class: "zonos--store-credit-header" }, h("div", { class: "zonos--store-credit-title-row" }, h("div", { class: "zonos--store-credit-title-left" }, h("div", { "aria-hidden": "true", class: "zonos--store-credit-title-icon" }, h("zonos-icon", { content: StoreCreditIcon, iconColor: 'gray-500', size: 22 })), h("zonos-text", { type: "semiBoldLabel" }, translate('Store credit'))), hasBalance && (h("div", { class: "zonos--store-credit-balance-badge" }, h("zonos-text", { textColor: "gray-600", type: "caption" }, formattedBalance))))), h(Fragment, null, hasBalance ? (h("div", { class: "zonos--store-credit-content" }, h("div", { class: "zonos--store-credit-checkbox" }, h("zonos-checkbox", { isChecked: isUsingStoreCredit, label: translate('Use store credit'), onCheckboxSelected: e => this.handleUseStoreCreditChange(e.detail), size: 16 })), isUsingStoreCredit && (h("div", { class: "zonos--store-credit-options" }, h("div", { class: "zonos--store-credit-toggle-row" }, h("zonos-toggle", { onToggleChanged: e => this.handleAmountModeChange(e.detail), options: [
|
|
80
|
+
{
|
|
81
|
+
label: translate('Apply full balance'),
|
|
82
|
+
value: AMOUNT_MODE_FULL,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: translate('Enter amount'),
|
|
86
|
+
value: AMOUNT_MODE_CUSTOM,
|
|
87
|
+
},
|
|
88
|
+
], value: useFullBalance ? AMOUNT_MODE_FULL : AMOUNT_MODE_CUSTOM })), !useFullBalance && (h("div", { class: "zonos--store-credit-custom-amount" }, h("div", { class: "zonos--store-credit-custom-amount-row" }, h("zonos-input", { inputLabel: translate('Enter amount'), inputValue: this.customAmountInput, isError: !!error, onInputChange: e => this.handleCustomAmountChange(e.detail) }), h("zonos-button", { onClick: this.handleApplyCustomAmount, size: "sm", variant: "primary" }, translate('Apply'))))), error && (h("div", { class: "zonos--store-credit-error" }, h("zonos-text", { textColor: "red-600", type: "caption" }, error))), h("div", { class: "zonos--store-credit-summary" }, h("zonos-text", { textColor: "gray-800", type: "semiBoldLabel" }, translate('Amount to apply: [amount]', {
|
|
89
|
+
amount: renderCheckoutCurrency({
|
|
90
|
+
amount: effectiveAmount,
|
|
91
|
+
isForeign: true,
|
|
92
|
+
}),
|
|
93
|
+
}))))))) : (h("div", { class: "zonos--store-credit-empty" }, h("div", { "aria-hidden": "true", class: "zonos--store-credit-empty-icon" }, h("zonos-icon", { content: StoreCreditIcon, iconColor: "gray-500", size: 28 })), h("zonos-text", { textColor: "gray-600", type: "caption" }, translate('No store credit available'))))))));
|
|
94
|
+
}
|
|
95
|
+
static get is() { return "zonos-store-credit"; }
|
|
96
|
+
static get encapsulation() { return "shadow"; }
|
|
97
|
+
static get originalStyleUrls() {
|
|
98
|
+
return {
|
|
99
|
+
"$": ["zonos-store-credit.scss"]
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
static get styleUrls() {
|
|
103
|
+
return {
|
|
104
|
+
"$": ["zonos-store-credit.css"]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
static get properties() {
|
|
108
|
+
return {
|
|
109
|
+
"enabled": {
|
|
110
|
+
"type": "boolean",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "boolean",
|
|
114
|
+
"resolved": "boolean",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": "Whether the component is enabled"
|
|
122
|
+
},
|
|
123
|
+
"getter": false,
|
|
124
|
+
"setter": false,
|
|
125
|
+
"attribute": "enabled",
|
|
126
|
+
"reflect": false,
|
|
127
|
+
"defaultValue": "true"
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
static get states() {
|
|
132
|
+
return {
|
|
133
|
+
"customAmountInput": {}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
static get elementRef() { return "el"; }
|
|
137
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, h, Host, } from "@stencil/core";
|
|
2
2
|
import { cartStore, cartStoreClearCheckoutInterval, cartStoreNextStep, cartStoreOnChange, cartStoreReset, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateToErrorState, } from "../../store/checkout/cart";
|
|
3
3
|
import { paypalInitScript, paypalStore, paypalStoreHasPaypalEnabled, } from "../../store/checkout/paypal";
|
|
4
|
+
import { storeCreditStoreApplyCredit, storeCreditStoreCoversFullAmount, storeCreditStoreCreateOrder, storeCreditStoreGetEffectiveAmount, } from "../../store/checkout/storeCredit";
|
|
4
5
|
import { getCheckoutSessionBody, initStripeElements, stripeStore, stripeStoreCleanupDomesticShippingSession, stripeStoreConfirmPayment, stripeStoreGetPaymentIntent, stripeStoreHandleInventoryCheck, stripeStoreHandleInventoryRefund, stripeStoreInitCheckoutSession, stripeStorePrefetchLandedCost, stripeStoreReset, stripeStoreRetrievePayment, stripeStoreUpdateCheckoutSessionBaseCurrency, } from "../../store/checkout/stripe";
|
|
5
6
|
import { localizationStore, localizationStoreOnChange, } from "../../store/hello/localization";
|
|
6
7
|
import { storageStore, storageStoreSetEnabledVariantTestKeys, VARIANT_TEST_KEY_EXPIRATION, } from "../../store/storageStore";
|
|
@@ -36,6 +37,7 @@ import { sendLoadNativeCheckoutLog } from "../../utils/logging/sendLoadNativeChe
|
|
|
36
37
|
import { mergeConfig } from "../../utils/mergeConfig";
|
|
37
38
|
import { styles } from "../../utils/styles";
|
|
38
39
|
import { submitGtag } from "../../utils/submitGtag";
|
|
40
|
+
import { validateCheckoutSession } from "../../utils/validateCheckoutSession";
|
|
39
41
|
import { filterExpiredTests } from "../../utils/varianceTest/filterExpiredTests";
|
|
40
42
|
import { getSelectedTestVariant } from "../../utils/varianceTest/getSelectedTestVariant";
|
|
41
43
|
import { isTestEnabled } from "../../utils/varianceTest/isTestEnabl";
|
|
@@ -1232,6 +1234,55 @@ export class ZonosCheckout {
|
|
|
1232
1234
|
this.submitLoading = false;
|
|
1233
1235
|
return;
|
|
1234
1236
|
}
|
|
1237
|
+
// Apply store credit if customer has selected an amount
|
|
1238
|
+
const storeCreditAmount = storeCreditStoreGetEffectiveAmount();
|
|
1239
|
+
if (storeCreditAmount > 0) {
|
|
1240
|
+
const storeCreditResult = await storeCreditStoreApplyCredit();
|
|
1241
|
+
if (!storeCreditResult.success) {
|
|
1242
|
+
stripeStore.hasPaymentError = true;
|
|
1243
|
+
stripeStore.customErrorMessage =
|
|
1244
|
+
storeCreditResult.error ||
|
|
1245
|
+
translate('Unable to apply store credit. Please try again.');
|
|
1246
|
+
this.submitLoading = false;
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
// If store credit covers the full order, create order directly without payment
|
|
1251
|
+
if (storeCreditStoreCoversFullAmount()) {
|
|
1252
|
+
try {
|
|
1253
|
+
// Validate checkout session (landed cost ID, etc.) before creating order
|
|
1254
|
+
const checkoutSessionStatus = await validateCheckoutSession();
|
|
1255
|
+
if (!checkoutSessionStatus.valid) {
|
|
1256
|
+
stripeStore.hasPaymentError = true;
|
|
1257
|
+
stripeStore.customErrorMessage = checkoutSessionStatus.errorMessage;
|
|
1258
|
+
this.submitLoading = false;
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
const orderResult = await storeCreditStoreCreateOrder();
|
|
1262
|
+
if (!orderResult.success) {
|
|
1263
|
+
stripeStore.hasPaymentError = true;
|
|
1264
|
+
stripeStore.customErrorMessage =
|
|
1265
|
+
orderResult.error ||
|
|
1266
|
+
translate('Unable to place order with store credit. Please try again.');
|
|
1267
|
+
this.submitLoading = false;
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
cartStoreNextStep();
|
|
1271
|
+
cartStoreClearCheckoutInterval();
|
|
1272
|
+
}
|
|
1273
|
+
catch (err) {
|
|
1274
|
+
logError(err);
|
|
1275
|
+
submitGtag({
|
|
1276
|
+
event: 'zonos-checkout-payment-fail',
|
|
1277
|
+
metadata: {
|
|
1278
|
+
checkoutSessionId: storageStore.checkoutSessionId,
|
|
1279
|
+
},
|
|
1280
|
+
});
|
|
1281
|
+
stripeStore.hasPaymentError = true;
|
|
1282
|
+
}
|
|
1283
|
+
this.submitLoading = false;
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1235
1286
|
try {
|
|
1236
1287
|
await stripeStoreConfirmPayment();
|
|
1237
1288
|
cartStoreNextStep();
|
|
@@ -1842,7 +1893,7 @@ export class ZonosCheckout {
|
|
|
1842
1893
|
"signature": "(session: CheckoutSessionDetailsFragment) => Promise<void>",
|
|
1843
1894
|
"parameters": [{
|
|
1844
1895
|
"name": "session",
|
|
1845
|
-
"type": "{ cartId: string | null; clientSecret: string; completedAt: string | null; customerProfile: { email: string | null; locations: { administrativeArea: string; countryCode: CountryCode; email: string | null; line1: string; line2: string | null;
|
|
1896
|
+
"type": "{ cartId: string | null; clientSecret: string; completedAt: string | null; customerProfile: { email: string | null; locations: { administrativeArea: string; countryCode: CountryCode; email: string | null; line1: string; line2: string | null; name: string | null; phone: string | null; locality: string; postalCode: string; }[] | null; name: string | null; storeCreditBalance: number | null; } | null; customerSessionClientSecret: string | null; id: string; landedCost: { amountSubtotals: { discounts: number | null; duties: number; fees: number; items: number; landedCostTotal: number; shipping: number; taxes: number; } | null; appliedAdjustments: { adjustment: { name: string | null; source: AdjustmentSource | null; } | null; amount: number; type: LandedCostAdjustmentType | null; item: { amount: number; } | null; }[] | null; currencyCode: CurrencyCode; deMinimis: { type: DeMinimisType; threshold: DeMinimisThreshold; method: IncotermCode; note: string; formula: string; }[]; duties: { amount: number; currencyCode: CurrencyCode; }[]; fees: { amount: number; currencyCode: CurrencyCode; }[]; landedCostGuaranteeCode: LandedCostGuaranteeCode; id: string; method: IncotermCode; remittance: { amount: number; description: string; }[]; rootId: string; shipmentRating: { amount: number; currencyCode: CurrencyCode; displayName: string; id: string; shippingProfile: { serviceLevel: { code: string; }; transitTime: { guaranteedDelivery: string | null; max: number | null; min: number | null; type: TransitTypeCode | null; } | null; } | null; }; taxes: { amount: number; currencyCode: CurrencyCode; }[]; } | null; metadata: ({ key: string; value: string; } | null)[] | null; organizationId: string; references: { inclusivePriceConfigurationId: string | null; } | null; subtotals: { adjustments: number; duties: number; exchangeRate: { id: string; rate: number; sourceCurrencyCode: CurrencyCode; targetCurrencyCode: CurrencyCode; type: ExchangeRateType; }; fees: number; items: number; landedCostTotal: number; presentmentCurrencyCode: CurrencyCode; shipping: number; storeCredit: number; taxes: number; total: number; }; varianceTestResults: { selectedVariantKey: string; testKey: string; }[] | null; }",
|
|
1846
1897
|
"docs": ""
|
|
1847
1898
|
}],
|
|
1848
1899
|
"references": {
|
|
@@ -71,7 +71,6 @@
|
|
|
71
71
|
padding: 8px 24px;
|
|
72
72
|
color: var(--zonos--color, var(--zonos-elements-gray-1000));
|
|
73
73
|
margin: 1px;
|
|
74
|
-
/** Button size */
|
|
75
74
|
}
|
|
76
75
|
:host button:not([disabled]):hover {
|
|
77
76
|
background-image: var(--zonos-elements-button-standard-hover);
|
|
@@ -105,6 +104,9 @@
|
|
|
105
104
|
:host button:active {
|
|
106
105
|
transform: scale(0.99);
|
|
107
106
|
}
|
|
107
|
+
:host button {
|
|
108
|
+
/** Button size */
|
|
109
|
+
}
|
|
108
110
|
:host button.sm {
|
|
109
111
|
height: var(--zonos-elements-size-sm);
|
|
110
112
|
line-height: var(--zonos-elements-size-sm);
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
|
|
34
34
|
:host {
|
|
35
35
|
margin: 1px;
|
|
36
|
-
/**disabled state */
|
|
37
36
|
}
|
|
38
37
|
:host .zonos--label-wrapper {
|
|
39
38
|
position: relative;
|
|
@@ -132,6 +131,9 @@
|
|
|
132
131
|
bottom: 0;
|
|
133
132
|
border-radius: var(--zonos--border-radius);
|
|
134
133
|
}
|
|
134
|
+
:host {
|
|
135
|
+
/**disabled state */
|
|
136
|
+
}
|
|
135
137
|
:host .disabled .zonos--floated-label {
|
|
136
138
|
pointer-events: inherit;
|
|
137
139
|
}
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
|
|
50
50
|
:host {
|
|
51
51
|
margin: 1px;
|
|
52
|
-
/**disabled state */
|
|
53
52
|
}
|
|
54
53
|
:host .zonos--label-wrapper {
|
|
55
54
|
position: relative;
|
|
@@ -150,6 +149,9 @@
|
|
|
150
149
|
bottom: 0;
|
|
151
150
|
border-radius: var(--zonos--border-radius);
|
|
152
151
|
}
|
|
152
|
+
:host {
|
|
153
|
+
/**disabled state */
|
|
154
|
+
}
|
|
153
155
|
:host .disabled .zonos--floated-label {
|
|
154
156
|
pointer-events: inherit;
|
|
155
157
|
}
|
package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js
CHANGED
|
@@ -259,7 +259,7 @@ export class ZonosStripePhoneInput {
|
|
|
259
259
|
"mutable": false,
|
|
260
260
|
"complexType": {
|
|
261
261
|
"original": "GenericZonosSettings['countryFields'] | null",
|
|
262
|
-
"resolved": "null | undefined | { AD: CountryFields; AE: CountryFields; AF: CountryFields; AG: CountryFields; AI: CountryFields; AL: CountryFields; AM: CountryFields; AO: CountryFields; AQ: CountryFields; AR: CountryFields; AS: CountryFields; AT: CountryFields; AU: CountryFields; AW: CountryFields; AX: CountryFields; AZ: CountryFields; BA: CountryFields; BB: CountryFields; BD: CountryFields; BE: CountryFields; BF: CountryFields; BG: CountryFields; BH: CountryFields; BI: CountryFields; BJ: CountryFields; BL: CountryFields; BM: CountryFields; BN: CountryFields; BO: CountryFields; BQ: CountryFields; BR: CountryFields; BS: CountryFields; BT: CountryFields; BV: CountryFields; BW: CountryFields; BY: CountryFields; BZ: CountryFields; CA: CountryFields;
|
|
262
|
+
"resolved": "null | undefined | { CC: CountryFields; TO: CountryFields; AD: CountryFields; AE: CountryFields; AF: CountryFields; AG: CountryFields; AI: CountryFields; AL: CountryFields; AM: CountryFields; AO: CountryFields; AQ: CountryFields; AR: CountryFields; AS: CountryFields; AT: CountryFields; AU: CountryFields; AW: CountryFields; AX: CountryFields; AZ: CountryFields; BA: CountryFields; BB: CountryFields; BD: CountryFields; BE: CountryFields; BF: CountryFields; BG: CountryFields; BH: CountryFields; BI: CountryFields; BJ: CountryFields; BL: CountryFields; BM: CountryFields; BN: CountryFields; BO: CountryFields; BQ: CountryFields; BR: CountryFields; BS: CountryFields; BT: CountryFields; BV: CountryFields; BW: CountryFields; BY: CountryFields; BZ: CountryFields; CA: CountryFields; CD: CountryFields; CF: CountryFields; CG: CountryFields; CH: CountryFields; CI: CountryFields; CK: CountryFields; CL: CountryFields; CM: CountryFields; CN: CountryFields; CO: CountryFields; CR: CountryFields; CU: CountryFields; CV: CountryFields; CW: CountryFields; CX: CountryFields; CY: CountryFields; CZ: CountryFields; DE: CountryFields; DJ: CountryFields; DK: CountryFields; DM: CountryFields; DO: CountryFields; DZ: CountryFields; EC: CountryFields; EE: CountryFields; EG: CountryFields; EH: CountryFields; ER: CountryFields; ES: CountryFields; ET: CountryFields; FI: CountryFields; FJ: CountryFields; FK: CountryFields; FM: CountryFields; FO: CountryFields; FR: CountryFields; GA: CountryFields; GB: CountryFields; GD: CountryFields; GE: CountryFields; GF: CountryFields; GG: CountryFields; GH: CountryFields; GI: CountryFields; GL: CountryFields; GM: CountryFields; GN: CountryFields; GP: CountryFields; GQ: CountryFields; GR: CountryFields; GS: CountryFields; GT: CountryFields; GU: CountryFields; GW: CountryFields; GY: CountryFields; HK: CountryFields; HM: CountryFields; HN: CountryFields; HR: CountryFields; HT: CountryFields; HU: CountryFields; IC: CountryFields; ID: CountryFields; IE: CountryFields; IL: CountryFields; IM: CountryFields; IN: CountryFields; IO: CountryFields; IQ: CountryFields; IR: CountryFields; IS: CountryFields; IT: CountryFields; JE: CountryFields; JM: CountryFields; JO: CountryFields; JP: CountryFields; KE: CountryFields; KG: CountryFields; KH: CountryFields; KI: CountryFields; KM: CountryFields; KN: CountryFields; KP: CountryFields; KR: CountryFields; KW: CountryFields; KY: CountryFields; KZ: CountryFields; LA: CountryFields; LB: CountryFields; LC: CountryFields; LI: CountryFields; LK: CountryFields; LR: CountryFields; LS: CountryFields; LT: CountryFields; LU: CountryFields; LV: CountryFields; LY: CountryFields; MA: CountryFields; MC: CountryFields; MD: CountryFields; ME: CountryFields; MF: CountryFields; MG: CountryFields; MH: CountryFields; MK: CountryFields; ML: CountryFields; MM: CountryFields; MN: CountryFields; MO: CountryFields; MP: CountryFields; MQ: CountryFields; MR: CountryFields; MS: CountryFields; MT: CountryFields; MU: CountryFields; MV: CountryFields; MW: CountryFields; MX: CountryFields; MY: CountryFields; MZ: CountryFields; NA: CountryFields; NC: CountryFields; NE: CountryFields; NF: CountryFields; NG: CountryFields; NI: CountryFields; NL: CountryFields; NO: CountryFields; NP: CountryFields; NR: CountryFields; NU: CountryFields; NZ: CountryFields; OM: CountryFields; PA: CountryFields; PE: CountryFields; PF: CountryFields; PG: CountryFields; PH: CountryFields; PK: CountryFields; PL: CountryFields; PM: CountryFields; PN: CountryFields; PR: CountryFields; PS: CountryFields; PT: CountryFields; PW: CountryFields; PY: CountryFields; QA: CountryFields; RE: CountryFields; RO: CountryFields; RS: CountryFields; RU: CountryFields; RW: CountryFields; SA: CountryFields; SB: CountryFields; SC: CountryFields; SD: CountryFields; SE: CountryFields; SG: CountryFields; SH: CountryFields; SI: CountryFields; SJ: CountryFields; SK: CountryFields; SL: CountryFields; SM: CountryFields; SN: CountryFields; SO: CountryFields; SR: CountryFields; SS: CountryFields; ST: CountryFields; SV: CountryFields; SX: CountryFields; SY: CountryFields; SZ: CountryFields; TC: CountryFields; TD: CountryFields; TF: CountryFields; TG: CountryFields; TH: CountryFields; TJ: CountryFields; TK: CountryFields; TL: CountryFields; TM: CountryFields; TN: CountryFields; TR: CountryFields; TT: CountryFields; TV: CountryFields; TW: CountryFields; TZ: CountryFields; UA: CountryFields; UG: CountryFields; UM: CountryFields; US: CountryFields; UY: CountryFields; UZ: CountryFields; VA: CountryFields; VC: CountryFields; VE: CountryFields; VG: CountryFields; VI: CountryFields; VN: CountryFields; VU: CountryFields; WF: CountryFields; WS: CountryFields; YE: CountryFields; YT: CountryFields; ZA: CountryFields; ZM: CountryFields; ZW: CountryFields; }",
|
|
263
263
|
"references": {
|
|
264
264
|
"GenericZonosSettings": {
|
|
265
265
|
"location": "import",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
margin: 1px;
|
|
52
52
|
position: relative;
|
|
53
53
|
min-width: var(--zonos--min-width, unset);
|
|
54
|
-
/**disabled state */
|
|
55
54
|
}
|
|
56
55
|
:host .zonos--label-wrapper {
|
|
57
56
|
position: relative;
|
|
@@ -152,6 +151,9 @@
|
|
|
152
151
|
color: var(--zonos-elements-gray-800);
|
|
153
152
|
z-index: 1;
|
|
154
153
|
}
|
|
154
|
+
:host {
|
|
155
|
+
/**disabled state */
|
|
156
|
+
}
|
|
155
157
|
:host .disabled .zonos--floated-label {
|
|
156
158
|
pointer-events: inherit;
|
|
157
159
|
}
|
|
@@ -602,7 +602,7 @@ export class ZonosController {
|
|
|
602
602
|
"signature": "(countryCode: CountryCode) => Promise<void>",
|
|
603
603
|
"parameters": [{
|
|
604
604
|
"name": "countryCode",
|
|
605
|
-
"type": "\"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"
|
|
605
|
+
"type": "\"CC\" | \"TO\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CD\" | \"CF\" | \"CG\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"IC\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\"",
|
|
606
606
|
"docs": ""
|
|
607
607
|
}],
|
|
608
608
|
"references": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createStore } from "@stencil/store";
|
|
2
|
+
import { storeCreditStoreGetInput, storeCreditStoreReset, storeCreditStoreSetBalanceFromSession, } from "./storeCredit";
|
|
2
3
|
import { stripeStore, stripeStoreInitCheckoutSession, stripeStoreReset, stripeStoreUpdateCheckoutSession, } from "./stripe";
|
|
3
4
|
import { localizationStore } from "../hello/localization";
|
|
4
5
|
import { storageStore, storageStoreSetEnabledVariantTestKeys, } from "../storageStore";
|
|
@@ -46,6 +47,7 @@ const { onChange: cartStoreOnChange, reset, state: cartStore, } = createStore(()
|
|
|
46
47
|
shippingData: null,
|
|
47
48
|
shouldHideDiscountInput: false,
|
|
48
49
|
step: 'customer-info',
|
|
50
|
+
storeCredit: 0,
|
|
49
51
|
subtotal: 0,
|
|
50
52
|
tabItems: {
|
|
51
53
|
'customer-info': {
|
|
@@ -134,8 +136,16 @@ const cartStoreCheckItemRestrictions = (itemsWorkflow) => {
|
|
|
134
136
|
restrictedItems: mappedRestrictedItems,
|
|
135
137
|
};
|
|
136
138
|
};
|
|
139
|
+
let storeCreditUpdateTimeout = null;
|
|
137
140
|
const cartStoreReset = () => {
|
|
138
141
|
storageStore.checkoutSessionId = null;
|
|
142
|
+
// clear pending store credit debounce timer
|
|
143
|
+
if (storeCreditUpdateTimeout) {
|
|
144
|
+
clearTimeout(storeCreditUpdateTimeout);
|
|
145
|
+
storeCreditUpdateTimeout = null;
|
|
146
|
+
}
|
|
147
|
+
// reset store credit store
|
|
148
|
+
storeCreditStoreReset();
|
|
139
149
|
// reset cart store
|
|
140
150
|
reset();
|
|
141
151
|
};
|
|
@@ -149,11 +159,13 @@ const cartStoreUpdateToErrorState = ({ messages, title, }) => {
|
|
|
149
159
|
};
|
|
150
160
|
};
|
|
151
161
|
const cartStoreApplySubtotals = ({ dutiesTaxesFeesEstimate, method, subtotals, }) => {
|
|
162
|
+
var _a;
|
|
152
163
|
// update exchange rate so we can use it to display cart items
|
|
153
164
|
cartStore.exchangeRate = subtotals.exchangeRate;
|
|
154
165
|
cartStore.adjustmentTotal = subtotals.adjustments;
|
|
155
166
|
cartStore.dutiesTaxesFees =
|
|
156
167
|
method === 'DAP' ? null : subtotals.landedCostTotal;
|
|
168
|
+
cartStore.storeCredit = (_a = subtotals.storeCredit) !== null && _a !== void 0 ? _a : 0;
|
|
157
169
|
cartStore.subtotal = subtotals.items;
|
|
158
170
|
cartStore.total = subtotals.total;
|
|
159
171
|
cartStore.currency = subtotals.presentmentCurrencyCode;
|
|
@@ -170,13 +182,15 @@ const cartStoreHasOneEligibleItem = () => {
|
|
|
170
182
|
return !!checkItems.find(item => !item.isRestricted);
|
|
171
183
|
};
|
|
172
184
|
const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
173
|
-
var _a, _b, _c, _d, _e;
|
|
185
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
174
186
|
// update stripe store with updated information
|
|
175
187
|
stripeStore.clientSecret = checkoutSession.clientSecret;
|
|
176
188
|
stripeStore.stripeCustomerSessionClientSecret =
|
|
177
189
|
checkoutSession.customerSessionClientSecret;
|
|
178
190
|
stripeStore.customerProfile = checkoutSession.customerProfile;
|
|
179
191
|
cartStore.checkoutSession = checkoutSession;
|
|
192
|
+
// Populate store credit balance from checkout session customer profile
|
|
193
|
+
storeCreditStoreSetBalanceFromSession((_b = (_a = checkoutSession.customerProfile) === null || _a === void 0 ? void 0 : _a.storeCreditBalance) !== null && _b !== void 0 ? _b : null);
|
|
180
194
|
if (!checkoutSession.id) {
|
|
181
195
|
// Log error to track down the issue
|
|
182
196
|
void sendErrorLog({
|
|
@@ -196,10 +210,10 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
|
196
210
|
const availableSelectedVariantTestKeys = filterValidTests(checkoutSession.varianceTestResults || []);
|
|
197
211
|
storageStoreSetEnabledVariantTestKeys(availableSelectedVariantTestKeys);
|
|
198
212
|
// Check if there is a redirect URL in the metadata to override
|
|
199
|
-
const externalConfirmationPageURL = ((
|
|
213
|
+
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) ||
|
|
200
214
|
(
|
|
201
215
|
// Sometimes externalConfirmationPageURL is not in checkoutSession create/update, check if there is a redirect URL in the cart metadata to override
|
|
202
|
-
(
|
|
216
|
+
(_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) ||
|
|
203
217
|
null;
|
|
204
218
|
if (externalConfirmationPageURL) {
|
|
205
219
|
log(`Found externalConfirmationPageURL: ${externalConfirmationPageURL}`);
|
|
@@ -470,4 +484,48 @@ const cartStoreResetTabItems = () => {
|
|
|
470
484
|
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 }) });
|
|
471
485
|
cartStoreResetSelectedShippingOption();
|
|
472
486
|
};
|
|
473
|
-
|
|
487
|
+
const cartStoreUpdateStoreCreditImmediate = async () => {
|
|
488
|
+
var _a, _b;
|
|
489
|
+
if (!storageStore.checkoutSessionId) {
|
|
490
|
+
log('Could not update store credit without checkout session id', 'info');
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
const selectedLandedCost = cartStore.selectedLandedCost;
|
|
494
|
+
const currency = cartStore.currency || ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '';
|
|
495
|
+
const adjustmentsAmount = cartStore.adjustments.reduce((prev, adj) => prev + adj.amount, 0);
|
|
496
|
+
const itemsAmount = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
497
|
+
const { errors, json } = await stripeStoreUpdateCheckoutSession({
|
|
498
|
+
adjustmentsAmount,
|
|
499
|
+
cartId: window.Zonos.cartId,
|
|
500
|
+
currency,
|
|
501
|
+
id: storageStore.checkoutSessionId,
|
|
502
|
+
itemsAmount,
|
|
503
|
+
landedCostId: selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCostId,
|
|
504
|
+
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
505
|
+
storeCreditApplication: storeCreditStoreGetInput(),
|
|
506
|
+
});
|
|
507
|
+
if (errors.length > 0 || !json) {
|
|
508
|
+
logError('Error updating checkout session with store credit');
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
// Apply updated subtotals from the response
|
|
512
|
+
cartStoreApplySubtotals({
|
|
513
|
+
method: ((_b = json.checkoutSessionUpdate.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
|
|
514
|
+
subtotals: json.checkoutSessionUpdate.subtotals,
|
|
515
|
+
});
|
|
516
|
+
cartStoreSetCheckoutSession(json.checkoutSessionUpdate);
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* Update the checkout session with the current store credit selection.
|
|
520
|
+
* Debounced to prevent multiple rapid requests when store changes cascade.
|
|
521
|
+
*/
|
|
522
|
+
const cartStoreUpdateStoreCredit = () => {
|
|
523
|
+
if (storeCreditUpdateTimeout) {
|
|
524
|
+
clearTimeout(storeCreditUpdateTimeout);
|
|
525
|
+
}
|
|
526
|
+
storeCreditUpdateTimeout = setTimeout(() => {
|
|
527
|
+
storeCreditUpdateTimeout = null;
|
|
528
|
+
void cartStoreUpdateStoreCreditImmediate();
|
|
529
|
+
}, 300);
|
|
530
|
+
};
|
|
531
|
+
export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetMethod, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStoreOnChange, cartStorePreviousStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateStoreCredit, cartStoreUpdateToErrorState, };
|