wickes-css2 2.113.0 → 2.117.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/category-main.css +1 -1
- package/build/css/components/checkout-payment-details-v2.css +1 -1
- package/build/css/components/checkout-payment-repayment-terms.css +1 -1
- package/build/css/components/price-block-v2-critical.css +1 -1
- package/build/css/components/price-block-v2.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/checkout.css +1 -1
- package/build/css/pages/page_checkout_delivery-new.css +1 -1
- package/build/css/pages/page_product-details-v2-critical.css +1 -1
- package/build/css/pages/page_product-details-v2.css +1 -1
- package/build/css/pages/page_product-details.css +1 -1
- package/build/css/pages/page_products-list-combined.css +1 -1
- package/build/css/pages/page_products-list_v2.css +1 -1
- package/build/css/pages/tradePro-signup.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/img/file-pdf-solid-full.svg +3 -0
- package/build/img/lorem_ipsum.pdf +150 -0
- package/build/js/account-members.min.js +1 -1
- package/build/js/add-project-list-id.min.js +1 -1
- package/build/js/address-book.min.js +1 -1
- package/build/js/basket.min.js +2 -2
- package/build/js/bloomreach-widget.min.js +1 -1
- package/build/js/bundle.min.js +1 -1
- package/build/js/change-password.min.js +1 -1
- package/build/js/checkout.min.js +2 -2
- package/build/js/emulation.min.js +400 -192
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/gift-cards.min.js +1 -1
- package/build/js/kitchen/kitchen-plp.min.js +1 -1
- package/build/js/merged-checkout.min.js +2 -2
- package/build/js/package-bulk-add.min.js +1 -0
- package/build/js/page/bloomreach-widget/bloomreach-recommendation-carousel-widget.js +7 -6
- package/build/js/page/bloomreach-widget/bloomreach-widget-core.js +47 -27
- package/build/js/page/bloomreach-widget/bloomreach-widget.js +5 -0
- package/build/js/page/bloomreach-widget/complete-your-project/view.js +11 -6
- package/build/js/page/bloomreach-widget/complete-your-project/widget.js +0 -1
- package/build/js/page/bloomreach-widget/similar-products-widget.js +17 -0
- package/build/js/page/plp-load-more.js +81 -66
- package/build/js/page/ripple/bulk-add.js +71 -0
- package/build/js/page/ripple/package-bulk-add.js +43 -0
- package/build/js/page/ripple/postcode-checker.js +83 -0
- package/build/js/page/ripple/thumb-gallery.js +236 -0
- package/build/js/page/utils/validation.js +1 -1
- package/build/js/pdf-preview.min.js +1 -0
- package/build/js/pdp.bundle.min.js +2 -2
- package/build/js/personal-details.min.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/postcode-checker.min.js +1 -0
- package/build/js/project-list.min.js +2 -2
- package/build/js/quiz.min.js +1 -1
- package/build/js/track-my-order.min.js +1 -1
- package/package.json +1 -1
- package/src/badges-ripple.html +120 -0
- package/src/badges.html +9 -18
- package/src/components/bloomreach/complete-card.hbs +1 -1
- package/src/components/bloomreach/why-not-add-card.hbs +26 -7
- package/src/components/bloomreach/why-not-add.hbs +1 -1
- package/src/components/fulfilment-accordions.hbs +1 -1
- package/src/components/image-accordion.hbs +18 -0
- package/src/components/kitchen/price.hbs +49 -29
- package/src/components/kitchen/strip-stickers.hbs +9 -3
- package/src/components/modal-capture.hbs +1 -1
- package/src/components/modal-id-type.hbs +271 -0
- package/src/components/modal-pdf-preview.hbs +70 -0
- package/src/components/package-card.hbs +30 -0
- package/src/components/partner-signup-form.hbs +1 -231
- package/src/components/pdp-price-actions.hbs +17 -0
- package/src/components/postcode-checker.hbs +24 -0
- package/src/components/price-badges.hbs +12 -10
- package/src/components/price-block-v2.hbs +289 -199
- package/src/components/product-main-info-v2.hbs +2 -0
- package/src/components/suite-includes.hbs +66 -0
- package/src/components/suite-product-card.hbs +47 -0
- package/src/components/thumb-gallery.hbs +23 -0
- package/src/data/data_badges.json +143 -0
- package/src/data/data_bathroom-plp.json +814 -0
- package/src/data/data_suite-includes-products.json +134 -0
- package/src/img/file-pdf-solid-full.svg +3 -0
- package/src/img/lorem_ipsum.pdf +150 -0
- package/src/js/components/banner-placement-manager.js +25 -9
- package/src/js/components/general/image-accordion.js +54 -0
- package/src/js/components/general/switchVat.js +8 -1
- package/src/js/components/package-card.js +69 -0
- package/src/js/components/store-locator-cards.js +76 -0
- package/src/js/emulation/banner-placement-manager.js +219 -188
- package/src/js/emulation/bloomreach-widget-calculations.js +1 -1
- package/src/js/emulation/mock.js +66 -34
- package/src/js/emulation/plp-load-more.js +13 -4
- package/src/js/emulation/postcode-checker.js +11 -0
- package/src/js/emulation/similar-products-loading.js +22 -0
- package/src/js/emulation/tradepro-id-pdf.js +182 -0
- package/src/js/libs/pdf-preview.js +1177 -0
- package/src/js/page/bloomreach-widget/bloomreach-recommendation-carousel-widget.js +7 -6
- package/src/js/page/bloomreach-widget/bloomreach-widget-core.js +47 -27
- package/src/js/page/bloomreach-widget/bloomreach-widget.js +5 -0
- package/src/js/page/bloomreach-widget/complete-your-project/view.js +11 -6
- package/src/js/page/bloomreach-widget/complete-your-project/widget.js +0 -1
- package/src/js/page/bloomreach-widget/similar-products-widget.js +17 -0
- package/src/js/page/plp-load-more.js +81 -66
- package/src/js/page/ripple/bulk-add.js +71 -0
- package/src/js/page/ripple/package-bulk-add.js +43 -0
- package/src/js/page/ripple/postcode-checker.js +83 -0
- package/src/js/page/ripple/thumb-gallery.js +236 -0
- package/src/js/page/utils/validation.js +1 -1
- package/src/page_bathroom-plp-vat.html +81 -0
- package/src/page_bathroom-plp-without-load-more.html +83 -0
- package/src/page_bathroom-plp.html +98 -0
- package/src/page_checkout_confirmation-billie.html +5 -231
- package/src/page_checkout_confirmation-clearpay.html +5 -231
- package/src/page_checkout_confirmation-new-apple.html +5 -231
- package/src/page_checkout_confirmation-new-google.html +5 -231
- package/src/page_checkout_confirmation-new-klarna.html +5 -231
- package/src/page_checkout_confirmation-new-paypal.html +5 -231
- package/src/page_checkout_delivery-details-v2-calendar-not-loaded.html +167 -0
- package/src/page_checkout_payment-details-v2-asm.html +2 -3
- package/src/page_checkout_payment-details-v2.html +2 -3
- package/src/page_checkout_payment-details_with-card-loader.html +2 -3
- package/src/page_checkout_payment-details_with-klarna-loader.html +2 -3
- package/src/page_checkout_payment-details_with-loader-v2.html +2 -3
- package/src/page_klarna_payment-details_with-klarna.html +2 -3
- package/src/page_payment-details-billie-registered-only.html +2 -3
- package/src/page_payment-details-billie-unregistered-only.html +2 -3
- package/src/page_payment-details-with-billie.html +2 -3
- package/src/page_payment-details-with-clearpay.html +2 -3
- package/src/page_payment-details-with-gift-card.html +2 -3
- package/src/page_payment-details_with_apple-pay.html +0 -1
- package/src/page_payment-details_with_google-pay.html +2 -3
- package/src/page_pdf-preview-example.html +955 -0
- package/src/page_product-details-banner.html +1 -3
- package/src/page_product-details-big-wins-disabled-delivery.html +1 -3
- package/src/page_product-details-big-wins-non-registered.html +1 -3
- package/src/page_product-details-big-wins-out-nearest.html +1 -3
- package/src/page_product-details-big-wins-unhappy.html +1 -3
- package/src/page_product-details-big-wins.html +1 -3
- package/src/page_product-details-billie.html +1 -3
- package/src/page_product-details-calculator.html +1 -3
- package/src/page_product-details-cashback-v2.html +1 -3
- package/src/page_product-details-clearpay.html +1 -3
- package/src/page_product-details-cnc-error-notification.html +1 -3
- package/src/page_product-details-cnc-success-notification-vat.html +1 -4
- package/src/page_product-details-cnc-success-notification.html +1 -3
- package/src/page_product-details-default-store.html +1 -3
- package/src/page_product-details-energy-efficiency.html +1 -3
- package/src/page_product-details-flooring-with-pr-placeholder.html +1 -3
- package/src/page_product-details-flooring.html +1 -3
- package/src/page_product-details-gallery-actual.html +1 -3
- package/src/page_product-details-mfe-calculator.html +1 -3
- package/src/page_product-details-mtm-doors.html +1 -3
- package/src/page_product-details-only-clearpay.html +1 -3
- package/src/page_product-details-paint-mixing.html +1 -3
- package/src/page_product-details-ripple-gallery-1-image.html +120 -0
- package/src/page_product-details-ripple-gallery-missing-image.html +121 -0
- package/src/page_product-details-ripple-gallery.html +121 -0
- package/src/page_product-details-saved-pl.html +1 -3
- package/src/page_product-details-suite-includes-banners.html +139 -0
- package/src/page_product-details-suite-includes-billie.html +128 -0
- package/src/page_product-details-suite-includes-klarna.html +120 -0
- package/src/page_product-details-suite-includes-vat.html +126 -0
- package/src/page_product-details-suite-includes.html +122 -0
- package/src/page_product-details-tile-steps-klarna-widget-with-method-ids.html +1 -3
- package/src/page_product-details-tile-steps-logout.html +1 -3
- package/src/page_product-details-tile-steps-no-new-project-list.html +1 -3
- package/src/page_product-details-tile-steps-with-klarna.html +1 -3
- package/src/page_product-details-tile-steps.html +1 -3
- package/src/page_product-details-v2.html +1 -3
- package/src/page_product-details-vat.html +1 -3
- package/src/page_product-details-wisdom-mcfc-registered.html +1 -3
- package/src/page_product-details-wisdom-mcfc.html +1 -3
- package/src/page_product-details-wisdom-oos-registered.html +1 -3
- package/src/page_product-details-wisdom-oos.html +1 -3
- package/src/page_product-details-wisdom-registered.html +1 -3
- package/src/page_product-details-wisdom.html +1 -3
- package/src/page_product-details-with-favourite.html +1 -3
- package/src/page_product-details-with-global-search-v2.html +2 -3
- package/src/page_product-details-with-similar-products-widget.html +132 -0
- package/src/page_product-details-with-why-not-add-single.html +1 -0
- package/src/page_product-details_no-previous-default.html +1 -3
- package/src/page_tradePro-checkout-summary-klarna.html +4 -231
- package/src/page_tradePro-checkout-summary.html +4 -231
- package/src/page_tradePro-signup.html +5 -0
- package/src/scss/common/_loading-button.scss +3 -1
- package/src/scss/components/_date-selection-add-new-styles.scss +53 -3
- package/src/scss/components/_gift-cards.scss +1 -1
- package/src/scss/components/_id-type-modal.scss +39 -0
- package/src/scss/components/_image-accordion.scss +54 -0
- package/src/scss/components/_kitchen-card.scss +1 -0
- package/src/scss/components/_map.scss +38 -0
- package/src/scss/components/_package-card.scss +65 -0
- package/src/scss/components/_package-plp.scss +88 -0
- package/src/scss/components/_pdf-preview-modal.scss +122 -0
- package/src/scss/components/_postcode-checker.scss +115 -0
- package/src/scss/components/_price-badges-critical.scss +10 -0
- package/src/scss/components/_price-badges.scss +10 -0
- package/src/scss/components/_price-block-critical.scss +1 -0
- package/src/scss/components/_price-block.scss +1 -0
- package/src/scss/components/_suite-includes.scss +141 -0
- package/src/scss/components/_suite-product-card.scss +98 -0
- package/src/scss/components/_thumb-gallery-critical.scss +35 -0
- package/src/scss/components/_thumb-gallery.scss +200 -0
- package/src/scss/components/bloomreach/_why-not-add.scss +3 -1
- package/src/scss/components/checkout-payment-details-v2.scss +44 -20
- package/src/scss/components/checkout-payment-repayment-terms.scss +0 -1
- package/src/scss/components/kitchen/_price.scss +10 -0
- package/src/scss/components/kitchen/_strip-stickers.scss +46 -0
- package/src/scss/components/price-block-v2-critical.scss +62 -0
- package/src/scss/components/price-block-v2.scss +62 -0
- package/src/scss/pages/_checkout-tradepro.scss +1 -0
- package/src/scss/pages/_checkout_delivery-details.scss +16 -104
- package/src/scss/pages/page_checkout_delivery-new.scss +252 -164
- package/src/scss/pages/page_product-details-v2-critical.scss +216 -109
- package/src/scss/pages/page_product-details-v2.scss +168 -107
- package/src/scss/pages/page_product-details.scss +11 -0
- package/src/scss/pages/page_products-list-combined.scss +8 -6
- package/src/scss/pages/page_products-list_v2.scss +8 -6
- package/src/scss/pages/tradePro-signup.scss +1 -0
- package/src/scss/pdp-main-critical.scss +1 -0
- package/src/scss/pdp-main.scss +6 -0
- package/src/scss/plp-main.scss +5 -0
- package/src/sitemap.html +30 -6
- package/build/css/components/kitchen/strip-stickers.css +0 -1
- package/build/css/components/strip-stickers.css +0 -1
- package/src/scss/components/kitchen/strip-stickers.scss +0 -18
- package/src/scss/components/strip-stickers.scss +0 -18
|
@@ -34,6 +34,7 @@ export function createBloomreachRecommendationCarouselWidget(config) {
|
|
|
34
34
|
};
|
|
35
35
|
const el = {
|
|
36
36
|
...DEFAULT_EL,
|
|
37
|
+
...(config.el || {}),
|
|
37
38
|
widgetContainer: config.widgetContainer,
|
|
38
39
|
};
|
|
39
40
|
const addToCartEvent = config.addToCartEvent || 'addToCart';
|
|
@@ -58,9 +59,6 @@ export function createBloomreachRecommendationCarouselWidget(config) {
|
|
|
58
59
|
.map(function (item) {
|
|
59
60
|
return item.baseProduct || item;
|
|
60
61
|
})
|
|
61
|
-
.filter(function (product) {
|
|
62
|
-
return config.isEligibleProduct ? config.isEligibleProduct(product) : true;
|
|
63
|
-
})
|
|
64
62
|
.slice(0, 5);
|
|
65
63
|
}
|
|
66
64
|
|
|
@@ -85,6 +83,8 @@ export function createBloomreachRecommendationCarouselWidget(config) {
|
|
|
85
83
|
...Wick.BloomreachWidget.getProductRenderData(product),
|
|
86
84
|
addToCartError: config.addToCartError,
|
|
87
85
|
showBadge: !config.hideBadge,
|
|
86
|
+
sameTab: Boolean(config.sameTab),
|
|
87
|
+
linkImage: Boolean(config.linkImage),
|
|
88
88
|
};
|
|
89
89
|
}),
|
|
90
90
|
isSingleProduct: products.length === 1,
|
|
@@ -130,7 +130,7 @@ export function createBloomreachRecommendationCarouselWidget(config) {
|
|
|
130
130
|
navigation: {
|
|
131
131
|
nextEl: $widget.find(el.next)[0],
|
|
132
132
|
prevEl: $widget.find(el.prev)[0],
|
|
133
|
-
disabledClass: 'why-not-add__arrow--disabled',
|
|
133
|
+
disabledClass: config.arrowDisabledClass || 'why-not-add__arrow--disabled',
|
|
134
134
|
},
|
|
135
135
|
pagination: {
|
|
136
136
|
el: $widget.find(el.pagination)[0],
|
|
@@ -140,8 +140,9 @@ export function createBloomreachRecommendationCarouselWidget(config) {
|
|
|
140
140
|
index + 1
|
|
141
141
|
}"></button>`;
|
|
142
142
|
},
|
|
143
|
-
bulletClass: 'why-not-add__pagination-item',
|
|
144
|
-
bulletActiveClass:
|
|
143
|
+
bulletClass: config.paginationItemClass || 'why-not-add__pagination-item',
|
|
144
|
+
bulletActiveClass:
|
|
145
|
+
config.paginationActiveItemClass || 'why-not-add__pagination-item--active',
|
|
145
146
|
},
|
|
146
147
|
});
|
|
147
148
|
|
|
@@ -56,6 +56,8 @@ export function createBloomreachWidget(config) {
|
|
|
56
56
|
config.renderWidget($container, payloadData, widget);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
Wick.BloomreachWidget.removeBlankTargets($container);
|
|
60
|
+
|
|
59
61
|
if (config.initRenderedWidget) {
|
|
60
62
|
config.initRenderedWidget($container, widget);
|
|
61
63
|
}
|
|
@@ -224,22 +226,9 @@ Wick.BloomreachWidget = {
|
|
|
224
226
|
},
|
|
225
227
|
|
|
226
228
|
getWasPriceFormatted(product) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (wasPrice && wasPrice.formattedValue) {
|
|
231
|
-
return wasPrice.formattedValue;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (typeof wasPrice === 'number') {
|
|
235
|
-
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if (wasPrice) {
|
|
239
|
-
return `${displayPrice.currencySymbol || '£'}${wasPrice}`;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return '';
|
|
229
|
+
return Wick.BloomreachWidget.formatPromotionalPrice(
|
|
230
|
+
Wick.BloomreachWidget.getWasPrice(product)
|
|
231
|
+
);
|
|
243
232
|
},
|
|
244
233
|
|
|
245
234
|
getExcVatWasPrice(product) {
|
|
@@ -249,15 +238,7 @@ Wick.BloomreachWidget = {
|
|
|
249
238
|
(displayPriceExclusiveVat && displayPriceExclusiveVat.wasPrice) ||
|
|
250
239
|
(priceExclusiveVat && priceExclusiveVat.wasPrice);
|
|
251
240
|
|
|
252
|
-
|
|
253
|
-
return wasPrice.formattedValue;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if (typeof wasPrice === 'number') {
|
|
257
|
-
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return wasPrice || '';
|
|
241
|
+
return Wick.BloomreachWidget.formatPromotionalPrice(wasPrice);
|
|
261
242
|
},
|
|
262
243
|
|
|
263
244
|
getProductImage(product, fallbackProduct) {
|
|
@@ -282,9 +263,15 @@ Wick.BloomreachWidget = {
|
|
|
282
263
|
const displayPriceExcVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
283
264
|
const wasPriceFormatted = Wick.BloomreachWidget.getWasPriceFormatted(product);
|
|
284
265
|
const isSwitchVat = !!(window.ACC && window.ACC.app && window.ACC.app.isVatToggleAvailable);
|
|
285
|
-
const
|
|
266
|
+
const incVatFormattedValue = wasPriceFormatted
|
|
267
|
+
? Wick.BloomreachWidget.formatPromotionalPrice(displayPrice)
|
|
268
|
+
: Wick.BloomreachWidget.getPriceFormattedValue(displayPrice);
|
|
269
|
+
const excVatValue = options.fallbackExcVat
|
|
286
270
|
? Wick.BloomreachWidget.getExcVatFormattedValue(product, displayPrice)
|
|
287
271
|
: Wick.BloomreachWidget.getPriceFormattedValue(displayPriceExcVat);
|
|
272
|
+
const excVatFormattedValue = wasPriceFormatted
|
|
273
|
+
? Wick.BloomreachWidget.formatPromotionalPrice(displayPriceExcVat || excVatValue)
|
|
274
|
+
: excVatValue;
|
|
288
275
|
|
|
289
276
|
return {
|
|
290
277
|
...product,
|
|
@@ -295,7 +282,7 @@ Wick.BloomreachWidget = {
|
|
|
295
282
|
Wick.BloomreachWidget.getProductImage(product, options.fallbackProduct),
|
|
296
283
|
wasPriceFormatted,
|
|
297
284
|
'switch-vat': isSwitchVat,
|
|
298
|
-
incVatFormattedValue
|
|
285
|
+
incVatFormattedValue,
|
|
299
286
|
incVatValue: Wick.BloomreachWidget.getPriceValue(displayPrice),
|
|
300
287
|
excVatFormattedValue,
|
|
301
288
|
excVatValue: Wick.BloomreachWidget.getPriceValue(displayPriceExcVat),
|
|
@@ -359,6 +346,39 @@ Wick.BloomreachWidget = {
|
|
|
359
346
|
$(window).off(eventName).on(eventName, Wick.BloomreachWidget.reapplyVatDisplay);
|
|
360
347
|
},
|
|
361
348
|
|
|
349
|
+
formatPromotionalPrice(price) {
|
|
350
|
+
if (price === null || price === undefined) {
|
|
351
|
+
return '';
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const rawValue =
|
|
355
|
+
typeof price === 'object'
|
|
356
|
+
? typeof price.value === 'number'
|
|
357
|
+
? price.value
|
|
358
|
+
: price.formattedValue
|
|
359
|
+
: price;
|
|
360
|
+
|
|
361
|
+
if (rawValue === null || rawValue === undefined || rawValue === '') {
|
|
362
|
+
return '';
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const value =
|
|
366
|
+
typeof rawValue === 'number'
|
|
367
|
+
? rawValue
|
|
368
|
+
: Number(`${rawValue}`.replace(/[,£\s]/g, ''));
|
|
369
|
+
|
|
370
|
+
if (!Number.isFinite(value)) {
|
|
371
|
+
return typeof rawValue === 'string' ? rawValue : '';
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return new Intl.NumberFormat('en-GB', {
|
|
375
|
+
style: 'currency',
|
|
376
|
+
currency: 'GBP',
|
|
377
|
+
minimumFractionDigits: Math.round(Math.abs(value) * 100) % 100 === 0 ? 0 : 2,
|
|
378
|
+
maximumFractionDigits: 2,
|
|
379
|
+
}).format(value);
|
|
380
|
+
},
|
|
381
|
+
|
|
362
382
|
formatPrice(value) {
|
|
363
383
|
return new Intl.NumberFormat('en-GB', {
|
|
364
384
|
style: 'currency',
|
|
@@ -4,6 +4,7 @@ import './bloomreach-widget-core';
|
|
|
4
4
|
import Widget from './complete-your-project/widget';
|
|
5
5
|
import WhyNotAddWidget from './why-not-add-widget';
|
|
6
6
|
import DontForgetWidget from './dont-forget-widget';
|
|
7
|
+
import SimilarProductsWidget from './similar-products-widget';
|
|
7
8
|
|
|
8
9
|
Wick.BloomreachWidget.registerWidgets([
|
|
9
10
|
{
|
|
@@ -18,4 +19,8 @@ Wick.BloomreachWidget.registerWidgets([
|
|
|
18
19
|
type: 'dontForget',
|
|
19
20
|
widget: DontForgetWidget,
|
|
20
21
|
},
|
|
22
|
+
{
|
|
23
|
+
type: 'similarProducts',
|
|
24
|
+
widget: SimilarProductsWidget,
|
|
25
|
+
},
|
|
21
26
|
]);
|
|
@@ -70,16 +70,21 @@ export function createCompleteYourProjectView(model, presenter) {
|
|
|
70
70
|
if (response.totalWasPrice) {
|
|
71
71
|
$total.addClass('complete-widget__total-sale');
|
|
72
72
|
|
|
73
|
+
const formatPrice = Wick.BloomreachWidget.formatPromotionalPrice;
|
|
74
|
+
const wasPrice = formatPrice(response.totalWasPrice);
|
|
75
|
+
const salePrice = formatPrice(response.totalPrice);
|
|
76
|
+
const excVatWasPrice = formatPrice(totalWasPriceExclusiveVat || response.totalWasPrice);
|
|
77
|
+
const excVatSalePrice = formatPrice(totalPriceExclusiveVat || response.totalPrice);
|
|
73
78
|
const $priceInc = $price.find(vatInc);
|
|
74
79
|
|
|
75
80
|
if ($priceInc.length) {
|
|
76
|
-
$priceInc.text(
|
|
77
|
-
$price.find(vatExc).text(
|
|
78
|
-
$salePrice.find(vatInc).text(
|
|
79
|
-
$salePrice.find(vatExc).text(
|
|
81
|
+
$priceInc.text(wasPrice);
|
|
82
|
+
$price.find(vatExc).text(excVatWasPrice);
|
|
83
|
+
$salePrice.find(vatInc).text(salePrice);
|
|
84
|
+
$salePrice.find(vatExc).text(excVatSalePrice);
|
|
80
85
|
} else {
|
|
81
|
-
$price.text(
|
|
82
|
-
$salePrice.text(
|
|
86
|
+
$price.text(wasPrice);
|
|
87
|
+
$salePrice.text(salePrice);
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
$salePrice.show();
|
|
@@ -124,7 +124,6 @@ function initRenderedWidget($container) {
|
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
Wick.BloomreachWidget.removeBlankTargets($completeWidget);
|
|
128
127
|
Wick.BloomreachWidget.drawRating($completeWidget);
|
|
129
128
|
cards.bindCardSelection($completeWidget);
|
|
130
129
|
cards.bindDropdowns();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createBloomreachRecommendationCarouselWidget } from './bloomreach-recommendation-carousel-widget';
|
|
2
|
+
|
|
3
|
+
const SimilarProductsWidget = createBloomreachRecommendationCarouselWidget({
|
|
4
|
+
namespace: 'similarProducts',
|
|
5
|
+
title: 'Similar products',
|
|
6
|
+
widgetContainer: '[data-similar-products-widget]',
|
|
7
|
+
disableAfterSuccess: false,
|
|
8
|
+
disableAfterFailure: false,
|
|
9
|
+
hideBadge: true,
|
|
10
|
+
sameTab: true,
|
|
11
|
+
linkImage: true,
|
|
12
|
+
el: {
|
|
13
|
+
productLink: '.why-not-add-card__title, .why-not-add-card__image-link',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default SimilarProductsWidget;
|
|
@@ -1,77 +1,92 @@
|
|
|
1
|
-
import {createEvent} from
|
|
2
|
-
import {appendLoader, showLoader, hideLoader} from
|
|
1
|
+
import { createEvent } from './utils/create-event';
|
|
2
|
+
import { appendLoader, showLoader, hideLoader } from './utils/loader';
|
|
3
3
|
|
|
4
4
|
var Wick = window.Wick || {};
|
|
5
5
|
|
|
6
6
|
Wick.PLPLoadMore = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
PLP_LOAD_MORE_EVENT: 'loadMore',
|
|
8
|
+
HIDDEN_CLASS_NAME: 'd-none',
|
|
9
|
+
MAX_PRODUCTS_PER_PAGE: 32,
|
|
10
|
+
initialPageNumber: 0,
|
|
11
|
+
el: {
|
|
12
|
+
$loadMoreBtn: $('.btn-load-more'),
|
|
13
|
+
loader: '.loader-wrapper',
|
|
14
|
+
$sortOptions: $('#sort_form1'),
|
|
15
|
+
productsList: $('.package-plp__cards').length ? '.package-plp__cards' : '.products-list',
|
|
16
|
+
$packageContent: $('.package-plp__content'),
|
|
17
|
+
},
|
|
18
|
+
numberOfPagesPLP: $('#numberOfPagesPLP').val(),
|
|
19
|
+
loaderPayload: {
|
|
20
|
+
wrapper: 'body',
|
|
21
|
+
hidden: true,
|
|
22
|
+
modifier: 'basket-loader',
|
|
23
|
+
},
|
|
24
|
+
loadMore() {
|
|
25
|
+
showLoader(Wick.PLPLoadMore.el.loader);
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const eventDetail = { resolve, reject };
|
|
29
|
+
const payload = {
|
|
30
|
+
currentPage: ++Wick.PLPLoadMore.initialPageNumber,
|
|
31
|
+
sort: Wick.PLPLoadMore.el.$sortOptions.val() || '',
|
|
32
|
+
isRippleData: Wick.PLPLoadMore.el.$packageContent.length,
|
|
33
|
+
};
|
|
34
|
+
const event = createEvent(Wick.PLPLoadMore.PLP_LOAD_MORE_EVENT, payload, eventDetail);
|
|
35
|
+
window.dispatchEvent(event);
|
|
36
|
+
})
|
|
37
|
+
.then((response) => {
|
|
38
|
+
if (!response.length) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Wick.PLPLoadMore.showNewCards(response);
|
|
43
|
+
Wick.PLPLoadMore.toggleLoadMoreBtn();
|
|
44
|
+
Wick.VatToggle.reapplyDisplayClass();
|
|
45
|
+
})
|
|
46
|
+
.finally(() => {
|
|
47
|
+
hideLoader(Wick.PLPLoadMore.el.loader);
|
|
48
|
+
Wick.PLPLoadMore.el.$loadMoreBtn.blur();
|
|
49
|
+
Wick.BannerPlacementManager.checkProductsInColumn();
|
|
50
|
+
$(window).trigger('productBannerPositionChanged');
|
|
51
|
+
Wick.EnergyEfficiency.drawEnergyLabels();
|
|
52
|
+
Wick.PLP?.bindEvents();
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
showNewCards(newProductsHtml) {
|
|
56
|
+
const $newProductsHtml = $(newProductsHtml);
|
|
57
|
+
$(Wick.PLPLoadMore.el.productsList).append($newProductsHtml);
|
|
58
|
+
Wick.PackageCards.alignGridRows();
|
|
59
|
+
},
|
|
60
|
+
toggleLoadMoreBtn(checkCardsAmount = false) {
|
|
61
|
+
const isLastPage =
|
|
62
|
+
Wick.PLPLoadMore.initialPageNumber + 1 >= +Wick.PLPLoadMore.numberOfPagesPLP;
|
|
63
|
+
let shouldHide = isLastPage;
|
|
64
|
+
|
|
65
|
+
if (checkCardsAmount) {
|
|
66
|
+
const cardsCount = $(Wick.PLPLoadMore.el.productsList).children().length;
|
|
67
|
+
shouldHide = cardsCount <= Wick.PLPLoadMore.MAX_PRODUCTS_PER_PAGE && isLastPage;
|
|
37
68
|
}
|
|
38
69
|
|
|
39
|
-
Wick.PLPLoadMore.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Wick.PLPLoadMore.el.$loadMoreBtn.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
Wick.EnergyEfficiency.drawEnergyLabels();
|
|
49
|
-
Wick.PLP?.bindEvents();
|
|
50
|
-
})
|
|
51
|
-
},
|
|
52
|
-
showNewCards (newProductsHtml) {
|
|
53
|
-
const $newProductsHtml = $(newProductsHtml);
|
|
54
|
-
$(Wick.PLPLoadMore.el.productsList).append($newProductsHtml);
|
|
55
|
-
},
|
|
56
|
-
toggleLoadMoreBtn() {
|
|
57
|
-
if (Wick.PLPLoadMore.initialPageNumber + 1 >= +Wick.PLPLoadMore.numberOfPagesPLP) {
|
|
58
|
-
Wick.PLPLoadMore.el.$loadMoreBtn.addClass(Wick.PLPLoadMore.HIDDEN_CLASS_NAME);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
init () {
|
|
62
|
-
if (!Wick.PLPLoadMore.el.$loadMoreBtn.length) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
appendLoader(Wick.PLPLoadMore.loaderPayload);
|
|
70
|
+
Wick.PLPLoadMore.el.$loadMoreBtn.toggleClass(
|
|
71
|
+
Wick.PLPLoadMore.HIDDEN_CLASS_NAME,
|
|
72
|
+
shouldHide
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
init() {
|
|
76
|
+
if (!Wick.PLPLoadMore.el.$loadMoreBtn.length) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
66
79
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
80
|
+
if (Wick.PLPLoadMore.el.$packageContent.length) {
|
|
81
|
+
Wick.PLPLoadMore.toggleLoadMoreBtn(true);
|
|
82
|
+
}
|
|
70
83
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
appendLoader(Wick.PLPLoadMore.loaderPayload);
|
|
85
|
+
|
|
86
|
+
Wick.PLPLoadMore.el.$loadMoreBtn.on('click', Wick.PLPLoadMore.loadMore);
|
|
87
|
+
},
|
|
88
|
+
};
|
|
75
89
|
|
|
76
|
-
|
|
90
|
+
$(document).ready(function () {
|
|
91
|
+
Wick.PLPLoadMore.init();
|
|
77
92
|
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createToast } from '../utils/create-toast';
|
|
2
|
+
import { createLoadingButton } from '../utils/create-loading-button';
|
|
3
|
+
import { createEvent } from '../utils/create-event';
|
|
4
|
+
const notificationTemplate = require('../../../elements/notifications.hbs');
|
|
5
|
+
|
|
6
|
+
const BULK_ADD_EVENT = 'bulkAddToCart';
|
|
7
|
+
const QUANTITY = 1;
|
|
8
|
+
|
|
9
|
+
const bulkAddFailedResponse = {
|
|
10
|
+
bulkAddToCartData: {
|
|
11
|
+
messageType: 'error',
|
|
12
|
+
messageText: 'Product was not added to basket',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function dispatchWindowEvent(eventName, payload) {
|
|
17
|
+
return new Promise(function (resolve, reject) {
|
|
18
|
+
window.dispatchEvent(createEvent(eventName, payload, { resolve, reject }));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function createBulkAddHelper({ productCodeSelector }) {
|
|
23
|
+
let toast = null;
|
|
24
|
+
let loadingButton = null;
|
|
25
|
+
|
|
26
|
+
function getProductCode() {
|
|
27
|
+
return $(productCodeSelector).val();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function addProductToCart(postcode) {
|
|
31
|
+
const item = { productCode: getProductCode(), quantity: QUANTITY };
|
|
32
|
+
|
|
33
|
+
const payload = {
|
|
34
|
+
entries: [item]
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (postcode) {
|
|
38
|
+
payload.postCode = postcode;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return dispatchWindowEvent(BULK_ADD_EVENT, payload);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function showBulkAddResult(response) {
|
|
45
|
+
const bulkData = response && response.bulkAddToCartData;
|
|
46
|
+
|
|
47
|
+
if (bulkData) {
|
|
48
|
+
toast.show({ type: bulkData.messageType, text: bulkData.messageText });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function init() {
|
|
53
|
+
if (!toast) {
|
|
54
|
+
toast = createToast({ template: notificationTemplate });
|
|
55
|
+
}
|
|
56
|
+
if (!loadingButton) {
|
|
57
|
+
loadingButton = createLoadingButton();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
init,
|
|
63
|
+
getProductCode,
|
|
64
|
+
addProductToCart,
|
|
65
|
+
showBulkAddResult,
|
|
66
|
+
showBulkAddFailed: () => showBulkAddResult(bulkAddFailedResponse),
|
|
67
|
+
get loadingButton() {
|
|
68
|
+
return loadingButton;
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createBulkAddHelper } from './bulk-add';
|
|
2
|
+
|
|
3
|
+
var Wick = window.Wick || {};
|
|
4
|
+
|
|
5
|
+
Wick.PackageBulkAdd = (function () {
|
|
6
|
+
const selectors = {
|
|
7
|
+
button: '.package-bulk-add',
|
|
8
|
+
productCodeInput: '.pdp-price input[name=productCodePost]',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const bulkAdd = createBulkAddHelper({ productCodeSelector: selectors.productCodeInput });
|
|
12
|
+
|
|
13
|
+
async function handleButtonClick(e) {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
|
|
16
|
+
const $buttons = $(selectors.button);
|
|
17
|
+
|
|
18
|
+
if (bulkAdd.loadingButton.isLoading($buttons)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
bulkAdd.loadingButton.start($buttons);
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
bulkAdd.showBulkAddResult(await bulkAdd.addProductToCart());
|
|
26
|
+
Wick.MiniBasketSliderFE.isMiniBasketLoaded = false;
|
|
27
|
+
} catch {
|
|
28
|
+
bulkAdd.showBulkAddFailed();
|
|
29
|
+
} finally {
|
|
30
|
+
bulkAdd.loadingButton.stop($buttons);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function init() {
|
|
35
|
+
bulkAdd.init();
|
|
36
|
+
|
|
37
|
+
$(selectors.button).on('click', handleButtonClick);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return { init };
|
|
41
|
+
})();
|
|
42
|
+
|
|
43
|
+
$(document).ready(Wick.PackageBulkAdd.init);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isValidPostcodeField } from '../utils/validation';
|
|
2
|
+
import { createBulkAddHelper, dispatchWindowEvent } from './bulk-add';
|
|
3
|
+
|
|
4
|
+
var Wick = window.Wick || {};
|
|
5
|
+
|
|
6
|
+
Wick.PostcodeChecker = (function () {
|
|
7
|
+
const POSTCODE_CHECK_AVAILABILITY_EVENT = 'postcodeCheckAviability';
|
|
8
|
+
const QUANTITY = 1;
|
|
9
|
+
|
|
10
|
+
const selectors = {
|
|
11
|
+
root: '.postcode-checker',
|
|
12
|
+
input: '.postcode-checker__input',
|
|
13
|
+
button: '.postcode-checker__button',
|
|
14
|
+
productCodeInput: '.pdp-price input[name=productCodePost]',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const modifiers = {
|
|
18
|
+
hasError: 'postcode-checker--error',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const bulkAdd = createBulkAddHelper({ productCodeSelector: selectors.productCodeInput });
|
|
22
|
+
|
|
23
|
+
function checkPostcodeAvailability(postcode) {
|
|
24
|
+
const payload = { postcode, productCode: bulkAdd.getProductCode(), quantity: QUANTITY };
|
|
25
|
+
|
|
26
|
+
return dispatchWindowEvent(POSTCODE_CHECK_AVAILABILITY_EVENT, payload);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function bulkAddForPostcode(postcode) {
|
|
30
|
+
try {
|
|
31
|
+
await checkPostcodeAvailability(postcode);
|
|
32
|
+
bulkAdd.showBulkAddResult(await bulkAdd.addProductToCart(postcode));
|
|
33
|
+
Wick.MiniBasketSliderFE.isMiniBasketLoaded = false;
|
|
34
|
+
} catch {
|
|
35
|
+
bulkAdd.showBulkAddFailed();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function isPostcodeValid($component, $postcodeInput) {
|
|
40
|
+
const isValid = isValidPostcodeField($postcodeInput.val());
|
|
41
|
+
$component.toggleClass(modifiers.hasError, !isValid);
|
|
42
|
+
console.log({ isValid, val: $postcodeInput.val() });
|
|
43
|
+
return isValid;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function handleSubmitClick($component, $postcodeInput, $submitButton) {
|
|
47
|
+
if (
|
|
48
|
+
bulkAdd.loadingButton.isLoading($submitButton) ||
|
|
49
|
+
!isPostcodeValid($component, $postcodeInput)
|
|
50
|
+
) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
bulkAdd.loadingButton.start($submitButton);
|
|
55
|
+
|
|
56
|
+
const postcode = $postcodeInput.val();
|
|
57
|
+
|
|
58
|
+
bulkAddForPostcode(postcode).finally(function () {
|
|
59
|
+
bulkAdd.loadingButton.stop($submitButton);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function init() {
|
|
64
|
+
bulkAdd.init();
|
|
65
|
+
|
|
66
|
+
$(selectors.root).each(function () {
|
|
67
|
+
const $component = $(this);
|
|
68
|
+
const $postcodeInput = $component.find(selectors.input);
|
|
69
|
+
const $submitButton = $component.find(selectors.button);
|
|
70
|
+
|
|
71
|
+
$component.removeClass(modifiers.hasError);
|
|
72
|
+
|
|
73
|
+
$submitButton.on('click', function (e) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
handleSubmitClick($component, $postcodeInput, $submitButton);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { init };
|
|
81
|
+
})();
|
|
82
|
+
|
|
83
|
+
$(document).ready(Wick.PostcodeChecker.init);
|