wickes-css2 2.111.0-why-not-add-refactor-fix.2 → 2.112.0-develop.1
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/kitchen-plp-main.css +1 -1
- package/build/css/pdp-main-before-combine.css +1 -1
- package/build/css/pdp-main-non-critical.css +1 -1
- package/build/css/pdp-main.css +1 -1
- package/build/js/bloomreach-widget.min.js +1 -1
- package/build/js/emulation.min.js +8 -334
- package/build/js/page/{bloomreach-widget/complete-your-project-widget.js → bloomreach-widget.js} +359 -205
- package/package.json +1 -1
- package/src/components/.DS_Store +0 -0
- package/src/components/bloomreach/complete-card.hbs +32 -4
- package/src/components/pdp-price-actions.hbs +2 -2
- package/src/components/price-block-v2.hbs +0 -2
- package/src/data/data_kitchen-plp.json +7 -16
- package/src/js/emulation/bloomreach-widget-loading.js +2 -2
- package/src/js/emulation/mock.js +0 -309
- package/src/js/page/.DS_Store +0 -0
- package/src/js/page/{bloomreach-widget/complete-your-project-widget.js → bloomreach-widget.js} +359 -205
- package/src/page_product-details-bloomreach.html +1 -1
- package/src/page_product-details-with-global-search-v2.html +1 -2
- package/src/scss/components/bloomreach/_bloomreach.scss +0 -3
- package/src/scss/components/bloomreach/_complete-card.scss +38 -0
- package/src/scss/components/kitchen/_colour-swatches.scss +9 -3
- package/src/sitemap.html +4 -10
- package/build/js/page/bloomreach-widget/bloomreach-widget.js +0 -241
- package/build/js/page/bloomreach-widget/why-not-add-widget.js +0 -196
- package/src/components/bloomreach/why-not-add-card-skeleton.hbs +0 -14
- package/src/components/bloomreach/why-not-add-card.hbs +0 -73
- package/src/components/bloomreach/why-not-add-content.hbs +0 -41
- package/src/components/bloomreach/why-not-add-skeleton.hbs +0 -9
- package/src/components/bloomreach/why-not-add.hbs +0 -6
- package/src/components/reviews-rating.hbs +0 -22
- package/src/js/emulation/why-not-add-loading.js +0 -11
- package/src/js/emulation/why-not-add.js +0 -28
- package/src/js/page/bloomreach-widget/bloomreach-widget.js +0 -241
- package/src/js/page/bloomreach-widget/why-not-add-widget.js +0 -196
- package/src/page_product-details-with-why-not-add-single.html +0 -131
- package/src/scss/components/bloomreach/_reviews.scss +0 -60
- package/src/scss/components/bloomreach/_why-not-add-card.scss +0 -212
- package/src/scss/components/bloomreach/_why-not-add.scss +0 -143
|
@@ -70,7 +70,7 @@ switch-vat=true
|
|
|
70
70
|
<div
|
|
71
71
|
class="pdp__widget"
|
|
72
72
|
data-complete-widget
|
|
73
|
-
data-
|
|
73
|
+
data-context-key="completeYourProject2Recomendations"
|
|
74
74
|
>
|
|
75
75
|
{{> bloomreach/complete-your-project title="Complete your project"}}
|
|
76
76
|
</div>
|
|
@@ -63,7 +63,6 @@ switch-vat=true
|
|
|
63
63
|
sample=true
|
|
64
64
|
cc=true
|
|
65
65
|
delivery=true
|
|
66
|
-
mockDataKey="whyNotAddRecommendations"
|
|
67
66
|
}}
|
|
68
67
|
</div>
|
|
69
68
|
<div class="pdp__description">
|
|
@@ -72,7 +71,7 @@ switch-vat=true
|
|
|
72
71
|
<div
|
|
73
72
|
class="pdp__widget"
|
|
74
73
|
data-complete-widget
|
|
75
|
-
data-
|
|
74
|
+
data-context-key="completeYourProject3Recomendations"
|
|
76
75
|
>
|
|
77
76
|
{{> bloomreach/complete-your-project title="Complete your project"}}
|
|
78
77
|
</div>
|
|
@@ -92,6 +92,44 @@
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
&__reviews {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
font-size: 0.75rem;
|
|
99
|
+
margin-bottom: 8px;
|
|
100
|
+
|
|
101
|
+
&-count {
|
|
102
|
+
display: inline-block;
|
|
103
|
+
margin-left: 6px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.rating-bg {
|
|
107
|
+
color: $gray;
|
|
108
|
+
position: relative;
|
|
109
|
+
|
|
110
|
+
.fa-star {
|
|
111
|
+
margin-right: 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.rating-overlay {
|
|
116
|
+
color: $yellow;
|
|
117
|
+
position: absolute;
|
|
118
|
+
left: 0;
|
|
119
|
+
top: 0;
|
|
120
|
+
display: flex;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.star-overlay {
|
|
124
|
+
display: inline-block;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
|
|
127
|
+
& + .star-overlay {
|
|
128
|
+
margin-left: 3.3px;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
95
133
|
&__count-stepper {
|
|
96
134
|
margin-top: 0;
|
|
97
135
|
margin-bottom: 12px;
|
|
@@ -61,13 +61,19 @@
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
.colour-wheel {
|
|
64
|
-
width:
|
|
64
|
+
width: 100%;
|
|
65
|
+
max-width: 184px;
|
|
65
66
|
height: 24px;
|
|
66
|
-
border-radius: 50%;
|
|
67
67
|
overflow: hidden;
|
|
68
68
|
|
|
69
69
|
img {
|
|
70
70
|
width: 100%;
|
|
71
|
-
|
|
71
|
+
height: 16px;
|
|
72
|
+
|
|
73
|
+
&[src*='Color_Wheel.svg'] {
|
|
74
|
+
width: 24px;
|
|
75
|
+
height: 24px;
|
|
76
|
+
border-radius: 50%;
|
|
77
|
+
}
|
|
72
78
|
}
|
|
73
79
|
}
|
package/src/sitemap.html
CHANGED
|
@@ -230,36 +230,30 @@
|
|
|
230
230
|
</li>
|
|
231
231
|
<li>
|
|
232
232
|
<span class="page-id">2.27</span>
|
|
233
|
-
<a href="page_product-details-with-why-not-add-single.html" target="_blank">
|
|
234
|
-
Product details page - With Why Not Add single widget
|
|
235
|
-
</a>
|
|
236
|
-
</li>
|
|
237
|
-
<li>
|
|
238
|
-
<span class="page-id">2.28</span>
|
|
239
233
|
<a href="page_product-details-mfe-calculator.html" target="_blank">
|
|
240
234
|
Product details page - With MFE calculator
|
|
241
235
|
</a>
|
|
242
236
|
</li>
|
|
243
237
|
<li>
|
|
244
|
-
<span class="page-id">2.
|
|
238
|
+
<span class="page-id">2.28</span>
|
|
245
239
|
<a href="page_product-details-cnc-success-notification.html" target="_blank">
|
|
246
240
|
Product details page - C&C success notifications
|
|
247
241
|
</a>
|
|
248
242
|
</li>
|
|
249
243
|
<li>
|
|
250
|
-
<span class="page-id">2.
|
|
244
|
+
<span class="page-id">2.29</span>
|
|
251
245
|
<a href="page_product-details-cnc-error-notification.html" target="_blank">
|
|
252
246
|
Product details page - C&C error notifications
|
|
253
247
|
</a>
|
|
254
248
|
</li>
|
|
255
249
|
<li>
|
|
256
|
-
<span class="page-id">2.
|
|
250
|
+
<span class="page-id">2.30</span>
|
|
257
251
|
<a href="page_product-details-cnc-success-notification-vat.html" target="_blank">
|
|
258
252
|
Product details page VAT
|
|
259
253
|
</a>
|
|
260
254
|
</li>
|
|
261
255
|
<li>
|
|
262
|
-
<span class="page-id">2.
|
|
256
|
+
<span class="page-id">2.31</span>
|
|
263
257
|
<a href="page_product-details-paint-mixing.html" target="_blank">
|
|
264
258
|
Product details page - Paint Mixing
|
|
265
259
|
</a>
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
var Wick = window.Wick || {};
|
|
2
|
-
|
|
3
|
-
import { createEvent } from '../utils/create-event';
|
|
4
|
-
import CompleteYourProjectWidget from './complete-your-project-widget';
|
|
5
|
-
import WhyNotAddWidget from './why-not-add-widget';
|
|
6
|
-
|
|
7
|
-
Wick.BloomreachWidget = {
|
|
8
|
-
widgets: {},
|
|
9
|
-
|
|
10
|
-
el: {
|
|
11
|
-
loadingButtonText: '.loading-button__text',
|
|
12
|
-
loadingButtonLoader: '.loading-button__loader',
|
|
13
|
-
ratingOverlay: '.rating-overlay',
|
|
14
|
-
starOverlay: '.star-overlay',
|
|
15
|
-
vatInc: '.including-vat-inherit',
|
|
16
|
-
vatExc: '.excluding-vat-inherit',
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
registerWidgets(widgetList) {
|
|
20
|
-
widgetList.forEach(function ({ type, widget }) {
|
|
21
|
-
Wick.BloomreachWidget.widgets[type] = widget;
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
getWidget(type) {
|
|
26
|
-
return Wick.BloomreachWidget.widgets[type];
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
init(type, payloadData) {
|
|
30
|
-
const widget = Wick.BloomreachWidget.getWidget(type);
|
|
31
|
-
|
|
32
|
-
if (!widget || typeof widget.init !== 'function') {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
widget.init(payloadData, Wick.BloomreachWidget);
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
normalizePayload(payloadData) {
|
|
40
|
-
if (Array.isArray(payloadData)) {
|
|
41
|
-
return payloadData;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (payloadData && Array.isArray(payloadData.recommendedProducts)) {
|
|
45
|
-
return payloadData.recommendedProducts;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return [];
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
hasRecommendations(payloadData) {
|
|
52
|
-
return Wick.BloomreachWidget.normalizePayload(payloadData).length > 0;
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
getDisplayPrice(product) {
|
|
56
|
-
return product.displayPrice || product.price || {};
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
getDisplayPriceExcVat(product) {
|
|
60
|
-
return product.displayPriceExclusiveVat || product.priceExclusiveVat || null;
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
getPriceValue(price) {
|
|
64
|
-
return price && typeof price.value === 'number' ? price.value : 0;
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
getPriceFormattedValue(price) {
|
|
68
|
-
if (!price) {
|
|
69
|
-
return '';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (price.formattedValue) {
|
|
73
|
-
return price.formattedValue;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (typeof price.value === 'number') {
|
|
77
|
-
return Wick.BloomreachWidget.formatPrice(price.value);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return '';
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
getWasPrice(product) {
|
|
84
|
-
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
85
|
-
|
|
86
|
-
return displayPrice && displayPrice.wasPrice ? displayPrice.wasPrice : null;
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
getWasPriceFormatted(product) {
|
|
90
|
-
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
91
|
-
const wasPrice = Wick.BloomreachWidget.getWasPrice(product);
|
|
92
|
-
|
|
93
|
-
if (wasPrice && wasPrice.formattedValue) {
|
|
94
|
-
return wasPrice.formattedValue;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (typeof wasPrice === 'number') {
|
|
98
|
-
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (wasPrice) {
|
|
102
|
-
return `${displayPrice.currencySymbol || '£'}${wasPrice}`;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return '';
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
getExcVatWasPrice(product) {
|
|
109
|
-
const priceExclusiveVat = product.priceExclusiveVat || null;
|
|
110
|
-
const displayPriceExclusiveVat = product.displayPriceExclusiveVat || null;
|
|
111
|
-
const wasPrice =
|
|
112
|
-
(displayPriceExclusiveVat && displayPriceExclusiveVat.wasPrice) ||
|
|
113
|
-
(priceExclusiveVat && priceExclusiveVat.wasPrice);
|
|
114
|
-
|
|
115
|
-
if (wasPrice && wasPrice.formattedValue) {
|
|
116
|
-
return wasPrice.formattedValue;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (typeof wasPrice === 'number') {
|
|
120
|
-
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return wasPrice || '';
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
getProductImage(product, fallbackProduct) {
|
|
127
|
-
const productImages = product.images || [];
|
|
128
|
-
const fallbackImages = fallbackProduct ? fallbackProduct.images || [] : [];
|
|
129
|
-
const images = productImages.length ? productImages : fallbackImages;
|
|
130
|
-
|
|
131
|
-
return (
|
|
132
|
-
images.find(function (item) {
|
|
133
|
-
return item.format === 'product';
|
|
134
|
-
}) ||
|
|
135
|
-
images.find(function (item) {
|
|
136
|
-
return item.imageType === 'PRIMARY';
|
|
137
|
-
}) ||
|
|
138
|
-
images[0] ||
|
|
139
|
-
{}
|
|
140
|
-
);
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
getProductRenderData(product, options = {}) {
|
|
144
|
-
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
145
|
-
const displayPriceExcVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
146
|
-
const wasPriceFormatted = Wick.BloomreachWidget.getWasPriceFormatted(product);
|
|
147
|
-
const excVatWasPriceFormatted = Wick.BloomreachWidget.getExcVatWasPrice(product);
|
|
148
|
-
const isSwitchVat = !!(window.ACC && window.ACC.app && window.ACC.app.isVatToggleAvailable);
|
|
149
|
-
|
|
150
|
-
return {
|
|
151
|
-
...product,
|
|
152
|
-
price: displayPrice,
|
|
153
|
-
image:
|
|
154
|
-
options.image ||
|
|
155
|
-
Wick.BloomreachWidget.getProductImage(product, options.fallbackProduct),
|
|
156
|
-
wasPriceFormatted,
|
|
157
|
-
'switch-vat': isSwitchVat,
|
|
158
|
-
incVatFormattedValue: Wick.BloomreachWidget.getPriceFormattedValue(displayPrice),
|
|
159
|
-
incVatValue: Wick.BloomreachWidget.getPriceValue(displayPrice),
|
|
160
|
-
excVatFormattedValue: Wick.BloomreachWidget.getPriceFormattedValue(displayPriceExcVat),
|
|
161
|
-
excVatValue: Wick.BloomreachWidget.getPriceValue(displayPriceExcVat),
|
|
162
|
-
incVatWasPriceFormatted: wasPriceFormatted,
|
|
163
|
-
excVatWasPriceFormatted: Wick.BloomreachWidget.getExcVatWasPrice(product),
|
|
164
|
-
};
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
drawRating($root) {
|
|
168
|
-
const { ratingOverlay, starOverlay } = Wick.BloomreachWidget.el;
|
|
169
|
-
|
|
170
|
-
$root.find(ratingOverlay).each(function () {
|
|
171
|
-
let rating = parseFloat($(this).attr('data-rating')) || 0;
|
|
172
|
-
const $stars = $(this).children(starOverlay);
|
|
173
|
-
|
|
174
|
-
$stars.each(function () {
|
|
175
|
-
const $star = $(this);
|
|
176
|
-
|
|
177
|
-
if (rating >= 1) {
|
|
178
|
-
rating--;
|
|
179
|
-
} else if (rating > 0) {
|
|
180
|
-
const width = Math.asin(2 * rating - 1) / Math.PI + 0.5;
|
|
181
|
-
$star.css('width', width + 'rem');
|
|
182
|
-
rating = 0;
|
|
183
|
-
} else {
|
|
184
|
-
$star.css('width', '0rem');
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
dispatchWidgetEvent(eventName, payload) {
|
|
191
|
-
return new Promise(function (resolve, reject) {
|
|
192
|
-
const eventDetail = { resolve, reject };
|
|
193
|
-
const event = createEvent(eventName, payload, eventDetail);
|
|
194
|
-
|
|
195
|
-
window.dispatchEvent(event);
|
|
196
|
-
});
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
reapplyVatDisplay() {
|
|
200
|
-
if (!Wick.VatToggle || typeof Wick.VatToggle.isActive !== 'function') {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const { vatInc, vatExc } = Wick.BloomreachWidget.el;
|
|
205
|
-
const hiddenClassName = Wick.VatToggle.HIDDEN_CLASS_NAME || 'd-none';
|
|
206
|
-
const isExcVatActive = Wick.VatToggle.isActive();
|
|
207
|
-
|
|
208
|
-
$(vatInc).toggleClass(hiddenClassName, isExcVatActive);
|
|
209
|
-
$(vatExc).toggleClass(hiddenClassName, !isExcVatActive);
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
bindVatToggle(namespace) {
|
|
213
|
-
if (!Wick.VatToggle || !Wick.VatToggle.TOGGLE_VAT_EVENT_NAME) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const eventName = `${Wick.VatToggle.TOGGLE_VAT_EVENT_NAME}.${namespace}`;
|
|
218
|
-
|
|
219
|
-
$(window).off(eventName).on(eventName, Wick.BloomreachWidget.reapplyVatDisplay);
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
formatPrice(value) {
|
|
223
|
-
return new Intl.NumberFormat('en-GB', {
|
|
224
|
-
style: 'currency',
|
|
225
|
-
currency: 'GBP',
|
|
226
|
-
minimumFractionDigits: 2,
|
|
227
|
-
maximumFractionDigits: 2,
|
|
228
|
-
}).format(value);
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
Wick.BloomreachWidget.registerWidgets([
|
|
233
|
-
{
|
|
234
|
-
type: 'completeYourProject',
|
|
235
|
-
widget: CompleteYourProjectWidget,
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
type: 'whyNotAdd',
|
|
239
|
-
widget: WhyNotAddWidget,
|
|
240
|
-
},
|
|
241
|
-
]);
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
var Wick = window.Wick || {};
|
|
2
|
-
|
|
3
|
-
import { createLoadingButton } from '../utils/create-loading-button';
|
|
4
|
-
|
|
5
|
-
const Handlebars = require('hbsfy/runtime');
|
|
6
|
-
|
|
7
|
-
Handlebars.registerPartial('loader', require('../../../elements/loader.hbs'));
|
|
8
|
-
Handlebars.registerPartial('button', require('../../../components/base/button.hbs'));
|
|
9
|
-
Handlebars.registerPartial(
|
|
10
|
-
'bloomreach/why-not-add',
|
|
11
|
-
require('../../../components/bloomreach/why-not-add.hbs')
|
|
12
|
-
);
|
|
13
|
-
Handlebars.registerPartial(
|
|
14
|
-
'bloomreach/why-not-add-skeleton',
|
|
15
|
-
require('../../../components/bloomreach/why-not-add-skeleton.hbs')
|
|
16
|
-
);
|
|
17
|
-
Handlebars.registerPartial(
|
|
18
|
-
'bloomreach/why-not-add-card-skeleton',
|
|
19
|
-
require('../../../components/bloomreach/why-not-add-card-skeleton.hbs')
|
|
20
|
-
);
|
|
21
|
-
Handlebars.registerPartial(
|
|
22
|
-
'bloomreach/why-not-add-card',
|
|
23
|
-
require('../../../components/bloomreach/why-not-add-card.hbs')
|
|
24
|
-
);
|
|
25
|
-
Handlebars.registerPartial('reviews-rating', require('../../../components/reviews-rating.hbs'));
|
|
26
|
-
|
|
27
|
-
const whyNotAddTemplate = require('../../../components/bloomreach/why-not-add-content.hbs');
|
|
28
|
-
|
|
29
|
-
const WhyNotAddWidget = {
|
|
30
|
-
ADD_TO_CART_EVENT: 'addToCart',
|
|
31
|
-
|
|
32
|
-
products: [],
|
|
33
|
-
sliders: [],
|
|
34
|
-
loadingButton: null,
|
|
35
|
-
|
|
36
|
-
el: {
|
|
37
|
-
cta: '.why-not-add-card__cta',
|
|
38
|
-
next: '[data-why-not-add-next]',
|
|
39
|
-
pagination: '[data-why-not-add-pagination]',
|
|
40
|
-
prev: '[data-why-not-add-prev]',
|
|
41
|
-
root: '[data-why-not-add]',
|
|
42
|
-
slider: '[data-why-not-add-slider]',
|
|
43
|
-
widgetContainer: '[data-why-not-add-widget]',
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
normalizeProducts(payloadData) {
|
|
47
|
-
return Wick.BloomreachWidget.normalizePayload(payloadData)
|
|
48
|
-
.map(function (item) {
|
|
49
|
-
return item.baseProduct || item;
|
|
50
|
-
})
|
|
51
|
-
.slice(0, 5);
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
renderWidget($container, payloadData) {
|
|
55
|
-
const products = WhyNotAddWidget.normalizeProducts(payloadData);
|
|
56
|
-
|
|
57
|
-
if (!products.length) {
|
|
58
|
-
$container.empty().hide();
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
WhyNotAddWidget.products = products;
|
|
63
|
-
|
|
64
|
-
$container
|
|
65
|
-
.html(
|
|
66
|
-
whyNotAddTemplate({
|
|
67
|
-
products: products.map(Wick.BloomreachWidget.getProductRenderData),
|
|
68
|
-
isSingleProduct: products.length === 1,
|
|
69
|
-
})
|
|
70
|
-
)
|
|
71
|
-
.show();
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
destroySliders() {
|
|
75
|
-
WhyNotAddWidget.sliders.forEach(function (slider) {
|
|
76
|
-
if (slider && slider.destroy) {
|
|
77
|
-
slider.destroy(true, true);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
WhyNotAddWidget.sliders = [];
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
initSliders($root) {
|
|
85
|
-
WhyNotAddWidget.destroySliders();
|
|
86
|
-
|
|
87
|
-
$root.find(WhyNotAddWidget.el.slider).each(function () {
|
|
88
|
-
const $slider = $(this);
|
|
89
|
-
const $widget = $slider.closest(WhyNotAddWidget.el.root);
|
|
90
|
-
const slidesCount = $slider.find('.swiper-slide').length;
|
|
91
|
-
|
|
92
|
-
if (slidesCount <= 1) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const slider = new Swiper(this, {
|
|
97
|
-
roundLengths: true,
|
|
98
|
-
slidesPerView: 1,
|
|
99
|
-
spaceBetween: 12,
|
|
100
|
-
watchOverflow: true,
|
|
101
|
-
navigation: {
|
|
102
|
-
nextEl: $widget.find(WhyNotAddWidget.el.next)[0],
|
|
103
|
-
prevEl: $widget.find(WhyNotAddWidget.el.prev)[0],
|
|
104
|
-
disabledClass: 'why-not-add__arrow--disabled',
|
|
105
|
-
},
|
|
106
|
-
pagination: {
|
|
107
|
-
el: $widget.find(WhyNotAddWidget.el.pagination)[0],
|
|
108
|
-
clickable: true,
|
|
109
|
-
renderBullet(index, className) {
|
|
110
|
-
return `<button class="${className}" type="button" aria-label="Go to slide ${
|
|
111
|
-
index + 1
|
|
112
|
-
}"></button>`;
|
|
113
|
-
},
|
|
114
|
-
bulletClass: 'why-not-add__pagination-item',
|
|
115
|
-
bulletActiveClass: 'why-not-add__pagination-item--active',
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
WhyNotAddWidget.sliders.push(slider);
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
bindAddToCart($root) {
|
|
123
|
-
$root.off('click.whyNotAdd', WhyNotAddWidget.el.cta);
|
|
124
|
-
$root.on('click.whyNotAdd', WhyNotAddWidget.el.cta, function (event) {
|
|
125
|
-
event.preventDefault();
|
|
126
|
-
|
|
127
|
-
const $button = $(this);
|
|
128
|
-
const $card = $button.closest('.why-not-add-card');
|
|
129
|
-
const productCode = $card.attr('data-product-code');
|
|
130
|
-
|
|
131
|
-
if (!productCode || WhyNotAddWidget.loadingButton.isLoading($button)) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const payload = {
|
|
136
|
-
productCode,
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
WhyNotAddWidget.loadingButton.start($button);
|
|
140
|
-
|
|
141
|
-
Wick.BloomreachWidget.dispatchWidgetEvent(WhyNotAddWidget.ADD_TO_CART_EVENT, payload)
|
|
142
|
-
.then(function () {
|
|
143
|
-
WhyNotAddWidget.loadingButton.stop($button);
|
|
144
|
-
Wick.MiniBasketSliderFE.isMiniBasketLoaded = false;
|
|
145
|
-
})
|
|
146
|
-
.catch(function () {
|
|
147
|
-
WhyNotAddWidget.loadingButton.stop($button);
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
bindVatToggle() {
|
|
153
|
-
if (Wick.BloomreachWidget.bindVatToggle) {
|
|
154
|
-
Wick.BloomreachWidget.bindVatToggle('whyNotAddVatToggle');
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
initRenderedWidget($container) {
|
|
159
|
-
const $root = $container.find(WhyNotAddWidget.el.root);
|
|
160
|
-
|
|
161
|
-
if (!$root.length) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (!WhyNotAddWidget.loadingButton) {
|
|
166
|
-
WhyNotAddWidget.loadingButton = createLoadingButton({
|
|
167
|
-
text: Wick.BloomreachWidget.el.loadingButtonText,
|
|
168
|
-
loader: Wick.BloomreachWidget.el.loadingButtonLoader,
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
Wick.BloomreachWidget.drawRating($root);
|
|
173
|
-
WhyNotAddWidget.initSliders($root);
|
|
174
|
-
WhyNotAddWidget.bindAddToCart($root);
|
|
175
|
-
WhyNotAddWidget.bindVatToggle();
|
|
176
|
-
Wick.BloomreachWidget.reapplyVatDisplay();
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
init(payloadData) {
|
|
180
|
-
const $containers = $(WhyNotAddWidget.el.widgetContainer);
|
|
181
|
-
|
|
182
|
-
if (!payloadData) {
|
|
183
|
-
$containers.empty().hide();
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
$containers.each(function () {
|
|
188
|
-
const $container = $(this);
|
|
189
|
-
|
|
190
|
-
WhyNotAddWidget.renderWidget($container, payloadData);
|
|
191
|
-
WhyNotAddWidget.initRenderedWidget($container);
|
|
192
|
-
});
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export default WhyNotAddWidget;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<div class="why-not-add-card why-not-add-card--skeleton ssc">
|
|
2
|
-
<div class="ssc-square why-not-add-card__image"></div>
|
|
3
|
-
|
|
4
|
-
<div class="ssc-line why-not-add-card__skeleton-title"></div>
|
|
5
|
-
<div class="ssc-line why-not-add-card__skeleton-title-short"></div>
|
|
6
|
-
|
|
7
|
-
<div class="ssc-line why-not-add-card__skeleton-reviews"></div>
|
|
8
|
-
|
|
9
|
-
<div class="ssc-line why-not-add-card__skeleton-price"></div>
|
|
10
|
-
|
|
11
|
-
<div class="ssc-line why-not-add-card__skeleton-delivery"></div>
|
|
12
|
-
|
|
13
|
-
<div class="ssc-square why-not-add-card__skeleton-cta"></div>
|
|
14
|
-
</div>
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<div class="why-not-add-card" data-product-code="{{code}}">
|
|
2
|
-
{{#if image.url}}
|
|
3
|
-
<img
|
|
4
|
-
class="why-not-add-card__image"
|
|
5
|
-
src="{{image.url}}"
|
|
6
|
-
alt="{{image.altText}}"
|
|
7
|
-
>
|
|
8
|
-
{{/if}}
|
|
9
|
-
|
|
10
|
-
<div class="why-not-add-card__content">
|
|
11
|
-
<a href="{{url}}" target="_blank" class="why-not-add-card__title">
|
|
12
|
-
{{name}}
|
|
13
|
-
</a>
|
|
14
|
-
|
|
15
|
-
{{> reviews-rating
|
|
16
|
-
externalAverageRating=externalAverageRating
|
|
17
|
-
externalReviewCount=externalReviewCount
|
|
18
|
-
}}
|
|
19
|
-
|
|
20
|
-
<div class="why-not-add-card__bottom">
|
|
21
|
-
<div class="why-not-add-card__price-wrap">
|
|
22
|
-
<div class="why-not-add-card__price {{#if wasPriceFormatted}}why-not-add-card__price--sale{{/if}}">
|
|
23
|
-
{{#if wasPriceFormatted}}
|
|
24
|
-
<span class="why-not-add-card__was-price">
|
|
25
|
-
{{#if switch-vat}}
|
|
26
|
-
<span class="including-vat-inherit">{{incVatWasPriceFormatted}}</span>
|
|
27
|
-
<span class="excluding-vat-inherit">{{excVatWasPriceFormatted}}</span>
|
|
28
|
-
{{else}}
|
|
29
|
-
{{wasPriceFormatted}}
|
|
30
|
-
{{/if}}
|
|
31
|
-
</span>
|
|
32
|
-
|
|
33
|
-
<span class="why-not-add-card__sale-price">
|
|
34
|
-
{{#if switch-vat}}
|
|
35
|
-
<span class="including-vat-inherit">{{incVatFormattedValue}}</span>
|
|
36
|
-
<span class="excluding-vat-inherit">{{excVatFormattedValue}}</span>
|
|
37
|
-
{{else}}
|
|
38
|
-
{{price.formattedValue}}
|
|
39
|
-
{{/if}}
|
|
40
|
-
</span>
|
|
41
|
-
{{else}}
|
|
42
|
-
<span class="why-not-add-card__regular-price">
|
|
43
|
-
{{#if switch-vat}}
|
|
44
|
-
<span class="including-vat-inherit">{{incVatFormattedValue}}</span>
|
|
45
|
-
<span class="excluding-vat-inherit">{{excVatFormattedValue}}</span>
|
|
46
|
-
{{else}}
|
|
47
|
-
{{price.formattedValue}}
|
|
48
|
-
{{/if}}
|
|
49
|
-
</span>
|
|
50
|
-
{{/if}}
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
{{#if switch-vat}}
|
|
54
|
-
<div class="why-not-add-card__vat-label">
|
|
55
|
-
<span class="including-vat-inherit">Inc.VAT</span>
|
|
56
|
-
<span class="excluding-vat-inherit">Exc.VAT</span>
|
|
57
|
-
</div>
|
|
58
|
-
{{/if}}
|
|
59
|
-
|
|
60
|
-
<div class="why-not-add-card__delivery">Excluding delivery</div>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
{{> button
|
|
64
|
-
type="button"
|
|
65
|
-
action=true
|
|
66
|
-
icon="fas fa-shopping-basket"
|
|
67
|
-
showLoader=true
|
|
68
|
-
loaderModifier="why-not-add-card__loader"
|
|
69
|
-
modification="why-not-add-card__cta"
|
|
70
|
-
}}
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|