@zonos/elements 1.1.1 → 1.1.2
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-108bc407.js → cart-a969ee0b.js} +8 -8
- package/dist/cjs/{cart-108bc407.js.map → cart-a969ee0b.js.map} +1 -1
- package/dist/cjs/{getBorderRadius-2904800c.js → getBorderRadius-ae52cae1.js} +2 -2
- package/dist/cjs/{getBorderRadius-2904800c.js.map → getBorderRadius-ae52cae1.js.map} +1 -1
- package/dist/cjs/{isDarkColor-a86b8a05.js → isDarkColor-e1a7bf45.js} +2 -2
- package/dist/cjs/{isDarkColor-a86b8a05.js.map → isDarkColor-e1a7bf45.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{localization-f6a1b679.js → localization-d510574c.js} +200 -12
- package/dist/cjs/localization-d510574c.js.map +1 -0
- package/dist/cjs/{submitGtag-b1b96579.js → submitGtag-4de4430f.js} +3 -3
- package/dist/cjs/{submitGtag-b1b96579.js.map → submitGtag-4de4430f.js.map} +1 -1
- package/dist/cjs/zonos-address_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-banner.cjs.entry.js +68 -0
- package/dist/cjs/zonos-banner.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-button_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-cart-items_10.cjs.entry.js +12 -12
- package/dist/cjs/zonos-checkout.cjs.entry.js +9 -9
- package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
- package/dist/cjs/zonos-controller.cjs.entry.js.map +1 -1
- package/dist/cjs/zonos-country-flag_4.cjs.entry.js +6 -6
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +12 -8
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +237 -22
- package/dist/cjs/zonos-hello.cjs.entry.js.map +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +60 -0
- package/dist/cjs/zonos-payment.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/{zonosStore-960e5542.js → zonosStore-d9cdaec6.js} +6 -22
- package/dist/cjs/zonosStore-d9cdaec6.js.map +1 -0
- package/dist/collection/components/checkout/zonos-checkout/assets/LeftArrow.svg +1 -1
- package/dist/collection/components/checkout/zonos-checkout/assets/MessageIcon.svg +1 -1
- package/dist/collection/components/checkout/zonos-checkout/assets/RemoveIcon.svg +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/assets/InfoIcon.svg +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/assets/RemoveIcon.svg +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/assets/SuccessIcon.svg +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/assets/ChevronDownIcon.svg +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/assets/ChevronUpIcon.svg +1 -1
- package/dist/collection/components/common/zonos-banner/zonos-banner.css +6 -1
- package/dist/collection/components/common/zonos-banner/zonos-banner.js +1 -1
- package/dist/collection/components/common/zonos-banner/zonos-banner.js.map +1 -1
- package/dist/collection/components/common/zonos-country-select/assets/arrowLeftBlue.svg +1 -1
- package/dist/collection/components/common/zonos-dialog/assets/removeIcon.svg +1 -1
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +1 -1
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js.map +1 -1
- package/dist/collection/components/hello/zonos-hello/zonos-hello.css +20 -2
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +135 -20
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js.map +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/assets/bagIcon.svg +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/assets/messageIcon.svg +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/assets/moneyIcon.svg +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/assets/removeIcon.svg +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/assets/chevronDownIcon.svg +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/assets/zonosIcon.svg +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.css +12 -4
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +30 -1
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js.map +1 -1
- package/dist/collection/components/store/hello/localization.js +2 -4
- package/dist/collection/components/store/hello/localization.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.arabic.js +9 -0
- package/dist/collection/components/store/translationStore/strings.arabic.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.base.js +9 -0
- package/dist/collection/components/store/translationStore/strings.base.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.chinese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.danish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.danish.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.dutch.js +9 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.french.js +9 -0
- package/dist/collection/components/store/translationStore/strings.french.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.german.js +9 -0
- package/dist/collection/components/store/translationStore/strings.german.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.hebrew.js +9 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.indonesian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.italian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.italian.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.japanese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.korean.js +9 -0
- package/dist/collection/components/store/translationStore/strings.korean.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.norwegian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.polish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.polish.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.portuguese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.russian.js +9 -0
- package/dist/collection/components/store/translationStore/strings.russian.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.spanish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.swedish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.turkish.js +9 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js.map +1 -1
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +9 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js.map +1 -1
- package/dist/collection/components/store/zonosStore.js +5 -3
- package/dist/collection/components/store/zonosStore.js.map +1 -1
- package/dist/collection/components/utils/api/checkItemRestrictions.js +18 -0
- package/dist/collection/components/utils/api/checkItemRestrictions.js.map +1 -0
- package/dist/collection/components/utils/hello/detectItemRestrictions.js +29 -0
- package/dist/collection/components/utils/hello/detectItemRestrictions.js.map +1 -0
- package/dist/collection/components/utils/hello/getCurrentHelloLocalePage.js +8 -7
- package/dist/collection/components/utils/hello/getCurrentHelloLocalePage.js.map +1 -1
- package/dist/collection/components/utils/hello/getProductsOnPage.js +49 -0
- package/dist/collection/components/utils/hello/getProductsOnPage.js.map +1 -0
- package/dist/collection/components/utils/hello/setZonosCountryUrlParam.js +10 -0
- package/dist/collection/components/utils/hello/setZonosCountryUrlParam.js.map +1 -0
- package/dist/collection/environment.js +34 -7
- package/dist/collection/environment.js.map +1 -1
- package/dist/collection/scripts/loadStripe.js +3 -3
- package/dist/collection/scripts/loadStripe.js.map +1 -1
- package/dist/collection/scripts/stripe.js +3 -3
- package/dist/collection/scripts/stripe.js.map +1 -1
- package/dist/collection/scripts/zonos.js +83 -30
- package/dist/collection/scripts/zonos.js.map +1 -1
- package/dist/collection/types/generated/graphql.customer.types.js +34 -0
- package/dist/collection/types/generated/graphql.customer.types.js.map +1 -1
- package/dist/collection/types/hello/HelloConfig.js.map +1 -1
- package/dist/collection/types/hello/Product.js +2 -0
- package/dist/collection/types/hello/Product.js.map +1 -0
- package/dist/collection/types/hello/RestrictedItem.js +2 -0
- package/dist/collection/types/hello/RestrictedItem.js.map +1 -0
- package/dist/components/localization.js +198 -11
- package/dist/components/localization.js.map +1 -1
- package/dist/components/stripe.js +3 -3
- package/dist/components/stripe.js.map +1 -1
- package/dist/components/zonos-banner2.js +2 -2
- package/dist/components/zonos-banner2.js.map +1 -1
- package/dist/components/zonos-cart-subtotal2.js +1 -1
- package/dist/components/zonos-checkout-finish2.js +2 -2
- package/dist/components/zonos-checkout.js +3 -3
- package/dist/components/zonos-controller.js +1 -1
- package/dist/components/zonos-controller.js.map +1 -1
- package/dist/components/zonos-country-select2.js +1 -1
- package/dist/components/zonos-dialog2.js +1 -1
- package/dist/components/zonos-hello-dialog-footer2.js +2 -2
- package/dist/components/zonos-hello-dialog2.js +18 -7
- package/dist/components/zonos-hello-dialog2.js.map +1 -1
- package/dist/components/zonos-hello.js +247 -22
- package/dist/components/zonos-hello.js.map +1 -1
- package/dist/components/zonos-review2.js +2 -2
- package/dist/components/zonos-shipping-rich-radio2.js +1 -1
- package/dist/components/zonos-shipping-rich-radio2.js.map +1 -1
- package/dist/components/zonosStore.js +5 -21
- package/dist/components/zonosStore.js.map +1 -1
- package/dist/{zonos-elements/cart-2f83e048.js → esm/cart-d00e1acb.js} +8 -8
- package/dist/esm/{cart-2f83e048.js.map → cart-d00e1acb.js.map} +1 -1
- package/dist/{zonos-elements/getBorderRadius-82fbaf25.js → esm/getBorderRadius-e8ad5967.js} +2 -2
- package/dist/esm/{getBorderRadius-82fbaf25.js.map → getBorderRadius-e8ad5967.js.map} +1 -1
- package/dist/{zonos-elements/isDarkColor-b21326ae.js → esm/isDarkColor-3bb345f4.js} +2 -2
- package/dist/{zonos-elements/isDarkColor-b21326ae.js.map → esm/isDarkColor-3bb345f4.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/{zonos-elements/localization-4a424f49.js → esm/localization-1d92a557.js} +200 -13
- package/dist/esm/localization-1d92a557.js.map +1 -0
- package/dist/{zonos-elements/submitGtag-fbdb454b.js → esm/submitGtag-85914088.js} +3 -3
- package/dist/esm/{submitGtag-fbdb454b.js.map → submitGtag-85914088.js.map} +1 -1
- package/dist/esm/zonos-address_2.entry.js +5 -5
- package/dist/esm/zonos-banner.entry.js +64 -0
- package/dist/esm/zonos-banner.entry.js.map +1 -0
- package/dist/esm/zonos-button_2.entry.js +3 -3
- package/dist/esm/zonos-cart-items_10.entry.js +12 -12
- package/dist/esm/zonos-checkout.entry.js +9 -9
- package/dist/esm/zonos-controller.entry.js +6 -6
- package/dist/esm/zonos-controller.entry.js.map +1 -1
- package/dist/esm/zonos-country-flag_4.entry.js +6 -6
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +12 -8
- package/dist/esm/zonos-hello-dialog.entry.js.map +1 -1
- package/dist/esm/zonos-hello.entry.js +237 -22
- package/dist/esm/zonos-hello.entry.js.map +1 -1
- package/dist/esm/zonos-payment.entry.js +56 -0
- package/dist/esm/zonos-payment.entry.js.map +1 -0
- package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
- package/dist/esm/zonos-shipping-rich-radio.entry.js.map +1 -1
- package/dist/{zonos-elements/zonosStore-13a7b534.js → esm/zonosStore-1c9c7d76.js} +6 -22
- package/dist/esm/zonosStore-1c9c7d76.js.map +1 -0
- package/dist/esm-es5/cart-d00e1acb.js +2 -0
- package/dist/esm-es5/{cart-2f83e048.js.map → cart-d00e1acb.js.map} +1 -1
- package/dist/esm-es5/{getBorderRadius-82fbaf25.js → getBorderRadius-e8ad5967.js} +2 -2
- package/dist/esm-es5/{isDarkColor-b21326ae.js → isDarkColor-3bb345f4.js} +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/localization-1d92a557.js +2 -0
- package/dist/esm-es5/localization-1d92a557.js.map +1 -0
- package/dist/esm-es5/{submitGtag-fbdb454b.js → submitGtag-85914088.js} +2 -2
- package/dist/esm-es5/zonos-address_2.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +2 -0
- package/dist/esm-es5/zonos-banner.entry.js.map +1 -0
- package/dist/esm-es5/zonos-button_2.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_10.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_10.entry.js.map +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js.map +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js.map +1 -1
- package/dist/esm-es5/zonos-country-flag_4.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag_4.entry.js.map +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-elements.js.map +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js.map +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js.map +1 -1
- package/dist/esm-es5/zonos-payment.entry.js +2 -0
- package/dist/esm-es5/zonos-payment.entry.js.map +1 -0
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js.map +1 -1
- package/dist/esm-es5/zonosStore-1c9c7d76.js +2 -0
- package/dist/esm-es5/zonosStore-1c9c7d76.js.map +1 -0
- package/dist/scripts/loadStripe.js +6 -6
- package/dist/scripts/loadZonos.js +92 -35
- package/dist/scripts/stripe.js +5 -5
- package/dist/scripts/zonos.js +92 -35
- package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +24 -1
- package/dist/types/components/hello/zonos-hello-dialog/zonos-hello-dialog.d.ts +6 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +9 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +9 -0
- package/dist/types/components/store/zonosStore.d.ts +1 -1
- package/dist/types/components/utils/api/checkItemRestrictions.d.ts +22 -0
- package/dist/types/components/utils/hello/detectItemRestrictions.d.ts +14 -0
- package/dist/types/components/utils/hello/getCurrentHelloLocalePage.d.ts +2 -1
- package/dist/types/components/utils/hello/getProductsOnPage.d.ts +2 -0
- package/dist/types/components/utils/hello/setZonosCountryUrlParam.d.ts +2 -0
- package/dist/types/components.d.ts +12 -0
- package/dist/types/environment.d.ts +9 -0
- package/dist/types/scripts/loadStripe.d.ts +1 -1
- package/dist/types/scripts/stripe.d.ts +2 -2
- package/dist/types/scripts/zonos.d.ts +2 -0
- package/dist/types/types/generated/graphql.customer.types.d.ts +75 -1
- package/dist/types/types/generated/graphql.customer.types.ts +113 -1
- package/dist/types/types/hello/HelloConfig.d.ts +4 -0
- package/dist/types/types/hello/Product.d.ts +5 -0
- package/dist/types/types/hello/RestrictedItem.d.ts +6 -0
- package/dist/zonos-elements/assets/ChevronDownIcon.svg +1 -1
- package/dist/zonos-elements/assets/ChevronUpIcon.svg +1 -1
- package/dist/zonos-elements/assets/InfoIcon.svg +1 -1
- package/dist/zonos-elements/assets/LeftArrow.svg +1 -1
- package/dist/zonos-elements/assets/MessageIcon.svg +1 -1
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/assets/SuccessIcon.svg +1 -1
- package/dist/zonos-elements/assets/bagIcon.svg +1 -1
- package/dist/zonos-elements/assets/messageIcon.svg +1 -1
- package/dist/zonos-elements/assets/moneyIcon.svg +1 -1
- package/dist/zonos-elements/assets/removeIcon.svg +1 -1
- package/dist/zonos-elements/cart-c641ddaf.system.js +2 -0
- package/dist/zonos-elements/{cart-9780fa28.system.js.map → cart-c641ddaf.system.js.map} +1 -1
- package/dist/{esm/cart-2f83e048.js → zonos-elements/cart-d00e1acb.js} +8 -8
- package/dist/zonos-elements/{cart-2f83e048.js.map → cart-d00e1acb.js.map} +1 -1
- package/dist/zonos-elements/{getBorderRadius-4fbe49de.system.js → getBorderRadius-b59c3ada.system.js} +2 -2
- package/dist/{esm/getBorderRadius-82fbaf25.js → zonos-elements/getBorderRadius-e8ad5967.js} +2 -2
- package/dist/zonos-elements/{getBorderRadius-82fbaf25.js.map → getBorderRadius-e8ad5967.js.map} +1 -1
- package/dist/zonos-elements/{isDarkColor-dc2b7c8f.system.js → isDarkColor-231502d4.system.js} +2 -2
- package/dist/{esm/isDarkColor-b21326ae.js → zonos-elements/isDarkColor-3bb345f4.js} +2 -2
- package/dist/{esm/isDarkColor-b21326ae.js.map → zonos-elements/isDarkColor-3bb345f4.js.map} +1 -1
- package/dist/{esm/localization-4a424f49.js → zonos-elements/localization-1d92a557.js} +200 -13
- package/dist/zonos-elements/localization-1d92a557.js.map +1 -0
- package/dist/zonos-elements/localization-a6b6a5a5.system.js +2 -0
- package/dist/zonos-elements/localization-a6b6a5a5.system.js.map +1 -0
- package/dist/zonos-elements/submitGtag-764af8c4.system.js +2 -0
- package/dist/{esm/submitGtag-fbdb454b.js → zonos-elements/submitGtag-85914088.js} +3 -3
- package/dist/zonos-elements/{submitGtag-fbdb454b.js.map → submitGtag-85914088.js.map} +1 -1
- package/dist/zonos-elements/zonos-address_2.entry.js +5 -5
- package/dist/zonos-elements/zonos-address_2.system.entry.js +1 -1
- package/dist/zonos-elements/zonos-banner.entry.js +64 -0
- package/dist/zonos-elements/zonos-banner.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-banner.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-banner.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-button_2.entry.js +3 -3
- package/dist/zonos-elements/zonos-button_2.system.entry.js +1 -1
- package/dist/zonos-elements/zonos-cart-items_10.entry.js +12 -12
- package/dist/zonos-elements/zonos-cart-items_10.system.entry.js +1 -1
- package/dist/zonos-elements/zonos-cart-items_10.system.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-checkout.entry.js +9 -9
- package/dist/zonos-elements/zonos-checkout.system.entry.js +1 -1
- package/dist/zonos-elements/zonos-checkout.system.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-controller.entry.js +6 -6
- package/dist/zonos-elements/zonos-controller.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-controller.system.entry.js +1 -1
- package/dist/zonos-elements/zonos-controller.system.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-country-flag_4.entry.js +6 -6
- package/dist/zonos-elements/zonos-country-flag_4.system.entry.js +1 -1
- package/dist/zonos-elements/zonos-country-flag_4.system.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/dist/zonos-elements/zonos-elements.system.js +1 -1
- package/dist/zonos-elements/zonos-elements.system.js.map +1 -1
- package/dist/zonos-elements/zonos-hello-dialog.entry.js +12 -8
- package/dist/zonos-elements/zonos-hello-dialog.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-hello-dialog.system.entry.js +1 -1
- package/dist/zonos-elements/zonos-hello-dialog.system.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-hello.entry.js +237 -22
- package/dist/zonos-elements/zonos-hello.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-hello.system.entry.js +1 -1
- package/dist/zonos-elements/zonos-hello.system.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-payment.entry.js +56 -0
- package/dist/zonos-elements/zonos-payment.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-payment.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-payment.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-shipping-rich-radio.entry.js +3 -3
- package/dist/zonos-elements/zonos-shipping-rich-radio.entry.js.map +1 -1
- package/dist/zonos-elements/zonos-shipping-rich-radio.system.entry.js +1 -1
- package/dist/zonos-elements/zonos-shipping-rich-radio.system.entry.js.map +1 -1
- package/dist/{esm/zonosStore-13a7b534.js → zonos-elements/zonosStore-1c9c7d76.js} +6 -22
- package/dist/zonos-elements/zonosStore-1c9c7d76.js.map +1 -0
- package/dist/zonos-elements/zonosStore-e5c545ea.system.js +2 -0
- package/dist/zonos-elements/zonosStore-e5c545ea.system.js.map +1 -0
- package/package.json +1 -1
- package/dist/cjs/localization-f6a1b679.js.map +0 -1
- package/dist/cjs/zonos-banner_2.cjs.entry.js +0 -120
- package/dist/cjs/zonos-banner_2.cjs.entry.js.map +0 -1
- package/dist/cjs/zonosStore-960e5542.js.map +0 -1
- package/dist/esm/localization-4a424f49.js.map +0 -1
- package/dist/esm/zonos-banner_2.entry.js +0 -115
- package/dist/esm/zonos-banner_2.entry.js.map +0 -1
- package/dist/esm/zonosStore-13a7b534.js.map +0 -1
- package/dist/esm-es5/cart-2f83e048.js +0 -2
- package/dist/esm-es5/localization-4a424f49.js +0 -2
- package/dist/esm-es5/localization-4a424f49.js.map +0 -1
- package/dist/esm-es5/zonos-banner_2.entry.js +0 -2
- package/dist/esm-es5/zonos-banner_2.entry.js.map +0 -1
- package/dist/esm-es5/zonosStore-13a7b534.js +0 -2
- package/dist/esm-es5/zonosStore-13a7b534.js.map +0 -1
- package/dist/zonos-elements/cart-9780fa28.system.js +0 -2
- package/dist/zonos-elements/localization-3c43290f.system.js +0 -2
- package/dist/zonos-elements/localization-3c43290f.system.js.map +0 -1
- package/dist/zonos-elements/localization-4a424f49.js.map +0 -1
- package/dist/zonos-elements/submitGtag-23ecdc20.system.js +0 -2
- package/dist/zonos-elements/zonos-banner_2.entry.js +0 -115
- package/dist/zonos-elements/zonos-banner_2.entry.js.map +0 -1
- package/dist/zonos-elements/zonos-banner_2.system.entry.js +0 -2
- package/dist/zonos-elements/zonos-banner_2.system.entry.js.map +0 -1
- package/dist/zonos-elements/zonosStore-13a7b534.js.map +0 -1
- package/dist/zonos-elements/zonosStore-77bcd7c0.system.js +0 -2
- package/dist/zonos-elements/zonosStore-77bcd7c0.system.js.map +0 -1
- /package/dist/esm-es5/{getBorderRadius-82fbaf25.js.map → getBorderRadius-e8ad5967.js.map} +0 -0
- /package/dist/esm-es5/{isDarkColor-b21326ae.js.map → isDarkColor-3bb345f4.js.map} +0 -0
- /package/dist/esm-es5/{submitGtag-fbdb454b.js.map → submitGtag-85914088.js.map} +0 -0
- /package/dist/zonos-elements/{getBorderRadius-4fbe49de.system.js.map → getBorderRadius-b59c3ada.system.js.map} +0 -0
- /package/dist/zonos-elements/{isDarkColor-dc2b7c8f.system.js.map → isDarkColor-231502d4.system.js.map} +0 -0
- /package/dist/zonos-elements/{submitGtag-23ecdc20.system.js.map → submitGtag-764af8c4.system.js.map} +0 -0
|
@@ -126,6 +126,14 @@ export const carrierAccountApiUsage = {
|
|
|
126
126
|
export type CarrierAccountApiUsage =
|
|
127
127
|
(typeof carrierAccountApiUsage)[keyof typeof carrierAccountApiUsage];
|
|
128
128
|
|
|
129
|
+
export const carrierAccountRateType = {
|
|
130
|
+
Negotiated: 'NEGOTIATED',
|
|
131
|
+
Retail: 'RETAIL',
|
|
132
|
+
} as const;
|
|
133
|
+
|
|
134
|
+
export type CarrierAccountRateType =
|
|
135
|
+
(typeof carrierAccountRateType)[keyof typeof carrierAccountRateType];
|
|
136
|
+
|
|
129
137
|
export const carrierCode = {
|
|
130
138
|
Apc: 'APC',
|
|
131
139
|
Dhl: 'DHL',
|
|
@@ -1097,6 +1105,13 @@ export const dimensionalUnitCode = {
|
|
|
1097
1105
|
|
|
1098
1106
|
export type DimensionalUnitCode =
|
|
1099
1107
|
(typeof dimensionalUnitCode)[keyof typeof dimensionalUnitCode];
|
|
1108
|
+
export const displayCurrency = {
|
|
1109
|
+
DestinationCountry: 'DESTINATION_COUNTRY',
|
|
1110
|
+
StoreNative: 'STORE_NATIVE',
|
|
1111
|
+
} as const;
|
|
1112
|
+
|
|
1113
|
+
export type DisplayCurrency =
|
|
1114
|
+
(typeof displayCurrency)[keyof typeof displayCurrency];
|
|
1100
1115
|
export const documentFilingType = {
|
|
1101
1116
|
Electronic: 'ELECTRONIC',
|
|
1102
1117
|
HardCopy: 'HARD_COPY',
|
|
@@ -1311,6 +1326,41 @@ export const imageSlot = {
|
|
|
1311
1326
|
} as const;
|
|
1312
1327
|
|
|
1313
1328
|
export type ImageSlot = (typeof imageSlot)[keyof typeof imageSlot];
|
|
1329
|
+
export const inclusivePriceHistoryCsvJobStatus = {
|
|
1330
|
+
Error: 'ERROR',
|
|
1331
|
+
Processed: 'PROCESSED',
|
|
1332
|
+
ReadyForProcessing: 'READY_FOR_PROCESSING',
|
|
1333
|
+
ReadyForUpload: 'READY_FOR_UPLOAD',
|
|
1334
|
+
Uploading: 'UPLOADING',
|
|
1335
|
+
} as const;
|
|
1336
|
+
|
|
1337
|
+
export type InclusivePriceHistoryCsvJobStatus =
|
|
1338
|
+
(typeof inclusivePriceHistoryCsvJobStatus)[keyof typeof inclusivePriceHistoryCsvJobStatus];
|
|
1339
|
+
|
|
1340
|
+
export const inclusivePriceHistorySource = {
|
|
1341
|
+
Platform: 'PLATFORM',
|
|
1342
|
+
UserInput: 'USER_INPUT',
|
|
1343
|
+
Zonos: 'ZONOS',
|
|
1344
|
+
} as const;
|
|
1345
|
+
|
|
1346
|
+
export type InclusivePriceHistorySource =
|
|
1347
|
+
(typeof inclusivePriceHistorySource)[keyof typeof inclusivePriceHistorySource];
|
|
1348
|
+
|
|
1349
|
+
export const inclusivePriceSettingAdjustmentStatus = {
|
|
1350
|
+
Excluded: 'EXCLUDED',
|
|
1351
|
+
Included: 'INCLUDED',
|
|
1352
|
+
} as const;
|
|
1353
|
+
|
|
1354
|
+
export type InclusivePriceSettingAdjustmentStatus =
|
|
1355
|
+
(typeof inclusivePriceSettingAdjustmentStatus)[keyof typeof inclusivePriceSettingAdjustmentStatus];
|
|
1356
|
+
|
|
1357
|
+
export const inclusivePriceSettingStatus = {
|
|
1358
|
+
Disabled: 'DISABLED',
|
|
1359
|
+
Enabled: 'ENABLED',
|
|
1360
|
+
} as const;
|
|
1361
|
+
|
|
1362
|
+
export type InclusivePriceSettingStatus =
|
|
1363
|
+
(typeof inclusivePriceSettingStatus)[keyof typeof inclusivePriceSettingStatus];
|
|
1314
1364
|
export const incotermCode = {
|
|
1315
1365
|
Cif: 'CIF',
|
|
1316
1366
|
Custom: 'CUSTOM',
|
|
@@ -2263,6 +2313,32 @@ export type ShipmentRatingFragment = {
|
|
|
2263
2313
|
minTransitAt: string | null;
|
|
2264
2314
|
};
|
|
2265
2315
|
|
|
2316
|
+
export type CheckItemRestrictionsMutation = {
|
|
2317
|
+
itemRestrictionApply: {
|
|
2318
|
+
id: string;
|
|
2319
|
+
items: Array<{
|
|
2320
|
+
action: ItemRestrictionAction | null;
|
|
2321
|
+
id: string;
|
|
2322
|
+
itemDescription: string | null;
|
|
2323
|
+
itemRestrictions: Array<{
|
|
2324
|
+
hsCode: string;
|
|
2325
|
+
id: string;
|
|
2326
|
+
note: string;
|
|
2327
|
+
sources: Array<string | null> | null;
|
|
2328
|
+
type: ItemRestrictionType;
|
|
2329
|
+
} | null> | null;
|
|
2330
|
+
} | null>;
|
|
2331
|
+
};
|
|
2332
|
+
};
|
|
2333
|
+
|
|
2334
|
+
export type BulkClassifyMutation = {
|
|
2335
|
+
classificationsCalculate: Array<{
|
|
2336
|
+
description: string | null;
|
|
2337
|
+
hsCode: { code: string } | null;
|
|
2338
|
+
name: string;
|
|
2339
|
+
}>;
|
|
2340
|
+
};
|
|
2341
|
+
|
|
2266
2342
|
export type CheckoutSessionUpdateMutation = {
|
|
2267
2343
|
checkoutSessionUpdate: {
|
|
2268
2344
|
clientSecret: string;
|
|
@@ -2518,8 +2594,12 @@ export type ZonosSettingsQuery = {
|
|
|
2518
2594
|
organization: string;
|
|
2519
2595
|
peekMessageBehavior: HelloPeekMessageBehavior;
|
|
2520
2596
|
peekMessageDelay: number;
|
|
2521
|
-
|
|
2597
|
+
productAddToCartElementSelector: string | null;
|
|
2522
2598
|
productListUrlPattern: string | null;
|
|
2599
|
+
productDetailUrlPattern: string | null;
|
|
2600
|
+
productDescriptionElementSelector: string | null;
|
|
2601
|
+
productPriceElementSelector: string | null;
|
|
2602
|
+
productTitleElementSelector: string | null;
|
|
2523
2603
|
restrictionBehavior: HelloRestrictionBehavior;
|
|
2524
2604
|
updatedAt: string;
|
|
2525
2605
|
updatedBy: string;
|
|
@@ -2590,8 +2670,12 @@ export type HelloSettingFragment = {
|
|
|
2590
2670
|
organization: string;
|
|
2591
2671
|
peekMessageBehavior: HelloPeekMessageBehavior;
|
|
2592
2672
|
peekMessageDelay: number;
|
|
2673
|
+
productAddToCartElementSelector: string | null;
|
|
2674
|
+
productDescriptionElementSelector: string | null;
|
|
2593
2675
|
productDetailUrlPattern: string | null;
|
|
2594
2676
|
productListUrlPattern: string | null;
|
|
2677
|
+
productPriceElementSelector: string | null;
|
|
2678
|
+
productTitleElementSelector: string | null;
|
|
2595
2679
|
restrictionBehavior: HelloRestrictionBehavior;
|
|
2596
2680
|
updatedAt: string;
|
|
2597
2681
|
updatedBy: string;
|
|
@@ -2635,6 +2719,20 @@ export function getSdk(
|
|
|
2635
2719
|
withWrapper: SdkFunctionWrapper = defaultWrapper,
|
|
2636
2720
|
) {
|
|
2637
2721
|
return {
|
|
2722
|
+
BulkClassify(
|
|
2723
|
+
variables?: { [x: string]: never },
|
|
2724
|
+
requestHeaders?: GraphQLClientRequestHeaders,
|
|
2725
|
+
): Promise<BulkClassifyMutation> {
|
|
2726
|
+
return withWrapper(
|
|
2727
|
+
wrappedRequestHeaders =>
|
|
2728
|
+
client.request<BulkClassifyMutation>('', variables, {
|
|
2729
|
+
...requestHeaders,
|
|
2730
|
+
...wrappedRequestHeaders,
|
|
2731
|
+
}),
|
|
2732
|
+
'BulkClassify',
|
|
2733
|
+
'mutation',
|
|
2734
|
+
);
|
|
2735
|
+
},
|
|
2638
2736
|
CalculateLandedCost(
|
|
2639
2737
|
variables?: { [x: string]: never },
|
|
2640
2738
|
requestHeaders?: GraphQLClientRequestHeaders,
|
|
@@ -2649,6 +2747,20 @@ export function getSdk(
|
|
|
2649
2747
|
'mutation',
|
|
2650
2748
|
);
|
|
2651
2749
|
},
|
|
2750
|
+
CheckItemRestrictions(
|
|
2751
|
+
variables?: { [x: string]: never },
|
|
2752
|
+
requestHeaders?: GraphQLClientRequestHeaders,
|
|
2753
|
+
): Promise<CheckItemRestrictionsMutation> {
|
|
2754
|
+
return withWrapper(
|
|
2755
|
+
wrappedRequestHeaders =>
|
|
2756
|
+
client.request<CheckItemRestrictionsMutation>('', variables, {
|
|
2757
|
+
...requestHeaders,
|
|
2758
|
+
...wrappedRequestHeaders,
|
|
2759
|
+
}),
|
|
2760
|
+
'CheckItemRestrictions',
|
|
2761
|
+
'mutation',
|
|
2762
|
+
);
|
|
2763
|
+
},
|
|
2652
2764
|
CheckoutSessionCreate(
|
|
2653
2765
|
variables?: { [x: string]: never },
|
|
2654
2766
|
requestHeaders?: GraphQLClientRequestHeaders,
|
|
@@ -13,7 +13,11 @@ export type HelloConfig = {
|
|
|
13
13
|
organization: string;
|
|
14
14
|
peekMessageBehavior: HelloPeekMessageBehavior;
|
|
15
15
|
peekMessageDelay: number;
|
|
16
|
+
productAddToCartElementSelector: string | null;
|
|
17
|
+
productDescriptionElementSelector: string | null;
|
|
16
18
|
productDetailUrlPattern: string | null;
|
|
17
19
|
productListUrlPattern: string | null;
|
|
20
|
+
productPriceElementSelector: string | null;
|
|
21
|
+
productTitleElementSelector: string | null;
|
|
18
22
|
restrictionBehavior: HelloRestrictionBehavior;
|
|
19
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg color="var(--amino-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="
|
|
1
|
+
<svg color="var(--amino-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg color="var(--amino-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="
|
|
1
|
+
<svg color="var(--amino-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M17.707 14.707a1 1 0 0 1-1.414 0L12 10.414l-4.293 4.293a1 1 0 0 1-1.414-1.414l4.93-4.93a1.1 1.1 0 0 1 1.555 0l4.93 4.93a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg viewBox="0 0 17 16" fill="none" xmlns="
|
|
1
|
+
<svg viewBox="0 0 17 16" fill="none" xmlns="https://www.w3.org/2000/svg">
|
|
2
2
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.96704 8.00065C1.96704 4.31875 4.93024 1.33398 8.58554 1.33398C12.2408 1.33398 15.204 4.31875 15.204 8.00065C15.204 11.6826 12.2408 14.6673 8.58554 14.6673C4.93024 14.6673 1.96704 11.6825 1.96704 8.00065Z" fill="#C5C6CA"/>
|
|
3
3
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.58543 4.66016C8.95096 4.66016 9.24728 4.95863 9.24728 5.32682V5.33349C9.24728 5.70168 8.95096 6.00016 8.58543 6.00016C8.2199 6.00016 7.92358 5.70168 7.92358 5.33349V5.32682C7.92358 4.95863 8.2199 4.66016 8.58543 4.66016ZM8.58543 7.33349C8.95096 7.33349 9.24728 7.63197 9.24728 8.00016V10.6668C9.24728 11.035 8.95096 11.3335 8.58543 11.3335C8.2199 11.3335 7.92358 11.035 7.92358 10.6668V8.00016C7.92358 7.63197 8.2199 7.33349 8.58543 7.33349Z" fill="#4D505A"/>
|
|
4
4
|
</svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="
|
|
1
|
+
<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M9.707 16.707a1 1 0 0 1-1.414 0l-3.647-3.646a1.5 1.5 0 0 1 0-2.122l3.647-3.646a1 1 0 0 1 1.414 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l2.293 2.293a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="
|
|
1
|
+
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">
|
|
2
2
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>
|
|
3
3
|
</svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg color="var(--amino-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="
|
|
1
|
+
<svg color="var(--amino-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--amino-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg color="var(--amino-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="
|
|
1
|
+
<svg color="var(--amino-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z" data-is-secondary-color="true" fill="var(--amino-blue-100)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M15.707 9.293a1 1 0 0 1 0 1.414l-3.646 3.647a1.5 1.5 0 0 1-2.122 0l-1.646-1.647a1 1 0 1 1 1.414-1.414L11 12.586l3.293-3.293a1 1 0 0 1 1.414 0Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="
|
|
1
|
+
<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">
|
|
2
2
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.66666 4.16667C9.20642 4.16667 8.83333 4.53976 8.83333 5V5.83333H12.1667V5C12.1667 4.53976 11.7936 4.16667 11.3333 4.16667H9.66666ZM13.8333 5.83333V5C13.8333 3.61929 12.714 2.5 11.3333 2.5H9.66666C8.28595 2.5 7.16666 3.61929 7.16666 5V5.83333H6.77759C5.44832 5.83333 4.35149 6.87354 4.2811 8.20094L3.92756 14.8676C3.85169 16.2983 4.99133 17.5 6.42405 17.5H14.5759C16.0087 17.5 17.1483 16.2983 17.0724 14.8676L16.7189 8.20094C16.6485 6.87354 15.5517 5.83333 14.2224 5.83333H13.8333ZM12.1667 7.5V8.33333C12.1667 8.79357 12.5398 9.16667 13 9.16667C13.4602 9.16667 13.8333 8.79357 13.8333 8.33333V7.5H14.2224C14.6655 7.5 15.0311 7.84674 15.0546 8.2892L15.4081 14.9559C15.4334 15.4328 15.0535 15.8333 14.5759 15.8333H6.42405C5.94648 15.8333 5.5666 15.4328 5.59189 14.9559L5.94542 8.2892C5.96889 7.84674 6.3345 7.5 6.77759 7.5H7.16666V8.33333C7.16666 8.79357 7.53976 9.16667 7.99999 9.16667C8.46023 9.16667 8.83333 8.79357 8.83333 8.33333V7.5H12.1667Z" fill="#4D505A"/>
|
|
3
3
|
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="
|
|
1
|
+
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">
|
|
2
2
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>
|
|
3
3
|
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="
|
|
1
|
+
<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">
|
|
2
2
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.16666 5.83301C2.16666 4.4523 3.28594 3.33301 4.66666 3.33301H16.3333C17.714 3.33301 18.8333 4.4523 18.8333 5.83301V14.1663C18.8333 15.5471 17.714 16.6663 16.3333 16.6663H4.66666C3.28594 16.6663 2.16666 15.5471 2.16666 14.1663V5.83301ZM4.66666 4.99967C4.20642 4.99967 3.83332 5.37277 3.83332 5.83301V14.1663C3.83332 14.6266 4.20642 14.9997 4.66666 14.9997H16.3333C16.7936 14.9997 17.1667 14.6266 17.1667 14.1663V5.83301C17.1667 5.37277 16.7936 4.99967 16.3333 4.99967H4.66666ZM6.33332 8.33301C6.79356 8.33301 7.16666 8.7061 7.16666 9.16634V10.833C7.16666 11.2932 6.79356 11.6663 6.33332 11.6663C5.87309 11.6663 5.49999 11.2932 5.49999 10.833V9.16634C5.49999 8.7061 5.87309 8.33301 6.33332 8.33301ZM8.83332 9.99967C8.83332 9.0792 9.57952 8.33301 10.5 8.33301C11.4205 8.33301 12.1667 9.0792 12.1667 9.99967C12.1667 10.9201 11.4205 11.6663 10.5 11.6663C9.57952 11.6663 8.83332 10.9201 8.83332 9.99967ZM14.6667 8.33301C15.1269 8.33301 15.5 8.7061 15.5 9.16634V10.833C15.5 11.2932 15.1269 11.6663 14.6667 11.6663C14.2064 11.6663 13.8333 11.2932 13.8333 10.833V9.16634C13.8333 8.7061 14.2064 8.33301 14.6667 8.33301Z" fill="#4D505A"/>
|
|
3
3
|
</svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="
|
|
1
|
+
<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(s,a)}c((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(r=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./zonosStore-e5c545ea.system.js","./localization-a6b6a5a5.system.js","./isDarkColor-231502d4.system.js","./getBorderRadius-b59c3ada.system.js"],(function(e){"use strict";var t,n,r,i,o,s,a,c,l;return{setters:[function(e){t=e.c;n=e.z},function(e){r=e.h;i=e.l;o=e.a;s=e.b;a=e.t},function(e){c=e.i},function(e){l=e.g}],execute:function(){var u=this;var d=function(){var e=y.stripeLinkEventData;var t=y.stripeAddressEventData;if(!t||!t.complete){throw new Error("Missing stripe address data")}return{checkoutSessionId:j.checkoutSessionId||"",contact:{email:(e===null||e===void 0?void 0:e.value.email)||"",firstName:t.value.firstName||"",lastName:t.value.lastName||"",phone:t.value.phone||""},items:j.items.map((function(e){return{amount:e.amount,countryOfOrigin:e.countryOfOrigin,currencyCode:e.currencyCode,imageUrl:e.imageUrl,name:e.name,productId:e.productId,quantity:e.quantity}})),shippingAddress:{addressLine1:t.value.address.line1,addressLine2:t.value.address.line2||"",city:t.value.address.city,country:t.value.address.country,postalCode:t.value.address.postal_code,state:t.value.address.state}}};var p=function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,i,o;return __generator(this,(function(s){switch(s.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/calculate-landed-cost");return[4,r(t,{body:d(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 1:n=s.sent(),i=n.errors,o=n.json;if(i.length||!o){throw new Error("Failed to calculate landed cost")}return[2,o]}}))}))};var v=function(e){var t=e.theme;switch(t){default:return{".Input":{padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"}}}};var f=function(e){var t=e.borderStyle,n=e.theme;switch(n){case"DARK":return{borderRadius:l(t),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:l(t)}}};var h=t((function(){return{clientSecret:sessionStorage.getItem("zonos--client-secret")||null,fetchingLandedCostAbordController:null,isFetchingLandedCost:false,isFetchingSession:false,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenFetchingLC:null,stripeElements:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null}})),m=h.onChange,g=h.reset,y=h.state;e("s",y);var C=function(e){var t=e.clientSecret,r=e.overrideBorderRaidus,i=e.overridePrimaryColor,s=e.overrideTheme;var a=i||n.appearance.colorPrimary;var l=a&&c(a)?"night":"flat";var u=s==="DARK"?"night":"flat";return{appearance:{labels:"floating",rules:Object.assign({},v({theme:"LIGHT"})),theme:s?u:l,variables:Object.assign({},f({borderStyle:r,theme:"LIGHT"}))},clientSecret:t,locale:o.selectedLocale}};var S=e("i",(function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(o){n=y.clientSecret;if(!y.stripe){i("Skip. Stripe is not initialized");return[2]}if(n){r=C({clientSecret:n,overrideBorderRaidus:e===null||e===void 0?void 0:e.overrideBorderRaidus,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme});if(!y.stripeElements){y.stripeElements=(t=y.stripe)===null||t===void 0?void 0:t.elements(r)}else{y.stripeElements.update(r)}i("Stripe elements initialized")}return[2]}))}))}));var b=e("j",(function(){sessionStorage.removeItem("zonos--client-secret");g();y.stripe=window.Zonos.stripe}));var w=function(){var e,t,n,r;var i=y.fetchingLandedCostAbordController;if(!i){return false}var o=JSON.stringify((e=y.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=y.stripeLinkEventData)===null||t===void 0?void 0:t.value);var s=JSON.stringify((n=y.stripeAddressUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((r=y.stripeAddressEventData)===null||r===void 0?void 0:r.value);return o||s};var _=e("f",(function(){return __awaiter(u,void 0,void 0,(function(){var e,t,n,r,i,o,a,c,l,u,d,v,f,h;return __generator(this,(function(m){switch(m.label){case 0:i=!!((e=y.stripeAddressEventData)===null||e===void 0?void 0:e.complete);o=!!((t=y.stripeLinkEventData)===null||t===void 0?void 0:t.complete);a=w();if(a){(n=y.fetchingLandedCostAbordController)===null||n===void 0?void 0:n.abort();y.fetchingLandedCostAbordController=null}if(!(i&&o&&(a||!y.isFetchingLandedCost)))return[3,5];y.isFetchingLandedCost=true;if(y.stripeAddressEventData){y.stripeAddressUsedWhenFetchingLC=Object.assign({},y.stripeAddressEventData)}if(y.stripeLinkEventData){y.stripeLinkUsedWhenFetchingLC=Object.assign({},y.stripeLinkEventData)}m.label=1;case 1:m.trys.push([1,3,,4]);c=new AbortController;y.fetchingLandedCostAbordController=c;return[4,p(c)];case 2:l=m.sent(),u=l.checkoutSessionWorkflow,d=l.shipmentRatingCalculateWorkflow;y.fetchingLandedCostAbordController=null;j.landedCostData=(u===null||u===void 0?void 0:u.filter(Boolean))||null;j.shippingData=(d===null||d===void 0?void 0:d.filter(Boolean))||null;v=(r=j.landedCostData)===null||r===void 0?void 0:r.find(Boolean);f=!!v?v.subtotals:null;if(f){B({exchangeRate:f.exchangeRate,items:f.items,landedCostTotal:0,presentmentCurrencyCode:f.presentmentCurrencyCode,shipping:0,total:f.items})}return[3,4];case 3:h=m.sent();s(h);return[3,4];case 4:y.isFetchingLandedCost=false;m.label=5;case 5:return[2]}}))}))}));var k=function(e){var t=[];var n=true;switch(e){case"succeeded":{t=[a("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"","",a("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")];n=false;break}case"requires_capture":case"processing":{t=[a("Payment processing. We'll update you when payment is received.")];n=false;break}case"requires_payment_method":{t=[a("Payment failed. Please try another payment method.")];break}default:{t=[a("Something went wrong.")];break}}return{isError:n,messages:t}};var A=e("l",(function(e){var t=e.clientSecret,n=e.storybookForceStatus;return __awaiter(u,void 0,void 0,(function(){var e,r,i,o,c,l,u,d,p;return __generator(this,(function(v){switch(v.label){case 0:if(n){e=k(n),r=e.isError,i=e.messages;return[2,{error:r,messages:i}]}o=t||y.clientSecret;if(!y.stripe||!o){s("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[a("Something went wrong.")]}]}return[4,y.stripe.retrievePaymentIntent(o)];case 1:c=v.sent().paymentIntent;l=c===null||c===void 0?void 0:c.status;u=k(l),d=u.isError,p=u.messages;return[2,{error:d,messages:p}]}}))}))}));var E=e("h",(function(){return __awaiter(u,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return __generator(this,(function(c){switch(c.label){case 0:r=!!((e=y.stripePaymentEventData)===null||e===void 0?void 0:e.complete);i=y.stripeElements;o=y.stripe;s=y.clientSecret;if(!(o&&i&&r&&s))return[3,2];return[4,o.confirmPayment({confirmParams:{receipt_email:(n=(t=y.stripeLinkEventData)===null||t===void 0?void 0:t.value)===null||n===void 0?void 0:n.email,return_url:window.location.href},elements:i,redirect:"if_required"})];case 1:a=c.sent().error;if(a){if(a.type==="card_error"||a.type==="validation_error"){throw new Error(a.message)}if(a.type==="invalid_request_error"){if(a.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}c.label=2;case 2:return[2]}}))}))}));var T=e("d",(function(){return __awaiter(u,void 0,void 0,(function(){var e,t,n,a,c,l;return __generator(this,(function(u){switch(u.label){case 0:t=j.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!t||!o.targetCurrency){s("Fail to create checkout session - invalid total or currency");return[2,false]}y.isFetchingSession=true;return[4,r("".concat("https://v1.route.js.zonos.com","/api/create-checkout-session"),{body:{currency:((e=j.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",itemsAmount:t,presentmentCountryCode:o.selectedCountryCode||null},method:"POST"})];case 1:n=u.sent(),a=n.errors,c=n.json;y.isFetchingSession=false;if(a.length||!c){s("Error occurs when creating checkout session",JSON.stringify(a,null,2));return[2,false]}l=c.checkoutSessionCreate;y.clientSecret=l.clientSecret;j.checkoutSessionId=l.id;B(Object.assign(Object.assign({},l.subtotals),{landedCostTotal:0,shipping:0,total:l.subtotals.items}));i("Exchange rate updated for cart items (checkout session create)","info",j.exchangeRate);i("done-init-checkout-session");return[2,true]}}))}))}));var D=function(e){var t=e.currency,n=e.id,i=e.itemsAmount,o=e.landedCostId,a=e.presentmentCountryCode;return __awaiter(u,void 0,void 0,(function(){var e,c,l;return __generator(this,(function(u){switch(u.label){case 0:return[4,r("".concat("https://v1.route.js.zonos.com","/api/update-checkout-session"),{body:{currency:t,id:n,itemsAmount:i,landedCostId:o,presentmentCountryCode:a},method:"POST"})];case 1:e=u.sent(),c=e.errors,l=e.json;if(c.length||!l){s("Error occurs when updating checkout session",JSON.stringify(c,null,2));return[2,{errors:c,json:l}]}return[2,{errors:[],json:l}]}}))}))};m("clientSecret",(function(e){if(e&&y.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var x=function(e){var t=e.date,n=e.formatOptions,r=n===void 0?{day:"numeric",weekday:"long",year:"numeric"}:n;return new Intl.DateTimeFormat("en-US",r).format(t)};var L=function(e){var t=new Date;var n=e.getTime()-t.getTime();var r=Math.floor(n/(1e3*60*60*24));return r};var O=t((function(){return{checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id")||null,currency:"USD",dutiesTaxFees:0,error:null,exchangeRate:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,items:[],landedCostData:null,selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,step:"customer-info",subtotal:0,total:0}})),I=O.onChange,F=O.reset,j=O.state;e("c",j);var P=e("n",(function(e){var t=e.minTransitAt?L(new Date(e.minTransitAt)):"";var n=e.maxTransitAt?L(new Date(e.maxTransitAt)):"";var r=e.minTransitAt?x({date:new Date(e.minTransitAt)}):"";return{expectedDate:r,maxTransit:n,minTransit:t}}));var R=e("b",(function(){sessionStorage.removeItem("zonos--checkout-session-id");F()}));var z=e("e",(function(e){var t=e.messages,n=e.title;j.step="error";j.error={messages:t,title:n}}));var B=function(e){j.exchangeRate=e.exchangeRate;j.dutiesTaxFees=e.landedCostTotal;j.subtotal=e.items;j.total=e.total;j.currency=e.presentmentCurrencyCode};var U=function(e){var t=e.currency,n=e.itemsAmount,r=e.landedCostId;return __awaiter(u,void 0,void 0,(function(){var e,c;return __generator(this,(function(l){switch(l.label){case 0:if(r&&j.selectedLandedCost){e=j.selectedLandedCost.subtotals;B(e);i("Exchange rate updated for cart items (landed cost subtotal)","info",j.exchangeRate)}if(!j.checkoutSessionId){s("Could update cart total without checkout session id");return[2,false]}return[4,D({currency:t,id:j.checkoutSessionId,itemsAmount:n,landedCostId:r,presentmentCountryCode:o.selectedCountryCode})];case 1:c=l.sent().json;if(!c){s("Error occurs when updating checkout session");z({messages:[a("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error updating Checkout")});return[2,false]}if(!r){B(c.checkoutSessionUpdate.subtotals);i("Exchange rate updated for cart items (checkout session update)","info",j.exchangeRate)}return[2,true]}}))}))};var N=e("m",(function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,l,u,d,p,v;return __generator(this,(function(f){switch(f.label){case 0:j.selectedShippingOption=e;s=P(j.selectedShippingOption),a=s.expectedDate,c=s.maxTransit,l=s.minTransit;j.selectedShippingOptionExpectedDate=a;j.selectedShippingOptionTransitTime=l&&c?"".concat(l,"-").concat(c):"".concat(l||c);u=(t=j.landedCostData)===null||t===void 0?void 0:t.find((function(e){var t,n,r;return((n=(t=e.landedCost)===null||t===void 0?void 0:t.shipmentRating)===null||n===void 0?void 0:n.id)===((r=j.selectedShippingOption)===null||r===void 0?void 0:r.id)}));j.selectedLandedCost=u||null;if(!u){return[2,false]}j.shipping=u.subtotals.shipping;d=((n=u===null||u===void 0?void 0:u.landedCost)===null||n===void 0?void 0:n.landedCostGuaranteeCode)==="ZONOS";p=!!((i=(r=u===null||u===void 0?void 0:u.landedCost)===null||r===void 0?void 0:r.deMinimis)===null||i===void 0?void 0:i.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));j.isSelectedShippingAboveDeminimis=p;j.isSelectedShippingGuarantee=d;return[4,U({landedCostId:(o=u.landedCost)===null||o===void 0?void 0:o.id})];case 1:v=f.sent();return[2,v]}}))}))}));I("checkoutSessionId",(function(){if(!j.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",j.checkoutSessionId)}));var W=e("a",(function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){switch(i.label){case 0:j.items=e;n=(t=e.find(Boolean))===null||t===void 0?void 0:t.currencyCode;r=e.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!n||!r){return[2]}j.currency=n;y.isFetchingSession=true;return[4,U({currency:n,itemsAmount:r})];case 1:i.sent();y.isFetchingSession=false;return[2]}}))}))}));var q=function(){j.selectedShippingOption=null;j.isSelectedShippingAboveDeminimis=false;j.isSelectedShippingGuarantee=false;j.selectedShippingOptionExpectedDate="";j.selectedShippingOptionTransitTime="";j.shipping=0};var G=e("g",(function(){if(j.step==="customer-info"){j.step="shipping"}else if(j.step==="shipping"){j.step="payment"}else if(j.step==="payment"){j.step="finish"}}));var J=e("k",(function(){if(j.step==="payment"){j.step="shipping"}else if(j.step==="shipping"){j.step="customer-info";q()}}))}}}));
|
|
2
|
+
//# sourceMappingURL=cart-c641ddaf.system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["prepCalculateLandedCost","stripeLinkData","stripeStore","stripeLinkEventData","stripeAddressData","stripeAddressEventData","complete","Error","checkoutSessionId","cartStore","contact","email","value","firstName","lastName","phone","items","map","item","amount","countryOfOrigin","currencyCode","imageUrl","name","productId","quantity","shippingAddress","addressLine1","address","line1","addressLine2","line2","city","country","postalCode","postal_code","state","calculateLandedCost","abortController","__awaiter","_this","url","concat","handleFetch","body","method","signal","_f","_g","sent","errors","json","length","addressRuleStyle","theme","padding","paddingBottom","paddingLeft","paddingRight","paddingTop","defaultVariable","borderStyle","borderRadius","getBorderRadius","colorBackground","colorBackgroundText","colorText","colorTextPlaceholder","createStore","clientSecret","sessionStorage","getItem","fetchingLandedCostAbordController","isFetchingLandedCost","isFetchingSession","stripe","stripeAddressElement","stripeAddressUsedWhenFetchingLC","stripeElements","stripeLinkElement","stripeLinkUsedWhenFetchingLC","stripePaymentElement","stripePaymentEventData","onChange","reset","exports","getStripeOptions","overrideBorderRaidus","overridePrimaryColor","overrideTheme","primaryColor","zonosStore","appearance","colorPrimary","themeBasedColor","isDarkColor","labels","rules","Object","assign","variables","locale","localizationStore","selectedLocale","initStripeElements","props","log","stripeOptions","_a","elements","update","stripeStoreReset","removeItem","window","Zonos","isPrefetchInfoOutdated","hasAbortController","isLinkDataDirty","JSON","stringify","_b","isAddressDataDirty","_c","_d","stripeStorePrefetchLandedCost","stripeAddressReady","stripeLinkReady","shouldRefetch","abort","AbortController","checkoutSessionWorkflow","shipmentRatingCalculateWorkflow","landedCostData","filter","Boolean","shippingData","firstLandedCostData","find","subtotals","cartStoreApplySubtotals","exchangeRate","landedCostTotal","presentmentCurrencyCode","shipping","total","logError","err_1","getStripeMessageBasedOnStatus","status","messages","isError","translate","stripeStoreRetrievePayment","_clientSecret","storybookForceStatus","isError_1","messages_1","error","message","retrievePaymentIntent","paymentIntent","_j","_h","stripeStoreConfirmPayment","stripePaymentReady","stripeClientSecret","confirmPayment","confirmParams","receipt_email","return_url","location","href","redirect","type","code","stripeStoreInitCheckoutSession","reduce","targetCurrency","currency","itemsAmount","presentmentCountryCode","selectedCountryCode","result","checkoutSessionCreate","id","stripeStoreUpdateCheckoutSession","landedCostId","setItem","formatDate","date","formatOptions","day","weekday","year","Intl","DateTimeFormat","format","getDaysDifference","targetDate","currentDate","Date","timeDifference","getTime","daysDifference","Math","floor","dutiesTaxFees","isSelectedShippingAboveDeminimis","isSelectedShippingGuarantee","selectedLandedCost","selectedShippingOption","selectedShippingOptionExpectedDate","selectedShippingOptionTransitTime","step","subtotal","cartStoreGetShippingTransitInfo","minTransit","minTransitAt","maxTransit","maxTransitAt","expectedDate","cartStoreReset","cartStoreUpdateToErrorState","title","cartStoreReCalculateTotal","checkoutSessionUpdate","cartStoreUpdateSelectedShippingOption","checkoutSessionPresentment","landedCost","shipmentRating","isGuarantee","landedCostGuaranteeCode","isAboveDeminimis","deMinimis","includes","threshold","_e","updateCalulateStatus","cartStoreUpdateItems","amt","cartStoreResetSelectedShippingOption","cartStoreNextStep","cartStorePreviousStep"],"sources":["src/components/utils/api/prepCalculateLandedCost.ts","src/components/utils/api/calculateLandedCost.ts","src/styles/stripe/addressRuleStyle.ts","src/styles/stripe/defaultVariable.ts","src/components/store/checkout/stripe.ts","src/components/utils/formatDate.ts","src/components/utils/getDaysDifference.ts","src/components/store/checkout/cart.ts"],"sourcesContent":["import { cartStore } from 'src/components/store/checkout/cart';\nimport { stripeStore } from 'src/components/store/checkout/stripe';\nimport type { CalculateLandedCostRequest } from 'src/types/checkout/api/CalculateLandedCostRequest';\n\nexport const prepCalculateLandedCost = (): CalculateLandedCostRequest => {\n // maybe we don't need email now for prefetch the landed cost\n const stripeLinkData = stripeStore.stripeLinkEventData;\n\n const stripeAddressData = stripeStore.stripeAddressEventData;\n if (!stripeAddressData || !stripeAddressData.complete) {\n throw new Error('Missing stripe address data');\n }\n\n return {\n checkoutSessionId: cartStore.checkoutSessionId || '',\n contact: {\n email: stripeLinkData?.value.email || '',\n // firstName and lastName should be valid now since stripe only mark\n // the address as complete when both fields are filled.\n firstName: stripeAddressData.value.firstName || '',\n lastName: stripeAddressData.value.lastName || '',\n phone: stripeAddressData.value.phone || '',\n },\n items: cartStore.items.map(item => ({\n amount: item.amount,\n countryOfOrigin: item.countryOfOrigin,\n currencyCode: item.currencyCode,\n imageUrl: item.imageUrl,\n name: item.name,\n productId: item.productId,\n quantity: item.quantity,\n })),\n shippingAddress: {\n addressLine1: stripeAddressData.value.address.line1,\n addressLine2: stripeAddressData.value.address.line2 || '',\n city: stripeAddressData.value.address.city,\n country: stripeAddressData.value.address.country,\n postalCode: stripeAddressData.value.address.postal_code,\n state: stripeAddressData.value.address.state,\n },\n };\n};\n","import { prepCalculateLandedCost } from 'src/components/utils/api/prepCalculateLandedCost';\nimport { handleFetch } from 'src/components/utils/handleFetch';\nimport type { CalculateLandedCostRequest } from 'src/types/checkout/api/CalculateLandedCostRequest';\nimport type { CalculateLandedCostMutation } from 'src/types/generated/graphql.customer.types';\n\nexport const calculateLandedCost = async (\n abortController?: AbortController,\n) => {\n // request to get landed cost info\n const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/calculate-landed-cost`;\n const { errors, json } = await handleFetch<\n CalculateLandedCostMutation,\n CalculateLandedCostRequest\n >(url, {\n body: prepCalculateLandedCost(),\n method: 'POST',\n signal: abortController?.signal,\n });\n if (errors.length || !json) {\n throw new Error('Failed to calculate landed cost');\n }\n\n return json;\n};\n","import type { ElementsUiTheme, StripeRuleType } from 'src/types';\n\nexport const addressRuleStyle = ({\n theme,\n}: {\n theme: ElementsUiTheme;\n}): StripeRuleType => {\n switch (theme) {\n default:\n return {\n '.Input': {\n // need to reset everything and the paddingTop to default, otherwise the paddingTop will not be updated.\n padding: '0',\n paddingBottom: '8px',\n paddingLeft: '16px',\n paddingRight: '8px',\n // any value here will be add up to the default paddingTop (20px).\n paddingTop: '6px',\n },\n };\n }\n};\n","import type { Appearance } from '@stripe/stripe-js';\n\nimport { getBorderRadius } from 'src/components/utils/getBorderRadius';\nimport type {\n ElementsUiStyle,\n ElementsUiTheme,\n} from 'src/types/generated/graphql.customer.types';\n\nexport const defaultVariable = ({\n borderStyle,\n theme,\n}: {\n borderStyle?: ElementsUiStyle;\n theme: ElementsUiTheme;\n}): Appearance['variables'] => {\n switch (theme) {\n case 'DARK':\n return {\n borderRadius: getBorderRadius(borderStyle),\n colorBackground: '#101117',\n colorBackgroundText: '#C5C6CA',\n colorText: '#C5C6CA',\n colorTextPlaceholder: '#C5C6CA',\n };\n default:\n return {\n borderRadius: getBorderRadius(borderStyle),\n };\n }\n};\n","import { createStore } from '@stencil/store';\nimport type {\n PaymentIntent,\n Stripe,\n StripeAddressElement,\n StripeAddressElementChangeEvent,\n StripeElements,\n StripeElementsOptionsClientSecret,\n StripeLinkAuthenticationElement,\n StripeLinkAuthenticationElementChangeEvent,\n StripePaymentElement,\n StripePaymentElementChangeEvent,\n} from '@stripe/stripe-js';\n\nimport {\n cartStore,\n cartStoreApplySubtotals,\n} from 'src/components/store/checkout/cart';\nimport { localizationStore } from 'src/components/store/hello/localization';\nimport { translate } from 'src/components/store/translationStore';\nimport { zonosStore } from 'src/components/store/zonosStore';\nimport { calculateLandedCost } from 'src/components/utils/api/calculateLandedCost';\nimport { handleFetch } from 'src/components/utils/handleFetch';\nimport { isDarkColor } from 'src/components/utils/isDarkColor';\nimport { log } from 'src/components/utils/logging/log';\nimport { logError } from 'src/components/utils/logging/logError';\nimport { addressRuleStyle } from 'src/styles/stripe/addressRuleStyle';\nimport { defaultVariable } from 'src/styles/stripe/defaultVariable';\nimport type {\n CheckoutSessionCreateMutation,\n CheckoutSessionUpdateMutation,\n CountryCode,\n ElementsUiStyle,\n ElementsUiTheme,\n} from 'src/types/generated/graphql.customer.types';\n\nexport type ContactOption = {\n address: {\n city: string;\n country: string;\n line1: string;\n line2?: string;\n postal_code: string;\n state: string;\n };\n name: string;\n phone?: string;\n};\n\ntype StripeStore = {\n // client secret is used to render link and payment elements\n clientSecret: string | null;\n fetchingLandedCostAbordController: AbortController | null;\n // toggle to indicate if we are pre-fetching/fetching landed cost\n isFetchingLandedCost: boolean;\n // toggle to indicate if we are fetching checkout session\n isFetchingSession: boolean;\n stripe: Stripe | null;\n stripeAddressElement: StripeAddressElement | null;\n stripeAddressEventData: StripeAddressElementChangeEvent | null;\n stripeAddressUsedWhenFetchingLC: StripeAddressElementChangeEvent | null;\n stripeElements: StripeElements | null;\n stripeLinkElement: StripeLinkAuthenticationElement | null;\n stripeLinkEventData: StripeLinkAuthenticationElementChangeEvent | null;\n stripeLinkUsedWhenFetchingLC: StripeLinkAuthenticationElementChangeEvent | null;\n stripePaymentElement: StripePaymentElement | null;\n stripePaymentEventData: StripePaymentElementChangeEvent | null;\n};\n\nconst {\n onChange,\n reset,\n state: stripeStore,\n} = createStore<StripeStore>(() => ({\n clientSecret: sessionStorage.getItem('zonos--client-secret') || null,\n fetchingLandedCostAbordController: null,\n isFetchingLandedCost: false,\n isFetchingSession: false,\n stripe: null,\n stripeAddressElement: null,\n stripeAddressEventData: null,\n stripeAddressUsedWhenFetchingLC: null,\n stripeElements: null,\n stripeLinkElement: null,\n stripeLinkEventData: null,\n stripeLinkUsedWhenFetchingLC: null,\n stripePaymentElement: null,\n stripePaymentEventData: null,\n}));\n\nconst getStripeOptions = ({\n clientSecret,\n overrideBorderRaidus,\n overridePrimaryColor,\n overrideTheme,\n}: {\n clientSecret?: string;\n overrideBorderRaidus?: ElementsUiStyle;\n overridePrimaryColor?: string;\n overrideTheme?: ElementsUiTheme;\n}): StripeElementsOptionsClientSecret => {\n const primaryColor =\n overridePrimaryColor || zonosStore.appearance.colorPrimary;\n const themeBasedColor =\n primaryColor && isDarkColor(primaryColor) ? 'night' : 'flat';\n // if overrideTheme is provided, use it. Otherwise, use theme based on primary color\n const theme = overrideTheme === 'DARK' ? 'night' : 'flat';\n return {\n appearance: {\n labels: 'floating',\n rules: {\n ...addressRuleStyle({ theme: 'LIGHT' }),\n },\n // get contrast theme color base on primary color\n theme: overrideTheme ? theme : themeBasedColor,\n variables: {\n ...defaultVariable({\n borderStyle: overrideBorderRaidus,\n theme: 'LIGHT',\n }),\n },\n },\n clientSecret,\n locale: localizationStore.selectedLocale,\n };\n};\n\nconst initStripeElements = async (props?: {\n overrideBorderRaidus?: ElementsUiStyle;\n overridePrimaryColor?: string;\n overrideTheme?: ElementsUiTheme;\n}) => {\n const clientSecret = stripeStore.clientSecret;\n\n if (!stripeStore.stripe) {\n log('Skip. Stripe is not initialized');\n return;\n }\n if (clientSecret) {\n const stripeOptions = getStripeOptions({\n clientSecret,\n overrideBorderRaidus: props?.overrideBorderRaidus,\n overridePrimaryColor: props?.overridePrimaryColor,\n overrideTheme: props?.overrideTheme,\n });\n\n if (!stripeStore.stripeElements) {\n // init stripe elements if it doesn't exist\n stripeStore.stripeElements = stripeStore.stripe?.elements(stripeOptions);\n } else {\n // update elements with new option if it already exists\n stripeStore.stripeElements.update(stripeOptions);\n }\n log('Stripe elements initialized');\n }\n};\n\nconst stripeStoreReset = () => {\n // clean clientSecret so that we can start the new one.\n sessionStorage.removeItem('zonos--client-secret');\n\n // cleanup stripe elements\n reset();\n // set stripe back to window.Zonos.stripe\n stripeStore.stripe = window.Zonos.stripe;\n};\n\n/**\n * Check if the address and email info used when fetching landed cost with the current email and address info are different\n * Purpose is to resend the request if the info used when fetching landed cost is different from the current info\n */\nconst isPrefetchInfoOutdated = () => {\n const hasAbortController = stripeStore.fetchingLandedCostAbordController;\n if (!hasAbortController) {\n // if there is no abort controller, this is a new request\n return false;\n }\n\n const isLinkDataDirty =\n JSON.stringify(stripeStore.stripeLinkUsedWhenFetchingLC?.value) !==\n JSON.stringify(stripeStore.stripeLinkEventData?.value);\n const isAddressDataDirty =\n JSON.stringify(stripeStore.stripeAddressUsedWhenFetchingLC?.value) !==\n JSON.stringify(stripeStore.stripeAddressEventData?.value);\n\n return isLinkDataDirty || isAddressDataDirty;\n};\n\nconst stripeStorePrefetchLandedCost = async () => {\n const stripeAddressReady = !!stripeStore.stripeAddressEventData?.complete;\n const stripeLinkReady = !!stripeStore.stripeLinkEventData?.complete;\n const shouldRefetch = isPrefetchInfoOutdated();\n\n if (shouldRefetch) {\n // if the info used when fetching landed cost is different from the current info, abort the previous request\n stripeStore.fetchingLandedCostAbordController?.abort();\n stripeStore.fetchingLandedCostAbordController = null;\n }\n\n // only fetch if we are not fetching or we need to refetch\n if (\n stripeAddressReady &&\n stripeLinkReady &&\n (shouldRefetch || !stripeStore.isFetchingLandedCost)\n ) {\n stripeStore.isFetchingLandedCost = true;\n if (stripeStore.stripeAddressEventData) {\n stripeStore.stripeAddressUsedWhenFetchingLC = {\n ...stripeStore.stripeAddressEventData,\n };\n }\n if (stripeStore.stripeLinkEventData) {\n stripeStore.stripeLinkUsedWhenFetchingLC = {\n ...stripeStore.stripeLinkEventData,\n };\n }\n try {\n const abortController = new AbortController();\n stripeStore.fetchingLandedCostAbordController = abortController;\n const { checkoutSessionWorkflow, shipmentRatingCalculateWorkflow } =\n await calculateLandedCost(abortController);\n\n // reset abort controller after we are done\n stripeStore.fetchingLandedCostAbordController = null;\n\n // update cart store with landed cost info\n cartStore.landedCostData =\n checkoutSessionWorkflow?.filter(Boolean) || null;\n\n cartStore.shippingData =\n shipmentRatingCalculateWorkflow?.filter(Boolean) || null;\n // apply new subtotal and total, this is mainly to show items in the presentment currency\n const firstLandedCostData = cartStore.landedCostData?.find(Boolean);\n const subtotals = !!firstLandedCostData\n ? firstLandedCostData.subtotals\n : null;\n if (subtotals) {\n // prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet\n cartStoreApplySubtotals({\n exchangeRate: subtotals.exchangeRate,\n items: subtotals.items,\n landedCostTotal: 0,\n presentmentCurrencyCode: subtotals.presentmentCurrencyCode,\n shipping: 0,\n total: subtotals.items,\n });\n }\n } catch (err) {\n logError(err);\n }\n stripeStore.isFetchingLandedCost = false;\n }\n};\n\nconst getStripeMessageBasedOnStatus = (status?: PaymentIntent['status']) => {\n let messages: string[] = [];\n let isError = true;\n // Inspect the PaymentIntent `status` to indicate the status of the payment\n // to your customer.\n //\n // Some payment methods will [immediately succeed or fail][0] upon\n // confirmation, while others will first enter a `processing` state.\n //\n // [0]: https://stripe.com/docs/payments/payment-methods#payment-notification\n switch (status) {\n case 'succeeded': {\n messages = [\n translate(\n 'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.',\n ),\n '',\n '',\n translate(\n \"We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.\",\n ),\n ];\n isError = false;\n break;\n }\n case 'requires_capture':\n case 'processing': {\n messages = [\n translate(\n \"Payment processing. We'll update you when payment is received.\",\n ),\n ];\n isError = false;\n break;\n }\n\n case 'requires_payment_method': {\n messages = [\n translate('Payment failed. Please try another payment method.'),\n ];\n break;\n }\n\n default: {\n messages = [translate('Something went wrong.')];\n break;\n }\n }\n return {\n isError,\n messages,\n };\n};\n\nconst stripeStoreRetrievePayment = async ({\n clientSecret: _clientSecret,\n storybookForceStatus,\n}: {\n clientSecret: string | null;\n storybookForceStatus?: PaymentIntent['status'];\n}) => {\n if (storybookForceStatus) {\n // return status right away if we are in storybook mode\n const { isError, messages } =\n getStripeMessageBasedOnStatus(storybookForceStatus);\n\n return { error: isError, messages };\n }\n const clientSecret = _clientSecret || stripeStore.clientSecret;\n if (!stripeStore.stripe || !clientSecret) {\n logError('Failed to retrieve payment intent. Stripe is not initialized');\n return { error: true, message: [translate('Something went wrong.')] };\n }\n const { paymentIntent } = await stripeStore.stripe.retrievePaymentIntent(\n clientSecret,\n );\n\n const status = paymentIntent?.status;\n\n const { isError, messages } = getStripeMessageBasedOnStatus(status);\n\n return { error: isError, messages };\n};\n\nconst stripeStoreConfirmPayment = async () => {\n const stripePaymentReady = !!stripeStore.stripePaymentEventData?.complete;\n const stripeElements = stripeStore.stripeElements;\n const stripe = stripeStore.stripe;\n const stripeClientSecret = stripeStore.clientSecret;\n if (stripe && stripeElements && stripePaymentReady && stripeClientSecret) {\n const { error } = await stripe.confirmPayment({\n confirmParams: {\n receipt_email: stripeStore.stripeLinkEventData?.value?.email,\n return_url: window.location.href,\n },\n elements: stripeElements,\n redirect: 'if_required',\n });\n\n if (error) {\n if (error.type === 'card_error' || error.type === 'validation_error') {\n throw new Error(error.message);\n }\n if (error.type === 'invalid_request_error') {\n if (error.code === 'payment_intent_unexpected_state') {\n // PaymentIntent was canceled or expired, or status is `require_capture`.\n // don't throw error here because we will reset the checkout session last step\n return;\n }\n }\n throw new Error('An unexpected error occurred.');\n }\n }\n};\n\ntype CheckoutSessionCreateRequest = {\n currency: string;\n itemsAmount: number;\n presentmentCountryCode: CountryCode | null;\n};\n\n/**\n * Init checkout session\n * @returns {boolean} whether or not the checkout session is successfully created\n */\nconst stripeStoreInitCheckoutSession = async () => {\n const total = cartStore.items.reduce(\n (amount, item) => amount + item.amount * item.quantity,\n 0,\n );\n\n if (!total || !localizationStore.targetCurrency) {\n logError('Fail to create checkout session - invalid total or currency');\n return false;\n }\n\n stripeStore.isFetchingSession = true;\n\n const { errors, json } = await handleFetch<\n CheckoutSessionCreateMutation,\n CheckoutSessionCreateRequest\n >(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/create-checkout-session`, {\n body: {\n currency: cartStore.items.find(Boolean)?.currencyCode || '',\n itemsAmount: total,\n presentmentCountryCode: localizationStore.selectedCountryCode || null,\n },\n method: 'POST',\n });\n\n stripeStore.isFetchingSession = false;\n\n if (errors.length || !json) {\n logError(\n 'Error occurs when creating checkout session',\n JSON.stringify(errors, null, 2),\n );\n\n return false;\n }\n const result = json.checkoutSessionCreate;\n\n stripeStore.clientSecret = result.clientSecret;\n // update cart store with updated informations\n cartStore.checkoutSessionId = result.id;\n cartStoreApplySubtotals({\n ...result.subtotals,\n landedCostTotal: 0,\n shipping: 0,\n total: result.subtotals.items,\n });\n log(\n 'Exchange rate updated for cart items (checkout session create)',\n 'info',\n cartStore.exchangeRate,\n );\n\n log('done-init-checkout-session');\n return true;\n};\n\ntype CheckoutSessionUpdateRequest = {\n currency?: string;\n id: string;\n itemsAmount?: number;\n landedCostId?: string;\n presentmentCountryCode: CountryCode | null;\n};\n/**\n * Update checkout session. Use for updating amount with landed cost id, or update session when cart items change\n */\nconst stripeStoreUpdateCheckoutSession = async ({\n currency,\n id,\n itemsAmount,\n landedCostId,\n presentmentCountryCode,\n}: CheckoutSessionUpdateRequest) => {\n // No need to set loading state here because this function will be called under the hood to update\n // landed cost id for the section.\n const { errors, json } = await handleFetch<\n CheckoutSessionUpdateMutation,\n CheckoutSessionUpdateRequest\n >(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/update-checkout-session`, {\n body: {\n currency,\n id,\n itemsAmount,\n landedCostId,\n presentmentCountryCode,\n },\n method: 'POST',\n });\n\n if (errors.length || !json) {\n logError(\n 'Error occurs when updating checkout session',\n JSON.stringify(errors, null, 2),\n );\n return { errors, json };\n }\n\n return { errors: [], json };\n};\n\nonChange('clientSecret', clientSecret => {\n // update stripe elements when client secret changes\n if (clientSecret && stripeStore.stripe) {\n sessionStorage.setItem('zonos--client-secret', clientSecret);\n }\n\n if (!clientSecret) {\n sessionStorage.removeItem('zonos--client-secret');\n }\n});\n\nexport {\n initStripeElements,\n stripeStore,\n stripeStoreConfirmPayment,\n stripeStoreInitCheckoutSession,\n stripeStorePrefetchLandedCost,\n stripeStoreReset,\n stripeStoreRetrievePayment,\n stripeStoreUpdateCheckoutSession,\n};\n","type Params = {\n date: Date;\n /**\n * Format options for Intl.DateTimeFormat\n * @default {day:'numeric',weekday:'long',year:'numeric'} Thursday 3, 2023\n */\n formatOptions?: Intl.DateTimeFormatOptions;\n};\n\nexport const formatDate = ({\n date,\n formatOptions = { day: 'numeric', weekday: 'long', year: 'numeric' },\n}: Params): string => {\n // format date to Thursday 3, 2023\n return new Intl.DateTimeFormat('en-US', formatOptions).format(date);\n};\n","export const getDaysDifference = (targetDate: Date) => {\n const currentDate = new Date();\n const timeDifference = targetDate.getTime() - currentDate.getTime();\n const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); // Convert milliseconds to days\n return daysDifference;\n};\n","import { createStore } from '@stencil/store';\n\nimport {\n stripeStore,\n stripeStoreUpdateCheckoutSession,\n} from 'src/components/store/checkout/stripe';\nimport { localizationStore } from 'src/components/store/hello/localization';\nimport { translate } from 'src/components/store/translationStore';\nimport { formatDate } from 'src/components/utils/formatDate';\nimport { getDaysDifference } from 'src/components/utils/getDaysDifference';\nimport { log } from 'src/components/utils/logging/log';\nimport { logError } from 'src/components/utils/logging/logError';\nimport type {\n CheckoutPresentmentFragment,\n CurrencyCode,\n ShipmentRatingFragment,\n} from 'src/types/generated/graphql.customer.types';\n\nexport type CartItem = {\n amount: number;\n countryOfOrigin?: string;\n currencyCode: string;\n description?: string;\n hsCode?: string;\n imageUrl?: string;\n name: string;\n productId?: string;\n quantity: number;\n};\n\ntype CartStore = {\n checkoutSessionId: string | null;\n currency: CurrencyCode;\n dutiesTaxFees: number;\n error: {\n messages: string[];\n title: string;\n } | null;\n exchangeRate: {\n id: string;\n rate: number;\n sourceCurrencyCode: CurrencyCode;\n targetCurrencyCode: CurrencyCode;\n type: string;\n } | null;\n isSelectedShippingAboveDeminimis: boolean;\n isSelectedShippingGuarantee: boolean;\n items: CartItem[];\n landedCostData: CheckoutPresentmentFragment[] | null;\n selectedLandedCost: CheckoutPresentmentFragment | null;\n selectedShippingOption: ShipmentRatingFragment | null;\n selectedShippingOptionExpectedDate: string;\n selectedShippingOptionTransitTime: string;\n shipping: number;\n shippingData: ShipmentRatingFragment[] | null;\n step: 'customer-info' | 'shipping' | 'payment' | 'finish' | 'error';\n subtotal: number;\n total: number;\n};\n\nconst {\n onChange,\n reset,\n state: cartStore,\n} = createStore<CartStore>(() => ({\n checkoutSessionId:\n sessionStorage.getItem('zonos--checkout-session-id') || null,\n currency: 'USD',\n dutiesTaxFees: 0,\n error: null,\n exchangeRate: null,\n isSelectedShippingAboveDeminimis: false,\n isSelectedShippingGuarantee: false,\n items: [],\n landedCostData: null,\n selectedLandedCost: null,\n selectedShippingOption: null,\n selectedShippingOptionExpectedDate: '',\n selectedShippingOptionTransitTime: '',\n shipping: 0,\n shippingData: null,\n step: 'customer-info',\n subtotal: 0,\n total: 0,\n}));\n\n/**\n * Format shipping transit info to be displayed on UI\n * @returns\n * - expectedDate: Thursday, Aug 12\n * - maxTransit: 5\n * - minTransit: 3\n */\nconst cartStoreGetShippingTransitInfo = (item: ShipmentRatingFragment) => {\n const minTransit = item.minTransitAt\n ? getDaysDifference(new Date(item.minTransitAt))\n : '';\n const maxTransit = item.maxTransitAt\n ? getDaysDifference(new Date(item.maxTransitAt))\n : '';\n const expectedDate = item.minTransitAt\n ? formatDate({\n date: new Date(item.minTransitAt),\n })\n : '';\n return {\n expectedDate,\n maxTransit,\n minTransit,\n };\n};\n\nconst cartStoreReset = () => {\n sessionStorage.removeItem('zonos--checkout-session-id');\n\n // reset cart store\n reset();\n};\n\nconst cartStoreUpdateToErrorState = ({\n messages,\n title,\n}: {\n messages: string[];\n title: string;\n}) => {\n cartStore.step = 'error';\n cartStore.error = {\n messages,\n title,\n };\n};\n\ntype CartSubtotals = {\n exchangeRate: {\n id: string;\n rate: number;\n sourceCurrencyCode: CurrencyCode;\n targetCurrencyCode: CurrencyCode;\n type: string;\n };\n items: number;\n landedCostTotal: number;\n presentmentCurrencyCode: CurrencyCode;\n shipping: number;\n total: number;\n};\n\nconst cartStoreApplySubtotals = (subtotals: CartSubtotals) => {\n // update exchange rate so we can use it to display cart items\n cartStore.exchangeRate = subtotals.exchangeRate;\n cartStore.dutiesTaxFees = subtotals.landedCostTotal;\n cartStore.subtotal = subtotals.items;\n cartStore.total = subtotals.total;\n cartStore.currency = subtotals.presentmentCurrencyCode;\n};\n\ntype CartStoreRecalculateTotalParams = Omit<\n Parameters<typeof stripeStoreUpdateCheckoutSession>[0],\n 'id' | 'presentmentCountryCode'\n>;\n\nconst cartStoreReCalculateTotal = async ({\n currency,\n itemsAmount,\n landedCostId,\n}: CartStoreRecalculateTotalParams) => {\n if (landedCostId && cartStore.selectedLandedCost) {\n // update cart total right away if we have landed cost id to avoid order total flickering\n const subtotals = cartStore.selectedLandedCost.subtotals;\n cartStoreApplySubtotals(subtotals);\n log(\n 'Exchange rate updated for cart items (landed cost subtotal)',\n 'info',\n cartStore.exchangeRate,\n );\n }\n // update checkout session\n if (!cartStore.checkoutSessionId) {\n logError('Could update cart total without checkout session id');\n return false;\n }\n const { json } = await stripeStoreUpdateCheckoutSession({\n currency,\n id: cartStore.checkoutSessionId,\n itemsAmount,\n landedCostId,\n presentmentCountryCode: localizationStore.selectedCountryCode,\n });\n if (!json) {\n // do nothing if we can't get checkout session\n logError('Error occurs when updating checkout session');\n cartStoreUpdateToErrorState({\n messages: [\n translate(\n \"There's been an error updating your checkout session. Please reload and try again or contact support if the error persists\",\n ),\n ],\n title: translate('Error updating Checkout'),\n });\n return false;\n }\n if (!landedCostId) {\n // This is when first open the checkout modal and we just want to get info from the old cart session.\n // use subtotals from checkout session to update cart total\n cartStoreApplySubtotals(json.checkoutSessionUpdate.subtotals);\n log(\n 'Exchange rate updated for cart items (checkout session update)',\n 'info',\n cartStore.exchangeRate,\n );\n }\n return true;\n};\n\nconst cartStoreUpdateSelectedShippingOption = async (\n selectedShippingOption: ShipmentRatingFragment,\n) => {\n cartStore.selectedShippingOption = selectedShippingOption;\n\n // update shipping transit info\n const { expectedDate, maxTransit, minTransit } =\n cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption);\n cartStore.selectedShippingOptionExpectedDate = expectedDate;\n cartStore.selectedShippingOptionTransitTime =\n minTransit && maxTransit\n ? `${minTransit}-${maxTransit}`\n : `${minTransit || maxTransit}`;\n\n const selectedLandedCost = cartStore.landedCostData?.find(\n checkoutSessionPresentment =>\n checkoutSessionPresentment.landedCost?.shipmentRating?.id ===\n cartStore.selectedShippingOption?.id,\n );\n // save selected landed cost for later use\n cartStore.selectedLandedCost = selectedLandedCost || null;\n\n if (!selectedLandedCost) {\n // do nothing if we can't find landed cost for selected shipping option\n return false;\n }\n\n // update shipping value and dutiesTaxFees on selectedShippingOption change\n cartStore.shipping = selectedLandedCost.subtotals.shipping;\n\n // update deminimis status\n const isGuarantee =\n selectedLandedCost?.landedCost?.landedCostGuaranteeCode === 'ZONOS';\n // one item in deminimis with type of duty and tax has threshold value is \"ABOVE\"\n const isAboveDeminimis = !!selectedLandedCost?.landedCost?.deMinimis?.find(\n item => ['DUTY', 'TAX'].includes(item.type) && item.threshold === 'ABOVE',\n );\n cartStore.isSelectedShippingAboveDeminimis = isAboveDeminimis;\n cartStore.isSelectedShippingGuarantee = isGuarantee;\n // update session with selected landed cost\n const updateCalulateStatus = await cartStoreReCalculateTotal({\n landedCostId: selectedLandedCost.landedCost?.id,\n });\n return updateCalulateStatus;\n};\n\nonChange('checkoutSessionId', () => {\n if (!cartStore.checkoutSessionId) {\n sessionStorage.removeItem('zonos--checkout-session-id');\n return;\n }\n sessionStorage.setItem(\n 'zonos--checkout-session-id',\n cartStore.checkoutSessionId,\n );\n});\n\nconst cartStoreUpdateItems = async (items: CartItem[]) => {\n cartStore.items = items;\n const currency = items.find(Boolean)?.currencyCode as CurrencyCode;\n const total = items.reduce((amt, item) => {\n return amt + item.amount * item.quantity;\n }, 0);\n if (!currency || !total) {\n // do nothing if we can't get currency or total\n return;\n }\n cartStore.currency = currency;\n // set loading state here because this is first load checkout session when we already have checkout session id stored\n stripeStore.isFetchingSession = true;\n await cartStoreReCalculateTotal({\n currency: currency,\n itemsAmount: total,\n });\n stripeStore.isFetchingSession = false;\n};\n\nconst cartStoreResetSelectedShippingOption = () => {\n cartStore.selectedShippingOption = null;\n cartStore.isSelectedShippingAboveDeminimis = false;\n cartStore.isSelectedShippingGuarantee = false;\n cartStore.selectedShippingOptionExpectedDate = '';\n cartStore.selectedShippingOptionTransitTime = '';\n cartStore.shipping = 0;\n};\n\nconst cartStoreNextStep = () => {\n if (cartStore.step === 'customer-info') {\n cartStore.step = 'shipping';\n } else if (cartStore.step === 'shipping') {\n cartStore.step = 'payment';\n } else if (cartStore.step === 'payment') {\n cartStore.step = 'finish';\n }\n};\n\nconst cartStorePreviousStep = () => {\n if (cartStore.step === 'payment') {\n cartStore.step = 'shipping';\n } else if (cartStore.step === 'shipping') {\n cartStore.step = 'customer-info';\n // reset selected shipping option\n cartStoreResetSelectedShippingOption();\n }\n};\n\nexport {\n cartStore,\n cartStoreApplySubtotals,\n cartStoreGetShippingTransitInfo,\n cartStoreNextStep,\n cartStorePreviousStep,\n cartStoreReCalculateTotal,\n cartStoreReset,\n cartStoreUpdateItems,\n cartStoreUpdateSelectedShippingOption,\n cartStoreUpdateToErrorState,\n};\n"],"mappings":"yzDAIO,IAAMA,EAA0B,WAErC,IAAMC,EAAiBC,EAAYC,oBAEnC,IAAMC,EAAoBF,EAAYG,uBACtC,IAAKD,IAAsBA,EAAkBE,SAAU,CACrD,MAAM,IAAIC,MAAM,8B,CAGlB,MAAO,CACLC,kBAAmBC,EAAUD,mBAAqB,GAClDE,QAAS,CACPC,OAAOV,IAAc,MAAdA,SAAc,SAAdA,EAAgBW,MAAMD,QAAS,GAGtCE,UAAWT,EAAkBQ,MAAMC,WAAa,GAChDC,SAAUV,EAAkBQ,MAAME,UAAY,GAC9CC,MAAOX,EAAkBQ,MAAMG,OAAS,IAE1CC,MAAOP,EAAUO,MAAMC,KAAI,SAAAC,GAAI,OAC7BC,OAAQD,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,S,MACZ,GAAI5M,EAAU4M,OAAS,UAAW,CACvC5M,EAAU4M,KAAO,Q,CAErB,I,IAEM6B,EAAqB7J,EAAA,KAAG,WAC5B,GAAI5E,EAAU4M,OAAS,UAAW,CAChC5M,EAAU4M,KAAO,U,MACZ,GAAI5M,EAAU4M,OAAS,WAAY,CACxC5M,EAAU4M,KAAO,gBAEjB2B,G,CAEJ,G"}
|
|
1
|
+
{"version":3,"names":["prepCalculateLandedCost","stripeLinkData","stripeStore","stripeLinkEventData","stripeAddressData","stripeAddressEventData","complete","Error","checkoutSessionId","cartStore","contact","email","value","firstName","lastName","phone","items","map","item","amount","countryOfOrigin","currencyCode","imageUrl","name","productId","quantity","shippingAddress","addressLine1","address","line1","addressLine2","line2","city","country","postalCode","postal_code","state","calculateLandedCost","abortController","__awaiter","_this","url","concat","handleFetch","body","method","signal","_f","_g","sent","errors","json","length","addressRuleStyle","theme","padding","paddingBottom","paddingLeft","paddingRight","paddingTop","defaultVariable","borderStyle","borderRadius","getBorderRadius","colorBackground","colorBackgroundText","colorText","colorTextPlaceholder","createStore","clientSecret","sessionStorage","getItem","fetchingLandedCostAbordController","isFetchingLandedCost","isFetchingSession","stripe","stripeAddressElement","stripeAddressUsedWhenFetchingLC","stripeElements","stripeLinkElement","stripeLinkUsedWhenFetchingLC","stripePaymentElement","stripePaymentEventData","onChange","reset","exports","getStripeOptions","overrideBorderRaidus","overridePrimaryColor","overrideTheme","primaryColor","zonosStore","appearance","colorPrimary","themeBasedColor","isDarkColor","labels","rules","Object","assign","variables","locale","localizationStore","selectedLocale","initStripeElements","props","log","stripeOptions","_a","elements","update","stripeStoreReset","removeItem","window","Zonos","isPrefetchInfoOutdated","hasAbortController","isLinkDataDirty","JSON","stringify","_b","isAddressDataDirty","_c","_d","stripeStorePrefetchLandedCost","stripeAddressReady","stripeLinkReady","shouldRefetch","abort","AbortController","checkoutSessionWorkflow","shipmentRatingCalculateWorkflow","landedCostData","filter","Boolean","shippingData","firstLandedCostData","find","subtotals","cartStoreApplySubtotals","exchangeRate","landedCostTotal","presentmentCurrencyCode","shipping","total","logError","err_1","getStripeMessageBasedOnStatus","status","messages","isError","translate","stripeStoreRetrievePayment","_clientSecret","storybookForceStatus","isError_1","messages_1","error","message","retrievePaymentIntent","paymentIntent","_j","_h","stripeStoreConfirmPayment","stripePaymentReady","stripeClientSecret","confirmPayment","confirmParams","receipt_email","return_url","location","href","redirect","type","code","stripeStoreInitCheckoutSession","reduce","targetCurrency","currency","itemsAmount","presentmentCountryCode","selectedCountryCode","result","checkoutSessionCreate","id","stripeStoreUpdateCheckoutSession","landedCostId","setItem","formatDate","date","formatOptions","day","weekday","year","Intl","DateTimeFormat","format","getDaysDifference","targetDate","currentDate","Date","timeDifference","getTime","daysDifference","Math","floor","dutiesTaxFees","isSelectedShippingAboveDeminimis","isSelectedShippingGuarantee","selectedLandedCost","selectedShippingOption","selectedShippingOptionExpectedDate","selectedShippingOptionTransitTime","step","subtotal","cartStoreGetShippingTransitInfo","minTransit","minTransitAt","maxTransit","maxTransitAt","expectedDate","cartStoreReset","cartStoreUpdateToErrorState","title","cartStoreReCalculateTotal","checkoutSessionUpdate","cartStoreUpdateSelectedShippingOption","checkoutSessionPresentment","landedCost","shipmentRating","isGuarantee","landedCostGuaranteeCode","isAboveDeminimis","deMinimis","includes","threshold","_e","updateCalulateStatus","cartStoreUpdateItems","amt","cartStoreResetSelectedShippingOption","cartStoreNextStep","cartStorePreviousStep"],"sources":["src/components/utils/api/prepCalculateLandedCost.ts","src/components/utils/api/calculateLandedCost.ts","src/styles/stripe/addressRuleStyle.ts","src/styles/stripe/defaultVariable.ts","src/components/store/checkout/stripe.ts","src/components/utils/formatDate.ts","src/components/utils/getDaysDifference.ts","src/components/store/checkout/cart.ts"],"sourcesContent":["import { cartStore } from 'src/components/store/checkout/cart';\nimport { stripeStore } from 'src/components/store/checkout/stripe';\nimport type { CalculateLandedCostRequest } from 'src/types/checkout/api/CalculateLandedCostRequest';\n\nexport const prepCalculateLandedCost = (): CalculateLandedCostRequest => {\n // maybe we don't need email now for prefetch the landed cost\n const stripeLinkData = stripeStore.stripeLinkEventData;\n\n const stripeAddressData = stripeStore.stripeAddressEventData;\n if (!stripeAddressData || !stripeAddressData.complete) {\n throw new Error('Missing stripe address data');\n }\n\n return {\n checkoutSessionId: cartStore.checkoutSessionId || '',\n contact: {\n email: stripeLinkData?.value.email || '',\n // firstName and lastName should be valid now since stripe only mark\n // the address as complete when both fields are filled.\n firstName: stripeAddressData.value.firstName || '',\n lastName: stripeAddressData.value.lastName || '',\n phone: stripeAddressData.value.phone || '',\n },\n items: cartStore.items.map(item => ({\n amount: item.amount,\n countryOfOrigin: item.countryOfOrigin,\n currencyCode: item.currencyCode,\n imageUrl: item.imageUrl,\n name: item.name,\n productId: item.productId,\n quantity: item.quantity,\n })),\n shippingAddress: {\n addressLine1: stripeAddressData.value.address.line1,\n addressLine2: stripeAddressData.value.address.line2 || '',\n city: stripeAddressData.value.address.city,\n country: stripeAddressData.value.address.country,\n postalCode: stripeAddressData.value.address.postal_code,\n state: stripeAddressData.value.address.state,\n },\n };\n};\n","import { prepCalculateLandedCost } from 'src/components/utils/api/prepCalculateLandedCost';\nimport { handleFetch } from 'src/components/utils/handleFetch';\nimport type { CalculateLandedCostRequest } from 'src/types/checkout/api/CalculateLandedCostRequest';\nimport type { CalculateLandedCostMutation } from 'src/types/generated/graphql.customer.types';\n\nexport const calculateLandedCost = async (\n abortController?: AbortController,\n) => {\n // request to get landed cost info\n const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/calculate-landed-cost`;\n const { errors, json } = await handleFetch<\n CalculateLandedCostMutation,\n CalculateLandedCostRequest\n >(url, {\n body: prepCalculateLandedCost(),\n method: 'POST',\n signal: abortController?.signal,\n });\n if (errors.length || !json) {\n throw new Error('Failed to calculate landed cost');\n }\n\n return json;\n};\n","import type { ElementsUiTheme, StripeRuleType } from 'src/types';\n\nexport const addressRuleStyle = ({\n theme,\n}: {\n theme: ElementsUiTheme;\n}): StripeRuleType => {\n switch (theme) {\n default:\n return {\n '.Input': {\n // need to reset everything and the paddingTop to default, otherwise the paddingTop will not be updated.\n padding: '0',\n paddingBottom: '8px',\n paddingLeft: '16px',\n paddingRight: '8px',\n // any value here will be add up to the default paddingTop (20px).\n paddingTop: '6px',\n },\n };\n }\n};\n","import type { Appearance } from '@stripe/stripe-js';\n\nimport { getBorderRadius } from 'src/components/utils/getBorderRadius';\nimport type {\n ElementsUiStyle,\n ElementsUiTheme,\n} from 'src/types/generated/graphql.customer.types';\n\nexport const defaultVariable = ({\n borderStyle,\n theme,\n}: {\n borderStyle?: ElementsUiStyle;\n theme: ElementsUiTheme;\n}): Appearance['variables'] => {\n switch (theme) {\n case 'DARK':\n return {\n borderRadius: getBorderRadius(borderStyle),\n colorBackground: '#101117',\n colorBackgroundText: '#C5C6CA',\n colorText: '#C5C6CA',\n colorTextPlaceholder: '#C5C6CA',\n };\n default:\n return {\n borderRadius: getBorderRadius(borderStyle),\n };\n }\n};\n","import { createStore } from '@stencil/store';\nimport type {\n PaymentIntent,\n Stripe,\n StripeAddressElement,\n StripeAddressElementChangeEvent,\n StripeElements,\n StripeElementsOptionsClientSecret,\n StripeLinkAuthenticationElement,\n StripeLinkAuthenticationElementChangeEvent,\n StripePaymentElement,\n StripePaymentElementChangeEvent,\n} from '@stripe/stripe-js';\n\nimport {\n cartStore,\n cartStoreApplySubtotals,\n} from 'src/components/store/checkout/cart';\nimport { localizationStore } from 'src/components/store/hello/localization';\nimport { translate } from 'src/components/store/translationStore';\nimport { zonosStore } from 'src/components/store/zonosStore';\nimport { calculateLandedCost } from 'src/components/utils/api/calculateLandedCost';\nimport { handleFetch } from 'src/components/utils/handleFetch';\nimport { isDarkColor } from 'src/components/utils/isDarkColor';\nimport { log } from 'src/components/utils/logging/log';\nimport { logError } from 'src/components/utils/logging/logError';\nimport { addressRuleStyle } from 'src/styles/stripe/addressRuleStyle';\nimport { defaultVariable } from 'src/styles/stripe/defaultVariable';\nimport type {\n CheckoutSessionCreateMutation,\n CheckoutSessionUpdateMutation,\n CountryCode,\n ElementsUiStyle,\n ElementsUiTheme,\n} from 'src/types/generated/graphql.customer.types';\n\nexport type ContactOption = {\n address: {\n city: string;\n country: string;\n line1: string;\n line2?: string;\n postal_code: string;\n state: string;\n };\n name: string;\n phone?: string;\n};\n\ntype StripeStore = {\n // client secret is used to render link and payment elements\n clientSecret: string | null;\n fetchingLandedCostAbordController: AbortController | null;\n // toggle to indicate if we are pre-fetching/fetching landed cost\n isFetchingLandedCost: boolean;\n // toggle to indicate if we are fetching checkout session\n isFetchingSession: boolean;\n stripe: Stripe | null;\n stripeAddressElement: StripeAddressElement | null;\n stripeAddressEventData: StripeAddressElementChangeEvent | null;\n stripeAddressUsedWhenFetchingLC: StripeAddressElementChangeEvent | null;\n stripeElements: StripeElements | null;\n stripeLinkElement: StripeLinkAuthenticationElement | null;\n stripeLinkEventData: StripeLinkAuthenticationElementChangeEvent | null;\n stripeLinkUsedWhenFetchingLC: StripeLinkAuthenticationElementChangeEvent | null;\n stripePaymentElement: StripePaymentElement | null;\n stripePaymentEventData: StripePaymentElementChangeEvent | null;\n};\n\nconst {\n onChange,\n reset,\n state: stripeStore,\n} = createStore<StripeStore>(() => ({\n clientSecret: sessionStorage.getItem('zonos--client-secret') || null,\n fetchingLandedCostAbordController: null,\n isFetchingLandedCost: false,\n isFetchingSession: false,\n stripe: null,\n stripeAddressElement: null,\n stripeAddressEventData: null,\n stripeAddressUsedWhenFetchingLC: null,\n stripeElements: null,\n stripeLinkElement: null,\n stripeLinkEventData: null,\n stripeLinkUsedWhenFetchingLC: null,\n stripePaymentElement: null,\n stripePaymentEventData: null,\n}));\n\nconst getStripeOptions = ({\n clientSecret,\n overrideBorderRaidus,\n overridePrimaryColor,\n overrideTheme,\n}: {\n clientSecret?: string;\n overrideBorderRaidus?: ElementsUiStyle;\n overridePrimaryColor?: string;\n overrideTheme?: ElementsUiTheme;\n}): StripeElementsOptionsClientSecret => {\n const primaryColor =\n overridePrimaryColor || zonosStore.appearance.colorPrimary;\n const themeBasedColor =\n primaryColor && isDarkColor(primaryColor) ? 'night' : 'flat';\n // if overrideTheme is provided, use it. Otherwise, use theme based on primary color\n const theme = overrideTheme === 'DARK' ? 'night' : 'flat';\n return {\n appearance: {\n labels: 'floating',\n rules: {\n ...addressRuleStyle({ theme: 'LIGHT' }),\n },\n // get contrast theme color base on primary color\n theme: overrideTheme ? theme : themeBasedColor,\n variables: {\n ...defaultVariable({\n borderStyle: overrideBorderRaidus,\n theme: 'LIGHT',\n }),\n },\n },\n clientSecret,\n locale: localizationStore.selectedLocale,\n };\n};\n\nconst initStripeElements = async (props?: {\n overrideBorderRaidus?: ElementsUiStyle;\n overridePrimaryColor?: string;\n overrideTheme?: ElementsUiTheme;\n}) => {\n const clientSecret = stripeStore.clientSecret;\n\n if (!stripeStore.stripe) {\n log('Skip. Stripe is not initialized');\n return;\n }\n if (clientSecret) {\n const stripeOptions = getStripeOptions({\n clientSecret,\n overrideBorderRaidus: props?.overrideBorderRaidus,\n overridePrimaryColor: props?.overridePrimaryColor,\n overrideTheme: props?.overrideTheme,\n });\n\n if (!stripeStore.stripeElements) {\n // init stripe elements if it doesn't exist\n stripeStore.stripeElements = stripeStore.stripe?.elements(stripeOptions);\n } else {\n // update elements with new option if it already exists\n stripeStore.stripeElements.update(stripeOptions);\n }\n log('Stripe elements initialized');\n }\n};\n\nconst stripeStoreReset = () => {\n // clean clientSecret so that we can start the new one.\n sessionStorage.removeItem('zonos--client-secret');\n\n // cleanup stripe elements\n reset();\n // set stripe back to window.Zonos.stripe\n stripeStore.stripe = window.Zonos.stripe;\n};\n\n/**\n * Check if the address and email info used when fetching landed cost with the current email and address info are different\n * Purpose is to resend the request if the info used when fetching landed cost is different from the current info\n */\nconst isPrefetchInfoOutdated = () => {\n const hasAbortController = stripeStore.fetchingLandedCostAbordController;\n if (!hasAbortController) {\n // if there is no abort controller, this is a new request\n return false;\n }\n\n const isLinkDataDirty =\n JSON.stringify(stripeStore.stripeLinkUsedWhenFetchingLC?.value) !==\n JSON.stringify(stripeStore.stripeLinkEventData?.value);\n const isAddressDataDirty =\n JSON.stringify(stripeStore.stripeAddressUsedWhenFetchingLC?.value) !==\n JSON.stringify(stripeStore.stripeAddressEventData?.value);\n\n return isLinkDataDirty || isAddressDataDirty;\n};\n\nconst stripeStorePrefetchLandedCost = async () => {\n const stripeAddressReady = !!stripeStore.stripeAddressEventData?.complete;\n const stripeLinkReady = !!stripeStore.stripeLinkEventData?.complete;\n const shouldRefetch = isPrefetchInfoOutdated();\n\n if (shouldRefetch) {\n // if the info used when fetching landed cost is different from the current info, abort the previous request\n stripeStore.fetchingLandedCostAbordController?.abort();\n stripeStore.fetchingLandedCostAbordController = null;\n }\n\n // only fetch if we are not fetching or we need to refetch\n if (\n stripeAddressReady &&\n stripeLinkReady &&\n (shouldRefetch || !stripeStore.isFetchingLandedCost)\n ) {\n stripeStore.isFetchingLandedCost = true;\n if (stripeStore.stripeAddressEventData) {\n stripeStore.stripeAddressUsedWhenFetchingLC = {\n ...stripeStore.stripeAddressEventData,\n };\n }\n if (stripeStore.stripeLinkEventData) {\n stripeStore.stripeLinkUsedWhenFetchingLC = {\n ...stripeStore.stripeLinkEventData,\n };\n }\n try {\n const abortController = new AbortController();\n stripeStore.fetchingLandedCostAbordController = abortController;\n const { checkoutSessionWorkflow, shipmentRatingCalculateWorkflow } =\n await calculateLandedCost(abortController);\n\n // reset abort controller after we are done\n stripeStore.fetchingLandedCostAbordController = null;\n\n // update cart store with landed cost info\n cartStore.landedCostData =\n checkoutSessionWorkflow?.filter(Boolean) || null;\n\n cartStore.shippingData =\n shipmentRatingCalculateWorkflow?.filter(Boolean) || null;\n // apply new subtotal and total, this is mainly to show items in the presentment currency\n const firstLandedCostData = cartStore.landedCostData?.find(Boolean);\n const subtotals = !!firstLandedCostData\n ? firstLandedCostData.subtotals\n : null;\n if (subtotals) {\n // prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet\n cartStoreApplySubtotals({\n exchangeRate: subtotals.exchangeRate,\n items: subtotals.items,\n landedCostTotal: 0,\n presentmentCurrencyCode: subtotals.presentmentCurrencyCode,\n shipping: 0,\n total: subtotals.items,\n });\n }\n } catch (err) {\n logError(err);\n }\n stripeStore.isFetchingLandedCost = false;\n }\n};\n\nconst getStripeMessageBasedOnStatus = (status?: PaymentIntent['status']) => {\n let messages: string[] = [];\n let isError = true;\n // Inspect the PaymentIntent `status` to indicate the status of the payment\n // to your customer.\n //\n // Some payment methods will [immediately succeed or fail][0] upon\n // confirmation, while others will first enter a `processing` state.\n //\n // [0]: https://stripe.com/docs/payments/payment-methods#payment-notification\n switch (status) {\n case 'succeeded': {\n messages = [\n translate(\n 'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.',\n ),\n '',\n '',\n translate(\n \"We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.\",\n ),\n ];\n isError = false;\n break;\n }\n case 'requires_capture':\n case 'processing': {\n messages = [\n translate(\n \"Payment processing. We'll update you when payment is received.\",\n ),\n ];\n isError = false;\n break;\n }\n\n case 'requires_payment_method': {\n messages = [\n translate('Payment failed. Please try another payment method.'),\n ];\n break;\n }\n\n default: {\n messages = [translate('Something went wrong.')];\n break;\n }\n }\n return {\n isError,\n messages,\n };\n};\n\nconst stripeStoreRetrievePayment = async ({\n clientSecret: _clientSecret,\n storybookForceStatus,\n}: {\n clientSecret: string | null;\n storybookForceStatus?: PaymentIntent['status'];\n}) => {\n if (storybookForceStatus) {\n // return status right away if we are in storybook mode\n const { isError, messages } =\n getStripeMessageBasedOnStatus(storybookForceStatus);\n\n return { error: isError, messages };\n }\n const clientSecret = _clientSecret || stripeStore.clientSecret;\n if (!stripeStore.stripe || !clientSecret) {\n logError('Failed to retrieve payment intent. Stripe is not initialized');\n return { error: true, message: [translate('Something went wrong.')] };\n }\n const { paymentIntent } = await stripeStore.stripe.retrievePaymentIntent(\n clientSecret,\n );\n\n const status = paymentIntent?.status;\n\n const { isError, messages } = getStripeMessageBasedOnStatus(status);\n\n return { error: isError, messages };\n};\n\nconst stripeStoreConfirmPayment = async () => {\n const stripePaymentReady = !!stripeStore.stripePaymentEventData?.complete;\n const stripeElements = stripeStore.stripeElements;\n const stripe = stripeStore.stripe;\n const stripeClientSecret = stripeStore.clientSecret;\n if (stripe && stripeElements && stripePaymentReady && stripeClientSecret) {\n const { error } = await stripe.confirmPayment({\n confirmParams: {\n receipt_email: stripeStore.stripeLinkEventData?.value?.email,\n return_url: window.location.href,\n },\n elements: stripeElements,\n redirect: 'if_required',\n });\n\n if (error) {\n if (error.type === 'card_error' || error.type === 'validation_error') {\n throw new Error(error.message);\n }\n if (error.type === 'invalid_request_error') {\n if (error.code === 'payment_intent_unexpected_state') {\n // PaymentIntent was canceled or expired, or status is `require_capture`.\n // don't throw error here because we will reset the checkout session last step\n return;\n }\n }\n throw new Error('An unexpected error occurred.');\n }\n }\n};\n\ntype CheckoutSessionCreateRequest = {\n currency: string;\n itemsAmount: number;\n presentmentCountryCode: CountryCode | null;\n};\n\n/**\n * Init checkout session\n * @returns {boolean} whether or not the checkout session is successfully created\n */\nconst stripeStoreInitCheckoutSession = async () => {\n const total = cartStore.items.reduce(\n (amount, item) => amount + item.amount * item.quantity,\n 0,\n );\n\n if (!total || !localizationStore.targetCurrency) {\n logError('Fail to create checkout session - invalid total or currency');\n return false;\n }\n\n stripeStore.isFetchingSession = true;\n\n const { errors, json } = await handleFetch<\n CheckoutSessionCreateMutation,\n CheckoutSessionCreateRequest\n >(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/create-checkout-session`, {\n body: {\n currency: cartStore.items.find(Boolean)?.currencyCode || '',\n itemsAmount: total,\n presentmentCountryCode: localizationStore.selectedCountryCode || null,\n },\n method: 'POST',\n });\n\n stripeStore.isFetchingSession = false;\n\n if (errors.length || !json) {\n logError(\n 'Error occurs when creating checkout session',\n JSON.stringify(errors, null, 2),\n );\n\n return false;\n }\n const result = json.checkoutSessionCreate;\n\n stripeStore.clientSecret = result.clientSecret;\n // update cart store with updated informations\n cartStore.checkoutSessionId = result.id;\n cartStoreApplySubtotals({\n ...result.subtotals,\n landedCostTotal: 0,\n shipping: 0,\n total: result.subtotals.items,\n });\n log(\n 'Exchange rate updated for cart items (checkout session create)',\n 'info',\n cartStore.exchangeRate,\n );\n\n log('done-init-checkout-session');\n return true;\n};\n\ntype CheckoutSessionUpdateRequest = {\n currency?: string;\n id: string;\n itemsAmount?: number;\n landedCostId?: string;\n presentmentCountryCode: CountryCode | null;\n};\n/**\n * Update checkout session. Use for updating amount with landed cost id, or update session when cart items change\n */\nconst stripeStoreUpdateCheckoutSession = async ({\n currency,\n id,\n itemsAmount,\n landedCostId,\n presentmentCountryCode,\n}: CheckoutSessionUpdateRequest) => {\n // No need to set loading state here because this function will be called under the hood to update\n // landed cost id for the section.\n const { errors, json } = await handleFetch<\n CheckoutSessionUpdateMutation,\n CheckoutSessionUpdateRequest\n >(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/update-checkout-session`, {\n body: {\n currency,\n id,\n itemsAmount,\n landedCostId,\n presentmentCountryCode,\n },\n method: 'POST',\n });\n\n if (errors.length || !json) {\n logError(\n 'Error occurs when updating checkout session',\n JSON.stringify(errors, null, 2),\n );\n return { errors, json };\n }\n\n return { errors: [], json };\n};\n\nonChange('clientSecret', clientSecret => {\n // update stripe elements when client secret changes\n if (clientSecret && stripeStore.stripe) {\n sessionStorage.setItem('zonos--client-secret', clientSecret);\n }\n\n if (!clientSecret) {\n sessionStorage.removeItem('zonos--client-secret');\n }\n});\n\nexport {\n initStripeElements,\n stripeStore,\n stripeStoreConfirmPayment,\n stripeStoreInitCheckoutSession,\n stripeStorePrefetchLandedCost,\n stripeStoreReset,\n stripeStoreRetrievePayment,\n stripeStoreUpdateCheckoutSession,\n};\n","type Params = {\n date: Date;\n /**\n * Format options for Intl.DateTimeFormat\n * @default {day:'numeric',weekday:'long',year:'numeric'} Thursday 3, 2023\n */\n formatOptions?: Intl.DateTimeFormatOptions;\n};\n\nexport const formatDate = ({\n date,\n formatOptions = { day: 'numeric', weekday: 'long', year: 'numeric' },\n}: Params): string => {\n // format date to Thursday 3, 2023\n return new Intl.DateTimeFormat('en-US', formatOptions).format(date);\n};\n","export const getDaysDifference = (targetDate: Date) => {\n const currentDate = new Date();\n const timeDifference = targetDate.getTime() - currentDate.getTime();\n const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); // Convert milliseconds to days\n return daysDifference;\n};\n","import { createStore } from '@stencil/store';\n\nimport {\n stripeStore,\n stripeStoreUpdateCheckoutSession,\n} from 'src/components/store/checkout/stripe';\nimport { localizationStore } from 'src/components/store/hello/localization';\nimport { translate } from 'src/components/store/translationStore';\nimport { formatDate } from 'src/components/utils/formatDate';\nimport { getDaysDifference } from 'src/components/utils/getDaysDifference';\nimport { log } from 'src/components/utils/logging/log';\nimport { logError } from 'src/components/utils/logging/logError';\nimport type {\n CheckoutPresentmentFragment,\n CurrencyCode,\n ShipmentRatingFragment,\n} from 'src/types/generated/graphql.customer.types';\n\nexport type CartItem = {\n amount: number;\n countryOfOrigin?: string;\n currencyCode: string;\n description?: string;\n hsCode?: string;\n imageUrl?: string;\n name: string;\n productId?: string;\n quantity: number;\n};\n\ntype CartStore = {\n checkoutSessionId: string | null;\n currency: CurrencyCode;\n dutiesTaxFees: number;\n error: {\n messages: string[];\n title: string;\n } | null;\n exchangeRate: {\n id: string;\n rate: number;\n sourceCurrencyCode: CurrencyCode;\n targetCurrencyCode: CurrencyCode;\n type: string;\n } | null;\n isSelectedShippingAboveDeminimis: boolean;\n isSelectedShippingGuarantee: boolean;\n items: CartItem[];\n landedCostData: CheckoutPresentmentFragment[] | null;\n selectedLandedCost: CheckoutPresentmentFragment | null;\n selectedShippingOption: ShipmentRatingFragment | null;\n selectedShippingOptionExpectedDate: string;\n selectedShippingOptionTransitTime: string;\n shipping: number;\n shippingData: ShipmentRatingFragment[] | null;\n step: 'customer-info' | 'shipping' | 'payment' | 'finish' | 'error';\n subtotal: number;\n total: number;\n};\n\nconst {\n onChange,\n reset,\n state: cartStore,\n} = createStore<CartStore>(() => ({\n checkoutSessionId:\n sessionStorage.getItem('zonos--checkout-session-id') || null,\n currency: 'USD',\n dutiesTaxFees: 0,\n error: null,\n exchangeRate: null,\n isSelectedShippingAboveDeminimis: false,\n isSelectedShippingGuarantee: false,\n items: [],\n landedCostData: null,\n selectedLandedCost: null,\n selectedShippingOption: null,\n selectedShippingOptionExpectedDate: '',\n selectedShippingOptionTransitTime: '',\n shipping: 0,\n shippingData: null,\n step: 'customer-info',\n subtotal: 0,\n total: 0,\n}));\n\n/**\n * Format shipping transit info to be displayed on UI\n * @returns\n * - expectedDate: Thursday, Aug 12\n * - maxTransit: 5\n * - minTransit: 3\n */\nconst cartStoreGetShippingTransitInfo = (item: ShipmentRatingFragment) => {\n const minTransit = item.minTransitAt\n ? getDaysDifference(new Date(item.minTransitAt))\n : '';\n const maxTransit = item.maxTransitAt\n ? getDaysDifference(new Date(item.maxTransitAt))\n : '';\n const expectedDate = item.minTransitAt\n ? formatDate({\n date: new Date(item.minTransitAt),\n })\n : '';\n return {\n expectedDate,\n maxTransit,\n minTransit,\n };\n};\n\nconst cartStoreReset = () => {\n sessionStorage.removeItem('zonos--checkout-session-id');\n\n // reset cart store\n reset();\n};\n\nconst cartStoreUpdateToErrorState = ({\n messages,\n title,\n}: {\n messages: string[];\n title: string;\n}) => {\n cartStore.step = 'error';\n cartStore.error = {\n messages,\n title,\n };\n};\n\ntype CartSubtotals = {\n exchangeRate: {\n id: string;\n rate: number;\n sourceCurrencyCode: CurrencyCode;\n targetCurrencyCode: CurrencyCode;\n type: string;\n };\n items: number;\n landedCostTotal: number;\n presentmentCurrencyCode: CurrencyCode;\n shipping: number;\n total: number;\n};\n\nconst cartStoreApplySubtotals = (subtotals: CartSubtotals) => {\n // update exchange rate so we can use it to display cart items\n cartStore.exchangeRate = subtotals.exchangeRate;\n cartStore.dutiesTaxFees = subtotals.landedCostTotal;\n cartStore.subtotal = subtotals.items;\n cartStore.total = subtotals.total;\n cartStore.currency = subtotals.presentmentCurrencyCode;\n};\n\ntype CartStoreRecalculateTotalParams = Omit<\n Parameters<typeof stripeStoreUpdateCheckoutSession>[0],\n 'id' | 'presentmentCountryCode'\n>;\n\nconst cartStoreReCalculateTotal = async ({\n currency,\n itemsAmount,\n landedCostId,\n}: CartStoreRecalculateTotalParams) => {\n if (landedCostId && cartStore.selectedLandedCost) {\n // update cart total right away if we have landed cost id to avoid order total flickering\n const subtotals = cartStore.selectedLandedCost.subtotals;\n cartStoreApplySubtotals(subtotals);\n log(\n 'Exchange rate updated for cart items (landed cost subtotal)',\n 'info',\n cartStore.exchangeRate,\n );\n }\n // update checkout session\n if (!cartStore.checkoutSessionId) {\n logError('Could update cart total without checkout session id');\n return false;\n }\n const { json } = await stripeStoreUpdateCheckoutSession({\n currency,\n id: cartStore.checkoutSessionId,\n itemsAmount,\n landedCostId,\n presentmentCountryCode: localizationStore.selectedCountryCode,\n });\n if (!json) {\n // do nothing if we can't get checkout session\n logError('Error occurs when updating checkout session');\n cartStoreUpdateToErrorState({\n messages: [\n translate(\n \"There's been an error updating your checkout session. Please reload and try again or contact support if the error persists\",\n ),\n ],\n title: translate('Error updating Checkout'),\n });\n return false;\n }\n if (!landedCostId) {\n // This is when first open the checkout modal and we just want to get info from the old cart session.\n // use subtotals from checkout session to update cart total\n cartStoreApplySubtotals(json.checkoutSessionUpdate.subtotals);\n log(\n 'Exchange rate updated for cart items (checkout session update)',\n 'info',\n cartStore.exchangeRate,\n );\n }\n return true;\n};\n\nconst cartStoreUpdateSelectedShippingOption = async (\n selectedShippingOption: ShipmentRatingFragment,\n) => {\n cartStore.selectedShippingOption = selectedShippingOption;\n\n // update shipping transit info\n const { expectedDate, maxTransit, minTransit } =\n cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption);\n cartStore.selectedShippingOptionExpectedDate = expectedDate;\n cartStore.selectedShippingOptionTransitTime =\n minTransit && maxTransit\n ? `${minTransit}-${maxTransit}`\n : `${minTransit || maxTransit}`;\n\n const selectedLandedCost = cartStore.landedCostData?.find(\n checkoutSessionPresentment =>\n checkoutSessionPresentment.landedCost?.shipmentRating?.id ===\n cartStore.selectedShippingOption?.id,\n );\n // save selected landed cost for later use\n cartStore.selectedLandedCost = selectedLandedCost || null;\n\n if (!selectedLandedCost) {\n // do nothing if we can't find landed cost for selected shipping option\n return false;\n }\n\n // update shipping value and dutiesTaxFees on selectedShippingOption change\n cartStore.shipping = selectedLandedCost.subtotals.shipping;\n\n // update deminimis status\n const isGuarantee =\n selectedLandedCost?.landedCost?.landedCostGuaranteeCode === 'ZONOS';\n // one item in deminimis with type of duty and tax has threshold value is \"ABOVE\"\n const isAboveDeminimis = !!selectedLandedCost?.landedCost?.deMinimis?.find(\n item => ['DUTY', 'TAX'].includes(item.type) && item.threshold === 'ABOVE',\n );\n cartStore.isSelectedShippingAboveDeminimis = isAboveDeminimis;\n cartStore.isSelectedShippingGuarantee = isGuarantee;\n // update session with selected landed cost\n const updateCalulateStatus = await cartStoreReCalculateTotal({\n landedCostId: selectedLandedCost.landedCost?.id,\n });\n return updateCalulateStatus;\n};\n\nonChange('checkoutSessionId', () => {\n if (!cartStore.checkoutSessionId) {\n sessionStorage.removeItem('zonos--checkout-session-id');\n return;\n }\n sessionStorage.setItem(\n 'zonos--checkout-session-id',\n cartStore.checkoutSessionId,\n );\n});\n\nconst cartStoreUpdateItems = async (items: CartItem[]) => {\n cartStore.items = items;\n const currency = items.find(Boolean)?.currencyCode as CurrencyCode;\n const total = items.reduce((amt, item) => {\n return amt + item.amount * item.quantity;\n }, 0);\n if (!currency || !total) {\n // do nothing if we can't get currency or total\n return;\n }\n cartStore.currency = currency;\n // set loading state here because this is first load checkout session when we already have checkout session id stored\n stripeStore.isFetchingSession = true;\n await cartStoreReCalculateTotal({\n currency: currency,\n itemsAmount: total,\n });\n stripeStore.isFetchingSession = false;\n};\n\nconst cartStoreResetSelectedShippingOption = () => {\n cartStore.selectedShippingOption = null;\n cartStore.isSelectedShippingAboveDeminimis = false;\n cartStore.isSelectedShippingGuarantee = false;\n cartStore.selectedShippingOptionExpectedDate = '';\n cartStore.selectedShippingOptionTransitTime = '';\n cartStore.shipping = 0;\n};\n\nconst cartStoreNextStep = () => {\n if (cartStore.step === 'customer-info') {\n cartStore.step = 'shipping';\n } else if (cartStore.step === 'shipping') {\n cartStore.step = 'payment';\n } else if (cartStore.step === 'payment') {\n cartStore.step = 'finish';\n }\n};\n\nconst cartStorePreviousStep = () => {\n if (cartStore.step === 'payment') {\n cartStore.step = 'shipping';\n } else if (cartStore.step === 'shipping') {\n cartStore.step = 'customer-info';\n // reset selected shipping option\n cartStoreResetSelectedShippingOption();\n }\n};\n\nexport {\n cartStore,\n cartStoreApplySubtotals,\n cartStoreGetShippingTransitInfo,\n cartStoreNextStep,\n cartStorePreviousStep,\n cartStoreReCalculateTotal,\n cartStoreReset,\n cartStoreUpdateItems,\n cartStoreUpdateSelectedShippingOption,\n cartStoreUpdateToErrorState,\n};\n"],"mappings":"yzDAIO,IAAMA,EAA0B,WAErC,IAAMC,EAAiBC,EAAYC,oBAEnC,IAAMC,EAAoBF,EAAYG,uBACtC,IAAKD,IAAsBA,EAAkBE,SAAU,CACrD,MAAM,IAAIC,MAAM,8B,CAGlB,MAAO,CACLC,kBAAmBC,EAAUD,mBAAqB,GAClDE,QAAS,CACPC,OAAOV,IAAc,MAAdA,SAAc,SAAdA,EAAgBW,MAAMD,QAAS,GAGtCE,UAAWT,EAAkBQ,MAAMC,WAAa,GAChDC,SAAUV,EAAkBQ,MAAME,UAAY,GAC9CC,MAAOX,EAAkBQ,MAAMG,OAAS,IAE1CC,MAAOP,EAAUO,MAAMC,KAAI,SAAAC,GAAI,OAC7BC,OAAQD,EAAKC,OACbC,gBAAiBF,EAAKE,gBACtBC,aAAcH,EAAKG,aACnBC,SAAUJ,EAAKI,SACfC,KAAML,EAAKK,K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,KAAG,WAC5B,GAAI5E,EAAU4M,OAAS,UAAW,CAChC5M,EAAU4M,KAAO,U,MACZ,GAAI5M,EAAU4M,OAAS,WAAY,CACxC5M,EAAU4M,KAAO,gBAEjB2B,G,CAEJ,G"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as createStore, z as zonosStore } from './zonosStore-
|
|
2
|
-
import { h as handleFetch, l as log, a as localizationStore, b as logError, t as translate } from './localization-
|
|
3
|
-
import { i as isDarkColor } from './isDarkColor-
|
|
4
|
-
import { g as getBorderRadius } from './getBorderRadius-
|
|
1
|
+
import { c as createStore, z as zonosStore } from './zonosStore-1c9c7d76.js';
|
|
2
|
+
import { h as handleFetch, l as log, a as localizationStore, b as logError, t as translate } from './localization-1d92a557.js';
|
|
3
|
+
import { i as isDarkColor } from './isDarkColor-3bb345f4.js';
|
|
4
|
+
import { g as getBorderRadius } from './getBorderRadius-e8ad5967.js';
|
|
5
5
|
|
|
6
6
|
const prepCalculateLandedCost = () => {
|
|
7
7
|
// maybe we don't need email now for prefetch the landed cost
|
|
@@ -42,7 +42,7 @@ const prepCalculateLandedCost = () => {
|
|
|
42
42
|
|
|
43
43
|
const calculateLandedCost = async (abortController) => {
|
|
44
44
|
// request to get landed cost info
|
|
45
|
-
const url = `${"https://route.js.zonos.com"}/api/calculate-landed-cost`;
|
|
45
|
+
const url = `${"https://v1.route.js.zonos.com"}/api/calculate-landed-cost`;
|
|
46
46
|
const { errors, json } = await handleFetch(url, {
|
|
47
47
|
body: prepCalculateLandedCost(),
|
|
48
48
|
method: 'POST',
|
|
@@ -332,7 +332,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
332
332
|
return false;
|
|
333
333
|
}
|
|
334
334
|
stripeStore.isFetchingSession = true;
|
|
335
|
-
const { errors, json } = await handleFetch(`${"https://route.js.zonos.com"}/api/create-checkout-session`, {
|
|
335
|
+
const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/create-checkout-session`, {
|
|
336
336
|
body: {
|
|
337
337
|
currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
|
|
338
338
|
itemsAmount: total,
|
|
@@ -360,7 +360,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
360
360
|
const stripeStoreUpdateCheckoutSession = async ({ currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
|
|
361
361
|
// No need to set loading state here because this function will be called under the hood to update
|
|
362
362
|
// landed cost id for the section.
|
|
363
|
-
const { errors, json } = await handleFetch(`${"https://route.js.zonos.com"}/api/update-checkout-session`, {
|
|
363
|
+
const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/update-checkout-session`, {
|
|
364
364
|
body: {
|
|
365
365
|
currency,
|
|
366
366
|
id,
|
|
@@ -595,4 +595,4 @@ const cartStorePreviousStep = () => {
|
|
|
595
595
|
|
|
596
596
|
export { cartStoreUpdateItems as a, cartStoreReset as b, cartStore as c, stripeStoreInitCheckoutSession as d, cartStoreUpdateToErrorState as e, stripeStorePrefetchLandedCost as f, cartStoreNextStep as g, stripeStoreConfirmPayment as h, initStripeElements as i, stripeStoreReset as j, cartStorePreviousStep as k, stripeStoreRetrievePayment as l, cartStoreUpdateSelectedShippingOption as m, cartStoreGetShippingTransitInfo as n, stripeStore as s };
|
|
597
597
|
|
|
598
|
-
//# sourceMappingURL=cart-
|
|
598
|
+
//# sourceMappingURL=cart-d00e1acb.js.map
|