wickes-css2 2.109.0-test.1 → 2.110.0
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 -0
- package/build/css/category-main.css +1 -1
- package/build/css/components/card-product-banner.css +1 -1
- package/build/css/components/special-opening-schedule-v2.css +1 -1
- package/build/css/components/special-opening-schedule.css +1 -1
- package/build/css/emulation.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/checkout-new.css +1 -1
- package/build/css/pages/page_checkout_delivery-new.css +1 -1
- package/build/css/pages/page_merged-basket.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/pages/page_store-locator-details.css +1 -1
- package/build/css/pages/page_store-locator.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 +2 -2
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +2 -2
- package/build/js/emulation.min.js +490 -138
- 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/mini-basket-total.js +17 -2
- package/build/js/page/checkout-payment-details.js +8 -0
- package/build/js/page/components/notify-me.js +99 -0
- package/build/js/page/components/order-summary.js +35 -0
- package/build/js/page/components/store-locator-cards.js +76 -0
- package/build/js/pdp.bundle.min.js +2 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/project-list.min.js +1 -1
- package/build/js/store-locator-cards.min.js +1 -0
- package/build/js/toggle-password-visibility.min.js +1 -0
- 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-store-locator.hbs +70 -33
- package/src/components/card_bloomreach_media_banner.hbs +10 -0
- 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-summary.hbs +2 -2
- 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_locators.json +441 -135
- package/src/data/data_search-results_v2.json +20 -2
- package/src/data/data_spr_injected_content.json +4 -0
- package/src/js/components/general/accordion.js +25 -2
- package/src/js/emulation/banner-placement-manager.js +235 -34
- 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/gift-cards.js +1 -1
- package/src/js/emulation/mini-basket-data.js +3 -3
- package/src/js/emulation/notify-me.js +9 -0
- package/src/js/emulation/store-locator-load-more.js +69 -0
- package/src/js/emulation/switchCalendar.js +12 -8
- package/src/js/page/basket/mini-basket-total.js +17 -2
- package/src/js/page/checkout-payment-details.js +8 -0
- package/src/js/page/components/notify-me.js +99 -0
- package/src/js/page/components/order-summary.js +35 -0
- package/src/js/page/components/store-locator-cards.js +76 -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_bloomreach.html +81 -0
- package/src/page_plp_v2.html +6 -0
- package/src/page_product-details-mfe-calculator.html +9 -3
- package/src/page_store-locator-list.html +18 -28
- package/src/scss/common/_CTAs.scss +7 -3
- package/src/scss/components/_card-store-locator.scss +139 -32
- 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 +35 -27
- package/src/scss/components/special-opening-schedule-v2.scss +2 -6
- package/src/scss/components/special-opening-schedule.scss +17 -4
- package/src/scss/emulation.scss +0 -6
- 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/pages/page_store-locator.scss +48 -26
- package/src/scss/pdp-main.scss +1 -0
- package/src/scss/store-locator-main.scss +15 -1
- package/src/sitemap.html +1 -0
- package/src/js/emulation/store-locator-list.js +0 -19
|
@@ -3,10 +3,18 @@ Wick.Accordion = (function () {
|
|
|
3
3
|
var accordionRoot = '.accordion',
|
|
4
4
|
accordionToggler = '.accordion__header',
|
|
5
5
|
accordionIcon = '.accordion__action',
|
|
6
|
+
accordionBottomClose = '.opening-times-accordion__close',
|
|
6
7
|
accordionContent = '.accordion__content',
|
|
7
8
|
collapsed = 'accordion_collapsed',
|
|
8
9
|
$asideAccordion = $('.aside-accordion .js-toggle-aside-accordion');
|
|
9
10
|
|
|
11
|
+
function toggleAccordion($acc) {
|
|
12
|
+
if (!$acc.length) return;
|
|
13
|
+
|
|
14
|
+
$acc.toggleClass(collapsed);
|
|
15
|
+
$acc.children(accordionContent).stop(true, true).slideToggle(200);
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
function getTriggerSelector($acc) {
|
|
11
19
|
return $acc.attr('data-action-element') === 'icon' ? accordionIcon : accordionToggler;
|
|
12
20
|
}
|
|
@@ -20,8 +28,19 @@ Wick.Accordion = (function () {
|
|
|
20
28
|
|
|
21
29
|
if (!$trigger.is(triggerSel)) return;
|
|
22
30
|
|
|
23
|
-
$acc
|
|
24
|
-
|
|
31
|
+
toggleAccordion($acc);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function onAccordionBottomCloseClick(e) {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
|
|
37
|
+
var $trigger = $(e.currentTarget);
|
|
38
|
+
var $acc = $trigger.closest(accordionRoot);
|
|
39
|
+
if (!$acc.length) return;
|
|
40
|
+
|
|
41
|
+
if (!$acc.hasClass(collapsed)) {
|
|
42
|
+
toggleAccordion($acc);
|
|
43
|
+
}
|
|
25
44
|
}
|
|
26
45
|
|
|
27
46
|
function init() {
|
|
@@ -29,6 +48,10 @@ Wick.Accordion = (function () {
|
|
|
29
48
|
.off('click.wickAccordion', accordionToggler + ',' + accordionIcon)
|
|
30
49
|
.on('click.wickAccordion', accordionToggler + ',' + accordionIcon, onAccordionClick);
|
|
31
50
|
|
|
51
|
+
$(document)
|
|
52
|
+
.off('click.wickAccordionClose', accordionBottomClose)
|
|
53
|
+
.on('click.wickAccordionClose', accordionBottomClose, onAccordionBottomCloseClick);
|
|
54
|
+
|
|
32
55
|
$asideAccordion.off('click.wickAsideAccordion').on('click.wickAsideAccordion', function () {
|
|
33
56
|
if (window.matchMedia('(min-width: 992px)').matches) {
|
|
34
57
|
if ($(this).text().toLowerCase() !== 'useful links') {
|
|
@@ -1,53 +1,254 @@
|
|
|
1
1
|
// Simulate prompt for input
|
|
2
|
-
function getInputs() {
|
|
3
|
-
const productBannerPositions = prompt("Enter Product Banner Positions:", "2") || "";
|
|
4
|
-
const sponsorProductPositions = prompt("Enter Sponsor Product Positions (comma-separated):", "6,7,8") || "";
|
|
5
|
-
const sponsorBannerPositions = prompt("Enter Sponsor Banner Positions:", "10") || "";
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
function parseSlots(value) {
|
|
4
|
+
if (!value) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return String(value)
|
|
9
|
+
.split(',')
|
|
10
|
+
.map((item) => parseInt(item.trim(), 10))
|
|
11
|
+
.filter((item) => Number.isInteger(item) && item >= 0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function isBloomreachDisabled(slots) {
|
|
15
|
+
return !slots.length || slots.every((s) => s === 0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function toggleHybrisProductBanners(inputs) {
|
|
19
|
+
const banners = document.querySelectorAll('.card-product-banner');
|
|
20
|
+
const disabled = isBloomreachDisabled(inputs.bloomreachSlots);
|
|
21
|
+
|
|
22
|
+
banners.forEach((banner) => {
|
|
23
|
+
if (disabled) {
|
|
24
|
+
banner.classList.remove('d-none');
|
|
25
|
+
banner.classList.remove('card-product-banner--inactive');
|
|
26
|
+
} else {
|
|
27
|
+
banner.classList.add('d-none');
|
|
28
|
+
banner.classList.add('card-product-banner--inactive');
|
|
29
|
+
}
|
|
30
|
+
});
|
|
12
31
|
}
|
|
13
32
|
|
|
14
33
|
function getPositionAttr() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
? 'data-mobile-position'
|
|
18
|
-
|
|
34
|
+
const isMobile = Wick.BannerPlacementManager.isMobileResolution();
|
|
35
|
+
|
|
36
|
+
return isMobile ? 'data-mobile-position' : 'data-desktop-position';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function setUnifiedPosition(el, slot) {
|
|
40
|
+
el.setAttribute('data-desktop-position', String(slot));
|
|
41
|
+
el.setAttribute('data-mobile-position', String(slot));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function hasLegacyBanners() {
|
|
45
|
+
return Boolean(
|
|
46
|
+
document.querySelector('.card-product-banner') ||
|
|
47
|
+
document.querySelector('.card-sponsor-product') ||
|
|
48
|
+
document.querySelector('.card-sponsor-banner')
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getInputs() {
|
|
53
|
+
const hasLegacy = hasLegacyBanners();
|
|
54
|
+
|
|
55
|
+
const bloomreachSlots = parseSlots(
|
|
56
|
+
prompt('Enter Bloomreach Banner Slots (comma-separated):', '3') || ''
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (!hasLegacy) {
|
|
60
|
+
return {
|
|
61
|
+
bloomreachSlots,
|
|
62
|
+
sponsorProductPositions: [],
|
|
63
|
+
sponsorBannerPositions: [],
|
|
64
|
+
productBannerPositions: [],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const productBannerPositions =
|
|
69
|
+
prompt('Enter Product Banner Positions (comma-separated):', '2') || '';
|
|
70
|
+
|
|
71
|
+
const sponsorProductPositions =
|
|
72
|
+
prompt('Enter Sponsor Product Positions (comma-separated):', '6,7,8') || '';
|
|
73
|
+
|
|
74
|
+
const sponsorBannerPositions =
|
|
75
|
+
prompt('Enter Sponsor Banner Positions (comma-separated):', '10') || '';
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
productBannerPositions: parseSlots(productBannerPositions),
|
|
79
|
+
sponsorProductPositions: parseSlots(sponsorProductPositions),
|
|
80
|
+
sponsorBannerPositions: parseSlots(sponsorBannerPositions),
|
|
81
|
+
bloomreachSlots,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function updateBannerPositions(selector, positions) {
|
|
86
|
+
if (!positions?.length) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const positionAttr = getPositionAttr();
|
|
91
|
+
const elements = document.querySelectorAll(selector);
|
|
92
|
+
|
|
93
|
+
elements.forEach((el, index) => {
|
|
94
|
+
if (positions[index] !== undefined) {
|
|
95
|
+
el.setAttribute(positionAttr, String(positions[index]));
|
|
96
|
+
}
|
|
97
|
+
});
|
|
19
98
|
}
|
|
20
99
|
|
|
21
100
|
function updatePositions(inputs) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
101
|
+
updateBannerPositions('.card-product-banner', inputs.productBannerPositions);
|
|
102
|
+
updateBannerPositions('.card-sponsor-product', inputs.sponsorProductPositions);
|
|
103
|
+
updateBannerPositions('.card-sponsor-banner', inputs.sponsorBannerPositions);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function patchBannerPlacementManagerForBloomreachEmulation(inputs) {
|
|
107
|
+
const manager = window.Wick?.BannerPlacementManager;
|
|
108
|
+
|
|
109
|
+
if (!manager || manager.__bloomreachEmulationPatched) {
|
|
110
|
+
return;
|
|
26
111
|
}
|
|
27
|
-
});
|
|
28
112
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
113
|
+
const shouldDisableProductBanners = Boolean(inputs.bloomreachSlots?.length);
|
|
114
|
+
|
|
115
|
+
manager.el.bloomreachBanners = '.card-bloomreach-media-banner';
|
|
116
|
+
|
|
117
|
+
manager.el.allBanners = shouldDisableProductBanners
|
|
118
|
+
? '.card-bloomreach-media-banner, .card-sponsor-banner, .card-sponsor-product'
|
|
119
|
+
: '.card-product-banner, .card-bloomreach-media-banner, .card-sponsor-banner, .card-sponsor-product';
|
|
120
|
+
|
|
121
|
+
manager.el.allListSlots = shouldDisableProductBanners
|
|
122
|
+
? '.product-card, .card-bloomreach-media-banner, .card-sponsor-banner, .card-sponsor-product'
|
|
123
|
+
: '.product-card, .card-product-banner, .card-bloomreach-media-banner, .card-sponsor-banner, .card-sponsor-product';
|
|
124
|
+
|
|
125
|
+
manager.classes.bloomreachBanners = 'card-bloomreach-media-banner';
|
|
126
|
+
|
|
127
|
+
manager.getListSlots = function () {
|
|
128
|
+
return $(manager.el.productsWrap)
|
|
129
|
+
.children(manager.el.allListSlots)
|
|
130
|
+
.filter(function () {
|
|
131
|
+
if (
|
|
132
|
+
$(this).hasClass(manager.classes.productBanners) ||
|
|
133
|
+
$(this).hasClass(manager.classes.bloomreachBanners)
|
|
134
|
+
) {
|
|
135
|
+
const position = manager.getBannerPosition(this);
|
|
136
|
+
const productsCount = manager.getListLength();
|
|
137
|
+
|
|
138
|
+
return position <= productsCount;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return true;
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
manager.arrangeBannersInRightOrder = function () {
|
|
146
|
+
const $allBanners = $(manager.el.allBanners);
|
|
147
|
+
|
|
148
|
+
function getSameSlotInsertionOrder(el) {
|
|
149
|
+
if ($(el).hasClass(manager.classes.bloomreachBanners)) {
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if ($(el).hasClass(manager.classes.sponsorBanners)) {
|
|
154
|
+
return 1;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if ($(el).hasClass(manager.classes.sponsorProducts)) {
|
|
158
|
+
return 2;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if ($(el).hasClass(manager.classes.productBanners)) {
|
|
162
|
+
return 3;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return 4;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
$allBanners
|
|
169
|
+
.sort((a, b) => {
|
|
170
|
+
const positionA = manager.getBannerPosition(a);
|
|
171
|
+
const positionB = manager.getBannerPosition(b);
|
|
172
|
+
|
|
173
|
+
if (positionA !== positionB) {
|
|
174
|
+
return positionA - positionB;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return getSameSlotInsertionOrder(a) - getSameSlotInsertionOrder(b);
|
|
178
|
+
})
|
|
179
|
+
.appendTo(manager.el.productsWrap);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
manager.__bloomreachEmulationPatched = true;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function rebuildBloomreachBannersForEmulation(inputs) {
|
|
186
|
+
const slots = inputs.bloomreachSlots || [];
|
|
187
|
+
const productsWrap = document.querySelector('.products-list.products-list-v2');
|
|
188
|
+
|
|
189
|
+
if (!productsWrap) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const existingBanners = document.querySelectorAll('.card-bloomreach-media-banner');
|
|
194
|
+
|
|
195
|
+
if (isBloomreachDisabled(slots)) {
|
|
196
|
+
existingBanners.forEach((banner) => banner.remove());
|
|
197
|
+
return;
|
|
33
198
|
}
|
|
34
|
-
});
|
|
35
199
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (inputs.sponsorBannerPositions[index] !== undefined) {
|
|
39
|
-
el.setAttribute(getPositionAttr(), inputs.sponsorBannerPositions[index]);
|
|
200
|
+
if (!existingBanners.length) {
|
|
201
|
+
return;
|
|
40
202
|
}
|
|
41
|
-
|
|
203
|
+
|
|
204
|
+
const template = existingBanners[0].cloneNode(true);
|
|
205
|
+
|
|
206
|
+
existingBanners.forEach((banner) => banner.remove());
|
|
207
|
+
|
|
208
|
+
const fragment = document.createDocumentFragment();
|
|
209
|
+
|
|
210
|
+
slots.forEach((slot) => {
|
|
211
|
+
if (slot === 0) return;
|
|
212
|
+
|
|
213
|
+
const node = template.cloneNode(true);
|
|
214
|
+
|
|
215
|
+
node.removeAttribute('data-slots');
|
|
216
|
+
setUnifiedPosition(node, slot);
|
|
217
|
+
|
|
218
|
+
fragment.appendChild(node);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
productsWrap.appendChild(fragment);
|
|
42
222
|
}
|
|
43
223
|
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
224
|
+
function applyBloomreachEmulation() {
|
|
225
|
+
const inputs = getInputs();
|
|
226
|
+
|
|
227
|
+
updatePositions(inputs);
|
|
228
|
+
|
|
229
|
+
const isDisabled = isBloomreachDisabled(inputs.bloomreachSlots);
|
|
230
|
+
|
|
231
|
+
toggleHybrisProductBanners(inputs);
|
|
232
|
+
|
|
233
|
+
if (!isDisabled) {
|
|
234
|
+
patchBannerPlacementManagerForBloomreachEmulation(inputs);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
rebuildBloomreachBannersForEmulation(inputs);
|
|
238
|
+
|
|
239
|
+
if (
|
|
240
|
+
window.Wick &&
|
|
241
|
+
Wick.BannerPlacementManager &&
|
|
242
|
+
typeof Wick.BannerPlacementManager.checkProductsInColumn === 'function'
|
|
243
|
+
) {
|
|
244
|
+
Wick.BannerPlacementManager.checkProductsInColumn();
|
|
245
|
+
}
|
|
47
246
|
}
|
|
48
247
|
|
|
49
248
|
$(document).ready(function () {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
249
|
+
if ($('.products-list.products-list-v2').length) {
|
|
250
|
+
setTimeout(() => {
|
|
251
|
+
applyBloomreachEmulation();
|
|
252
|
+
}, 100);
|
|
253
|
+
}
|
|
53
254
|
});
|
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
var Wick = Wick || {};
|
|
2
2
|
Wick.DeliveryDetails = (function () {
|
|
3
|
-
|
|
3
|
+
var $page = $('.page_checkout-delivery-details');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
function bindEvents() {
|
|
6
|
+
var dateAlert;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
$page
|
|
9
|
+
.find(
|
|
10
|
+
'.btn-payment-details, .delivery-details__payment-details, .delivery-details__payment-details_mobile'
|
|
11
|
+
)
|
|
12
|
+
.on('click', function () {
|
|
13
|
+
if (navigator.userAgent.match(/TradeProMobile_Android|DIYMobile_Android/i)) {
|
|
14
|
+
document.body.scrollTop = 0;
|
|
15
|
+
document.documentElement.scrollTop = 0;
|
|
16
|
+
}
|
|
9
17
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
if (!Wick.DateSelection.isDateSelected()) {
|
|
19
|
+
dateAlert = Wick.Notification.show({
|
|
20
|
+
text: 'Sorry, please select a delivery date and/or time',
|
|
21
|
+
container: '.checkout-heading',
|
|
22
|
+
type: 'error',
|
|
23
|
+
});
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
14
27
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
text: 'Sorry, please select a delivery date and/or time',
|
|
18
|
-
container: '.checkout-heading',
|
|
19
|
-
type: 'error'
|
|
28
|
+
$('.date-selection').on('selected', function () {
|
|
29
|
+
dateAlert && dateAlert.hide();
|
|
20
30
|
});
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
});
|
|
31
|
+
}
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
}
|
|
33
|
+
if (!$page.length) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
bindEvents();
|
|
37
|
+
bindEvents();
|
|
35
38
|
})();
|
|
@@ -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: [
|