@zonos/elements 1.3.217 → 1.3.219
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/buildCartItemsByTempCart-309fcebf.js +28 -0
- package/dist/cjs/{cart-54ff39d6.js → cart-9a2b32e4.js} +91 -48
- package/dist/cjs/cleanHtmlMarkdown-577d0a77.js +999 -0
- package/dist/cjs/{handleFetch-0313ebba.js → handleFetch-45f35cac.js} +2 -1
- package/dist/cjs/index.cjs.js +20 -10
- package/dist/cjs/isCollectMobileTablet-7e57fd90.js +172 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/localization-b12edb2a.js +738 -0
- package/dist/cjs/{paypal-e7504122.js → paypal-e80871d0.js} +13 -9
- package/dist/cjs/placeTestOrder-8222fe95.js +93 -0
- package/dist/cjs/{localization-721a5ec3.js → translationStore-20a6d8bf.js} +963 -734
- package/dist/cjs/{updateCheckoutSessionAttributes-8db49644.js → updateCheckoutSessionAttributes-c0853fdd.js} +1 -1
- package/dist/cjs/zonos-address_11.cjs.entry.js +103 -73
- package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
- package/dist/cjs/{zonos-banner.cjs.entry.js → zonos-banner_2.cjs.entry.js} +40 -0
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/{zonos-cart-items_14.cjs.entry.js → zonos-cart-items_12.cjs.entry.js} +75 -1294
- package/dist/cjs/zonos-checkout.cjs.entry.js +27 -50
- package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +92 -0
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +810 -0
- package/dist/cjs/zonos-collect.cjs.entry.js +468 -0
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +168 -0
- package/dist/cjs/zonos-controller.cjs.entry.js +85 -29
- package/dist/cjs/zonos-country-flag.cjs.entry.js +3 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +12 -11
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +16 -6
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +35 -34
- package/dist/cjs/zonos-hello.cjs.entry.js +9 -8
- package/dist/cjs/zonos-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +7 -6
- package/dist/cjs/zonos-link.cjs.entry.js +1 -1
- package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +8 -5
- package/dist/cjs/zonos-text.cjs.entry.js +1 -1
- package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
- package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +10 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +5 -1
- package/dist/collection/components/checkout/zonos-collect/assets/ChevronDownIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/assets/empty-item.jpeg +0 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.css +60 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.js +39 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/assets/RemoveIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/assets/SuccessIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.css +84 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +403 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/chevronDownIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/globe.svg +3 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/zonosIconDark.svg +10 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/zonosIconLight.svg +10 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/zonosWordmark.svg +7 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.css +152 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.js +164 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/assets/ChevronDownIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/assets/ChevronUpIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.css +109 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.js +194 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/assets/CheckmarkLineIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/assets/RemoveLineIcon.svg +1 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.css +98 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +369 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.css +68 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.js +151 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.css +78 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.js +115 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect.css +349 -0
- package/dist/collection/components/checkout/zonos-collect/zonos-collect.js +547 -0
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
- package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
- package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
- package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +3 -3
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.css +38 -0
- package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +63 -0
- package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
- package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
- package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
- package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +1 -1
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
- package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
- package/dist/collection/components/common/zonos-skeleton/assets/RemoveLineIcon.svg +3 -0
- package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.css +40 -0
- package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +102 -0
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +8 -5
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
- package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
- package/dist/collection/components/common/zonos-text/zonos-text.css +1 -0
- package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
- package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
- package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
- package/dist/collection/components/main/zonos-controller.js +91 -25
- package/dist/collection/components/paypal/zonos-paypal-payment.js +13 -2
- package/dist/collection/components/store/checkout/cart.js +36 -15
- package/dist/collection/components/store/checkout/collect.js +157 -0
- package/dist/collection/components/store/checkout/paypal.js +4 -2
- package/dist/collection/components/store/checkout/stripe.js +31 -12
- package/dist/collection/components/store/translationStore/strings.arabic.js +48 -0
- package/dist/collection/components/store/translationStore/strings.base.js +48 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +48 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +48 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +48 -0
- package/dist/collection/components/store/translationStore/strings.french.js +48 -0
- package/dist/collection/components/store/translationStore/strings.german.js +48 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +48 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +48 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +48 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +48 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +48 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +48 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +48 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +48 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +48 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +48 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +48 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +48 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +48 -0
- package/dist/collection/components/store/translationStore.js +2 -1
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +35 -18
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +15 -2
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
- package/dist/collection/components/utils/checkout/initCollect.js +15 -0
- package/dist/collection/components/utils/checkout/isCollectMobileTablet.js +10 -0
- package/dist/collection/components/utils/checkout/renderCheckoutCurrency.js +10 -1
- package/dist/collection/components/utils/getNextFallbackApi.js +1 -1
- package/dist/collection/components/utils/handleFetch.js +1 -0
- package/dist/collection/components/utils/renderFallback.js +7 -0
- package/dist/collection/scripts/_getZonosQaUrl.js +5 -1
- package/dist/collection/scripts/_zonosBase.js +7 -1
- package/dist/collection/types/checkout/api/PartyInfo.js +1 -0
- package/dist/collection/types/generated/graphql.internal.types.js +103 -0
- package/dist/collection/types/index.js +1 -0
- package/dist/esm/buildCartItemsByTempCart-c4488f73.js +26 -0
- package/dist/esm/{cart-010402f9.js → cart-acf4ebf5.js} +69 -28
- package/dist/esm/cleanHtmlMarkdown-b5b18743.js +997 -0
- package/dist/esm/{handleFetch-fa90f7f6.js → handleFetch-99218189.js} +2 -1
- package/dist/esm/index.js +20 -10
- package/dist/esm/isCollectMobileTablet-b72b81c5.js +165 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/localization-8646f526.js +719 -0
- package/dist/esm/{paypal-70b140d9.js → paypal-2fa930eb.js} +8 -5
- package/dist/esm/placeTestOrder-d1ad9cf6.js +90 -0
- package/dist/esm/{localization-9db8b6e9.js → translationStore-c9743292.js} +963 -718
- package/dist/esm/{updateCheckoutSessionAttributes-691cdc6d.js → updateCheckoutSessionAttributes-92f42882.js} +1 -1
- package/dist/esm/zonos-address_11.entry.js +72 -42
- package/dist/esm/zonos-badge.entry.js +3 -3
- package/dist/esm/{zonos-banner.entry.js → zonos-banner_2.entry.js} +40 -1
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/{zonos-cart-items_14.entry.js → zonos-cart-items_12.entry.js} +24 -1241
- package/dist/esm/zonos-checkout.entry.js +8 -31
- package/dist/esm/zonos-collapse.entry.js +2 -2
- package/dist/esm/zonos-collect-cart-items_3.entry.js +86 -0
- package/dist/esm/zonos-collect-finish_6.entry.js +801 -0
- package/dist/esm/zonos-collect.entry.js +464 -0
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-confirm-dialog_2.entry.js +163 -0
- package/dist/esm/zonos-controller.entry.js +85 -29
- package/dist/esm/zonos-country-flag.entry.js +3 -2
- package/dist/esm/zonos-country-select_4.entry.js +12 -11
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-empty-state-payment_4.entry.js +16 -6
- package/dist/esm/zonos-hello-dialog.entry.js +7 -6
- package/dist/esm/zonos-hello.entry.js +3 -2
- package/dist/esm/zonos-input.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +7 -6
- package/dist/esm/zonos-link.entry.js +1 -1
- package/dist/esm/zonos-logo.entry.js +2 -2
- package/dist/esm/zonos-stripe-input.entry.js +9 -6
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/zonos-toggle.entry.js +2 -2
- package/dist/esm/zonos-tooltip.entry.js +2 -2
- package/dist/esm/zonos-v-stack.entry.js +2 -2
- package/dist/esm-es5/buildCartItemsByTempCart-c4488f73.js +1 -0
- package/dist/esm-es5/cart-acf4ebf5.js +1 -0
- package/dist/esm-es5/cleanHtmlMarkdown-b5b18743.js +1 -0
- package/dist/esm-es5/{handleFetch-fa90f7f6.js → handleFetch-99218189.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/isCollectMobileTablet-b72b81c5.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/localization-8646f526.js +1 -0
- package/dist/esm-es5/paypal-2fa930eb.js +17 -0
- package/dist/esm-es5/placeTestOrder-d1ad9cf6.js +1 -0
- package/dist/esm-es5/translationStore-c9743292.js +1 -0
- package/dist/esm-es5/{updateCheckoutSessionAttributes-691cdc6d.js → updateCheckoutSessionAttributes-92f42882.js} +1 -1
- package/dist/esm-es5/zonos-address_11.entry.js +1 -1
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-banner_2.entry.js +1 -0
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -0
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -0
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -0
- package/dist/esm-es5/zonos-collect.entry.js +1 -0
- package/dist/esm-es5/zonos-component.entry.js +1 -1
- package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +1 -0
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-link.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/zonos-toggle.entry.js +1 -1
- package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/scripts/index.d.ts +471 -4
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.d.ts +4 -0
- package/dist/types/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.d.ts +49 -0
- package/dist/types/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.d.ts +25 -0
- package/dist/types/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.d.ts +29 -0
- package/dist/types/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.d.ts +62 -0
- package/dist/types/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.d.ts +22 -0
- package/dist/types/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.d.ts +10 -0
- package/dist/types/components/checkout/zonos-collect/zonos-collect.d.ts +86 -0
- package/dist/types/components/common/zonos-h-stack/zonos-h-stack.d.ts +9 -0
- package/dist/types/components/common/zonos-skeleton/zonos-skeleton.d.ts +17 -0
- package/dist/types/components/main/zonos-controller.d.ts +5 -0
- package/dist/types/components/paypal/zonos-paypal-payment.d.ts +3 -0
- package/dist/types/components/store/checkout/cart.d.ts +23 -3
- package/dist/types/components/store/checkout/collect.d.ts +21 -0
- package/dist/types/components/store/checkout/paypal.d.ts +4 -3
- package/dist/types/components/store/checkout/stripe.d.ts +6 -2
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +48 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +48 -0
- package/dist/types/components/store/translationStore.d.ts +2 -1
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +1 -2
- package/dist/types/components/stripe/zonos-link-authentication/zonos-link-authentication.d.ts +2 -0
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components/utils/checkout/initCollect.d.ts +1 -0
- package/dist/types/components/utils/checkout/isCollectMobileTablet.d.ts +4 -0
- package/dist/types/components/utils/getNextFallbackApi.d.ts +2 -2
- package/dist/types/components/utils/renderFallback.d.ts +6 -0
- package/dist/types/components.d.ts +401 -2
- package/dist/types/scripts/_zonosBase.d.ts +5 -0
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +5 -0
- package/dist/types/types/checkout/api/CheckoutSession.d.ts +9 -1
- package/dist/types/types/checkout/api/CreateParty.d.ts +24 -0
- package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +6 -1
- package/dist/types/types/checkout/api/PartyInfo.d.ts +24 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
- package/dist/types/types/generated/graphql.internal.types.d.ts +431 -9
- package/dist/types/types/generated/graphql.internal.types.ts +428 -10
- package/dist/types/types/index.d.ts +1 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-288761b1.system.entry.js → p-009c3ac5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c7d5d45d.entry.js → p-03980f76.entry.js} +1 -1
- package/dist/zonos-elements/{p-c1d86f32.system.js → p-062430f9.system.js} +1 -1
- package/dist/zonos-elements/p-07bea979.system.js +1 -0
- package/dist/zonos-elements/p-0cec2dd2.system.entry.js +1 -0
- package/dist/zonos-elements/p-0d6c6a38.entry.js +1 -0
- package/dist/zonos-elements/p-0e28207a.js +1 -0
- package/dist/zonos-elements/{p-1efc348b.system.js → p-0ed63ce0.system.js} +1 -1
- package/dist/zonos-elements/p-0ef2a242.js +1 -0
- package/dist/zonos-elements/p-106ae0f1.entry.js +1 -0
- package/dist/zonos-elements/p-10797d2b.system.entry.js +1 -0
- package/dist/zonos-elements/p-195b33b6.system.entry.js +1 -0
- package/dist/zonos-elements/p-1fe5d4da.system.entry.js +1 -0
- package/dist/zonos-elements/{p-da4c01da.system.entry.js → p-2323ff0f.system.entry.js} +1 -1
- package/dist/zonos-elements/p-23293a0b.entry.js +1 -0
- package/dist/zonos-elements/{p-62813488.entry.js → p-23735db6.entry.js} +1 -1
- package/dist/zonos-elements/{p-ebaaaee9.entry.js → p-26573347.entry.js} +1 -1
- package/dist/zonos-elements/{p-e640e8b8.entry.js → p-29499a5f.entry.js} +1 -1
- package/dist/zonos-elements/p-29c80a34.js +1 -0
- package/dist/zonos-elements/{p-edc77ea1.entry.js → p-2a9681b4.entry.js} +1 -1
- package/dist/zonos-elements/{p-3f31901f.entry.js → p-2c9381be.entry.js} +1 -1
- package/dist/zonos-elements/p-2cc031b3.js +17 -0
- package/dist/zonos-elements/{p-7ab62a26.system.entry.js → p-34a37ce7.system.entry.js} +1 -1
- package/dist/zonos-elements/p-3c9714a8.system.entry.js +1 -0
- package/dist/zonos-elements/p-485416ec.js +1 -0
- package/dist/zonos-elements/p-56ee6d4b.system.entry.js +1 -0
- package/dist/zonos-elements/p-58afbe2b.entry.js +1 -0
- package/dist/zonos-elements/p-5e372fb9.entry.js +1 -0
- package/dist/zonos-elements/p-5ff4f9df.system.js +1 -0
- package/dist/zonos-elements/{p-92cc26b7.system.entry.js → p-60c61982.system.entry.js} +1 -1
- package/dist/zonos-elements/p-61c2c336.entry.js +1 -0
- package/dist/zonos-elements/p-6696617a.system.entry.js +1 -0
- package/dist/zonos-elements/p-6761091e.entry.js +1 -0
- package/dist/zonos-elements/p-6761286d.js +1 -0
- package/dist/zonos-elements/p-69451a50.system.js +1 -0
- package/dist/zonos-elements/p-69fd1b88.js +1 -0
- package/dist/zonos-elements/p-6dd63754.system.js +1 -0
- package/dist/zonos-elements/p-6e8aae27.system.entry.js +1 -0
- package/dist/zonos-elements/{p-1c45cd15.entry.js → p-70b81bbc.entry.js} +1 -1
- package/dist/zonos-elements/{p-eeb01de6.system.entry.js → p-750b7f32.system.entry.js} +1 -1
- package/dist/zonos-elements/p-772ac0b7.js +1 -0
- package/dist/zonos-elements/p-81b357f7.system.js +1 -1
- package/dist/zonos-elements/p-81e23f30.system.js +1 -0
- package/dist/zonos-elements/p-873b698a.entry.js +1 -0
- package/dist/zonos-elements/p-87e2a777.entry.js +1 -0
- package/dist/zonos-elements/p-8ca25e6c.entry.js +1 -0
- package/dist/zonos-elements/p-909d36bf.entry.js +1 -0
- package/dist/zonos-elements/p-95461a1b.system.entry.js +1 -0
- package/dist/zonos-elements/p-986ebccc.js +1 -0
- package/dist/zonos-elements/p-9c0b78bf.system.entry.js +1 -0
- package/dist/zonos-elements/p-a61a9b65.system.entry.js +1 -0
- package/dist/zonos-elements/p-a7204d41.entry.js +1 -0
- package/dist/zonos-elements/{p-d93ecc57.js → p-a8a312b2.js} +1 -1
- package/dist/zonos-elements/p-aca272ea.entry.js +1 -0
- package/dist/zonos-elements/p-b12ec9f2.system.entry.js +1 -0
- package/dist/zonos-elements/p-b1bd9fe7.system.entry.js +1 -0
- package/dist/zonos-elements/p-b2ae8eb7.system.js +1 -0
- package/dist/zonos-elements/{p-77666360.entry.js → p-b5406d26.entry.js} +1 -1
- package/dist/zonos-elements/p-bfbc081f.entry.js +1 -0
- package/dist/zonos-elements/p-c0a54cf6.system.js +1 -0
- package/dist/zonos-elements/p-c3c9b089.entry.js +1 -0
- package/dist/zonos-elements/p-c8784a01.system.entry.js +1 -0
- package/dist/zonos-elements/{p-7b5de646.entry.js → p-d045e2e5.entry.js} +1 -1
- package/dist/zonos-elements/p-d26cffba.entry.js +1 -0
- package/dist/zonos-elements/{p-544c173a.system.entry.js → p-d351ece6.system.entry.js} +1 -1
- package/dist/zonos-elements/p-d63696ac.system.js +17 -0
- package/dist/zonos-elements/p-ddb29c2a.system.entry.js +1 -0
- package/dist/zonos-elements/{p-d6fa2dc2.entry.js → p-dfb92907.entry.js} +1 -1
- package/dist/zonos-elements/{p-714c28b1.system.entry.js → p-e2a45188.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1ac8bfbb.system.entry.js → p-e455f060.system.entry.js} +1 -1
- package/dist/zonos-elements/p-eb54ece4.system.entry.js +1 -0
- package/dist/zonos-elements/{p-a98b1e8d.entry.js → p-efa6203f.entry.js} +1 -1
- package/dist/zonos-elements/{p-59eaebe3.system.entry.js → p-f0be0ca9.system.entry.js} +1 -1
- package/dist/zonos-elements/p-f129a83b.system.entry.js +1 -0
- package/dist/zonos-elements/p-f17fde5f.system.js +1 -0
- package/dist/zonos-elements/{p-47ffacd8.system.entry.js → p-f74a6b78.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/zonos-card.cjs.entry.js +0 -49
- package/dist/esm/zonos-card.entry.js +0 -45
- package/dist/esm-es5/cart-010402f9.js +0 -1
- package/dist/esm-es5/localization-9db8b6e9.js +0 -1
- package/dist/esm-es5/paypal-70b140d9.js +0 -17
- package/dist/esm-es5/zonos-banner.entry.js +0 -1
- package/dist/esm-es5/zonos-card.entry.js +0 -1
- package/dist/esm-es5/zonos-cart-items_14.entry.js +0 -1
- package/dist/zonos-elements/p-043f57e8.system.entry.js +0 -1
- package/dist/zonos-elements/p-0a7ef032.entry.js +0 -1
- package/dist/zonos-elements/p-0e8bdf5c.js +0 -1
- package/dist/zonos-elements/p-164ba7ae.system.entry.js +0 -1
- package/dist/zonos-elements/p-242dd7ca.system.entry.js +0 -1
- package/dist/zonos-elements/p-300e0d47.system.entry.js +0 -1
- package/dist/zonos-elements/p-37aa481c.system.entry.js +0 -1
- package/dist/zonos-elements/p-3a1513ae.system.entry.js +0 -1
- package/dist/zonos-elements/p-425096c9.js +0 -1
- package/dist/zonos-elements/p-4cd33d08.entry.js +0 -1
- package/dist/zonos-elements/p-57f391e6.system.entry.js +0 -1
- package/dist/zonos-elements/p-58b3a0fc.entry.js +0 -1
- package/dist/zonos-elements/p-605a21ac.entry.js +0 -1
- package/dist/zonos-elements/p-608f965f.system.js +0 -1
- package/dist/zonos-elements/p-65c68531.js +0 -1
- package/dist/zonos-elements/p-680149ed.entry.js +0 -1
- package/dist/zonos-elements/p-6d44f441.system.js +0 -1
- package/dist/zonos-elements/p-7c88d2ac.entry.js +0 -1
- package/dist/zonos-elements/p-9ddb4533.system.entry.js +0 -1
- package/dist/zonos-elements/p-a91024b6.system.entry.js +0 -1
- package/dist/zonos-elements/p-a9d41e7c.system.entry.js +0 -1
- package/dist/zonos-elements/p-ad556be6.entry.js +0 -1
- package/dist/zonos-elements/p-ad8b1fe8.entry.js +0 -1
- package/dist/zonos-elements/p-afa4b4f0.js +0 -17
- package/dist/zonos-elements/p-b83b382e.system.js +0 -1
- package/dist/zonos-elements/p-b9ff6458.entry.js +0 -1
- package/dist/zonos-elements/p-d55aec11.system.entry.js +0 -1
- package/dist/zonos-elements/p-dcedcdda.entry.js +0 -1
- package/dist/zonos-elements/p-e11c61a5.entry.js +0 -1
- package/dist/zonos-elements/p-e17ac0d1.system.js +0 -17
- package/dist/zonos-elements/p-e1a7a85f.system.entry.js +0 -1
- package/dist/zonos-elements/p-ef1ce617.system.entry.js +0 -1
- package/dist/zonos-elements/p-ef34e1ce.entry.js +0 -1
- package/dist/zonos-elements/p-f54123b5.entry.js +0 -1
- package/dist/zonos-elements/p-f7300f5b.system.entry.js +0 -1
|
@@ -3,1057 +3,26 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const
|
|
6
|
+
const cart = require('./cart-9a2b32e4.js');
|
|
7
|
+
const translationStore = require('./translationStore-20a6d8bf.js');
|
|
8
|
+
const placeTestOrder = require('./placeTestOrder-8222fe95.js');
|
|
9
|
+
const cleanHtmlMarkdown = require('./cleanHtmlMarkdown-577d0a77.js');
|
|
8
10
|
const classes = require('./classes-b7918f56.js');
|
|
9
11
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
10
|
-
const paypal = require('./paypal-
|
|
11
|
-
const
|
|
12
|
+
const paypal = require('./paypal-e80871d0.js');
|
|
13
|
+
const localization = require('./localization-b12edb2a.js');
|
|
14
|
+
const handleFetch = require('./handleFetch-45f35cac.js');
|
|
12
15
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
13
16
|
const getBorderRadius = require('./getBorderRadius-1b5e33cf.js');
|
|
14
17
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
15
18
|
const isDarkColor = require('./isDarkColor-428965f4.js');
|
|
16
19
|
const isColorVariable = require('./isColorVariable-525dbfa7.js');
|
|
17
|
-
const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-
|
|
20
|
+
const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-c0853fdd.js');
|
|
18
21
|
const shouldRenderTaxIdInput = require('./shouldRenderTaxIdInput-9b8a8de1.js');
|
|
19
22
|
const TaxId = require('./TaxId-12acedde.js');
|
|
20
23
|
require('./VarianceTest-0cb1e118.js');
|
|
21
24
|
require('./debounce-465a4328.js');
|
|
22
25
|
|
|
23
|
-
const getDisplayCurrency = () => {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
const shouldDisplayBaseCurrency = cart.cartStore.displayBaseCurrency;
|
|
26
|
-
const displayCurrency = shouldDisplayBaseCurrency && ((_a = cart.cartStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.sourceCurrencyCode)
|
|
27
|
-
? (_b = cart.cartStore.exchangeRate) === null || _b === void 0 ? void 0 : _b.sourceCurrencyCode
|
|
28
|
-
: cart.cartStore.currency;
|
|
29
|
-
return displayCurrency;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Unified currency rendering for checkout amounts.
|
|
34
|
-
* @note This is only to display, not for calculations.
|
|
35
|
-
*/
|
|
36
|
-
const renderCheckoutCurrency = ({ amount, isForeign }) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const targetRate = ((_a = cart.cartStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.rate) || 1;
|
|
39
|
-
const shouldDisplayBaseCurrency = cart.cartStore.displayBaseCurrency;
|
|
40
|
-
const displayCurrency = getDisplayCurrency();
|
|
41
|
-
if (isForeign) {
|
|
42
|
-
// Amount is in foreign currency, divide by the rate to convert it to the base currency if displaying in base currency
|
|
43
|
-
const displayAmount = shouldDisplayBaseCurrency
|
|
44
|
-
? amount / targetRate
|
|
45
|
-
: amount;
|
|
46
|
-
return localization.currencyFormat({
|
|
47
|
-
amount: displayAmount,
|
|
48
|
-
currency: displayCurrency,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
// Amount is already in base currency, need to multiply rate to convert to foreign currency if display in foreign currency
|
|
52
|
-
const displayAmount = shouldDisplayBaseCurrency
|
|
53
|
-
? amount
|
|
54
|
-
: amount * targetRate;
|
|
55
|
-
return localization.currencyFormat({
|
|
56
|
-
amount: displayAmount,
|
|
57
|
-
currency: displayCurrency,
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
function extend (destination) {
|
|
62
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
63
|
-
var source = arguments[i];
|
|
64
|
-
for (var key in source) {
|
|
65
|
-
if (source.hasOwnProperty(key)) destination[key] = source[key];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return destination
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function repeat (character, count) {
|
|
72
|
-
return Array(count + 1).join(character)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function trimLeadingNewlines (string) {
|
|
76
|
-
return string.replace(/^\n*/, '')
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function trimTrailingNewlines (string) {
|
|
80
|
-
// avoid match-at-end regexp bottleneck, see #370
|
|
81
|
-
var indexEnd = string.length;
|
|
82
|
-
while (indexEnd > 0 && string[indexEnd - 1] === '\n') indexEnd--;
|
|
83
|
-
return string.substring(0, indexEnd)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
var blockElements = [
|
|
87
|
-
'ADDRESS', 'ARTICLE', 'ASIDE', 'AUDIO', 'BLOCKQUOTE', 'BODY', 'CANVAS',
|
|
88
|
-
'CENTER', 'DD', 'DIR', 'DIV', 'DL', 'DT', 'FIELDSET', 'FIGCAPTION', 'FIGURE',
|
|
89
|
-
'FOOTER', 'FORM', 'FRAMESET', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HEADER',
|
|
90
|
-
'HGROUP', 'HR', 'HTML', 'ISINDEX', 'LI', 'MAIN', 'MENU', 'NAV', 'NOFRAMES',
|
|
91
|
-
'NOSCRIPT', 'OL', 'OUTPUT', 'P', 'PRE', 'SECTION', 'TABLE', 'TBODY', 'TD',
|
|
92
|
-
'TFOOT', 'TH', 'THEAD', 'TR', 'UL'
|
|
93
|
-
];
|
|
94
|
-
|
|
95
|
-
function isBlock (node) {
|
|
96
|
-
return is(node, blockElements)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
var voidElements = [
|
|
100
|
-
'AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT',
|
|
101
|
-
'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'
|
|
102
|
-
];
|
|
103
|
-
|
|
104
|
-
function isVoid (node) {
|
|
105
|
-
return is(node, voidElements)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function hasVoid (node) {
|
|
109
|
-
return has(node, voidElements)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
var meaningfulWhenBlankElements = [
|
|
113
|
-
'A', 'TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TH', 'TD', 'IFRAME', 'SCRIPT',
|
|
114
|
-
'AUDIO', 'VIDEO'
|
|
115
|
-
];
|
|
116
|
-
|
|
117
|
-
function isMeaningfulWhenBlank (node) {
|
|
118
|
-
return is(node, meaningfulWhenBlankElements)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function hasMeaningfulWhenBlank (node) {
|
|
122
|
-
return has(node, meaningfulWhenBlankElements)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function is (node, tagNames) {
|
|
126
|
-
return tagNames.indexOf(node.nodeName) >= 0
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function has (node, tagNames) {
|
|
130
|
-
return (
|
|
131
|
-
node.getElementsByTagName &&
|
|
132
|
-
tagNames.some(function (tagName) {
|
|
133
|
-
return node.getElementsByTagName(tagName).length
|
|
134
|
-
})
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
var rules = {};
|
|
139
|
-
|
|
140
|
-
rules.paragraph = {
|
|
141
|
-
filter: 'p',
|
|
142
|
-
|
|
143
|
-
replacement: function (content) {
|
|
144
|
-
return '\n\n' + content + '\n\n'
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
rules.lineBreak = {
|
|
149
|
-
filter: 'br',
|
|
150
|
-
|
|
151
|
-
replacement: function (content, node, options) {
|
|
152
|
-
return options.br + '\n'
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
rules.heading = {
|
|
157
|
-
filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
|
|
158
|
-
|
|
159
|
-
replacement: function (content, node, options) {
|
|
160
|
-
var hLevel = Number(node.nodeName.charAt(1));
|
|
161
|
-
|
|
162
|
-
if (options.headingStyle === 'setext' && hLevel < 3) {
|
|
163
|
-
var underline = repeat((hLevel === 1 ? '=' : '-'), content.length);
|
|
164
|
-
return (
|
|
165
|
-
'\n\n' + content + '\n' + underline + '\n\n'
|
|
166
|
-
)
|
|
167
|
-
} else {
|
|
168
|
-
return '\n\n' + repeat('#', hLevel) + ' ' + content + '\n\n'
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
rules.blockquote = {
|
|
174
|
-
filter: 'blockquote',
|
|
175
|
-
|
|
176
|
-
replacement: function (content) {
|
|
177
|
-
content = content.replace(/^\n+|\n+$/g, '');
|
|
178
|
-
content = content.replace(/^/gm, '> ');
|
|
179
|
-
return '\n\n' + content + '\n\n'
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
rules.list = {
|
|
184
|
-
filter: ['ul', 'ol'],
|
|
185
|
-
|
|
186
|
-
replacement: function (content, node) {
|
|
187
|
-
var parent = node.parentNode;
|
|
188
|
-
if (parent.nodeName === 'LI' && parent.lastElementChild === node) {
|
|
189
|
-
return '\n' + content
|
|
190
|
-
} else {
|
|
191
|
-
return '\n\n' + content + '\n\n'
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
rules.listItem = {
|
|
197
|
-
filter: 'li',
|
|
198
|
-
|
|
199
|
-
replacement: function (content, node, options) {
|
|
200
|
-
content = content
|
|
201
|
-
.replace(/^\n+/, '') // remove leading newlines
|
|
202
|
-
.replace(/\n+$/, '\n') // replace trailing newlines with just a single one
|
|
203
|
-
.replace(/\n/gm, '\n '); // indent
|
|
204
|
-
var prefix = options.bulletListMarker + ' ';
|
|
205
|
-
var parent = node.parentNode;
|
|
206
|
-
if (parent.nodeName === 'OL') {
|
|
207
|
-
var start = parent.getAttribute('start');
|
|
208
|
-
var index = Array.prototype.indexOf.call(parent.children, node);
|
|
209
|
-
prefix = (start ? Number(start) + index : index + 1) + '. ';
|
|
210
|
-
}
|
|
211
|
-
return (
|
|
212
|
-
prefix + content + (node.nextSibling && !/\n$/.test(content) ? '\n' : '')
|
|
213
|
-
)
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
rules.indentedCodeBlock = {
|
|
218
|
-
filter: function (node, options) {
|
|
219
|
-
return (
|
|
220
|
-
options.codeBlockStyle === 'indented' &&
|
|
221
|
-
node.nodeName === 'PRE' &&
|
|
222
|
-
node.firstChild &&
|
|
223
|
-
node.firstChild.nodeName === 'CODE'
|
|
224
|
-
)
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
replacement: function (content, node, options) {
|
|
228
|
-
return (
|
|
229
|
-
'\n\n ' +
|
|
230
|
-
node.firstChild.textContent.replace(/\n/g, '\n ') +
|
|
231
|
-
'\n\n'
|
|
232
|
-
)
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
rules.fencedCodeBlock = {
|
|
237
|
-
filter: function (node, options) {
|
|
238
|
-
return (
|
|
239
|
-
options.codeBlockStyle === 'fenced' &&
|
|
240
|
-
node.nodeName === 'PRE' &&
|
|
241
|
-
node.firstChild &&
|
|
242
|
-
node.firstChild.nodeName === 'CODE'
|
|
243
|
-
)
|
|
244
|
-
},
|
|
245
|
-
|
|
246
|
-
replacement: function (content, node, options) {
|
|
247
|
-
var className = node.firstChild.getAttribute('class') || '';
|
|
248
|
-
var language = (className.match(/language-(\S+)/) || [null, ''])[1];
|
|
249
|
-
var code = node.firstChild.textContent;
|
|
250
|
-
|
|
251
|
-
var fenceChar = options.fence.charAt(0);
|
|
252
|
-
var fenceSize = 3;
|
|
253
|
-
var fenceInCodeRegex = new RegExp('^' + fenceChar + '{3,}', 'gm');
|
|
254
|
-
|
|
255
|
-
var match;
|
|
256
|
-
while ((match = fenceInCodeRegex.exec(code))) {
|
|
257
|
-
if (match[0].length >= fenceSize) {
|
|
258
|
-
fenceSize = match[0].length + 1;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
var fence = repeat(fenceChar, fenceSize);
|
|
263
|
-
|
|
264
|
-
return (
|
|
265
|
-
'\n\n' + fence + language + '\n' +
|
|
266
|
-
code.replace(/\n$/, '') +
|
|
267
|
-
'\n' + fence + '\n\n'
|
|
268
|
-
)
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
rules.horizontalRule = {
|
|
273
|
-
filter: 'hr',
|
|
274
|
-
|
|
275
|
-
replacement: function (content, node, options) {
|
|
276
|
-
return '\n\n' + options.hr + '\n\n'
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
rules.inlineLink = {
|
|
281
|
-
filter: function (node, options) {
|
|
282
|
-
return (
|
|
283
|
-
options.linkStyle === 'inlined' &&
|
|
284
|
-
node.nodeName === 'A' &&
|
|
285
|
-
node.getAttribute('href')
|
|
286
|
-
)
|
|
287
|
-
},
|
|
288
|
-
|
|
289
|
-
replacement: function (content, node) {
|
|
290
|
-
var href = node.getAttribute('href');
|
|
291
|
-
if (href) href = href.replace(/([()])/g, '\\$1');
|
|
292
|
-
var title = cleanAttribute(node.getAttribute('title'));
|
|
293
|
-
if (title) title = ' "' + title.replace(/"/g, '\\"') + '"';
|
|
294
|
-
return '[' + content + '](' + href + title + ')'
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
rules.referenceLink = {
|
|
299
|
-
filter: function (node, options) {
|
|
300
|
-
return (
|
|
301
|
-
options.linkStyle === 'referenced' &&
|
|
302
|
-
node.nodeName === 'A' &&
|
|
303
|
-
node.getAttribute('href')
|
|
304
|
-
)
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
replacement: function (content, node, options) {
|
|
308
|
-
var href = node.getAttribute('href');
|
|
309
|
-
var title = cleanAttribute(node.getAttribute('title'));
|
|
310
|
-
if (title) title = ' "' + title + '"';
|
|
311
|
-
var replacement;
|
|
312
|
-
var reference;
|
|
313
|
-
|
|
314
|
-
switch (options.linkReferenceStyle) {
|
|
315
|
-
case 'collapsed':
|
|
316
|
-
replacement = '[' + content + '][]';
|
|
317
|
-
reference = '[' + content + ']: ' + href + title;
|
|
318
|
-
break
|
|
319
|
-
case 'shortcut':
|
|
320
|
-
replacement = '[' + content + ']';
|
|
321
|
-
reference = '[' + content + ']: ' + href + title;
|
|
322
|
-
break
|
|
323
|
-
default:
|
|
324
|
-
var id = this.references.length + 1;
|
|
325
|
-
replacement = '[' + content + '][' + id + ']';
|
|
326
|
-
reference = '[' + id + ']: ' + href + title;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
this.references.push(reference);
|
|
330
|
-
return replacement
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
references: [],
|
|
334
|
-
|
|
335
|
-
append: function (options) {
|
|
336
|
-
var references = '';
|
|
337
|
-
if (this.references.length) {
|
|
338
|
-
references = '\n\n' + this.references.join('\n') + '\n\n';
|
|
339
|
-
this.references = []; // Reset references
|
|
340
|
-
}
|
|
341
|
-
return references
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
rules.emphasis = {
|
|
346
|
-
filter: ['em', 'i'],
|
|
347
|
-
|
|
348
|
-
replacement: function (content, node, options) {
|
|
349
|
-
if (!content.trim()) return ''
|
|
350
|
-
return options.emDelimiter + content + options.emDelimiter
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
rules.strong = {
|
|
355
|
-
filter: ['strong', 'b'],
|
|
356
|
-
|
|
357
|
-
replacement: function (content, node, options) {
|
|
358
|
-
if (!content.trim()) return ''
|
|
359
|
-
return options.strongDelimiter + content + options.strongDelimiter
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
rules.code = {
|
|
364
|
-
filter: function (node) {
|
|
365
|
-
var hasSiblings = node.previousSibling || node.nextSibling;
|
|
366
|
-
var isCodeBlock = node.parentNode.nodeName === 'PRE' && !hasSiblings;
|
|
367
|
-
|
|
368
|
-
return node.nodeName === 'CODE' && !isCodeBlock
|
|
369
|
-
},
|
|
370
|
-
|
|
371
|
-
replacement: function (content) {
|
|
372
|
-
if (!content) return ''
|
|
373
|
-
content = content.replace(/\r?\n|\r/g, ' ');
|
|
374
|
-
|
|
375
|
-
var extraSpace = /^`|^ .*?[^ ].* $|`$/.test(content) ? ' ' : '';
|
|
376
|
-
var delimiter = '`';
|
|
377
|
-
var matches = content.match(/`+/gm) || [];
|
|
378
|
-
while (matches.indexOf(delimiter) !== -1) delimiter = delimiter + '`';
|
|
379
|
-
|
|
380
|
-
return delimiter + extraSpace + content + extraSpace + delimiter
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
rules.image = {
|
|
385
|
-
filter: 'img',
|
|
386
|
-
|
|
387
|
-
replacement: function (content, node) {
|
|
388
|
-
var alt = cleanAttribute(node.getAttribute('alt'));
|
|
389
|
-
var src = node.getAttribute('src') || '';
|
|
390
|
-
var title = cleanAttribute(node.getAttribute('title'));
|
|
391
|
-
var titlePart = title ? ' "' + title + '"' : '';
|
|
392
|
-
return src ? '![' + alt + ']' + '(' + src + titlePart + ')' : ''
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
function cleanAttribute (attribute) {
|
|
397
|
-
return attribute ? attribute.replace(/(\n+\s*)+/g, '\n') : ''
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Manages a collection of rules used to convert HTML to Markdown
|
|
402
|
-
*/
|
|
403
|
-
|
|
404
|
-
function Rules (options) {
|
|
405
|
-
this.options = options;
|
|
406
|
-
this._keep = [];
|
|
407
|
-
this._remove = [];
|
|
408
|
-
|
|
409
|
-
this.blankRule = {
|
|
410
|
-
replacement: options.blankReplacement
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
this.keepReplacement = options.keepReplacement;
|
|
414
|
-
|
|
415
|
-
this.defaultRule = {
|
|
416
|
-
replacement: options.defaultReplacement
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
this.array = [];
|
|
420
|
-
for (var key in options.rules) this.array.push(options.rules[key]);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
Rules.prototype = {
|
|
424
|
-
add: function (key, rule) {
|
|
425
|
-
this.array.unshift(rule);
|
|
426
|
-
},
|
|
427
|
-
|
|
428
|
-
keep: function (filter) {
|
|
429
|
-
this._keep.unshift({
|
|
430
|
-
filter: filter,
|
|
431
|
-
replacement: this.keepReplacement
|
|
432
|
-
});
|
|
433
|
-
},
|
|
434
|
-
|
|
435
|
-
remove: function (filter) {
|
|
436
|
-
this._remove.unshift({
|
|
437
|
-
filter: filter,
|
|
438
|
-
replacement: function () {
|
|
439
|
-
return ''
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
},
|
|
443
|
-
|
|
444
|
-
forNode: function (node) {
|
|
445
|
-
if (node.isBlank) return this.blankRule
|
|
446
|
-
var rule;
|
|
447
|
-
|
|
448
|
-
if ((rule = findRule(this.array, node, this.options))) return rule
|
|
449
|
-
if ((rule = findRule(this._keep, node, this.options))) return rule
|
|
450
|
-
if ((rule = findRule(this._remove, node, this.options))) return rule
|
|
451
|
-
|
|
452
|
-
return this.defaultRule
|
|
453
|
-
},
|
|
454
|
-
|
|
455
|
-
forEach: function (fn) {
|
|
456
|
-
for (var i = 0; i < this.array.length; i++) fn(this.array[i], i);
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
function findRule (rules, node, options) {
|
|
461
|
-
for (var i = 0; i < rules.length; i++) {
|
|
462
|
-
var rule = rules[i];
|
|
463
|
-
if (filterValue(rule, node, options)) return rule
|
|
464
|
-
}
|
|
465
|
-
return void 0
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
function filterValue (rule, node, options) {
|
|
469
|
-
var filter = rule.filter;
|
|
470
|
-
if (typeof filter === 'string') {
|
|
471
|
-
if (filter === node.nodeName.toLowerCase()) return true
|
|
472
|
-
} else if (Array.isArray(filter)) {
|
|
473
|
-
if (filter.indexOf(node.nodeName.toLowerCase()) > -1) return true
|
|
474
|
-
} else if (typeof filter === 'function') {
|
|
475
|
-
if (filter.call(rule, node, options)) return true
|
|
476
|
-
} else {
|
|
477
|
-
throw new TypeError('`filter` needs to be a string, array, or function')
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* The collapseWhitespace function is adapted from collapse-whitespace
|
|
483
|
-
* by Luc Thevenard.
|
|
484
|
-
*
|
|
485
|
-
* The MIT License (MIT)
|
|
486
|
-
*
|
|
487
|
-
* Copyright (c) 2014 Luc Thevenard <lucthevenard@gmail.com>
|
|
488
|
-
*
|
|
489
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
490
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
491
|
-
* in the Software without restriction, including without limitation the rights
|
|
492
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
493
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
494
|
-
* furnished to do so, subject to the following conditions:
|
|
495
|
-
*
|
|
496
|
-
* The above copyright notice and this permission notice shall be included in
|
|
497
|
-
* all copies or substantial portions of the Software.
|
|
498
|
-
*
|
|
499
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
500
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
501
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
502
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
503
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
504
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
505
|
-
* THE SOFTWARE.
|
|
506
|
-
*/
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* collapseWhitespace(options) removes extraneous whitespace from an the given element.
|
|
510
|
-
*
|
|
511
|
-
* @param {Object} options
|
|
512
|
-
*/
|
|
513
|
-
function collapseWhitespace (options) {
|
|
514
|
-
var element = options.element;
|
|
515
|
-
var isBlock = options.isBlock;
|
|
516
|
-
var isVoid = options.isVoid;
|
|
517
|
-
var isPre = options.isPre || function (node) {
|
|
518
|
-
return node.nodeName === 'PRE'
|
|
519
|
-
};
|
|
520
|
-
|
|
521
|
-
if (!element.firstChild || isPre(element)) return
|
|
522
|
-
|
|
523
|
-
var prevText = null;
|
|
524
|
-
var keepLeadingWs = false;
|
|
525
|
-
|
|
526
|
-
var prev = null;
|
|
527
|
-
var node = next(prev, element, isPre);
|
|
528
|
-
|
|
529
|
-
while (node !== element) {
|
|
530
|
-
if (node.nodeType === 3 || node.nodeType === 4) { // Node.TEXT_NODE or Node.CDATA_SECTION_NODE
|
|
531
|
-
var text = node.data.replace(/[ \r\n\t]+/g, ' ');
|
|
532
|
-
|
|
533
|
-
if ((!prevText || / $/.test(prevText.data)) &&
|
|
534
|
-
!keepLeadingWs && text[0] === ' ') {
|
|
535
|
-
text = text.substr(1);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
// `text` might be empty at this point.
|
|
539
|
-
if (!text) {
|
|
540
|
-
node = remove(node);
|
|
541
|
-
continue
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
node.data = text;
|
|
545
|
-
|
|
546
|
-
prevText = node;
|
|
547
|
-
} else if (node.nodeType === 1) { // Node.ELEMENT_NODE
|
|
548
|
-
if (isBlock(node) || node.nodeName === 'BR') {
|
|
549
|
-
if (prevText) {
|
|
550
|
-
prevText.data = prevText.data.replace(/ $/, '');
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
prevText = null;
|
|
554
|
-
keepLeadingWs = false;
|
|
555
|
-
} else if (isVoid(node) || isPre(node)) {
|
|
556
|
-
// Avoid trimming space around non-block, non-BR void elements and inline PRE.
|
|
557
|
-
prevText = null;
|
|
558
|
-
keepLeadingWs = true;
|
|
559
|
-
} else if (prevText) {
|
|
560
|
-
// Drop protection if set previously.
|
|
561
|
-
keepLeadingWs = false;
|
|
562
|
-
}
|
|
563
|
-
} else {
|
|
564
|
-
node = remove(node);
|
|
565
|
-
continue
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
var nextNode = next(prev, node, isPre);
|
|
569
|
-
prev = node;
|
|
570
|
-
node = nextNode;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
if (prevText) {
|
|
574
|
-
prevText.data = prevText.data.replace(/ $/, '');
|
|
575
|
-
if (!prevText.data) {
|
|
576
|
-
remove(prevText);
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
/**
|
|
582
|
-
* remove(node) removes the given node from the DOM and returns the
|
|
583
|
-
* next node in the sequence.
|
|
584
|
-
*
|
|
585
|
-
* @param {Node} node
|
|
586
|
-
* @return {Node} node
|
|
587
|
-
*/
|
|
588
|
-
function remove (node) {
|
|
589
|
-
var next = node.nextSibling || node.parentNode;
|
|
590
|
-
|
|
591
|
-
node.parentNode.removeChild(node);
|
|
592
|
-
|
|
593
|
-
return next
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* next(prev, current, isPre) returns the next node in the sequence, given the
|
|
598
|
-
* current and previous nodes.
|
|
599
|
-
*
|
|
600
|
-
* @param {Node} prev
|
|
601
|
-
* @param {Node} current
|
|
602
|
-
* @param {Function} isPre
|
|
603
|
-
* @return {Node}
|
|
604
|
-
*/
|
|
605
|
-
function next (prev, current, isPre) {
|
|
606
|
-
if ((prev && prev.parentNode === current) || isPre(current)) {
|
|
607
|
-
return current.nextSibling || current.parentNode
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
return current.firstChild || current.nextSibling || current.parentNode
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
/*
|
|
614
|
-
* Set up window for Node.js
|
|
615
|
-
*/
|
|
616
|
-
|
|
617
|
-
var root = (typeof window !== 'undefined' ? window : {});
|
|
618
|
-
|
|
619
|
-
/*
|
|
620
|
-
* Parsing HTML strings
|
|
621
|
-
*/
|
|
622
|
-
|
|
623
|
-
function canParseHTMLNatively () {
|
|
624
|
-
var Parser = root.DOMParser;
|
|
625
|
-
var canParse = false;
|
|
626
|
-
|
|
627
|
-
// Adapted from https://gist.github.com/1129031
|
|
628
|
-
// Firefox/Opera/IE throw errors on unsupported types
|
|
629
|
-
try {
|
|
630
|
-
// WebKit returns null on unsupported types
|
|
631
|
-
if (new Parser().parseFromString('', 'text/html')) {
|
|
632
|
-
canParse = true;
|
|
633
|
-
}
|
|
634
|
-
} catch (e) {}
|
|
635
|
-
|
|
636
|
-
return canParse
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
function createHTMLParser () {
|
|
640
|
-
var Parser = function () {};
|
|
641
|
-
|
|
642
|
-
{
|
|
643
|
-
if (shouldUseActiveX()) {
|
|
644
|
-
Parser.prototype.parseFromString = function (string) {
|
|
645
|
-
var doc = new window.ActiveXObject('htmlfile');
|
|
646
|
-
doc.designMode = 'on'; // disable on-page scripts
|
|
647
|
-
doc.open();
|
|
648
|
-
doc.write(string);
|
|
649
|
-
doc.close();
|
|
650
|
-
return doc
|
|
651
|
-
};
|
|
652
|
-
} else {
|
|
653
|
-
Parser.prototype.parseFromString = function (string) {
|
|
654
|
-
var doc = document.implementation.createHTMLDocument('');
|
|
655
|
-
doc.open();
|
|
656
|
-
doc.write(string);
|
|
657
|
-
doc.close();
|
|
658
|
-
return doc
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
return Parser
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
function shouldUseActiveX () {
|
|
666
|
-
var useActiveX = false;
|
|
667
|
-
try {
|
|
668
|
-
document.implementation.createHTMLDocument('').open();
|
|
669
|
-
} catch (e) {
|
|
670
|
-
if (root.ActiveXObject) useActiveX = true;
|
|
671
|
-
}
|
|
672
|
-
return useActiveX
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
var HTMLParser = canParseHTMLNatively() ? root.DOMParser : createHTMLParser();
|
|
676
|
-
|
|
677
|
-
function RootNode (input, options) {
|
|
678
|
-
var root;
|
|
679
|
-
if (typeof input === 'string') {
|
|
680
|
-
var doc = htmlParser().parseFromString(
|
|
681
|
-
// DOM parsers arrange elements in the <head> and <body>.
|
|
682
|
-
// Wrapping in a custom element ensures elements are reliably arranged in
|
|
683
|
-
// a single element.
|
|
684
|
-
'<x-turndown id="turndown-root">' + input + '</x-turndown>',
|
|
685
|
-
'text/html'
|
|
686
|
-
);
|
|
687
|
-
root = doc.getElementById('turndown-root');
|
|
688
|
-
} else {
|
|
689
|
-
root = input.cloneNode(true);
|
|
690
|
-
}
|
|
691
|
-
collapseWhitespace({
|
|
692
|
-
element: root,
|
|
693
|
-
isBlock: isBlock,
|
|
694
|
-
isVoid: isVoid,
|
|
695
|
-
isPre: options.preformattedCode ? isPreOrCode : null
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
return root
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
var _htmlParser;
|
|
702
|
-
function htmlParser () {
|
|
703
|
-
_htmlParser = _htmlParser || new HTMLParser();
|
|
704
|
-
return _htmlParser
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
function isPreOrCode (node) {
|
|
708
|
-
return node.nodeName === 'PRE' || node.nodeName === 'CODE'
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
function Node (node, options) {
|
|
712
|
-
node.isBlock = isBlock(node);
|
|
713
|
-
node.isCode = node.nodeName === 'CODE' || node.parentNode.isCode;
|
|
714
|
-
node.isBlank = isBlank(node);
|
|
715
|
-
node.flankingWhitespace = flankingWhitespace(node, options);
|
|
716
|
-
return node
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
function isBlank (node) {
|
|
720
|
-
return (
|
|
721
|
-
!isVoid(node) &&
|
|
722
|
-
!isMeaningfulWhenBlank(node) &&
|
|
723
|
-
/^\s*$/i.test(node.textContent) &&
|
|
724
|
-
!hasVoid(node) &&
|
|
725
|
-
!hasMeaningfulWhenBlank(node)
|
|
726
|
-
)
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
function flankingWhitespace (node, options) {
|
|
730
|
-
if (node.isBlock || (options.preformattedCode && node.isCode)) {
|
|
731
|
-
return { leading: '', trailing: '' }
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
var edges = edgeWhitespace(node.textContent);
|
|
735
|
-
|
|
736
|
-
// abandon leading ASCII WS if left-flanked by ASCII WS
|
|
737
|
-
if (edges.leadingAscii && isFlankedByWhitespace('left', node, options)) {
|
|
738
|
-
edges.leading = edges.leadingNonAscii;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
// abandon trailing ASCII WS if right-flanked by ASCII WS
|
|
742
|
-
if (edges.trailingAscii && isFlankedByWhitespace('right', node, options)) {
|
|
743
|
-
edges.trailing = edges.trailingNonAscii;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
return { leading: edges.leading, trailing: edges.trailing }
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
function edgeWhitespace (string) {
|
|
750
|
-
var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
|
|
751
|
-
return {
|
|
752
|
-
leading: m[1], // whole string for whitespace-only strings
|
|
753
|
-
leadingAscii: m[2],
|
|
754
|
-
leadingNonAscii: m[3],
|
|
755
|
-
trailing: m[4], // empty for whitespace-only strings
|
|
756
|
-
trailingNonAscii: m[5],
|
|
757
|
-
trailingAscii: m[6]
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
function isFlankedByWhitespace (side, node, options) {
|
|
762
|
-
var sibling;
|
|
763
|
-
var regExp;
|
|
764
|
-
var isFlanked;
|
|
765
|
-
|
|
766
|
-
if (side === 'left') {
|
|
767
|
-
sibling = node.previousSibling;
|
|
768
|
-
regExp = / $/;
|
|
769
|
-
} else {
|
|
770
|
-
sibling = node.nextSibling;
|
|
771
|
-
regExp = /^ /;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
if (sibling) {
|
|
775
|
-
if (sibling.nodeType === 3) {
|
|
776
|
-
isFlanked = regExp.test(sibling.nodeValue);
|
|
777
|
-
} else if (options.preformattedCode && sibling.nodeName === 'CODE') {
|
|
778
|
-
isFlanked = false;
|
|
779
|
-
} else if (sibling.nodeType === 1 && !isBlock(sibling)) {
|
|
780
|
-
isFlanked = regExp.test(sibling.textContent);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
return isFlanked
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
var reduce = Array.prototype.reduce;
|
|
787
|
-
var escapes = [
|
|
788
|
-
[/\\/g, '\\\\'],
|
|
789
|
-
[/\*/g, '\\*'],
|
|
790
|
-
[/^-/g, '\\-'],
|
|
791
|
-
[/^\+ /g, '\\+ '],
|
|
792
|
-
[/^(=+)/g, '\\$1'],
|
|
793
|
-
[/^(#{1,6}) /g, '\\$1 '],
|
|
794
|
-
[/`/g, '\\`'],
|
|
795
|
-
[/^~~~/g, '\\~~~'],
|
|
796
|
-
[/\[/g, '\\['],
|
|
797
|
-
[/\]/g, '\\]'],
|
|
798
|
-
[/^>/g, '\\>'],
|
|
799
|
-
[/_/g, '\\_'],
|
|
800
|
-
[/^(\d+)\. /g, '$1\\. ']
|
|
801
|
-
];
|
|
802
|
-
|
|
803
|
-
function TurndownService (options) {
|
|
804
|
-
if (!(this instanceof TurndownService)) return new TurndownService(options)
|
|
805
|
-
|
|
806
|
-
var defaults = {
|
|
807
|
-
rules: rules,
|
|
808
|
-
headingStyle: 'setext',
|
|
809
|
-
hr: '* * *',
|
|
810
|
-
bulletListMarker: '*',
|
|
811
|
-
codeBlockStyle: 'indented',
|
|
812
|
-
fence: '```',
|
|
813
|
-
emDelimiter: '_',
|
|
814
|
-
strongDelimiter: '**',
|
|
815
|
-
linkStyle: 'inlined',
|
|
816
|
-
linkReferenceStyle: 'full',
|
|
817
|
-
br: ' ',
|
|
818
|
-
preformattedCode: false,
|
|
819
|
-
blankReplacement: function (content, node) {
|
|
820
|
-
return node.isBlock ? '\n\n' : ''
|
|
821
|
-
},
|
|
822
|
-
keepReplacement: function (content, node) {
|
|
823
|
-
return node.isBlock ? '\n\n' + node.outerHTML + '\n\n' : node.outerHTML
|
|
824
|
-
},
|
|
825
|
-
defaultReplacement: function (content, node) {
|
|
826
|
-
return node.isBlock ? '\n\n' + content + '\n\n' : content
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
this.options = extend({}, defaults, options);
|
|
830
|
-
this.rules = new Rules(this.options);
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
TurndownService.prototype = {
|
|
834
|
-
/**
|
|
835
|
-
* The entry point for converting a string or DOM node to Markdown
|
|
836
|
-
* @public
|
|
837
|
-
* @param {String|HTMLElement} input The string or DOM node to convert
|
|
838
|
-
* @returns A Markdown representation of the input
|
|
839
|
-
* @type String
|
|
840
|
-
*/
|
|
841
|
-
|
|
842
|
-
turndown: function (input) {
|
|
843
|
-
if (!canConvert(input)) {
|
|
844
|
-
throw new TypeError(
|
|
845
|
-
input + ' is not a string, or an element/document/fragment node.'
|
|
846
|
-
)
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
if (input === '') return ''
|
|
850
|
-
|
|
851
|
-
var output = process.call(this, new RootNode(input, this.options));
|
|
852
|
-
return postProcess.call(this, output)
|
|
853
|
-
},
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
* Add one or more plugins
|
|
857
|
-
* @public
|
|
858
|
-
* @param {Function|Array} plugin The plugin or array of plugins to add
|
|
859
|
-
* @returns The Turndown instance for chaining
|
|
860
|
-
* @type Object
|
|
861
|
-
*/
|
|
862
|
-
|
|
863
|
-
use: function (plugin) {
|
|
864
|
-
if (Array.isArray(plugin)) {
|
|
865
|
-
for (var i = 0; i < plugin.length; i++) this.use(plugin[i]);
|
|
866
|
-
} else if (typeof plugin === 'function') {
|
|
867
|
-
plugin(this);
|
|
868
|
-
} else {
|
|
869
|
-
throw new TypeError('plugin must be a Function or an Array of Functions')
|
|
870
|
-
}
|
|
871
|
-
return this
|
|
872
|
-
},
|
|
873
|
-
|
|
874
|
-
/**
|
|
875
|
-
* Adds a rule
|
|
876
|
-
* @public
|
|
877
|
-
* @param {String} key The unique key of the rule
|
|
878
|
-
* @param {Object} rule The rule
|
|
879
|
-
* @returns The Turndown instance for chaining
|
|
880
|
-
* @type Object
|
|
881
|
-
*/
|
|
882
|
-
|
|
883
|
-
addRule: function (key, rule) {
|
|
884
|
-
this.rules.add(key, rule);
|
|
885
|
-
return this
|
|
886
|
-
},
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
* Keep a node (as HTML) that matches the filter
|
|
890
|
-
* @public
|
|
891
|
-
* @param {String|Array|Function} filter The unique key of the rule
|
|
892
|
-
* @returns The Turndown instance for chaining
|
|
893
|
-
* @type Object
|
|
894
|
-
*/
|
|
895
|
-
|
|
896
|
-
keep: function (filter) {
|
|
897
|
-
this.rules.keep(filter);
|
|
898
|
-
return this
|
|
899
|
-
},
|
|
900
|
-
|
|
901
|
-
/**
|
|
902
|
-
* Remove a node that matches the filter
|
|
903
|
-
* @public
|
|
904
|
-
* @param {String|Array|Function} filter The unique key of the rule
|
|
905
|
-
* @returns The Turndown instance for chaining
|
|
906
|
-
* @type Object
|
|
907
|
-
*/
|
|
908
|
-
|
|
909
|
-
remove: function (filter) {
|
|
910
|
-
this.rules.remove(filter);
|
|
911
|
-
return this
|
|
912
|
-
},
|
|
913
|
-
|
|
914
|
-
/**
|
|
915
|
-
* Escapes Markdown syntax
|
|
916
|
-
* @public
|
|
917
|
-
* @param {String} string The string to escape
|
|
918
|
-
* @returns A string with Markdown syntax escaped
|
|
919
|
-
* @type String
|
|
920
|
-
*/
|
|
921
|
-
|
|
922
|
-
escape: function (string) {
|
|
923
|
-
return escapes.reduce(function (accumulator, escape) {
|
|
924
|
-
return accumulator.replace(escape[0], escape[1])
|
|
925
|
-
}, string)
|
|
926
|
-
}
|
|
927
|
-
};
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* Reduces a DOM node down to its Markdown string equivalent
|
|
931
|
-
* @private
|
|
932
|
-
* @param {HTMLElement} parentNode The node to convert
|
|
933
|
-
* @returns A Markdown representation of the node
|
|
934
|
-
* @type String
|
|
935
|
-
*/
|
|
936
|
-
|
|
937
|
-
function process (parentNode) {
|
|
938
|
-
var self = this;
|
|
939
|
-
return reduce.call(parentNode.childNodes, function (output, node) {
|
|
940
|
-
node = new Node(node, self.options);
|
|
941
|
-
|
|
942
|
-
var replacement = '';
|
|
943
|
-
if (node.nodeType === 3) {
|
|
944
|
-
replacement = node.isCode ? node.nodeValue : self.escape(node.nodeValue);
|
|
945
|
-
} else if (node.nodeType === 1) {
|
|
946
|
-
replacement = replacementForNode.call(self, node);
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
return join(output, replacement)
|
|
950
|
-
}, '')
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
/**
|
|
954
|
-
* Appends strings as each rule requires and trims the output
|
|
955
|
-
* @private
|
|
956
|
-
* @param {String} output The conversion output
|
|
957
|
-
* @returns A trimmed version of the ouput
|
|
958
|
-
* @type String
|
|
959
|
-
*/
|
|
960
|
-
|
|
961
|
-
function postProcess (output) {
|
|
962
|
-
var self = this;
|
|
963
|
-
this.rules.forEach(function (rule) {
|
|
964
|
-
if (typeof rule.append === 'function') {
|
|
965
|
-
output = join(output, rule.append(self.options));
|
|
966
|
-
}
|
|
967
|
-
});
|
|
968
|
-
|
|
969
|
-
return output.replace(/^[\t\r\n]+/, '').replace(/[\t\r\n\s]+$/, '')
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
/**
|
|
973
|
-
* Converts an element node to its Markdown equivalent
|
|
974
|
-
* @private
|
|
975
|
-
* @param {HTMLElement} node The node to convert
|
|
976
|
-
* @returns A Markdown representation of the node
|
|
977
|
-
* @type String
|
|
978
|
-
*/
|
|
979
|
-
|
|
980
|
-
function replacementForNode (node) {
|
|
981
|
-
var rule = this.rules.forNode(node);
|
|
982
|
-
var content = process.call(this, node);
|
|
983
|
-
var whitespace = node.flankingWhitespace;
|
|
984
|
-
if (whitespace.leading || whitespace.trailing) content = content.trim();
|
|
985
|
-
return (
|
|
986
|
-
whitespace.leading +
|
|
987
|
-
rule.replacement(content, node, this.options) +
|
|
988
|
-
whitespace.trailing
|
|
989
|
-
)
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
/**
|
|
993
|
-
* Joins replacement to the current output with appropriate number of new lines
|
|
994
|
-
* @private
|
|
995
|
-
* @param {String} output The current conversion output
|
|
996
|
-
* @param {String} replacement The string to append to the output
|
|
997
|
-
* @returns Joined output
|
|
998
|
-
* @type String
|
|
999
|
-
*/
|
|
1000
|
-
|
|
1001
|
-
function join (output, replacement) {
|
|
1002
|
-
var s1 = trimTrailingNewlines(output);
|
|
1003
|
-
var s2 = trimLeadingNewlines(replacement);
|
|
1004
|
-
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
1005
|
-
var separator = '\n\n'.substring(0, nls);
|
|
1006
|
-
|
|
1007
|
-
return s1 + separator + s2
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
/**
|
|
1011
|
-
* Determines whether an input can be converted
|
|
1012
|
-
* @private
|
|
1013
|
-
* @param {String|HTMLElement} input Describe this parameter
|
|
1014
|
-
* @returns Describe what it returns
|
|
1015
|
-
* @type String|Object|Array|Boolean|Number
|
|
1016
|
-
*/
|
|
1017
|
-
|
|
1018
|
-
function canConvert (input) {
|
|
1019
|
-
return (
|
|
1020
|
-
input != null && (
|
|
1021
|
-
typeof input === 'string' ||
|
|
1022
|
-
(input.nodeType && (
|
|
1023
|
-
input.nodeType === 1 || input.nodeType === 9 || input.nodeType === 11
|
|
1024
|
-
))
|
|
1025
|
-
)
|
|
1026
|
-
)
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
const turndownService = new TurndownService();
|
|
1030
|
-
/**
|
|
1031
|
-
* Converts an HTML string to Markdown format, strips unnecessary Markdown tags,
|
|
1032
|
-
* and returns an array of cleaned Markdown text blocks..
|
|
1033
|
-
*
|
|
1034
|
-
* This utility function is useful for transforming HTML into Markdown and cleaning
|
|
1035
|
-
* it by removing extra or unwanted Markdown elements, resulting in an array of
|
|
1036
|
-
* plain Markdown text segments.
|
|
1037
|
-
*
|
|
1038
|
-
* @param {string} htmlString - The input HTML string to be converted and cleaned.
|
|
1039
|
-
*
|
|
1040
|
-
* @example
|
|
1041
|
-
* const htmlInput = "<h1>Hello World</h1><p>This is a paragraph.</p>";
|
|
1042
|
-
* const result = cleanHtmlMarkdown(htmlInput);
|
|
1043
|
-
* console.info(result); // Outputs cleaned HTML after conversion and processing
|
|
1044
|
-
*/
|
|
1045
|
-
const cleanHtmlMarkdown = (htmlString) => {
|
|
1046
|
-
const mdString = turndownService.turndown(htmlString);
|
|
1047
|
-
const sanitizedMdString =
|
|
1048
|
-
// remove header tags
|
|
1049
|
-
mdString.replace(/^\#+\s+/gm, '').trim();
|
|
1050
|
-
if (!sanitizedMdString) {
|
|
1051
|
-
return [];
|
|
1052
|
-
}
|
|
1053
|
-
const mdBlocks = sanitizedMdString.split(/[\n\r]+/gm);
|
|
1054
|
-
return mdBlocks;
|
|
1055
|
-
};
|
|
1056
|
-
|
|
1057
26
|
const zonosCartItemsCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--cart-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column{padding:8px;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column:last-child{text-align:right}:host .zonos--cart-table .zonos--column:first-child{width:60px}:host .zonos--cart-table td{vertical-align:top}:host .zonos--cart-item-name{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:12px}:host .zonos--cart-item-name .zonos--cart-item-quantity>*{display:inline-block}:host .zonos--cart-item-price zonos-text{white-space:nowrap}:host img{min-width:40px;margin-top:6px}";
|
|
1058
27
|
const ZonosCartItemsStyle0 = zonosCartItemsCss;
|
|
1059
28
|
|
|
@@ -1067,13 +36,13 @@ const ZonosCartItems = class {
|
|
|
1067
36
|
const nonRestrictedItems = cart.cartStore.items.filter(item => !item.isRestricted);
|
|
1068
37
|
return (index.h(index.Host, { key: '52911cfab4b2da9d65c840cd692e638c9dc732c5', class: "zonos--cart-items zonos--elements" }, index.h("table", { key: '428a62423a7fcf0721f420c9fdceac4bd928a6eb', class: "zonos--cart-table" }, index.h("tbody", { key: '41a438eeb79635ba00a241fa9771b9c33c7fe7ff' }, nonRestrictedItems.map(item => {
|
|
1069
38
|
const itemImg = item.imageUrl;
|
|
1070
|
-
const cleanedItemNames = cleanHtmlMarkdown(item.name);
|
|
39
|
+
const cleanedItemNames = cleanHtmlMarkdown.cleanHtmlMarkdown(item.name);
|
|
1071
40
|
const amount = item.amount * item.quantity;
|
|
1072
41
|
return (index.h("tr", { class: "zonos--cart-item" }, index.h("td", { class: "zonos--column zonos--cart-item-image" }, itemImg && !this.errorImages.includes(itemImg) ? (index.h("img", { alt: item.name, onError: () => {
|
|
1073
42
|
this.errorImages = [...this.errorImages, itemImg];
|
|
1074
43
|
}, src: item.imageUrl, style: {
|
|
1075
44
|
'min-width': '40px',
|
|
1076
|
-
}, width: 40 })) : (index.h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), index.h("td", { class: "zonos--column zonos--cart-item-name" }, index.h("div", null, cleanedItemNames.map(name => (index.h("zonos-text", { type: "label" }, name)))), index.h("zonos-text", { textColor: "gray-600", type: "caption" },
|
|
45
|
+
}, width: 40 })) : (index.h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), index.h("td", { class: "zonos--column zonos--cart-item-name" }, index.h("div", null, cleanedItemNames.map(name => (index.h("zonos-text", { type: "label" }, name)))), index.h("zonos-text", { textColor: "gray-600", type: "caption" }, translationStore.translate('Quantity'), ": ", item.quantity)), index.h("td", { class: "zonos--column zonos--cart-item-price" }, index.h("zonos-text", { type: "semiBoldLabel", weight: 600 }, placeTestOrder.renderCheckoutCurrency({
|
|
1077
46
|
amount,
|
|
1078
47
|
isForeign: false,
|
|
1079
48
|
})))));
|
|
@@ -1152,7 +121,7 @@ const ZonosCartRestrictedItems = class {
|
|
|
1152
121
|
this.internalCollapsed && 'collapsed',
|
|
1153
122
|
]), onClick: () => {
|
|
1154
123
|
this.internalCollapsed = !this.internalCollapsed;
|
|
1155
|
-
} }, index.h("div", { class: "zonos--title-wrapper" }, index.h("zonos-text", { textColor: "red-600", type: "label" }, `${
|
|
124
|
+
} }, index.h("div", { class: "zonos--title-wrapper" }, index.h("zonos-text", { textColor: "red-600", type: "label" }, `${translationStore.translate(this.internalCollapsed ? 'Show' : 'Hide')} ${restrictedItemTotal} ${translationStore.translate('restricted items')}`), index.h("zonos-icon", { content: ChevronUpIcon$2, iconColor: "red-600" }))), index.h("zonos-collapse", { collapsed: this.internalCollapsed }, index.h("zonos-banner", { bannerTitle: translationStore.translate('The following items are unable to be shipped to your country and are not included in your cart total.'), intent: "error" }), index.h("table", { class: "zonos--cart-table" }, index.h("tbody", null, cart.cartStore.restrictedItems.map((item, index$1) => {
|
|
1156
125
|
var _a, _b;
|
|
1157
126
|
const itemImg = item.imageUrl;
|
|
1158
127
|
return (index.h("tr", { class: "zonos--cart-item" }, index.h("td", { class: "zonos--column zonos--cart-item-image" }, itemImg && !this.errorImages.includes(itemImg) ? (index.h("img", { alt:
|
|
@@ -1163,7 +132,7 @@ const ZonosCartRestrictedItems = class {
|
|
|
1163
132
|
this.errorImages = [...this.errorImages, itemImg];
|
|
1164
133
|
}, src: itemImg, style: {
|
|
1165
134
|
'min-width': '40px',
|
|
1166
|
-
}, width: 40 })) : (index.h("img", { alt: item.name || `Restricted item ${index$1 + 1}`, src: emptyItemImg, width: 40 }))), index.h("td", { class: "zonos--column zonos--cart-item-name" }, index.h("zonos-text", { type: "label" }, ((_b = item.matchedItem) === null || _b === void 0 ? void 0 : _b.name) || item.name), index.h("zonos-text", { type: "caption" }, item.restriction.reason)), index.h("td", { class: "zonos--column zonos--cart-item-price" }, index.h("zonos-text", { type: "semiBoldLabel" }, renderCheckoutCurrency({
|
|
135
|
+
}, width: 40 })) : (index.h("img", { alt: item.name || `Restricted item ${index$1 + 1}`, src: emptyItemImg, width: 40 }))), index.h("td", { class: "zonos--column zonos--cart-item-name" }, index.h("zonos-text", { type: "label" }, ((_b = item.matchedItem) === null || _b === void 0 ? void 0 : _b.name) || item.name), index.h("zonos-text", { type: "caption" }, item.restriction.reason)), index.h("td", { class: "zonos--column zonos--cart-item-price" }, index.h("zonos-text", { type: "semiBoldLabel" }, placeTestOrder.renderCheckoutCurrency({
|
|
1167
136
|
amount: item.amount * item.quantity * rate,
|
|
1168
137
|
isForeign: false,
|
|
1169
138
|
})))));
|
|
@@ -1215,7 +184,7 @@ const ZonosCartSubtotal = class {
|
|
|
1215
184
|
};
|
|
1216
185
|
const renderShippingInfo = () => {
|
|
1217
186
|
if (!cart.cartStore.selectedShippingOption) {
|
|
1218
|
-
return (index.h(index.Fragment, null, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" },
|
|
187
|
+
return (index.h(index.Fragment, null, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translationStore.translate('Shipping')), index.h("zonos-text", { class: "zonos--caption", type: "caption" }, translationStore.translate('No shipping method selected'))));
|
|
1219
188
|
}
|
|
1220
189
|
return (index.h(index.Fragment, null, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cart.cartStore.selectedShippingOption.displayName), cart.cartStore.selectedShippingOptionTransitTime && (index.h("zonos-text", { class: "zonos--caption", type: "caption" }, cart.cartStore.selectedShippingOptionTransitTime))));
|
|
1221
190
|
};
|
|
@@ -1223,9 +192,9 @@ const ZonosCartSubtotal = class {
|
|
|
1223
192
|
var _a, _b, _c;
|
|
1224
193
|
// Domestic US doesn't have duty applied, just taxes and fees
|
|
1225
194
|
if ((_b = (_a = zonosStore.zonosStore.genericSettings) === null || _a === void 0 ? void 0 : _a.domesticCountries) === null || _b === void 0 ? void 0 : _b.includes(((_c = cart.stripeStore.stripeAddressEventData) === null || _c === void 0 ? void 0 : _c.value.address.country) || 'US')) {
|
|
1226
|
-
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" },
|
|
195
|
+
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translationStore.translate('Taxes and fees'))), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("div", { class: "zonos--cart-duty-tax-price" }, cart.cartStore.dutiesTaxesFees !== null ||
|
|
1227
196
|
cart.cartStore.dutiesTaxesFeesEstimate !== null
|
|
1228
|
-
? renderCheckoutCurrency({
|
|
197
|
+
? placeTestOrder.renderCheckoutCurrency({
|
|
1229
198
|
amount: cart.cartStore.dutiesTaxesFees ||
|
|
1230
199
|
cart.cartStore.dutiesTaxesFeesEstimate ||
|
|
1231
200
|
0,
|
|
@@ -1234,38 +203,38 @@ const ZonosCartSubtotal = class {
|
|
|
1234
203
|
: '-'))));
|
|
1235
204
|
}
|
|
1236
205
|
if (cart.cartStore.landedCostMethod === 'DAP') {
|
|
1237
|
-
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" },
|
|
1238
|
-
? `${
|
|
1239
|
-
amount: renderCheckoutCurrency({
|
|
206
|
+
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translationStore.translate('Duties, taxes, and fees')), cart.cartStore.dutiesTaxesFeesEstimate !== null
|
|
207
|
+
? `${translationStore.translate('Estimated [amount]', {
|
|
208
|
+
amount: placeTestOrder.renderCheckoutCurrency({
|
|
1240
209
|
amount: cart.cartStore.dutiesTaxesFeesEstimate,
|
|
1241
210
|
isForeign: true,
|
|
1242
211
|
}),
|
|
1243
212
|
})}`
|
|
1244
|
-
: '-'), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("div", { class: "zonos--cart-duty-tax-price" },
|
|
213
|
+
: '-'), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("div", { class: "zonos--cart-duty-tax-price" }, translationStore.translate('Due at delivery')))));
|
|
1245
214
|
}
|
|
1246
|
-
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" },
|
|
1247
|
-
? renderCheckoutCurrency({
|
|
215
|
+
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translationStore.translate('Duties, taxes, and fees')), index.h("zonos-text", { class: "zonos--caption", type: "caption" }, translationStore.translate('Nothing due at the door'))), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("div", { class: "zonos--cart-duty-tax-price" }, cart.cartStore.dutiesTaxesFees !== null
|
|
216
|
+
? placeTestOrder.renderCheckoutCurrency({
|
|
1248
217
|
amount: cart.cartStore.dutiesTaxesFees,
|
|
1249
218
|
isForeign: true,
|
|
1250
219
|
})
|
|
1251
220
|
: '-'))));
|
|
1252
221
|
};
|
|
1253
|
-
return (index.h(index.Host, { class: "zonos--cart-subtotal zonos--elements" }, index.h("table", { class: "zonos--cart-table" }, index.h("tr", { class: "zonos--row zonos--cart-subtotal" }, index.h("td", { class: "zonos--column" }), index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { type: "semiBoldLabel" },
|
|
222
|
+
return (index.h(index.Host, { class: "zonos--cart-subtotal zonos--elements" }, index.h("table", { class: "zonos--cart-table" }, index.h("tr", { class: "zonos--row zonos--cart-subtotal" }, index.h("td", { class: "zonos--column" }), index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { type: "semiBoldLabel" }, translationStore.translate('Cart subtotal'))), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("zonos-text", { type: "semiBoldLabel" }, placeTestOrder.renderCheckoutCurrency({
|
|
1254
223
|
amount: subtotal,
|
|
1255
224
|
isForeign: true,
|
|
1256
225
|
})))), index.h("tr", { class: "zonos--row zonos--cart-shipping" }, index.h("td", { class: "zonos--column" }), index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, renderShippingInfo()), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, cart.cartStore.shipping
|
|
1257
|
-
? renderCheckoutCurrency({
|
|
226
|
+
? placeTestOrder.renderCheckoutCurrency({
|
|
1258
227
|
amount: cart.cartStore.shipping,
|
|
1259
228
|
isForeign: true,
|
|
1260
229
|
})
|
|
1261
|
-
: '-')), showDutyTaxesInfo && (index.h("tr", { class: "zonos--row zonos--cart-duties" }, index.h("td", { class: "zonos--column" }), renderLandedCost())), shouldRenderPromoInput && (index.h("tr", { class: "zonos--row zonos--cart-promo-code" }, index.h("td", { class: "zonos--column" }), !!appliedPromoCode ? (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-promo-code-col" }, this.loading ? (index.h("zonos-spinner", { size: 16 })) : (index.h("zonos-badge", { dismissHandler: () => removePromoCode() }, cart.cartStore.promoCode))), index.h("td", { class: "zonos--column zonos--cart-promo-code-col" }))) : (index.h("td", { class: "zonos--column zonos--cart-promo-code-col", colSpan: 2 }, index.h("div", { class: "zonos--cart-promo-code-input-wrapper" }, index.h("zonos-input", { class: "zonos--cart-promo-code-input", inputLabel:
|
|
230
|
+
: '-')), showDutyTaxesInfo && (index.h("tr", { class: "zonos--row zonos--cart-duties" }, index.h("td", { class: "zonos--column" }), renderLandedCost())), shouldRenderPromoInput && (index.h("tr", { class: "zonos--row zonos--cart-promo-code" }, index.h("td", { class: "zonos--column" }), !!appliedPromoCode ? (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-promo-code-col" }, this.loading ? (index.h("zonos-spinner", { size: 16 })) : (index.h("zonos-badge", { dismissHandler: () => removePromoCode() }, cart.cartStore.promoCode))), index.h("td", { class: "zonos--column zonos--cart-promo-code-col" }))) : (index.h("td", { class: "zonos--column zonos--cart-promo-code-col", colSpan: 2 }, index.h("div", { class: "zonos--cart-promo-code-input-wrapper" }, index.h("zonos-input", { class: "zonos--cart-promo-code-input", inputLabel: translationStore.translate('Add promotional code'), inputValue: cart.cartStore.promoCode, isError: cart.cartStore.promoCodeError, onInputChange: e => (cart.cartStore.promoCode = e.detail.trim()), onKeyDown: e => {
|
|
1262
231
|
if (e.key === 'Enter') {
|
|
1263
232
|
void applyPromoCode();
|
|
1264
233
|
}
|
|
1265
|
-
} }), index.h("zonos-button", { loading: this.loading, onClick: () => applyPromoCode(), variant: "primary" },
|
|
234
|
+
} }), index.h("zonos-button", { loading: this.loading, onClick: () => applyPromoCode(), variant: "primary" }, translationStore.translate('Apply'))))))), !!cart.cartStore.adjustmentTotal && (index.h("tr", { class: "zonos--row zonos--cart-discount" }, index.h("td", { class: "zonos--column" }), index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("div", { class: "zonos--title-with-icon" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translationStore.translate('Discounts')))), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("zonos-text", { type: "semiBoldLabel" }, placeTestOrder.renderCheckoutCurrency({
|
|
1266
235
|
amount: cart.cartStore.adjustmentTotal,
|
|
1267
236
|
isForeign: true,
|
|
1268
|
-
}))))), index.h("tr", { class: "zonos--row zonos--cart-pay-total" }, index.h("td", { class: "zonos--column" }), index.h("td", { class: "zonos--column" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" },
|
|
237
|
+
}))))), index.h("tr", { class: "zonos--row zonos--cart-pay-total" }, index.h("td", { class: "zonos--column" }), index.h("td", { class: "zonos--column" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translationStore.translate('Order total'))), index.h("td", { class: "zonos--column zonos--cart-total-price" }, index.h("zonos-text", { type: "semiBoldLabel" }, placeTestOrder.renderCheckoutCurrency({
|
|
1269
238
|
amount: total,
|
|
1270
239
|
isForeign: true,
|
|
1271
240
|
})))))));
|
|
@@ -1297,7 +266,7 @@ const ZonosCheckoutFinish = class {
|
|
|
1297
266
|
this.notificationType = 'success';
|
|
1298
267
|
this.notificationTitle = '';
|
|
1299
268
|
this.notificationMessages = [];
|
|
1300
|
-
this.notificationActionText =
|
|
269
|
+
this.notificationActionText = translationStore.translate('Keep shopping');
|
|
1301
270
|
this.order = null;
|
|
1302
271
|
/**
|
|
1303
272
|
* Is waiting to redirect to a different page
|
|
@@ -1385,10 +354,10 @@ const ZonosCheckoutFinish = class {
|
|
|
1385
354
|
case successBehavior === 'REDIRECT_TO_SUCCESS_PAGE':
|
|
1386
355
|
case !!cart.cartStore.externalConfirmationPageURL: {
|
|
1387
356
|
// use different default notification message if we are redirecting to a different page
|
|
1388
|
-
this.notificationTitle =
|
|
357
|
+
this.notificationTitle = translationStore.translate('Order complete!');
|
|
1389
358
|
this.notificationMessages = [
|
|
1390
|
-
|
|
1391
|
-
|
|
359
|
+
translationStore.translate('Your order has been successfully placed.'),
|
|
360
|
+
translationStore.translate("You will be redirected back to the merchant's site in a few seconds."),
|
|
1392
361
|
];
|
|
1393
362
|
// stop loading spinner to show the redirecting notification
|
|
1394
363
|
this.isLoading = false;
|
|
@@ -1515,8 +484,8 @@ const ZonosCheckoutFinish = class {
|
|
|
1515
484
|
this.notificationType = isError ? 'error' : 'success';
|
|
1516
485
|
this.notificationMessages = messages || [];
|
|
1517
486
|
this.notificationTitle = isError
|
|
1518
|
-
?
|
|
1519
|
-
:
|
|
487
|
+
? translationStore.translate('Payment failed')
|
|
488
|
+
: translationStore.translate("You're all set!");
|
|
1520
489
|
handleFetch.log('=== Payment intent retrieve status', 'info', {
|
|
1521
490
|
clientSecret,
|
|
1522
491
|
error,
|
|
@@ -1571,7 +540,7 @@ const ZonosCheckoutFinish = class {
|
|
|
1571
540
|
};
|
|
1572
541
|
this.checkStagingOrderStatus = async () => {
|
|
1573
542
|
this.notificationType = 'success';
|
|
1574
|
-
this.notificationTitle =
|
|
543
|
+
this.notificationTitle = translationStore.translate("You're all set!");
|
|
1575
544
|
this.notificationMessages =
|
|
1576
545
|
cart.stripeStoreMessageBasedOnStatus('succeeded').messages;
|
|
1577
546
|
// override title if notification type is success
|
|
@@ -1587,7 +556,7 @@ const ZonosCheckoutFinish = class {
|
|
|
1587
556
|
// render error message if there's an error
|
|
1588
557
|
if (paypal.paypalStore.paypalErrorMessage) {
|
|
1589
558
|
this.notificationType = 'error';
|
|
1590
|
-
this.notificationTitle =
|
|
559
|
+
this.notificationTitle = translationStore.translate('Payment failed');
|
|
1591
560
|
this.notificationMessages = [paypal.paypalStore.paypalErrorMessage];
|
|
1592
561
|
this.isLoading = false;
|
|
1593
562
|
return;
|
|
@@ -1602,7 +571,7 @@ const ZonosCheckoutFinish = class {
|
|
|
1602
571
|
eventName: 'checkout_orderCompleted',
|
|
1603
572
|
});
|
|
1604
573
|
this.notificationType = 'success';
|
|
1605
|
-
this.notificationTitle =
|
|
574
|
+
this.notificationTitle = translationStore.translate("You're all set!");
|
|
1606
575
|
this.notificationMessages =
|
|
1607
576
|
cart.stripeStoreMessageBasedOnStatus('succeeded').messages;
|
|
1608
577
|
// override title if notification type is success
|
|
@@ -1672,7 +641,7 @@ const ZonosCheckoutFinish = class {
|
|
|
1672
641
|
return;
|
|
1673
642
|
}
|
|
1674
643
|
this.closeClickHandler();
|
|
1675
|
-
}, size: "md", variant: "primary" },
|
|
644
|
+
}, size: "md", variant: "primary" }, translationStore.translate('Close'))), !window.Zonos.isLegacyCheckout &&
|
|
1676
645
|
this.shouldRenderKeepShoppingButton() && (index.h("zonos-button", { key: '9b809e21052fddb2149a2a1d0c22db4b10808403', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
|
|
1677
646
|
cart.cartStore.step === 'finish' &&
|
|
1678
647
|
this.notificationType === 'success' && (index.h("div", { key: '4a278c7c4270d265c61b6b36d20864c55e1b42f1', class: "zonos--finish-button-wrapper" }, index.h("zonos-button", { key: 'fd8a876a0c5b76edd3be2d9b28da9c3963aee714', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), index.h("zonos-button", { key: '7882981c1fe01ab6f78d8f84bcfc9aab94bffb74', onClick: () => {
|
|
@@ -1747,44 +716,6 @@ const ZonosCheckoutFooter = class {
|
|
|
1747
716
|
};
|
|
1748
717
|
ZonosCheckoutFooter.style = ZonosCheckoutFooterStyle0;
|
|
1749
718
|
|
|
1750
|
-
const placeTestOrder = async () => {
|
|
1751
|
-
var _a, _b;
|
|
1752
|
-
const shipToPartyId = (_a = cart.cartStore.partiesData.find(party => party.type === 'DESTINATION')) === null || _a === void 0 ? void 0 : _a.id;
|
|
1753
|
-
const billToPartyId = (_b = cart.cartStore.partiesData.find(party => party.type === 'PAYOR')) === null || _b === void 0 ? void 0 : _b.id;
|
|
1754
|
-
const checkoutSessionId = localization.storageStore.checkoutSessionId;
|
|
1755
|
-
if (!checkoutSessionId || !billToPartyId || !shipToPartyId) {
|
|
1756
|
-
handleFetch.logError('Missing required data', {
|
|
1757
|
-
billToPartyId,
|
|
1758
|
-
checkoutSessionId,
|
|
1759
|
-
shipToPartyId,
|
|
1760
|
-
});
|
|
1761
|
-
return {
|
|
1762
|
-
errors: ['Missing required data'],
|
|
1763
|
-
json: null,
|
|
1764
|
-
};
|
|
1765
|
-
}
|
|
1766
|
-
const payload = {
|
|
1767
|
-
billToPartyId,
|
|
1768
|
-
checkoutSessionId,
|
|
1769
|
-
shipToPartyId,
|
|
1770
|
-
};
|
|
1771
|
-
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/place-test-order', {
|
|
1772
|
-
body: payload,
|
|
1773
|
-
method: 'POST',
|
|
1774
|
-
});
|
|
1775
|
-
if (errors.length || !json) {
|
|
1776
|
-
handleFetch.logError('Error occurs when placing test order', errors);
|
|
1777
|
-
return {
|
|
1778
|
-
errors: errors.map(error => error.message),
|
|
1779
|
-
json: null,
|
|
1780
|
-
};
|
|
1781
|
-
}
|
|
1782
|
-
return {
|
|
1783
|
-
errors: [],
|
|
1784
|
-
json,
|
|
1785
|
-
};
|
|
1786
|
-
};
|
|
1787
|
-
|
|
1788
719
|
const CheckmarkLineIcon = `<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M15.342 10.21a.75.75 0 0 0-1.184-.92l-2.978 3.829-1.4-1.4a.75.75 0 1 0-1.06 1.061l1.8 1.8a1 1 0 0 0 1.496-.093l3.326-4.277Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>`;
|
|
1789
720
|
|
|
1790
721
|
const RemoveLineIcon = `<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M14.475 10.586a.75.75 0 1 0-1.06-1.06L12 10.938l-1.414-1.414a.75.75 0 0 0-1.06 1.06L10.938 12l-1.414 1.414a.75.75 0 1 0 1.06 1.06L12 13.062l1.414 1.414a.75.75 0 0 0 1.06-1.06L13.062 12l1.414-1.414Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>`;
|
|
@@ -1871,14 +802,14 @@ const ZonosCheckoutPayment = class {
|
|
|
1871
802
|
document.body.removeChild(hiddenTextarea);
|
|
1872
803
|
}
|
|
1873
804
|
window.Zonos.showNotification({
|
|
1874
|
-
message:
|
|
805
|
+
message: translationStore.translate('Card number copied to clipboard'),
|
|
1875
806
|
timeout: 4000,
|
|
1876
807
|
type: 'success',
|
|
1877
808
|
});
|
|
1878
809
|
};
|
|
1879
810
|
this.placeTestOrder = async () => {
|
|
1880
811
|
this.internalContinueLoading = true;
|
|
1881
|
-
const { errors } = await placeTestOrder();
|
|
812
|
+
const { errors } = await placeTestOrder.placeTestOrder();
|
|
1882
813
|
if (errors.length) {
|
|
1883
814
|
this.stagingOrderCreateErrorMessage =
|
|
1884
815
|
errors[0] || 'Failed to create staging order. Please try again.';
|
|
@@ -1910,6 +841,9 @@ const ZonosCheckoutPayment = class {
|
|
|
1910
841
|
if (!cart.stripeStore.stripeElements) {
|
|
1911
842
|
return null;
|
|
1912
843
|
}
|
|
844
|
+
if (!cart.stripeStore.clientSecret && !cart.cartStore.isStagingMode) {
|
|
845
|
+
return null;
|
|
846
|
+
}
|
|
1913
847
|
// start validate on typing after error banner is shown, and hide it if the form is complete
|
|
1914
848
|
if (this.showErrorBanner) {
|
|
1915
849
|
this.showErrorBanner = !this.handleValidate();
|
|
@@ -1925,14 +859,14 @@ const ZonosCheckoutPayment = class {
|
|
|
1925
859
|
const theme = this.isMobile
|
|
1926
860
|
? zonosStore.zonosStore.appearance.theme
|
|
1927
861
|
: themeBasedColor;
|
|
1928
|
-
return (index.h(index.Fragment, null, this.stagingOrderCreateErrorMessage && (index.h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, this.stagingOrderCreateErrorMessage)), index.h("zonos-empty-state-payment", { emptyStateText:
|
|
862
|
+
return (index.h(index.Fragment, null, this.stagingOrderCreateErrorMessage && (index.h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, this.stagingOrderCreateErrorMessage)), index.h("zonos-empty-state-payment", { emptyStateText: translationStore.translate('No payment method needed for staging'), theme: theme }), index.h("div", { class: "zonos--group-btn" }, index.h("zonos-button", { backgroundColor: this.submitBtnColor, loading: this.internalContinueLoading, onClick: () => {
|
|
1929
863
|
void this.placeTestOrder();
|
|
1930
864
|
}, size: "lg",
|
|
1931
865
|
// use primary type when on mobile mode
|
|
1932
|
-
variant: this.submitBtnType },
|
|
866
|
+
variant: this.submitBtnType }, translationStore.translate('Place test order')))));
|
|
1933
867
|
}
|
|
1934
|
-
return (index.h(index.Fragment, null, this.showErrorBanner && (index.h("zonos-banner", { class: "zonos--error-banner", intent: "error" },
|
|
1935
|
-
|
|
868
|
+
return (index.h(index.Fragment, null, this.showErrorBanner && (index.h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translationStore.translate('Missing required fields. Make sure all fields are completed.'))), this.hasStripePaymentError && (index.h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, cart.stripeStore.customErrorMessage ||
|
|
869
|
+
translationStore.translate("We couldn't complete your payment. Please verify the payment details and try again."))), paypal.paypalStore.paypalErrorMessage && (index.h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, paypal.paypalStore.paypalErrorMessage)), index.h("zonos-payment", null), index.h("div", { class: "zonos--group-btn" }, !isPaypalTabSelected && (index.h(index.Fragment, null, index.h("zonos-button", { backgroundColor: this.submitBtnColor, bold: true, isDisabled: this.continueLoading &&
|
|
1936
870
|
cart.stripeStore.checkoutSettlementCurrency === 'USD', loading: this.continueLoading &&
|
|
1937
871
|
cart.stripeStore.checkoutSettlementCurrency !== 'USD', onClick: async () => {
|
|
1938
872
|
if (!cart.cartStore.checkoutSession) {
|
|
@@ -1945,8 +879,8 @@ const ZonosCheckoutPayment = class {
|
|
|
1945
879
|
});
|
|
1946
880
|
}, size: "lg",
|
|
1947
881
|
// use primary type when on mobile mode
|
|
1948
|
-
variant: this.submitBtnType },
|
|
1949
|
-
orderTotal: renderCheckoutCurrency({
|
|
882
|
+
variant: this.submitBtnType }, translationStore.translate('Pay [orderTotal]', {
|
|
883
|
+
orderTotal: placeTestOrder.renderCheckoutCurrency({
|
|
1950
884
|
amount: cart.cartStore.total,
|
|
1951
885
|
isForeign: true,
|
|
1952
886
|
}),
|
|
@@ -1956,13 +890,13 @@ const ZonosCheckoutPayment = class {
|
|
|
1956
890
|
await this.continueClickHandler({
|
|
1957
891
|
currencyCode: 'USD',
|
|
1958
892
|
});
|
|
1959
|
-
}, size: "lg", variant: "subtle" },
|
|
893
|
+
}, size: "lg", variant: "subtle" }, translationStore.translate('Click to pay in USD'))))), index.h("zonos-paypal-payment", { onPaypalSessionDone: ({ detail: { orderId } }) => {
|
|
1960
894
|
this.paypalSessionDone.emit(orderId);
|
|
1961
895
|
}, onPaypalSessionFail: () => this.paypalSessionFailed.emit(), style: {
|
|
1962
896
|
display: isPaypalTabSelected ? 'block' : 'none',
|
|
1963
|
-
} })), isTestMode && (index.h("zonos-card", { backgroundColor: "gray-100", borderRadius: 12, class: "zonos--test-cards" }, index.h("zonos-v-stack", { spacing: 16 }, index.h("div", null, index.h("zonos-text", { type: "semiBoldLabel" },
|
|
897
|
+
} })), isTestMode && (index.h("zonos-card", { backgroundColor: "gray-100", borderRadius: 12, class: "zonos--test-cards" }, index.h("zonos-v-stack", { spacing: 16 }, index.h("div", null, index.h("zonos-text", { type: "semiBoldLabel" }, translationStore.translate('Test cards')), index.h("zonos-text", { textColor: "gray-700" }, translationStore.translate('Click to copy the card number. Use any future expiration date and three number CVC.'))), index.h("zonos-button", { icon: index.h("zonos-icon", { content: CheckmarkLineIcon }), justifyContent: "flex-start", onClick: () => this.copyCardToClipboard('4242424242424242') }, translationStore.translate('Success'), " (****4242)"), index.h("zonos-button", { icon: index.h("zonos-icon", { content: RemoveLineIcon }), justifyContent: "flex-start", onClick: () => this.copyCardToClipboard('4000000000000002') }, translationStore.translate('Failure'), " (****0002)")), index.h("zonos-notification", null)))));
|
|
1964
898
|
};
|
|
1965
|
-
return (index.h(index.Host, { class: "zonos--checkout-payment zonos--elements" }, index.h("div", { class: "zonos--group" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" },
|
|
899
|
+
return (index.h(index.Host, { class: "zonos--checkout-payment zonos--elements" }, index.h("div", { class: "zonos--group" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translationStore.translate('Payment method')), renderPayment())));
|
|
1966
900
|
}
|
|
1967
901
|
get ele() { return index.getElement(this); }
|
|
1968
902
|
static get watchers() { return {
|
|
@@ -2091,156 +1025,23 @@ const ZonosCheckoutProgressTabs = class {
|
|
|
2091
1025
|
color: labelSelectedColor,
|
|
2092
1026
|
})
|
|
2093
1027
|
: labelSelectedColor;
|
|
2094
|
-
return (index.h(index.Host, { key: '
|
|
1028
|
+
return (index.h(index.Host, { key: 'bf2f6ea302aafa40c5b1a763b89bffc47389b7ac', class: "zonos--elements", style: {
|
|
2095
1029
|
'--zonos--color': contrastLabelColor,
|
|
2096
1030
|
'--zonos--progress-percent': this.getTotalSuccessStep(),
|
|
2097
|
-
} }, index.h("div", { key: '
|
|
1031
|
+
} }, index.h("div", { key: '043adfc8805b027604880284a99148c9ea06e67b', class: "zonos--tab-wrapper" }, Object.values(cart.cartStore.tabItems).map((tab, index$1) => {
|
|
2098
1032
|
const isSelected = tab.value === selectedStep;
|
|
2099
1033
|
return (index.h("button", { "aria-label": `Tab ${tab.label}`, class: classes.classes([
|
|
2100
1034
|
'zonos--tab-item',
|
|
2101
1035
|
tab.value === selectedStep && 'selected',
|
|
2102
1036
|
tab.isDone && 'done',
|
|
2103
|
-
]), disabled: !this.isTabClickable(tab.value), key: tab.value, onClick: () => this.setTabSelected(tab.value) }, index.h("div", { class: "zonos--tab-index" }, index.h("zonos-text", { class: "zonos--tab-index-label", textColor: isSelected ? contrastLabelColor : 'gray-1000', type: "label" }, index$1 + 1), index.h("zonos-icon", { class: "zonos--tab-index-done-icon", content: TabCheckmark, iconColor: isSelected ? contrastLabelColor : 'gray-1000' })), index.h("zonos-text", { textColor: isSelected ? contrastLabelColor : 'gray-1000', type: "label" },
|
|
2104
|
-
})), index.h("div", { key: '
|
|
1037
|
+
]), disabled: !this.isTabClickable(tab.value), key: tab.value, onClick: () => this.setTabSelected(tab.value) }, index.h("div", { class: "zonos--tab-index" }, index.h("zonos-text", { class: "zonos--tab-index-label", textColor: isSelected ? contrastLabelColor : 'gray-1000', type: "label" }, index$1 + 1), index.h("zonos-icon", { class: "zonos--tab-index-done-icon", content: TabCheckmark, iconColor: isSelected ? contrastLabelColor : 'gray-1000' })), index.h("zonos-text", { textColor: isSelected ? contrastLabelColor : 'gray-1000', type: "label" }, translationStore.translate(tab.label))));
|
|
1038
|
+
})), index.h("div", { key: '991d64c7d79e4e4207e395ec8a3b9b2096e51c6a', class: "zonos--tab-progress" }, index.h("div", { key: '22471019b9e920af6d35976dd71b0954cc785b62', class: "zonos--progress-bar-fill" }))));
|
|
2105
1039
|
}
|
|
2106
1040
|
static get assetsDirs() { return ["assets"]; }
|
|
2107
1041
|
get ele() { return index.getElement(this); }
|
|
2108
1042
|
};
|
|
2109
1043
|
ZonosCheckoutProgressTabs.style = ZonosCheckoutProgressTabsStyle0;
|
|
2110
1044
|
|
|
2111
|
-
const ExclamationMarkDuotoneIcon = `<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
|
|
2112
|
-
<path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>
|
|
2113
|
-
<path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>
|
|
2114
|
-
</svg>`;
|
|
2115
|
-
|
|
2116
|
-
const HelpDuotoneIcon = `<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
|
|
2117
|
-
<path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>
|
|
2118
|
-
<path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>
|
|
2119
|
-
</svg>`;
|
|
2120
|
-
|
|
2121
|
-
const WarningDuotoneIcon = `<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
|
|
2122
|
-
<path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>
|
|
2123
|
-
<path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>
|
|
2124
|
-
</svg>`;
|
|
2125
|
-
|
|
2126
|
-
const zonosConfirmDialogCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";
|
|
2127
|
-
const ZonosConfirmDialogStyle0 = zonosConfirmDialogCss;
|
|
2128
|
-
|
|
2129
|
-
const ZonosConfirmDialog = class {
|
|
2130
|
-
constructor(hostRef) {
|
|
2131
|
-
index.registerInstance(this, hostRef);
|
|
2132
|
-
this.confirmClicked = index.createEvent(this, "confirmClicked", 7);
|
|
2133
|
-
this.cancelClicked = index.createEvent(this, "cancelClicked", 7);
|
|
2134
|
-
/**
|
|
2135
|
-
* Dialog title text
|
|
2136
|
-
* @default "Are you sure?"
|
|
2137
|
-
*/
|
|
2138
|
-
this.dialogTitle = localization.translate('Are you sure?');
|
|
2139
|
-
/**
|
|
2140
|
-
* Dialog intent (for icon and button color)
|
|
2141
|
-
* @default "info"
|
|
2142
|
-
*/
|
|
2143
|
-
this.dialogIntent = 'info';
|
|
2144
|
-
/**
|
|
2145
|
-
* Dialog subtitle text
|
|
2146
|
-
* @default null No subtitle
|
|
2147
|
-
*/
|
|
2148
|
-
this.dialogSubtitle = null;
|
|
2149
|
-
/**
|
|
2150
|
-
* Dialog width
|
|
2151
|
-
* @default 350 px
|
|
2152
|
-
*/
|
|
2153
|
-
this.dialogWidth = 350;
|
|
2154
|
-
/**
|
|
2155
|
-
* Type of dialog
|
|
2156
|
-
* - "alert" - Only confirm button
|
|
2157
|
-
* - "confirm" - Both Confirm and cancel buttons
|
|
2158
|
-
* @default "confirm"
|
|
2159
|
-
*/
|
|
2160
|
-
this.dialogType = 'confirm';
|
|
2161
|
-
/**
|
|
2162
|
-
* Whether or not the dialog is open
|
|
2163
|
-
*/
|
|
2164
|
-
this.isMobile = false;
|
|
2165
|
-
/**
|
|
2166
|
-
* Whether or not to close the dialog when clicking outside of it
|
|
2167
|
-
* @default false
|
|
2168
|
-
*/
|
|
2169
|
-
this.noClickOutside = false;
|
|
2170
|
-
this.clickOutsideDialogHandler = (event) => {
|
|
2171
|
-
if (event.target === event.currentTarget && !this.noClickOutside) {
|
|
2172
|
-
this.closeDialogHandler();
|
|
2173
|
-
}
|
|
2174
|
-
};
|
|
2175
|
-
}
|
|
2176
|
-
handleKeyDown(ev) {
|
|
2177
|
-
if (ev.key === 'Escape') {
|
|
2178
|
-
this.closeDialogHandler();
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
focusDialog() {
|
|
2182
|
-
if (this.dialogOpen) {
|
|
2183
|
-
setTimeout(() => {
|
|
2184
|
-
var _a, _b;
|
|
2185
|
-
// Focus on a non tabable element (tabIndex=-1), so we will be able to tab to other tabable elements
|
|
2186
|
-
(_b = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.zonos--backdrop')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
2187
|
-
}, 100);
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
confirmDialogHandler() {
|
|
2191
|
-
// Only do the action if the dialog is open
|
|
2192
|
-
if (!this.dialogOpen) {
|
|
2193
|
-
return;
|
|
2194
|
-
}
|
|
2195
|
-
// Emit confirm event
|
|
2196
|
-
this.confirmClicked.emit();
|
|
2197
|
-
}
|
|
2198
|
-
closeDialogHandler() {
|
|
2199
|
-
// Only do the action if the dialog is open
|
|
2200
|
-
if (!this.dialogOpen) {
|
|
2201
|
-
return;
|
|
2202
|
-
}
|
|
2203
|
-
// Emit cancel event
|
|
2204
|
-
this.cancelClicked.emit();
|
|
2205
|
-
}
|
|
2206
|
-
renderIcon() {
|
|
2207
|
-
switch (this.dialogIntent) {
|
|
2208
|
-
case 'info':
|
|
2209
|
-
return (index.h("zonos-icon", { content: HelpDuotoneIcon, iconColor: 'blue-800' }));
|
|
2210
|
-
case 'danger':
|
|
2211
|
-
return (index.h("zonos-icon", { content: ExclamationMarkDuotoneIcon, iconColor: 'red-800' }));
|
|
2212
|
-
case 'warn':
|
|
2213
|
-
return (index.h("zonos-icon", { content: WarningDuotoneIcon, iconColor: 'orange-800' }));
|
|
2214
|
-
}
|
|
2215
|
-
}
|
|
2216
|
-
getButtonConfirmVariant() {
|
|
2217
|
-
switch (this.dialogIntent) {
|
|
2218
|
-
case 'warn':
|
|
2219
|
-
return 'warning';
|
|
2220
|
-
case 'danger':
|
|
2221
|
-
return 'danger';
|
|
2222
|
-
default:
|
|
2223
|
-
return 'primary';
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
render() {
|
|
2227
|
-
this.focusDialog();
|
|
2228
|
-
const borderStyle = getBorderRadius.getBorderRadius();
|
|
2229
|
-
// Get theme for the update dialog, inherit from the theme, no from this component theme
|
|
2230
|
-
const theme = zonosStore.getZonosStoreTheme(zonosStore.zonosStore.appearance.theme);
|
|
2231
|
-
return (index.h(index.Host, { key: '3d4920dacf3c4b1ae796b10a3d68dc875cbe4267', class: classes.classes([this.dialogOpen && 'open', 'zonos--elements']), "data-dialog-type": this.dialogType, "data-theme": theme, style: {
|
|
2232
|
-
'--zonos--border-radius': borderStyle,
|
|
2233
|
-
'--zonos--dialog-width': `${this.dialogWidth}px`,
|
|
2234
|
-
'--zonos--font-family': zonosStore.zonosStoreFontFamily(),
|
|
2235
|
-
} }, index.h("div", { key: 'e2b1358dedfb3e5a3dc42099330be1d3bb6845e5', class: "zonos--backdrop", tabIndex: -1 }), index.h("div", { key: 'f4cf0ddf4ee1695bef503809a810710902c2e810', class: classes.classes(['zonos--confirm-layout', this.dialogIntent]), onClick: e => this.clickOutsideDialogHandler(e) }, index.h("div", { key: 'a8910f985165f18399e628b05b5075d04487007b', class: "zonos--confirm-dialog", onBlur: () => {
|
|
2236
|
-
this.focusDialog();
|
|
2237
|
-
} }, index.h("div", { key: '723b4753614273bafe03488cdc5eb7a2a14cfb2c', class: "wrapper" }, index.h("div", { key: '53faf2cbdcec3acdff25f8471a37afdfb4298ef3', class: "icon-wrapper" }, this.renderIcon()), index.h("div", { key: '8e6ee33eb8ee48acb99066ce964b52e81086176f', class: "content" }, index.h("div", { key: '6c800bbc27a2e62756b20068b97e5777ebf5fbb2', class: "title" }, index.h("zonos-text", { key: '7bcad323167f954ae83c9afd7c4473efc5e32c37', type: "subheader" }, this.dialogTitle)), this.dialogSubtitle && (index.h("div", { key: '85ffc3c1492dd432953bc645103590bacd9a3912', class: "subtitle" }, index.h("zonos-text", { key: 'f7e859f0c8256ead95db3d74b78b50fe6ea84700', textColor: "gray-800" }, this.dialogSubtitle)))), index.h("div", { key: 'c35405667155231fb6037147ac35d0c1f5ed0dd0', class: "footer" }, this.dialogType === 'confirm' && (index.h("zonos-button", { key: '082731ae55230c6fe05307871ef5e6a124616e33', backgroundColor: "gray-0", class: "cancel-button", onClick: () => this.closeDialogHandler(), size: "lg", withBoxShadow: true }, this.dialogCancelBtnText || localization.translate('Cancel'))), index.h("zonos-button", { key: '4873b0e88c691197104b95658fc00940d97d44b9', class: "confirm-button", onClick: () => this.confirmDialogHandler(), size: "lg", variant: this.getButtonConfirmVariant() }, this.dialogConfirmBtnText)))))));
|
|
2238
|
-
}
|
|
2239
|
-
static get assetsDirs() { return ["assets"]; }
|
|
2240
|
-
get el() { return index.getElement(this); }
|
|
2241
|
-
};
|
|
2242
|
-
ZonosConfirmDialog.style = ZonosConfirmDialogStyle0;
|
|
2243
|
-
|
|
2244
1045
|
const ZonosCurrencyToggle = class {
|
|
2245
1046
|
constructor(hostRef) {
|
|
2246
1047
|
index.registerInstance(this, hostRef);
|
|
@@ -2570,7 +1371,7 @@ const ZonosCustomerInfo = class {
|
|
|
2570
1371
|
shippingCountry: this.shippingCountry,
|
|
2571
1372
|
taxId: cart.stripeStore.taxId,
|
|
2572
1373
|
});
|
|
2573
|
-
this.taxIdErrorMessage = !valid ?
|
|
1374
|
+
this.taxIdErrorMessage = !valid ? translationStore.translate(error) : '';
|
|
2574
1375
|
if (!isValidBilling || !isValidShipping || !isValidLink || !valid) {
|
|
2575
1376
|
return false;
|
|
2576
1377
|
}
|
|
@@ -2630,10 +1431,10 @@ const ZonosCustomerInfo = class {
|
|
|
2630
1431
|
}
|
|
2631
1432
|
// Render custom address component if the custom address form is enabled
|
|
2632
1433
|
if (this.addressFormRenderType === 'zonos') {
|
|
2633
|
-
return (index.h("zonos-custom-address", { defaultAddress: defaultAddress, taxIdErrorMessage: this.taxIdErrorMessage, titleText:
|
|
1434
|
+
return (index.h("zonos-custom-address", { defaultAddress: defaultAddress, taxIdErrorMessage: this.taxIdErrorMessage, titleText: translationStore.translate(type === 'shipping' ? 'Shipping address' : 'Billing address'), type: type }));
|
|
2634
1435
|
}
|
|
2635
1436
|
// Render Stripe address component by default
|
|
2636
|
-
return (index.h("zonos-address", { defaultAddress: defaultAddress, taxIdErrorMessage: this.taxIdErrorMessage, titleText:
|
|
1437
|
+
return (index.h("zonos-address", { defaultAddress: defaultAddress, taxIdErrorMessage: this.taxIdErrorMessage, titleText: translationStore.translate(type === 'shipping' ? 'Shipping address' : 'Billing address'), type: type }));
|
|
2637
1438
|
};
|
|
2638
1439
|
}
|
|
2639
1440
|
watchShowErrorBanner() {
|
|
@@ -2724,11 +1525,11 @@ const ZonosCustomerInfo = class {
|
|
|
2724
1525
|
const defaultEmail = ((_b = this.defaultAddress.find(Boolean)) === null || _b === void 0 ? void 0 : _b.email) ||
|
|
2725
1526
|
((_e = (_d = (_c = cart.stripeStore.customerProfile) === null || _c === void 0 ? void 0 : _c.locations) === null || _d === void 0 ? void 0 : _d.find(Boolean)) === null || _e === void 0 ? void 0 : _e.email) ||
|
|
2726
1527
|
((_f = cart.stripeStore.customerProfile) === null || _f === void 0 ? void 0 : _f.email);
|
|
2727
|
-
return (index.h(index.Host, { class: "zonos--customer-info zonos--elements" }, index.h("div", { class: "zonos--group" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" },
|
|
1528
|
+
return (index.h(index.Host, { class: "zonos--customer-info zonos--elements" }, index.h("div", { class: "zonos--group" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translationStore.translate('Customer information')), this.showErrorBanner && (index.h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translationStore.translate('Missing required fields. Make sure all fields are completed.'))), index.h("zonos-link-authentication", { defaultEmail: defaultEmail, isEmailError: this.isEmailError, onLinkAuthenticationChange: this.handleEmailValidation, titleText: translationStore.translate('Contact') }), this.renderAddressComponent('shipping'), index.h("zonos-checkbox", { class: "zonos--shipping-same-as-billing-cbx", isChecked: cart.stripeStore.stripeShippingSameAsBilling, label: translationStore.translate('Shipping address same as billing'), onCheckboxSelected: e => {
|
|
2728
1529
|
cart.stripeStore.stripeShippingSameAsBilling = e.detail;
|
|
2729
1530
|
} }), index.h("zonos-collapse", { collapsed: !showBilling }, this.renderAddressComponent('billing')), index.h("div", { class: "zonos--group-btn" }, index.h("zonos-button", { backgroundColor: this.submitBtnColor, bold: true, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
|
|
2730
1531
|
// use primary type when on mobile mode
|
|
2731
|
-
variant: this.submitBtnType },
|
|
1532
|
+
variant: this.submitBtnType }, translationStore.translate('Continue to shipping')))), cart.stripeStore.stripeAddressEventData && (index.h("zonos-address-update-dialog", { billingAddress: !cart.stripeStore.stripeShippingSameAsBilling &&
|
|
2732
1533
|
cart.stripeStore.stripeBillingAddressEventData
|
|
2733
1534
|
? this.prepareAddressObject(cart.stripeStore.stripeBillingAddressEventData)
|
|
2734
1535
|
: null, "data-theme": theme, dialogLoading: this.isValidatingAddress, dialogOpen: this.openAddressValidationDialog, isMobile: this.isMobile, onCloseUpdateDialog: () => (this.openAddressValidationDialog = false), onContinueClicked: e => {
|
|
@@ -2753,28 +1554,6 @@ const ZonosCustomerInfo = class {
|
|
|
2753
1554
|
};
|
|
2754
1555
|
ZonosCustomerInfo.style = ZonosCustomerInfoStyle0;
|
|
2755
1556
|
|
|
2756
|
-
const zonosLoadingOverlayCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";
|
|
2757
|
-
const ZonosLoadingOverlayStyle0 = zonosLoadingOverlayCss;
|
|
2758
|
-
|
|
2759
|
-
const ZonosLoadingOverlay = class {
|
|
2760
|
-
constructor(hostRef) {
|
|
2761
|
-
index.registerInstance(this, hostRef);
|
|
2762
|
-
/**
|
|
2763
|
-
* Whether or not the overlay is open
|
|
2764
|
-
* @default false
|
|
2765
|
-
*/
|
|
2766
|
-
this.open = false;
|
|
2767
|
-
/**
|
|
2768
|
-
* Spinner size (optional, default 40)
|
|
2769
|
-
*/
|
|
2770
|
-
this.size = 40;
|
|
2771
|
-
}
|
|
2772
|
-
render() {
|
|
2773
|
-
return (index.h(index.Host, { key: 'eff20c3fe4c4a998748ac07567cc5449efc398cd', class: classes.classes(['zonos--elements', this.open && 'zonos--open']) }, index.h("div", { key: '1b37bfc1a150720e0f4f84075ac661e5395aee3b', class: "zonos--loading-overlay" }, index.h("zonos-spinner", { key: '42ac91e723802b23897b6e5cd99e0aea7d964da5', size: this.size, spinnerColor: this.spinnerColor }))));
|
|
2774
|
-
}
|
|
2775
|
-
};
|
|
2776
|
-
ZonosLoadingOverlay.style = ZonosLoadingOverlayStyle0;
|
|
2777
|
-
|
|
2778
1557
|
const zonosRestStateCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{height:100%;width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;gap:20px}:host .zonos--restState-image{width:124px;height:124px;margin-bottom:15px}:host .content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;gap:8px}";
|
|
2779
1558
|
const ZonosRestStateStyle0 = zonosRestStateCss;
|
|
2780
1559
|
|
|
@@ -2792,11 +1571,11 @@ const ZonosRestState = class {
|
|
|
2792
1571
|
}
|
|
2793
1572
|
render() {
|
|
2794
1573
|
const imageUrl = this.getImageRestState();
|
|
2795
|
-
return (index.h(index.Host, { key: '
|
|
1574
|
+
return (index.h(index.Host, { key: '1259c56e28646e85893b129c22402e9d7cfe18f8', class: classes.classes(['zonos--elements zonos--restState']), style: {
|
|
2796
1575
|
'--zonos--font-family': zonosStore.zonosStoreFontFamily(),
|
|
2797
|
-
} }, index.h("div", { key: '
|
|
1576
|
+
} }, index.h("div", { key: '3cba2e86f4952f5d2a171017ad1f6eaa62aacc6a', class: "zonos--restState-image" }, index.h("img", { key: '8f656c89ef030c1eddec8cd95d6a15df889c6ed2', alt: this.restStateType, onError: () => {
|
|
2798
1577
|
this.isErrorImageLoad = true;
|
|
2799
|
-
}, src: imageUrl })), index.h("div", { key: '
|
|
1578
|
+
}, src: imageUrl })), index.h("div", { key: '963cf06ac769d8b3bfeb7b36824cb1b6821b5498', class: "content" }, index.h("zonos-text", { key: 'dacc2d0c125d41e5a72c57a5b611789bb005fc46', class: "title", type: "boldSubheader" }, this.restStateTitle), index.h("zonos-text", { key: '32db4bc138b4cc6c5fab3fd6aa14b51c31ffaf80', class: "subtitle" }, this.restStateSubtitle)), index.h("div", { key: '28f933f06737ac076d2da9dcc1530f01ddb93575', class: "action" }, index.h("slot", { key: 'd974a157a01c4e2305255fc4032868e86af162b5' }))));
|
|
2800
1579
|
}
|
|
2801
1580
|
static get assetsDirs() { return ["assets"]; }
|
|
2802
1581
|
};
|
|
@@ -2850,9 +1629,9 @@ const ZonosReview = class {
|
|
|
2850
1629
|
return (index.h(index.Host, { class: classes.classes([
|
|
2851
1630
|
'zonos--review zonos--elements',
|
|
2852
1631
|
this.isMobile && 'mobile',
|
|
2853
|
-
]) }, index.h("div", { class: "zonos--title" }, index.h("zonos-text", { textColor: titleTextColor, type: titleTextType },
|
|
1632
|
+
]) }, index.h("div", { class: "zonos--title" }, index.h("zonos-text", { textColor: titleTextColor, type: titleTextType }, translationStore.translate('Pay [organizationName]', {
|
|
2854
1633
|
organizationName: zonosStore.zonosStore.organizationName,
|
|
2855
|
-
})), renderCollapseIcon()), index.h("div", { class: "zonos--total-pay" }, index.h("zonos-text", { type: totalTextType }, renderCheckoutCurrency({
|
|
1634
|
+
})), renderCollapseIcon()), index.h("div", { class: "zonos--total-pay" }, index.h("zonos-text", { type: totalTextType }, placeTestOrder.renderCheckoutCurrency({
|
|
2856
1635
|
amount: total,
|
|
2857
1636
|
isForeign: true,
|
|
2858
1637
|
})))));
|
|
@@ -2929,7 +1708,11 @@ const ZonosShipping = class {
|
|
|
2929
1708
|
// update the address async if we already got landed cost data
|
|
2930
1709
|
await cart.stripeStoreAsyncAddressUpdate();
|
|
2931
1710
|
// save selected shipping option to store
|
|
2932
|
-
await cart.cartStoreUpdateSelectedShippingOption(
|
|
1711
|
+
await cart.cartStoreUpdateSelectedShippingOption({
|
|
1712
|
+
applySubtotalsOnly: false,
|
|
1713
|
+
landedCostId: e.detail.landedCostId,
|
|
1714
|
+
selectedShippingOption,
|
|
1715
|
+
});
|
|
2933
1716
|
this.isSelecting = false;
|
|
2934
1717
|
};
|
|
2935
1718
|
this.handleValidate = () => {
|
|
@@ -2975,7 +1758,7 @@ const ZonosShipping = class {
|
|
|
2975
1758
|
// DAP description for non-US countries only
|
|
2976
1759
|
case method === 'DAP' &&
|
|
2977
1760
|
!((_b = (_a = zonosStore.zonosStore.genericSettings) === null || _a === void 0 ? void 0 : _a.domesticCountries) === null || _b === void 0 ? void 0 : _b.includes(((_c = cart.stripeStore.stripeAddressEventData) === null || _c === void 0 ? void 0 : _c.value.address.country) || 'US')):
|
|
2978
|
-
return
|
|
1761
|
+
return translationStore.translate(` (Duties due at door)`);
|
|
2979
1762
|
default:
|
|
2980
1763
|
return '';
|
|
2981
1764
|
}
|
|
@@ -3001,7 +1784,7 @@ const ZonosShipping = class {
|
|
|
3001
1784
|
label: `${item.displayName}${this.getLandedCostMethodLabelSuffix(method)}`,
|
|
3002
1785
|
landedCostId: landedCost.landedCostId,
|
|
3003
1786
|
method,
|
|
3004
|
-
price: renderCheckoutCurrency({
|
|
1787
|
+
price: placeTestOrder.renderCheckoutCurrency({
|
|
3005
1788
|
amount: shippingAmount,
|
|
3006
1789
|
isForeign: true,
|
|
3007
1790
|
}),
|
|
@@ -3105,13 +1888,13 @@ const ZonosShipping = class {
|
|
|
3105
1888
|
this.collapsedDAPOptions && 'collapsed',
|
|
3106
1889
|
]), onClick: () => {
|
|
3107
1890
|
this.collapsedDAPOptions = !this.collapsedDAPOptions;
|
|
3108
|
-
} }, index.h("div", { class: "zonos--title-wrapper" }, index.h("zonos-text", { type: "label" }, `${
|
|
1891
|
+
} }, index.h("div", { class: "zonos--title-wrapper" }, index.h("zonos-text", { type: "label" }, `${translationStore.translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), index.h("zonos-icon", { content: ChevronUpIcon })))), index.h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, index.h("div", { class: "zonos--dap-wrapper" }, index.h("zonos-banner", { bannerTitle: translationStore.translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, translationStore.translate('You may incur additional fees from the shipping carrier by not prepaying.')), index.h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod })))));
|
|
3109
1892
|
};
|
|
3110
|
-
return (index.h(index.Host, { class: "zonos--shipping zonos--elements" }, index.h("div", { class: "zonos--group" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" },
|
|
1893
|
+
return (index.h(index.Host, { class: "zonos--shipping zonos--elements" }, index.h("div", { class: "zonos--group" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translationStore.translate('Delivery options')), this.showErrorBanner && !!this.serviceLevelsAll.length && (index.h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translationStore.translate('No shipping method selected'))), index.h("zonos-text", { class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translationStore.translate('Shipping method')), !this.serviceLevelsAll.length ? (index.h("zonos-banner", { bannerTitle: cart.cartStore.customQuotingError
|
|
3111
1894
|
? cart.cartStore.customQuotingError
|
|
3112
|
-
:
|
|
1895
|
+
: translationStore.translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (index.h("div", { class: "zonos--shipping-options-wrapper" }, renderServiceLevels())), index.h("div", { class: "zonos--group-btn" }, index.h("zonos-button", { backgroundColor: this.submitBtnColor, bold: true, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
|
|
3113
1896
|
// use primary type when on mobile mode
|
|
3114
|
-
variant: this.submitBtnType },
|
|
1897
|
+
variant: this.submitBtnType }, translationStore.translate('Go to payment'))))));
|
|
3115
1898
|
}
|
|
3116
1899
|
};
|
|
3117
1900
|
ZonosShipping.style = ZonosShippingStyle0;
|
|
@@ -3123,10 +1906,8 @@ exports.zonos_checkout_finish = ZonosCheckoutFinish;
|
|
|
3123
1906
|
exports.zonos_checkout_footer = ZonosCheckoutFooter;
|
|
3124
1907
|
exports.zonos_checkout_payment = ZonosCheckoutPayment;
|
|
3125
1908
|
exports.zonos_checkout_progress_tabs = ZonosCheckoutProgressTabs;
|
|
3126
|
-
exports.zonos_confirm_dialog = ZonosConfirmDialog;
|
|
3127
1909
|
exports.zonos_currency_toggle = ZonosCurrencyToggle;
|
|
3128
1910
|
exports.zonos_customer_info = ZonosCustomerInfo;
|
|
3129
|
-
exports.zonos_loading_overlay = ZonosLoadingOverlay;
|
|
3130
1911
|
exports.zonos_rest_state = ZonosRestState;
|
|
3131
1912
|
exports.zonos_review = ZonosReview;
|
|
3132
1913
|
exports.zonos_shipping = ZonosShipping;
|