wickes-css2 2.113.0-develop.1 → 2.113.0-develop.11
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/global-search.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/components/store-locator-facilities.css +1 -1
- package/build/css/components/store-locator-lookup.css +1 -1
- package/build/css/components/tile-calculator.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/checkout.css +1 -1
- package/build/css/pages/my-account-v2.css +1 -1
- package/build/css/pages/my-account.css +1 -1
- package/build/css/pages/page_address-book.css +1 -1
- package/build/css/pages/page_checkout_delivery-new.css +1 -1
- package/build/css/pages/page_default-store.css +1 -1
- package/build/css/pages/page_discount.css +1 -1
- package/build/css/pages/page_fi.css +1 -1
- package/build/css/pages/page_in-store-checkout.css +1 -1
- package/build/css/pages/page_merged-basket.css +1 -1
- package/build/css/pages/page_my-order.css +1 -1
- package/build/css/pages/page_my-orders.css +1 -1
- package/build/css/pages/page_product-details-critical.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_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/pages/page_ti.css +1 -1
- package/build/css/pages/tradePro-discount.css +1 -1
- package/build/css/pages/tradePro-rewards-old.css +1 -1
- package/build/css/pages/tradePro-rewards.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/shopping-list-pdf.css +1 -1
- package/build/css/store-locator-main.css +1 -1
- package/build/img/emulation/low-trees.png +0 -0
- package/build/img/emulation/overhead-power-cables.png +0 -0
- package/build/img/emulation/parked-vehicles.png +0 -0
- package/build/img/emulation/traffic-access-issues.png +0 -0
- package/build/img/emulation/walls-or-fences.png +0 -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 +456 -3270
- 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 +318 -0
- package/build/js/page/bloomreach-widget/bloomreach-widget-core.js +370 -0
- package/build/js/page/bloomreach-widget/bloomreach-widget-tracking.js +16 -13
- package/build/js/page/bloomreach-widget/bloomreach-widget.js +8 -237
- package/build/js/page/bloomreach-widget/complete-your-project/cards.js +308 -0
- package/build/js/page/bloomreach-widget/complete-your-project/config.js +60 -0
- package/build/js/page/bloomreach-widget/complete-your-project/model.js +140 -0
- package/build/js/page/bloomreach-widget/complete-your-project/presenter.js +69 -0
- package/build/js/page/bloomreach-widget/complete-your-project/quantity.js +80 -0
- package/build/js/page/bloomreach-widget/complete-your-project/view.js +179 -0
- package/build/js/page/bloomreach-widget/complete-your-project/widget.js +185 -0
- package/build/js/page/bloomreach-widget/dont-forget-widget.js +15 -0
- package/build/js/page/bloomreach-widget/why-not-add-widget.js +10 -228
- 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 +168 -0
- package/build/js/page/utils/validation.js +1 -1
- 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 +4 -2
- package/src/badges-ripple.html +120 -0
- package/src/badges.html +9 -18
- package/src/components/base/button.hbs +7 -0
- package/src/components/bloomreach/complete-your-project-skeleton.hbs +21 -0
- package/src/components/bloomreach/complete-your-project.hbs +6 -21
- package/src/components/bloomreach/why-not-add-card-skeleton.hbs +2 -2
- package/src/components/bloomreach/why-not-add-card.hbs +79 -60
- package/src/components/bloomreach/why-not-add-content.hbs +3 -3
- package/src/components/bloomreach/why-not-add.hbs +1 -1
- package/src/components/date-selection.hbs +19 -10
- package/src/components/fulfilment-accordions.hbs +1 -1
- package/src/components/heavy-banners-wrapper.hbs +21 -0
- 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/package-card.hbs +30 -0
- 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 +274 -202
- 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_heavy-banner.json +29 -0
- package/src/data/data_suite-includes-products.json +134 -0
- package/src/data/my-account/data_my-account.json +1 -1
- package/src/data/my-account/data_my-order.json +1 -1
- package/src/data/my-account/data_my-orders.json +1 -1
- package/src/img/emulation/low-trees.png +0 -0
- package/src/img/emulation/overhead-power-cables.png +0 -0
- package/src/img/emulation/parked-vehicles.png +0 -0
- package/src/img/emulation/traffic-access-issues.png +0 -0
- package/src/img/emulation/walls-or-fences.png +0 -0
- package/src/js/components/banner-placement-manager.js +25 -9
- package/src/js/components/general/cart-slider.js +41 -4
- 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/complete-your-project-loading.js +16 -0
- package/src/js/emulation/custom-slider-emulation.js +21 -8
- package/src/js/emulation/date-selection.js +2 -2
- package/src/js/emulation/dont-forget-loading.js +36 -0
- package/src/js/emulation/just-added-scenarios-emulation.js +131 -0
- package/src/js/emulation/mini-basket.js +34 -34
- package/src/js/emulation/mock.js +429 -4
- package/src/js/emulation/plp-load-more.js +13 -4
- package/src/js/emulation/postcode-checker.js +11 -0
- package/src/js/emulation/why-not-add-loading.js +14 -3
- package/src/js/emulation/why-not-add.js +12 -14
- package/src/js/page/bloomreach-widget/bloomreach-recommendation-carousel-widget.js +318 -0
- package/src/js/page/bloomreach-widget/bloomreach-widget-core.js +370 -0
- package/src/js/page/bloomreach-widget/bloomreach-widget-tracking.js +16 -13
- package/src/js/page/bloomreach-widget/bloomreach-widget.js +8 -237
- package/src/js/page/bloomreach-widget/complete-your-project/cards.js +308 -0
- package/src/js/page/bloomreach-widget/complete-your-project/config.js +60 -0
- package/src/js/page/bloomreach-widget/complete-your-project/model.js +140 -0
- package/src/js/page/bloomreach-widget/complete-your-project/presenter.js +69 -0
- package/src/js/page/bloomreach-widget/complete-your-project/quantity.js +80 -0
- package/src/js/page/bloomreach-widget/complete-your-project/view.js +179 -0
- package/src/js/page/bloomreach-widget/complete-your-project/widget.js +185 -0
- package/src/js/page/bloomreach-widget/dont-forget-widget.js +15 -0
- package/src/js/page/bloomreach-widget/why-not-add-widget.js +10 -228
- 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 +168 -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_big-bulky-delivery-details.html +272 -0
- package/src/page_checkout_premium-delivery-details.html +2 -2
- 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.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 +6 -9
- package/src/page_product-details-with-why-not-add-single.html +2 -1
- package/src/page_product-details_no-previous-default.html +1 -3
- package/src/scss/components/_cards-slider.scss +3 -1
- package/src/scss/components/_checkout_order.scss +2 -1
- package/src/scss/components/_date-selection-add-new-styles.scss +29 -0
- package/src/scss/components/_heavy-banners.scss +216 -0
- package/src/scss/components/_image-accordion.scss +54 -0
- package/src/scss/components/_kitchen-card.scss +1 -0
- package/src/scss/components/_lines-group.scss +1 -1
- package/src/scss/components/_package-card.scss +63 -0
- package/src/scss/components/_package-plp.scss +88 -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/_sticky-element-appearance.scss +6 -2
- 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 +34 -0
- package/src/scss/components/_thumb-gallery.scss +192 -0
- package/src/scss/components/bloomreach/_bloomreach.scss +1 -0
- package/src/scss/components/bloomreach/_card-shared.scss +24 -0
- package/src/scss/components/bloomreach/_complete-card.scss +1 -9
- package/src/scss/components/bloomreach/_reviews.scss +0 -2
- package/src/scss/components/bloomreach/_why-not-add-card.scss +137 -10
- package/src/scss/components/bloomreach/_why-not-add.scss +31 -2
- package/src/scss/components/energy-efficiency.scss +2 -2
- package/src/scss/components/global-search.scss +6 -2
- package/src/scss/components/kitchen/_price.scss +10 -0
- package/src/scss/components/kitchen/_strip-stickers.scss +46 -0
- package/src/scss/components/my-account/_active-orders.scss +9 -9
- package/src/scss/components/price-block-v2-critical.scss +58 -0
- package/src/scss/components/price-block-v2.scss +58 -0
- package/src/scss/helpers/helpers-pdp-critical/_helpers-critical-pdp.scss +13 -8
- package/src/scss/libs/_bootstrap-extracted.scss +5 -0
- package/src/scss/main.scss +1 -0
- package/src/scss/pages/iframe-paypage.scss +9 -11
- package/src/scss/pages/page_checkout_delivery-new.scss +4 -0
- package/src/scss/pages/page_cms_homepage.scss +10 -4
- package/src/scss/pages/page_installation.scss +2 -2
- package/src/scss/pages/page_online-exclusive.scss +7 -3
- 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_top-rated.scss +38 -23
- 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 +15 -0
- package/build/css/components/kitchen/strip-stickers.css +0 -1
- package/build/css/components/strip-stickers.css +0 -1
- package/build/js/page/bloomreach-widget/complete-your-project-widget.js +0 -1100
- package/src/js/page/bloomreach-widget/complete-your-project-widget.js +0 -1100
- package/src/scss/components/kitchen/strip-stickers.scss +0 -18
- package/src/scss/components/strip-stickers.scss +0 -18
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { isApp } from '../utils/helpers';
|
|
2
|
+
import { createBloomreachWidgetTracking } from './bloomreach-widget-tracking';
|
|
3
|
+
|
|
4
|
+
var Wick = window.Wick || {};
|
|
5
|
+
|
|
6
|
+
import { createEvent } from '../utils/create-event';
|
|
7
|
+
|
|
8
|
+
export function createBloomreachWidget(config) {
|
|
9
|
+
const tracking = config.tracking || createBloomreachWidgetTracking();
|
|
10
|
+
|
|
11
|
+
const widget = {
|
|
12
|
+
el: config.el || {},
|
|
13
|
+
tracking,
|
|
14
|
+
|
|
15
|
+
getContainers(options = {}) {
|
|
16
|
+
if (options.container) {
|
|
17
|
+
return $(options.container);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return $(widget.el.widgetContainer);
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
hide(options = {}) {
|
|
24
|
+
const $containers = widget.getContainers(options);
|
|
25
|
+
|
|
26
|
+
if (config.hide) {
|
|
27
|
+
config.hide($containers, options, widget);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
$containers.empty().hide();
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
init(payloadData, options = {}) {
|
|
35
|
+
const $containers = widget.getContainers(options);
|
|
36
|
+
|
|
37
|
+
if (!$containers.length) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!payloadData || !Wick.BloomreachWidget.hasRecommendations(payloadData)) {
|
|
42
|
+
widget.hide(options);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
tracking.setPayload(payloadData);
|
|
47
|
+
|
|
48
|
+
if (config.setPayload) {
|
|
49
|
+
config.setPayload(payloadData, widget);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
$containers.each(function () {
|
|
53
|
+
const $container = $(this);
|
|
54
|
+
|
|
55
|
+
if (config.renderWidget) {
|
|
56
|
+
config.renderWidget($container, payloadData, widget);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (config.initRenderedWidget) {
|
|
60
|
+
config.initRenderedWidget($container, widget);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (config.getViewTargets) {
|
|
65
|
+
tracking.observeView(config.getViewTargets($containers, widget));
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return widget;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
Wick.BloomreachWidget = {
|
|
74
|
+
widgets: {},
|
|
75
|
+
|
|
76
|
+
el: {
|
|
77
|
+
loadingButtonText: '.loading-button__text',
|
|
78
|
+
loadingButtonLoader: '.loading-button__loader',
|
|
79
|
+
ratingOverlay: '.rating-overlay',
|
|
80
|
+
starOverlay: '.star-overlay',
|
|
81
|
+
vatInc: '.including-vat-inherit',
|
|
82
|
+
vatExc: '.excluding-vat-inherit',
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
badgeColorMap: {
|
|
86
|
+
blue: '#019ee3',
|
|
87
|
+
gray: '#3e3e3e',
|
|
88
|
+
green: '#9acd32',
|
|
89
|
+
red: '#cf000f',
|
|
90
|
+
yellow: '#f7ca18',
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
getBadgeColor(color) {
|
|
94
|
+
if (!color) {
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return Wick.BloomreachWidget.badgeColorMap[color] || color;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
getBadge(product) {
|
|
102
|
+
if (!product) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const promotion = product.potentialPromotions && product.potentialPromotions[0];
|
|
107
|
+
const promotionAttributes = promotion && promotion.customAttributes;
|
|
108
|
+
|
|
109
|
+
if (promotionAttributes && promotionAttributes.overlayText) {
|
|
110
|
+
return {
|
|
111
|
+
text: promotionAttributes.overlayText,
|
|
112
|
+
textColor: Wick.BloomreachWidget.getBadgeColor(
|
|
113
|
+
promotionAttributes.overlayTextColor
|
|
114
|
+
),
|
|
115
|
+
color: Wick.BloomreachWidget.getBadgeColor(
|
|
116
|
+
promotionAttributes.overlayBackgroundColor
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (product.badge && product.badge.text) {
|
|
122
|
+
return {
|
|
123
|
+
...product.badge,
|
|
124
|
+
textColor: Wick.BloomreachWidget.getBadgeColor(product.badge.textColor),
|
|
125
|
+
color: Wick.BloomreachWidget.getBadgeColor(product.badge.color),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return product.badge || null;
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
registerWidgets(widgetList) {
|
|
133
|
+
widgetList.forEach(function ({ type, widget }) {
|
|
134
|
+
Wick.BloomreachWidget.widgets[type] = widget;
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
getWidget(type) {
|
|
139
|
+
return Wick.BloomreachWidget.widgets[type];
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
init(type, payloadData, options = {}) {
|
|
143
|
+
const widget = Wick.BloomreachWidget.getWidget(type);
|
|
144
|
+
|
|
145
|
+
if (!widget || typeof widget.init !== 'function') {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
widget.init(payloadData, options, Wick.BloomreachWidget);
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
normalizePayload(payloadData) {
|
|
153
|
+
if (Array.isArray(payloadData)) {
|
|
154
|
+
return payloadData;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (payloadData && Array.isArray(payloadData.recommendedProducts)) {
|
|
158
|
+
return payloadData.recommendedProducts;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return [];
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
hasRecommendations(payloadData) {
|
|
165
|
+
return Wick.BloomreachWidget.normalizePayload(payloadData).length > 0;
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
removeBlankTargets($root) {
|
|
169
|
+
if (!isApp()) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
$root.find('a[target="_blank"]').removeAttr('target');
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
getDisplayPrice(product) {
|
|
177
|
+
return product.displayPrice || product.price || {};
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
getDisplayPriceExcVat(product) {
|
|
181
|
+
return product.displayPriceExclusiveVat || product.priceExclusiveVat || null;
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
getExcVatFormattedValue(product, displayPrice) {
|
|
185
|
+
const excVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
186
|
+
|
|
187
|
+
if (excVat && excVat.formattedValue) {
|
|
188
|
+
return excVat.formattedValue;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!displayPrice || typeof displayPrice.value !== 'number') {
|
|
192
|
+
return displayPrice ? displayPrice.formattedValue || '' : '';
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const vatRate = displayPrice.vatRatePercentage || 20;
|
|
196
|
+
|
|
197
|
+
return Wick.BloomreachWidget.formatPrice(displayPrice.value / (1 + vatRate / 100));
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
getPriceValue(price) {
|
|
201
|
+
return price && typeof price.value === 'number' ? price.value : 0;
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
getPriceFormattedValue(price) {
|
|
205
|
+
if (!price) {
|
|
206
|
+
return '';
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (price.formattedValue) {
|
|
210
|
+
return price.formattedValue;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (typeof price.value === 'number') {
|
|
214
|
+
return Wick.BloomreachWidget.formatPrice(price.value);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return '';
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
getWasPrice(product) {
|
|
221
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
222
|
+
|
|
223
|
+
return displayPrice && displayPrice.wasPrice ? displayPrice.wasPrice : null;
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
getWasPriceFormatted(product) {
|
|
227
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
228
|
+
const wasPrice = Wick.BloomreachWidget.getWasPrice(product);
|
|
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 '';
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
getExcVatWasPrice(product) {
|
|
246
|
+
const priceExclusiveVat = product.priceExclusiveVat || null;
|
|
247
|
+
const displayPriceExclusiveVat = product.displayPriceExclusiveVat || null;
|
|
248
|
+
const wasPrice =
|
|
249
|
+
(displayPriceExclusiveVat && displayPriceExclusiveVat.wasPrice) ||
|
|
250
|
+
(priceExclusiveVat && priceExclusiveVat.wasPrice);
|
|
251
|
+
|
|
252
|
+
if (wasPrice && wasPrice.formattedValue) {
|
|
253
|
+
return wasPrice.formattedValue;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (typeof wasPrice === 'number') {
|
|
257
|
+
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return wasPrice || '';
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
getProductImage(product, fallbackProduct) {
|
|
264
|
+
const productImages = product.images || [];
|
|
265
|
+
const fallbackImages = fallbackProduct ? fallbackProduct.images || [] : [];
|
|
266
|
+
const images = productImages.length ? productImages : fallbackImages;
|
|
267
|
+
|
|
268
|
+
return (
|
|
269
|
+
images.find(function (item) {
|
|
270
|
+
return item.format === 'product';
|
|
271
|
+
}) ||
|
|
272
|
+
images.find(function (item) {
|
|
273
|
+
return item.imageType === 'PRIMARY';
|
|
274
|
+
}) ||
|
|
275
|
+
images[0] ||
|
|
276
|
+
{}
|
|
277
|
+
);
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
getProductRenderData(product, options = {}) {
|
|
281
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
282
|
+
const displayPriceExcVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
283
|
+
const wasPriceFormatted = Wick.BloomreachWidget.getWasPriceFormatted(product);
|
|
284
|
+
const isSwitchVat = !!(window.ACC && window.ACC.app && window.ACC.app.isVatToggleAvailable);
|
|
285
|
+
const excVatFormattedValue = options.fallbackExcVat
|
|
286
|
+
? Wick.BloomreachWidget.getExcVatFormattedValue(product, displayPrice)
|
|
287
|
+
: Wick.BloomreachWidget.getPriceFormattedValue(displayPriceExcVat);
|
|
288
|
+
|
|
289
|
+
return {
|
|
290
|
+
...product,
|
|
291
|
+
badge: Wick.BloomreachWidget.getBadge(product),
|
|
292
|
+
price: displayPrice,
|
|
293
|
+
image:
|
|
294
|
+
options.image ||
|
|
295
|
+
Wick.BloomreachWidget.getProductImage(product, options.fallbackProduct),
|
|
296
|
+
wasPriceFormatted,
|
|
297
|
+
'switch-vat': isSwitchVat,
|
|
298
|
+
incVatFormattedValue: Wick.BloomreachWidget.getPriceFormattedValue(displayPrice),
|
|
299
|
+
incVatValue: Wick.BloomreachWidget.getPriceValue(displayPrice),
|
|
300
|
+
excVatFormattedValue,
|
|
301
|
+
excVatValue: Wick.BloomreachWidget.getPriceValue(displayPriceExcVat),
|
|
302
|
+
incVatWasPriceFormatted: wasPriceFormatted,
|
|
303
|
+
excVatWasPriceFormatted: Wick.BloomreachWidget.getExcVatWasPrice(product),
|
|
304
|
+
};
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
drawRating($root) {
|
|
308
|
+
const { ratingOverlay, starOverlay } = Wick.BloomreachWidget.el;
|
|
309
|
+
|
|
310
|
+
$root.find(ratingOverlay).each(function () {
|
|
311
|
+
let rating = parseFloat($(this).attr('data-rating')) || 0;
|
|
312
|
+
const $stars = $(this).children(starOverlay);
|
|
313
|
+
|
|
314
|
+
$stars.each(function () {
|
|
315
|
+
const $star = $(this);
|
|
316
|
+
|
|
317
|
+
if (rating >= 1) {
|
|
318
|
+
rating--;
|
|
319
|
+
} else if (rating > 0) {
|
|
320
|
+
const width = Math.asin(2 * rating - 1) / Math.PI + 0.5;
|
|
321
|
+
$star.css('width', width + 'rem');
|
|
322
|
+
rating = 0;
|
|
323
|
+
} else {
|
|
324
|
+
$star.css('width', '0rem');
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
dispatchWidgetEvent(eventName, payload) {
|
|
331
|
+
return new Promise(function (resolve, reject) {
|
|
332
|
+
const eventDetail = { resolve, reject };
|
|
333
|
+
const event = createEvent(eventName, payload, eventDetail);
|
|
334
|
+
|
|
335
|
+
window.dispatchEvent(event);
|
|
336
|
+
});
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
reapplyVatDisplay() {
|
|
340
|
+
if (!Wick.VatToggle || typeof Wick.VatToggle.isActive !== 'function') {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const { vatInc, vatExc } = Wick.BloomreachWidget.el;
|
|
345
|
+
const hiddenClassName = Wick.VatToggle.HIDDEN_CLASS_NAME || 'd-none';
|
|
346
|
+
const isExcVatActive = Wick.VatToggle.isActive();
|
|
347
|
+
|
|
348
|
+
$(vatInc).toggleClass(hiddenClassName, isExcVatActive);
|
|
349
|
+
$(vatExc).toggleClass(hiddenClassName, !isExcVatActive);
|
|
350
|
+
},
|
|
351
|
+
|
|
352
|
+
bindVatToggle(namespace) {
|
|
353
|
+
if (!Wick.VatToggle || !Wick.VatToggle.TOGGLE_VAT_EVENT_NAME) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const eventName = `${Wick.VatToggle.TOGGLE_VAT_EVENT_NAME}.${namespace}`;
|
|
358
|
+
|
|
359
|
+
$(window).off(eventName).on(eventName, Wick.BloomreachWidget.reapplyVatDisplay);
|
|
360
|
+
},
|
|
361
|
+
|
|
362
|
+
formatPrice(value) {
|
|
363
|
+
return new Intl.NumberFormat('en-GB', {
|
|
364
|
+
style: 'currency',
|
|
365
|
+
currency: 'GBP',
|
|
366
|
+
minimumFractionDigits: 2,
|
|
367
|
+
maximumFractionDigits: 2,
|
|
368
|
+
}).format(value);
|
|
369
|
+
},
|
|
370
|
+
};
|
|
@@ -15,22 +15,24 @@ function disconnectViewObserver(state) {
|
|
|
15
15
|
state.viewObserver = null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function observeView(state,
|
|
19
|
-
if (!window.IntersectionObserver) {
|
|
18
|
+
function observeView(state, target) {
|
|
19
|
+
if (!target || !window.IntersectionObserver) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
elements = Array.isArray(
|
|
23
|
+
const elements = Array.isArray(target) ? target : [target];
|
|
24
24
|
|
|
25
25
|
state.viewObserver = new IntersectionObserver(function (entries) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
) {
|
|
31
|
-
|
|
32
|
-
disconnectViewObserver(state);
|
|
26
|
+
const isVisible = entries.some(function (entry) {
|
|
27
|
+
return entry.isIntersecting;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (!isVisible) {
|
|
31
|
+
return;
|
|
33
32
|
}
|
|
33
|
+
|
|
34
|
+
pushDataLayerEvent(EVENT_NAMES.view, state.widgetData);
|
|
35
|
+
disconnectViewObserver(state);
|
|
34
36
|
});
|
|
35
37
|
|
|
36
38
|
elements.forEach(function (element) {
|
|
@@ -56,13 +58,14 @@ function trackAddToCart(state, items) {
|
|
|
56
58
|
|
|
57
59
|
export function createBloomreachWidgetTracking() {
|
|
58
60
|
const state = {
|
|
59
|
-
|
|
61
|
+
widgetData: null,
|
|
60
62
|
viewObserver: null,
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
return {
|
|
64
66
|
setPayload(payloadData) {
|
|
65
67
|
disconnectViewObserver(state);
|
|
68
|
+
|
|
66
69
|
const metadata = payloadData.widgetMetadata;
|
|
67
70
|
|
|
68
71
|
state.widgetData = {
|
|
@@ -72,8 +75,8 @@ export function createBloomreachWidgetTracking() {
|
|
|
72
75
|
};
|
|
73
76
|
},
|
|
74
77
|
|
|
75
|
-
observeView(
|
|
76
|
-
observeView(state,
|
|
78
|
+
observeView(target) {
|
|
79
|
+
observeView(state, target);
|
|
77
80
|
},
|
|
78
81
|
|
|
79
82
|
trackClick(itemId) {
|
|
@@ -1,250 +1,21 @@
|
|
|
1
1
|
var Wick = window.Wick || {};
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import CompleteYourProjectWidget from './complete-your-project-widget';
|
|
3
|
+
import './bloomreach-widget-core';
|
|
4
|
+
import Widget from './complete-your-project/widget';
|
|
6
5
|
import WhyNotAddWidget from './why-not-add-widget';
|
|
7
|
-
|
|
8
|
-
Wick.BloomreachWidget = {
|
|
9
|
-
widgets: {},
|
|
10
|
-
|
|
11
|
-
el: {
|
|
12
|
-
loadingButtonText: '.loading-button__text',
|
|
13
|
-
loadingButtonLoader: '.loading-button__loader',
|
|
14
|
-
ratingOverlay: '.rating-overlay',
|
|
15
|
-
starOverlay: '.star-overlay',
|
|
16
|
-
vatInc: '.including-vat-inherit',
|
|
17
|
-
vatExc: '.excluding-vat-inherit',
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
registerWidgets(widgetList) {
|
|
21
|
-
widgetList.forEach(function ({ type, widget }) {
|
|
22
|
-
Wick.BloomreachWidget.widgets[type] = widget;
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
getWidget(type) {
|
|
27
|
-
return Wick.BloomreachWidget.widgets[type];
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
init(type, payloadData) {
|
|
31
|
-
const widget = Wick.BloomreachWidget.getWidget(type);
|
|
32
|
-
|
|
33
|
-
if (!widget || typeof widget.init !== 'function') {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
widget.init(payloadData, Wick.BloomreachWidget);
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
normalizePayload(payloadData) {
|
|
41
|
-
if (Array.isArray(payloadData)) {
|
|
42
|
-
return payloadData;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (payloadData && Array.isArray(payloadData.recommendedProducts)) {
|
|
46
|
-
return payloadData.recommendedProducts;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return [];
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
hasRecommendations(payloadData) {
|
|
53
|
-
return Wick.BloomreachWidget.normalizePayload(payloadData).length > 0;
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
getDisplayPrice(product) {
|
|
57
|
-
return product.displayPrice || product.price || {};
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
getDisplayPriceExcVat(product) {
|
|
61
|
-
return product.displayPriceExclusiveVat || product.priceExclusiveVat || null;
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
getPriceValue(price) {
|
|
65
|
-
return price && typeof price.value === 'number' ? price.value : 0;
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
getPriceFormattedValue(price) {
|
|
69
|
-
if (!price) {
|
|
70
|
-
return '';
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (price.formattedValue) {
|
|
74
|
-
return price.formattedValue;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (typeof price.value === 'number') {
|
|
78
|
-
return Wick.BloomreachWidget.formatPrice(price.value);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return '';
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
removeBlankTargets($root) {
|
|
85
|
-
if (!isApp()) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
$root.find('a[target="_blank"]').removeAttr('target');
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
getWasPrice(product) {
|
|
93
|
-
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
94
|
-
|
|
95
|
-
return displayPrice && displayPrice.wasPrice ? displayPrice.wasPrice : null;
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
getWasPriceFormatted(product) {
|
|
99
|
-
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
100
|
-
const wasPrice = Wick.BloomreachWidget.getWasPrice(product);
|
|
101
|
-
|
|
102
|
-
if (wasPrice && wasPrice.formattedValue) {
|
|
103
|
-
return wasPrice.formattedValue;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (typeof wasPrice === 'number') {
|
|
107
|
-
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (wasPrice) {
|
|
111
|
-
return `${displayPrice.currencySymbol || '£'}${wasPrice}`;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return '';
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
getExcVatWasPrice(product) {
|
|
118
|
-
const priceExclusiveVat = product.priceExclusiveVat || null;
|
|
119
|
-
const displayPriceExclusiveVat = product.displayPriceExclusiveVat || null;
|
|
120
|
-
const wasPrice =
|
|
121
|
-
(displayPriceExclusiveVat && displayPriceExclusiveVat.wasPrice) ||
|
|
122
|
-
(priceExclusiveVat && priceExclusiveVat.wasPrice);
|
|
123
|
-
|
|
124
|
-
if (wasPrice && wasPrice.formattedValue) {
|
|
125
|
-
return wasPrice.formattedValue;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (typeof wasPrice === 'number') {
|
|
129
|
-
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return wasPrice || '';
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
getProductImage(product, fallbackProduct) {
|
|
136
|
-
const productImages = product.images || [];
|
|
137
|
-
const fallbackImages = fallbackProduct ? fallbackProduct.images || [] : [];
|
|
138
|
-
const images = productImages.length ? productImages : fallbackImages;
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
images.find(function (item) {
|
|
142
|
-
return item.format === 'product';
|
|
143
|
-
}) ||
|
|
144
|
-
images.find(function (item) {
|
|
145
|
-
return item.imageType === 'PRIMARY';
|
|
146
|
-
}) ||
|
|
147
|
-
images[0] ||
|
|
148
|
-
{}
|
|
149
|
-
);
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
getProductRenderData(product, options = {}) {
|
|
153
|
-
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
154
|
-
const displayPriceExcVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
155
|
-
const wasPriceFormatted = Wick.BloomreachWidget.getWasPriceFormatted(product);
|
|
156
|
-
const excVatWasPriceFormatted = Wick.BloomreachWidget.getExcVatWasPrice(product);
|
|
157
|
-
const isSwitchVat = !!(window.ACC && window.ACC.app && window.ACC.app.isVatToggleAvailable);
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
...product,
|
|
161
|
-
price: displayPrice,
|
|
162
|
-
image:
|
|
163
|
-
options.image ||
|
|
164
|
-
Wick.BloomreachWidget.getProductImage(product, options.fallbackProduct),
|
|
165
|
-
wasPriceFormatted,
|
|
166
|
-
'switch-vat': isSwitchVat,
|
|
167
|
-
incVatFormattedValue: Wick.BloomreachWidget.getPriceFormattedValue(displayPrice),
|
|
168
|
-
incVatValue: Wick.BloomreachWidget.getPriceValue(displayPrice),
|
|
169
|
-
excVatFormattedValue: Wick.BloomreachWidget.getPriceFormattedValue(displayPriceExcVat),
|
|
170
|
-
excVatValue: Wick.BloomreachWidget.getPriceValue(displayPriceExcVat),
|
|
171
|
-
incVatWasPriceFormatted: wasPriceFormatted,
|
|
172
|
-
excVatWasPriceFormatted: Wick.BloomreachWidget.getExcVatWasPrice(product),
|
|
173
|
-
};
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
drawRating($root) {
|
|
177
|
-
const { ratingOverlay, starOverlay } = Wick.BloomreachWidget.el;
|
|
178
|
-
|
|
179
|
-
$root.find(ratingOverlay).each(function () {
|
|
180
|
-
let rating = parseFloat($(this).attr('data-rating')) || 0;
|
|
181
|
-
const $stars = $(this).children(starOverlay);
|
|
182
|
-
|
|
183
|
-
$stars.each(function () {
|
|
184
|
-
const $star = $(this);
|
|
185
|
-
|
|
186
|
-
if (rating >= 1) {
|
|
187
|
-
rating--;
|
|
188
|
-
} else if (rating > 0) {
|
|
189
|
-
const width = Math.asin(2 * rating - 1) / Math.PI + 0.5;
|
|
190
|
-
$star.css('width', width + 'rem');
|
|
191
|
-
rating = 0;
|
|
192
|
-
} else {
|
|
193
|
-
$star.css('width', '0rem');
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
dispatchWidgetEvent(eventName, payload) {
|
|
200
|
-
return new Promise(function (resolve, reject) {
|
|
201
|
-
const eventDetail = { resolve, reject };
|
|
202
|
-
const event = createEvent(eventName, payload, eventDetail);
|
|
203
|
-
|
|
204
|
-
window.dispatchEvent(event);
|
|
205
|
-
});
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
reapplyVatDisplay() {
|
|
209
|
-
if (!Wick.VatToggle || typeof Wick.VatToggle.isActive !== 'function') {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const { vatInc, vatExc } = Wick.BloomreachWidget.el;
|
|
214
|
-
const hiddenClassName = Wick.VatToggle.HIDDEN_CLASS_NAME || 'd-none';
|
|
215
|
-
const isExcVatActive = Wick.VatToggle.isActive();
|
|
216
|
-
|
|
217
|
-
$(vatInc).toggleClass(hiddenClassName, isExcVatActive);
|
|
218
|
-
$(vatExc).toggleClass(hiddenClassName, !isExcVatActive);
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
bindVatToggle(namespace) {
|
|
222
|
-
if (!Wick.VatToggle || !Wick.VatToggle.TOGGLE_VAT_EVENT_NAME) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const eventName = `${Wick.VatToggle.TOGGLE_VAT_EVENT_NAME}.${namespace}`;
|
|
227
|
-
|
|
228
|
-
$(window).off(eventName).on(eventName, Wick.BloomreachWidget.reapplyVatDisplay);
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
formatPrice(value) {
|
|
232
|
-
return new Intl.NumberFormat('en-GB', {
|
|
233
|
-
style: 'currency',
|
|
234
|
-
currency: 'GBP',
|
|
235
|
-
minimumFractionDigits: 2,
|
|
236
|
-
maximumFractionDigits: 2,
|
|
237
|
-
}).format(value);
|
|
238
|
-
},
|
|
239
|
-
};
|
|
6
|
+
import DontForgetWidget from './dont-forget-widget';
|
|
240
7
|
|
|
241
8
|
Wick.BloomreachWidget.registerWidgets([
|
|
242
9
|
{
|
|
243
10
|
type: 'completeYourProject',
|
|
244
|
-
widget:
|
|
11
|
+
widget: Widget,
|
|
245
12
|
},
|
|
246
13
|
{
|
|
247
14
|
type: 'whyNotAdd',
|
|
248
15
|
widget: WhyNotAddWidget,
|
|
249
16
|
},
|
|
17
|
+
{
|
|
18
|
+
type: 'dontForget',
|
|
19
|
+
widget: DontForgetWidget,
|
|
20
|
+
},
|
|
250
21
|
]);
|