@zonos/elements 1.0.16
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/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/cjs/cart-e27fd17c.js +607 -0
- package/dist/cjs/cart-e27fd17c.js.map +1 -0
- package/dist/cjs/classes-b7918f56.js +16 -0
- package/dist/cjs/classes-b7918f56.js.map +1 -0
- package/dist/cjs/getBorderRadius-2904800c.js +20 -0
- package/dist/cjs/getBorderRadius-2904800c.js.map +1 -0
- package/dist/cjs/getHasMoreSpaceOnRight-2855491b.js +12 -0
- package/dist/cjs/getHasMoreSpaceOnRight-2855491b.js.map +1 -0
- package/dist/cjs/index-9542d2e7.js +1917 -0
- package/dist/cjs/index-9542d2e7.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/isColorVariable-c1ed7303.js +18 -0
- package/dist/cjs/isColorVariable-c1ed7303.js.map +1 -0
- package/dist/cjs/isDarkColor-a86b8a05.js +1199 -0
- package/dist/cjs/isDarkColor-a86b8a05.js.map +1 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/localization-f6a1b679.js +3387 -0
- package/dist/cjs/localization-f6a1b679.js.map +1 -0
- package/dist/cjs/submitGtag-b1b96579.js +29 -0
- package/dist/cjs/submitGtag-b1b96579.js.map +1 -0
- package/dist/cjs/zonos-address_2.cjs.entry.js +126 -0
- package/dist/cjs/zonos-address_2.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-badge.cjs.entry.js +36 -0
- package/dist/cjs/zonos-badge.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-banner_2.cjs.entry.js +120 -0
- package/dist/cjs/zonos-banner_2.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-button_2.cjs.entry.js +129 -0
- package/dist/cjs/zonos-button_2.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-card_2.cjs.entry.js +47 -0
- package/dist/cjs/zonos-card_2.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-cart-items_10.cjs.entry.js +505 -0
- package/dist/cjs/zonos-cart-items_10.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-checkout.cjs.entry.js +337 -0
- package/dist/cjs/zonos-checkout.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-component.cjs.entry.js +31 -0
- package/dist/cjs/zonos-component.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-controller.cjs.entry.js +169 -0
- package/dist/cjs/zonos-controller.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-country-flag_4.cjs.entry.js +1902 -0
- package/dist/cjs/zonos-country-flag_4.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-elements.cjs.js +25 -0
- package/dist/cjs/zonos-elements.cjs.js.map +1 -0
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +115 -0
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-hello.cjs.entry.js +485 -0
- package/dist/cjs/zonos-hello.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-icon.cjs.entry.js +34 -0
- package/dist/cjs/zonos-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-notification.cjs.entry.js +71 -0
- package/dist/cjs/zonos-notification.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +54 -0
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js.map +1 -0
- package/dist/cjs/zonos-text.cjs.entry.js +160 -0
- package/dist/cjs/zonos-text.cjs.entry.js.map +1 -0
- package/dist/cjs/zonosStore-960e5542.js +2650 -0
- package/dist/cjs/zonosStore-960e5542.js.map +1 -0
- package/dist/collection/collection-manifest.json +43 -0
- package/dist/collection/components/checkout/zonos-checkout/assets/LeftArrow.svg +1 -0
- package/dist/collection/components/checkout/zonos-checkout/assets/MessageIcon.svg +3 -0
- package/dist/collection/components/checkout/zonos-checkout/assets/RemoveIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/assets/empty-item.jpeg +0 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.css +49 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +41 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js.map +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/assets/InfoIcon.svg +4 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.css +58 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +53 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js.map +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/assets/RemoveIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/assets/SuccessIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.css +57 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +173 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js.map +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +63 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +161 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js.map +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +207 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +562 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js.map +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +63 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +163 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js.map +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/assets/ChevronDownIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/assets/ChevronUpIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.css +49 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +122 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js.map +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +69 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +176 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js.map +1 -0
- package/dist/collection/components/common/countries.js +267 -0
- package/dist/collection/components/common/countries.js.map +1 -0
- package/dist/collection/components/common/zonos-badge/zonos-badge.css +108 -0
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +192 -0
- package/dist/collection/components/common/zonos-badge/zonos-badge.js.map +1 -0
- package/dist/collection/components/common/zonos-banner/zonos-banner.css +68 -0
- package/dist/collection/components/common/zonos-banner/zonos-banner.js +135 -0
- package/dist/collection/components/common/zonos-banner/zonos-banner.js.map +1 -0
- package/dist/collection/components/common/zonos-button/zonos-button.css +245 -0
- package/dist/collection/components/common/zonos-button/zonos-button.js +418 -0
- package/dist/collection/components/common/zonos-button/zonos-button.js.map +1 -0
- package/dist/collection/components/common/zonos-card/zonos-card.css +67 -0
- package/dist/collection/components/common/zonos-card/zonos-card.js +169 -0
- package/dist/collection/components/common/zonos-card/zonos-card.js.map +1 -0
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.css +43 -0
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +88 -0
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js.map +1 -0
- package/dist/collection/components/common/zonos-country-flag/zonos-country-flag.css +48 -0
- package/dist/collection/components/common/zonos-country-flag/zonos-country-flag.js +106 -0
- package/dist/collection/components/common/zonos-country-flag/zonos-country-flag.js.map +1 -0
- package/dist/collection/components/common/zonos-country-select/assets/arrowLeftBlue.svg +1 -0
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.css +76 -0
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +79 -0
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js.map +1 -0
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.css +38 -0
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +63 -0
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js.map +1 -0
- package/dist/collection/components/common/zonos-dialog/assets/removeIcon.svg +1 -0
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.css +150 -0
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +383 -0
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js.map +1 -0
- package/dist/collection/components/common/zonos-icon/zonos-icon.css +38 -0
- package/dist/collection/components/common/zonos-icon/zonos-icon.js +127 -0
- package/dist/collection/components/common/zonos-icon/zonos-icon.js.map +1 -0
- package/dist/collection/components/common/zonos-logo/assets/ZonosLogo.png +0 -0
- package/dist/collection/components/common/zonos-logo/zonos-logo.css +36 -0
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +96 -0
- package/dist/collection/components/common/zonos-logo/zonos-logo.js.map +1 -0
- package/dist/collection/components/common/zonos-notification/zonos-notification.css +67 -0
- package/dist/collection/components/common/zonos-notification/zonos-notification.js +131 -0
- package/dist/collection/components/common/zonos-notification/zonos-notification.js.map +1 -0
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.css +70 -0
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +176 -0
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js.map +1 -0
- package/dist/collection/components/common/zonos-spinner/zonos-spinner.css +104 -0
- package/dist/collection/components/common/zonos-spinner/zonos-spinner.js +78 -0
- package/dist/collection/components/common/zonos-spinner/zonos-spinner.js.map +1 -0
- package/dist/collection/components/common/zonos-text/zonos-text.css +80 -0
- package/dist/collection/components/common/zonos-text/zonos-text.js +199 -0
- package/dist/collection/components/common/zonos-text/zonos-text.js.map +1 -0
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.css +35 -0
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +74 -0
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js.map +1 -0
- package/dist/collection/components/component-template/zonos-component/zonos-component.css +33 -0
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +86 -0
- package/dist/collection/components/component-template/zonos-component/zonos-component.js.map +1 -0
- package/dist/collection/components/hello/zonos-hello/zonos-hello.css +262 -0
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +342 -0
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js.map +1 -0
- package/dist/collection/components/hello/zonos-hello-dialog/assets/bagIcon.svg +3 -0
- package/dist/collection/components/hello/zonos-hello-dialog/assets/messageIcon.svg +3 -0
- package/dist/collection/components/hello/zonos-hello-dialog/assets/moneyIcon.svg +3 -0
- package/dist/collection/components/hello/zonos-hello-dialog/assets/removeIcon.svg +1 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/assets/chevronDownIcon.svg +1 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/assets/zonosIcon.svg +5 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.css +522 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +82 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js.map +1 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.css +162 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +255 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js.map +1 -0
- package/dist/collection/components/main/zonos-controller.css +34 -0
- package/dist/collection/components/main/zonos-controller.js +287 -0
- package/dist/collection/components/main/zonos-controller.js.map +1 -0
- package/dist/collection/components/store/checkout/cart.js +198 -0
- package/dist/collection/components/store/checkout/cart.js.map +1 -0
- package/dist/collection/components/store/checkout/stripe.js +309 -0
- package/dist/collection/components/store/checkout/stripe.js.map +1 -0
- package/dist/collection/components/store/hello/localization.js +120 -0
- package/dist/collection/components/store/hello/localization.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.arabic.js +141 -0
- package/dist/collection/components/store/translationStore/strings.arabic.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.base.js +141 -0
- package/dist/collection/components/store/translationStore/strings.base.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +141 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +141 -0
- package/dist/collection/components/store/translationStore/strings.danish.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +141 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.french.js +141 -0
- package/dist/collection/components/store/translationStore/strings.french.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.german.js +141 -0
- package/dist/collection/components/store/translationStore/strings.german.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +141 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +141 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +141 -0
- package/dist/collection/components/store/translationStore/strings.italian.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +141 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +141 -0
- package/dist/collection/components/store/translationStore/strings.korean.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +141 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +141 -0
- package/dist/collection/components/store/translationStore/strings.polish.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +141 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +141 -0
- package/dist/collection/components/store/translationStore/strings.russian.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +141 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +141 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +141 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js.map +1 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +141 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js.map +1 -0
- package/dist/collection/components/store/translationStore.js +94 -0
- package/dist/collection/components/store/translationStore.js.map +1 -0
- package/dist/collection/components/store/zonosStore.js +102 -0
- package/dist/collection/components/store/zonosStore.js.map +1 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.css +32 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +151 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js.map +1 -0
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.css +32 -0
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +87 -0
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js.map +1 -0
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.css +32 -0
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +92 -0
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js.map +1 -0
- package/dist/collection/components/utils/addDays.js +12 -0
- package/dist/collection/components/utils/addDays.js.map +1 -0
- package/dist/collection/components/utils/api/calculateLandedCost.js +16 -0
- package/dist/collection/components/utils/api/calculateLandedCost.js.map +1 -0
- package/dist/collection/components/utils/api/getCountries.js +16 -0
- package/dist/collection/components/utils/api/getCountries.js.map +1 -0
- package/dist/collection/components/utils/api/getCountryLandedCost.js +16 -0
- package/dist/collection/components/utils/api/getCountryLandedCost.js.map +1 -0
- package/dist/collection/components/utils/api/getExchangeRate.js +18 -0
- package/dist/collection/components/utils/api/getExchangeRate.js.map +1 -0
- package/dist/collection/components/utils/api/getLocaleMessages.js +13 -0
- package/dist/collection/components/utils/api/getLocaleMessages.js.map +1 -0
- package/dist/collection/components/utils/api/getLocalization.js +22 -0
- package/dist/collection/components/utils/api/getLocalization.js.map +1 -0
- package/dist/collection/components/utils/api/getShippingZones.js +14 -0
- package/dist/collection/components/utils/api/getShippingZones.js.map +1 -0
- package/dist/collection/components/utils/api/getZonosSetting.js +12 -0
- package/dist/collection/components/utils/api/getZonosSetting.js.map +1 -0
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js +39 -0
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js.map +1 -0
- package/dist/collection/components/utils/changeDeepProperty.js +43 -0
- package/dist/collection/components/utils/changeDeepProperty.js.map +1 -0
- package/dist/collection/components/utils/changeDeepPropertyAtIndex.js +66 -0
- package/dist/collection/components/utils/changeDeepPropertyAtIndex.js.map +1 -0
- package/dist/collection/components/utils/checkout/initCheckout.js +25 -0
- package/dist/collection/components/utils/checkout/initCheckout.js.map +1 -0
- package/dist/collection/components/utils/checkout/isCheckoutMobile.js +5 -0
- package/dist/collection/components/utils/checkout/isCheckoutMobile.js.map +1 -0
- package/dist/collection/components/utils/classes.js +11 -0
- package/dist/collection/components/utils/classes.js.map +1 -0
- package/dist/collection/components/utils/darkenColor.js +8 -0
- package/dist/collection/components/utils/darkenColor.js.map +1 -0
- package/dist/collection/components/utils/formatCurrency.js +10 -0
- package/dist/collection/components/utils/formatCurrency.js.map +1 -0
- package/dist/collection/components/utils/formatDate.js +5 -0
- package/dist/collection/components/utils/formatDate.js.map +1 -0
- package/dist/collection/components/utils/getBorderRadius.js +14 -0
- package/dist/collection/components/utils/getBorderRadius.js.map +1 -0
- package/dist/collection/components/utils/getButtonTheme.js +17 -0
- package/dist/collection/components/utils/getButtonTheme.js.map +1 -0
- package/dist/collection/components/utils/getDaysDifference.js +7 -0
- package/dist/collection/components/utils/getDaysDifference.js.map +1 -0
- package/dist/collection/components/utils/handleFetch.js +89 -0
- package/dist/collection/components/utils/handleFetch.js.map +1 -0
- package/dist/collection/components/utils/hello/currencyConversion/currencyConvert.js +13 -0
- package/dist/collection/components/utils/hello/currencyConversion/currencyConvert.js.map +1 -0
- package/dist/collection/components/utils/hello/currencyConversion/currencyConvertAndFormat.js +8 -0
- package/dist/collection/components/utils/hello/currencyConversion/currencyConvertAndFormat.js.map +1 -0
- package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js +18 -0
- package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js.map +1 -0
- package/dist/collection/components/utils/hello/currencyConversion/currencyFormat.js +33 -0
- package/dist/collection/components/utils/hello/currencyConversion/currencyFormat.js.map +1 -0
- package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +48 -0
- package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js.map +1 -0
- package/dist/collection/components/utils/hello/currencyConversion/getCurrencyCode.js +10 -0
- package/dist/collection/components/utils/hello/currencyConversion/getCurrencyCode.js.map +1 -0
- package/dist/collection/components/utils/hello/currencyConversion/getCurrencyElements.js +19 -0
- package/dist/collection/components/utils/hello/currencyConversion/getCurrencyElements.js.map +1 -0
- package/dist/collection/components/utils/hello/currencyConversion/getInitialElementAmount.js +16 -0
- package/dist/collection/components/utils/hello/currencyConversion/getInitialElementAmount.js.map +1 -0
- package/dist/collection/components/utils/hello/currencyConversion/getLanguageCode.js +10 -0
- package/dist/collection/components/utils/hello/currencyConversion/getLanguageCode.js.map +1 -0
- package/dist/collection/components/utils/hello/getCurrentHelloLocalePage.js +20 -0
- package/dist/collection/components/utils/hello/getCurrentHelloLocalePage.js.map +1 -0
- package/dist/collection/components/utils/hello/getHasMoreSpaceOnRight.js +10 -0
- package/dist/collection/components/utils/hello/getHasMoreSpaceOnRight.js.map +1 -0
- package/dist/collection/components/utils/hello/initHello.js +23 -0
- package/dist/collection/components/utils/hello/initHello.js.map +1 -0
- package/dist/collection/components/utils/isColorVariable.js +13 -0
- package/dist/collection/components/utils/isColorVariable.js.map +1 -0
- package/dist/collection/components/utils/isDarkColor.js +5 -0
- package/dist/collection/components/utils/isDarkColor.js.map +1 -0
- package/dist/collection/components/utils/isValidSelector.js +17 -0
- package/dist/collection/components/utils/isValidSelector.js.map +1 -0
- package/dist/collection/components/utils/jsonParse.js +14 -0
- package/dist/collection/components/utils/jsonParse.js.map +1 -0
- package/dist/collection/components/utils/lightenColor.js +8 -0
- package/dist/collection/components/utils/lightenColor.js.map +1 -0
- package/dist/collection/components/utils/logging/log.js +25 -0
- package/dist/collection/components/utils/logging/log.js.map +1 -0
- package/dist/collection/components/utils/logging/logError.js +5 -0
- package/dist/collection/components/utils/logging/logError.js.map +1 -0
- package/dist/collection/components/utils/mergeConfig.js +12 -0
- package/dist/collection/components/utils/mergeConfig.js.map +1 -0
- package/dist/collection/components/utils/submitGtag.js +17 -0
- package/dist/collection/components/utils/submitGtag.js.map +1 -0
- package/dist/collection/environment.js +68 -0
- package/dist/collection/environment.js.map +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/scripts/loadStripe.js +17 -0
- package/dist/collection/scripts/loadStripe.js.map +1 -0
- package/dist/collection/scripts/stripe.js +115 -0
- package/dist/collection/scripts/stripe.js.map +1 -0
- package/dist/collection/scripts/zonos.js +164 -0
- package/dist/collection/scripts/zonos.js.map +1 -0
- package/dist/collection/styles/stripe/addressRuleStyle.js +17 -0
- package/dist/collection/styles/stripe/addressRuleStyle.js.map +1 -0
- package/dist/collection/styles/stripe/defaultVariable.js +18 -0
- package/dist/collection/styles/stripe/defaultVariable.js.map +1 -0
- package/dist/collection/types/ICountryJson.js +2 -0
- package/dist/collection/types/ICountryJson.js.map +1 -0
- package/dist/collection/types/JsonError.js +2 -0
- package/dist/collection/types/JsonError.js.map +1 -0
- package/dist/collection/types/NoInfer.js +2 -0
- package/dist/collection/types/NoInfer.js.map +1 -0
- package/dist/collection/types/Translation.js +2 -0
- package/dist/collection/types/Translation.js.map +1 -0
- package/dist/collection/types/checkout/CheckoutConfig.js +2 -0
- package/dist/collection/types/checkout/CheckoutConfig.js.map +1 -0
- package/dist/collection/types/checkout/api/CalculateLandedCostRequest.js +2 -0
- package/dist/collection/types/checkout/api/CalculateLandedCostRequest.js.map +1 -0
- package/dist/collection/types/generated/graphql.customer.types.js +1634 -0
- package/dist/collection/types/generated/graphql.customer.types.js.map +1 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +396 -0
- package/dist/collection/types/generated/graphql.frontend.types.js.map +1 -0
- package/dist/collection/types/hello/HelloConfig.js +2 -0
- package/dist/collection/types/hello/HelloConfig.js.map +1 -0
- package/dist/collection/types/index.js +12 -0
- package/dist/collection/types/index.js.map +1 -0
- package/dist/collection/types/online-store/OnlineStoreConfig.js +2 -0
- package/dist/collection/types/online-store/OnlineStoreConfig.js.map +1 -0
- package/dist/collection/types/stripe/Apperance.js +60 -0
- package/dist/collection/types/stripe/Apperance.js.map +1 -0
- package/dist/collection/types/styles/Color.js +23 -0
- package/dist/collection/types/styles/Color.js.map +1 -0
- package/dist/collection/types/styles/GridSpacing.js +2 -0
- package/dist/collection/types/styles/GridSpacing.js.map +1 -0
- package/dist/collection/types/styles/Text.js +100 -0
- package/dist/collection/types/styles/Text.js.map +1 -0
- package/dist/collection/types/utils/deep/IDeepKeyof.js +4 -0
- package/dist/collection/types/utils/deep/IDeepKeyof.js.map +1 -0
- package/dist/collection/types/utils/deep/IDeepKeyofAtIndex.js +2 -0
- package/dist/collection/types/utils/deep/IDeepKeyofAtIndex.js.map +1 -0
- package/dist/collection/utils/format.js +4 -0
- package/dist/collection/utils/format.js.map +1 -0
- package/dist/collection/utils/generateVercelDeployUrl.js +29 -0
- package/dist/collection/utils/generateVercelDeployUrl.js.map +1 -0
- package/dist/components/classes.js +14 -0
- package/dist/components/classes.js.map +1 -0
- package/dist/components/formatCurrency.js +13 -0
- package/dist/components/formatCurrency.js.map +1 -0
- package/dist/components/getBorderRadius.js +18 -0
- package/dist/components/getBorderRadius.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/isColorVariable.js +16 -0
- package/dist/components/isColorVariable.js.map +1 -0
- package/dist/components/isDarkColor.js +1197 -0
- package/dist/components/isDarkColor.js.map +1 -0
- package/dist/components/localization.js +3374 -0
- package/dist/components/localization.js.map +1 -0
- package/dist/components/stripe.js +591 -0
- package/dist/components/stripe.js.map +1 -0
- package/dist/components/submitGtag.js +21 -0
- package/dist/components/submitGtag.js.map +1 -0
- package/dist/components/zonos-address.d.ts +11 -0
- package/dist/components/zonos-address.js +8 -0
- package/dist/components/zonos-address.js.map +1 -0
- package/dist/components/zonos-address2.js +101 -0
- package/dist/components/zonos-address2.js.map +1 -0
- package/dist/components/zonos-badge.d.ts +11 -0
- package/dist/components/zonos-badge.js +8 -0
- package/dist/components/zonos-badge.js.map +1 -0
- package/dist/components/zonos-badge2.js +55 -0
- package/dist/components/zonos-badge2.js.map +1 -0
- package/dist/components/zonos-banner.d.ts +11 -0
- package/dist/components/zonos-banner.js +8 -0
- package/dist/components/zonos-banner.js.map +1 -0
- package/dist/components/zonos-banner2.js +90 -0
- package/dist/components/zonos-banner2.js.map +1 -0
- package/dist/components/zonos-button.d.ts +11 -0
- package/dist/components/zonos-button.js +8 -0
- package/dist/components/zonos-button.js.map +1 -0
- package/dist/components/zonos-button2.js +144 -0
- package/dist/components/zonos-button2.js.map +1 -0
- package/dist/components/zonos-card.d.ts +11 -0
- package/dist/components/zonos-card.js +8 -0
- package/dist/components/zonos-card.js.map +1 -0
- package/dist/components/zonos-card2.js +51 -0
- package/dist/components/zonos-card2.js.map +1 -0
- package/dist/components/zonos-cart-items.d.ts +11 -0
- package/dist/components/zonos-cart-items.js +8 -0
- package/dist/components/zonos-cart-items.js.map +1 -0
- package/dist/components/zonos-cart-items2.js +55 -0
- package/dist/components/zonos-cart-items2.js.map +1 -0
- package/dist/components/zonos-cart-subtotal.d.ts +11 -0
- package/dist/components/zonos-cart-subtotal.js +8 -0
- package/dist/components/zonos-cart-subtotal.js.map +1 -0
- package/dist/components/zonos-cart-subtotal2.js +87 -0
- package/dist/components/zonos-cart-subtotal2.js.map +1 -0
- package/dist/components/zonos-checkout-finish.d.ts +11 -0
- package/dist/components/zonos-checkout-finish.js +8 -0
- package/dist/components/zonos-checkout-finish.js.map +1 -0
- package/dist/components/zonos-checkout-finish2.js +119 -0
- package/dist/components/zonos-checkout-finish2.js.map +1 -0
- package/dist/components/zonos-checkout-payment.d.ts +11 -0
- package/dist/components/zonos-checkout-payment.js +8 -0
- package/dist/components/zonos-checkout-payment.js.map +1 -0
- package/dist/components/zonos-checkout-payment2.js +104 -0
- package/dist/components/zonos-checkout-payment2.js.map +1 -0
- package/dist/components/zonos-checkout.d.ts +11 -0
- package/dist/components/zonos-checkout.js +510 -0
- package/dist/components/zonos-checkout.js.map +1 -0
- package/dist/components/zonos-collapse.d.ts +11 -0
- package/dist/components/zonos-collapse.js +8 -0
- package/dist/components/zonos-collapse.js.map +1 -0
- package/dist/components/zonos-collapse2.js +57 -0
- package/dist/components/zonos-collapse2.js.map +1 -0
- package/dist/components/zonos-component.d.ts +11 -0
- package/dist/components/zonos-component.js +49 -0
- package/dist/components/zonos-component.js.map +1 -0
- package/dist/components/zonos-controller.d.ts +11 -0
- package/dist/components/zonos-controller.js +200 -0
- package/dist/components/zonos-controller.js.map +1 -0
- package/dist/components/zonos-country-flag.d.ts +11 -0
- package/dist/components/zonos-country-flag.js +8 -0
- package/dist/components/zonos-country-flag.js.map +1 -0
- package/dist/components/zonos-country-flag2.js +52 -0
- package/dist/components/zonos-country-flag2.js.map +1 -0
- package/dist/components/zonos-country-select.d.ts +11 -0
- package/dist/components/zonos-country-select.js +8 -0
- package/dist/components/zonos-country-select.js.map +1 -0
- package/dist/components/zonos-country-select2.js +1878 -0
- package/dist/components/zonos-country-select2.js.map +1 -0
- package/dist/components/zonos-custom-message.d.ts +11 -0
- package/dist/components/zonos-custom-message.js +8 -0
- package/dist/components/zonos-custom-message.js.map +1 -0
- package/dist/components/zonos-custom-message2.js +55 -0
- package/dist/components/zonos-custom-message2.js.map +1 -0
- package/dist/components/zonos-customer-info.d.ts +11 -0
- package/dist/components/zonos-customer-info.js +8 -0
- package/dist/components/zonos-customer-info.js.map +1 -0
- package/dist/components/zonos-customer-info2.js +103 -0
- package/dist/components/zonos-customer-info2.js.map +1 -0
- package/dist/components/zonos-dialog.d.ts +11 -0
- package/dist/components/zonos-dialog.js +8 -0
- package/dist/components/zonos-dialog.js.map +1 -0
- package/dist/components/zonos-dialog2.js +123 -0
- package/dist/components/zonos-dialog2.js.map +1 -0
- package/dist/components/zonos-hello-dialog-footer.d.ts +11 -0
- package/dist/components/zonos-hello-dialog-footer.js +8 -0
- package/dist/components/zonos-hello-dialog-footer.js.map +1 -0
- package/dist/components/zonos-hello-dialog-footer2.js +71 -0
- package/dist/components/zonos-hello-dialog-footer2.js.map +1 -0
- package/dist/components/zonos-hello-dialog.d.ts +11 -0
- package/dist/components/zonos-hello-dialog.js +8 -0
- package/dist/components/zonos-hello-dialog.js.map +1 -0
- package/dist/components/zonos-hello-dialog2.js +202 -0
- package/dist/components/zonos-hello-dialog2.js.map +1 -0
- package/dist/components/zonos-hello.d.ts +11 -0
- package/dist/components/zonos-hello.js +576 -0
- package/dist/components/zonos-hello.js.map +1 -0
- package/dist/components/zonos-icon.d.ts +11 -0
- package/dist/components/zonos-icon.js +8 -0
- package/dist/components/zonos-icon.js.map +1 -0
- package/dist/components/zonos-icon2.js +50 -0
- package/dist/components/zonos-icon2.js.map +1 -0
- package/dist/components/zonos-link-authentication.d.ts +11 -0
- package/dist/components/zonos-link-authentication.js +8 -0
- package/dist/components/zonos-link-authentication.js.map +1 -0
- package/dist/components/zonos-link-authentication2.js +75 -0
- package/dist/components/zonos-link-authentication2.js.map +1 -0
- package/dist/components/zonos-logo.d.ts +11 -0
- package/dist/components/zonos-logo.js +8 -0
- package/dist/components/zonos-logo.js.map +1 -0
- package/dist/components/zonos-logo2.js +47 -0
- package/dist/components/zonos-logo2.js.map +1 -0
- package/dist/components/zonos-notification.d.ts +11 -0
- package/dist/components/zonos-notification.js +8 -0
- package/dist/components/zonos-notification.js.map +1 -0
- package/dist/components/zonos-notification2.js +92 -0
- package/dist/components/zonos-notification2.js.map +1 -0
- package/dist/components/zonos-payment.d.ts +11 -0
- package/dist/components/zonos-payment.js +8 -0
- package/dist/components/zonos-payment.js.map +1 -0
- package/dist/components/zonos-payment2.js +79 -0
- package/dist/components/zonos-payment2.js.map +1 -0
- package/dist/components/zonos-review.d.ts +11 -0
- package/dist/components/zonos-review.js +8 -0
- package/dist/components/zonos-review.js.map +1 -0
- package/dist/components/zonos-review2.js +98 -0
- package/dist/components/zonos-review2.js.map +1 -0
- package/dist/components/zonos-shipping-rich-radio.d.ts +11 -0
- package/dist/components/zonos-shipping-rich-radio.js +8 -0
- package/dist/components/zonos-shipping-rich-radio.js.map +1 -0
- package/dist/components/zonos-shipping-rich-radio2.js +77 -0
- package/dist/components/zonos-shipping-rich-radio2.js.map +1 -0
- package/dist/components/zonos-shipping.d.ts +11 -0
- package/dist/components/zonos-shipping.js +8 -0
- package/dist/components/zonos-shipping.js.map +1 -0
- package/dist/components/zonos-shipping2.js +136 -0
- package/dist/components/zonos-shipping2.js.map +1 -0
- package/dist/components/zonos-spinner.d.ts +11 -0
- package/dist/components/zonos-spinner.js +8 -0
- package/dist/components/zonos-spinner.js.map +1 -0
- package/dist/components/zonos-spinner2.js +44 -0
- package/dist/components/zonos-spinner2.js.map +1 -0
- package/dist/components/zonos-text.d.ts +11 -0
- package/dist/components/zonos-text.js +8 -0
- package/dist/components/zonos-text.js.map +1 -0
- package/dist/components/zonos-text2.js +179 -0
- package/dist/components/zonos-text2.js.map +1 -0
- package/dist/components/zonos-v-stack.d.ts +11 -0
- package/dist/components/zonos-v-stack.js +8 -0
- package/dist/components/zonos-v-stack.js.map +1 -0
- package/dist/components/zonos-v-stack2.js +38 -0
- package/dist/components/zonos-v-stack2.js.map +1 -0
- package/dist/components/zonosStore.js +2639 -0
- package/dist/components/zonosStore.js.map +1 -0
- package/dist/esm/cart-36c33342.js +591 -0
- package/dist/esm/cart-36c33342.js.map +1 -0
- package/dist/esm/classes-0d95c529.js +14 -0
- package/dist/esm/classes-0d95c529.js.map +1 -0
- package/dist/esm/getBorderRadius-82fbaf25.js +18 -0
- package/dist/esm/getBorderRadius-82fbaf25.js.map +1 -0
- package/dist/esm/getHasMoreSpaceOnRight-feba1ae2.js +10 -0
- package/dist/esm/getHasMoreSpaceOnRight-feba1ae2.js.map +1 -0
- package/dist/esm/index-d1aa9293.js +1884 -0
- package/dist/esm/index-d1aa9293.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/isColorVariable-4cda28c9.js +16 -0
- package/dist/esm/isColorVariable-4cda28c9.js.map +1 -0
- package/dist/esm/isDarkColor-b21326ae.js +1197 -0
- package/dist/esm/isDarkColor-b21326ae.js.map +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/localization-4a424f49.js +3374 -0
- package/dist/esm/localization-4a424f49.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/submitGtag-fbdb454b.js +26 -0
- package/dist/esm/submitGtag-fbdb454b.js.map +1 -0
- package/dist/esm/zonos-address_2.entry.js +121 -0
- package/dist/esm/zonos-address_2.entry.js.map +1 -0
- package/dist/esm/zonos-badge.entry.js +32 -0
- package/dist/esm/zonos-badge.entry.js.map +1 -0
- package/dist/esm/zonos-banner_2.entry.js +115 -0
- package/dist/esm/zonos-banner_2.entry.js.map +1 -0
- package/dist/esm/zonos-button_2.entry.js +124 -0
- package/dist/esm/zonos-button_2.entry.js.map +1 -0
- package/dist/esm/zonos-card_2.entry.js +42 -0
- package/dist/esm/zonos-card_2.entry.js.map +1 -0
- package/dist/esm/zonos-cart-items_10.entry.js +492 -0
- package/dist/esm/zonos-cart-items_10.entry.js.map +1 -0
- package/dist/esm/zonos-checkout.entry.js +333 -0
- package/dist/esm/zonos-checkout.entry.js.map +1 -0
- package/dist/esm/zonos-component.entry.js +27 -0
- package/dist/esm/zonos-component.entry.js.map +1 -0
- package/dist/esm/zonos-controller.entry.js +165 -0
- package/dist/esm/zonos-controller.entry.js.map +1 -0
- package/dist/esm/zonos-country-flag_4.entry.js +1895 -0
- package/dist/esm/zonos-country-flag_4.entry.js.map +1 -0
- package/dist/esm/zonos-elements.js +20 -0
- package/dist/esm/zonos-elements.js.map +1 -0
- package/dist/esm/zonos-hello-dialog.entry.js +111 -0
- package/dist/esm/zonos-hello-dialog.entry.js.map +1 -0
- package/dist/esm/zonos-hello.entry.js +481 -0
- package/dist/esm/zonos-hello.entry.js.map +1 -0
- package/dist/esm/zonos-icon.entry.js +30 -0
- package/dist/esm/zonos-icon.entry.js.map +1 -0
- package/dist/esm/zonos-notification.entry.js +67 -0
- package/dist/esm/zonos-notification.entry.js.map +1 -0
- package/dist/esm/zonos-shipping-rich-radio.entry.js +50 -0
- package/dist/esm/zonos-shipping-rich-radio.entry.js.map +1 -0
- package/dist/esm/zonos-text.entry.js +156 -0
- package/dist/esm/zonos-text.entry.js.map +1 -0
- package/dist/esm/zonosStore-13a7b534.js +2639 -0
- package/dist/esm/zonosStore-13a7b534.js.map +1 -0
- package/dist/esm-es5/cart-36c33342.js +2 -0
- package/dist/esm-es5/cart-36c33342.js.map +1 -0
- package/dist/esm-es5/classes-0d95c529.js +2 -0
- package/dist/esm-es5/classes-0d95c529.js.map +1 -0
- package/dist/esm-es5/getBorderRadius-82fbaf25.js +2 -0
- package/dist/esm-es5/getBorderRadius-82fbaf25.js.map +1 -0
- package/dist/esm-es5/getHasMoreSpaceOnRight-feba1ae2.js +2 -0
- package/dist/esm-es5/getHasMoreSpaceOnRight-feba1ae2.js.map +1 -0
- package/dist/esm-es5/index-d1aa9293.js +3 -0
- package/dist/esm-es5/index-d1aa9293.js.map +1 -0
- package/dist/esm-es5/index.js +2 -0
- package/dist/esm-es5/index.js.map +1 -0
- package/dist/esm-es5/isColorVariable-4cda28c9.js +2 -0
- package/dist/esm-es5/isColorVariable-4cda28c9.js.map +1 -0
- package/dist/esm-es5/isDarkColor-b21326ae.js +2 -0
- package/dist/esm-es5/isDarkColor-b21326ae.js.map +1 -0
- package/dist/esm-es5/loader.js +2 -0
- package/dist/esm-es5/loader.js.map +1 -0
- package/dist/esm-es5/localization-4a424f49.js +2 -0
- package/dist/esm-es5/localization-4a424f49.js.map +1 -0
- package/dist/esm-es5/submitGtag-fbdb454b.js +2 -0
- package/dist/esm-es5/submitGtag-fbdb454b.js.map +1 -0
- package/dist/esm-es5/zonos-address_2.entry.js +2 -0
- package/dist/esm-es5/zonos-address_2.entry.js.map +1 -0
- package/dist/esm-es5/zonos-badge.entry.js +2 -0
- package/dist/esm-es5/zonos-badge.entry.js.map +1 -0
- package/dist/esm-es5/zonos-banner_2.entry.js +2 -0
- package/dist/esm-es5/zonos-banner_2.entry.js.map +1 -0
- package/dist/esm-es5/zonos-button_2.entry.js +2 -0
- package/dist/esm-es5/zonos-button_2.entry.js.map +1 -0
- package/dist/esm-es5/zonos-card_2.entry.js +2 -0
- package/dist/esm-es5/zonos-card_2.entry.js.map +1 -0
- package/dist/esm-es5/zonos-cart-items_10.entry.js +2 -0
- package/dist/esm-es5/zonos-cart-items_10.entry.js.map +1 -0
- package/dist/esm-es5/zonos-checkout.entry.js +2 -0
- package/dist/esm-es5/zonos-checkout.entry.js.map +1 -0
- package/dist/esm-es5/zonos-component.entry.js +2 -0
- package/dist/esm-es5/zonos-component.entry.js.map +1 -0
- package/dist/esm-es5/zonos-controller.entry.js +2 -0
- package/dist/esm-es5/zonos-controller.entry.js.map +1 -0
- package/dist/esm-es5/zonos-country-flag_4.entry.js +2 -0
- package/dist/esm-es5/zonos-country-flag_4.entry.js.map +1 -0
- package/dist/esm-es5/zonos-elements.js +2 -0
- package/dist/esm-es5/zonos-elements.js.map +1 -0
- package/dist/esm-es5/zonos-hello-dialog.entry.js +2 -0
- package/dist/esm-es5/zonos-hello-dialog.entry.js.map +1 -0
- package/dist/esm-es5/zonos-hello.entry.js +2 -0
- package/dist/esm-es5/zonos-hello.entry.js.map +1 -0
- package/dist/esm-es5/zonos-icon.entry.js +2 -0
- package/dist/esm-es5/zonos-icon.entry.js.map +1 -0
- package/dist/esm-es5/zonos-notification.entry.js +2 -0
- package/dist/esm-es5/zonos-notification.entry.js.map +1 -0
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +2 -0
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js.map +1 -0
- package/dist/esm-es5/zonos-text.entry.js +2 -0
- package/dist/esm-es5/zonos-text.entry.js.map +1 -0
- package/dist/esm-es5/zonosStore-13a7b534.js +2 -0
- package/dist/esm-es5/zonosStore-13a7b534.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.d.ts +4 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.d.ts +3 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +36 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.d.ts +34 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +86 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +35 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-review/zonos-review.d.ts +16 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.d.ts +33 -0
- package/dist/types/components/common/countries.d.ts +3 -0
- package/dist/types/components/common/zonos-badge/zonos-badge.d.ts +38 -0
- package/dist/types/components/common/zonos-banner/zonos-banner.d.ts +24 -0
- package/dist/types/components/common/zonos-button/zonos-button.d.ts +96 -0
- package/dist/types/components/common/zonos-card/zonos-card.d.ts +31 -0
- package/dist/types/components/common/zonos-collapse/zonos-collapse.d.ts +16 -0
- package/dist/types/components/common/zonos-country-flag/zonos-country-flag.d.ts +19 -0
- package/dist/types/components/common/zonos-country-select/zonos-country-select.d.ts +11 -0
- package/dist/types/components/common/zonos-custom-message/zonos-custom-message.d.ts +11 -0
- package/dist/types/components/common/zonos-dialog/zonos-dialog.d.ts +79 -0
- package/dist/types/components/common/zonos-icon/zonos-icon.d.ts +30 -0
- package/dist/types/components/common/zonos-logo/zonos-logo.d.ts +16 -0
- package/dist/types/components/common/zonos-notification/zonos-notification.d.ts +35 -0
- package/dist/types/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.d.ts +41 -0
- package/dist/types/components/common/zonos-spinner/zonos-spinner.d.ts +14 -0
- package/dist/types/components/common/zonos-text/zonos-text.d.ts +34 -0
- package/dist/types/components/common/zonos-v-stack/zonos-v-stack.d.ts +13 -0
- package/dist/types/components/component-template/zonos-component/zonos-component.d.ts +16 -0
- package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +50 -0
- package/dist/types/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.d.ts +13 -0
- package/dist/types/components/hello/zonos-hello-dialog/zonos-hello-dialog.d.ts +40 -0
- package/dist/types/components/main/zonos-controller.d.ts +44 -0
- package/dist/types/components/store/checkout/cart.d.ts +68 -0
- package/dist/types/components/store/checkout/stripe.d.ts +71 -0
- package/dist/types/components/store/hello/localization.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +140 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +140 -0
- package/dist/types/components/store/translationStore.d.ts +11 -0
- package/dist/types/components/store/zonosStore.d.ts +39 -0
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +20 -0
- package/dist/types/components/stripe/zonos-link-authentication/zonos-link-authentication.d.ts +12 -0
- package/dist/types/components/stripe/zonos-payment/zonos-payment.d.ts +13 -0
- package/dist/types/components/utils/addDays.d.ts +14 -0
- package/dist/types/components/utils/api/calculateLandedCost.d.ts +2 -0
- package/dist/types/components/utils/api/getCountries.d.ts +2 -0
- package/dist/types/components/utils/api/getCountryLandedCost.d.ts +10 -0
- package/dist/types/components/utils/api/getExchangeRate.d.ts +16 -0
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +20 -0
- package/dist/types/components/utils/api/getLocalization.d.ts +8 -0
- package/dist/types/components/utils/api/getShippingZones.d.ts +1 -0
- package/dist/types/components/utils/api/getZonosSetting.d.ts +8 -0
- package/dist/types/components/utils/api/prepCalculateLandedCost.d.ts +2 -0
- package/dist/types/components/utils/changeDeepProperty.d.ts +44 -0
- package/dist/types/components/utils/changeDeepPropertyAtIndex.d.ts +68 -0
- package/dist/types/components/utils/checkout/initCheckout.d.ts +2 -0
- package/dist/types/components/utils/checkout/isCheckoutMobile.d.ts +2 -0
- package/dist/types/components/utils/classes.d.ts +10 -0
- package/dist/types/components/utils/darkenColor.d.ts +4 -0
- package/dist/types/components/utils/formatCurrency.d.ts +5 -0
- package/dist/types/components/utils/formatDate.d.ts +10 -0
- package/dist/types/components/utils/getBorderRadius.d.ts +7 -0
- package/dist/types/components/utils/getButtonTheme.d.ts +4 -0
- package/dist/types/components/utils/getDaysDifference.d.ts +1 -0
- package/dist/types/components/utils/handleFetch.d.ts +15 -0
- package/dist/types/components/utils/hello/currencyConversion/currencyConvert.d.ts +1 -0
- package/dist/types/components/utils/hello/currencyConversion/currencyConvertAndFormat.d.ts +1 -0
- package/dist/types/components/utils/hello/currencyConversion/currencyDisplay.d.ts +1 -0
- package/dist/types/components/utils/hello/currencyConversion/currencyFormat.d.ts +1 -0
- package/dist/types/components/utils/hello/currencyConversion/defaultCurrencyConverter.d.ts +1 -0
- package/dist/types/components/utils/hello/currencyConversion/getCurrencyCode.d.ts +3 -0
- package/dist/types/components/utils/hello/currencyConversion/getCurrencyElements.d.ts +1 -0
- package/dist/types/components/utils/hello/currencyConversion/getInitialElementAmount.d.ts +1 -0
- package/dist/types/components/utils/hello/currencyConversion/getLanguageCode.d.ts +2 -0
- package/dist/types/components/utils/hello/getCurrentHelloLocalePage.d.ts +1 -0
- package/dist/types/components/utils/hello/getHasMoreSpaceOnRight.d.ts +1 -0
- package/dist/types/components/utils/hello/initHello.d.ts +2 -0
- package/dist/types/components/utils/isColorVariable.d.ts +1 -0
- package/dist/types/components/utils/isDarkColor.d.ts +1 -0
- package/dist/types/components/utils/isValidSelector.d.ts +7 -0
- package/dist/types/components/utils/jsonParse.d.ts +1 -0
- package/dist/types/components/utils/lightenColor.d.ts +4 -0
- package/dist/types/components/utils/logging/log.d.ts +3 -0
- package/dist/types/components/utils/logging/logError.d.ts +1 -0
- package/dist/types/components/utils/mergeConfig.d.ts +9 -0
- package/dist/types/components/utils/submitGtag.d.ts +11 -0
- package/dist/types/components.d.ts +1603 -0
- package/dist/types/environment.d.ts +36 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/scripts/loadStripe.d.ts +2 -0
- package/dist/types/scripts/stripe.d.ts +13 -0
- package/dist/types/scripts/zonos.d.ts +42 -0
- package/dist/types/stencil-public-runtime.d.ts +1652 -0
- package/dist/types/styles/stripe/addressRuleStyle.d.ts +4 -0
- package/dist/types/styles/stripe/defaultVariable.d.ts +6 -0
- package/dist/types/types/ICountryJson.d.ts +29 -0
- package/dist/types/types/JsonError.d.ts +5 -0
- package/dist/types/types/NoInfer.d.ts +5 -0
- package/dist/types/types/Translation.d.ts +3 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +55 -0
- package/dist/types/types/checkout/api/CalculateLandedCostRequest.d.ts +19 -0
- package/dist/types/types/generated/graphql.customer.types.d.ts +2352 -0
- package/dist/types/types/generated/graphql.customer.types.ts +2688 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +502 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +527 -0
- package/dist/types/types/global.d.ts +19 -0
- package/dist/types/types/hello/HelloConfig.d.ts +19 -0
- package/dist/types/types/index.d.ts +10 -0
- package/dist/types/types/online-store/OnlineStoreConfig.d.ts +3 -0
- package/dist/types/types/stripe/Apperance.d.ts +19 -0
- package/dist/types/types/styles/Color.d.ts +5 -0
- package/dist/types/types/styles/GridSpacing.d.ts +2 -0
- package/dist/types/types/styles/Text.d.ts +97 -0
- package/dist/types/types/ts-reset/common.d.ts +9 -0
- package/dist/types/types/ts-reset/fetch.d.ts +4 -0
- package/dist/types/types/ts-reset/reset.d.ts +2 -0
- package/dist/types/types/utils/deep/IDeepKeyof.d.ts +20 -0
- package/dist/types/types/utils/deep/IDeepKeyofAtIndex.d.ts +14 -0
- package/dist/types/utils/format.d.ts +1 -0
- package/dist/types/utils/generateVercelDeployUrl.d.ts +11 -0
- package/dist/zonos-elements/assets/ChevronDownIcon.svg +1 -0
- package/dist/zonos-elements/assets/ChevronUpIcon.svg +1 -0
- package/dist/zonos-elements/assets/InfoIcon.svg +4 -0
- package/dist/zonos-elements/assets/LeftArrow.svg +1 -0
- package/dist/zonos-elements/assets/MessageIcon.svg +3 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -0
- package/dist/zonos-elements/assets/SuccessIcon.svg +1 -0
- package/dist/zonos-elements/assets/ZonosLogo.png +0 -0
- package/dist/zonos-elements/assets/bagIcon.svg +3 -0
- package/dist/zonos-elements/assets/empty-item.jpeg +0 -0
- package/dist/zonos-elements/assets/messageIcon.svg +3 -0
- package/dist/zonos-elements/assets/moneyIcon.svg +3 -0
- package/dist/zonos-elements/assets/removeIcon.svg +1 -0
- package/dist/zonos-elements/cart-36c33342.js +591 -0
- package/dist/zonos-elements/cart-36c33342.js.map +1 -0
- package/dist/zonos-elements/cart-ecd9011b.system.js +2 -0
- package/dist/zonos-elements/cart-ecd9011b.system.js.map +1 -0
- package/dist/zonos-elements/classes-0d95c529.js +14 -0
- package/dist/zonos-elements/classes-0d95c529.js.map +1 -0
- package/dist/zonos-elements/classes-ce25a814.system.js +2 -0
- package/dist/zonos-elements/classes-ce25a814.system.js.map +1 -0
- package/dist/zonos-elements/getBorderRadius-4fbe49de.system.js +2 -0
- package/dist/zonos-elements/getBorderRadius-4fbe49de.system.js.map +1 -0
- package/dist/zonos-elements/getBorderRadius-82fbaf25.js +18 -0
- package/dist/zonos-elements/getBorderRadius-82fbaf25.js.map +1 -0
- package/dist/zonos-elements/getHasMoreSpaceOnRight-5a9efd60.system.js +2 -0
- package/dist/zonos-elements/getHasMoreSpaceOnRight-5a9efd60.system.js.map +1 -0
- package/dist/zonos-elements/getHasMoreSpaceOnRight-feba1ae2.js +10 -0
- package/dist/zonos-elements/getHasMoreSpaceOnRight-feba1ae2.js.map +1 -0
- package/dist/zonos-elements/index-87193773.system.js +3 -0
- package/dist/zonos-elements/index-87193773.system.js.map +1 -0
- package/dist/zonos-elements/index-d1aa9293.js +1884 -0
- package/dist/zonos-elements/index-d1aa9293.js.map +1 -0
- package/dist/zonos-elements/index.esm.js +3 -0
- package/dist/zonos-elements/index.esm.js.map +1 -0
- package/dist/zonos-elements/index.system.js +2 -0
- package/dist/zonos-elements/index.system.js.map +1 -0
- package/dist/zonos-elements/isColorVariable-4cda28c9.js +16 -0
- package/dist/zonos-elements/isColorVariable-4cda28c9.js.map +1 -0
- package/dist/zonos-elements/isColorVariable-be454101.system.js +2 -0
- package/dist/zonos-elements/isColorVariable-be454101.system.js.map +1 -0
- package/dist/zonos-elements/isDarkColor-b21326ae.js +1197 -0
- package/dist/zonos-elements/isDarkColor-b21326ae.js.map +1 -0
- package/dist/zonos-elements/isDarkColor-dc2b7c8f.system.js +2 -0
- package/dist/zonos-elements/isDarkColor-dc2b7c8f.system.js.map +1 -0
- package/dist/zonos-elements/localization-3c43290f.system.js +2 -0
- package/dist/zonos-elements/localization-3c43290f.system.js.map +1 -0
- package/dist/zonos-elements/localization-4a424f49.js +3374 -0
- package/dist/zonos-elements/localization-4a424f49.js.map +1 -0
- package/dist/zonos-elements/submitGtag-23ecdc20.system.js +2 -0
- package/dist/zonos-elements/submitGtag-23ecdc20.system.js.map +1 -0
- package/dist/zonos-elements/submitGtag-fbdb454b.js +26 -0
- package/dist/zonos-elements/submitGtag-fbdb454b.js.map +1 -0
- package/dist/zonos-elements/zonos-address_2.entry.js +121 -0
- package/dist/zonos-elements/zonos-address_2.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-address_2.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-address_2.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-badge.entry.js +32 -0
- package/dist/zonos-elements/zonos-badge.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-badge.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-badge.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-banner_2.entry.js +115 -0
- package/dist/zonos-elements/zonos-banner_2.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-banner_2.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-banner_2.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-button_2.entry.js +124 -0
- package/dist/zonos-elements/zonos-button_2.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-button_2.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-button_2.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-card_2.entry.js +42 -0
- package/dist/zonos-elements/zonos-card_2.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-card_2.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-card_2.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-cart-items_10.entry.js +492 -0
- package/dist/zonos-elements/zonos-cart-items_10.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-cart-items_10.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-cart-items_10.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-checkout.entry.js +333 -0
- package/dist/zonos-elements/zonos-checkout.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-checkout.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-checkout.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-component.entry.js +27 -0
- package/dist/zonos-elements/zonos-component.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-component.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-component.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-controller.entry.js +165 -0
- package/dist/zonos-elements/zonos-controller.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-controller.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-controller.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-country-flag_4.entry.js +1895 -0
- package/dist/zonos-elements/zonos-country-flag_4.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-country-flag_4.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-country-flag_4.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-elements.css +37 -0
- package/dist/zonos-elements/zonos-elements.esm.js +20 -0
- package/dist/zonos-elements/zonos-elements.esm.js.map +1 -0
- package/dist/zonos-elements/zonos-elements.js +127 -0
- package/dist/zonos-elements/zonos-elements.system.js +2 -0
- package/dist/zonos-elements/zonos-elements.system.js.map +1 -0
- package/dist/zonos-elements/zonos-hello-dialog.entry.js +111 -0
- package/dist/zonos-elements/zonos-hello-dialog.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-hello-dialog.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-hello-dialog.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-hello.entry.js +481 -0
- package/dist/zonos-elements/zonos-hello.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-hello.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-hello.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-icon.entry.js +30 -0
- package/dist/zonos-elements/zonos-icon.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-icon.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-icon.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-notification.entry.js +67 -0
- package/dist/zonos-elements/zonos-notification.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-notification.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-notification.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-shipping-rich-radio.entry.js +50 -0
- package/dist/zonos-elements/zonos-shipping-rich-radio.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-shipping-rich-radio.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-shipping-rich-radio.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-text.entry.js +156 -0
- package/dist/zonos-elements/zonos-text.entry.js.map +1 -0
- package/dist/zonos-elements/zonos-text.system.entry.js +2 -0
- package/dist/zonos-elements/zonos-text.system.entry.js.map +1 -0
- package/dist/zonos-elements/zonosStore-13a7b534.js +2639 -0
- package/dist/zonos-elements/zonosStore-13a7b534.js.map +1 -0
- package/dist/zonos-elements/zonosStore-77bcd7c0.system.js +2 -0
- package/dist/zonos-elements/zonosStore-77bcd7c0.system.js.map +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +21 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +155 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { createStore } from "@stencil/store";
|
|
2
|
+
import { cartStore, cartStoreApplySubtotals, } from "./cart";
|
|
3
|
+
import { localizationStore } from "../hello/localization";
|
|
4
|
+
import { translate } from "../translationStore";
|
|
5
|
+
import { zonosStore } from "../zonosStore";
|
|
6
|
+
import { calculateLandedCost } from "../../utils/api/calculateLandedCost";
|
|
7
|
+
import { handleFetch } from "../../utils/handleFetch";
|
|
8
|
+
import { isDarkColor } from "../../utils/isDarkColor";
|
|
9
|
+
import { log } from "../../utils/logging/log";
|
|
10
|
+
import { logError } from "../../utils/logging/logError";
|
|
11
|
+
import { addressRuleStyle } from "../../../styles/stripe/addressRuleStyle";
|
|
12
|
+
import { defaultVariable } from "../../../styles/stripe/defaultVariable";
|
|
13
|
+
const { onChange, reset, state: stripeStore, } = createStore(() => ({
|
|
14
|
+
clientSecret: sessionStorage.getItem('zonos--client-secret') || null,
|
|
15
|
+
fetchingLandedCostAbordController: null,
|
|
16
|
+
isFetchingLandedCost: false,
|
|
17
|
+
isFetchingSession: false,
|
|
18
|
+
stripe: null,
|
|
19
|
+
stripeAddressElement: null,
|
|
20
|
+
stripeAddressEventData: null,
|
|
21
|
+
stripeAddressUsedWhenFetchingLC: null,
|
|
22
|
+
stripeElements: null,
|
|
23
|
+
stripeLinkElement: null,
|
|
24
|
+
stripeLinkEventData: null,
|
|
25
|
+
stripeLinkUsedWhenFetchingLC: null,
|
|
26
|
+
stripePaymentElement: null,
|
|
27
|
+
stripePaymentEventData: null,
|
|
28
|
+
}));
|
|
29
|
+
const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryColor, overrideTheme, }) => {
|
|
30
|
+
const primaryColor = overridePrimaryColor || zonosStore.appearance.colorPrimary;
|
|
31
|
+
const themeBasedColor = primaryColor && isDarkColor(primaryColor) ? 'night' : 'flat';
|
|
32
|
+
// if overrideTheme is provided, use it. Otherwise, use theme based on primary color
|
|
33
|
+
const theme = overrideTheme === 'DARK' ? 'night' : 'flat';
|
|
34
|
+
return {
|
|
35
|
+
appearance: {
|
|
36
|
+
labels: 'floating',
|
|
37
|
+
rules: Object.assign({}, addressRuleStyle({ theme: 'LIGHT' })),
|
|
38
|
+
// get contrast theme color base on primary color
|
|
39
|
+
theme: overrideTheme ? theme : themeBasedColor,
|
|
40
|
+
variables: Object.assign({}, defaultVariable({
|
|
41
|
+
borderStyle: overrideBorderRaidus,
|
|
42
|
+
theme: 'LIGHT',
|
|
43
|
+
})),
|
|
44
|
+
},
|
|
45
|
+
clientSecret,
|
|
46
|
+
locale: localizationStore.selectedLocale,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const initStripeElements = async (props) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const clientSecret = stripeStore.clientSecret;
|
|
52
|
+
if (!stripeStore.stripe) {
|
|
53
|
+
log('Skip. Stripe is not initialized');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (clientSecret) {
|
|
57
|
+
const stripeOptions = getStripeOptions({
|
|
58
|
+
clientSecret,
|
|
59
|
+
overrideBorderRaidus: props === null || props === void 0 ? void 0 : props.overrideBorderRaidus,
|
|
60
|
+
overridePrimaryColor: props === null || props === void 0 ? void 0 : props.overridePrimaryColor,
|
|
61
|
+
overrideTheme: props === null || props === void 0 ? void 0 : props.overrideTheme,
|
|
62
|
+
});
|
|
63
|
+
if (!stripeStore.stripeElements) {
|
|
64
|
+
// init stripe elements if it doesn't exist
|
|
65
|
+
stripeStore.stripeElements = (_a = stripeStore.stripe) === null || _a === void 0 ? void 0 : _a.elements(stripeOptions);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// update elements with new option if it already exists
|
|
69
|
+
stripeStore.stripeElements.update(stripeOptions);
|
|
70
|
+
}
|
|
71
|
+
log('Stripe elements initialized');
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const stripeStoreReset = () => {
|
|
75
|
+
// clean clientSecret so that we can start the new one.
|
|
76
|
+
sessionStorage.removeItem('zonos--client-secret');
|
|
77
|
+
// cleanup stripe elements
|
|
78
|
+
reset();
|
|
79
|
+
// set stripe back to window.Zonos.stripe
|
|
80
|
+
stripeStore.stripe = window.Zonos.stripe;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Check if the address and email info used when fetching landed cost with the current email and address info are different
|
|
84
|
+
* Purpose is to resend the request if the info used when fetching landed cost is different from the current info
|
|
85
|
+
*/
|
|
86
|
+
const isPrefetchInfoOutdated = () => {
|
|
87
|
+
var _a, _b, _c, _d;
|
|
88
|
+
const hasAbortController = stripeStore.fetchingLandedCostAbordController;
|
|
89
|
+
if (!hasAbortController) {
|
|
90
|
+
// if there is no abort controller, this is a new request
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const isLinkDataDirty = JSON.stringify((_a = stripeStore.stripeLinkUsedWhenFetchingLC) === null || _a === void 0 ? void 0 : _a.value) !==
|
|
94
|
+
JSON.stringify((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.value);
|
|
95
|
+
const isAddressDataDirty = JSON.stringify((_c = stripeStore.stripeAddressUsedWhenFetchingLC) === null || _c === void 0 ? void 0 : _c.value) !==
|
|
96
|
+
JSON.stringify((_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value);
|
|
97
|
+
return isLinkDataDirty || isAddressDataDirty;
|
|
98
|
+
};
|
|
99
|
+
const stripeStorePrefetchLandedCost = async () => {
|
|
100
|
+
var _a, _b, _c, _d;
|
|
101
|
+
const stripeAddressReady = !!((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete);
|
|
102
|
+
const stripeLinkReady = !!((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.complete);
|
|
103
|
+
const shouldRefetch = isPrefetchInfoOutdated();
|
|
104
|
+
if (shouldRefetch) {
|
|
105
|
+
// if the info used when fetching landed cost is different from the current info, abort the previous request
|
|
106
|
+
(_c = stripeStore.fetchingLandedCostAbordController) === null || _c === void 0 ? void 0 : _c.abort();
|
|
107
|
+
stripeStore.fetchingLandedCostAbordController = null;
|
|
108
|
+
}
|
|
109
|
+
// only fetch if we are not fetching or we need to refetch
|
|
110
|
+
if (stripeAddressReady &&
|
|
111
|
+
stripeLinkReady &&
|
|
112
|
+
(shouldRefetch || !stripeStore.isFetchingLandedCost)) {
|
|
113
|
+
stripeStore.isFetchingLandedCost = true;
|
|
114
|
+
if (stripeStore.stripeAddressEventData) {
|
|
115
|
+
stripeStore.stripeAddressUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeAddressEventData);
|
|
116
|
+
}
|
|
117
|
+
if (stripeStore.stripeLinkEventData) {
|
|
118
|
+
stripeStore.stripeLinkUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeLinkEventData);
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const abortController = new AbortController();
|
|
122
|
+
stripeStore.fetchingLandedCostAbordController = abortController;
|
|
123
|
+
const { checkoutSessionWorkflow, shipmentRatingCalculateWorkflow } = await calculateLandedCost(abortController);
|
|
124
|
+
// reset abort controller after we are done
|
|
125
|
+
stripeStore.fetchingLandedCostAbordController = null;
|
|
126
|
+
// update cart store with landed cost info
|
|
127
|
+
cartStore.landedCostData =
|
|
128
|
+
(checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.filter(Boolean)) || null;
|
|
129
|
+
cartStore.shippingData =
|
|
130
|
+
(shipmentRatingCalculateWorkflow === null || shipmentRatingCalculateWorkflow === void 0 ? void 0 : shipmentRatingCalculateWorkflow.filter(Boolean)) || null;
|
|
131
|
+
// apply new subtotal and total, this is mainly to show items in the presentment currency
|
|
132
|
+
const firstLandedCostData = (_d = cartStore.landedCostData) === null || _d === void 0 ? void 0 : _d.find(Boolean);
|
|
133
|
+
const subtotals = !!firstLandedCostData
|
|
134
|
+
? firstLandedCostData.subtotals
|
|
135
|
+
: null;
|
|
136
|
+
if (subtotals) {
|
|
137
|
+
// prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
|
|
138
|
+
cartStoreApplySubtotals({
|
|
139
|
+
items: subtotals.items,
|
|
140
|
+
landedCostTotal: 0,
|
|
141
|
+
presentmentCurrencyCode: subtotals.presentmentCurrencyCode,
|
|
142
|
+
shipping: 0,
|
|
143
|
+
total: subtotals.items,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
logError(err);
|
|
149
|
+
}
|
|
150
|
+
stripeStore.isFetchingLandedCost = false;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const getStripeMessageBasedOnStatus = (status) => {
|
|
154
|
+
let messages = [];
|
|
155
|
+
let isError = true;
|
|
156
|
+
// Inspect the PaymentIntent `status` to indicate the status of the payment
|
|
157
|
+
// to your customer.
|
|
158
|
+
//
|
|
159
|
+
// Some payment methods will [immediately succeed or fail][0] upon
|
|
160
|
+
// confirmation, while others will first enter a `processing` state.
|
|
161
|
+
//
|
|
162
|
+
// [0]: https://stripe.com/docs/payments/payment-methods#payment-notification
|
|
163
|
+
switch (status) {
|
|
164
|
+
case 'succeeded': {
|
|
165
|
+
messages = [
|
|
166
|
+
translate('Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.'),
|
|
167
|
+
'',
|
|
168
|
+
'',
|
|
169
|
+
translate("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time."),
|
|
170
|
+
];
|
|
171
|
+
isError = false;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
case 'requires_capture':
|
|
175
|
+
case 'processing': {
|
|
176
|
+
messages = [
|
|
177
|
+
translate("Payment processing. We'll update you when payment is received."),
|
|
178
|
+
];
|
|
179
|
+
isError = false;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
case 'requires_payment_method': {
|
|
183
|
+
messages = [
|
|
184
|
+
translate('Payment failed. Please try another payment method.'),
|
|
185
|
+
];
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
default: {
|
|
189
|
+
messages = [translate('Something went wrong.')];
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
isError,
|
|
195
|
+
messages,
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
const stripeStoreRetrievePayment = async ({ clientSecret: _clientSecret, storybookForceStatus, }) => {
|
|
199
|
+
if (storybookForceStatus) {
|
|
200
|
+
// return status right away if we are in storybook mode
|
|
201
|
+
const { isError, messages } = getStripeMessageBasedOnStatus(storybookForceStatus);
|
|
202
|
+
return { error: isError, messages };
|
|
203
|
+
}
|
|
204
|
+
const clientSecret = _clientSecret || stripeStore.clientSecret;
|
|
205
|
+
if (!stripeStore.stripe || !clientSecret) {
|
|
206
|
+
logError('Failed to retrieve payment intent. Stripe is not initialized');
|
|
207
|
+
return { error: true, message: [translate('Something went wrong.')] };
|
|
208
|
+
}
|
|
209
|
+
const { paymentIntent } = await stripeStore.stripe.retrievePaymentIntent(clientSecret);
|
|
210
|
+
const status = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status;
|
|
211
|
+
const { isError, messages } = getStripeMessageBasedOnStatus(status);
|
|
212
|
+
return { error: isError, messages };
|
|
213
|
+
};
|
|
214
|
+
const stripeStoreConfirmPayment = async () => {
|
|
215
|
+
var _a, _b, _c;
|
|
216
|
+
const stripePaymentReady = !!((_a = stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.complete);
|
|
217
|
+
const stripeElements = stripeStore.stripeElements;
|
|
218
|
+
const stripe = stripeStore.stripe;
|
|
219
|
+
const stripeClientSecret = stripeStore.clientSecret;
|
|
220
|
+
if (stripe && stripeElements && stripePaymentReady && stripeClientSecret) {
|
|
221
|
+
const { error } = await stripe.confirmPayment({
|
|
222
|
+
confirmParams: {
|
|
223
|
+
receipt_email: (_c = (_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.email,
|
|
224
|
+
return_url: window.location.href,
|
|
225
|
+
},
|
|
226
|
+
elements: stripeElements,
|
|
227
|
+
redirect: 'if_required',
|
|
228
|
+
});
|
|
229
|
+
if (error) {
|
|
230
|
+
if (error.type === 'card_error' || error.type === 'validation_error') {
|
|
231
|
+
throw new Error(error.message);
|
|
232
|
+
}
|
|
233
|
+
if (error.type === 'invalid_request_error') {
|
|
234
|
+
if (error.code === 'payment_intent_unexpected_state') {
|
|
235
|
+
// PaymentIntent was canceled or expired, or status is `require_capture`.
|
|
236
|
+
// don't throw error here because we will reset the checkout session last step
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
throw new Error('An unexpected error occurred.');
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Init checkout session
|
|
246
|
+
* @returns {boolean} whether or not the checkout session is successfully created
|
|
247
|
+
*/
|
|
248
|
+
const stripeStoreInitCheckoutSession = async () => {
|
|
249
|
+
var _a;
|
|
250
|
+
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
251
|
+
if (!total || !localizationStore.targetCurrency) {
|
|
252
|
+
logError('Fail to create checkout session - invalid total or currency');
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
stripeStore.isFetchingSession = true;
|
|
256
|
+
const { errors, json } = await handleFetch(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/create-checkout-session`, {
|
|
257
|
+
body: {
|
|
258
|
+
currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
|
|
259
|
+
itemsAmount: total,
|
|
260
|
+
presentmentCountryCode: localizationStore.selectedCountryCode || null,
|
|
261
|
+
},
|
|
262
|
+
method: 'POST',
|
|
263
|
+
});
|
|
264
|
+
stripeStore.isFetchingSession = false;
|
|
265
|
+
if (errors.length || !json) {
|
|
266
|
+
logError('Error occurs when creating checkout session', JSON.stringify(errors, null, 2));
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
const result = json.checkoutSessionCreate;
|
|
270
|
+
stripeStore.clientSecret = result.clientSecret;
|
|
271
|
+
// update cart store with updated informations
|
|
272
|
+
cartStore.checkoutSessionId = result.id;
|
|
273
|
+
cartStoreApplySubtotals(Object.assign(Object.assign({}, result.subtotals), { landedCostTotal: 0, shipping: 0, total: result.subtotals.items }));
|
|
274
|
+
log('done-init-checkout-session');
|
|
275
|
+
return true;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
|
|
279
|
+
*/
|
|
280
|
+
const stripeStoreUpdateCheckoutSession = async ({ currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
|
|
281
|
+
// No need to set loading state here because this function will be called under the hood to update
|
|
282
|
+
// landed cost id for the section.
|
|
283
|
+
const { errors, json } = await handleFetch(`${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/update-checkout-session`, {
|
|
284
|
+
body: {
|
|
285
|
+
currency,
|
|
286
|
+
id,
|
|
287
|
+
itemsAmount,
|
|
288
|
+
landedCostId,
|
|
289
|
+
presentmentCountryCode,
|
|
290
|
+
},
|
|
291
|
+
method: 'POST',
|
|
292
|
+
});
|
|
293
|
+
if (errors.length || !json) {
|
|
294
|
+
logError('Error occurs when updating checkout session', JSON.stringify(errors, null, 2));
|
|
295
|
+
return { errors, json };
|
|
296
|
+
}
|
|
297
|
+
return { errors: [], json };
|
|
298
|
+
};
|
|
299
|
+
onChange('clientSecret', clientSecret => {
|
|
300
|
+
// update stripe elements when client secret changes
|
|
301
|
+
if (clientSecret && stripeStore.stripe) {
|
|
302
|
+
sessionStorage.setItem('zonos--client-secret', clientSecret);
|
|
303
|
+
}
|
|
304
|
+
if (!clientSecret) {
|
|
305
|
+
sessionStorage.removeItem('zonos--client-secret');
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
export { initStripeElements, stripeStore, stripeStoreConfirmPayment, stripeStoreInitCheckoutSession, stripeStorePrefetchLandedCost, stripeStoreReset, stripeStoreRetrievePayment, stripeStoreUpdateCheckoutSession, };
|
|
309
|
+
//# sourceMappingURL=stripe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.js","sourceRoot":"","sources":["../../../../src/components/store/checkout/stripe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAc7C,OAAO,EACL,SAAS,EACT,uBAAuB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kC;EAClC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,CAGxC,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,8BAA8B,EAAE;IAC1E,IAAI,EAAE;MACJ,QAAQ;MACR,EAAE;MACF,WAAW;MACX,YAAY;MACZ,sBAAsB;KACvB;IACD,MAAM,EAAE,MAAM;GACf,CAAC,CAAC;EAEH,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE;IAC1B,QAAQ,CACN,6CAA6C,EAC7C,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAChC,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACzB;EAED,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC,EAAE;EACtC,oDAAoD;EACpD,IAAI,YAAY,IAAI,WAAW,CAAC,MAAM,EAAE;IACtC,cAAc,CAAC,OAAO,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;GAC9D;EAED,IAAI,CAAC,YAAY,EAAE;IACjB,cAAc,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;GACnD;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,yBAAyB,EACzB,8BAA8B,EAC9B,6BAA6B,EAC7B,gBAAgB,EAChB,0BAA0B,EAC1B,gCAAgC,GACjC,CAAC","sourcesContent":["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 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;\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\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"]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { createStore } from "@stencil/store";
|
|
2
|
+
import { translationStoreUpdateLanguage } from "../translationStore";
|
|
3
|
+
import { zonosStore } from "../zonosStore";
|
|
4
|
+
import { getCountries } from "../../utils/api/getCountries";
|
|
5
|
+
import { getCountryLandedCost, } from "../../utils/api/getCountryLandedCost";
|
|
6
|
+
import { getExchangeRate, } from "../../utils/api/getExchangeRate";
|
|
7
|
+
import { getLocaleMessages } from "../../utils/api/getLocaleMessages";
|
|
8
|
+
import { getLocalization } from "../../utils/api/getLocalization";
|
|
9
|
+
import { getShippingZones } from "../../utils/api/getShippingZones";
|
|
10
|
+
import { currencyDisplay } from "../../utils/hello/currencyConversion/currencyDisplay";
|
|
11
|
+
import { getCurrencyCode } from "../../utils/hello/currencyConversion/getCurrencyCode";
|
|
12
|
+
import { log } from "../../utils/logging/log";
|
|
13
|
+
const { state: localizationStore } = createStore({
|
|
14
|
+
countryLandedCost: null,
|
|
15
|
+
customMessages: [],
|
|
16
|
+
exchangeRate: null,
|
|
17
|
+
isShippableCountry: false,
|
|
18
|
+
localizationLoaded: false,
|
|
19
|
+
selectedCountryCode: null,
|
|
20
|
+
selectedLocale: 'en',
|
|
21
|
+
shippingZoneCountries: null,
|
|
22
|
+
targetCurrency: 'USD',
|
|
23
|
+
});
|
|
24
|
+
const getNewLocalization = async () => {
|
|
25
|
+
log('get new localization store');
|
|
26
|
+
const { isShippableCountry, selectedCountryCode } = localizationStore;
|
|
27
|
+
if (zonosStore.helloSettings.currencyBehavior === 'DISABLED' ||
|
|
28
|
+
!isShippableCountry ||
|
|
29
|
+
!selectedCountryCode) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
localizationStore.exchangeRate = await getExchangeRate({
|
|
33
|
+
country: localizationStore.selectedCountryCode,
|
|
34
|
+
sourceCurrency: zonosStore.sourceCurrency,
|
|
35
|
+
targetCurrency: localizationStore.targetCurrency,
|
|
36
|
+
});
|
|
37
|
+
if (localizationStore.exchangeRate) {
|
|
38
|
+
currencyDisplay();
|
|
39
|
+
}
|
|
40
|
+
localizationStore.countryLandedCost = await getCountryLandedCost(localizationStore.selectedCountryCode);
|
|
41
|
+
};
|
|
42
|
+
const getCustomMessages = async () => {
|
|
43
|
+
if (!localizationStore.selectedCountryCode || !zonosStore.storeId) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const localeMessages = await getLocaleMessages({
|
|
47
|
+
countryCode: localizationStore.selectedCountryCode,
|
|
48
|
+
localeTo: localizationStore.selectedLocale,
|
|
49
|
+
storeId: zonosStore.storeId,
|
|
50
|
+
});
|
|
51
|
+
const allMessages = localeMessages.flatMap(x => {
|
|
52
|
+
var _a;
|
|
53
|
+
return {
|
|
54
|
+
countryCode: localizationStore.selectedCountryCode,
|
|
55
|
+
message: (_a = x.countryCodesPageMessageLinks.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message.textTo,
|
|
56
|
+
pageName: x.pageName,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
localizationStore.customMessages = allMessages;
|
|
60
|
+
};
|
|
61
|
+
const getOverrideLocale = () => {
|
|
62
|
+
const currentUrl = new URL(window.location.href);
|
|
63
|
+
const zonosLocale = currentUrl.searchParams.get('zonosLocale');
|
|
64
|
+
return zonosLocale;
|
|
65
|
+
};
|
|
66
|
+
const localizationStoreUpdateSelectedCountryCode = async (newSelectedCountryCode) => {
|
|
67
|
+
log('update selected country code');
|
|
68
|
+
localizationStore.selectedCountryCode = newSelectedCountryCode;
|
|
69
|
+
const { selectedCountryCode, shippingZoneCountries } = localizationStore;
|
|
70
|
+
const isShippableCountry = shippingZoneCountries &&
|
|
71
|
+
selectedCountryCode &&
|
|
72
|
+
!!shippingZoneCountries[selectedCountryCode];
|
|
73
|
+
// update shippable country
|
|
74
|
+
localizationStore.isShippableCountry = !!isShippableCountry;
|
|
75
|
+
log(`Is shippable country: ${localizationStore.isShippableCountry}`);
|
|
76
|
+
if (!selectedCountryCode) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const currencyCode = getCurrencyCode(selectedCountryCode);
|
|
80
|
+
if (!currencyCode) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
localizationStore.targetCurrency = currencyCode;
|
|
84
|
+
void getNewLocalization();
|
|
85
|
+
void getCustomMessages();
|
|
86
|
+
// Update the URL query param with the new country code
|
|
87
|
+
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
88
|
+
urlSearchParams.set('zonosCountry', selectedCountryCode);
|
|
89
|
+
const newUrl = `${window.location.pathname}?${urlSearchParams.toString()}`;
|
|
90
|
+
window.history.replaceState({}, '', newUrl);
|
|
91
|
+
};
|
|
92
|
+
const initLocalizationStore = async () => {
|
|
93
|
+
// all countries from countries.json, shipping zone and localization
|
|
94
|
+
const [allCountries, shippingZoneCountries, localization] = await Promise.all([getCountries(), getShippingZones(), getLocalization()]);
|
|
95
|
+
// Filter countries to only include countries in the shipping zone
|
|
96
|
+
const filteredCountries = shippingZoneCountries === null || shippingZoneCountries === void 0 ? void 0 : shippingZoneCountries.reduce((acc, countryCode) => {
|
|
97
|
+
const countryInfo = allCountries === null || allCountries === void 0 ? void 0 : allCountries[countryCode];
|
|
98
|
+
return countryInfo
|
|
99
|
+
? Object.assign(Object.assign({}, acc), { [countryCode]: countryInfo }) : acc;
|
|
100
|
+
}, {});
|
|
101
|
+
localizationStore.shippingZoneCountries = filteredCountries || null;
|
|
102
|
+
const { country, locale } = localization;
|
|
103
|
+
// update selected country code in store
|
|
104
|
+
void localizationStoreUpdateSelectedCountryCode(country);
|
|
105
|
+
// use locale from params if it exists, otherwise use locale from localization
|
|
106
|
+
const overrideLocale = getOverrideLocale();
|
|
107
|
+
localizationStore.selectedLocale = overrideLocale || locale || 'en';
|
|
108
|
+
translationStoreUpdateLanguage(localizationStore.selectedLocale);
|
|
109
|
+
const devSites = ['dev.elements', 'dev.dashboard'];
|
|
110
|
+
// If the country code is not set, set it to the US for development (vercel can't get geo country in dev)
|
|
111
|
+
if (!localizationStore.selectedCountryCode &&
|
|
112
|
+
devSites.some(site => window.location.origin.includes(site))) {
|
|
113
|
+
// update selected country code in store
|
|
114
|
+
void localizationStoreUpdateSelectedCountryCode('US');
|
|
115
|
+
}
|
|
116
|
+
localizationStore.localizationLoaded = true;
|
|
117
|
+
void getCustomMessages();
|
|
118
|
+
};
|
|
119
|
+
export { initLocalizationStore, localizationStore, localizationStoreUpdateSelectedCountryCode, };
|
|
120
|
+
//# sourceMappingURL=localization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localization.js","sourceRoot":"","sources":["../../../../src/components/store/hello/localization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAEL,oBAAoB,GACrB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,eAAe,GAChB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,+DAA+D,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,+DAA+D,CAAC;AAChG,OAAO,EAAE,GAAG,EAAE,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EAEzC,wCAAwC;EACxC,KAAK,0CAA0C,CAAC,OAAO,CAAC,CAAC;EACzD,8EAA8E;EAC9E,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;EAC3C,iBAAiB,CAAC,cAAc,GAAG,cAAc,IAAI,MAAM,IAAI,IAAI,CAAC;EACpE,8BAA8B,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;EACjE,MAAM,QAAQ,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;EAEnD,yGAAyG;EACzG,IACE,CAAC,iBAAiB,CAAC,mBAAmB;IACtC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAC5D;IACA,wCAAwC;IACxC,KAAK,0CAA0C,CAAC,IAAI,CAAC,CAAC;GACvD;EACD,iBAAiB,CAAC,kBAAkB,GAAG,IAAI,CAAC;EAE5C,KAAK,iBAAiB,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,0CAA0C,GAC3C,CAAC","sourcesContent":["import { createStore } from '@stencil/store';\n\nimport { translationStoreUpdateLanguage } from 'src/components/store/translationStore';\nimport { zonosStore } from 'src/components/store/zonosStore';\nimport { getCountries } from 'src/components/utils/api/getCountries';\nimport {\n type CountryLandedCost,\n getCountryLandedCost,\n} from 'src/components/utils/api/getCountryLandedCost';\nimport {\n type TargetFormat,\n getExchangeRate,\n} from 'src/components/utils/api/getExchangeRate';\nimport { getLocaleMessages } from 'src/components/utils/api/getLocaleMessages';\nimport { getLocalization } from 'src/components/utils/api/getLocalization';\nimport { getShippingZones } from 'src/components/utils/api/getShippingZones';\nimport { currencyDisplay } from 'src/components/utils/hello/currencyConversion/currencyDisplay';\nimport { getCurrencyCode } from 'src/components/utils/hello/currencyConversion/getCurrencyCode';\nimport { log } from 'src/components/utils/logging/log';\nimport type { CountryCode } from 'src/types';\nimport type { CurrencyCode } from 'src/types/generated/graphql.customer.types';\nimport type {\n Locale_ElementsSupportedLocationCode_Enum,\n Locale_PageName_Enum,\n} from 'src/types/generated/graphql.frontend.types';\nimport type { ICountryJson } from 'src/types/ICountryJson';\n\nexport type ExchangeRateForUse = { rate: number; targetFormat: TargetFormat };\ntype LocalizationStore = {\n countryLandedCost: CountryLandedCost | null;\n customMessages: ILocaleMessageForUse[];\n exchangeRate: ExchangeRateForUse | null;\n isShippableCountry: boolean;\n // toggle to determine if localization has been loaded\n localizationLoaded: boolean;\n selectedCountryCode: CountryCode | null;\n selectedLocale: Locale_ElementsSupportedLocationCode_Enum;\n shippingZoneCountries: ICountryJson | null;\n targetCurrency: CurrencyCode;\n};\n\ntype ILocaleMessageForUse = {\n countryCode: string | null;\n message?: string;\n pageName: Locale_PageName_Enum;\n};\n\nconst { state: localizationStore } = createStore<LocalizationStore>({\n countryLandedCost: null,\n customMessages: [],\n exchangeRate: null,\n isShippableCountry: false,\n localizationLoaded: false,\n selectedCountryCode: null,\n selectedLocale: 'en',\n shippingZoneCountries: null,\n targetCurrency: 'USD',\n});\n\nconst getNewLocalization = async () => {\n log('get new localization store');\n const { isShippableCountry, selectedCountryCode } = localizationStore;\n\n if (\n zonosStore.helloSettings.currencyBehavior === 'DISABLED' ||\n !isShippableCountry ||\n !selectedCountryCode\n ) {\n return;\n }\n localizationStore.exchangeRate = await getExchangeRate({\n country: localizationStore.selectedCountryCode,\n sourceCurrency: zonosStore.sourceCurrency,\n targetCurrency: localizationStore.targetCurrency,\n });\n\n if (localizationStore.exchangeRate) {\n currencyDisplay();\n }\n\n localizationStore.countryLandedCost = await getCountryLandedCost(\n localizationStore.selectedCountryCode,\n );\n};\n\nconst getCustomMessages = async () => {\n if (!localizationStore.selectedCountryCode || !zonosStore.storeId) {\n return;\n }\n const localeMessages = await getLocaleMessages({\n countryCode: localizationStore.selectedCountryCode,\n localeTo: localizationStore.selectedLocale,\n storeId: zonosStore.storeId,\n });\n const allMessages: ILocaleMessageForUse[] = localeMessages.flatMap(x => {\n return {\n countryCode: localizationStore.selectedCountryCode,\n message: x.countryCodesPageMessageLinks.find(Boolean)?.message.textTo,\n pageName: x.pageName,\n };\n });\n\n localizationStore.customMessages = allMessages;\n};\n\nconst getOverrideLocale = () => {\n const currentUrl = new URL(window.location.href);\n const zonosLocale = currentUrl.searchParams.get('zonosLocale');\n return zonosLocale as Locale_ElementsSupportedLocationCode_Enum | null;\n};\n\nconst localizationStoreUpdateSelectedCountryCode = async (\n newSelectedCountryCode: CountryCode | null,\n) => {\n log('update selected country code');\n localizationStore.selectedCountryCode = newSelectedCountryCode;\n const { selectedCountryCode, shippingZoneCountries } = localizationStore;\n const isShippableCountry =\n shippingZoneCountries &&\n selectedCountryCode &&\n !!shippingZoneCountries[selectedCountryCode];\n\n // update shippable country\n localizationStore.isShippableCountry = !!isShippableCountry;\n log(`Is shippable country: ${localizationStore.isShippableCountry}`);\n\n if (!selectedCountryCode) {\n return;\n }\n const currencyCode = getCurrencyCode(selectedCountryCode);\n if (!currencyCode) {\n return;\n }\n localizationStore.targetCurrency = currencyCode;\n void getNewLocalization();\n void getCustomMessages();\n\n // Update the URL query param with the new country code\n const urlSearchParams = new URLSearchParams(window.location.search);\n urlSearchParams.set('zonosCountry', selectedCountryCode);\n const newUrl = `${window.location.pathname}?${urlSearchParams.toString()}`;\n window.history.replaceState({}, '', newUrl);\n};\n\nconst initLocalizationStore = async () => {\n // all countries from countries.json, shipping zone and localization\n const [allCountries, shippingZoneCountries, localization] = await Promise.all(\n [getCountries(), getShippingZones(), getLocalization()],\n );\n\n // Filter countries to only include countries in the shipping zone\n const filteredCountries = shippingZoneCountries?.reduce(\n (acc: ICountryJson, countryCode) => {\n const countryInfo = allCountries?.[countryCode];\n return countryInfo\n ? {\n ...acc,\n [countryCode]: countryInfo,\n }\n : acc;\n },\n {},\n );\n localizationStore.shippingZoneCountries = filteredCountries || null;\n\n const { country, locale } = localization;\n\n // update selected country code in store\n void localizationStoreUpdateSelectedCountryCode(country);\n // use locale from params if it exists, otherwise use locale from localization\n const overrideLocale = getOverrideLocale();\n localizationStore.selectedLocale = overrideLocale || locale || 'en';\n translationStoreUpdateLanguage(localizationStore.selectedLocale);\n const devSites = ['dev.elements', 'dev.dashboard'];\n\n // If the country code is not set, set it to the US for development (vercel can't get geo country in dev)\n if (\n !localizationStore.selectedCountryCode &&\n devSites.some(site => window.location.origin.includes(site))\n ) {\n // update selected country code in store\n void localizationStoreUpdateSelectedCountryCode('US');\n }\n localizationStore.localizationLoaded = true;\n\n void getCustomMessages();\n};\n\nexport {\n initLocalizationStore,\n localizationStore,\n localizationStoreUpdateSelectedCountryCode,\n};\n"]}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export const stringsArabic = {
|
|
2
|
+
'Above de minimis threshold for': {
|
|
3
|
+
value: 'أعلى من الحد الأدنى لـ',
|
|
4
|
+
},
|
|
5
|
+
Address: {
|
|
6
|
+
value: 'العنوان',
|
|
7
|
+
},
|
|
8
|
+
Back: {
|
|
9
|
+
value: 'رجوع',
|
|
10
|
+
},
|
|
11
|
+
'Cart subtotal': {
|
|
12
|
+
value: 'المجموع الفرعي للسلة',
|
|
13
|
+
},
|
|
14
|
+
Contact: {
|
|
15
|
+
value: 'اتصل بنا',
|
|
16
|
+
},
|
|
17
|
+
'Continue to shipping': {
|
|
18
|
+
value: 'متابعة إلى الشحن',
|
|
19
|
+
},
|
|
20
|
+
'Customer information': {
|
|
21
|
+
value: 'معلومات العميل',
|
|
22
|
+
},
|
|
23
|
+
'Duties and taxes will be applied to items and shipping.': {
|
|
24
|
+
value: 'سيتم تطبيق الرسوم والضرائب على العناصر والشحن.',
|
|
25
|
+
},
|
|
26
|
+
'Duties will apply to all orders': {
|
|
27
|
+
value: 'ستنطبق الرسوم على جميع الطلبات',
|
|
28
|
+
},
|
|
29
|
+
'Duties, taxes, and fees': {
|
|
30
|
+
value: 'الرسوم والضرائب والرسوم',
|
|
31
|
+
},
|
|
32
|
+
'Error creating Checkout': {
|
|
33
|
+
value: 'خطأ في إنشاء جلسة الخروج',
|
|
34
|
+
},
|
|
35
|
+
'Error updating Checkout': {
|
|
36
|
+
value: 'خطأ في تحديث جلسة الخروج',
|
|
37
|
+
},
|
|
38
|
+
'Expected delivery': {
|
|
39
|
+
value: 'التوصيل المتوقع',
|
|
40
|
+
},
|
|
41
|
+
'Go to payment': {
|
|
42
|
+
value: 'الذهاب إلى الدفع',
|
|
43
|
+
},
|
|
44
|
+
Guaranteed: {
|
|
45
|
+
value: 'مضمون',
|
|
46
|
+
},
|
|
47
|
+
'Keep shopping': {
|
|
48
|
+
value: 'متابعة التسوق',
|
|
49
|
+
},
|
|
50
|
+
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
51
|
+
value: 'تعرف على الرسوم والضرائب قبل الشراء. اشترِ بثقة!',
|
|
52
|
+
},
|
|
53
|
+
'No shipping method selected': {
|
|
54
|
+
value: 'لم يتم تحديد طريقة الشحن',
|
|
55
|
+
},
|
|
56
|
+
'No shipping methods found - try editing your address or contacting support if the error persists': {
|
|
57
|
+
value: 'لم يتم العثور على طرق شحن - جرب تحرير عنوانك أو الاتصال بالدعم إذا استمر الخطأ',
|
|
58
|
+
},
|
|
59
|
+
'Order is over the de minimis threshold for both duty and tax': {
|
|
60
|
+
value: 'الطلبية أعلى من الحد الأدنى لكل من الرسوم والضرائب',
|
|
61
|
+
},
|
|
62
|
+
'Order total': {
|
|
63
|
+
value: 'إجمالي الطلبية',
|
|
64
|
+
},
|
|
65
|
+
Pay: {
|
|
66
|
+
value: 'دفع',
|
|
67
|
+
},
|
|
68
|
+
'Payment failed': {
|
|
69
|
+
value: 'فشل الدفع',
|
|
70
|
+
},
|
|
71
|
+
'Payment failed. Please try another payment method.': {
|
|
72
|
+
value: 'فشل الدفع. يرجى تجربة طريقة دفع أخرى.',
|
|
73
|
+
},
|
|
74
|
+
'Payment method': {
|
|
75
|
+
value: 'طريقة الدفع',
|
|
76
|
+
},
|
|
77
|
+
"Payment processing. We'll update you when payment is received.": {
|
|
78
|
+
value: 'جارٍ معالجة الدفع. سنحدثك عند استلام الدفعة.',
|
|
79
|
+
},
|
|
80
|
+
'Powered by': {
|
|
81
|
+
value: 'مشغل بواسطة',
|
|
82
|
+
},
|
|
83
|
+
'Prepay duties and taxes at checkout': {
|
|
84
|
+
value: 'دفع الرسوم والضرائب مقدمًا عند الدفع',
|
|
85
|
+
},
|
|
86
|
+
'See duty and tax thresholds': {
|
|
87
|
+
value: 'انظر عتبات الرسوم والضرائب',
|
|
88
|
+
},
|
|
89
|
+
Shipping: {
|
|
90
|
+
value: 'الشحن',
|
|
91
|
+
},
|
|
92
|
+
'Shipping information': {
|
|
93
|
+
value: 'معلومات الشحن',
|
|
94
|
+
},
|
|
95
|
+
'Shipping method': {
|
|
96
|
+
value: 'طريقة الشحن',
|
|
97
|
+
},
|
|
98
|
+
'Something went wrong.': {
|
|
99
|
+
value: 'حدث خطأ ما.',
|
|
100
|
+
},
|
|
101
|
+
Spend: {
|
|
102
|
+
value: 'إنفاق',
|
|
103
|
+
},
|
|
104
|
+
'Taxes will apply to all orders': {
|
|
105
|
+
value: 'ستنطبق الضرائب على جميع الطلبات',
|
|
106
|
+
},
|
|
107
|
+
"There's been an error creating your checkout session. Please reload and try again or contact support if the error persists": {
|
|
108
|
+
value: 'حدث خطأ في إنشاء جلسة الخروج الخاصة بك. يرجى إعادة التحميل والمحاولة مرة أخرى أو الاتصال بالدعم إذا استمر الخطأ',
|
|
109
|
+
},
|
|
110
|
+
"There's been an error updating your checkout session. Please reload and try again or contact support if the error persists": {
|
|
111
|
+
value: 'حدث خطأ في تحديث جلسة الخروج الخاصة بك. يرجى إعادة التحميل والمحاولة مرة أخرى أو الاتصال بالدعم إذا استمر الخطأ',
|
|
112
|
+
},
|
|
113
|
+
"We couldn't complete your payment. Please verify the payment details and try again.": {
|
|
114
|
+
value: 'تعذر علينا اكمال الدفع. يرجى التحقق من تفاصيل الدفع وإعادة المحاولة.',
|
|
115
|
+
},
|
|
116
|
+
"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.": {
|
|
117
|
+
value: 'لقد أرسلنا إليك تأكيدًا بالبريد الإلكتروني لتفاصيل الطلبية لمراجعتك. ويقوم فريقنا بإعداد طلبيتك بعناية حتى تصل في الوقت المحدد.',
|
|
118
|
+
},
|
|
119
|
+
'Welcome to': {
|
|
120
|
+
value: 'مرحبا بكم في',
|
|
121
|
+
},
|
|
122
|
+
'Welcome!': {
|
|
123
|
+
value: 'أهلا بك!',
|
|
124
|
+
},
|
|
125
|
+
"You're all set!": {
|
|
126
|
+
value: 'أنت جاهز!',
|
|
127
|
+
},
|
|
128
|
+
'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.': {
|
|
129
|
+
value: 'تمت عملية الدفع بنجاح! شكرا لتسوقك معنا! نأمل أن تكون قد استمتعت بتجربة رائعة ودعمك يعني لنا الكثير.',
|
|
130
|
+
},
|
|
131
|
+
'business days': {
|
|
132
|
+
value: 'أيام العمل',
|
|
133
|
+
},
|
|
134
|
+
'duty free': {
|
|
135
|
+
value: 'معفى من الرسوم',
|
|
136
|
+
},
|
|
137
|
+
'tax free': {
|
|
138
|
+
value: 'معفى من الضرائب',
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=strings.arabic.js.map
|