@zonos/elements 1.3.218 → 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-c54d05ce.js → cart-9a2b32e4.js} +90 -47
- package/dist/cjs/cleanHtmlMarkdown-577d0a77.js +999 -0
- package/dist/cjs/index.cjs.js +19 -9
- 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-d36b5dd1.js → paypal-e80871d0.js} +12 -8
- package/dist/cjs/placeTestOrder-8222fe95.js +93 -0
- package/dist/cjs/{localization-ab7e1902.js → translationStore-20a6d8bf.js} +963 -734
- package/dist/cjs/zonos-address_11.cjs.entry.js +102 -72
- 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} +73 -1292
- package/dist/cjs/zonos-checkout.cjs.entry.js +25 -48
- 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 +84 -28
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +11 -10
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +15 -5
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +34 -33
- package/dist/cjs/zonos-hello.cjs.entry.js +8 -7
- package/dist/cjs/zonos-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +6 -5
- 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/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-bb0ee971.js → cart-acf4ebf5.js} +68 -27
- package/dist/esm/cleanHtmlMarkdown-b5b18743.js +997 -0
- package/dist/esm/index.js +19 -9
- 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-bd4520eb.js → paypal-2fa930eb.js} +7 -4
- package/dist/esm/placeTestOrder-d1ad9cf6.js +90 -0
- package/dist/esm/{localization-d8326254.js → translationStore-c9743292.js} +963 -718
- package/dist/esm/zonos-address_11.entry.js +71 -41
- 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} +23 -1240
- package/dist/esm/zonos-checkout.entry.js +6 -29
- 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 +84 -28
- package/dist/esm/zonos-country-flag.entry.js +2 -1
- package/dist/esm/zonos-country-select_4.entry.js +11 -10
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-empty-state-payment_4.entry.js +15 -5
- package/dist/esm/zonos-hello-dialog.entry.js +6 -5
- package/dist/esm/zonos-hello.entry.js +2 -1
- package/dist/esm/zonos-input.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +6 -5
- 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/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/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 +470 -3
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-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/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-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-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-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-bb0ee971.js +0 -1
- package/dist/esm-es5/localization-d8326254.js +0 -1
- package/dist/esm-es5/paypal-bd4520eb.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-0631d2b9.js +0 -1
- package/dist/zonos-elements/p-0a6ac265.system.js +0 -1
- package/dist/zonos-elements/p-0f041dc5.system.entry.js +0 -1
- package/dist/zonos-elements/p-1432a217.system.entry.js +0 -1
- package/dist/zonos-elements/p-1b51b738.system.entry.js +0 -1
- package/dist/zonos-elements/p-3a1513ae.system.entry.js +0 -1
- package/dist/zonos-elements/p-3b8d11dd.entry.js +0 -1
- package/dist/zonos-elements/p-4333afcb.entry.js +0 -1
- package/dist/zonos-elements/p-4d0d89da.system.entry.js +0 -1
- package/dist/zonos-elements/p-5dd9cb44.system.entry.js +0 -1
- package/dist/zonos-elements/p-605a21ac.entry.js +0 -1
- package/dist/zonos-elements/p-674981ad.system.js +0 -1
- package/dist/zonos-elements/p-6d090b53.entry.js +0 -1
- package/dist/zonos-elements/p-73c8c551.system.entry.js +0 -1
- package/dist/zonos-elements/p-795d223d.entry.js +0 -1
- package/dist/zonos-elements/p-8218ff62.system.entry.js +0 -1
- package/dist/zonos-elements/p-82f80c8a.entry.js +0 -1
- package/dist/zonos-elements/p-88f7256d.js +0 -1
- package/dist/zonos-elements/p-8b083884.entry.js +0 -1
- package/dist/zonos-elements/p-a449940d.entry.js +0 -1
- package/dist/zonos-elements/p-a5a4ad2f.entry.js +0 -1
- package/dist/zonos-elements/p-a5d45585.system.entry.js +0 -1
- package/dist/zonos-elements/p-a751e819.system.entry.js +0 -1
- package/dist/zonos-elements/p-ad556be6.entry.js +0 -1
- package/dist/zonos-elements/p-b4792af0.entry.js +0 -1
- package/dist/zonos-elements/p-b9ff6458.entry.js +0 -1
- package/dist/zonos-elements/p-d3dbae8c.system.js +0 -1
- package/dist/zonos-elements/p-d55aec11.system.entry.js +0 -1
- package/dist/zonos-elements/p-ebb9b902.system.js +0 -17
- package/dist/zonos-elements/p-ef1ce617.system.entry.js +0 -1
- package/dist/zonos-elements/p-ef75da6f.js +0 -17
- package/dist/zonos-elements/p-f3dbe934.entry.js +0 -1
- package/dist/zonos-elements/p-f741407e.system.entry.js +0 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { r as registerInstance, d as getAssetPath, h, H as Host, F as Fragment, c as createEvent, a as getElement } from './index-55a03023.js';
|
|
2
|
-
import { e as cartStore,
|
|
3
|
-
import {
|
|
2
|
+
import { e as cartStore, D as cartStoreHasOneEligibleItem, E as stripeStoreApplyPromoCode, F as stripeStoreRemovePromoCode, c as stripeStore, y as stripeStoreReset, d as stripeStoreRetrievePayment, t as trackConversionEvent, G as stripeStoreResetPromoCode, H as stripeStoreMessageBasedOnStatus, r as cartStoreNextStep, I as stripeStoreTranslateAddressToLatin, J as extractName, K as cartStoreOnChange, L as stripeStoreAsyncAddressUpdate, C as cartStoreUpdateSelectedShippingOption, M as cartStoreGetShippingTransitInfo, N as cartStoreGetMethod, O as sortServiceLevelOptionsByAmount } from './cart-acf4ebf5.js';
|
|
3
|
+
import { t as translate } from './translationStore-c9743292.js';
|
|
4
|
+
import { r as renderCheckoutCurrency, p as placeTestOrder } from './placeTestOrder-d1ad9cf6.js';
|
|
5
|
+
import { c as cleanHtmlMarkdown } from './cleanHtmlMarkdown-b5b18743.js';
|
|
4
6
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
|
-
import { z as zonosStore,
|
|
6
|
-
import { s as submitGtag, c as paypalStoreReset, a as paypalStore, i as isContrastColor } from './paypal-
|
|
7
|
-
import {
|
|
7
|
+
import { z as zonosStore, h as zonosStoreOnChange, g as getZonosStoreTheme, f as zonosStoreFontFamily } from './zonosStore-c456b933.js';
|
|
8
|
+
import { s as submitGtag, c as paypalStoreReset, a as paypalStore, i as isContrastColor } from './paypal-2fa930eb.js';
|
|
9
|
+
import { s as storageStore, l as localizationStore, c as localizationStoreOnChange } from './localization-8646f526.js';
|
|
10
|
+
import { h as handleFetch, l as log, s as sendErrorLog, d as allLogs, j as jsonParse, g as getIsTestMode, i as isCheckoutMobile, a as getIsStagingMode } from './handleFetch-99218189.js';
|
|
8
11
|
import { c as createCustomEvent } from './createCustomEvent-58159025.js';
|
|
9
12
|
import { g as getBorderRadius } from './getBorderRadius-87593ff4.js';
|
|
10
13
|
import { l as languages } from './ILanguage-cd6acb72.js';
|
|
@@ -16,1040 +19,6 @@ import { e as euCountryCodes } from './TaxId-50d72254.js';
|
|
|
16
19
|
import './VarianceTest-fef2d958.js';
|
|
17
20
|
import './debounce-c34d1270.js';
|
|
18
21
|
|
|
19
|
-
const getDisplayCurrency = () => {
|
|
20
|
-
var _a, _b;
|
|
21
|
-
const shouldDisplayBaseCurrency = cartStore.displayBaseCurrency;
|
|
22
|
-
const displayCurrency = shouldDisplayBaseCurrency && ((_a = cartStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.sourceCurrencyCode)
|
|
23
|
-
? (_b = cartStore.exchangeRate) === null || _b === void 0 ? void 0 : _b.sourceCurrencyCode
|
|
24
|
-
: cartStore.currency;
|
|
25
|
-
return displayCurrency;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Unified currency rendering for checkout amounts.
|
|
30
|
-
* @note This is only to display, not for calculations.
|
|
31
|
-
*/
|
|
32
|
-
const renderCheckoutCurrency = ({ amount, isForeign }) => {
|
|
33
|
-
var _a;
|
|
34
|
-
const targetRate = ((_a = cartStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.rate) || 1;
|
|
35
|
-
const shouldDisplayBaseCurrency = cartStore.displayBaseCurrency;
|
|
36
|
-
const displayCurrency = getDisplayCurrency();
|
|
37
|
-
if (isForeign) {
|
|
38
|
-
// Amount is in foreign currency, divide by the rate to convert it to the base currency if displaying in base currency
|
|
39
|
-
const displayAmount = shouldDisplayBaseCurrency
|
|
40
|
-
? amount / targetRate
|
|
41
|
-
: amount;
|
|
42
|
-
return currencyFormat({
|
|
43
|
-
amount: displayAmount,
|
|
44
|
-
currency: displayCurrency,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
// Amount is already in base currency, need to multiply rate to convert to foreign currency if display in foreign currency
|
|
48
|
-
const displayAmount = shouldDisplayBaseCurrency
|
|
49
|
-
? amount
|
|
50
|
-
: amount * targetRate;
|
|
51
|
-
return currencyFormat({
|
|
52
|
-
amount: displayAmount,
|
|
53
|
-
currency: displayCurrency,
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
function extend (destination) {
|
|
58
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
59
|
-
var source = arguments[i];
|
|
60
|
-
for (var key in source) {
|
|
61
|
-
if (source.hasOwnProperty(key)) destination[key] = source[key];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return destination
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function repeat (character, count) {
|
|
68
|
-
return Array(count + 1).join(character)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function trimLeadingNewlines (string) {
|
|
72
|
-
return string.replace(/^\n*/, '')
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function trimTrailingNewlines (string) {
|
|
76
|
-
// avoid match-at-end regexp bottleneck, see #370
|
|
77
|
-
var indexEnd = string.length;
|
|
78
|
-
while (indexEnd > 0 && string[indexEnd - 1] === '\n') indexEnd--;
|
|
79
|
-
return string.substring(0, indexEnd)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var blockElements = [
|
|
83
|
-
'ADDRESS', 'ARTICLE', 'ASIDE', 'AUDIO', 'BLOCKQUOTE', 'BODY', 'CANVAS',
|
|
84
|
-
'CENTER', 'DD', 'DIR', 'DIV', 'DL', 'DT', 'FIELDSET', 'FIGCAPTION', 'FIGURE',
|
|
85
|
-
'FOOTER', 'FORM', 'FRAMESET', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HEADER',
|
|
86
|
-
'HGROUP', 'HR', 'HTML', 'ISINDEX', 'LI', 'MAIN', 'MENU', 'NAV', 'NOFRAMES',
|
|
87
|
-
'NOSCRIPT', 'OL', 'OUTPUT', 'P', 'PRE', 'SECTION', 'TABLE', 'TBODY', 'TD',
|
|
88
|
-
'TFOOT', 'TH', 'THEAD', 'TR', 'UL'
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
function isBlock (node) {
|
|
92
|
-
return is(node, blockElements)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
var voidElements = [
|
|
96
|
-
'AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT',
|
|
97
|
-
'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'
|
|
98
|
-
];
|
|
99
|
-
|
|
100
|
-
function isVoid (node) {
|
|
101
|
-
return is(node, voidElements)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function hasVoid (node) {
|
|
105
|
-
return has(node, voidElements)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
var meaningfulWhenBlankElements = [
|
|
109
|
-
'A', 'TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TH', 'TD', 'IFRAME', 'SCRIPT',
|
|
110
|
-
'AUDIO', 'VIDEO'
|
|
111
|
-
];
|
|
112
|
-
|
|
113
|
-
function isMeaningfulWhenBlank (node) {
|
|
114
|
-
return is(node, meaningfulWhenBlankElements)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function hasMeaningfulWhenBlank (node) {
|
|
118
|
-
return has(node, meaningfulWhenBlankElements)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function is (node, tagNames) {
|
|
122
|
-
return tagNames.indexOf(node.nodeName) >= 0
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function has (node, tagNames) {
|
|
126
|
-
return (
|
|
127
|
-
node.getElementsByTagName &&
|
|
128
|
-
tagNames.some(function (tagName) {
|
|
129
|
-
return node.getElementsByTagName(tagName).length
|
|
130
|
-
})
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
var rules = {};
|
|
135
|
-
|
|
136
|
-
rules.paragraph = {
|
|
137
|
-
filter: 'p',
|
|
138
|
-
|
|
139
|
-
replacement: function (content) {
|
|
140
|
-
return '\n\n' + content + '\n\n'
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
rules.lineBreak = {
|
|
145
|
-
filter: 'br',
|
|
146
|
-
|
|
147
|
-
replacement: function (content, node, options) {
|
|
148
|
-
return options.br + '\n'
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
rules.heading = {
|
|
153
|
-
filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
|
|
154
|
-
|
|
155
|
-
replacement: function (content, node, options) {
|
|
156
|
-
var hLevel = Number(node.nodeName.charAt(1));
|
|
157
|
-
|
|
158
|
-
if (options.headingStyle === 'setext' && hLevel < 3) {
|
|
159
|
-
var underline = repeat((hLevel === 1 ? '=' : '-'), content.length);
|
|
160
|
-
return (
|
|
161
|
-
'\n\n' + content + '\n' + underline + '\n\n'
|
|
162
|
-
)
|
|
163
|
-
} else {
|
|
164
|
-
return '\n\n' + repeat('#', hLevel) + ' ' + content + '\n\n'
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
rules.blockquote = {
|
|
170
|
-
filter: 'blockquote',
|
|
171
|
-
|
|
172
|
-
replacement: function (content) {
|
|
173
|
-
content = content.replace(/^\n+|\n+$/g, '');
|
|
174
|
-
content = content.replace(/^/gm, '> ');
|
|
175
|
-
return '\n\n' + content + '\n\n'
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
rules.list = {
|
|
180
|
-
filter: ['ul', 'ol'],
|
|
181
|
-
|
|
182
|
-
replacement: function (content, node) {
|
|
183
|
-
var parent = node.parentNode;
|
|
184
|
-
if (parent.nodeName === 'LI' && parent.lastElementChild === node) {
|
|
185
|
-
return '\n' + content
|
|
186
|
-
} else {
|
|
187
|
-
return '\n\n' + content + '\n\n'
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
rules.listItem = {
|
|
193
|
-
filter: 'li',
|
|
194
|
-
|
|
195
|
-
replacement: function (content, node, options) {
|
|
196
|
-
content = content
|
|
197
|
-
.replace(/^\n+/, '') // remove leading newlines
|
|
198
|
-
.replace(/\n+$/, '\n') // replace trailing newlines with just a single one
|
|
199
|
-
.replace(/\n/gm, '\n '); // indent
|
|
200
|
-
var prefix = options.bulletListMarker + ' ';
|
|
201
|
-
var parent = node.parentNode;
|
|
202
|
-
if (parent.nodeName === 'OL') {
|
|
203
|
-
var start = parent.getAttribute('start');
|
|
204
|
-
var index = Array.prototype.indexOf.call(parent.children, node);
|
|
205
|
-
prefix = (start ? Number(start) + index : index + 1) + '. ';
|
|
206
|
-
}
|
|
207
|
-
return (
|
|
208
|
-
prefix + content + (node.nextSibling && !/\n$/.test(content) ? '\n' : '')
|
|
209
|
-
)
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
rules.indentedCodeBlock = {
|
|
214
|
-
filter: function (node, options) {
|
|
215
|
-
return (
|
|
216
|
-
options.codeBlockStyle === 'indented' &&
|
|
217
|
-
node.nodeName === 'PRE' &&
|
|
218
|
-
node.firstChild &&
|
|
219
|
-
node.firstChild.nodeName === 'CODE'
|
|
220
|
-
)
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
replacement: function (content, node, options) {
|
|
224
|
-
return (
|
|
225
|
-
'\n\n ' +
|
|
226
|
-
node.firstChild.textContent.replace(/\n/g, '\n ') +
|
|
227
|
-
'\n\n'
|
|
228
|
-
)
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
rules.fencedCodeBlock = {
|
|
233
|
-
filter: function (node, options) {
|
|
234
|
-
return (
|
|
235
|
-
options.codeBlockStyle === 'fenced' &&
|
|
236
|
-
node.nodeName === 'PRE' &&
|
|
237
|
-
node.firstChild &&
|
|
238
|
-
node.firstChild.nodeName === 'CODE'
|
|
239
|
-
)
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
replacement: function (content, node, options) {
|
|
243
|
-
var className = node.firstChild.getAttribute('class') || '';
|
|
244
|
-
var language = (className.match(/language-(\S+)/) || [null, ''])[1];
|
|
245
|
-
var code = node.firstChild.textContent;
|
|
246
|
-
|
|
247
|
-
var fenceChar = options.fence.charAt(0);
|
|
248
|
-
var fenceSize = 3;
|
|
249
|
-
var fenceInCodeRegex = new RegExp('^' + fenceChar + '{3,}', 'gm');
|
|
250
|
-
|
|
251
|
-
var match;
|
|
252
|
-
while ((match = fenceInCodeRegex.exec(code))) {
|
|
253
|
-
if (match[0].length >= fenceSize) {
|
|
254
|
-
fenceSize = match[0].length + 1;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
var fence = repeat(fenceChar, fenceSize);
|
|
259
|
-
|
|
260
|
-
return (
|
|
261
|
-
'\n\n' + fence + language + '\n' +
|
|
262
|
-
code.replace(/\n$/, '') +
|
|
263
|
-
'\n' + fence + '\n\n'
|
|
264
|
-
)
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
rules.horizontalRule = {
|
|
269
|
-
filter: 'hr',
|
|
270
|
-
|
|
271
|
-
replacement: function (content, node, options) {
|
|
272
|
-
return '\n\n' + options.hr + '\n\n'
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
rules.inlineLink = {
|
|
277
|
-
filter: function (node, options) {
|
|
278
|
-
return (
|
|
279
|
-
options.linkStyle === 'inlined' &&
|
|
280
|
-
node.nodeName === 'A' &&
|
|
281
|
-
node.getAttribute('href')
|
|
282
|
-
)
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
replacement: function (content, node) {
|
|
286
|
-
var href = node.getAttribute('href');
|
|
287
|
-
if (href) href = href.replace(/([()])/g, '\\$1');
|
|
288
|
-
var title = cleanAttribute(node.getAttribute('title'));
|
|
289
|
-
if (title) title = ' "' + title.replace(/"/g, '\\"') + '"';
|
|
290
|
-
return '[' + content + '](' + href + title + ')'
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
rules.referenceLink = {
|
|
295
|
-
filter: function (node, options) {
|
|
296
|
-
return (
|
|
297
|
-
options.linkStyle === 'referenced' &&
|
|
298
|
-
node.nodeName === 'A' &&
|
|
299
|
-
node.getAttribute('href')
|
|
300
|
-
)
|
|
301
|
-
},
|
|
302
|
-
|
|
303
|
-
replacement: function (content, node, options) {
|
|
304
|
-
var href = node.getAttribute('href');
|
|
305
|
-
var title = cleanAttribute(node.getAttribute('title'));
|
|
306
|
-
if (title) title = ' "' + title + '"';
|
|
307
|
-
var replacement;
|
|
308
|
-
var reference;
|
|
309
|
-
|
|
310
|
-
switch (options.linkReferenceStyle) {
|
|
311
|
-
case 'collapsed':
|
|
312
|
-
replacement = '[' + content + '][]';
|
|
313
|
-
reference = '[' + content + ']: ' + href + title;
|
|
314
|
-
break
|
|
315
|
-
case 'shortcut':
|
|
316
|
-
replacement = '[' + content + ']';
|
|
317
|
-
reference = '[' + content + ']: ' + href + title;
|
|
318
|
-
break
|
|
319
|
-
default:
|
|
320
|
-
var id = this.references.length + 1;
|
|
321
|
-
replacement = '[' + content + '][' + id + ']';
|
|
322
|
-
reference = '[' + id + ']: ' + href + title;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
this.references.push(reference);
|
|
326
|
-
return replacement
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
references: [],
|
|
330
|
-
|
|
331
|
-
append: function (options) {
|
|
332
|
-
var references = '';
|
|
333
|
-
if (this.references.length) {
|
|
334
|
-
references = '\n\n' + this.references.join('\n') + '\n\n';
|
|
335
|
-
this.references = []; // Reset references
|
|
336
|
-
}
|
|
337
|
-
return references
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
rules.emphasis = {
|
|
342
|
-
filter: ['em', 'i'],
|
|
343
|
-
|
|
344
|
-
replacement: function (content, node, options) {
|
|
345
|
-
if (!content.trim()) return ''
|
|
346
|
-
return options.emDelimiter + content + options.emDelimiter
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
rules.strong = {
|
|
351
|
-
filter: ['strong', 'b'],
|
|
352
|
-
|
|
353
|
-
replacement: function (content, node, options) {
|
|
354
|
-
if (!content.trim()) return ''
|
|
355
|
-
return options.strongDelimiter + content + options.strongDelimiter
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
rules.code = {
|
|
360
|
-
filter: function (node) {
|
|
361
|
-
var hasSiblings = node.previousSibling || node.nextSibling;
|
|
362
|
-
var isCodeBlock = node.parentNode.nodeName === 'PRE' && !hasSiblings;
|
|
363
|
-
|
|
364
|
-
return node.nodeName === 'CODE' && !isCodeBlock
|
|
365
|
-
},
|
|
366
|
-
|
|
367
|
-
replacement: function (content) {
|
|
368
|
-
if (!content) return ''
|
|
369
|
-
content = content.replace(/\r?\n|\r/g, ' ');
|
|
370
|
-
|
|
371
|
-
var extraSpace = /^`|^ .*?[^ ].* $|`$/.test(content) ? ' ' : '';
|
|
372
|
-
var delimiter = '`';
|
|
373
|
-
var matches = content.match(/`+/gm) || [];
|
|
374
|
-
while (matches.indexOf(delimiter) !== -1) delimiter = delimiter + '`';
|
|
375
|
-
|
|
376
|
-
return delimiter + extraSpace + content + extraSpace + delimiter
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
rules.image = {
|
|
381
|
-
filter: 'img',
|
|
382
|
-
|
|
383
|
-
replacement: function (content, node) {
|
|
384
|
-
var alt = cleanAttribute(node.getAttribute('alt'));
|
|
385
|
-
var src = node.getAttribute('src') || '';
|
|
386
|
-
var title = cleanAttribute(node.getAttribute('title'));
|
|
387
|
-
var titlePart = title ? ' "' + title + '"' : '';
|
|
388
|
-
return src ? '![' + alt + ']' + '(' + src + titlePart + ')' : ''
|
|
389
|
-
}
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
function cleanAttribute (attribute) {
|
|
393
|
-
return attribute ? attribute.replace(/(\n+\s*)+/g, '\n') : ''
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Manages a collection of rules used to convert HTML to Markdown
|
|
398
|
-
*/
|
|
399
|
-
|
|
400
|
-
function Rules (options) {
|
|
401
|
-
this.options = options;
|
|
402
|
-
this._keep = [];
|
|
403
|
-
this._remove = [];
|
|
404
|
-
|
|
405
|
-
this.blankRule = {
|
|
406
|
-
replacement: options.blankReplacement
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
this.keepReplacement = options.keepReplacement;
|
|
410
|
-
|
|
411
|
-
this.defaultRule = {
|
|
412
|
-
replacement: options.defaultReplacement
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
this.array = [];
|
|
416
|
-
for (var key in options.rules) this.array.push(options.rules[key]);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
Rules.prototype = {
|
|
420
|
-
add: function (key, rule) {
|
|
421
|
-
this.array.unshift(rule);
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
keep: function (filter) {
|
|
425
|
-
this._keep.unshift({
|
|
426
|
-
filter: filter,
|
|
427
|
-
replacement: this.keepReplacement
|
|
428
|
-
});
|
|
429
|
-
},
|
|
430
|
-
|
|
431
|
-
remove: function (filter) {
|
|
432
|
-
this._remove.unshift({
|
|
433
|
-
filter: filter,
|
|
434
|
-
replacement: function () {
|
|
435
|
-
return ''
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
forNode: function (node) {
|
|
441
|
-
if (node.isBlank) return this.blankRule
|
|
442
|
-
var rule;
|
|
443
|
-
|
|
444
|
-
if ((rule = findRule(this.array, node, this.options))) return rule
|
|
445
|
-
if ((rule = findRule(this._keep, node, this.options))) return rule
|
|
446
|
-
if ((rule = findRule(this._remove, node, this.options))) return rule
|
|
447
|
-
|
|
448
|
-
return this.defaultRule
|
|
449
|
-
},
|
|
450
|
-
|
|
451
|
-
forEach: function (fn) {
|
|
452
|
-
for (var i = 0; i < this.array.length; i++) fn(this.array[i], i);
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
function findRule (rules, node, options) {
|
|
457
|
-
for (var i = 0; i < rules.length; i++) {
|
|
458
|
-
var rule = rules[i];
|
|
459
|
-
if (filterValue(rule, node, options)) return rule
|
|
460
|
-
}
|
|
461
|
-
return void 0
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
function filterValue (rule, node, options) {
|
|
465
|
-
var filter = rule.filter;
|
|
466
|
-
if (typeof filter === 'string') {
|
|
467
|
-
if (filter === node.nodeName.toLowerCase()) return true
|
|
468
|
-
} else if (Array.isArray(filter)) {
|
|
469
|
-
if (filter.indexOf(node.nodeName.toLowerCase()) > -1) return true
|
|
470
|
-
} else if (typeof filter === 'function') {
|
|
471
|
-
if (filter.call(rule, node, options)) return true
|
|
472
|
-
} else {
|
|
473
|
-
throw new TypeError('`filter` needs to be a string, array, or function')
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* The collapseWhitespace function is adapted from collapse-whitespace
|
|
479
|
-
* by Luc Thevenard.
|
|
480
|
-
*
|
|
481
|
-
* The MIT License (MIT)
|
|
482
|
-
*
|
|
483
|
-
* Copyright (c) 2014 Luc Thevenard <lucthevenard@gmail.com>
|
|
484
|
-
*
|
|
485
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
486
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
487
|
-
* in the Software without restriction, including without limitation the rights
|
|
488
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
489
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
490
|
-
* furnished to do so, subject to the following conditions:
|
|
491
|
-
*
|
|
492
|
-
* The above copyright notice and this permission notice shall be included in
|
|
493
|
-
* all copies or substantial portions of the Software.
|
|
494
|
-
*
|
|
495
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
496
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
497
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
498
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
499
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
500
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
501
|
-
* THE SOFTWARE.
|
|
502
|
-
*/
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* collapseWhitespace(options) removes extraneous whitespace from an the given element.
|
|
506
|
-
*
|
|
507
|
-
* @param {Object} options
|
|
508
|
-
*/
|
|
509
|
-
function collapseWhitespace (options) {
|
|
510
|
-
var element = options.element;
|
|
511
|
-
var isBlock = options.isBlock;
|
|
512
|
-
var isVoid = options.isVoid;
|
|
513
|
-
var isPre = options.isPre || function (node) {
|
|
514
|
-
return node.nodeName === 'PRE'
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
if (!element.firstChild || isPre(element)) return
|
|
518
|
-
|
|
519
|
-
var prevText = null;
|
|
520
|
-
var keepLeadingWs = false;
|
|
521
|
-
|
|
522
|
-
var prev = null;
|
|
523
|
-
var node = next(prev, element, isPre);
|
|
524
|
-
|
|
525
|
-
while (node !== element) {
|
|
526
|
-
if (node.nodeType === 3 || node.nodeType === 4) { // Node.TEXT_NODE or Node.CDATA_SECTION_NODE
|
|
527
|
-
var text = node.data.replace(/[ \r\n\t]+/g, ' ');
|
|
528
|
-
|
|
529
|
-
if ((!prevText || / $/.test(prevText.data)) &&
|
|
530
|
-
!keepLeadingWs && text[0] === ' ') {
|
|
531
|
-
text = text.substr(1);
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
// `text` might be empty at this point.
|
|
535
|
-
if (!text) {
|
|
536
|
-
node = remove(node);
|
|
537
|
-
continue
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
node.data = text;
|
|
541
|
-
|
|
542
|
-
prevText = node;
|
|
543
|
-
} else if (node.nodeType === 1) { // Node.ELEMENT_NODE
|
|
544
|
-
if (isBlock(node) || node.nodeName === 'BR') {
|
|
545
|
-
if (prevText) {
|
|
546
|
-
prevText.data = prevText.data.replace(/ $/, '');
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
prevText = null;
|
|
550
|
-
keepLeadingWs = false;
|
|
551
|
-
} else if (isVoid(node) || isPre(node)) {
|
|
552
|
-
// Avoid trimming space around non-block, non-BR void elements and inline PRE.
|
|
553
|
-
prevText = null;
|
|
554
|
-
keepLeadingWs = true;
|
|
555
|
-
} else if (prevText) {
|
|
556
|
-
// Drop protection if set previously.
|
|
557
|
-
keepLeadingWs = false;
|
|
558
|
-
}
|
|
559
|
-
} else {
|
|
560
|
-
node = remove(node);
|
|
561
|
-
continue
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
var nextNode = next(prev, node, isPre);
|
|
565
|
-
prev = node;
|
|
566
|
-
node = nextNode;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
if (prevText) {
|
|
570
|
-
prevText.data = prevText.data.replace(/ $/, '');
|
|
571
|
-
if (!prevText.data) {
|
|
572
|
-
remove(prevText);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* remove(node) removes the given node from the DOM and returns the
|
|
579
|
-
* next node in the sequence.
|
|
580
|
-
*
|
|
581
|
-
* @param {Node} node
|
|
582
|
-
* @return {Node} node
|
|
583
|
-
*/
|
|
584
|
-
function remove (node) {
|
|
585
|
-
var next = node.nextSibling || node.parentNode;
|
|
586
|
-
|
|
587
|
-
node.parentNode.removeChild(node);
|
|
588
|
-
|
|
589
|
-
return next
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* next(prev, current, isPre) returns the next node in the sequence, given the
|
|
594
|
-
* current and previous nodes.
|
|
595
|
-
*
|
|
596
|
-
* @param {Node} prev
|
|
597
|
-
* @param {Node} current
|
|
598
|
-
* @param {Function} isPre
|
|
599
|
-
* @return {Node}
|
|
600
|
-
*/
|
|
601
|
-
function next (prev, current, isPre) {
|
|
602
|
-
if ((prev && prev.parentNode === current) || isPre(current)) {
|
|
603
|
-
return current.nextSibling || current.parentNode
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
return current.firstChild || current.nextSibling || current.parentNode
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
/*
|
|
610
|
-
* Set up window for Node.js
|
|
611
|
-
*/
|
|
612
|
-
|
|
613
|
-
var root = (typeof window !== 'undefined' ? window : {});
|
|
614
|
-
|
|
615
|
-
/*
|
|
616
|
-
* Parsing HTML strings
|
|
617
|
-
*/
|
|
618
|
-
|
|
619
|
-
function canParseHTMLNatively () {
|
|
620
|
-
var Parser = root.DOMParser;
|
|
621
|
-
var canParse = false;
|
|
622
|
-
|
|
623
|
-
// Adapted from https://gist.github.com/1129031
|
|
624
|
-
// Firefox/Opera/IE throw errors on unsupported types
|
|
625
|
-
try {
|
|
626
|
-
// WebKit returns null on unsupported types
|
|
627
|
-
if (new Parser().parseFromString('', 'text/html')) {
|
|
628
|
-
canParse = true;
|
|
629
|
-
}
|
|
630
|
-
} catch (e) {}
|
|
631
|
-
|
|
632
|
-
return canParse
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
function createHTMLParser () {
|
|
636
|
-
var Parser = function () {};
|
|
637
|
-
|
|
638
|
-
{
|
|
639
|
-
if (shouldUseActiveX()) {
|
|
640
|
-
Parser.prototype.parseFromString = function (string) {
|
|
641
|
-
var doc = new window.ActiveXObject('htmlfile');
|
|
642
|
-
doc.designMode = 'on'; // disable on-page scripts
|
|
643
|
-
doc.open();
|
|
644
|
-
doc.write(string);
|
|
645
|
-
doc.close();
|
|
646
|
-
return doc
|
|
647
|
-
};
|
|
648
|
-
} else {
|
|
649
|
-
Parser.prototype.parseFromString = function (string) {
|
|
650
|
-
var doc = document.implementation.createHTMLDocument('');
|
|
651
|
-
doc.open();
|
|
652
|
-
doc.write(string);
|
|
653
|
-
doc.close();
|
|
654
|
-
return doc
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
return Parser
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
function shouldUseActiveX () {
|
|
662
|
-
var useActiveX = false;
|
|
663
|
-
try {
|
|
664
|
-
document.implementation.createHTMLDocument('').open();
|
|
665
|
-
} catch (e) {
|
|
666
|
-
if (root.ActiveXObject) useActiveX = true;
|
|
667
|
-
}
|
|
668
|
-
return useActiveX
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
var HTMLParser = canParseHTMLNatively() ? root.DOMParser : createHTMLParser();
|
|
672
|
-
|
|
673
|
-
function RootNode (input, options) {
|
|
674
|
-
var root;
|
|
675
|
-
if (typeof input === 'string') {
|
|
676
|
-
var doc = htmlParser().parseFromString(
|
|
677
|
-
// DOM parsers arrange elements in the <head> and <body>.
|
|
678
|
-
// Wrapping in a custom element ensures elements are reliably arranged in
|
|
679
|
-
// a single element.
|
|
680
|
-
'<x-turndown id="turndown-root">' + input + '</x-turndown>',
|
|
681
|
-
'text/html'
|
|
682
|
-
);
|
|
683
|
-
root = doc.getElementById('turndown-root');
|
|
684
|
-
} else {
|
|
685
|
-
root = input.cloneNode(true);
|
|
686
|
-
}
|
|
687
|
-
collapseWhitespace({
|
|
688
|
-
element: root,
|
|
689
|
-
isBlock: isBlock,
|
|
690
|
-
isVoid: isVoid,
|
|
691
|
-
isPre: options.preformattedCode ? isPreOrCode : null
|
|
692
|
-
});
|
|
693
|
-
|
|
694
|
-
return root
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
var _htmlParser;
|
|
698
|
-
function htmlParser () {
|
|
699
|
-
_htmlParser = _htmlParser || new HTMLParser();
|
|
700
|
-
return _htmlParser
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
function isPreOrCode (node) {
|
|
704
|
-
return node.nodeName === 'PRE' || node.nodeName === 'CODE'
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
function Node (node, options) {
|
|
708
|
-
node.isBlock = isBlock(node);
|
|
709
|
-
node.isCode = node.nodeName === 'CODE' || node.parentNode.isCode;
|
|
710
|
-
node.isBlank = isBlank(node);
|
|
711
|
-
node.flankingWhitespace = flankingWhitespace(node, options);
|
|
712
|
-
return node
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
function isBlank (node) {
|
|
716
|
-
return (
|
|
717
|
-
!isVoid(node) &&
|
|
718
|
-
!isMeaningfulWhenBlank(node) &&
|
|
719
|
-
/^\s*$/i.test(node.textContent) &&
|
|
720
|
-
!hasVoid(node) &&
|
|
721
|
-
!hasMeaningfulWhenBlank(node)
|
|
722
|
-
)
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
function flankingWhitespace (node, options) {
|
|
726
|
-
if (node.isBlock || (options.preformattedCode && node.isCode)) {
|
|
727
|
-
return { leading: '', trailing: '' }
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
var edges = edgeWhitespace(node.textContent);
|
|
731
|
-
|
|
732
|
-
// abandon leading ASCII WS if left-flanked by ASCII WS
|
|
733
|
-
if (edges.leadingAscii && isFlankedByWhitespace('left', node, options)) {
|
|
734
|
-
edges.leading = edges.leadingNonAscii;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
// abandon trailing ASCII WS if right-flanked by ASCII WS
|
|
738
|
-
if (edges.trailingAscii && isFlankedByWhitespace('right', node, options)) {
|
|
739
|
-
edges.trailing = edges.trailingNonAscii;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
return { leading: edges.leading, trailing: edges.trailing }
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
function edgeWhitespace (string) {
|
|
746
|
-
var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
|
|
747
|
-
return {
|
|
748
|
-
leading: m[1], // whole string for whitespace-only strings
|
|
749
|
-
leadingAscii: m[2],
|
|
750
|
-
leadingNonAscii: m[3],
|
|
751
|
-
trailing: m[4], // empty for whitespace-only strings
|
|
752
|
-
trailingNonAscii: m[5],
|
|
753
|
-
trailingAscii: m[6]
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
function isFlankedByWhitespace (side, node, options) {
|
|
758
|
-
var sibling;
|
|
759
|
-
var regExp;
|
|
760
|
-
var isFlanked;
|
|
761
|
-
|
|
762
|
-
if (side === 'left') {
|
|
763
|
-
sibling = node.previousSibling;
|
|
764
|
-
regExp = / $/;
|
|
765
|
-
} else {
|
|
766
|
-
sibling = node.nextSibling;
|
|
767
|
-
regExp = /^ /;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
if (sibling) {
|
|
771
|
-
if (sibling.nodeType === 3) {
|
|
772
|
-
isFlanked = regExp.test(sibling.nodeValue);
|
|
773
|
-
} else if (options.preformattedCode && sibling.nodeName === 'CODE') {
|
|
774
|
-
isFlanked = false;
|
|
775
|
-
} else if (sibling.nodeType === 1 && !isBlock(sibling)) {
|
|
776
|
-
isFlanked = regExp.test(sibling.textContent);
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
return isFlanked
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
var reduce = Array.prototype.reduce;
|
|
783
|
-
var escapes = [
|
|
784
|
-
[/\\/g, '\\\\'],
|
|
785
|
-
[/\*/g, '\\*'],
|
|
786
|
-
[/^-/g, '\\-'],
|
|
787
|
-
[/^\+ /g, '\\+ '],
|
|
788
|
-
[/^(=+)/g, '\\$1'],
|
|
789
|
-
[/^(#{1,6}) /g, '\\$1 '],
|
|
790
|
-
[/`/g, '\\`'],
|
|
791
|
-
[/^~~~/g, '\\~~~'],
|
|
792
|
-
[/\[/g, '\\['],
|
|
793
|
-
[/\]/g, '\\]'],
|
|
794
|
-
[/^>/g, '\\>'],
|
|
795
|
-
[/_/g, '\\_'],
|
|
796
|
-
[/^(\d+)\. /g, '$1\\. ']
|
|
797
|
-
];
|
|
798
|
-
|
|
799
|
-
function TurndownService (options) {
|
|
800
|
-
if (!(this instanceof TurndownService)) return new TurndownService(options)
|
|
801
|
-
|
|
802
|
-
var defaults = {
|
|
803
|
-
rules: rules,
|
|
804
|
-
headingStyle: 'setext',
|
|
805
|
-
hr: '* * *',
|
|
806
|
-
bulletListMarker: '*',
|
|
807
|
-
codeBlockStyle: 'indented',
|
|
808
|
-
fence: '```',
|
|
809
|
-
emDelimiter: '_',
|
|
810
|
-
strongDelimiter: '**',
|
|
811
|
-
linkStyle: 'inlined',
|
|
812
|
-
linkReferenceStyle: 'full',
|
|
813
|
-
br: ' ',
|
|
814
|
-
preformattedCode: false,
|
|
815
|
-
blankReplacement: function (content, node) {
|
|
816
|
-
return node.isBlock ? '\n\n' : ''
|
|
817
|
-
},
|
|
818
|
-
keepReplacement: function (content, node) {
|
|
819
|
-
return node.isBlock ? '\n\n' + node.outerHTML + '\n\n' : node.outerHTML
|
|
820
|
-
},
|
|
821
|
-
defaultReplacement: function (content, node) {
|
|
822
|
-
return node.isBlock ? '\n\n' + content + '\n\n' : content
|
|
823
|
-
}
|
|
824
|
-
};
|
|
825
|
-
this.options = extend({}, defaults, options);
|
|
826
|
-
this.rules = new Rules(this.options);
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
TurndownService.prototype = {
|
|
830
|
-
/**
|
|
831
|
-
* The entry point for converting a string or DOM node to Markdown
|
|
832
|
-
* @public
|
|
833
|
-
* @param {String|HTMLElement} input The string or DOM node to convert
|
|
834
|
-
* @returns A Markdown representation of the input
|
|
835
|
-
* @type String
|
|
836
|
-
*/
|
|
837
|
-
|
|
838
|
-
turndown: function (input) {
|
|
839
|
-
if (!canConvert(input)) {
|
|
840
|
-
throw new TypeError(
|
|
841
|
-
input + ' is not a string, or an element/document/fragment node.'
|
|
842
|
-
)
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
if (input === '') return ''
|
|
846
|
-
|
|
847
|
-
var output = process.call(this, new RootNode(input, this.options));
|
|
848
|
-
return postProcess.call(this, output)
|
|
849
|
-
},
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Add one or more plugins
|
|
853
|
-
* @public
|
|
854
|
-
* @param {Function|Array} plugin The plugin or array of plugins to add
|
|
855
|
-
* @returns The Turndown instance for chaining
|
|
856
|
-
* @type Object
|
|
857
|
-
*/
|
|
858
|
-
|
|
859
|
-
use: function (plugin) {
|
|
860
|
-
if (Array.isArray(plugin)) {
|
|
861
|
-
for (var i = 0; i < plugin.length; i++) this.use(plugin[i]);
|
|
862
|
-
} else if (typeof plugin === 'function') {
|
|
863
|
-
plugin(this);
|
|
864
|
-
} else {
|
|
865
|
-
throw new TypeError('plugin must be a Function or an Array of Functions')
|
|
866
|
-
}
|
|
867
|
-
return this
|
|
868
|
-
},
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* Adds a rule
|
|
872
|
-
* @public
|
|
873
|
-
* @param {String} key The unique key of the rule
|
|
874
|
-
* @param {Object} rule The rule
|
|
875
|
-
* @returns The Turndown instance for chaining
|
|
876
|
-
* @type Object
|
|
877
|
-
*/
|
|
878
|
-
|
|
879
|
-
addRule: function (key, rule) {
|
|
880
|
-
this.rules.add(key, rule);
|
|
881
|
-
return this
|
|
882
|
-
},
|
|
883
|
-
|
|
884
|
-
/**
|
|
885
|
-
* Keep a node (as HTML) that matches the filter
|
|
886
|
-
* @public
|
|
887
|
-
* @param {String|Array|Function} filter The unique key of the rule
|
|
888
|
-
* @returns The Turndown instance for chaining
|
|
889
|
-
* @type Object
|
|
890
|
-
*/
|
|
891
|
-
|
|
892
|
-
keep: function (filter) {
|
|
893
|
-
this.rules.keep(filter);
|
|
894
|
-
return this
|
|
895
|
-
},
|
|
896
|
-
|
|
897
|
-
/**
|
|
898
|
-
* Remove a node that matches the filter
|
|
899
|
-
* @public
|
|
900
|
-
* @param {String|Array|Function} filter The unique key of the rule
|
|
901
|
-
* @returns The Turndown instance for chaining
|
|
902
|
-
* @type Object
|
|
903
|
-
*/
|
|
904
|
-
|
|
905
|
-
remove: function (filter) {
|
|
906
|
-
this.rules.remove(filter);
|
|
907
|
-
return this
|
|
908
|
-
},
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
* Escapes Markdown syntax
|
|
912
|
-
* @public
|
|
913
|
-
* @param {String} string The string to escape
|
|
914
|
-
* @returns A string with Markdown syntax escaped
|
|
915
|
-
* @type String
|
|
916
|
-
*/
|
|
917
|
-
|
|
918
|
-
escape: function (string) {
|
|
919
|
-
return escapes.reduce(function (accumulator, escape) {
|
|
920
|
-
return accumulator.replace(escape[0], escape[1])
|
|
921
|
-
}, string)
|
|
922
|
-
}
|
|
923
|
-
};
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* Reduces a DOM node down to its Markdown string equivalent
|
|
927
|
-
* @private
|
|
928
|
-
* @param {HTMLElement} parentNode The node to convert
|
|
929
|
-
* @returns A Markdown representation of the node
|
|
930
|
-
* @type String
|
|
931
|
-
*/
|
|
932
|
-
|
|
933
|
-
function process (parentNode) {
|
|
934
|
-
var self = this;
|
|
935
|
-
return reduce.call(parentNode.childNodes, function (output, node) {
|
|
936
|
-
node = new Node(node, self.options);
|
|
937
|
-
|
|
938
|
-
var replacement = '';
|
|
939
|
-
if (node.nodeType === 3) {
|
|
940
|
-
replacement = node.isCode ? node.nodeValue : self.escape(node.nodeValue);
|
|
941
|
-
} else if (node.nodeType === 1) {
|
|
942
|
-
replacement = replacementForNode.call(self, node);
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
return join(output, replacement)
|
|
946
|
-
}, '')
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* Appends strings as each rule requires and trims the output
|
|
951
|
-
* @private
|
|
952
|
-
* @param {String} output The conversion output
|
|
953
|
-
* @returns A trimmed version of the ouput
|
|
954
|
-
* @type String
|
|
955
|
-
*/
|
|
956
|
-
|
|
957
|
-
function postProcess (output) {
|
|
958
|
-
var self = this;
|
|
959
|
-
this.rules.forEach(function (rule) {
|
|
960
|
-
if (typeof rule.append === 'function') {
|
|
961
|
-
output = join(output, rule.append(self.options));
|
|
962
|
-
}
|
|
963
|
-
});
|
|
964
|
-
|
|
965
|
-
return output.replace(/^[\t\r\n]+/, '').replace(/[\t\r\n\s]+$/, '')
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
/**
|
|
969
|
-
* Converts an element node to its Markdown equivalent
|
|
970
|
-
* @private
|
|
971
|
-
* @param {HTMLElement} node The node to convert
|
|
972
|
-
* @returns A Markdown representation of the node
|
|
973
|
-
* @type String
|
|
974
|
-
*/
|
|
975
|
-
|
|
976
|
-
function replacementForNode (node) {
|
|
977
|
-
var rule = this.rules.forNode(node);
|
|
978
|
-
var content = process.call(this, node);
|
|
979
|
-
var whitespace = node.flankingWhitespace;
|
|
980
|
-
if (whitespace.leading || whitespace.trailing) content = content.trim();
|
|
981
|
-
return (
|
|
982
|
-
whitespace.leading +
|
|
983
|
-
rule.replacement(content, node, this.options) +
|
|
984
|
-
whitespace.trailing
|
|
985
|
-
)
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
/**
|
|
989
|
-
* Joins replacement to the current output with appropriate number of new lines
|
|
990
|
-
* @private
|
|
991
|
-
* @param {String} output The current conversion output
|
|
992
|
-
* @param {String} replacement The string to append to the output
|
|
993
|
-
* @returns Joined output
|
|
994
|
-
* @type String
|
|
995
|
-
*/
|
|
996
|
-
|
|
997
|
-
function join (output, replacement) {
|
|
998
|
-
var s1 = trimTrailingNewlines(output);
|
|
999
|
-
var s2 = trimLeadingNewlines(replacement);
|
|
1000
|
-
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
1001
|
-
var separator = '\n\n'.substring(0, nls);
|
|
1002
|
-
|
|
1003
|
-
return s1 + separator + s2
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
/**
|
|
1007
|
-
* Determines whether an input can be converted
|
|
1008
|
-
* @private
|
|
1009
|
-
* @param {String|HTMLElement} input Describe this parameter
|
|
1010
|
-
* @returns Describe what it returns
|
|
1011
|
-
* @type String|Object|Array|Boolean|Number
|
|
1012
|
-
*/
|
|
1013
|
-
|
|
1014
|
-
function canConvert (input) {
|
|
1015
|
-
return (
|
|
1016
|
-
input != null && (
|
|
1017
|
-
typeof input === 'string' ||
|
|
1018
|
-
(input.nodeType && (
|
|
1019
|
-
input.nodeType === 1 || input.nodeType === 9 || input.nodeType === 11
|
|
1020
|
-
))
|
|
1021
|
-
)
|
|
1022
|
-
)
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
const turndownService = new TurndownService();
|
|
1026
|
-
/**
|
|
1027
|
-
* Converts an HTML string to Markdown format, strips unnecessary Markdown tags,
|
|
1028
|
-
* and returns an array of cleaned Markdown text blocks..
|
|
1029
|
-
*
|
|
1030
|
-
* This utility function is useful for transforming HTML into Markdown and cleaning
|
|
1031
|
-
* it by removing extra or unwanted Markdown elements, resulting in an array of
|
|
1032
|
-
* plain Markdown text segments.
|
|
1033
|
-
*
|
|
1034
|
-
* @param {string} htmlString - The input HTML string to be converted and cleaned.
|
|
1035
|
-
*
|
|
1036
|
-
* @example
|
|
1037
|
-
* const htmlInput = "<h1>Hello World</h1><p>This is a paragraph.</p>";
|
|
1038
|
-
* const result = cleanHtmlMarkdown(htmlInput);
|
|
1039
|
-
* console.info(result); // Outputs cleaned HTML after conversion and processing
|
|
1040
|
-
*/
|
|
1041
|
-
const cleanHtmlMarkdown = (htmlString) => {
|
|
1042
|
-
const mdString = turndownService.turndown(htmlString);
|
|
1043
|
-
const sanitizedMdString =
|
|
1044
|
-
// remove header tags
|
|
1045
|
-
mdString.replace(/^\#+\s+/gm, '').trim();
|
|
1046
|
-
if (!sanitizedMdString) {
|
|
1047
|
-
return [];
|
|
1048
|
-
}
|
|
1049
|
-
const mdBlocks = sanitizedMdString.split(/[\n\r]+/gm);
|
|
1050
|
-
return mdBlocks;
|
|
1051
|
-
};
|
|
1052
|
-
|
|
1053
22
|
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}";
|
|
1054
23
|
const ZonosCartItemsStyle0 = zonosCartItemsCss;
|
|
1055
24
|
|
|
@@ -1743,44 +712,6 @@ const ZonosCheckoutFooter = class {
|
|
|
1743
712
|
};
|
|
1744
713
|
ZonosCheckoutFooter.style = ZonosCheckoutFooterStyle0;
|
|
1745
714
|
|
|
1746
|
-
const placeTestOrder = async () => {
|
|
1747
|
-
var _a, _b;
|
|
1748
|
-
const shipToPartyId = (_a = cartStore.partiesData.find(party => party.type === 'DESTINATION')) === null || _a === void 0 ? void 0 : _a.id;
|
|
1749
|
-
const billToPartyId = (_b = cartStore.partiesData.find(party => party.type === 'PAYOR')) === null || _b === void 0 ? void 0 : _b.id;
|
|
1750
|
-
const checkoutSessionId = storageStore.checkoutSessionId;
|
|
1751
|
-
if (!checkoutSessionId || !billToPartyId || !shipToPartyId) {
|
|
1752
|
-
logError('Missing required data', {
|
|
1753
|
-
billToPartyId,
|
|
1754
|
-
checkoutSessionId,
|
|
1755
|
-
shipToPartyId,
|
|
1756
|
-
});
|
|
1757
|
-
return {
|
|
1758
|
-
errors: ['Missing required data'],
|
|
1759
|
-
json: null,
|
|
1760
|
-
};
|
|
1761
|
-
}
|
|
1762
|
-
const payload = {
|
|
1763
|
-
billToPartyId,
|
|
1764
|
-
checkoutSessionId,
|
|
1765
|
-
shipToPartyId,
|
|
1766
|
-
};
|
|
1767
|
-
const { errors, json } = await handleFetch('/api/zonos-elements/place-test-order', {
|
|
1768
|
-
body: payload,
|
|
1769
|
-
method: 'POST',
|
|
1770
|
-
});
|
|
1771
|
-
if (errors.length || !json) {
|
|
1772
|
-
logError('Error occurs when placing test order', errors);
|
|
1773
|
-
return {
|
|
1774
|
-
errors: errors.map(error => error.message),
|
|
1775
|
-
json: null,
|
|
1776
|
-
};
|
|
1777
|
-
}
|
|
1778
|
-
return {
|
|
1779
|
-
errors: [],
|
|
1780
|
-
json,
|
|
1781
|
-
};
|
|
1782
|
-
};
|
|
1783
|
-
|
|
1784
715
|
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>`;
|
|
1785
716
|
|
|
1786
717
|
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>`;
|
|
@@ -1906,6 +837,9 @@ const ZonosCheckoutPayment = class {
|
|
|
1906
837
|
if (!stripeStore.stripeElements) {
|
|
1907
838
|
return null;
|
|
1908
839
|
}
|
|
840
|
+
if (!stripeStore.clientSecret && !cartStore.isStagingMode) {
|
|
841
|
+
return null;
|
|
842
|
+
}
|
|
1909
843
|
// start validate on typing after error banner is shown, and hide it if the form is complete
|
|
1910
844
|
if (this.showErrorBanner) {
|
|
1911
845
|
this.showErrorBanner = !this.handleValidate();
|
|
@@ -2087,156 +1021,23 @@ const ZonosCheckoutProgressTabs = class {
|
|
|
2087
1021
|
color: labelSelectedColor,
|
|
2088
1022
|
})
|
|
2089
1023
|
: labelSelectedColor;
|
|
2090
|
-
return (h(Host, { key: '
|
|
1024
|
+
return (h(Host, { key: 'bf2f6ea302aafa40c5b1a763b89bffc47389b7ac', class: "zonos--elements", style: {
|
|
2091
1025
|
'--zonos--color': contrastLabelColor,
|
|
2092
1026
|
'--zonos--progress-percent': this.getTotalSuccessStep(),
|
|
2093
|
-
} }, h("div", { key: '
|
|
1027
|
+
} }, h("div", { key: '043adfc8805b027604880284a99148c9ea06e67b', class: "zonos--tab-wrapper" }, Object.values(cartStore.tabItems).map((tab, index) => {
|
|
2094
1028
|
const isSelected = tab.value === selectedStep;
|
|
2095
1029
|
return (h("button", { "aria-label": `Tab ${tab.label}`, class: classes([
|
|
2096
1030
|
'zonos--tab-item',
|
|
2097
1031
|
tab.value === selectedStep && 'selected',
|
|
2098
1032
|
tab.isDone && 'done',
|
|
2099
1033
|
]), disabled: !this.isTabClickable(tab.value), key: tab.value, onClick: () => this.setTabSelected(tab.value) }, h("div", { class: "zonos--tab-index" }, h("zonos-text", { class: "zonos--tab-index-label", textColor: isSelected ? contrastLabelColor : 'gray-1000', type: "label" }, index + 1), h("zonos-icon", { class: "zonos--tab-index-done-icon", content: TabCheckmark, iconColor: isSelected ? contrastLabelColor : 'gray-1000' })), h("zonos-text", { textColor: isSelected ? contrastLabelColor : 'gray-1000', type: "label" }, translate(tab.label))));
|
|
2100
|
-
})), h("div", { key: '
|
|
1034
|
+
})), h("div", { key: '991d64c7d79e4e4207e395ec8a3b9b2096e51c6a', class: "zonos--tab-progress" }, h("div", { key: '22471019b9e920af6d35976dd71b0954cc785b62', class: "zonos--progress-bar-fill" }))));
|
|
2101
1035
|
}
|
|
2102
1036
|
static get assetsDirs() { return ["assets"]; }
|
|
2103
1037
|
get ele() { return getElement(this); }
|
|
2104
1038
|
};
|
|
2105
1039
|
ZonosCheckoutProgressTabs.style = ZonosCheckoutProgressTabsStyle0;
|
|
2106
1040
|
|
|
2107
|
-
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;">
|
|
2108
|
-
<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>
|
|
2109
|
-
<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>
|
|
2110
|
-
</svg>`;
|
|
2111
|
-
|
|
2112
|
-
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;">
|
|
2113
|
-
<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>
|
|
2114
|
-
<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>
|
|
2115
|
-
</svg>`;
|
|
2116
|
-
|
|
2117
|
-
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;">
|
|
2118
|
-
<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>
|
|
2119
|
-
<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>
|
|
2120
|
-
</svg>`;
|
|
2121
|
-
|
|
2122
|
-
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)}";
|
|
2123
|
-
const ZonosConfirmDialogStyle0 = zonosConfirmDialogCss;
|
|
2124
|
-
|
|
2125
|
-
const ZonosConfirmDialog = class {
|
|
2126
|
-
constructor(hostRef) {
|
|
2127
|
-
registerInstance(this, hostRef);
|
|
2128
|
-
this.confirmClicked = createEvent(this, "confirmClicked", 7);
|
|
2129
|
-
this.cancelClicked = createEvent(this, "cancelClicked", 7);
|
|
2130
|
-
/**
|
|
2131
|
-
* Dialog title text
|
|
2132
|
-
* @default "Are you sure?"
|
|
2133
|
-
*/
|
|
2134
|
-
this.dialogTitle = translate('Are you sure?');
|
|
2135
|
-
/**
|
|
2136
|
-
* Dialog intent (for icon and button color)
|
|
2137
|
-
* @default "info"
|
|
2138
|
-
*/
|
|
2139
|
-
this.dialogIntent = 'info';
|
|
2140
|
-
/**
|
|
2141
|
-
* Dialog subtitle text
|
|
2142
|
-
* @default null No subtitle
|
|
2143
|
-
*/
|
|
2144
|
-
this.dialogSubtitle = null;
|
|
2145
|
-
/**
|
|
2146
|
-
* Dialog width
|
|
2147
|
-
* @default 350 px
|
|
2148
|
-
*/
|
|
2149
|
-
this.dialogWidth = 350;
|
|
2150
|
-
/**
|
|
2151
|
-
* Type of dialog
|
|
2152
|
-
* - "alert" - Only confirm button
|
|
2153
|
-
* - "confirm" - Both Confirm and cancel buttons
|
|
2154
|
-
* @default "confirm"
|
|
2155
|
-
*/
|
|
2156
|
-
this.dialogType = 'confirm';
|
|
2157
|
-
/**
|
|
2158
|
-
* Whether or not the dialog is open
|
|
2159
|
-
*/
|
|
2160
|
-
this.isMobile = false;
|
|
2161
|
-
/**
|
|
2162
|
-
* Whether or not to close the dialog when clicking outside of it
|
|
2163
|
-
* @default false
|
|
2164
|
-
*/
|
|
2165
|
-
this.noClickOutside = false;
|
|
2166
|
-
this.clickOutsideDialogHandler = (event) => {
|
|
2167
|
-
if (event.target === event.currentTarget && !this.noClickOutside) {
|
|
2168
|
-
this.closeDialogHandler();
|
|
2169
|
-
}
|
|
2170
|
-
};
|
|
2171
|
-
}
|
|
2172
|
-
handleKeyDown(ev) {
|
|
2173
|
-
if (ev.key === 'Escape') {
|
|
2174
|
-
this.closeDialogHandler();
|
|
2175
|
-
}
|
|
2176
|
-
}
|
|
2177
|
-
focusDialog() {
|
|
2178
|
-
if (this.dialogOpen) {
|
|
2179
|
-
setTimeout(() => {
|
|
2180
|
-
var _a, _b;
|
|
2181
|
-
// Focus on a non tabable element (tabIndex=-1), so we will be able to tab to other tabable elements
|
|
2182
|
-
(_b = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.zonos--backdrop')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
2183
|
-
}, 100);
|
|
2184
|
-
}
|
|
2185
|
-
}
|
|
2186
|
-
confirmDialogHandler() {
|
|
2187
|
-
// Only do the action if the dialog is open
|
|
2188
|
-
if (!this.dialogOpen) {
|
|
2189
|
-
return;
|
|
2190
|
-
}
|
|
2191
|
-
// Emit confirm event
|
|
2192
|
-
this.confirmClicked.emit();
|
|
2193
|
-
}
|
|
2194
|
-
closeDialogHandler() {
|
|
2195
|
-
// Only do the action if the dialog is open
|
|
2196
|
-
if (!this.dialogOpen) {
|
|
2197
|
-
return;
|
|
2198
|
-
}
|
|
2199
|
-
// Emit cancel event
|
|
2200
|
-
this.cancelClicked.emit();
|
|
2201
|
-
}
|
|
2202
|
-
renderIcon() {
|
|
2203
|
-
switch (this.dialogIntent) {
|
|
2204
|
-
case 'info':
|
|
2205
|
-
return (h("zonos-icon", { content: HelpDuotoneIcon, iconColor: 'blue-800' }));
|
|
2206
|
-
case 'danger':
|
|
2207
|
-
return (h("zonos-icon", { content: ExclamationMarkDuotoneIcon, iconColor: 'red-800' }));
|
|
2208
|
-
case 'warn':
|
|
2209
|
-
return (h("zonos-icon", { content: WarningDuotoneIcon, iconColor: 'orange-800' }));
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
getButtonConfirmVariant() {
|
|
2213
|
-
switch (this.dialogIntent) {
|
|
2214
|
-
case 'warn':
|
|
2215
|
-
return 'warning';
|
|
2216
|
-
case 'danger':
|
|
2217
|
-
return 'danger';
|
|
2218
|
-
default:
|
|
2219
|
-
return 'primary';
|
|
2220
|
-
}
|
|
2221
|
-
}
|
|
2222
|
-
render() {
|
|
2223
|
-
this.focusDialog();
|
|
2224
|
-
const borderStyle = getBorderRadius();
|
|
2225
|
-
// Get theme for the update dialog, inherit from the theme, no from this component theme
|
|
2226
|
-
const theme = getZonosStoreTheme(zonosStore.appearance.theme);
|
|
2227
|
-
return (h(Host, { key: '3d4920dacf3c4b1ae796b10a3d68dc875cbe4267', class: classes([this.dialogOpen && 'open', 'zonos--elements']), "data-dialog-type": this.dialogType, "data-theme": theme, style: {
|
|
2228
|
-
'--zonos--border-radius': borderStyle,
|
|
2229
|
-
'--zonos--dialog-width': `${this.dialogWidth}px`,
|
|
2230
|
-
'--zonos--font-family': zonosStoreFontFamily(),
|
|
2231
|
-
} }, h("div", { key: 'e2b1358dedfb3e5a3dc42099330be1d3bb6845e5', class: "zonos--backdrop", tabIndex: -1 }), h("div", { key: 'f4cf0ddf4ee1695bef503809a810710902c2e810', class: classes(['zonos--confirm-layout', this.dialogIntent]), onClick: e => this.clickOutsideDialogHandler(e) }, h("div", { key: 'a8910f985165f18399e628b05b5075d04487007b', class: "zonos--confirm-dialog", onBlur: () => {
|
|
2232
|
-
this.focusDialog();
|
|
2233
|
-
} }, h("div", { key: '723b4753614273bafe03488cdc5eb7a2a14cfb2c', class: "wrapper" }, h("div", { key: '53faf2cbdcec3acdff25f8471a37afdfb4298ef3', class: "icon-wrapper" }, this.renderIcon()), h("div", { key: '8e6ee33eb8ee48acb99066ce964b52e81086176f', class: "content" }, h("div", { key: '6c800bbc27a2e62756b20068b97e5777ebf5fbb2', class: "title" }, h("zonos-text", { key: '7bcad323167f954ae83c9afd7c4473efc5e32c37', type: "subheader" }, this.dialogTitle)), this.dialogSubtitle && (h("div", { key: '85ffc3c1492dd432953bc645103590bacd9a3912', class: "subtitle" }, h("zonos-text", { key: 'f7e859f0c8256ead95db3d74b78b50fe6ea84700', textColor: "gray-800" }, this.dialogSubtitle)))), h("div", { key: 'c35405667155231fb6037147ac35d0c1f5ed0dd0', class: "footer" }, this.dialogType === 'confirm' && (h("zonos-button", { key: '082731ae55230c6fe05307871ef5e6a124616e33', backgroundColor: "gray-0", class: "cancel-button", onClick: () => this.closeDialogHandler(), size: "lg", withBoxShadow: true }, this.dialogCancelBtnText || translate('Cancel'))), h("zonos-button", { key: '4873b0e88c691197104b95658fc00940d97d44b9', class: "confirm-button", onClick: () => this.confirmDialogHandler(), size: "lg", variant: this.getButtonConfirmVariant() }, this.dialogConfirmBtnText)))))));
|
|
2234
|
-
}
|
|
2235
|
-
static get assetsDirs() { return ["assets"]; }
|
|
2236
|
-
get el() { return getElement(this); }
|
|
2237
|
-
};
|
|
2238
|
-
ZonosConfirmDialog.style = ZonosConfirmDialogStyle0;
|
|
2239
|
-
|
|
2240
1041
|
const ZonosCurrencyToggle = class {
|
|
2241
1042
|
constructor(hostRef) {
|
|
2242
1043
|
registerInstance(this, hostRef);
|
|
@@ -2749,28 +1550,6 @@ const ZonosCustomerInfo = class {
|
|
|
2749
1550
|
};
|
|
2750
1551
|
ZonosCustomerInfo.style = ZonosCustomerInfoStyle0;
|
|
2751
1552
|
|
|
2752
|
-
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}";
|
|
2753
|
-
const ZonosLoadingOverlayStyle0 = zonosLoadingOverlayCss;
|
|
2754
|
-
|
|
2755
|
-
const ZonosLoadingOverlay = class {
|
|
2756
|
-
constructor(hostRef) {
|
|
2757
|
-
registerInstance(this, hostRef);
|
|
2758
|
-
/**
|
|
2759
|
-
* Whether or not the overlay is open
|
|
2760
|
-
* @default false
|
|
2761
|
-
*/
|
|
2762
|
-
this.open = false;
|
|
2763
|
-
/**
|
|
2764
|
-
* Spinner size (optional, default 40)
|
|
2765
|
-
*/
|
|
2766
|
-
this.size = 40;
|
|
2767
|
-
}
|
|
2768
|
-
render() {
|
|
2769
|
-
return (h(Host, { key: 'eff20c3fe4c4a998748ac07567cc5449efc398cd', class: classes(['zonos--elements', this.open && 'zonos--open']) }, h("div", { key: '1b37bfc1a150720e0f4f84075ac661e5395aee3b', class: "zonos--loading-overlay" }, h("zonos-spinner", { key: '42ac91e723802b23897b6e5cd99e0aea7d964da5', size: this.size, spinnerColor: this.spinnerColor }))));
|
|
2770
|
-
}
|
|
2771
|
-
};
|
|
2772
|
-
ZonosLoadingOverlay.style = ZonosLoadingOverlayStyle0;
|
|
2773
|
-
|
|
2774
1553
|
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}";
|
|
2775
1554
|
const ZonosRestStateStyle0 = zonosRestStateCss;
|
|
2776
1555
|
|
|
@@ -2788,11 +1567,11 @@ const ZonosRestState = class {
|
|
|
2788
1567
|
}
|
|
2789
1568
|
render() {
|
|
2790
1569
|
const imageUrl = this.getImageRestState();
|
|
2791
|
-
return (h(Host, { key: '
|
|
1570
|
+
return (h(Host, { key: '1259c56e28646e85893b129c22402e9d7cfe18f8', class: classes(['zonos--elements zonos--restState']), style: {
|
|
2792
1571
|
'--zonos--font-family': zonosStoreFontFamily(),
|
|
2793
|
-
} }, h("div", { key: '
|
|
1572
|
+
} }, h("div", { key: '3cba2e86f4952f5d2a171017ad1f6eaa62aacc6a', class: "zonos--restState-image" }, h("img", { key: '8f656c89ef030c1eddec8cd95d6a15df889c6ed2', alt: this.restStateType, onError: () => {
|
|
2794
1573
|
this.isErrorImageLoad = true;
|
|
2795
|
-
}, src: imageUrl })), h("div", { key: '
|
|
1574
|
+
}, src: imageUrl })), h("div", { key: '963cf06ac769d8b3bfeb7b36824cb1b6821b5498', class: "content" }, h("zonos-text", { key: 'dacc2d0c125d41e5a72c57a5b611789bb005fc46', class: "title", type: "boldSubheader" }, this.restStateTitle), h("zonos-text", { key: '32db4bc138b4cc6c5fab3fd6aa14b51c31ffaf80', class: "subtitle" }, this.restStateSubtitle)), h("div", { key: '28f933f06737ac076d2da9dcc1530f01ddb93575', class: "action" }, h("slot", { key: 'd974a157a01c4e2305255fc4032868e86af162b5' }))));
|
|
2796
1575
|
}
|
|
2797
1576
|
static get assetsDirs() { return ["assets"]; }
|
|
2798
1577
|
};
|
|
@@ -2925,7 +1704,11 @@ const ZonosShipping = class {
|
|
|
2925
1704
|
// update the address async if we already got landed cost data
|
|
2926
1705
|
await stripeStoreAsyncAddressUpdate();
|
|
2927
1706
|
// save selected shipping option to store
|
|
2928
|
-
await cartStoreUpdateSelectedShippingOption(
|
|
1707
|
+
await cartStoreUpdateSelectedShippingOption({
|
|
1708
|
+
applySubtotalsOnly: false,
|
|
1709
|
+
landedCostId: e.detail.landedCostId,
|
|
1710
|
+
selectedShippingOption,
|
|
1711
|
+
});
|
|
2929
1712
|
this.isSelecting = false;
|
|
2930
1713
|
};
|
|
2931
1714
|
this.handleValidate = () => {
|
|
@@ -3112,4 +1895,4 @@ const ZonosShipping = class {
|
|
|
3112
1895
|
};
|
|
3113
1896
|
ZonosShipping.style = ZonosShippingStyle0;
|
|
3114
1897
|
|
|
3115
|
-
export { ZonosCartItems as zonos_cart_items, ZonosCartRestrictedItems as zonos_cart_restricted_items, ZonosCartSubtotal as zonos_cart_subtotal, ZonosCheckoutFinish as zonos_checkout_finish, ZonosCheckoutFooter as zonos_checkout_footer, ZonosCheckoutPayment as zonos_checkout_payment, ZonosCheckoutProgressTabs as zonos_checkout_progress_tabs,
|
|
1898
|
+
export { ZonosCartItems as zonos_cart_items, ZonosCartRestrictedItems as zonos_cart_restricted_items, ZonosCartSubtotal as zonos_cart_subtotal, ZonosCheckoutFinish as zonos_checkout_finish, ZonosCheckoutFooter as zonos_checkout_footer, ZonosCheckoutPayment as zonos_checkout_payment, ZonosCheckoutProgressTabs as zonos_checkout_progress_tabs, ZonosCurrencyToggle as zonos_currency_toggle, ZonosCustomerInfo as zonos_customer_info, ZonosRestState as zonos_rest_state, ZonosReview as zonos_review, ZonosShipping as zonos_shipping };
|