wickes-css2 2.111.0-develop.2 → 2.111.0-why-not-add.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +1 -1
- package/build/css/category-main.css +1 -1
- package/build/css/components/global-search.css +1 -1
- package/build/css/homepage-main.css +1 -1
- package/build/css/kitchen-plp-main.css +1 -1
- package/build/css/main.css +1 -1
- package/build/css/my-account-main-v2.css +1 -1
- package/build/css/my-account-main.css +1 -1
- package/build/css/pages/page_personal-details.css +1 -1
- package/build/css/pages/page_product-details-v2.css +1 -1
- package/build/css/pdp-main-before-combine.css +1 -1
- package/build/css/pdp-main-critical.css +1 -1
- package/build/css/pdp-main-non-critical.css +1 -1
- package/build/css/pdp-main.css +1 -1
- package/build/css/plp-main.css +1 -1
- package/build/css/store-locator-main.css +1 -1
- package/build/js/account-hub.min.js +1 -1
- package/build/js/basket.min.js +2 -2
- package/build/js/bloomreach-widget.min.js +1 -0
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +2 -2
- package/build/js/emulation.min.js +3001 -280
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/gift-cards.min.js +1 -1
- package/build/js/merged-checkout.min.js +2 -2
- package/build/js/mini-basket-slider.min.js +1 -1
- package/build/js/page/basket-v2.js +18 -11
- package/build/js/page/bloomreach-widget.js +1187 -0
- package/build/js/page/components/discounts.js +8 -15
- package/build/js/page/components/mini-basket-slider.js +24 -18
- package/build/js/page/components/voucher.js +2 -56
- package/build/js/page/utils/create-count-stepper.js +30 -9
- package/build/js/page/utils/create-loading-button.js +37 -0
- package/build/js/page/utils/create-toast.js +79 -0
- package/build/js/page/utils/custom-dropdown.js +80 -0
- package/build/js/pdp-count-stepper.min.js +1 -1
- package/build/js/pdp.bundle.min.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/project-list.min.js +1 -1
- package/build/js/saving-shopping-list.min.js +1 -1
- package/package.json +1 -1
- package/src/components/base/button.hbs +23 -5
- package/src/components/bloomreach/complete-card-dropdown.hbs +47 -0
- package/src/components/bloomreach/complete-card-skeleton.hbs +19 -0
- package/src/components/bloomreach/complete-card.hbs +138 -0
- package/src/components/bloomreach/complete-divider.hbs +3 -0
- package/src/components/bloomreach/complete-summary-skeleton.hbs +12 -0
- package/src/components/bloomreach/complete-summary.hbs +43 -0
- package/src/components/bloomreach/complete-wrapper.hbs +1 -0
- package/src/components/bloomreach/complete-your-project.hbs +21 -0
- package/src/components/cart-voucher.hbs +4 -4
- package/src/components/gift-cards.hbs +1 -1
- package/src/components/mini-basket/mini-basket-order-item.hbs +4 -4
- package/src/components/wismo-payment.hbs +7 -50
- package/src/data/data_delivery-address-v2.json +6 -6
- package/src/data/data_discounts.json +6 -6
- package/src/data/data_shopping-cart-v2.json +11 -32
- package/src/data/data_shopping-cart-with-energy.json +12 -12
- package/src/data/data_wismo.json +1 -2
- package/src/elements/checkbox.hbs +8 -1
- package/src/js/components/general/cart-slider.js +19 -6
- package/src/js/components/general/switchVat.js +7 -9
- package/src/js/emulation/basket-data.js +1 -11
- package/src/js/emulation/bloomreach-widget-calculations.js +132 -0
- package/src/js/emulation/bloomreach-widget-loading.js +11 -0
- package/src/js/emulation/checkout-data.js +0 -3
- package/src/js/emulation/mini-basket-data.js +0 -68
- package/src/js/emulation/mock.js +3098 -1
- package/src/js/emulation/notify-me.js +1 -1
- package/src/js/page/basket-v2.js +18 -11
- package/src/js/page/bloomreach-widget.js +1187 -0
- package/src/js/page/components/discounts.js +8 -15
- package/src/js/page/components/mini-basket-slider.js +24 -18
- package/src/js/page/components/voucher.js +2 -56
- package/src/js/page/utils/create-count-stepper.js +30 -9
- package/src/js/page/utils/create-loading-button.js +37 -0
- package/src/js/page/utils/create-toast.js +79 -0
- package/src/js/page/utils/custom-dropdown.js +80 -0
- package/src/layouts/checkout.hbs +0 -1
- package/src/page_basket-energy-efficiency.html +0 -4
- package/src/page_checkout_confirmation-new-marketing-consent-error.html +0 -7
- package/src/page_checkout_confirmation-new-marketing-consent.html +0 -4
- package/src/page_checkout_delivery-address-v2.html +0 -4
- package/src/page_checkout_delivery-details-v2-asm.html +1 -7
- package/src/page_checkout_delivery-details-v2-calendar-message.html +0 -4
- package/src/page_checkout_delivery-details-v2-oos.html +0 -4
- package/src/page_checkout_delivery-details-v2-wisdom-not-available.html +0 -4
- package/src/page_checkout_delivery-details-v2-wisdom.html +0 -4
- package/src/page_checkout_delivery-details-with-loader-v2.html +0 -4
- package/src/page_checkout_delivery-details_guest-new.html +0 -4
- package/src/page_checkout_delivery_address-asm-new.html +0 -4
- package/src/page_checkout_merge-basket-v2.html +3 -6
- package/src/page_checkout_merge-basket-vat-v2.html +1 -6
- package/src/page_checkout_merge-basket-with-energy.html +0 -4
- package/src/page_checkout_next-day-delivery-details.html +0 -4
- package/src/page_checkout_payment-details-v2-asm.html +0 -4
- package/src/page_checkout_payment-details-v2.html +0 -4
- package/src/page_checkout_payment-details_guest-click-collect-icon.html +0 -4
- package/src/page_checkout_payment-details_guest-with-checkout-journey.html +0 -7
- package/src/page_checkout_payment-details_login-with-checkout-journey.html +0 -7
- package/src/page_checkout_payment-details_with-card-loader.html +0 -4
- package/src/page_checkout_payment-details_with-loader-v2.html +0 -4
- package/src/page_checkout_rapid-delivery-details.html +0 -4
- package/src/page_empty-basket-instore.html +0 -4
- package/src/page_homepage-with-global-search-v2-vat.html +0 -1
- package/src/page_instore_progress_bar.html +0 -4
- package/src/page_product-details-banner.html +0 -1
- package/src/page_product-details-big-wins-disabled-delivery.html +0 -1
- package/src/page_product-details-big-wins-non-registered.html +0 -1
- package/src/page_product-details-big-wins-out-nearest.html +0 -1
- package/src/page_product-details-big-wins-unhappy.html +0 -1
- package/src/page_product-details-big-wins.html +0 -1
- package/src/page_product-details-billie.html +0 -1
- package/src/page_product-details-bloomreach.html +130 -0
- package/src/page_product-details-calculator.html +0 -1
- package/src/page_product-details-cashback-v2.html +0 -1
- package/src/page_product-details-clearpay.html +0 -1
- package/src/page_product-details-cnc-error-notification.html +0 -1
- package/src/page_product-details-cnc-success-notification-vat.html +0 -1
- package/src/page_product-details-cnc-success-notification.html +0 -1
- package/src/page_product-details-default-store.html +0 -1
- package/src/page_product-details-energy-efficiency.html +0 -1
- package/src/page_product-details-flooring-with-pr-placeholder.html +0 -1
- package/src/page_product-details-flooring.html +0 -1
- package/src/page_product-details-gallery-actual.html +0 -1
- package/src/page_product-details-mfe-calculator.html +0 -1
- package/src/page_product-details-minimum-v2.html +0 -1
- package/src/page_product-details-mtm-doors.html +0 -1
- package/src/page_product-details-only-clearpay.html +0 -1
- package/src/page_product-details-paint-mixing.html +0 -1
- package/src/page_product-details-saved-pl.html +0 -1
- package/src/page_product-details-tile-steps-klarna-widget-with-method-ids.html +0 -1
- package/src/page_product-details-tile-steps-logout.html +0 -1
- package/src/page_product-details-tile-steps-no-new-project-list.html +0 -1
- package/src/page_product-details-tile-steps-with-klarna.html +0 -1
- package/src/page_product-details-tile-steps.html +0 -1
- package/src/page_product-details-v2.html +0 -1
- package/src/page_product-details-vat.html +0 -1
- package/src/page_product-details-wisdom-mcfc-registered.html +0 -1
- package/src/page_product-details-wisdom-mcfc.html +0 -1
- package/src/page_product-details-wisdom-oos-registered.html +0 -1
- package/src/page_product-details-wisdom-oos.html +0 -1
- package/src/page_product-details-wisdom-registered.html +0 -1
- package/src/page_product-details-wisdom.html +0 -1
- package/src/page_product-details-with-favourite.html +0 -1
- package/src/page_product-details-with-global-search-v2.html +7 -2
- package/src/page_product-details_no-previous-default.html +0 -1
- package/src/page_shopping-cart-registered-v2.html +0 -4
- package/src/page_shopping-cart-v2-vat.html +0 -6
- package/src/page_shopping-cart-v2.html +2 -5
- package/src/page_shopping-cart-v3-instore.html +0 -4
- package/src/page_track-my-order-result.html +1 -0
- package/src/partials/scripts.hbs +1 -0
- package/src/scss/common/_common.scss +1 -0
- package/src/scss/common/_elements.scss +13 -1
- package/src/scss/common/_loading-button.scss +49 -0
- package/src/scss/components/_notifications.scss +86 -5
- package/src/scss/components/bloomreach/_bloomreach.scss +3 -0
- package/src/scss/components/bloomreach/_complete-card-dropdown.scss +174 -0
- package/src/scss/components/bloomreach/_complete-card.scss +408 -0
- package/src/scss/components/bloomreach/_complete-your-project.scss +207 -0
- package/src/scss/components/global-search.scss +0 -11
- package/src/scss/globals/_global-components.scss +0 -1
- package/src/scss/helpers/_variables.scss +1 -0
- package/src/scss/main.scss +0 -2
- package/src/scss/pages/page_product-details-v2.scss +45 -2
- package/src/scss/pdp-main-critical.scss +0 -1
- package/src/scss/pdp-main.scss +1 -1
- package/src/sitemap.html +6 -0
- package/src/components/checkout-voucher-remove-modal.hbs +0 -16
- package/src/components/tradepro-discount-banner.hbs +0 -8
- package/src/js/components/general/tradepro-discount-banner.js +0 -69
- package/src/js/emulation/tradepro-discount-banner-emulation.js +0 -13
- package/src/scss/components/_checkout-voucher-remove-modal.scss +0 -108
- package/src/scss/components/_pdp-action-v2-critical.scss +0 -27
- package/src/scss/components/_pdp-action-v2.scss +0 -27
- package/src/scss/components/_tradepro-discount-banner.scss +0 -78
|
@@ -17,10 +17,10 @@ export function updateDiscount(data, isVoucher) {
|
|
|
17
17
|
if (isVoucher) {
|
|
18
18
|
promotions.forEach((discountItem) => {
|
|
19
19
|
osEl.$discountList().append(() => {
|
|
20
|
-
if (discountItem.usedCouponCode && discountItem.
|
|
20
|
+
if (discountItem.usedCouponCode && discountItem.description) {
|
|
21
21
|
return `
|
|
22
22
|
<li data-coupon-code="${discountItem.usedCouponCode}">
|
|
23
|
-
${
|
|
23
|
+
${discountItem.description}
|
|
24
24
|
<span class="icon checkout-widget__voucher-remove">
|
|
25
25
|
<span class="fas fa-times"></span>
|
|
26
26
|
</span>
|
|
@@ -28,8 +28,8 @@ export function updateDiscount(data, isVoucher) {
|
|
|
28
28
|
`;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
if (discountItem.
|
|
32
|
-
return `<li>${
|
|
31
|
+
if (discountItem.description) {
|
|
32
|
+
return `<li>${discountItem.description}</li>`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return '';
|
|
@@ -46,27 +46,20 @@ export function updateDiscount(data, isVoucher) {
|
|
|
46
46
|
|
|
47
47
|
function appendOrderPromotions(discountObj) {
|
|
48
48
|
if (!_.isEmpty(discountObj)) {
|
|
49
|
-
if (discountObj.usedCouponCode && discountObj.
|
|
49
|
+
if (discountObj.usedCouponCode && discountObj.description) {
|
|
50
50
|
osEl.$discountList().append(createRemoveCouponItem(discountObj));
|
|
51
|
-
} else if (discountObj.
|
|
51
|
+
} else if (discountObj.description) {
|
|
52
52
|
osEl.$discountList().append(function () {
|
|
53
|
-
return `<li>${
|
|
53
|
+
return `<li>${discountObj.description}</li>`;
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
function buildDescriptionHtml(obj) {
|
|
60
|
-
if (Wick.VatToggle.isToggleVatAvailable() && obj.displayDescriptionExclusiveVat) {
|
|
61
|
-
return `<span class="including-vat-inherit">${obj.displayDescription}</span><span class="excluding-vat-inherit">${obj.displayDescriptionExclusiveVat}</span>`;
|
|
62
|
-
}
|
|
63
|
-
return obj.displayDescription;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
59
|
function createRemoveCouponItem(obj) {
|
|
67
60
|
return `
|
|
68
61
|
<li data-coupon-code="${obj.usedCouponCode}">
|
|
69
|
-
${
|
|
62
|
+
${obj.description}
|
|
70
63
|
<span class="icon checkout-widget__voucher-remove">
|
|
71
64
|
<span class="fas fa-times"></span>
|
|
72
65
|
</span>
|
|
@@ -33,7 +33,7 @@ Handlebars.registerHelper('removeFirst', function (str, remove) {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
Handlebars.registerHelper('isToggleVatAvailable', function () {
|
|
36
|
-
return
|
|
36
|
+
return Wick.checkLocalEnv ? false : window.ACC?.app?.isVatToggleAvailable;
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
var Wick = window.Wick || {};
|
|
@@ -439,15 +439,6 @@ Wick.MiniBasketSliderFE = {
|
|
|
439
439
|
Wick.MiniBasketSliderFE.addPromotions
|
|
440
440
|
);
|
|
441
441
|
},
|
|
442
|
-
buildPromoHtml: function (entry) {
|
|
443
|
-
const desc = entry.displayDescription;
|
|
444
|
-
const descExc = entry.displayDescriptionExclusiveVat;
|
|
445
|
-
const isVatAvailable = !!window.ACC?.app?.isVatToggleAvailable;
|
|
446
|
-
if (isVatAvailable && descExc) {
|
|
447
|
-
return `<div class="products__promo"><span class="including-vat-inherit">${desc}</span><span class="excluding-vat-inherit">${descExc}</span></div>`;
|
|
448
|
-
}
|
|
449
|
-
return `<div class="products__promo">${desc}</div>`;
|
|
450
|
-
},
|
|
451
442
|
addPromotions: function (item, data) {
|
|
452
443
|
let arr = [];
|
|
453
444
|
|
|
@@ -455,9 +446,17 @@ Wick.MiniBasketSliderFE = {
|
|
|
455
446
|
data.potentialProductPromotions.forEach((entry) => {
|
|
456
447
|
entry.consumedEntries.forEach((promo) => {
|
|
457
448
|
if (promo.orderEntryNumber === item.entryNumber) {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
449
|
+
if (arr.length) {
|
|
450
|
+
let duplicate = arr.every((el) => {
|
|
451
|
+
return (
|
|
452
|
+
el !== `<div class="products__promo">${entry.description}</div>`
|
|
453
|
+
);
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
!duplicate ||
|
|
457
|
+
arr.push(`<div class="products__promo">${entry.description}</div>`);
|
|
458
|
+
} else {
|
|
459
|
+
arr.push(`<div class="products__promo">${entry.description}</div>`);
|
|
461
460
|
}
|
|
462
461
|
}
|
|
463
462
|
});
|
|
@@ -466,10 +465,18 @@ Wick.MiniBasketSliderFE = {
|
|
|
466
465
|
data.appliedProductPromotions &&
|
|
467
466
|
data.appliedProductPromotions.forEach((entry) => {
|
|
468
467
|
entry.consumedEntries.forEach((promo) => {
|
|
469
|
-
if (promo.orderEntryNumber === item.entryNumber && entry.
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
468
|
+
if (promo.orderEntryNumber === item.entryNumber && entry.description) {
|
|
469
|
+
if (arr.length) {
|
|
470
|
+
let duplicate = arr.every((el) => {
|
|
471
|
+
return (
|
|
472
|
+
el !== `<div class="products__promo">${entry.description}</div>`
|
|
473
|
+
);
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
!duplicate ||
|
|
477
|
+
arr.push(`<div class="products__promo">${entry.description}</div>`);
|
|
478
|
+
} else {
|
|
479
|
+
arr.push(`<div class="products__promo">${entry.description}</div>`);
|
|
473
480
|
}
|
|
474
481
|
}
|
|
475
482
|
});
|
|
@@ -543,7 +550,6 @@ Wick.MiniBasketSliderFE = {
|
|
|
543
550
|
Wick.MiniBasketSliderFE.showMiniBasketEvent();
|
|
544
551
|
setTimeout(() => {
|
|
545
552
|
Wick.MiniBasketSliderFE.isInitial = false;
|
|
546
|
-
Wick.MiniBasketSliderFE.isMiniBasketLoaded = true;
|
|
547
553
|
}, 100);
|
|
548
554
|
return;
|
|
549
555
|
}
|
|
@@ -77,49 +77,9 @@ function executionVoucherApplying(value, context) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
let pendingVoucherRemoval = null;
|
|
81
|
-
|
|
82
80
|
export function voucherRemove() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const couponName = getVoucherDisplayName(voucher) || voucherCode;
|
|
86
|
-
const $modal = $('#voucher-remove-popup');
|
|
87
|
-
|
|
88
|
-
if ($modal.length) {
|
|
89
|
-
$modal.find('.modal-box__title').text(`Remove ${couponName} discount?`);
|
|
90
|
-
$modal
|
|
91
|
-
.find('.description')
|
|
92
|
-
.html(
|
|
93
|
-
`Are you sure you want to remove your <span class='voucher-remove-modal__coupon-name'>${couponName} discount</span> from this order? The total cost of your order will increase.`
|
|
94
|
-
);
|
|
95
|
-
pendingVoucherRemoval = { voucherCode, voucher };
|
|
96
|
-
|
|
97
|
-
const scrollPos = $(window).scrollTop();
|
|
98
|
-
if (Wick.Responsive.isTouchDevice()) {
|
|
99
|
-
$modal.one('show.bs.modal', function (e) {
|
|
100
|
-
e.stopPropagation();
|
|
101
|
-
$('body').css({ position: 'fixed', top: -scrollPos, width: '100%' });
|
|
102
|
-
});
|
|
103
|
-
$modal.one('hidden.bs.modal', function () {
|
|
104
|
-
$('body').css({ position: '', top: '', width: '' });
|
|
105
|
-
window.requestAnimationFrame(function () {
|
|
106
|
-
window.scrollTo(0, scrollPos);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
$modal.modal('show');
|
|
112
|
-
} else {
|
|
113
|
-
voucher.addClass('checkout-widget__voucher-removed').text('Voucher removed');
|
|
114
|
-
voucherRemoveAction(voucherCode, voucher);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function confirmVoucherRemove() {
|
|
119
|
-
if (!pendingVoucherRemoval) return;
|
|
120
|
-
const { voucherCode, voucher } = pendingVoucherRemoval;
|
|
121
|
-
pendingVoucherRemoval = null;
|
|
122
|
-
$('#voucher-remove-popup').modal('hide');
|
|
81
|
+
let voucher = $(this).parent(),
|
|
82
|
+
voucherCode = voucher.attr('data-coupon-code');
|
|
123
83
|
voucher.addClass('checkout-widget__voucher-removed').text('Voucher removed');
|
|
124
84
|
voucherRemoveAction(voucherCode, voucher);
|
|
125
85
|
}
|
|
@@ -155,7 +115,6 @@ function executionVoucherRemoving(data) {
|
|
|
155
115
|
);
|
|
156
116
|
updateClearpayPlacements(data.total);
|
|
157
117
|
updateClearpayVisibility(data.total);
|
|
158
|
-
Wick.BasketPage && Wick.BasketPage.updateCart(true);
|
|
159
118
|
}
|
|
160
119
|
|
|
161
120
|
function applyVoucher(data, context) {
|
|
@@ -172,7 +131,6 @@ function applyVoucher(data, context) {
|
|
|
172
131
|
);
|
|
173
132
|
updateClearpayPlacements(data.total);
|
|
174
133
|
updateClearpayVisibility(data.total);
|
|
175
|
-
Wick.BasketPage && Wick.BasketPage.updateCart(true);
|
|
176
134
|
setTimeout(function () {
|
|
177
135
|
voucherButton.attr('disabled', false);
|
|
178
136
|
$voucherFormInput.val('');
|
|
@@ -238,16 +196,6 @@ function getNotAppliedVoucher() {
|
|
|
238
196
|
}
|
|
239
197
|
}
|
|
240
198
|
|
|
241
|
-
function getVoucherDisplayName($voucher) {
|
|
242
|
-
if (Wick.VatToggle.isToggleVatAvailable()) {
|
|
243
|
-
const selector = Wick.VatToggle.isActive()
|
|
244
|
-
? '.excluding-vat, .excluding-vat-inherit'
|
|
245
|
-
: '.including-vat, .including-vat-inherit';
|
|
246
|
-
return $voucher.find(selector).first().text().trim();
|
|
247
|
-
}
|
|
248
|
-
return $voucher.text().trim();
|
|
249
|
-
}
|
|
250
|
-
|
|
251
199
|
function clearValidationErrors(form) {
|
|
252
200
|
var $form = $(form);
|
|
253
201
|
if ($form.hasClass(voucherEl.formInvalid)) {
|
|
@@ -313,7 +261,5 @@ $(document).ready(function () {
|
|
|
313
261
|
getCSRFToken();
|
|
314
262
|
}
|
|
315
263
|
|
|
316
|
-
$(document).on('click', '[data-action="confirm-voucher-remove"]', confirmVoucherRemove);
|
|
317
|
-
|
|
318
264
|
init();
|
|
319
265
|
});
|
|
@@ -18,7 +18,8 @@ function normalizeOptions(options) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function toInt(value) {
|
|
21
|
-
const n = parseInt(
|
|
21
|
+
const n = parseInt(`${value || ''}`.trim(), 10);
|
|
22
|
+
|
|
22
23
|
return Number.isFinite(n) ? n : NaN;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -28,6 +29,7 @@ function clampMin(n, min) {
|
|
|
28
29
|
|
|
29
30
|
function ensureQty(value, fallback) {
|
|
30
31
|
const n = toInt(value);
|
|
32
|
+
|
|
31
33
|
return Number.isFinite(n) ? n : fallback;
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -58,12 +60,15 @@ function updateButtons($input, opt) {
|
|
|
58
60
|
|
|
59
61
|
const $minus = getMinusBtn($wrap);
|
|
60
62
|
|
|
61
|
-
if ($minus.length)
|
|
63
|
+
if ($minus.length) {
|
|
64
|
+
$minus.prop('disabled', qty <= opt.min);
|
|
65
|
+
}
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
function setQty($input, opt, qty) {
|
|
65
69
|
const next = clampMin(qty, opt.min);
|
|
66
|
-
|
|
70
|
+
|
|
71
|
+
$input.val(`${next}`);
|
|
67
72
|
updateButtons($input, opt);
|
|
68
73
|
|
|
69
74
|
if (typeof opt.onChange === 'function') {
|
|
@@ -83,11 +88,13 @@ function ensureButtons($input, opt) {
|
|
|
83
88
|
if (!hasMinus) {
|
|
84
89
|
$input.before(buildBtn('minus', true));
|
|
85
90
|
}
|
|
91
|
+
|
|
86
92
|
if (!hasPlus) {
|
|
87
93
|
$input.after(buildBtn('plus', false));
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
const initial = ensureQty($input.val(), opt.min);
|
|
97
|
+
|
|
91
98
|
setQty($input, opt, initial);
|
|
92
99
|
}
|
|
93
100
|
|
|
@@ -95,16 +102,24 @@ function getInputs($root, inputSel) {
|
|
|
95
102
|
const $scope = $root && $root.length ? $root : $(document);
|
|
96
103
|
const $self = $scope.is(inputSel) ? $scope : $();
|
|
97
104
|
const $found = $scope.find(inputSel);
|
|
105
|
+
|
|
98
106
|
return $self.add($found);
|
|
99
107
|
}
|
|
100
108
|
|
|
109
|
+
function getNamespace(inputSel) {
|
|
110
|
+
return `.countStepper_${inputSel.replace(/[^a-zA-Z0-9_-]/g, '')}`;
|
|
111
|
+
}
|
|
112
|
+
|
|
101
113
|
// ===== FACTORY =====
|
|
102
114
|
|
|
103
115
|
export function createCountStepper(options = {}) {
|
|
104
116
|
const OPT = normalizeOptions(options);
|
|
105
|
-
if (!OPT.inputSel) throw new Error('[createCountStepper] Missing inputSel');
|
|
106
117
|
|
|
107
|
-
|
|
118
|
+
if (!OPT.inputSel) {
|
|
119
|
+
throw new Error('[createCountStepper] Missing inputSel');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const NS = getNamespace(OPT.inputSel);
|
|
108
123
|
|
|
109
124
|
function init($root) {
|
|
110
125
|
getInputs($root, OPT.inputSel).each(function () {
|
|
@@ -112,7 +127,6 @@ export function createCountStepper(options = {}) {
|
|
|
112
127
|
});
|
|
113
128
|
}
|
|
114
129
|
|
|
115
|
-
// +/- click
|
|
116
130
|
$(document)
|
|
117
131
|
.off(`click${NS}`, '[data-count-btn]')
|
|
118
132
|
.on(`click${NS}`, '[data-count-btn]', function (e) {
|
|
@@ -120,15 +134,22 @@ export function createCountStepper(options = {}) {
|
|
|
120
134
|
const $parent = $btn.parent();
|
|
121
135
|
const $input = $parent.find(OPT.inputSel).first();
|
|
122
136
|
|
|
123
|
-
if (!$input.length)
|
|
137
|
+
if (!$input.length) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
124
140
|
|
|
125
141
|
e.preventDefault();
|
|
126
142
|
|
|
127
143
|
const type = ($btn.attr('data-count-type') || '').toLowerCase();
|
|
128
144
|
const current = ensureQty($input.val(), OPT.min);
|
|
129
145
|
|
|
130
|
-
if (type === 'plus')
|
|
131
|
-
|
|
146
|
+
if (type === 'plus') {
|
|
147
|
+
setQty($input, OPT, current + 1);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (type === 'minus') {
|
|
151
|
+
setQty($input, OPT, current - 1);
|
|
152
|
+
}
|
|
132
153
|
});
|
|
133
154
|
|
|
134
155
|
$(document)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function createLoadingButton(config = {}) {
|
|
2
|
+
const settings = {
|
|
3
|
+
text: '.loading-button__text',
|
|
4
|
+
loader: '.loading-button__loader',
|
|
5
|
+
loadingClass: 'loading-button--loading',
|
|
6
|
+
...config,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function setLoading($button, isLoading) {
|
|
10
|
+
if (!$button.length) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
$button.toggleClass(settings.loadingClass, isLoading);
|
|
15
|
+
$button.find(settings.text).toggleClass('d-none', isLoading);
|
|
16
|
+
$button.find(settings.loader).toggleClass('d-none', !isLoading);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function start($button) {
|
|
20
|
+
setLoading($button, true);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function stop($button) {
|
|
24
|
+
setLoading($button, false);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isLoading($button) {
|
|
28
|
+
return $button.hasClass(settings.loadingClass);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
setLoading,
|
|
33
|
+
start,
|
|
34
|
+
stop,
|
|
35
|
+
isLoading,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export function createToast(config = {}) {
|
|
2
|
+
const settings = {
|
|
3
|
+
containerClass: 'toast-container',
|
|
4
|
+
toastClass: 'toast',
|
|
5
|
+
closeSelector: '.notification__close',
|
|
6
|
+
backdropClass: 'modal-backdrop--toast',
|
|
7
|
+
duration: 3000,
|
|
8
|
+
template: null,
|
|
9
|
+
getData(type, text) {
|
|
10
|
+
return {
|
|
11
|
+
text,
|
|
12
|
+
classModifier: `${settings.toastClass} notification_${type}`,
|
|
13
|
+
success: type === 'success',
|
|
14
|
+
warning: type === 'warning',
|
|
15
|
+
error: type === 'error',
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
...config,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
let closeTimer = null;
|
|
22
|
+
|
|
23
|
+
function clearCloseTimer() {
|
|
24
|
+
if (closeTimer) {
|
|
25
|
+
window.clearTimeout(closeTimer);
|
|
26
|
+
closeTimer = null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function hide() {
|
|
31
|
+
clearCloseTimer();
|
|
32
|
+
|
|
33
|
+
$(`.${settings.containerClass}`).remove();
|
|
34
|
+
$(`.${settings.backdropClass}`).removeClass(settings.backdropClass);
|
|
35
|
+
|
|
36
|
+
if (window.Wick && Wick.Backdrop) {
|
|
37
|
+
Wick.Backdrop.hide();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
$(document).off('click.toast');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function show({ type = 'success', text = '' }) {
|
|
44
|
+
if (!settings.template) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
hide();
|
|
49
|
+
|
|
50
|
+
const toastHtml = settings.template(settings.getData(type, text));
|
|
51
|
+
|
|
52
|
+
if (window.Wick && Wick.Backdrop) {
|
|
53
|
+
Wick.Backdrop.show();
|
|
54
|
+
$('.modal-backdrop').addClass(settings.backdropClass);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
$('body').append(`<div class="${settings.containerClass}">${toastHtml}</div>`);
|
|
58
|
+
|
|
59
|
+
$(`.${settings.containerClass}`)
|
|
60
|
+
.off('click.toastClose', settings.closeSelector)
|
|
61
|
+
.on('click.toastClose', settings.closeSelector, function (event) {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
hide();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
$(document)
|
|
67
|
+
.off('click.toast')
|
|
68
|
+
.on('click.toast', `.${settings.backdropClass}`, function () {
|
|
69
|
+
hide();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
closeTimer = window.setTimeout(hide, settings.duration);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
show,
|
|
77
|
+
hide,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export function createDropdown(config) {
|
|
2
|
+
const settings = {
|
|
3
|
+
root: '[data-dropdown]',
|
|
4
|
+
toggle: '[data-dropdown-toggle]',
|
|
5
|
+
value: '[data-dropdown-value]',
|
|
6
|
+
option: '[data-dropdown-option]',
|
|
7
|
+
openClass: 'dropdown--open',
|
|
8
|
+
selectedClass: 'dropdown__option--selected',
|
|
9
|
+
selectedValueData: 'selected-value',
|
|
10
|
+
ariaExpandedAttr: 'aria-expanded',
|
|
11
|
+
ariaSelectedAttr: 'aria-selected',
|
|
12
|
+
namespace: 'customDropdown',
|
|
13
|
+
onSelect: function () {},
|
|
14
|
+
...config,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function closeAll() {
|
|
18
|
+
$(settings.root).each(function () {
|
|
19
|
+
const $dropdown = $(this);
|
|
20
|
+
const $toggle = $dropdown.find(settings.toggle);
|
|
21
|
+
|
|
22
|
+
$dropdown.removeClass(settings.openClass);
|
|
23
|
+
$toggle.attr(settings.ariaExpandedAttr, 'false');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function selectOption($dropdown, $option) {
|
|
28
|
+
const $value = $dropdown.find(settings.value);
|
|
29
|
+
const $options = $dropdown.find(settings.option);
|
|
30
|
+
const selectedValue = $option.attr('data-value') || '';
|
|
31
|
+
|
|
32
|
+
$options.removeClass(settings.selectedClass).attr(settings.ariaSelectedAttr, 'false');
|
|
33
|
+
$option.addClass(settings.selectedClass).attr(settings.ariaSelectedAttr, 'true');
|
|
34
|
+
|
|
35
|
+
if ($value.length) {
|
|
36
|
+
$value.text($option.text().trim());
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
$dropdown.data(settings.selectedValueData, selectedValue);
|
|
40
|
+
|
|
41
|
+
settings.onSelect($dropdown, $option, selectedValue);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function bind() {
|
|
45
|
+
$(document).off(`click.${settings.namespace}`);
|
|
46
|
+
$(document).on(`click.${settings.namespace}`, function (event) {
|
|
47
|
+
const $target = $(event.target);
|
|
48
|
+
const $toggle = $target.closest(settings.toggle);
|
|
49
|
+
const $option = $target.closest(settings.option);
|
|
50
|
+
const $dropdown = $target.closest(settings.root);
|
|
51
|
+
|
|
52
|
+
if (!$dropdown.length) {
|
|
53
|
+
closeAll();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if ($toggle.length) {
|
|
58
|
+
const isOpen = $dropdown.hasClass(settings.openClass);
|
|
59
|
+
|
|
60
|
+
closeAll();
|
|
61
|
+
|
|
62
|
+
$dropdown.toggleClass(settings.openClass, !isOpen);
|
|
63
|
+
$toggle.attr(settings.ariaExpandedAttr, String(!isOpen));
|
|
64
|
+
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if ($option.length) {
|
|
69
|
+
selectOption($dropdown, $option);
|
|
70
|
+
closeAll();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
bind,
|
|
77
|
+
closeAll,
|
|
78
|
+
selectOption,
|
|
79
|
+
};
|
|
80
|
+
}
|
package/src/layouts/checkout.hbs
CHANGED
|
@@ -58,10 +58,6 @@
|
|
|
58
58
|
<div class="modal-images"></div>
|
|
59
59
|
{{/content}}
|
|
60
60
|
{{/extend}}
|
|
61
|
-
{{> checkout-voucher-remove-modal
|
|
62
|
-
shopping-cart-v2.checkout.voucher-remove-popup
|
|
63
|
-
id="voucher-remove-popup"
|
|
64
|
-
}}
|
|
65
61
|
<script defer src="./js/energy-efficiency.min.js"></script>
|
|
66
62
|
<script defer src="./js/basket.min.js"></script>
|
|
67
63
|
{{/content}}
|
|
@@ -38,10 +38,6 @@
|
|
|
38
38
|
{{/content}}
|
|
39
39
|
|
|
40
40
|
{{#content "foot" mode="append"}}
|
|
41
|
-
{{> checkout-voucher-remove-modal
|
|
42
|
-
shopping-cart-v2.checkout.voucher-remove-popup
|
|
43
|
-
id="voucher-remove-popup"
|
|
44
|
-
}}
|
|
45
41
|
<script defer src="./js/page/checkout-confirmation-new.js"></script>
|
|
46
42
|
{{/content}}
|
|
47
43
|
|
|
@@ -39,10 +39,6 @@
|
|
|
39
39
|
{{/content}}
|
|
40
40
|
|
|
41
41
|
{{#content "foot" mode="append"}}
|
|
42
|
-
{{> checkout-voucher-remove-modal
|
|
43
|
-
shopping-cart-v2.checkout.voucher-remove-popup
|
|
44
|
-
id="voucher-remove-popup"
|
|
45
|
-
}}
|
|
46
42
|
<script defer src="./js/page/checkout-confirmation-new.js"></script>
|
|
47
43
|
{{/content}}
|
|
48
44
|
{{/extend}}
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
{{> order-summary delivery-address-v2.summary no-action=true id=1 basket-id=true email=true}}
|
|
13
13
|
{{/content}}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
{{>tradepro-discount-banner}}
|
|
17
|
-
{{/content}}
|
|
15
|
+
|
|
18
16
|
{{#content "main"}}
|
|
19
17
|
<div class="delivery-block">
|
|
20
18
|
<h3 class="delivery-block__heading">Delivery Information</h3>
|
|
@@ -126,10 +124,6 @@
|
|
|
126
124
|
{{/content}}
|
|
127
125
|
|
|
128
126
|
{{#content "foot" mode="append"}}
|
|
129
|
-
{{> checkout-voucher-remove-modal
|
|
130
|
-
shopping-cart-v2.checkout.voucher-remove-popup
|
|
131
|
-
id="voucher-remove-popup"
|
|
132
|
-
}}
|
|
133
127
|
<script defer src="./js/page/checkout-confirmation-new.js"></script>
|
|
134
128
|
<script defer src="./js/page/select-address.js"></script>
|
|
135
129
|
|
|
@@ -127,10 +127,6 @@
|
|
|
127
127
|
{{/content}}
|
|
128
128
|
|
|
129
129
|
{{#content "foot" mode="append"}}
|
|
130
|
-
{{> checkout-voucher-remove-modal
|
|
131
|
-
shopping-cart-v2.checkout.voucher-remove-popup
|
|
132
|
-
id="voucher-remove-popup"
|
|
133
|
-
}}
|
|
134
130
|
<script defer src="./js/page/checkout-confirmation-new.js"></script>
|
|
135
131
|
<script defer src="./js/page/select-address.js"></script>
|
|
136
132
|
|
|
@@ -151,10 +151,6 @@
|
|
|
151
151
|
{{/content}}
|
|
152
152
|
|
|
153
153
|
{{#content "foot" mode="append"}}
|
|
154
|
-
{{> checkout-voucher-remove-modal
|
|
155
|
-
shopping-cart-v2.checkout.voucher-remove-popup
|
|
156
|
-
id="voucher-remove-popup"
|
|
157
|
-
}}
|
|
158
154
|
<script defer src="./js/page/checkout-confirmation-new.js"></script>
|
|
159
155
|
<script defer src="./js/page/select-address.js"></script>
|
|
160
156
|
|
|
@@ -133,10 +133,6 @@
|
|
|
133
133
|
{{/content}}
|
|
134
134
|
|
|
135
135
|
{{#content "foot" mode="append"}}
|
|
136
|
-
{{> checkout-voucher-remove-modal
|
|
137
|
-
shopping-cart-v2.checkout.voucher-remove-popup
|
|
138
|
-
id="voucher-remove-popup"
|
|
139
|
-
}}
|
|
140
136
|
<script defer src="./js/page/checkout-confirmation-new.js"></script>
|
|
141
137
|
<script defer src="./js/page/select-address.js"></script>
|
|
142
138
|
|
|
@@ -130,10 +130,6 @@
|
|
|
130
130
|
{{/content}}
|
|
131
131
|
|
|
132
132
|
{{#content "foot" mode="append"}}
|
|
133
|
-
{{> checkout-voucher-remove-modal
|
|
134
|
-
shopping-cart-v2.checkout.voucher-remove-popup
|
|
135
|
-
id="voucher-remove-popup"
|
|
136
|
-
}}
|
|
137
133
|
<script defer src="./js/page/checkout-confirmation-new.js"></script>
|
|
138
134
|
<script defer src="./js/page/select-address.js"></script>
|
|
139
135
|
|
|
@@ -126,10 +126,6 @@
|
|
|
126
126
|
{{/content}}
|
|
127
127
|
|
|
128
128
|
{{#content "foot" mode="append"}}
|
|
129
|
-
{{> checkout-voucher-remove-modal
|
|
130
|
-
shopping-cart-v2.checkout.voucher-remove-popup
|
|
131
|
-
id="voucher-remove-popup"
|
|
132
|
-
}}
|
|
133
129
|
<script defer src="./js/page/checkout-confirmation-new.js"></script>
|
|
134
130
|
<script defer src="./js/page/select-address.js"></script>
|
|
135
131
|
|