@zonos/elements 1.3.81 → 1.3.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart-97e693e4.js → cart-4de3faca.js} +798 -74
- package/dist/cjs/{createCustomEvent-777b3fa7.js → createCustomEvent-65331eae.js} +1 -3
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-16029169.js → paypal-370b3a10.js} +1 -1
- package/dist/cjs/{zonos-address_8.cjs.entry.js → zonos-address_7.cjs.entry.js} +9 -64
- package/dist/cjs/zonos-badge.cjs.entry.js +44 -0
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card.cjs.entry.js +4 -4
- package/dist/cjs/{zonos-badge_13.cjs.entry.js → zonos-cart-items_12.cjs.entry.js} +135 -80
- package/dist/cjs/zonos-checkout.cjs.entry.js +5 -5
- package/dist/cjs/zonos-collapse.cjs.entry.js +62 -0
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +9 -9
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -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-notification_3.cjs.entry.js +4 -4
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +1 -11
- package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.css +10 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +89 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +5 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +3 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/assets/ChevronUpIcon.svg +23 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +55 -9
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +52 -12
- package/dist/collection/components/common/zonos-badge/assets/RemoveLineIcon.svg +3 -0
- package/dist/collection/components/common/zonos-badge/zonos-badge.css +3 -0
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +43 -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 +8 -7
- 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 +2 -2
- 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-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-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-shipping-rich-radio/zonos-shipping-rich-radio.js +20 -27
- 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 +1 -1
- package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
- package/dist/collection/components/store/checkout/cart.js +45 -11
- package/dist/collection/components/store/checkout/stripe.js +119 -65
- package/dist/collection/components/store/translationStore/strings.arabic.js +30 -0
- package/dist/collection/components/store/translationStore/strings.base.js +30 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +30 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +30 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +30 -0
- package/dist/collection/components/store/translationStore/strings.french.js +30 -0
- package/dist/collection/components/store/translationStore/strings.german.js +30 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +30 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +30 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +30 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +30 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +30 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +30 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +30 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +30 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +30 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +30 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +30 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +30 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +30 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -1
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js +22 -0
- package/dist/collection/components/utils/api/trackConversionEvent.js +0 -2
- package/dist/collection/components/utils/api/triggerBuildLandedCost.js +1 -0
- package/dist/collection/components/utils/checkout/{sortServiceLevelOptions.js → sortServiceLevelOptionsByAmount.js} +1 -1
- package/dist/collection/components/utils/hello/currencyConversion/currencyFormat.js +1 -1
- package/dist/esm/{cart-9bf6dece.js → cart-bdc45f59.js} +795 -75
- package/dist/esm/{createCustomEvent-a18e45a2.js → createCustomEvent-4db13122.js} +1 -3
- package/dist/esm/index.js +7 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-edab4cee.js → paypal-1b29d424.js} +1 -1
- package/dist/esm/{zonos-address_8.entry.js → zonos-address_7.entry.js} +10 -64
- package/dist/esm/zonos-badge.entry.js +40 -0
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card.entry.js +4 -4
- package/dist/esm/{zonos-badge_13.entry.js → zonos-cart-items_12.entry.js} +137 -81
- package/dist/esm/zonos-checkout.entry.js +5 -5
- package/dist/esm/zonos-collapse.entry.js +58 -0
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +9 -9
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +5 -5
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-input.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +5 -5
- package/dist/esm/zonos-link.entry.js +1 -1
- package/dist/esm/zonos-logo.entry.js +2 -2
- package/dist/esm/zonos-notification_3.entry.js +4 -4
- package/dist/esm/zonos-shipping-rich-radio.entry.js +1 -11
- package/dist/esm/zonos-tooltip.entry.js +2 -2
- package/dist/esm/zonos-v-stack.entry.js +2 -2
- package/dist/esm-es5/cart-bdc45f59.js +1 -0
- package/dist/esm-es5/{createCustomEvent-a18e45a2.js → createCustomEvent-4db13122.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-edab4cee.js → paypal-1b29d424.js} +1 -1
- package/dist/esm-es5/zonos-address_7.entry.js +1 -0
- package/dist/esm-es5/zonos-badge.entry.js +1 -0
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card.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 -0
- package/dist/esm-es5/zonos-component.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-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-notification_3.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.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 +542 -494
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.d.ts +12 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.d.ts +4 -1
- package/dist/types/components/common/zonos-badge/zonos-badge.d.ts +9 -0
- package/dist/types/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.d.ts +2 -6
- package/dist/types/components/store/checkout/cart.d.ts +16 -7
- package/dist/types/components/store/checkout/stripe.d.ts +12 -2
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +30 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +30 -0
- package/dist/types/components/store/translationStore.d.ts +1 -1
- package/dist/types/components/utils/api/triggerBuildLandedCost.d.ts +1 -0
- package/dist/types/components/utils/checkout/sortServiceLevelOptionsByAmount.d.ts +6 -0
- package/dist/types/components.d.ts +44 -8
- package/dist/types/types/checkout/api/CalculateLandedCost.d.ts +2 -0
- package/dist/types/types/generated/graphql.internal.types.d.ts +12 -0
- package/dist/types/types/generated/graphql.internal.types.ts +9 -0
- package/dist/zonos-elements/assets/ChevronUpIcon.svg +23 -1
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-8cbbdd53.system.entry.js → p-00bb8221.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e468f85e.entry.js → p-017bf338.entry.js} +1 -1
- package/dist/zonos-elements/{p-1b8c8e0c.system.entry.js → p-01d11845.system.entry.js} +1 -1
- package/dist/zonos-elements/p-0cc8c6a3.system.js +1 -0
- package/dist/zonos-elements/p-1a92ff9a.system.entry.js +1 -0
- package/dist/zonos-elements/{p-92ba4082.system.entry.js → p-2140ccb4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8dae668f.system.entry.js → p-2183128a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1e4f7997.system.entry.js → p-22e81fee.system.entry.js} +1 -1
- package/dist/zonos-elements/p-278d61ed.js +1 -0
- package/dist/zonos-elements/p-2b60faf8.entry.js +1 -0
- package/dist/zonos-elements/p-2d2ff962.entry.js +1 -0
- package/dist/zonos-elements/{p-bc4a147d.entry.js → p-3347e142.entry.js} +1 -1
- package/dist/zonos-elements/{p-811ed9bf.system.entry.js → p-3457c5e8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2a47d2cc.system.entry.js → p-38886017.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-41f42a5c.entry.js → p-42636c5a.entry.js} +1 -1
- package/dist/zonos-elements/p-4abca0e9.system.entry.js +1 -0
- package/dist/zonos-elements/{p-e3cb74fd.system.js → p-4ec7afc5.system.js} +1 -1
- package/dist/zonos-elements/{p-25633055.entry.js → p-58832515.entry.js} +1 -1
- package/dist/zonos-elements/{p-19fc5e11.system.entry.js → p-5d186fc7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-a2fedd1c.entry.js → p-5fb337a0.entry.js} +1 -1
- package/dist/zonos-elements/{p-f3fc05a8.entry.js → p-6a5d714a.entry.js} +1 -1
- package/dist/zonos-elements/{p-fca6f444.entry.js → p-6a83b682.entry.js} +1 -1
- package/dist/zonos-elements/{p-97f0d9d2.entry.js → p-6aa35f18.entry.js} +1 -1
- package/dist/zonos-elements/{p-a3200d5c.entry.js → p-771e2623.entry.js} +1 -1
- package/dist/zonos-elements/{p-7ca0622f.js → p-7cc5e325.js} +1 -1
- package/dist/zonos-elements/p-7f3aeb53.system.entry.js +1 -0
- package/dist/zonos-elements/p-844ec9f9.system.entry.js +1 -0
- package/dist/zonos-elements/p-9931bea7.system.entry.js +1 -0
- package/dist/zonos-elements/{p-7be7bd28.entry.js → p-997c8f07.entry.js} +1 -1
- package/dist/zonos-elements/{p-fac38f60.entry.js → p-9b911f6f.entry.js} +1 -1
- package/dist/zonos-elements/{p-95f0ffd1.system.entry.js → p-9cfa3736.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-49478dba.system.js → p-a1fa0a1c.system.js} +1 -1
- package/dist/zonos-elements/{p-df4deb97.entry.js → p-a34f0674.entry.js} +1 -1
- package/dist/zonos-elements/{p-d26d827d.system.js → p-a6cff57f.system.js} +1 -1
- package/dist/zonos-elements/{p-a3e2592b.system.entry.js → p-ae7526a2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6de38759.entry.js → p-afad2fae.entry.js} +1 -1
- package/dist/zonos-elements/{p-264fbd27.entry.js → p-b0303b0e.entry.js} +1 -1
- package/dist/zonos-elements/{p-a033685e.system.entry.js → p-c2b7b670.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d775bd42.entry.js → p-c6350880.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/p-ce41cbde.js +1 -0
- package/dist/zonos-elements/p-cec3e1ed.entry.js +1 -0
- package/dist/zonos-elements/{p-ba05f1d6.system.entry.js → p-d621f462.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f7b5ae86.system.entry.js → p-e3df5ff6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f4765417.entry.js → p-e93b511f.entry.js} +1 -1
- package/dist/zonos-elements/{p-747eed39.entry.js → p-ea68ee1f.entry.js} +1 -1
- package/dist/zonos-elements/{p-51f8c3d5.system.entry.js → p-f1d043ad.system.entry.js} +1 -1
- package/dist/zonos-elements/p-f1e452e1.entry.js +1 -0
- package/dist/zonos-elements/{p-de93cc65.system.entry.js → p-f68c38d8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d56f87ab.system.entry.js → p-f7bbdd0c.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-9bf6dece.js +0 -1
- package/dist/esm-es5/zonos-address_8.entry.js +0 -1
- package/dist/esm-es5/zonos-badge_13.entry.js +0 -1
- package/dist/types/components/utils/checkout/sortServiceLevelOptions.d.ts +0 -5
- package/dist/zonos-elements/p-214724f8.system.entry.js +0 -1
- package/dist/zonos-elements/p-23358611.js +0 -1
- package/dist/zonos-elements/p-62044821.system.js +0 -1
- package/dist/zonos-elements/p-6b4fec5a.js +0 -1
- package/dist/zonos-elements/p-6f821997.entry.js +0 -1
- package/dist/zonos-elements/p-a1c5c1a2.entry.js +0 -1
- package/dist/zonos-elements/p-d08ed3ea.system.entry.js +0 -1
- package/dist/zonos-elements/p-f4667002.system.entry.js +0 -1
|
@@ -1,19 +1,59 @@
|
|
|
1
1
|
import { Fragment, h, Host } from "@stencil/core";
|
|
2
2
|
import { cartStore, cartStoreHasOneEligibleItem, } from "../../../store/checkout/cart";
|
|
3
|
+
import { stripeStoreApplyPromoCode, stripeStoreRemovePromoCode, } from "../../../store/checkout/stripe";
|
|
3
4
|
import { translate } from "../../../store/translationStore";
|
|
4
5
|
import { currencyFormat } from "../../../utils/hello/currencyConversion/currencyFormat";
|
|
5
6
|
export class ZonosCartSubtotal {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.submitBtnType = undefined;
|
|
9
|
+
this.submitBtnColor = undefined;
|
|
10
|
+
this.loading = false;
|
|
11
|
+
}
|
|
6
12
|
render() {
|
|
13
|
+
var _a, _b, _c, _d, _e;
|
|
7
14
|
const showDutyTaxesInfo = cartStore.step === 'payment' || cartStore.step === 'shipping';
|
|
8
15
|
// Show 0 for subtotal and total when all items are restricted
|
|
9
16
|
const total = cartStoreHasOneEligibleItem() ? cartStore.total : 0;
|
|
10
17
|
const subtotal = cartStoreHasOneEligibleItem() ? cartStore.subtotal : 0;
|
|
18
|
+
const appliedPromoCode = (_e = (_d = (_c = (_b = (_a = cartStore.landedCostData) === null || _a === void 0 ? void 0 : _a.find(Boolean)) === null || _b === void 0 ? void 0 : _b.landedCost.appliedAdjustments) === null || _c === void 0 ? void 0 : _c.find(x => { var _a; return ((_a = x.adjustment) === null || _a === void 0 ? void 0 : _a.source) === 'PROMO_CODE'; })) === null || _d === void 0 ? void 0 : _d.adjustment) === null || _e === void 0 ? void 0 : _e.name;
|
|
19
|
+
const applyPromoCode = async () => {
|
|
20
|
+
// Promo code apply button is clicked
|
|
21
|
+
cartStore.promoCodeApplied = true;
|
|
22
|
+
// Reset promo code highlight error state
|
|
23
|
+
cartStore.promoCodeError = false;
|
|
24
|
+
this.loading = true;
|
|
25
|
+
await stripeStoreApplyPromoCode();
|
|
26
|
+
this.loading = false;
|
|
27
|
+
};
|
|
28
|
+
const removePromoCode = async () => {
|
|
29
|
+
// Reset promo code highlight error state
|
|
30
|
+
cartStore.promoCodeError = false;
|
|
31
|
+
this.loading = true;
|
|
32
|
+
await stripeStoreRemovePromoCode();
|
|
33
|
+
this.loading = false;
|
|
34
|
+
};
|
|
11
35
|
const renderShippingInfo = () => {
|
|
12
36
|
if (!cartStore.selectedShippingOption) {
|
|
13
37
|
return (h(Fragment, null, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Shipping')), h("zonos-text", { class: "zonos--caption", type: "caption" }, translate('No shipping method selected'))));
|
|
14
38
|
}
|
|
15
39
|
return (h(Fragment, null, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cartStore.selectedShippingOption.displayName), cartStore.selectedShippingOptionTransitTime && (h("zonos-text", { class: "zonos--caption", type: "caption" }, cartStore.selectedShippingOptionTransitTime))));
|
|
16
40
|
};
|
|
41
|
+
const renderLandedCost = () => {
|
|
42
|
+
if (cartStore.landedCostMethod === 'DAP') {
|
|
43
|
+
return (h(Fragment, null, h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), cartStore.dutiesTaxesFeesEstimate
|
|
44
|
+
? `${translate('Estimated')} ${currencyFormat({
|
|
45
|
+
amount: cartStore.dutiesTaxesFeesEstimate,
|
|
46
|
+
currency: cartStore.currency,
|
|
47
|
+
})}`
|
|
48
|
+
: '-'), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("div", { class: "zonos--cart-duty-tax-price" }, translate('Due at delivery')))));
|
|
49
|
+
}
|
|
50
|
+
return (h(Fragment, null, h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), h("zonos-text", { class: "zonos--caption", type: "caption" }, translate('Nothing due at the door'))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("div", { class: "zonos--cart-duty-tax-price" }, cartStore.dutiesTaxesFees
|
|
51
|
+
? currencyFormat({
|
|
52
|
+
amount: cartStore.dutiesTaxesFees,
|
|
53
|
+
currency: cartStore.currency,
|
|
54
|
+
})
|
|
55
|
+
: '-'))));
|
|
56
|
+
};
|
|
17
57
|
return (h(Host, { class: "zonos--cart-subtotal zonos--elements" }, h("table", { class: "zonos--cart-table" }, h("tr", { class: "zonos--row zonos--cart-subtotal" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { type: "semiBoldLabel" }, translate('Cart subtotal'))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
|
|
18
58
|
amount: subtotal,
|
|
19
59
|
currency: cartStore.currency,
|
|
@@ -22,12 +62,7 @@ export class ZonosCartSubtotal {
|
|
|
22
62
|
amount: cartStore.shipping,
|
|
23
63
|
currency: cartStore.currency,
|
|
24
64
|
})
|
|
25
|
-
: '-')), showDutyTaxesInfo && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("
|
|
26
|
-
? currencyFormat({
|
|
27
|
-
amount: cartStore.dutiesTaxFees,
|
|
28
|
-
currency: cartStore.currency,
|
|
29
|
-
})
|
|
30
|
-
: '-')))), !!cartStore.adjustmentTotal && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("div", { class: "zonos--title-with-icon" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Discounts')))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
|
|
65
|
+
: '-')), showDutyTaxesInfo && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), renderLandedCost())), cartStore.step !== 'customer-info' && (h("tr", { class: "zonos--row zonos--cart-promo-code" }, h("td", { class: "zonos--column" }), !!appliedPromoCode ? (h(Fragment, null, h("td", { class: "zonos--column zonos--cart-promo-code-col" }, this.loading ? (h("zonos-spinner", { size: 16 })) : (h("zonos-badge", { dismissHandler: () => removePromoCode() }, cartStore.promoCode))), h("td", { class: "zonos--column zonos--cart-promo-code-col" }))) : (h("td", { class: "zonos--column zonos--cart-promo-code-col", colSpan: 2 }, h("div", { class: "zonos--cart-promo-code-input-wrapper" }, h("zonos-input", { class: "zonos--cart-promo-code-input", inputLabel: translate('Add promotional code'), inputValue: cartStore.promoCode, isError: cartStore.promoCodeError, onInputChange: e => (cartStore.promoCode = e.detail.trim()) }), h("zonos-button", { loading: this.loading, onClick: () => applyPromoCode(), variant: "primary" }, translate('Apply'))))))), !!cartStore.adjustmentTotal && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("div", { class: "zonos--title-with-icon" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Discounts')))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
|
|
31
66
|
amount: cartStore.adjustmentTotal,
|
|
32
67
|
currency: cartStore.currency,
|
|
33
68
|
}))))), h("tr", { class: "zonos--row zonos--cart-pay-total" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Order total'))), h("td", { class: "zonos--column" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
|
|
@@ -48,4 +83,52 @@ export class ZonosCartSubtotal {
|
|
|
48
83
|
};
|
|
49
84
|
}
|
|
50
85
|
static get assetsDirs() { return ["assets"]; }
|
|
86
|
+
static get properties() {
|
|
87
|
+
return {
|
|
88
|
+
"submitBtnType": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"mutable": false,
|
|
91
|
+
"complexType": {
|
|
92
|
+
"original": "HTMLZonosButtonElement['variant']",
|
|
93
|
+
"resolved": "\"danger\" | \"outline\" | \"primary\" | \"standard\" | \"subtle\" | \"success\" | \"warning\" | undefined",
|
|
94
|
+
"references": {
|
|
95
|
+
"HTMLZonosButtonElement": {
|
|
96
|
+
"location": "global",
|
|
97
|
+
"id": "global::HTMLZonosButtonElement"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": true,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [],
|
|
105
|
+
"text": "Button type of the submit button"
|
|
106
|
+
},
|
|
107
|
+
"attribute": "submit-btn-type",
|
|
108
|
+
"reflect": false
|
|
109
|
+
},
|
|
110
|
+
"submitBtnColor": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"mutable": false,
|
|
113
|
+
"complexType": {
|
|
114
|
+
"original": "string",
|
|
115
|
+
"resolved": "string | undefined",
|
|
116
|
+
"references": {}
|
|
117
|
+
},
|
|
118
|
+
"required": false,
|
|
119
|
+
"optional": true,
|
|
120
|
+
"docs": {
|
|
121
|
+
"tags": [],
|
|
122
|
+
"text": "Button color of the submit button"
|
|
123
|
+
},
|
|
124
|
+
"attribute": "submit-btn-color",
|
|
125
|
+
"reflect": false
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
static get states() {
|
|
130
|
+
return {
|
|
131
|
+
"loading": {}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
51
134
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, h, Host, } from "@stencil/core";
|
|
2
2
|
import { cartStore } from "../../../store/checkout/cart";
|
|
3
3
|
import { paypalStore, paypalStoreReset, } from "../../../store/checkout/paypal";
|
|
4
|
-
import { stripeStore, stripeStoreMessageBasedOnStatus, stripeStoreReset, stripeStoreRetrievePayment, } from "../../../store/checkout/stripe";
|
|
4
|
+
import { stripeStore, stripeStoreMessageBasedOnStatus, stripeStoreReset, stripeStoreResetPromoCode, stripeStoreRetrievePayment, } from "../../../store/checkout/stripe";
|
|
5
5
|
import { translate } from "../../../store/translationStore";
|
|
6
6
|
import { zonosStore } from "../../../store/zonosStore";
|
|
7
7
|
import { trackConversionEvent } from "../../../utils/api/trackConversionEvent";
|
|
@@ -195,6 +195,8 @@ export class ZonosCheckoutFinish {
|
|
|
195
195
|
// wait this to finish before resetting store and checkout session id
|
|
196
196
|
await this.getPullOrder();
|
|
197
197
|
}
|
|
198
|
+
// reset promo when checkout is finished
|
|
199
|
+
stripeStoreResetPromoCode();
|
|
198
200
|
this.isLoading = false;
|
|
199
201
|
stripeStoreReset();
|
|
200
202
|
paypalStoreReset();
|
|
@@ -233,11 +235,11 @@ export class ZonosCheckoutFinish {
|
|
|
233
235
|
var _a, _b;
|
|
234
236
|
const orderId = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.accountOrderNumber) || getGraphQlShortId((_b = this.order) === null || _b === void 0 ? void 0 : _b.id);
|
|
235
237
|
const isTestMode = getIsTestMode();
|
|
236
|
-
return (h(Host, { key: '
|
|
238
|
+
return (h(Host, { key: '9939772d4ce4213978ae6b02b4cd5345d15dbdfd', class: "zonos--checkout-finish zonos--elements", style: {
|
|
237
239
|
'--border-radius': getBorderRadius({
|
|
238
240
|
overrideBorderStyle: this.borderRadius,
|
|
239
241
|
}),
|
|
240
|
-
} }, this.isLoading && (h("div", { key: '
|
|
242
|
+
} }, this.isLoading && (h("div", { key: '491d4d0ba3dc487d448606009a30a5ce8d3bb86e', class: "loading-wrapper" }, h("zonos-spinner", { key: '3179aeb472d3e70628d3f1e3e2b76ed3d622145d' }))), !this.isLoading && (h("div", { key: '6044c9d1ac7599d9168f944dcf82028669fd1f37', class: "zonos--finish-details" }, h("div", { key: 'd22ec981a73db08e4871c8babe29f9a09a5bc29d', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'bfef33fd319456253e07c3ef3f81da1b85414df9', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (h("div", { key: 'f056c93644d1f9defa263f59111874f154293b51', class: "zonos--order-number" }, "Order #", orderId)), h("zonos-text", { key: '69d38c4640943a5cfdcef5ea6951ddec9c7b8a84', textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), h("zonos-button", { key: 'fbb2d1cc0baab99a3312f2077c28cb9d51b4eb44', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cartStore.step === 'finish' && (h("div", { key: '7b63fd838f850ce6a5acf4970fa66657ca05e235', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '85035826e36d52ccf8c77aa6ba6e27173fccdaa6', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'd3848fdbdf1380dce49fcbc2b2903d99ce65247d', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
|
|
241
243
|
}
|
|
242
244
|
static get is() { return "zonos-checkout-finish"; }
|
|
243
245
|
static get encapsulation() { return "shadow"; }
|
|
@@ -602,7 +602,7 @@ export class ZonosCheckout {
|
|
|
602
602
|
} }), h("zonos-collapse", {
|
|
603
603
|
// only collapsible on mobile
|
|
604
604
|
collapsed: this.collapseReviewMobile && this.isMobile
|
|
605
|
-
}, h("zonos-cart-items", null), this.isMobile && (h("zonos-v-stack", { spacing: 16 }, h("zonos-cart-subtotal",
|
|
605
|
+
}, h("zonos-cart-items", null), this.isMobile && (h("zonos-v-stack", { spacing: 16 }, h("zonos-cart-subtotal", { submitBtnColor: submitButtonColor }), h("zonos-custom-message", { class: "zonos--checkout-default-message", icon: MessageIcon, message: defaultMessage }))))), h("zonos-cart-restricted-items", null), !this.isMobile && (h("zonos-v-stack", { spacing: 16 }, h("zonos-cart-subtotal", null), h("zonos-custom-message", { class: "zonos--checkout-default-message", icon: MessageIcon, message: defaultMessage }))))))), (cartStore.step === 'finish' || cartStore.step === 'error') && (h("div", { class: "zonos--done", "data-theme": rightSideTheme }, h("div", { class: "zonos--header" }, renderLogo(), h("zonos-button", { class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close checkout dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.handleFinishClick(), theme: rightSideTheme })), h("zonos-checkout-finish", { borderRadius: style, onCloseClick: () => this.handleFinishClick(), overrideNotification: cartStore.step === 'error' && !!cartStore.error
|
|
606
606
|
? Object.assign(Object.assign({}, cartStore.error), { type: 'error' }) : undefined, storybookForceStatus: this.storybookPaymentStatusOverride }))), h("zonos-checkout-footer", { "data-theme": rightSideTheme, mobile: this.isMobile,
|
|
607
607
|
/**
|
|
608
608
|
* For this component, use slot instead of passing JSX through prop of other component. Because
|
package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/assets/ChevronUpIcon.svg
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g filter="url(#filter0_dd_2052_3658)">
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.46967 14.5303C7.76256 14.8232 8.23744 14.8232 8.53033 14.5303L12.5 10.5607L16.4697 14.5303C16.7626 14.8232 17.2374 14.8232 17.5303 14.5303C17.8232 14.2374 17.8232 13.7626 17.5303 13.4697L13.0303 8.96967C12.7374 8.67678 12.2626 8.67678 11.9697 8.96967L7.46967 13.4697C7.17678 13.7626 7.17678 14.2374 7.46967 14.5303Z" fill="currentColor"/>
|
|
4
|
+
</g>
|
|
5
|
+
<defs>
|
|
6
|
+
<filter id="filter0_dd_2052_3658" x="-3.5" y="-2" width="32" height="32" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
7
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
8
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
9
|
+
<feOffset dy="2"/>
|
|
10
|
+
<feGaussianBlur stdDeviation="2"/>
|
|
11
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
12
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"/>
|
|
13
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2052_3658"/>
|
|
14
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
15
|
+
<feOffset dy="1"/>
|
|
16
|
+
<feGaussianBlur stdDeviation="1"/>
|
|
17
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
18
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0"/>
|
|
19
|
+
<feBlend mode="normal" in2="effect1_dropShadow_2052_3658" result="effect2_dropShadow_2052_3658"/>
|
|
20
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_2052_3658" result="shape"/>
|
|
21
|
+
</filter>
|
|
22
|
+
</defs>
|
|
23
|
+
</svg>
|
package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css
CHANGED
|
@@ -36,19 +36,16 @@
|
|
|
36
36
|
display: flex;
|
|
37
37
|
flex-direction: column;
|
|
38
38
|
}
|
|
39
|
-
:host .zonos--title {
|
|
40
|
-
margin-bottom: 24px;
|
|
41
|
-
}
|
|
42
39
|
:host .zonos--shipping-method-title {
|
|
43
|
-
margin-bottom: 16px;
|
|
44
|
-
}
|
|
45
|
-
:host .zonos-shipping-rich-radio {
|
|
46
|
-
margin-bottom: 24px;
|
|
40
|
+
margin-bottom: -16px;
|
|
47
41
|
}
|
|
48
42
|
:host .zonos--group {
|
|
49
43
|
margin-bottom: 20px;
|
|
50
44
|
overflow: auto;
|
|
51
45
|
padding: 5px;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: 24px;
|
|
52
49
|
overscroll-behavior: contain;
|
|
53
50
|
}
|
|
54
51
|
:host .zonos--group::-webkit-scrollbar {
|
|
@@ -69,6 +66,9 @@
|
|
|
69
66
|
:host .zonos--error-banner {
|
|
70
67
|
margin-bottom: 16px;
|
|
71
68
|
}
|
|
69
|
+
:host .zonos--shipping-method-error {
|
|
70
|
+
margin-top: 24px;
|
|
71
|
+
}
|
|
72
72
|
:host zonos-button {
|
|
73
73
|
box-shadow: 0 0 1px 0 var(--zonos-elements-gray-600);
|
|
74
74
|
}
|
|
@@ -83,6 +83,52 @@
|
|
|
83
83
|
:host .zonos--group-btn zonos-button {
|
|
84
84
|
width: 100%;
|
|
85
85
|
}
|
|
86
|
-
:host zonos-
|
|
87
|
-
|
|
86
|
+
:host .zonos--shipping-options-wrapper {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
gap: 24px;
|
|
90
|
+
}
|
|
91
|
+
:host .zonos--shipping-options-collapse-trigger {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: row;
|
|
94
|
+
gap: 24px;
|
|
95
|
+
align-items: center;
|
|
96
|
+
background: var(--zonos-elements-gray-0);
|
|
97
|
+
width: 100%;
|
|
98
|
+
border: none;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
position: sticky;
|
|
101
|
+
top: 0;
|
|
102
|
+
z-index: 1;
|
|
103
|
+
transition: 0.5s all ease;
|
|
104
|
+
}
|
|
105
|
+
:host .zonos--shipping-options-collapse-trigger zonos-icon {
|
|
106
|
+
transition: transform 0.3s ease;
|
|
107
|
+
}
|
|
108
|
+
:host .zonos--shipping-options-collapse-trigger.collapsed {
|
|
109
|
+
margin-bottom: 0;
|
|
110
|
+
}
|
|
111
|
+
:host .zonos--shipping-options-collapse-trigger.collapsed zonos-icon {
|
|
112
|
+
transform: rotate(180deg);
|
|
113
|
+
}
|
|
114
|
+
:host .zonos--shipping-options-collapse-trigger::before, :host .zonos--shipping-options-collapse-trigger::after {
|
|
115
|
+
content: "";
|
|
116
|
+
display: block;
|
|
117
|
+
width: 80%;
|
|
118
|
+
height: 1px;
|
|
119
|
+
background-color: var(--zonos-elements-border-color);
|
|
120
|
+
flex-shrink: 1;
|
|
121
|
+
}
|
|
122
|
+
:host .zonos--shipping-options-collapse-trigger .zonos--title-wrapper {
|
|
123
|
+
flex-grow: 1;
|
|
124
|
+
flex-shrink: 0;
|
|
125
|
+
display: inline-flex;
|
|
126
|
+
flex-direction: row;
|
|
127
|
+
gap: 8px;
|
|
128
|
+
align-items: center;
|
|
129
|
+
}
|
|
130
|
+
:host .zonos--dap-wrapper {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
gap: 24px;
|
|
88
134
|
}
|
|
@@ -2,9 +2,12 @@ import { h, Host, } from "@stencil/core";
|
|
|
2
2
|
import { cartStore, cartStoreGetShippingTransitInfo, cartStoreUpdateSelectedShippingOption, } from "../../../store/checkout/cart";
|
|
3
3
|
import { translate } from "../../../store/translationStore";
|
|
4
4
|
import { trackConversionEvent } from "../../../utils/api/trackConversionEvent";
|
|
5
|
-
import {
|
|
5
|
+
import { sortServiceLevelOptionsByAmount } from "../../../utils/checkout/sortServiceLevelOptionsByAmount";
|
|
6
|
+
import { classes } from "../../../utils/classes";
|
|
6
7
|
import { currencyFormat } from "../../../utils/hello/currencyConversion/currencyFormat";
|
|
7
8
|
import { submitGtag } from "../../../utils/submitGtag";
|
|
9
|
+
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
10
|
+
import ChevronUpIcon from "./assets/ChevronUpIcon.svg";
|
|
8
11
|
export class ZonosShipping {
|
|
9
12
|
constructor() {
|
|
10
13
|
this.handleRadioSelected = async (e) => {
|
|
@@ -50,8 +53,6 @@ export class ZonosShipping {
|
|
|
50
53
|
switch (method) {
|
|
51
54
|
case 'DAP':
|
|
52
55
|
return translate(` (Duties due at door)`);
|
|
53
|
-
case 'DDP':
|
|
54
|
-
return translate(` (Duties prepaid)`);
|
|
55
56
|
default:
|
|
56
57
|
return '';
|
|
57
58
|
}
|
|
@@ -67,10 +68,11 @@ export class ZonosShipping {
|
|
|
67
68
|
const matchedLandedCosts = (_a = cartStore.landedCostData) === null || _a === void 0 ? void 0 : _a.filter(landedCostItem => { var _a; return ((_a = landedCostItem.landedCost) === null || _a === void 0 ? void 0 : _a.shipmentRating.id) === item.id; });
|
|
68
69
|
return ((matchedLandedCosts === null || matchedLandedCosts === void 0 ? void 0 : matchedLandedCosts.map(landedCost => {
|
|
69
70
|
const shippingAmount = landedCost.subtotals.shipping;
|
|
70
|
-
|
|
71
|
+
const option = {
|
|
71
72
|
amount: shippingAmount,
|
|
72
73
|
label: `${item.displayName}${this.getLandedCostMethodLabelSuffix(landedCost.landedCost.method)}`,
|
|
73
74
|
landedCostId: landedCost.landedCostId,
|
|
75
|
+
method: landedCost.landedCost.method,
|
|
74
76
|
price: currencyFormat({
|
|
75
77
|
amount: shippingAmount,
|
|
76
78
|
currency: cartStore.currency,
|
|
@@ -79,28 +81,50 @@ export class ZonosShipping {
|
|
|
79
81
|
sublabel,
|
|
80
82
|
value: landedCost.landedCostId,
|
|
81
83
|
};
|
|
84
|
+
return option;
|
|
82
85
|
})) || []);
|
|
83
86
|
})) || [];
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
const serviceLevelsDDP = serviceLevels.filter(item => item.method === 'DDP');
|
|
88
|
+
const serviceLevelsDAP = serviceLevels.filter(item => item.method === 'DAP');
|
|
89
|
+
const serviceLevelsOther = serviceLevels.filter(item => item.method !== 'DAP' && item.method !== 'DDP');
|
|
90
|
+
this.serviceLevelsDDP = sortServiceLevelOptionsByAmount(serviceLevelsDDP);
|
|
91
|
+
this.serviceLevelsDAP = sortServiceLevelOptionsByAmount(serviceLevelsDAP);
|
|
92
|
+
this.serviceLevelsOther =
|
|
93
|
+
sortServiceLevelOptionsByAmount(serviceLevelsOther);
|
|
94
|
+
const defaultShownServiceLevels = [
|
|
95
|
+
...this.serviceLevelsDDP,
|
|
96
|
+
...this.serviceLevelsOther,
|
|
97
|
+
];
|
|
98
|
+
// Show DAP by default if there is no DDP
|
|
99
|
+
if (!defaultShownServiceLevels.length) {
|
|
100
|
+
this.collapsedDAPOptions = false;
|
|
101
|
+
}
|
|
86
102
|
};
|
|
87
103
|
this.continueLoading = false;
|
|
88
104
|
this.submitBtnColor = undefined;
|
|
89
105
|
this.submitBtnType = undefined;
|
|
90
106
|
this.selectedShippingMethod = null;
|
|
107
|
+
this.collapsedDAPOptions = true;
|
|
91
108
|
this.isSelecting = false;
|
|
92
109
|
this.showErrorBanner = false;
|
|
93
|
-
this.
|
|
110
|
+
this.serviceLevelsDDP = [];
|
|
111
|
+
this.serviceLevelsDAP = [];
|
|
112
|
+
this.serviceLevelsOther = [];
|
|
94
113
|
}
|
|
95
114
|
componentWillLoad() {
|
|
96
115
|
this.initServiceLevels();
|
|
97
|
-
const
|
|
116
|
+
const allServiceLevels = [
|
|
117
|
+
...this.serviceLevelsDDP,
|
|
118
|
+
...this.serviceLevelsDAP,
|
|
119
|
+
...this.serviceLevelsOther,
|
|
120
|
+
];
|
|
121
|
+
const selectedServiceLevel = allServiceLevels.find(item => { var _a; return item.value === ((_a = cartStore.selectedShippingOption) === null || _a === void 0 ? void 0 : _a.id); }) || null;
|
|
98
122
|
if (selectedServiceLevel) {
|
|
99
123
|
// keep the selected shipping method
|
|
100
124
|
this.selectedShippingMethod = selectedServiceLevel;
|
|
101
125
|
return;
|
|
102
126
|
}
|
|
103
|
-
const firstServiceLevel =
|
|
127
|
+
const firstServiceLevel = allServiceLevels.find(Boolean);
|
|
104
128
|
if (firstServiceLevel) {
|
|
105
129
|
// preselect the first shipping method
|
|
106
130
|
void this.handleRadioSelected({
|
|
@@ -109,12 +133,25 @@ export class ZonosShipping {
|
|
|
109
133
|
}
|
|
110
134
|
}
|
|
111
135
|
render() {
|
|
112
|
-
|
|
136
|
+
const allServiceLevels = [
|
|
137
|
+
...this.serviceLevelsDDP,
|
|
138
|
+
...this.serviceLevelsDAP,
|
|
139
|
+
...this.serviceLevelsOther,
|
|
140
|
+
];
|
|
141
|
+
const defaultShownServiceLevels = [
|
|
142
|
+
...this.serviceLevelsDDP,
|
|
143
|
+
...this.serviceLevelsOther,
|
|
144
|
+
];
|
|
113
145
|
// start validate on typing after error banner is shown, and hide it if the form is complete
|
|
114
146
|
if (this.showErrorBanner) {
|
|
115
147
|
this.showErrorBanner = !this.handleValidate();
|
|
116
148
|
}
|
|
117
|
-
return (h(Host, { key: '
|
|
149
|
+
return (h(Host, { key: 'e376545666893a373bca1591083a868892804fb1', class: "zonos--shipping zonos--elements" }, h("div", { key: 'f8901d3d8fbeb6a285a7a33b9cea940476413c68', class: "zonos--group" }, h("zonos-text", { key: '83e02010c5e11647064ebf28468def163dd3395a', class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!allServiceLevels.length && (h("zonos-banner", { key: 'e65f0ce2e968612bd7c1efeca8309e69a03a8c65', class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { key: 'cdae794614c6879477e96de435d5c4e59f469fe9', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !allServiceLevels.length ? (h("zonos-banner", { bannerTitle: 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" })) : (h("div", { class: "zonos--shipping-options-wrapper" }, h("zonos-shipping-rich-radio", { items: defaultShownServiceLevels, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }), !!defaultShownServiceLevels.length && (h("button", { class: classes([
|
|
150
|
+
'zonos--shipping-options-collapse-trigger',
|
|
151
|
+
this.collapsedDAPOptions && 'collapsed',
|
|
152
|
+
]), onClick: () => {
|
|
153
|
+
this.collapsedDAPOptions = !this.collapsedDAPOptions;
|
|
154
|
+
} }, h("div", { class: "zonos--title-wrapper" }, h("zonos-text", { type: "label" }, `${translate(this.collapsedDAPOptions ? 'Show non prepaid methods' : 'Hide non prepaid methods')} `), h("zonos-icon", { content: ChevronUpIcon })))), h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, h("div", { class: "zonos--dap-wrapper" }, h("zonos-banner", { bannerTitle: translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, translate('You may incur additional fees from the shipping carrier by not prepaying.')), h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }))))), h("div", { key: '43619b89b2274e38683ade860402ff026ddcdd9a', class: "zonos--group-btn" }, h("zonos-button", { key: 'fff71598501c5a83ea415a72f3bc64ee004cbeae', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
|
|
118
155
|
// use primary type when on mobile mode
|
|
119
156
|
variant: this.submitBtnType }, translate('Go to payment'))))));
|
|
120
157
|
}
|
|
@@ -194,9 +231,12 @@ export class ZonosShipping {
|
|
|
194
231
|
static get states() {
|
|
195
232
|
return {
|
|
196
233
|
"selectedShippingMethod": {},
|
|
234
|
+
"collapsedDAPOptions": {},
|
|
197
235
|
"isSelecting": {},
|
|
198
236
|
"showErrorBanner": {},
|
|
199
|
-
"
|
|
237
|
+
"serviceLevelsDDP": {},
|
|
238
|
+
"serviceLevelsDAP": {},
|
|
239
|
+
"serviceLevelsOther": {}
|
|
200
240
|
};
|
|
201
241
|
}
|
|
202
242
|
static get events() {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.8282 5.17184C11.0235 5.3671 11.0235 5.68368 10.8282 5.87894L8.70688 8.00026L10.8282 10.1216C11.0235 10.3168 11.0235 10.6334 10.8282 10.8287C10.6329 11.024 10.3164 11.024 10.1211 10.8287L7.99978 8.70737L5.87846 10.8287C5.68319 11.024 5.36661 11.024 5.17135 10.8287C4.97609 10.6334 4.97609 10.3168 5.17135 10.1216L7.29267 8.00026L5.17135 5.87894C4.97609 5.68368 4.97609 5.3671 5.17135 5.17184C5.36661 4.97658 5.68319 4.97658 5.87846 5.17184L7.99978 7.29316L10.1211 5.17184C10.3164 4.97658 10.6329 4.97658 10.8282 5.17184Z" fill="var(--zonos-elements-gray-800)"/>
|
|
3
|
+
</svg>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { zonosStoreFontFamily } from "../../store/zonosStore";
|
|
3
3
|
import { classes } from "../../utils/classes";
|
|
4
|
+
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
5
|
+
import RemoveLineIcon from "./assets/RemoveLineIcon.svg";
|
|
4
6
|
export class ZonosBadge {
|
|
5
7
|
constructor() {
|
|
6
8
|
this.bold = false;
|
|
@@ -9,18 +11,20 @@ export class ZonosBadge {
|
|
|
9
11
|
this.iconRight = false;
|
|
10
12
|
this.size = 'default';
|
|
11
13
|
this.rounded = false;
|
|
14
|
+
this.loading = false;
|
|
15
|
+
this.dismissHandler = undefined;
|
|
12
16
|
}
|
|
13
17
|
render() {
|
|
14
|
-
return (h(Host, { key: '
|
|
18
|
+
return (h(Host, { key: '9704ae6d10af4b720e1edf9ccc0263d4463e64f2', class: classes(['zonos--elements zonos--badge']), style: {
|
|
15
19
|
'--font-family': zonosStoreFontFamily(),
|
|
16
|
-
} }, h("div", { key: '
|
|
20
|
+
} }, h("div", { key: 'e395b7477591edff91059aefc4d3858f45d61098', class: classes([
|
|
17
21
|
'zonos--badge-content',
|
|
18
22
|
this.badgeColor,
|
|
19
23
|
this.rounded && 'rounded',
|
|
20
24
|
this.iconRight && 'icon-right',
|
|
21
25
|
this.size,
|
|
22
26
|
this.bold && 'bold',
|
|
23
|
-
]) }, this.icon, h("zonos-text", { key: '
|
|
27
|
+
]) }, this.icon, h("zonos-text", { key: '92eeb162849c9036bb102012e14fb6476b34b411', textColor: `${this.badgeColor}-800` }, h("slot", { key: '3a52067262d1ba34eb5952dc2f2eaeeb1daa624c' })), this.dismissHandler && (h("zonos-icon", { key: '7bb94d2b2204c81e7c21e31fe2769de2e0f0c19b', "aria-label": "Remove promo code", class: "zonos--badge-dismiss", content: RemoveLineIcon, onClick: () => { var _a; return (_a = this.dismissHandler) === null || _a === void 0 ? void 0 : _a.call(this); } })))));
|
|
24
28
|
}
|
|
25
29
|
static get is() { return "zonos-badge"; }
|
|
26
30
|
static get encapsulation() { return "shadow"; }
|
|
@@ -169,6 +173,42 @@ export class ZonosBadge {
|
|
|
169
173
|
"attribute": "rounded",
|
|
170
174
|
"reflect": false,
|
|
171
175
|
"defaultValue": "false"
|
|
176
|
+
},
|
|
177
|
+
"loading": {
|
|
178
|
+
"type": "boolean",
|
|
179
|
+
"mutable": false,
|
|
180
|
+
"complexType": {
|
|
181
|
+
"original": "boolean",
|
|
182
|
+
"resolved": "boolean",
|
|
183
|
+
"references": {}
|
|
184
|
+
},
|
|
185
|
+
"required": false,
|
|
186
|
+
"optional": false,
|
|
187
|
+
"docs": {
|
|
188
|
+
"tags": [{
|
|
189
|
+
"name": "default",
|
|
190
|
+
"text": "false"
|
|
191
|
+
}],
|
|
192
|
+
"text": "Whether or not the badge is loading"
|
|
193
|
+
},
|
|
194
|
+
"attribute": "loading",
|
|
195
|
+
"reflect": false,
|
|
196
|
+
"defaultValue": "false"
|
|
197
|
+
},
|
|
198
|
+
"dismissHandler": {
|
|
199
|
+
"type": "unknown",
|
|
200
|
+
"mutable": false,
|
|
201
|
+
"complexType": {
|
|
202
|
+
"original": "() => void",
|
|
203
|
+
"resolved": "(() => void) | undefined",
|
|
204
|
+
"references": {}
|
|
205
|
+
},
|
|
206
|
+
"required": false,
|
|
207
|
+
"optional": true,
|
|
208
|
+
"docs": {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": "Callback for when the badge is dismissed. Also determines if dismiss icon shown."
|
|
211
|
+
}
|
|
172
212
|
}
|
|
173
213
|
};
|
|
174
214
|
}
|
|
@@ -121,12 +121,12 @@ export class ZonosButton {
|
|
|
121
121
|
const borderStyle = getBorderRadius({
|
|
122
122
|
overrideBorderStyle: this.borderStyle,
|
|
123
123
|
});
|
|
124
|
-
return (h(Host, { key: '
|
|
124
|
+
return (h(Host, { key: 'c8e781921a30afccbbe3dd187632aa06135420df', class: classes(['zonos--elements']), "data-theme": this.theme || buttonTheme, disabled: disabled, style: styles({
|
|
125
125
|
'--background-color': backgroundColor,
|
|
126
126
|
'--border-radius': borderStyle,
|
|
127
127
|
'--color': color,
|
|
128
128
|
'--font-family': zonosStoreFontFamily(),
|
|
129
|
-
}) }, h("button", { key: '
|
|
129
|
+
}) }, h("button", { key: '1783400cd4ae43832789ba63649b7962d7e08d6c', class: classes([
|
|
130
130
|
this.hasIcon && 'has-icon',
|
|
131
131
|
this.hasContent && 'has-content',
|
|
132
132
|
this.noBackground && 'no-background',
|
|
@@ -141,7 +141,7 @@ export class ZonosButton {
|
|
|
141
141
|
backgroundColor && variant === 'standard' && 'override-background',
|
|
142
142
|
]), disabled: disabled, style: {
|
|
143
143
|
justifyContent: this.justifyContent,
|
|
144
|
-
} }, this.loading && (h("div", { key: '
|
|
144
|
+
} }, this.loading && (h("div", { key: '7f1c3907f9dbbc42613db7b976d358d477caaac4', class: "zonos--spinner-wrapper" }, h("zonos-spinner", { key: 'be0002a169ebf26eb4bbf65f5a057840a90fe937', size: 16, spinnerColor: spinnerColor }))), !this.loading && !this.iconRight && this.icon, h("slot", { key: '4204bc86e934884015fcd09be7ffe79931f5c112', onSlotchange: this.handleSlotChange }), !this.loading && this.iconRight && this.icon)));
|
|
145
145
|
}
|
|
146
146
|
static get is() { return "zonos-button"; }
|
|
147
147
|
static get encapsulation() { return "shadow"; }
|
|
@@ -22,16 +22,16 @@ export class ZonosCard {
|
|
|
22
22
|
customRoundRadius: `${this.borderRadius}px`,
|
|
23
23
|
overrideBorderStyle: 'ROUNDED',
|
|
24
24
|
});
|
|
25
|
-
return (h(Host, { key: '
|
|
25
|
+
return (h(Host, { key: 'eb938f526afeb2d8c70b3ce6d5e219fb82dccd4b', style: {
|
|
26
26
|
'--font-family': zonosStoreFontFamily(),
|
|
27
|
-
} }, h("div", { key: '
|
|
27
|
+
} }, h("div", { key: 'd1c94fc6d2f2bc4fa157901116209a0ec2b2c6bc', class: classes(['styled-card']), style: {
|
|
28
28
|
'--background-color': backgroundColor,
|
|
29
29
|
'--border-radius': borderRadius,
|
|
30
30
|
padding: this.spacing,
|
|
31
|
-
} }, this.label && (h("header", { key: '
|
|
31
|
+
} }, this.label && (h("header", { key: 'c91e1e4620f6c16a51cb0240528cf17de5f65192', class: "card-header", style: { padding: this.spacing } }, h("zonos-text", { key: 'c0516125052b5369f49fa90696f0f1ff9707cd76', type: "subheader" }, this.label), h("h-stack", { key: '025ee9b66a9f0d354efe41e16cbe7f78ea74cdf5', spacing: 8 }, this.actions))), h("slot", { key: '27805390a0d386f68f65cd23f86e04c5489eb291' }), (this.footerActions || this.footerContent) && (h("footer", { key: '7a6d615316e46f32f2dd70988c425edb99089fd9', class: "card-footer", style: {
|
|
32
32
|
height: this.footerHeight ? `${this.footerHeight}px` : 'auto',
|
|
33
33
|
padding: this.spacing,
|
|
34
|
-
} }, h("div", { key: '
|
|
34
|
+
} }, h("div", { key: '72c6cba3976cfcaf693af897db891c015bba7cd6' }, this.footerContent), h("h-stack", { key: 'c52f116dae77617934090a33a89602f0f4bd5c5a', spacing: 8 }, this.footerActions))))));
|
|
35
35
|
}
|
|
36
36
|
static get is() { return "zonos-card"; }
|
|
37
37
|
static get encapsulation() { return "shadow"; }
|
|
@@ -36,14 +36,14 @@ export class ZonosCheckbox {
|
|
|
36
36
|
customRoundRadius: '4px',
|
|
37
37
|
overrideBorderStyle: this.borderStyle,
|
|
38
38
|
});
|
|
39
|
-
return (h(Host, { key: '
|
|
39
|
+
return (h(Host, { key: '8613d885c639d01671743dbdb0583c390718c732', class: classes(['zonos--elements zonos--checkbox']), style: {
|
|
40
40
|
'--background-color': backgroundColor,
|
|
41
41
|
'--border-radius': borderStyle,
|
|
42
42
|
'--font-family': zonosStoreFontFamily(),
|
|
43
43
|
'--size': `${this.size}px`,
|
|
44
|
-
} }, h("label", { key: '
|
|
44
|
+
} }, h("label", { key: '803434d7a63e1735bf0ef15a9e4c7fb515bfff41', class: classes([this.isDisabled && 'disabled']) }, h("input", { key: 'a19a46a896597f4c47d4ec790a21b5133c13b952', checked: this.isChecked, disabled: this.isDisabled, hidden: true, onChange: e => {
|
|
45
45
|
this.checkboxSelected.emit(e.target.checked);
|
|
46
|
-
}, type: "checkbox" }), h("span", { key: '
|
|
46
|
+
}, type: "checkbox" }), h("span", { key: '7f4b933f9626bc05f052d79fa25a0c46ee16f492', class: "checkmark-container" }, h("svg", { key: '775d0b011a1430f712e8f633e2850d6f6e193f36', class: "checkmark", color: checkmarkColor, fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'eef97178731ac1bf9885d5cfd57afa514c20df5f', "clip-rule": "evenodd", d: "M17.456 7.404a.75.75 0 0 1 .14 1.052l-6.5 8.5a.75.75 0 0 1-1.126.074l-4-4a.75.75 0 0 1 1.06-1.06l3.395 3.394 5.98-7.82a.75.75 0 0 1 1.05-.14Z", fill: "currentColor", "fill-rule": "evenodd" }))), this.label && (h("zonos-text", { key: '0f72347f0b21817cd176393219374008a056b590', size: this.fontSize }, this.label)))));
|
|
47
47
|
}
|
|
48
48
|
static get is() { return "zonos-checkbox"; }
|
|
49
49
|
static get encapsulation() { return "shadow"; }
|