wickes-css2 2.109.0-develop.2 → 2.109.0-develop.4
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/build/css/category-main.css +1 -1
- package/build/css/components/card-product-banner.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_checkout_delivery-new.css +1 -1
- package/build/css/pages/page_products-list-combined.css +1 -1
- package/build/css/pages/page_products-list.css +1 -1
- package/build/css/pages/page_shopping-cart-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/basket.min.js +1 -1
- package/build/js/checkout.min.js +1 -1
- package/build/js/emulation.min.js +490 -56
- package/build/js/gift-cards.min.js +1 -1
- package/build/js/merged-checkout.min.js +1 -1
- package/build/js/mini-basket-slider.min.js +1 -1
- package/build/js/page/basket/mini-basket-total.js +17 -2
- package/build/js/page/basket-v2.js +30 -26
- package/build/js/page/components/notify-me.js +99 -0
- package/build/js/page/components/order-summary.js +35 -0
- package/build/js/pdp.bundle.min.js +2 -1
- package/build/js/wickes-dc.js +1 -0
- package/package.json +1 -3
- package/src/components/base/button.hbs +1 -1
- package/src/components/card_product_banner_v2.hbs +4 -1
- package/src/components/card_sponsor_banner.hbs +4 -1
- package/src/components/checkout_order-summary-new.hbs +10 -1
- package/src/components/click-and-collect-modal.hbs +0 -14
- package/src/components/date-selection.hbs +1 -1
- package/src/components/delivery-types.hbs +11 -3
- package/src/components/injected-content.hbs +6 -1
- package/src/components/modal.hbs +1 -1
- package/src/components/modals/notify-me-modal.hbs +76 -0
- package/src/components/order-item.hbs +7 -7
- package/src/components/order-summary.hbs +2 -2
- package/src/components/potential-promotion.hbs +4 -4
- package/src/components/price-block-v2.hbs +211 -214
- package/src/components/sponsor-top-banner.hbs +10 -0
- package/src/data/data_delivery-address-v2.json +1 -1
- package/src/data/data_search-results_v2.json +9 -2
- package/src/data/data_shopping-cart-v2.json +46 -2
- package/src/data/data_shopping-cart-with-energy.json +26 -2
- package/src/data/data_spr_injected_content.json +4 -0
- package/src/js/emulation/basket-data.js +312 -0
- package/src/js/emulation/checkout-delivery-details.js +28 -25
- package/src/js/emulation/custom-slider-emulation.js +1 -1
- package/src/js/emulation/date-selection.js +136 -24
- package/src/js/emulation/forms.js +12 -0
- package/src/js/emulation/mini-basket-data.js +3 -3
- package/src/js/emulation/notify-me.js +9 -0
- package/src/js/emulation/switchCalendar.js +12 -8
- package/src/js/page/basket/mini-basket-total.js +17 -2
- package/src/js/page/basket-v2.js +30 -26
- package/src/js/page/components/notify-me.js +99 -0
- package/src/js/page/components/order-summary.js +35 -0
- package/src/page_checkout_next-day-delivery-details.html +2 -2
- package/src/page_checkout_payment-details-v2-asm.html +1 -1
- package/src/page_checkout_payment-details-v2.html +1 -1
- package/src/page_checkout_payment-details_with-card-loader.html +1 -1
- package/src/page_checkout_payment-details_with-klarna-loader.html +1 -1
- package/src/page_checkout_payment-details_with-loader-v2.html +1 -1
- package/src/page_checkout_rapid-delivery-details.html +7 -5
- package/src/page_klarna_payment-details_with-klarna.html +1 -1
- package/src/page_payment-details-with-billie.html +1 -1
- package/src/page_payment-details-with-clearpay.html +1 -1
- package/src/page_payment-details-with-gift-card.html +1 -1
- package/src/page_payment-details_with_apple-pay.html +1 -1
- package/src/page_payment-details_with_google-pay.html +1 -1
- package/src/page_plp_v2.html +1 -0
- package/src/page_product-details-mfe-calculator.html +9 -3
- package/src/scss/common/_CTAs.scss +7 -3
- package/src/scss/components/_custom-slider.scss +18 -0
- package/src/scss/components/_date-selection-add-new-styles.scss +43 -1
- package/src/scss/components/_notify-me-modal.scss +139 -0
- package/src/scss/components/_order-summary.scss +25 -12
- package/src/scss/components/_price-block-critical.scss +2 -2
- package/src/scss/components/_price-block.scss +14 -4
- package/src/scss/components/card-product-banner.scss +8 -0
- package/src/scss/helpers/_CTAs.scss +15 -5
- package/src/scss/pages/page_checkout_delivery-new.scss +36 -0
- package/src/scss/pages/page_products-list-combined.scss +8 -1
- package/src/scss/pages/page_products-list.scss +8 -1
- package/src/scss/pages/page_shopping-cart-v2.scss +34 -10
- package/src/scss/pdp-main.scss +1 -0
|
@@ -1,32 +1,144 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
const DS_EL = {
|
|
2
|
+
cell: '.calendar__cell_cnt',
|
|
3
|
+
dateSelection: '.date-selection',
|
|
4
|
+
loader: '.rapid-loader',
|
|
5
|
+
title: '.delivery-btn .title',
|
|
6
|
+
subtitle: '.delivery-btn .subtitle',
|
|
7
|
+
infoIcon: '.rapid-info-icon',
|
|
8
|
+
image: '.delivery-btn__image',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const DS_CLASSES = {
|
|
12
|
+
selectedCell: 'calendar__cell_selected',
|
|
13
|
+
isSelected: 'date-selection_selected',
|
|
14
|
+
rapidCell: 'calendar__cell_rapid',
|
|
15
|
+
hidden: 'd-none',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
let rapidLoaderShown = false;
|
|
19
|
+
let isDateSelected = false;
|
|
20
|
+
|
|
21
|
+
function generateRapidEstimate() {
|
|
22
|
+
const scenario = Math.floor(Math.random() * 4);
|
|
23
|
+
|
|
24
|
+
switch (scenario) {
|
|
25
|
+
case 0: {
|
|
26
|
+
const mins = Math.floor(Math.random() * 59) + 1;
|
|
27
|
+
const padded = String(mins).padStart(2, '0');
|
|
28
|
+
const word = mins === 1 ? 'minute' : 'minutes';
|
|
29
|
+
return `Delivered in as little as <br>${padded} ${word} for £10.00`;
|
|
30
|
+
}
|
|
31
|
+
case 1: {
|
|
32
|
+
const mins = Math.floor(Math.random() * 60);
|
|
33
|
+
const padded = String(mins).padStart(2, '0');
|
|
34
|
+
const word = mins === 1 ? 'minute' : 'minutes';
|
|
35
|
+
const minutePart = mins === 0 ? '00 minutes' : `${padded} ${word}`;
|
|
36
|
+
return `Delivered in as little as <br>1 hour ${minutePart} for £10.00`;
|
|
37
|
+
}
|
|
38
|
+
case 2: {
|
|
39
|
+
const mins = Math.floor(Math.random() * 60);
|
|
40
|
+
const padded = String(mins).padStart(2, '0');
|
|
41
|
+
const word = mins === 1 ? 'minute' : 'minutes';
|
|
42
|
+
const minutePart = mins === 0 ? '00 minutes' : `${padded} ${word}`;
|
|
43
|
+
return `Delivered in as little as <br>2 hours ${minutePart} for £10.00`;
|
|
44
|
+
}
|
|
45
|
+
default:
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function updateDeliveryInfo() {
|
|
51
|
+
const $subtitle = $(DS_EL.subtitle);
|
|
52
|
+
const $infoIcon = $subtitle.find(DS_EL.infoIcon).detach();
|
|
53
|
+
const estimate = generateRapidEstimate();
|
|
54
|
+
|
|
55
|
+
if (estimate) {
|
|
56
|
+
$subtitle.html(estimate);
|
|
57
|
+
$infoIcon.removeClass(DS_CLASSES.hidden);
|
|
58
|
+
} else {
|
|
59
|
+
$subtitle.html('Delivery within 3 hours for <b>£10.00');
|
|
60
|
+
$infoIcon.addClass(DS_CLASSES.hidden);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
$subtitle.append($infoIcon);
|
|
64
|
+
$infoIcon.filter('[data-toggle="tooltip"]').tooltip();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function showRapidLoader() {
|
|
68
|
+
const $self = $(DS_EL.dateSelection);
|
|
69
|
+
const $loader = $(DS_EL.loader);
|
|
70
|
+
$loader.removeClass(DS_CLASSES.hidden);
|
|
71
|
+
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
$loader.addClass(DS_CLASSES.hidden);
|
|
74
|
+
$self.addClass(DS_CLASSES.isSelected);
|
|
75
|
+
updateRapidInfo();
|
|
76
|
+
}, 3000);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function updateNonRapidInfo() {
|
|
80
|
+
const $title = $(DS_EL.title);
|
|
81
|
+
const $subtitle = $(DS_EL.subtitle);
|
|
82
|
+
const $infoIcon = $subtitle.find(DS_EL.infoIcon).detach();
|
|
83
|
+
const $image = $(DS_EL.image);
|
|
84
|
+
|
|
85
|
+
$title.text('Next or Named day delivery');
|
|
86
|
+
$subtitle.html('Delivery between 7am - 7pm for £12.00');
|
|
87
|
+
$infoIcon.addClass(DS_CLASSES.hidden);
|
|
88
|
+
$subtitle.append($infoIcon);
|
|
89
|
+
$image.addClass(DS_CLASSES.hidden);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function updateRapidInfo() {
|
|
93
|
+
const $title = $(DS_EL.title);
|
|
94
|
+
const $image = $(DS_EL.image);
|
|
95
|
+
|
|
96
|
+
$title.text('Rapid delivery');
|
|
97
|
+
$image.removeClass(DS_CLASSES.hidden);
|
|
98
|
+
updateDeliveryInfo();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function selectTimeSlot(e) {
|
|
102
|
+
const $self = $(DS_EL.dateSelection);
|
|
103
|
+
const $cell = $(e.target).closest(DS_EL.cell);
|
|
104
|
+
const isRapid = $cell.hasClass(DS_CLASSES.rapidCell);
|
|
105
|
+
|
|
106
|
+
$(DS_EL.cell).removeClass(DS_CLASSES.selectedCell);
|
|
107
|
+
$cell.addClass(DS_CLASSES.selectedCell);
|
|
13
108
|
$self.trigger('selected');
|
|
14
109
|
isDateSelected = true;
|
|
15
|
-
};
|
|
16
110
|
|
|
17
|
-
|
|
111
|
+
if (isRapid) {
|
|
112
|
+
if (!rapidLoaderShown) {
|
|
113
|
+
rapidLoaderShown = true;
|
|
114
|
+
showRapidLoader();
|
|
115
|
+
return;
|
|
116
|
+
} else {
|
|
117
|
+
$self.addClass(DS_CLASSES.isSelected);
|
|
118
|
+
updateRapidInfo();
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
$self.addClass(DS_CLASSES.isSelected);
|
|
122
|
+
updateNonRapidInfo();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function initDateSelection() {
|
|
127
|
+
const $self = $(DS_EL.dateSelection);
|
|
128
|
+
|
|
18
129
|
if (!$self.length) {
|
|
19
|
-
|
|
130
|
+
return;
|
|
20
131
|
}
|
|
21
132
|
|
|
22
|
-
$self.on('click', cell, selectTimeSlot);
|
|
23
|
-
|
|
133
|
+
$self.on('click', DS_EL.cell, selectTimeSlot);
|
|
134
|
+
}
|
|
24
135
|
|
|
25
|
-
|
|
136
|
+
var Wick = window.Wick || {};
|
|
26
137
|
|
|
27
|
-
|
|
28
|
-
isDateSelected:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
138
|
+
Wick.DateSelection = {
|
|
139
|
+
isDateSelected: () => isDateSelected,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
$(document).ready(function () {
|
|
143
|
+
initDateSelection();
|
|
144
|
+
});
|
|
@@ -323,6 +323,18 @@ Wick.Forms = (function () {
|
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
if ($(form).is('.notify-me-form')) {
|
|
327
|
+
if ($(form).find('#notify-me-email').val().length) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if ($(form).is('.add-list-id__form')) {
|
|
333
|
+
if ($(form).find('#project-id').val().length) {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
326
338
|
if ($(form).is('.header-search')) {
|
|
327
339
|
window.location.href = './page_search-results.html';
|
|
328
340
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
window.Wick = window.Wick || {};
|
|
2
2
|
Wick.MiniBasketData = (function () {
|
|
3
3
|
return {
|
|
4
4
|
updateQuantity: {
|
|
@@ -874,14 +874,14 @@ Wick.MiniBasketData = (function () {
|
|
|
874
874
|
clickAndCollectOnly: false,
|
|
875
875
|
deliveryItemsQuantity: 1,
|
|
876
876
|
pickupItemsQuantity: 2,
|
|
877
|
-
freeDelivery:
|
|
877
|
+
freeDelivery: false,
|
|
878
878
|
subtotalWithoutCharity: {
|
|
879
879
|
value: 19.0,
|
|
880
880
|
formattedValue: '£19.00',
|
|
881
881
|
currencyIso: 'GBP',
|
|
882
882
|
formattedPriceWithoutCurrencySymbol: '19.00',
|
|
883
883
|
},
|
|
884
|
-
messageForFreeDelivery:
|
|
884
|
+
messageForFreeDelivery: null,
|
|
885
885
|
pickupOrderGroups: [
|
|
886
886
|
{
|
|
887
887
|
entries: [
|
|
@@ -16,20 +16,21 @@ Wick.Calendar = {
|
|
|
16
16
|
if ($(this).hasClass(Wick.Calendar.el.switchBtnEarlier)) {
|
|
17
17
|
$currentCalendar = $currentCalendar.prev();
|
|
18
18
|
$currentCalendar.removeClass(Wick.Calendar.el.dateSectionHidden);
|
|
19
|
-
|
|
20
19
|
} else if ($(this).hasClass(Wick.Calendar.el.switchBtnLatest)) {
|
|
21
20
|
$currentCalendar = $currentCalendar.next(Wick.Calendar.el.dateSection);
|
|
22
21
|
$currentCalendar.removeClass(Wick.Calendar.el.dateSectionHidden);
|
|
23
22
|
}
|
|
24
23
|
},
|
|
25
|
-
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
$(document).ready(function () {
|
|
29
27
|
function init() {
|
|
30
|
-
|
|
31
28
|
if (Wick.checkLocalEnv) {
|
|
32
|
-
$(Wick.Calendar.el.componentDateSection).on(
|
|
29
|
+
$(Wick.Calendar.el.componentDateSection).on(
|
|
30
|
+
'click',
|
|
31
|
+
Wick.Calendar.el.switchBtn,
|
|
32
|
+
Wick.Calendar.SwitchCalendar
|
|
33
|
+
);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -39,8 +40,11 @@ $(document).ready(function () {
|
|
|
39
40
|
|
|
40
41
|
init();
|
|
41
42
|
|
|
42
|
-
$(window).on(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
$(window).on(
|
|
44
|
+
'resize',
|
|
45
|
+
_.debounce(function () {
|
|
46
|
+
unbind();
|
|
47
|
+
init();
|
|
48
|
+
}, 250)
|
|
49
|
+
);
|
|
46
50
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { updateDiscount } from '../components/discounts';
|
|
2
2
|
|
|
3
3
|
const osEl = {
|
|
4
|
-
|
|
4
|
+
totalSection: '.mini-basket__total',
|
|
5
5
|
checkoutWidgetDetailsDiscount: '.checkout-widget__details-discount',
|
|
6
6
|
checkoutWidgetDetails: '.checkout-widget__details',
|
|
7
7
|
delivery: '.checkout-widget__item-delivery',
|
|
8
|
+
deliveryCostMessage: '.checkout-widget__item-delivery-cost-message',
|
|
8
9
|
cc: '.checkout-widget__item-cc',
|
|
9
10
|
itemFree: '.checkout-widget__item-free',
|
|
10
11
|
itemDeficit: '.checkout-widget__item-deficit',
|
|
@@ -37,26 +38,40 @@ export function updateTotal(data, equalMap, isVoucher) {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
function createCheckoutWidgetItem(obj) {
|
|
41
|
+
const isDelivery = obj.item === osEl.delivery;
|
|
40
42
|
return `
|
|
41
43
|
<li class="checkout-widget__item ${obj.item.substr(1)}">
|
|
42
44
|
<span>${obj.title}</span>
|
|
43
45
|
<span class="checkout-widget__item-value">${obj.dataValue}</span>
|
|
44
46
|
</li>
|
|
47
|
+
${
|
|
48
|
+
isDelivery
|
|
49
|
+
? `
|
|
50
|
+
<li class="checkout-widget__item checkout-widget__item-delivery-cost-message">
|
|
51
|
+
<span class="checkout-widget__item-value" id="order-delivery-cost-message">
|
|
52
|
+
Final delivery cost confirmed at checkout
|
|
53
|
+
</span>
|
|
54
|
+
</li>`
|
|
55
|
+
: ''
|
|
56
|
+
}
|
|
45
57
|
`;
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
function hideUnusedDeliveryTypeCost(data, isVoucher) {
|
|
49
61
|
$(osEl.delivery).show();
|
|
62
|
+
$(osEl.deliveryCostMessage).show();
|
|
50
63
|
$(osEl.cc).show();
|
|
51
64
|
if (isVoucher) {
|
|
52
65
|
if (!data.deliveryOrder) {
|
|
53
66
|
$(osEl.delivery).hide();
|
|
67
|
+
$(osEl.deliveryCostMessage).hide();
|
|
54
68
|
} else if (!data.clickAndCollectOrder) {
|
|
55
69
|
$(osEl.cc).hide();
|
|
56
70
|
}
|
|
57
71
|
} else {
|
|
58
72
|
if (data.clickAndCollectOnly) {
|
|
59
73
|
$(osEl.delivery).hide();
|
|
74
|
+
$(osEl.deliveryCostMessage).hide();
|
|
60
75
|
} else if (data.deliveryItemsQuantity > 0 && data.pickupItemsQuantity === 0) {
|
|
61
76
|
$(osEl.cc).hide();
|
|
62
77
|
}
|
|
@@ -64,7 +79,7 @@ function hideUnusedDeliveryTypeCost(data, isVoucher) {
|
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
function calculateFreeDelivery(data) {
|
|
67
|
-
osEl
|
|
82
|
+
$(osEl.totalSection).each(function () {
|
|
68
83
|
let $free = $(this).find(osEl.itemFree);
|
|
69
84
|
let $deficit = $(this).find(osEl.itemDeficit);
|
|
70
85
|
|
package/src/js/page/basket-v2.js
CHANGED
|
@@ -277,13 +277,13 @@ Wick.BasketPage = {
|
|
|
277
277
|
if (isSwitchVat) {
|
|
278
278
|
const itemTotalIncVat = context.find(Wick.BasketPage.el.itemTotalIncVat);
|
|
279
279
|
const itemTotalExcVat = context.find(Wick.BasketPage.el.itemTotalExcVat);
|
|
280
|
-
const totalPrice = data.entry.
|
|
281
|
-
const totalPriceExcVat = data.entry.
|
|
280
|
+
const totalPrice = data.entry.displayItemTotalWithoutDiscount.formattedValue;
|
|
281
|
+
const totalPriceExcVat = data.entry.displayItemTotalWithoutDiscountExclusiveVat.formattedValue;
|
|
282
282
|
itemTotalIncVat.text(totalPrice);
|
|
283
283
|
itemTotalExcVat.text(totalPriceExcVat);
|
|
284
284
|
} else {
|
|
285
285
|
const totalValue = context.find(Wick.BasketPage.el.itemTotal);
|
|
286
|
-
const totalPrice = data.entry.
|
|
286
|
+
const totalPrice = data.entry.displayItemTotalWithoutDiscount.formattedValue;
|
|
287
287
|
totalValue.text(totalPrice);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
@@ -798,20 +798,20 @@ Wick.BasketPage = {
|
|
|
798
798
|
<div class="order-item__price-title">Item price:</div>
|
|
799
799
|
<div class="order-item__price-value">
|
|
800
800
|
${
|
|
801
|
-
currentItem.
|
|
801
|
+
currentItem.displayBasePrice.value === 0
|
|
802
802
|
? '<span class="order-item__value">FREE</span>'
|
|
803
803
|
: Wick.VatToggle.isToggleVatAvailable()
|
|
804
804
|
? `
|
|
805
805
|
<div class="including-vat"><!--
|
|
806
|
-
--><span class="order-item__value">${currentItem.
|
|
806
|
+
--><span class="order-item__value">${currentItem.displayBasePrice.formattedValue}</span><!--
|
|
807
807
|
--><div class="price-vat">Inc.VAT</div>
|
|
808
808
|
</div>
|
|
809
809
|
<div class="excluding-vat"><!--
|
|
810
|
-
--><span class="order-item__value">${currentItem.
|
|
810
|
+
--><span class="order-item__value">${currentItem.displayBasePriceExclusiveVat.formattedValue}</span><!--
|
|
811
811
|
--><div class="price-vat">Exc.VAT</div>
|
|
812
812
|
</div>
|
|
813
813
|
`
|
|
814
|
-
: `<span class="order-item__value">${currentItem.
|
|
814
|
+
: `<span class="order-item__value">${currentItem.displayBasePrice.formattedValue}</span>`
|
|
815
815
|
}
|
|
816
816
|
</div>
|
|
817
817
|
</div>
|
|
@@ -820,20 +820,20 @@ Wick.BasketPage = {
|
|
|
820
820
|
<div class="order-item__total-title">Item total:</div>
|
|
821
821
|
<div class="order-item__total-value">
|
|
822
822
|
${
|
|
823
|
-
currentItem.
|
|
823
|
+
currentItem.displayItemTotalWithoutDiscount.value === 0
|
|
824
824
|
? '<span class="order-item__value">FREE</span>'
|
|
825
825
|
: Wick.VatToggle.isToggleVatAvailable()
|
|
826
826
|
? `
|
|
827
827
|
<div class="including-vat"><!--
|
|
828
|
-
--><span class="order-item__value">${currentItem.
|
|
828
|
+
--><span class="order-item__value">${currentItem.displayItemTotalWithoutDiscount.formattedValue}</span><!--
|
|
829
829
|
--><div class="price-vat">Inc.VAT</div><!--
|
|
830
830
|
--></div>
|
|
831
831
|
<div class="excluding-vat"><!--
|
|
832
|
-
--><span class="order-item__value">${currentItem.
|
|
832
|
+
--><span class="order-item__value">${currentItem.displayItemTotalWithoutDiscountExclusiveVat.formattedValue}</span><!--
|
|
833
833
|
--><div class="price-vat">Exc.VAT</div>
|
|
834
834
|
</div>
|
|
835
835
|
`
|
|
836
|
-
: `<span class="order-item__value">${currentItem.
|
|
836
|
+
: `<span class="order-item__value">${currentItem.displayItemTotalWithoutDiscount.formattedValue}</span>`
|
|
837
837
|
}
|
|
838
838
|
</div>
|
|
839
839
|
</div>
|
|
@@ -912,16 +912,16 @@ Wick.BasketPage = {
|
|
|
912
912
|
let duplicate = arr.every((el) => {
|
|
913
913
|
return (
|
|
914
914
|
el !==
|
|
915
|
-
`<div class="order-item__promo">${entry.
|
|
915
|
+
`<div class="order-item__promo">${entry.displayDescription}</div>`
|
|
916
916
|
);
|
|
917
917
|
});
|
|
918
918
|
|
|
919
919
|
!duplicate ||
|
|
920
920
|
arr.push(
|
|
921
|
-
`<div class="order-item__promo">${entry.
|
|
921
|
+
`<div class="order-item__promo">${entry.displayDescription}</div>`
|
|
922
922
|
);
|
|
923
923
|
} else {
|
|
924
|
-
arr.push(`<div class="order-item__promo">${entry.
|
|
924
|
+
arr.push(`<div class="order-item__promo">${entry.displayDescription}</div>`);
|
|
925
925
|
}
|
|
926
926
|
}
|
|
927
927
|
});
|
|
@@ -930,21 +930,21 @@ Wick.BasketPage = {
|
|
|
930
930
|
data.appliedProductPromotions &&
|
|
931
931
|
data.appliedProductPromotions.forEach((entry) => {
|
|
932
932
|
entry.consumedEntries.forEach((promo) => {
|
|
933
|
-
if (promo.orderEntryNumber === item.entryNumber && entry.
|
|
933
|
+
if (promo.orderEntryNumber === item.entryNumber && entry.displayDescription) {
|
|
934
934
|
if (arr.length) {
|
|
935
935
|
let duplicate = arr.every((el) => {
|
|
936
936
|
return (
|
|
937
937
|
el !==
|
|
938
|
-
`<div class="order-item__promo">${entry.
|
|
938
|
+
`<div class="order-item__promo">${entry.displayDescription}</div>`
|
|
939
939
|
);
|
|
940
940
|
});
|
|
941
941
|
|
|
942
942
|
!duplicate ||
|
|
943
943
|
arr.push(
|
|
944
|
-
`<div class="order-item__promo">${entry.
|
|
944
|
+
`<div class="order-item__promo">${entry.displayDescription}</div>`
|
|
945
945
|
);
|
|
946
946
|
} else {
|
|
947
|
-
arr.push(`<div class="order-item__promo">${entry.
|
|
947
|
+
arr.push(`<div class="order-item__promo">${entry.displayDescription}</div>`);
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
950
|
});
|
|
@@ -1122,15 +1122,17 @@ Wick.BasketPage = {
|
|
|
1122
1122
|
const arr = [];
|
|
1123
1123
|
if (data.potentialOrderPromotions && data.potentialOrderPromotions.length) {
|
|
1124
1124
|
data.potentialOrderPromotions.forEach((promo) => {
|
|
1125
|
-
!promo.
|
|
1125
|
+
!promo.displayDescription ||
|
|
1126
1126
|
arr.push(`
|
|
1127
1127
|
<div class="p-promotion">
|
|
1128
1128
|
<div class="p-promotion__icon">
|
|
1129
1129
|
<i class="icon fas fa-gift"></i>
|
|
1130
1130
|
</div>
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1131
|
+
${Wick.VatToggle.isToggleVatAvailable() && promo.displayDescriptionExclusiveVat
|
|
1132
|
+
? `<div class="p-promotion__description including-vat">${promo.displayDescription}</div>
|
|
1133
|
+
<div class="p-promotion__description excluding-vat d-none">${promo.displayDescriptionExclusiveVat}</div>`
|
|
1134
|
+
: `<div class="p-promotion__description">${promo.displayDescription}</div>`
|
|
1135
|
+
}
|
|
1134
1136
|
<div class="p-promotion__close">
|
|
1135
1137
|
<i class="icon fas fa-times"></i>
|
|
1136
1138
|
</div>
|
|
@@ -1141,15 +1143,17 @@ Wick.BasketPage = {
|
|
|
1141
1143
|
|
|
1142
1144
|
if (data.appliedOrderPromotions && data.appliedOrderPromotions.length) {
|
|
1143
1145
|
data.appliedOrderPromotions.forEach((promo) => {
|
|
1144
|
-
!promo.
|
|
1146
|
+
!promo.displayDescription ||
|
|
1145
1147
|
arr.push(`
|
|
1146
1148
|
<div class="p-promotion">
|
|
1147
1149
|
<div class="p-promotion__icon">
|
|
1148
1150
|
<i class="icon fas fa-gift"></i>
|
|
1149
1151
|
</div>
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1152
|
+
${Wick.VatToggle.isToggleVatAvailable() && promo.displayDescriptionExclusiveVat
|
|
1153
|
+
? `<div class="p-promotion__description including-vat">${promo.displayDescription}</div>
|
|
1154
|
+
<div class="p-promotion__description excluding-vat d-none">${promo.displayDescriptionExclusiveVat}</div>`
|
|
1155
|
+
: `<div class="p-promotion__description">${promo.displayDescription}</div>`
|
|
1156
|
+
}
|
|
1153
1157
|
<div class="p-promotion__close">
|
|
1154
1158
|
<i class="icon fas fa-times"></i>
|
|
1155
1159
|
</div>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { showValidationErrors, clearValidationErrors, isValidEmail } from '../utils/validation';
|
|
2
|
+
|
|
3
|
+
var Wick = window.Wick || {};
|
|
4
|
+
|
|
5
|
+
Wick.NotifyMeSubscription = {
|
|
6
|
+
NOTIFY_ME_EVENT: 'NOTIFY_ME',
|
|
7
|
+
HIDDEN_CLASS_NAME: 'd-none',
|
|
8
|
+
el: {
|
|
9
|
+
notifyMePopup: '#modal-notify-me',
|
|
10
|
+
notifyMeBtn: '.btn--notify-open',
|
|
11
|
+
|
|
12
|
+
form: '#modal-notify-me .notify-me-form',
|
|
13
|
+
emailInput: '#modal-notify-me #notify-me-email',
|
|
14
|
+
stateForm: '#modal-notify-me [data-notify-state="form"]',
|
|
15
|
+
stateSuccess: '#modal-notify-me [data-notify-state="success"]',
|
|
16
|
+
headerForm: '#modal-notify-me [data-notify-header="form"]',
|
|
17
|
+
headerSuccess: '#modal-notify-me [data-notify-header="success"]',
|
|
18
|
+
productId: '#product-code-val',
|
|
19
|
+
},
|
|
20
|
+
defaultErrorMessage: 'Something went wrong',
|
|
21
|
+
invalidEmailMessage: 'Please enter a valid email address',
|
|
22
|
+
showCustomModal() {
|
|
23
|
+
$(Wick.NotifyMeSubscription.el.notifyMePopup).modal('show');
|
|
24
|
+
},
|
|
25
|
+
getEmail() {
|
|
26
|
+
return ($(Wick.NotifyMeSubscription.el.emailInput).val() || '').toString().trim();
|
|
27
|
+
},
|
|
28
|
+
isEmailValid() {
|
|
29
|
+
const email = Wick.NotifyMeSubscription.getEmail();
|
|
30
|
+
|
|
31
|
+
return isValidEmail(email);
|
|
32
|
+
},
|
|
33
|
+
showFormState() {
|
|
34
|
+
$(Wick.NotifyMeSubscription.el.stateSuccess).addClass(
|
|
35
|
+
Wick.NotifyMeSubscription.HIDDEN_CLASS_NAME
|
|
36
|
+
);
|
|
37
|
+
$(Wick.NotifyMeSubscription.el.stateForm).removeClass(
|
|
38
|
+
Wick.NotifyMeSubscription.HIDDEN_CLASS_NAME
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
$(Wick.NotifyMeSubscription.el.headerSuccess).addClass(
|
|
42
|
+
Wick.NotifyMeSubscription.HIDDEN_CLASS_NAME
|
|
43
|
+
);
|
|
44
|
+
$(Wick.NotifyMeSubscription.el.headerForm).removeClass(
|
|
45
|
+
Wick.NotifyMeSubscription.HIDDEN_CLASS_NAME
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
showSuccessState() {
|
|
49
|
+
$(Wick.NotifyMeSubscription.el.stateForm).addClass(
|
|
50
|
+
Wick.NotifyMeSubscription.HIDDEN_CLASS_NAME
|
|
51
|
+
);
|
|
52
|
+
$(Wick.NotifyMeSubscription.el.stateSuccess).removeClass(
|
|
53
|
+
Wick.NotifyMeSubscription.HIDDEN_CLASS_NAME
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
$(Wick.NotifyMeSubscription.el.headerForm).addClass(
|
|
57
|
+
Wick.NotifyMeSubscription.HIDDEN_CLASS_NAME
|
|
58
|
+
);
|
|
59
|
+
$(Wick.NotifyMeSubscription.el.headerSuccess).removeClass(
|
|
60
|
+
Wick.NotifyMeSubscription.HIDDEN_CLASS_NAME
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
resetValidation() {
|
|
64
|
+
clearValidationErrors(Wick.NotifyMeSubscription.el.form);
|
|
65
|
+
},
|
|
66
|
+
validateForm() {
|
|
67
|
+
Wick.NotifyMeSubscription.resetValidation();
|
|
68
|
+
|
|
69
|
+
if (!Wick.NotifyMeSubscription.isEmailValid()) {
|
|
70
|
+
showValidationErrors(
|
|
71
|
+
Wick.NotifyMeSubscription.el.form,
|
|
72
|
+
Wick.NotifyMeSubscription.invalidEmailMessage
|
|
73
|
+
);
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return true;
|
|
78
|
+
},
|
|
79
|
+
showError(err = {}) {
|
|
80
|
+
const msg = err.errMsg || err.errorMessage || Wick.NotifyMeSubscription.defaultErrorMessage;
|
|
81
|
+
|
|
82
|
+
showValidationErrors(Wick.NotifyMeSubscription.el.form, msg);
|
|
83
|
+
},
|
|
84
|
+
init() {
|
|
85
|
+
$(document).on('click', Wick.NotifyMeSubscription.el.notifyMeBtn, function (e) {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
Wick.NotifyMeSubscription.showCustomModal();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
$(Wick.NotifyMeSubscription.el.notifyMePopup).on('hidden.bs.modal', function () {
|
|
91
|
+
Wick.NotifyMeSubscription.showFormState();
|
|
92
|
+
clearValidationErrors(Wick.NotifyMeSubscription.el.form);
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
$(document).ready(function () {
|
|
98
|
+
Wick.NotifyMeSubscription.init();
|
|
99
|
+
});
|
|
@@ -5,6 +5,7 @@ const osEl = {
|
|
|
5
5
|
checkoutWidgetDetailsDiscount: '.checkout-widget__details-discount',
|
|
6
6
|
checkoutWidgetDetails: '.checkout-widget__details',
|
|
7
7
|
delivery: '.checkout-widget__item-delivery',
|
|
8
|
+
deliveryCostMessage: '.checkout-widget__item-delivery-cost-message',
|
|
8
9
|
cc: '.checkout-widget__item-cc',
|
|
9
10
|
itemFree: '.checkout-widget__item-free',
|
|
10
11
|
itemDeficit: '.checkout-widget__item-deficit',
|
|
@@ -26,6 +27,22 @@ export function updateOrderSummary(data, equalMap, isVoucher) {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
if (obj.item === osEl.delivery) {
|
|
31
|
+
$(osEl.delivery).each(function () {
|
|
32
|
+
if (
|
|
33
|
+
!$(this).siblings(osEl.deliveryCostMessage).length &&
|
|
34
|
+
!$(this).closest('[data-hide-delivery-cost-message]').length
|
|
35
|
+
) {
|
|
36
|
+
$(this).after(`
|
|
37
|
+
<li class="checkout-widget__item checkout-widget__item-delivery-cost-message">
|
|
38
|
+
<span class="checkout-widget__item-value" id="order-delivery-cost-message">
|
|
39
|
+
Final delivery cost confirmed at checkout
|
|
40
|
+
</span>
|
|
41
|
+
</li>`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
29
46
|
$(obj.item).find(obj.itemValue).text(obj.dataValue);
|
|
30
47
|
if (isVoucher ? obj.dataValue : obj.value && obj.dataValue) {
|
|
31
48
|
$(obj.item).find(obj.itemValue).show();
|
|
@@ -64,20 +81,37 @@ export function updateOrderSummary(data, equalMap, isVoucher) {
|
|
|
64
81
|
}
|
|
65
82
|
|
|
66
83
|
function createCheckoutWidgetItem(obj) {
|
|
84
|
+
const isDelivery = obj.item === osEl.delivery;
|
|
85
|
+
const hideMessage = $(osEl.checkoutWidgetDetails).closest(
|
|
86
|
+
'[data-hide-delivery-cost-message]'
|
|
87
|
+
).length;
|
|
88
|
+
const costMessageExists = $(osEl.deliveryCostMessage).length > 0;
|
|
67
89
|
return `
|
|
68
90
|
<li class="checkout-widget__item ${obj.item.substr(1)}">
|
|
69
91
|
<span>${obj.title}</span>
|
|
70
92
|
<span class="checkout-widget__item-value">${obj.dataValue}</span>
|
|
71
93
|
</li>
|
|
94
|
+
${
|
|
95
|
+
isDelivery && !hideMessage && !costMessageExists
|
|
96
|
+
? `
|
|
97
|
+
<li class="checkout-widget__item checkout-widget__item-delivery-cost-message">
|
|
98
|
+
<span class="checkout-widget__item-value" id="order-delivery-cost-message">
|
|
99
|
+
Final delivery cost confirmed at checkout
|
|
100
|
+
</span>
|
|
101
|
+
</li>`
|
|
102
|
+
: ''
|
|
103
|
+
}
|
|
72
104
|
`;
|
|
73
105
|
}
|
|
74
106
|
|
|
75
107
|
function hideUnusedDeliveryTypeCost(data, isVoucher) {
|
|
76
108
|
$(osEl.delivery).show();
|
|
109
|
+
$(osEl.deliveryCostMessage).show();
|
|
77
110
|
$(osEl.cc).show();
|
|
78
111
|
if (isVoucher) {
|
|
79
112
|
if ('deliveryOrder' in data && data.deliveryOrder === false) {
|
|
80
113
|
$(osEl.delivery).hide();
|
|
114
|
+
$(osEl.deliveryCostMessage).hide();
|
|
81
115
|
}
|
|
82
116
|
|
|
83
117
|
if ('clickAndCollectOrder' in data && data.clickAndCollectOrder === false) {
|
|
@@ -86,6 +120,7 @@ function hideUnusedDeliveryTypeCost(data, isVoucher) {
|
|
|
86
120
|
} else {
|
|
87
121
|
if (data.clickAndCollectOnly) {
|
|
88
122
|
$(osEl.delivery).hide();
|
|
123
|
+
$(osEl.deliveryCostMessage).hide();
|
|
89
124
|
} else if (data.deliveryItemsQuantity > 0 && data.pickupItemsQuantity === 0) {
|
|
90
125
|
$(osEl.cc).hide();
|
|
91
126
|
}
|