wickes-css2 2.111.0-develop.2 → 2.111.0-why-not-add.2
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/global-search.css +1 -1
- package/build/css/homepage-main.css +1 -1
- package/build/css/kitchen-plp-main.css +1 -1
- package/build/css/main.css +1 -1
- package/build/css/my-account-main-v2.css +1 -1
- package/build/css/my-account-main.css +1 -1
- package/build/css/pages/page_personal-details.css +1 -1
- package/build/css/pages/page_product-details-v2.css +1 -1
- package/build/css/pdp-main-before-combine.css +1 -1
- package/build/css/pdp-main-critical.css +1 -1
- package/build/css/pdp-main-non-critical.css +1 -1
- package/build/css/pdp-main.css +1 -1
- package/build/css/plp-main.css +1 -1
- package/build/css/store-locator-main.css +1 -1
- package/build/js/account-hub.min.js +1 -1
- package/build/js/basket.min.js +2 -2
- package/build/js/bloomreach-widget.min.js +1 -0
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +2 -2
- package/build/js/emulation.min.js +3001 -280
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/gift-cards.min.js +1 -1
- package/build/js/merged-checkout.min.js +2 -2
- package/build/js/mini-basket-slider.min.js +1 -1
- package/build/js/page/basket-v2.js +18 -11
- package/build/js/page/bloomreach-widget.js +1187 -0
- package/build/js/page/components/discounts.js +8 -15
- package/build/js/page/components/mini-basket-slider.js +24 -18
- package/build/js/page/components/voucher.js +2 -56
- package/build/js/page/utils/create-count-stepper.js +30 -9
- package/build/js/page/utils/create-loading-button.js +37 -0
- package/build/js/page/utils/create-toast.js +79 -0
- package/build/js/page/utils/custom-dropdown.js +80 -0
- package/build/js/pdp-count-stepper.min.js +1 -1
- package/build/js/pdp.bundle.min.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/project-list.min.js +1 -1
- package/build/js/saving-shopping-list.min.js +1 -1
- package/package.json +1 -1
- package/src/components/base/button.hbs +23 -5
- package/src/components/bloomreach/complete-card-dropdown.hbs +47 -0
- package/src/components/bloomreach/complete-card-skeleton.hbs +19 -0
- package/src/components/bloomreach/complete-card.hbs +138 -0
- package/src/components/bloomreach/complete-divider.hbs +3 -0
- package/src/components/bloomreach/complete-summary-skeleton.hbs +12 -0
- package/src/components/bloomreach/complete-summary.hbs +43 -0
- package/src/components/bloomreach/complete-wrapper.hbs +1 -0
- package/src/components/bloomreach/complete-your-project.hbs +21 -0
- package/src/components/cart-voucher.hbs +4 -4
- package/src/components/gift-cards.hbs +1 -1
- package/src/components/mini-basket/mini-basket-order-item.hbs +4 -4
- package/src/components/wismo-payment.hbs +7 -50
- package/src/data/data_delivery-address-v2.json +6 -6
- package/src/data/data_discounts.json +6 -6
- package/src/data/data_shopping-cart-v2.json +11 -32
- package/src/data/data_shopping-cart-with-energy.json +12 -12
- package/src/data/data_wismo.json +1 -2
- package/src/elements/checkbox.hbs +8 -1
- package/src/js/components/general/cart-slider.js +19 -6
- package/src/js/components/general/switchVat.js +7 -9
- package/src/js/emulation/basket-data.js +1 -11
- package/src/js/emulation/bloomreach-widget-calculations.js +132 -0
- package/src/js/emulation/bloomreach-widget-loading.js +11 -0
- package/src/js/emulation/checkout-data.js +0 -3
- package/src/js/emulation/mini-basket-data.js +0 -68
- package/src/js/emulation/mock.js +3098 -1
- package/src/js/emulation/notify-me.js +1 -1
- package/src/js/page/basket-v2.js +18 -11
- package/src/js/page/bloomreach-widget.js +1187 -0
- package/src/js/page/components/discounts.js +8 -15
- package/src/js/page/components/mini-basket-slider.js +24 -18
- package/src/js/page/components/voucher.js +2 -56
- package/src/js/page/utils/create-count-stepper.js +30 -9
- package/src/js/page/utils/create-loading-button.js +37 -0
- package/src/js/page/utils/create-toast.js +79 -0
- package/src/js/page/utils/custom-dropdown.js +80 -0
- package/src/layouts/checkout.hbs +0 -1
- package/src/page_basket-energy-efficiency.html +0 -4
- package/src/page_checkout_confirmation-new-marketing-consent-error.html +0 -7
- package/src/page_checkout_confirmation-new-marketing-consent.html +0 -4
- package/src/page_checkout_delivery-address-v2.html +0 -4
- package/src/page_checkout_delivery-details-v2-asm.html +1 -7
- package/src/page_checkout_delivery-details-v2-calendar-message.html +0 -4
- package/src/page_checkout_delivery-details-v2-oos.html +0 -4
- package/src/page_checkout_delivery-details-v2-wisdom-not-available.html +0 -4
- package/src/page_checkout_delivery-details-v2-wisdom.html +0 -4
- package/src/page_checkout_delivery-details-with-loader-v2.html +0 -4
- package/src/page_checkout_delivery-details_guest-new.html +0 -4
- package/src/page_checkout_delivery_address-asm-new.html +0 -4
- package/src/page_checkout_merge-basket-v2.html +3 -6
- package/src/page_checkout_merge-basket-vat-v2.html +1 -6
- package/src/page_checkout_merge-basket-with-energy.html +0 -4
- package/src/page_checkout_next-day-delivery-details.html +0 -4
- package/src/page_checkout_payment-details-v2-asm.html +0 -4
- package/src/page_checkout_payment-details-v2.html +0 -4
- package/src/page_checkout_payment-details_guest-click-collect-icon.html +0 -4
- package/src/page_checkout_payment-details_guest-with-checkout-journey.html +0 -7
- package/src/page_checkout_payment-details_login-with-checkout-journey.html +0 -7
- package/src/page_checkout_payment-details_with-card-loader.html +0 -4
- package/src/page_checkout_payment-details_with-loader-v2.html +0 -4
- package/src/page_checkout_rapid-delivery-details.html +0 -4
- package/src/page_empty-basket-instore.html +0 -4
- package/src/page_homepage-with-global-search-v2-vat.html +0 -1
- package/src/page_instore_progress_bar.html +0 -4
- package/src/page_product-details-banner.html +0 -1
- package/src/page_product-details-big-wins-disabled-delivery.html +0 -1
- package/src/page_product-details-big-wins-non-registered.html +0 -1
- package/src/page_product-details-big-wins-out-nearest.html +0 -1
- package/src/page_product-details-big-wins-unhappy.html +0 -1
- package/src/page_product-details-big-wins.html +0 -1
- package/src/page_product-details-billie.html +0 -1
- package/src/page_product-details-bloomreach.html +130 -0
- package/src/page_product-details-calculator.html +0 -1
- package/src/page_product-details-cashback-v2.html +0 -1
- package/src/page_product-details-clearpay.html +0 -1
- package/src/page_product-details-cnc-error-notification.html +0 -1
- package/src/page_product-details-cnc-success-notification-vat.html +0 -1
- package/src/page_product-details-cnc-success-notification.html +0 -1
- package/src/page_product-details-default-store.html +0 -1
- package/src/page_product-details-energy-efficiency.html +0 -1
- package/src/page_product-details-flooring-with-pr-placeholder.html +0 -1
- package/src/page_product-details-flooring.html +0 -1
- package/src/page_product-details-gallery-actual.html +0 -1
- package/src/page_product-details-mfe-calculator.html +0 -1
- package/src/page_product-details-minimum-v2.html +0 -1
- package/src/page_product-details-mtm-doors.html +0 -1
- package/src/page_product-details-only-clearpay.html +0 -1
- package/src/page_product-details-paint-mixing.html +0 -1
- package/src/page_product-details-saved-pl.html +0 -1
- package/src/page_product-details-tile-steps-klarna-widget-with-method-ids.html +0 -1
- package/src/page_product-details-tile-steps-logout.html +0 -1
- package/src/page_product-details-tile-steps-no-new-project-list.html +0 -1
- package/src/page_product-details-tile-steps-with-klarna.html +0 -1
- package/src/page_product-details-tile-steps.html +0 -1
- package/src/page_product-details-v2.html +0 -1
- package/src/page_product-details-vat.html +0 -1
- package/src/page_product-details-wisdom-mcfc-registered.html +0 -1
- package/src/page_product-details-wisdom-mcfc.html +0 -1
- package/src/page_product-details-wisdom-oos-registered.html +0 -1
- package/src/page_product-details-wisdom-oos.html +0 -1
- package/src/page_product-details-wisdom-registered.html +0 -1
- package/src/page_product-details-wisdom.html +0 -1
- package/src/page_product-details-with-favourite.html +0 -1
- package/src/page_product-details-with-global-search-v2.html +7 -2
- package/src/page_product-details_no-previous-default.html +0 -1
- package/src/page_shopping-cart-registered-v2.html +0 -4
- package/src/page_shopping-cart-v2-vat.html +0 -6
- package/src/page_shopping-cart-v2.html +2 -5
- package/src/page_shopping-cart-v3-instore.html +0 -4
- package/src/page_track-my-order-result.html +1 -0
- package/src/partials/scripts.hbs +1 -0
- package/src/scss/common/_common.scss +1 -0
- package/src/scss/common/_elements.scss +13 -1
- package/src/scss/common/_loading-button.scss +49 -0
- package/src/scss/components/_notifications.scss +86 -5
- package/src/scss/components/bloomreach/_bloomreach.scss +3 -0
- package/src/scss/components/bloomreach/_complete-card-dropdown.scss +174 -0
- package/src/scss/components/bloomreach/_complete-card.scss +408 -0
- package/src/scss/components/bloomreach/_complete-your-project.scss +207 -0
- package/src/scss/components/global-search.scss +0 -11
- package/src/scss/globals/_global-components.scss +0 -1
- package/src/scss/helpers/_variables.scss +1 -0
- package/src/scss/main.scss +0 -2
- package/src/scss/pages/page_product-details-v2.scss +45 -2
- package/src/scss/pdp-main-critical.scss +0 -1
- package/src/scss/pdp-main.scss +1 -1
- package/src/sitemap.html +6 -0
- package/src/components/checkout-voucher-remove-modal.hbs +0 -16
- package/src/components/tradepro-discount-banner.hbs +0 -8
- package/src/js/components/general/tradepro-discount-banner.js +0 -69
- package/src/js/emulation/tradepro-discount-banner-emulation.js +0 -13
- package/src/scss/components/_checkout-voucher-remove-modal.scss +0 -108
- package/src/scss/components/_pdp-action-v2-critical.scss +0 -27
- package/src/scss/components/_pdp-action-v2.scss +0 -27
- package/src/scss/components/_tradepro-discount-banner.scss +0 -78
|
@@ -0,0 +1,1187 @@
|
|
|
1
|
+
var Wick = window.Wick || {};
|
|
2
|
+
|
|
3
|
+
import { createCountStepper } from './utils/create-count-stepper';
|
|
4
|
+
import { createEvent } from './utils/create-event';
|
|
5
|
+
import { createDropdown } from './utils/custom-dropdown';
|
|
6
|
+
import { createLoadingButton } from './utils/create-loading-button';
|
|
7
|
+
import { createToast } from './utils/create-toast';
|
|
8
|
+
|
|
9
|
+
const Handlebars = require('hbsfy/runtime');
|
|
10
|
+
|
|
11
|
+
Handlebars.registerPartial('checkbox', require('../../elements/checkbox.hbs'));
|
|
12
|
+
Handlebars.registerPartial('loader', require('../../elements/loader.hbs'));
|
|
13
|
+
Handlebars.registerPartial('button', require('../../components/base/button.hbs'));
|
|
14
|
+
Handlebars.registerPartial(
|
|
15
|
+
'bloomreach/complete-card-dropdown',
|
|
16
|
+
require('../../components/bloomreach/complete-card-dropdown.hbs')
|
|
17
|
+
);
|
|
18
|
+
Handlebars.registerPartial('notifications', require('../../elements/notifications.hbs'));
|
|
19
|
+
|
|
20
|
+
const notificationTemplate = require('../../elements/notifications.hbs');
|
|
21
|
+
const completeWrapperTemplate = require('../../components/bloomreach/complete-wrapper.hbs');
|
|
22
|
+
const completeDividerTemplate = require('../../components/bloomreach/complete-divider.hbs');
|
|
23
|
+
const completeCardTemplate = require('../../components/bloomreach/complete-card.hbs');
|
|
24
|
+
const completeSummaryTemplate = require('../../components/bloomreach/complete-summary.hbs');
|
|
25
|
+
|
|
26
|
+
Wick.BloomreachWidget = {
|
|
27
|
+
CALCULATE_PRODUCT_BUNDLE_TOTAL_EVENT: 'calculateProductBundleTotal',
|
|
28
|
+
ADD_PRODUCT_BUNDLE_TO_CART_EVENT: 'bulkAddToCart',
|
|
29
|
+
|
|
30
|
+
steppers: [],
|
|
31
|
+
recommendations: [],
|
|
32
|
+
dropdown: null,
|
|
33
|
+
loadingButton: null,
|
|
34
|
+
lastCalculationResponse: null,
|
|
35
|
+
dropdownCurrent: {},
|
|
36
|
+
toast: null,
|
|
37
|
+
|
|
38
|
+
el: {
|
|
39
|
+
cardCheckbox: '.complete-card__select input[type="checkbox"]',
|
|
40
|
+
completeCard: '.complete-card',
|
|
41
|
+
completeWidget: '.complete-widget',
|
|
42
|
+
countBtn: '.count-btn',
|
|
43
|
+
countStepperInitializedData: 'count-stepper-initialized',
|
|
44
|
+
countStepperRoot: '.count-stepper',
|
|
45
|
+
ctaButton: '.complete-widget__cta .btn',
|
|
46
|
+
ctaButtonText: '.loading-button__text',
|
|
47
|
+
ctaButtonLoader: '.loading-button__loader',
|
|
48
|
+
summaryPriceValue: '.complete-widget__price-value',
|
|
49
|
+
summarySalePrice: '.complete-widget__sale-price',
|
|
50
|
+
summaryPriceInc: '.including-vat-inherit',
|
|
51
|
+
summaryPriceExc: '.excluding-vat-inherit',
|
|
52
|
+
summarySalePriceInc: '.including-vat-inherit',
|
|
53
|
+
summarySalePriceExc: '.excluding-vat-inherit',
|
|
54
|
+
|
|
55
|
+
dropdownErrorClass: 'complete-card-dropdown--error',
|
|
56
|
+
dropdownOpenClass: 'complete-card-dropdown--open',
|
|
57
|
+
dropdownOption: '[data-complete-card-dropdown-option]',
|
|
58
|
+
dropdownOptionSelectedClass: 'complete-card-dropdown__option--selected',
|
|
59
|
+
dropdownRoot: '[data-complete-card-dropdown]',
|
|
60
|
+
dropdownToggle: '[data-complete-card-dropdown-toggle]',
|
|
61
|
+
dropdownValue: '[data-complete-card-dropdown-value]',
|
|
62
|
+
|
|
63
|
+
optionsEl: '.complete-card__options',
|
|
64
|
+
previousQuantityData: 'previous-quantity',
|
|
65
|
+
quantityInput: '.tbx_quantity',
|
|
66
|
+
quantityReadyData: 'quantity-ready',
|
|
67
|
+
|
|
68
|
+
recommendationIndexAttr: 'data-recommendation-index',
|
|
69
|
+
selectedClass: 'complete-card--selected',
|
|
70
|
+
selectedValueData: 'selected-value',
|
|
71
|
+
starOverlay: '.star-overlay',
|
|
72
|
+
|
|
73
|
+
titleEl: '.complete-card__title',
|
|
74
|
+
|
|
75
|
+
widgetContainer: '[data-complete-widget]',
|
|
76
|
+
widgetContent: '[data-complete-widget-content]',
|
|
77
|
+
widgetWrapper: '[data-complete-widget-wrapper]',
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
badgeColorMap: {
|
|
81
|
+
blue: '#019ee3',
|
|
82
|
+
gray: '#3e3e3e',
|
|
83
|
+
green: '#9acd32',
|
|
84
|
+
red: '#cf000f',
|
|
85
|
+
yellow: '#f7ca18',
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
getCtaText(selectedCount) {
|
|
89
|
+
if (!selectedCount) {
|
|
90
|
+
return 'Add product(s) to basket';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return `Add ${selectedCount} product${selectedCount > 1 ? 's' : ''} to basket`;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
setCtaText($button, text) {
|
|
97
|
+
const { ctaButtonText } = Wick.BloomreachWidget.el;
|
|
98
|
+
const $text = $button.find(ctaButtonText);
|
|
99
|
+
|
|
100
|
+
if ($text.length) {
|
|
101
|
+
$text.text(text);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
$button.text(text);
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
getBadgeColor(color) {
|
|
109
|
+
return Wick.BloomreachWidget.badgeColorMap[color] || color;
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
hasRecommendations(payloadData) {
|
|
113
|
+
if (Array.isArray(payloadData)) {
|
|
114
|
+
return payloadData.length > 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return Boolean(
|
|
118
|
+
payloadData &&
|
|
119
|
+
Array.isArray(payloadData.recommendedProducts) &&
|
|
120
|
+
payloadData.recommendedProducts.length
|
|
121
|
+
);
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
normalizePayload(payloadData) {
|
|
125
|
+
if (Array.isArray(payloadData)) {
|
|
126
|
+
return payloadData;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (payloadData && Array.isArray(payloadData.recommendedProducts)) {
|
|
130
|
+
return payloadData.recommendedProducts;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return [];
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
getDisplayPrice(product) {
|
|
137
|
+
return product.displayPrice || product.price || {};
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
dispatchWidgetEvent(eventName, payload) {
|
|
141
|
+
return new Promise(function (resolve, reject) {
|
|
142
|
+
const eventDetail = { resolve, reject };
|
|
143
|
+
const event = createEvent(eventName, payload, eventDetail);
|
|
144
|
+
|
|
145
|
+
window.dispatchEvent(event);
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
getProductImage(product, fallbackProduct) {
|
|
150
|
+
const productImages = product.images || [];
|
|
151
|
+
const fallbackImages = fallbackProduct ? fallbackProduct.images || [] : [];
|
|
152
|
+
const images = productImages.length ? productImages : fallbackImages;
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
images.find(function (item) {
|
|
156
|
+
return item.format === 'product';
|
|
157
|
+
}) ||
|
|
158
|
+
images.find(function (item) {
|
|
159
|
+
return item.imageType === 'PRIMARY';
|
|
160
|
+
}) ||
|
|
161
|
+
images[0] ||
|
|
162
|
+
{}
|
|
163
|
+
);
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
getDropdownOptions(product) {
|
|
167
|
+
if (!product.variantOptions || !product.variantOptions.length) {
|
|
168
|
+
return [];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return product.variantOptions.map(function (variantOption) {
|
|
172
|
+
const qualifiers = variantOption.variantOptionQualifiers || [];
|
|
173
|
+
|
|
174
|
+
const label = qualifiers
|
|
175
|
+
.map(function (qualifier) {
|
|
176
|
+
return qualifier.value;
|
|
177
|
+
})
|
|
178
|
+
.join(', ');
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
label,
|
|
182
|
+
value: variantOption.code,
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
getSelectedDropdownLabel(options, selectedValue) {
|
|
188
|
+
const selectedOption = options.find(function (option) {
|
|
189
|
+
return option.value === selectedValue;
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
return selectedOption ? selectedOption.label : '';
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
handleBulkAddToCartResponse(response) {
|
|
196
|
+
const bulkData = response && response.bulkAddToCartData;
|
|
197
|
+
|
|
198
|
+
if (!bulkData) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
Wick.BloomreachWidget.toast.show({
|
|
203
|
+
type: bulkData.messageType,
|
|
204
|
+
text: bulkData.messageText,
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
getBadge(product) {
|
|
209
|
+
const promotion = product.potentialPromotions && product.potentialPromotions[0];
|
|
210
|
+
const promotionAttributes = promotion && promotion.customAttributes;
|
|
211
|
+
|
|
212
|
+
if (promotionAttributes && promotionAttributes.overlayText) {
|
|
213
|
+
return {
|
|
214
|
+
text: promotionAttributes.overlayText,
|
|
215
|
+
textColor: Wick.BloomreachWidget.getBadgeColor(
|
|
216
|
+
promotionAttributes.overlayTextColor
|
|
217
|
+
),
|
|
218
|
+
color: Wick.BloomreachWidget.getBadgeColor(
|
|
219
|
+
promotionAttributes.overlayBackgroundColor
|
|
220
|
+
),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return product.badge;
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
getWasPrice(product) {
|
|
228
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
229
|
+
|
|
230
|
+
return displayPrice && displayPrice.wasPrice ? displayPrice.wasPrice : null;
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
getWasPriceFormatted(product) {
|
|
234
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
235
|
+
const wasPrice = Wick.BloomreachWidget.getWasPrice(product);
|
|
236
|
+
|
|
237
|
+
if (wasPrice && wasPrice.formattedValue) {
|
|
238
|
+
return wasPrice.formattedValue;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (typeof wasPrice === 'number') {
|
|
242
|
+
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (wasPrice) {
|
|
246
|
+
return `${displayPrice.currencySymbol || '£'}${wasPrice}`;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return '';
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
getDisplayPriceExcVat(product) {
|
|
253
|
+
return product.displayPriceExclusiveVat || product.priceExclusiveVat || null;
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
getPriceValue(price) {
|
|
257
|
+
return price && typeof price.value === 'number' ? price.value : 0;
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
getPriceFormattedValue(price) {
|
|
261
|
+
if (!price) {
|
|
262
|
+
return '';
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (price.formattedValue) {
|
|
266
|
+
return price.formattedValue;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (typeof price.value === 'number') {
|
|
270
|
+
return Wick.BloomreachWidget.formatPrice(price.value);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return '';
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
getExcVatWasPrice(product) {
|
|
277
|
+
const displayPriceExclusiveVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
278
|
+
const wasPrice = displayPriceExclusiveVat && displayPriceExclusiveVat.wasPrice;
|
|
279
|
+
|
|
280
|
+
if (wasPrice && wasPrice.formattedValue) {
|
|
281
|
+
return wasPrice.formattedValue;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (typeof wasPrice === 'number') {
|
|
285
|
+
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return wasPrice || '';
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
getExcVatFormattedValue(displayPrice, product) {
|
|
292
|
+
const excVat = product ? Wick.BloomreachWidget.getDisplayPriceExcVat(product) : null;
|
|
293
|
+
if (excVat && excVat.formattedValue) {
|
|
294
|
+
return excVat.formattedValue;
|
|
295
|
+
}
|
|
296
|
+
if (!displayPrice || typeof displayPrice.value !== 'number') {
|
|
297
|
+
return displayPrice ? displayPrice.formattedValue || '' : '';
|
|
298
|
+
}
|
|
299
|
+
const vatRate = displayPrice.vatRatePercentage || 20;
|
|
300
|
+
return Wick.BloomreachWidget.formatPrice(displayPrice.value / (1 + vatRate / 100));
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
getProductRenderData(product, index, options = {}) {
|
|
304
|
+
const shouldShowDropdown = index !== 0;
|
|
305
|
+
const dropdownOptions = shouldShowDropdown
|
|
306
|
+
? Wick.BloomreachWidget.getDropdownOptions(product)
|
|
307
|
+
: [];
|
|
308
|
+
const selectedDropdownValue = options.selectedDropdownValue || '';
|
|
309
|
+
const selectedDropdownLabel = Wick.BloomreachWidget.getSelectedDropdownLabel(
|
|
310
|
+
dropdownOptions,
|
|
311
|
+
selectedDropdownValue
|
|
312
|
+
);
|
|
313
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
314
|
+
const showFromPrice = Boolean(
|
|
315
|
+
index !== 0 &&
|
|
316
|
+
!selectedDropdownValue &&
|
|
317
|
+
displayPrice &&
|
|
318
|
+
displayPrice.priceType === 'FROM'
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
const wasPriceFormatted = Wick.BloomreachWidget.getWasPriceFormatted(product);
|
|
322
|
+
const excVatFormattedValue = Wick.BloomreachWidget.getExcVatFormattedValue(
|
|
323
|
+
displayPrice,
|
|
324
|
+
product
|
|
325
|
+
);
|
|
326
|
+
const isSwitchVat = !!(window.ACC && window.ACC.app && window.ACC.app.isVatToggleAvailable);
|
|
327
|
+
|
|
328
|
+
const excVatWasPriceFormatted = wasPriceFormatted
|
|
329
|
+
? Wick.BloomreachWidget.getExcVatWasPrice(product)
|
|
330
|
+
: '';
|
|
331
|
+
|
|
332
|
+
return {
|
|
333
|
+
...product,
|
|
334
|
+
badge: Wick.BloomreachWidget.getBadge(product),
|
|
335
|
+
price: displayPrice,
|
|
336
|
+
wasPriceFormatted,
|
|
337
|
+
'switch-vat': isSwitchVat,
|
|
338
|
+
incVatFormattedValue: Wick.BloomreachWidget.getPriceFormattedValue(displayPrice),
|
|
339
|
+
incVatValue: Wick.BloomreachWidget.getPriceValue(displayPrice),
|
|
340
|
+
excVatFormattedValue,
|
|
341
|
+
excVatValue: Wick.BloomreachWidget.getPriceValue(
|
|
342
|
+
Wick.BloomreachWidget.getDisplayPriceExcVat(product)
|
|
343
|
+
),
|
|
344
|
+
incVatWasPriceFormatted: wasPriceFormatted,
|
|
345
|
+
excVatWasPriceFormatted,
|
|
346
|
+
showFromPrice,
|
|
347
|
+
image:
|
|
348
|
+
options.image ||
|
|
349
|
+
Wick.BloomreachWidget.getProductImage(product, options.fallbackProduct),
|
|
350
|
+
dropdownOptions: dropdownOptions.map(function (option) {
|
|
351
|
+
return {
|
|
352
|
+
...option,
|
|
353
|
+
selected: option.value === selectedDropdownValue,
|
|
354
|
+
};
|
|
355
|
+
}),
|
|
356
|
+
checkboxId: `${product.code}-${index}`,
|
|
357
|
+
dropdownError: options.dropdownError || false,
|
|
358
|
+
checked: options.checked || false,
|
|
359
|
+
selectedDropdownValue,
|
|
360
|
+
selectedDropdownLabel,
|
|
361
|
+
};
|
|
362
|
+
},
|
|
363
|
+
|
|
364
|
+
renderWidget($container, context) {
|
|
365
|
+
const { widgetContent, widgetWrapper, completeCard, recommendationIndexAttr } =
|
|
366
|
+
Wick.BloomreachWidget.el;
|
|
367
|
+
|
|
368
|
+
const $content = $container.find(widgetContent);
|
|
369
|
+
const recommendations = Wick.BloomreachWidget.normalizePayload(context);
|
|
370
|
+
|
|
371
|
+
if (!$content.length || !recommendations.length) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
Wick.BloomreachWidget.recommendations = recommendations;
|
|
376
|
+
|
|
377
|
+
$content.html(completeWrapperTemplate());
|
|
378
|
+
|
|
379
|
+
const $wrapper = $content.find(widgetWrapper);
|
|
380
|
+
|
|
381
|
+
Wick.BloomreachWidget.dropdownCurrent = {};
|
|
382
|
+
|
|
383
|
+
recommendations.forEach(function (recommendation, index) {
|
|
384
|
+
const product = Wick.BloomreachWidget.getProductRenderData(
|
|
385
|
+
recommendation.baseProduct,
|
|
386
|
+
index
|
|
387
|
+
);
|
|
388
|
+
|
|
389
|
+
$wrapper.append(completeCardTemplate(product));
|
|
390
|
+
|
|
391
|
+
const $card = $wrapper.children(completeCard).last();
|
|
392
|
+
|
|
393
|
+
$card.attr(recommendationIndexAttr, index);
|
|
394
|
+
|
|
395
|
+
if (index === 0 && recommendations.length > 1) {
|
|
396
|
+
$wrapper.append(completeDividerTemplate());
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
const isSwitchVat = !!(window.ACC && window.ACC.app && window.ACC.app.isVatToggleAvailable);
|
|
401
|
+
$content.append(completeSummaryTemplate({ 'switch-vat': isSwitchVat }));
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
renderWidgetFromPayload(payloadData) {
|
|
405
|
+
const { widgetContainer, completeWidget } = Wick.BloomreachWidget.el;
|
|
406
|
+
const $containers = $(widgetContainer);
|
|
407
|
+
|
|
408
|
+
if (!$containers.length) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (!Wick.BloomreachWidget.hasRecommendations(payloadData)) {
|
|
413
|
+
$containers.find(completeWidget).hide();
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
$containers.each(function () {
|
|
418
|
+
const $container = $(this);
|
|
419
|
+
|
|
420
|
+
Wick.BloomreachWidget.renderWidget($container, payloadData);
|
|
421
|
+
Wick.BloomreachWidget.initRenderedWidget($container);
|
|
422
|
+
});
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
drawRating($root) {
|
|
426
|
+
const $ratingOverlay = $root.find('.rating-overlay');
|
|
427
|
+
|
|
428
|
+
$ratingOverlay.each(function () {
|
|
429
|
+
let rating = parseFloat($(this).attr('data-rating')) || 0;
|
|
430
|
+
const $stars = $(this).children(Wick.BloomreachWidget.el.starOverlay);
|
|
431
|
+
|
|
432
|
+
$stars.each(function () {
|
|
433
|
+
const $star = $(this);
|
|
434
|
+
|
|
435
|
+
if (rating >= 1) {
|
|
436
|
+
rating--;
|
|
437
|
+
} else if (rating > 0) {
|
|
438
|
+
const width = Math.asin(2 * rating - 1) / Math.PI + 0.5;
|
|
439
|
+
$star.css('width', width + 'rem');
|
|
440
|
+
rating = 0;
|
|
441
|
+
} else {
|
|
442
|
+
$star.css('width', '0rem');
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
},
|
|
447
|
+
|
|
448
|
+
getDropdownCard($dropdown) {
|
|
449
|
+
return $dropdown.closest(Wick.BloomreachWidget.el.completeCard);
|
|
450
|
+
},
|
|
451
|
+
|
|
452
|
+
getDropdownCheckbox($dropdown) {
|
|
453
|
+
return Wick.BloomreachWidget.getDropdownCard($dropdown).find(
|
|
454
|
+
Wick.BloomreachWidget.el.cardCheckbox
|
|
455
|
+
);
|
|
456
|
+
},
|
|
457
|
+
|
|
458
|
+
setDropdownCheckboxState($dropdown, isChecked, shouldTriggerChange = true) {
|
|
459
|
+
const $checkbox = Wick.BloomreachWidget.getDropdownCheckbox($dropdown);
|
|
460
|
+
|
|
461
|
+
if (!$checkbox.length) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
$checkbox.prop('checked', isChecked);
|
|
466
|
+
|
|
467
|
+
if (shouldTriggerChange) {
|
|
468
|
+
$checkbox.trigger('change');
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
|
|
472
|
+
setDropdownError($dropdown, hasError) {
|
|
473
|
+
$dropdown.toggleClass(Wick.BloomreachWidget.el.dropdownErrorClass, hasError);
|
|
474
|
+
},
|
|
475
|
+
|
|
476
|
+
validateDropdown($dropdown, options = {}) {
|
|
477
|
+
const isValid = Boolean($dropdown.data(Wick.BloomreachWidget.el.selectedValueData));
|
|
478
|
+
|
|
479
|
+
Wick.BloomreachWidget.setDropdownError($dropdown, !isValid);
|
|
480
|
+
|
|
481
|
+
if (!isValid && options.uncheck) {
|
|
482
|
+
Wick.BloomreachWidget.setDropdownCheckboxState($dropdown, false, false);
|
|
483
|
+
Wick.BloomreachWidget.getDropdownCard($dropdown).removeClass(
|
|
484
|
+
Wick.BloomreachWidget.el.selectedClass
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return isValid;
|
|
489
|
+
},
|
|
490
|
+
|
|
491
|
+
validateCardDropdown($card, options = {}) {
|
|
492
|
+
const $dropdown = $card.find(Wick.BloomreachWidget.el.dropdownRoot);
|
|
493
|
+
|
|
494
|
+
if (!$dropdown.length) {
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
return Wick.BloomreachWidget.validateDropdown($dropdown, options);
|
|
499
|
+
},
|
|
500
|
+
|
|
501
|
+
findVariantProduct(recommendation, selectedValue) {
|
|
502
|
+
if (!recommendation.variantProducts || !recommendation.variantProducts.length) {
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return recommendation.variantProducts.find(function (variantProduct) {
|
|
507
|
+
return String(variantProduct.code) === String(selectedValue);
|
|
508
|
+
});
|
|
509
|
+
},
|
|
510
|
+
|
|
511
|
+
getCardQuantity($card) {
|
|
512
|
+
const $input = $card.find(Wick.BloomreachWidget.el.quantityInput);
|
|
513
|
+
const quantity = parseInt($input.val(), 10);
|
|
514
|
+
|
|
515
|
+
return Number.isNaN(quantity) ? 1 : quantity;
|
|
516
|
+
},
|
|
517
|
+
|
|
518
|
+
getCardProduct($card) {
|
|
519
|
+
const { recommendationIndexAttr, dropdownRoot, selectedValueData } =
|
|
520
|
+
Wick.BloomreachWidget.el;
|
|
521
|
+
|
|
522
|
+
const recommendationIndex = Number($card.attr(recommendationIndexAttr));
|
|
523
|
+
const recommendation = Wick.BloomreachWidget.recommendations[recommendationIndex];
|
|
524
|
+
|
|
525
|
+
if (!recommendation) {
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
const $dropdown = $card.find(dropdownRoot);
|
|
530
|
+
const selectedValue = $dropdown.length ? $dropdown.data(selectedValueData) : '';
|
|
531
|
+
|
|
532
|
+
if (selectedValue) {
|
|
533
|
+
return (
|
|
534
|
+
Wick.BloomreachWidget.findVariantProduct(recommendation, selectedValue) ||
|
|
535
|
+
recommendation.baseProduct
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
return recommendation.baseProduct;
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
getSelectedEntries($root) {
|
|
543
|
+
const { completeCard, cardCheckbox } = Wick.BloomreachWidget.el;
|
|
544
|
+
const entries = [];
|
|
545
|
+
|
|
546
|
+
$root.find(completeCard).each(function () {
|
|
547
|
+
const $card = $(this);
|
|
548
|
+
const $checkbox = $card.find(cardCheckbox);
|
|
549
|
+
|
|
550
|
+
if (!$checkbox.prop('checked')) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
const product = Wick.BloomreachWidget.getCardProduct($card);
|
|
555
|
+
|
|
556
|
+
if (!product) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
entries.push({
|
|
561
|
+
product,
|
|
562
|
+
quantity: Wick.BloomreachWidget.getCardQuantity($card),
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
return entries;
|
|
567
|
+
},
|
|
568
|
+
|
|
569
|
+
getAddToCartEntries($root) {
|
|
570
|
+
return Wick.BloomreachWidget.getSelectedEntries($root).map(function (entry) {
|
|
571
|
+
return {
|
|
572
|
+
productCode: entry.product.code,
|
|
573
|
+
quantity: entry.quantity,
|
|
574
|
+
};
|
|
575
|
+
});
|
|
576
|
+
},
|
|
577
|
+
|
|
578
|
+
updateSummary($root, response = {}) {
|
|
579
|
+
const totalPriceExclusiveVat = response.totalPriceExclusiveVat || response.totalExcVatPrice;
|
|
580
|
+
|
|
581
|
+
const totalWasPriceExclusiveVat =
|
|
582
|
+
response.totalWasPriceExclusiveVat || response.totalExcVatWasPrice;
|
|
583
|
+
|
|
584
|
+
const {
|
|
585
|
+
summaryPriceValue,
|
|
586
|
+
summarySalePrice,
|
|
587
|
+
summaryPriceInc,
|
|
588
|
+
summaryPriceExc,
|
|
589
|
+
summarySalePriceInc,
|
|
590
|
+
summarySalePriceExc,
|
|
591
|
+
} = Wick.BloomreachWidget.el;
|
|
592
|
+
|
|
593
|
+
Wick.BloomreachWidget.lastCalculationResponse = response;
|
|
594
|
+
|
|
595
|
+
const $price = $root.find(summaryPriceValue);
|
|
596
|
+
const $salePrice = $root.find(summarySalePrice);
|
|
597
|
+
const $total = $root.find('.complete-widget__total');
|
|
598
|
+
|
|
599
|
+
if (!$price.length) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
if (response.totalWasPrice) {
|
|
604
|
+
$total.addClass('complete-widget__total-sale');
|
|
605
|
+
const $priceInc = $price.find(summaryPriceInc);
|
|
606
|
+
|
|
607
|
+
if ($priceInc.length) {
|
|
608
|
+
$priceInc.text(response.totalWasPrice);
|
|
609
|
+
$price
|
|
610
|
+
.find(summaryPriceExc)
|
|
611
|
+
.text(totalWasPriceExclusiveVat || response.totalWasPrice);
|
|
612
|
+
|
|
613
|
+
$salePrice.find(summarySalePriceInc).text(response.totalPrice || '');
|
|
614
|
+
$salePrice
|
|
615
|
+
.find(summarySalePriceExc)
|
|
616
|
+
.text(totalPriceExclusiveVat || response.totalPrice || '');
|
|
617
|
+
} else {
|
|
618
|
+
$price.text(response.totalWasPrice);
|
|
619
|
+
$salePrice.text(response.totalPrice || '');
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
$salePrice.show();
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
$total.removeClass('complete-widget__total-sale');
|
|
627
|
+
const $priceInc = $price.find(summaryPriceInc);
|
|
628
|
+
if ($priceInc.length) {
|
|
629
|
+
$priceInc.text(response.totalPrice || '£0.00');
|
|
630
|
+
$price
|
|
631
|
+
.find(summaryPriceExc)
|
|
632
|
+
.text(totalPriceExclusiveVat || response.totalPrice || '£0.00');
|
|
633
|
+
|
|
634
|
+
$salePrice.find(summarySalePriceInc).text('');
|
|
635
|
+
$salePrice.find(summarySalePriceExc).text('');
|
|
636
|
+
$salePrice.hide();
|
|
637
|
+
} else {
|
|
638
|
+
$price.text(response.totalPrice || '£0.00');
|
|
639
|
+
$salePrice.text('').hide();
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
|
|
643
|
+
updateCta($root) {
|
|
644
|
+
const { ctaButton, cardCheckbox } = Wick.BloomreachWidget.el;
|
|
645
|
+
const selectedCount = $root.find(cardCheckbox).filter(':checked').length;
|
|
646
|
+
const $cta = $root.find(ctaButton);
|
|
647
|
+
|
|
648
|
+
if (!$cta.length) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
$cta.prop('disabled', !selectedCount);
|
|
653
|
+
Wick.BloomreachWidget.setCtaText($cta, Wick.BloomreachWidget.getCtaText(selectedCount));
|
|
654
|
+
},
|
|
655
|
+
|
|
656
|
+
dispatchCalculateTotal($root) {
|
|
657
|
+
Wick.BloomreachWidget.updateCta($root);
|
|
658
|
+
|
|
659
|
+
return Wick.BloomreachWidget.dispatchWidgetEvent(
|
|
660
|
+
Wick.BloomreachWidget.CALCULATE_PRODUCT_BUNDLE_TOTAL_EVENT,
|
|
661
|
+
{
|
|
662
|
+
entries: Wick.BloomreachWidget.getSelectedEntries($root),
|
|
663
|
+
}
|
|
664
|
+
).then(function (response) {
|
|
665
|
+
Wick.BloomreachWidget.updateSummary($root, response);
|
|
666
|
+
});
|
|
667
|
+
},
|
|
668
|
+
|
|
669
|
+
dispatchAddToCart($root, $button) {
|
|
670
|
+
Wick.BloomreachWidget.loadingButton.start($button);
|
|
671
|
+
|
|
672
|
+
return new Promise(function (resolve, reject) {
|
|
673
|
+
const eventDetail = { resolve, reject };
|
|
674
|
+
const event = createEvent(
|
|
675
|
+
Wick.BloomreachWidget.ADD_PRODUCT_BUNDLE_TO_CART_EVENT,
|
|
676
|
+
{
|
|
677
|
+
entries: Wick.BloomreachWidget.getAddToCartEntries($root),
|
|
678
|
+
},
|
|
679
|
+
eventDetail
|
|
680
|
+
);
|
|
681
|
+
|
|
682
|
+
window.dispatchEvent(event);
|
|
683
|
+
})
|
|
684
|
+
.then(function (response) {
|
|
685
|
+
Wick.BloomreachWidget.handleBulkAddToCartResponse(response);
|
|
686
|
+
})
|
|
687
|
+
.catch(function () {
|
|
688
|
+
Wick.BloomreachWidget.handleBulkAddToCartResponse({
|
|
689
|
+
bulkAddToCartData: {
|
|
690
|
+
messageType: 'error',
|
|
691
|
+
messageText: 'Selected product(s) were not added to basket',
|
|
692
|
+
},
|
|
693
|
+
});
|
|
694
|
+
})
|
|
695
|
+
.finally(function () {
|
|
696
|
+
Wick.BloomreachWidget.loadingButton.stop($button);
|
|
697
|
+
Wick.BloomreachWidget.updateCta($root);
|
|
698
|
+
});
|
|
699
|
+
},
|
|
700
|
+
|
|
701
|
+
reinitCard($card) {
|
|
702
|
+
const { countBtn, completeWidget } = Wick.BloomreachWidget.el;
|
|
703
|
+
|
|
704
|
+
$card.find(countBtn).remove();
|
|
705
|
+
|
|
706
|
+
Wick.BloomreachWidget.initQuantityFields($card);
|
|
707
|
+
Wick.BloomreachWidget.drawRating($card);
|
|
708
|
+
Wick.BloomreachWidget.alignCardBlocks($card.closest(completeWidget));
|
|
709
|
+
},
|
|
710
|
+
|
|
711
|
+
replaceCardWithBaseProduct($dropdown, options = {}) {
|
|
712
|
+
const {
|
|
713
|
+
completeCard,
|
|
714
|
+
recommendationIndexAttr,
|
|
715
|
+
dropdownRoot,
|
|
716
|
+
dropdownErrorClass,
|
|
717
|
+
cardCheckbox,
|
|
718
|
+
} = Wick.BloomreachWidget.el;
|
|
719
|
+
|
|
720
|
+
const $card = $dropdown.closest(completeCard);
|
|
721
|
+
const recommendationIndex = Number($card.attr(recommendationIndexAttr));
|
|
722
|
+
const recommendation = Wick.BloomreachWidget.recommendations[recommendationIndex];
|
|
723
|
+
|
|
724
|
+
if (!recommendation || !recommendation.baseProduct) {
|
|
725
|
+
return null;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
const productData = Wick.BloomreachWidget.getProductRenderData(
|
|
729
|
+
recommendation.baseProduct,
|
|
730
|
+
recommendationIndex,
|
|
731
|
+
{
|
|
732
|
+
dropdownError: options.dropdownError || false,
|
|
733
|
+
checked: false,
|
|
734
|
+
}
|
|
735
|
+
);
|
|
736
|
+
|
|
737
|
+
const newCardHtml = completeCardTemplate(productData);
|
|
738
|
+
const $newCard = $(newCardHtml);
|
|
739
|
+
|
|
740
|
+
$newCard.attr(recommendationIndexAttr, recommendationIndex);
|
|
741
|
+
|
|
742
|
+
if (options.dropdownError) {
|
|
743
|
+
$newCard.find(dropdownRoot).addClass(dropdownErrorClass);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
$card.replaceWith($newCard);
|
|
747
|
+
|
|
748
|
+
$newCard.find(cardCheckbox).prop('checked', false);
|
|
749
|
+
|
|
750
|
+
$newCard
|
|
751
|
+
.find(Wick.BloomreachWidget.el.quantityInput)
|
|
752
|
+
.val(1)
|
|
753
|
+
.data(Wick.BloomreachWidget.el.previousQuantityData, 1)
|
|
754
|
+
.removeData(Wick.BloomreachWidget.el.quantityReadyData)
|
|
755
|
+
.removeData(Wick.BloomreachWidget.el.countStepperInitializedData);
|
|
756
|
+
|
|
757
|
+
Wick.BloomreachWidget.reinitCard($newCard);
|
|
758
|
+
|
|
759
|
+
return $newCard;
|
|
760
|
+
},
|
|
761
|
+
|
|
762
|
+
replaceCardWithVariant($dropdown, selectedValue) {
|
|
763
|
+
const {
|
|
764
|
+
completeCard,
|
|
765
|
+
recommendationIndexAttr,
|
|
766
|
+
selectedClass,
|
|
767
|
+
dropdownRoot,
|
|
768
|
+
selectedValueData,
|
|
769
|
+
cardCheckbox,
|
|
770
|
+
} = Wick.BloomreachWidget.el;
|
|
771
|
+
|
|
772
|
+
const $card = $dropdown.closest(completeCard);
|
|
773
|
+
const recommendationIndex = Number($card.attr(recommendationIndexAttr));
|
|
774
|
+
const recommendation = Wick.BloomreachWidget.recommendations[recommendationIndex];
|
|
775
|
+
|
|
776
|
+
if (!recommendation) {
|
|
777
|
+
return null;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
const variantProduct = Wick.BloomreachWidget.findVariantProduct(
|
|
781
|
+
recommendation,
|
|
782
|
+
selectedValue
|
|
783
|
+
);
|
|
784
|
+
|
|
785
|
+
if (!variantProduct) {
|
|
786
|
+
return null;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
const productData = Wick.BloomreachWidget.getProductRenderData(
|
|
790
|
+
{
|
|
791
|
+
...variantProduct,
|
|
792
|
+
variantOptions: recommendation.baseProduct.variantOptions,
|
|
793
|
+
},
|
|
794
|
+
recommendationIndex,
|
|
795
|
+
{
|
|
796
|
+
fallbackProduct: recommendation.baseProduct,
|
|
797
|
+
checked: true,
|
|
798
|
+
selectedDropdownValue: selectedValue,
|
|
799
|
+
}
|
|
800
|
+
);
|
|
801
|
+
|
|
802
|
+
const newCardHtml = completeCardTemplate(productData);
|
|
803
|
+
const $newCard = $(newCardHtml);
|
|
804
|
+
|
|
805
|
+
$newCard.attr(recommendationIndexAttr, recommendationIndex);
|
|
806
|
+
$newCard.addClass(selectedClass);
|
|
807
|
+
|
|
808
|
+
const $newDropdown = $newCard.find(dropdownRoot);
|
|
809
|
+
|
|
810
|
+
if ($newDropdown.length) {
|
|
811
|
+
$newDropdown.data(selectedValueData, selectedValue);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
$card.replaceWith($newCard);
|
|
815
|
+
|
|
816
|
+
$newCard.find(cardCheckbox).prop('checked', true);
|
|
817
|
+
|
|
818
|
+
$newCard
|
|
819
|
+
.find(Wick.BloomreachWidget.el.quantityInput)
|
|
820
|
+
.val(1)
|
|
821
|
+
.data(Wick.BloomreachWidget.el.previousQuantityData, 1)
|
|
822
|
+
.removeData(Wick.BloomreachWidget.el.quantityReadyData)
|
|
823
|
+
.removeData(Wick.BloomreachWidget.el.countStepperInitializedData);
|
|
824
|
+
|
|
825
|
+
Wick.BloomreachWidget.reinitCard($newCard);
|
|
826
|
+
|
|
827
|
+
return $newCard;
|
|
828
|
+
},
|
|
829
|
+
|
|
830
|
+
handleDropdownSelect($dropdown, selectedValue) {
|
|
831
|
+
const $card = $dropdown.closest(Wick.BloomreachWidget.el.completeCard);
|
|
832
|
+
const recommendationIndex = $card.attr(Wick.BloomreachWidget.el.recommendationIndexAttr);
|
|
833
|
+
const currentValue = Wick.BloomreachWidget.dropdownCurrent[recommendationIndex];
|
|
834
|
+
|
|
835
|
+
if (`${currentValue}` === `${selectedValue}`) {
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
Wick.BloomreachWidget.dropdownCurrent[recommendationIndex] = selectedValue;
|
|
840
|
+
|
|
841
|
+
const $completeWidget = $dropdown.closest(Wick.BloomreachWidget.el.completeWidget);
|
|
842
|
+
const isPlaceholder = !selectedValue;
|
|
843
|
+
|
|
844
|
+
if (isPlaceholder) {
|
|
845
|
+
Wick.BloomreachWidget.setDropdownError($dropdown, true);
|
|
846
|
+
Wick.BloomreachWidget.setDropdownCheckboxState($dropdown, false, false);
|
|
847
|
+
Wick.BloomreachWidget.replaceCardWithBaseProduct($dropdown, {
|
|
848
|
+
dropdownError: true,
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
if ($completeWidget.length) {
|
|
852
|
+
Wick.BloomreachWidget.dispatchCalculateTotal($completeWidget);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
Wick.BloomreachWidget.setDropdownError($dropdown, false);
|
|
859
|
+
Wick.BloomreachWidget.setDropdownCheckboxState($dropdown, true, false);
|
|
860
|
+
Wick.BloomreachWidget.replaceCardWithVariant($dropdown, selectedValue);
|
|
861
|
+
|
|
862
|
+
if ($completeWidget.length) {
|
|
863
|
+
Wick.BloomreachWidget.dispatchCalculateTotal($completeWidget);
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
|
|
867
|
+
bindDropdowns() {
|
|
868
|
+
const {
|
|
869
|
+
dropdownRoot,
|
|
870
|
+
dropdownToggle,
|
|
871
|
+
dropdownValue,
|
|
872
|
+
dropdownOption,
|
|
873
|
+
dropdownOpenClass,
|
|
874
|
+
dropdownOptionSelectedClass,
|
|
875
|
+
} = Wick.BloomreachWidget.el;
|
|
876
|
+
|
|
877
|
+
Wick.BloomreachWidget.dropdown = createDropdown({
|
|
878
|
+
root: dropdownRoot,
|
|
879
|
+
toggle: dropdownToggle,
|
|
880
|
+
value: dropdownValue,
|
|
881
|
+
option: dropdownOption,
|
|
882
|
+
openClass: dropdownOpenClass,
|
|
883
|
+
selectedClass: dropdownOptionSelectedClass,
|
|
884
|
+
namespace: 'bloomreachDropdown',
|
|
885
|
+
onSelect($dropdown, $option, selectedValue) {
|
|
886
|
+
Wick.BloomreachWidget.handleDropdownSelect($dropdown, selectedValue);
|
|
887
|
+
},
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
Wick.BloomreachWidget.dropdown.bind();
|
|
891
|
+
},
|
|
892
|
+
|
|
893
|
+
bindCardSelection($root) {
|
|
894
|
+
const { completeCard, cardCheckbox, selectedClass } = Wick.BloomreachWidget.el;
|
|
895
|
+
|
|
896
|
+
const $firstCard = $root.find(completeCard).first();
|
|
897
|
+
|
|
898
|
+
$firstCard.find(cardCheckbox).prop('checked', true);
|
|
899
|
+
$firstCard.addClass(selectedClass);
|
|
900
|
+
|
|
901
|
+
$root.off('change.bloomreachCardSelection', cardCheckbox);
|
|
902
|
+
$root.on('change.bloomreachCardSelection', cardCheckbox, function () {
|
|
903
|
+
const $checkbox = $(this);
|
|
904
|
+
const $card = $checkbox.closest(completeCard);
|
|
905
|
+
const $dropdown = $card.find(Wick.BloomreachWidget.el.dropdownRoot);
|
|
906
|
+
|
|
907
|
+
if (
|
|
908
|
+
!$checkbox.prop('checked') &&
|
|
909
|
+
$dropdown.hasClass(Wick.BloomreachWidget.el.dropdownErrorClass)
|
|
910
|
+
) {
|
|
911
|
+
$card.removeClass(selectedClass);
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
if (
|
|
916
|
+
$checkbox.prop('checked') &&
|
|
917
|
+
!Wick.BloomreachWidget.validateCardDropdown($card, {
|
|
918
|
+
uncheck: true,
|
|
919
|
+
})
|
|
920
|
+
) {
|
|
921
|
+
$checkbox.prop('checked', false);
|
|
922
|
+
$card.removeClass(selectedClass);
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
$card.toggleClass(selectedClass, this.checked);
|
|
927
|
+
|
|
928
|
+
Wick.BloomreachWidget.dispatchCalculateTotal($root);
|
|
929
|
+
});
|
|
930
|
+
},
|
|
931
|
+
|
|
932
|
+
bindDropdownValidation($root) {
|
|
933
|
+
const { cardCheckbox, completeCard } = Wick.BloomreachWidget.el;
|
|
934
|
+
|
|
935
|
+
$root.off('click.bloomreachDropdownValidation', cardCheckbox);
|
|
936
|
+
$root.on('click.bloomreachDropdownValidation', cardCheckbox, function () {
|
|
937
|
+
const $checkbox = $(this);
|
|
938
|
+
const $card = $checkbox.closest(completeCard);
|
|
939
|
+
|
|
940
|
+
if (
|
|
941
|
+
$checkbox.prop('checked') &&
|
|
942
|
+
!Wick.BloomreachWidget.validateCardDropdown($card, {
|
|
943
|
+
uncheck: true,
|
|
944
|
+
})
|
|
945
|
+
) {
|
|
946
|
+
$checkbox.prop('checked', false);
|
|
947
|
+
$card.removeClass(Wick.BloomreachWidget.el.selectedClass);
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
},
|
|
951
|
+
|
|
952
|
+
bindAddToCart($root) {
|
|
953
|
+
const { ctaButton } = Wick.BloomreachWidget.el;
|
|
954
|
+
|
|
955
|
+
$root.off('click.bloomreachAddToCart', ctaButton);
|
|
956
|
+
$root.on('click.bloomreachAddToCart', ctaButton, function (event) {
|
|
957
|
+
event.preventDefault();
|
|
958
|
+
|
|
959
|
+
const $button = $(this);
|
|
960
|
+
|
|
961
|
+
if (
|
|
962
|
+
$button.prop('disabled') ||
|
|
963
|
+
Wick.BloomreachWidget.loadingButton.isLoading($button)
|
|
964
|
+
) {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
Wick.BloomreachWidget.dispatchAddToCart($root, $button);
|
|
969
|
+
});
|
|
970
|
+
},
|
|
971
|
+
|
|
972
|
+
alignBlock(selector, $root) {
|
|
973
|
+
const $els = $root.find(selector);
|
|
974
|
+
|
|
975
|
+
$els.css('min-height', '');
|
|
976
|
+
|
|
977
|
+
if (!$els.length || Wick.Responsive.getCurrentBreakpoint() !== 'up-lg') {
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
let maxHeight = 0;
|
|
982
|
+
|
|
983
|
+
$els.each(function () {
|
|
984
|
+
maxHeight = Math.max(maxHeight, $(this).height());
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
if (maxHeight > 0) {
|
|
988
|
+
$els.css('min-height', maxHeight + 'px');
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
|
|
992
|
+
alignCardBlocks($root) {
|
|
993
|
+
const { titleEl, optionsEl } = Wick.BloomreachWidget.el;
|
|
994
|
+
|
|
995
|
+
Wick.BloomreachWidget.alignBlock(titleEl, $root);
|
|
996
|
+
Wick.BloomreachWidget.alignBlock(optionsEl, $root);
|
|
997
|
+
},
|
|
998
|
+
|
|
999
|
+
setInitialSummary($root) {
|
|
1000
|
+
const entries = Wick.BloomreachWidget.getSelectedEntries($root);
|
|
1001
|
+
const firstEntry = entries[0];
|
|
1002
|
+
|
|
1003
|
+
if (!firstEntry || !firstEntry.product) {
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
const product = firstEntry.product;
|
|
1008
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
1009
|
+
const priceExcVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
1010
|
+
const wasPriceFormatted = Wick.BloomreachWidget.getWasPriceFormatted(product);
|
|
1011
|
+
|
|
1012
|
+
Wick.BloomreachWidget.updateSummary($root, {
|
|
1013
|
+
totalPrice: Wick.BloomreachWidget.getPriceFormattedValue(displayPrice) || '£0.00',
|
|
1014
|
+
totalWasPrice: wasPriceFormatted || null,
|
|
1015
|
+
totalPriceExclusiveVat: Wick.BloomreachWidget.getPriceFormattedValue(priceExcVat),
|
|
1016
|
+
totalWasPriceExclusiveVat: Wick.BloomreachWidget.getExcVatWasPrice(product) || null,
|
|
1017
|
+
});
|
|
1018
|
+
},
|
|
1019
|
+
|
|
1020
|
+
initQuantityField($root, inputSel) {
|
|
1021
|
+
const stepper = createCountStepper({
|
|
1022
|
+
inputSel,
|
|
1023
|
+
min: 1,
|
|
1024
|
+
onChange(qty, inputEl) {
|
|
1025
|
+
const $input = $(inputEl);
|
|
1026
|
+
const $card = $input.closest(Wick.BloomreachWidget.el.completeCard);
|
|
1027
|
+
const $completeWidget = $input.closest(Wick.BloomreachWidget.el.completeWidget);
|
|
1028
|
+
const $checkbox = $card.find(Wick.BloomreachWidget.el.cardCheckbox);
|
|
1029
|
+
const previousQuantity =
|
|
1030
|
+
$input.data(Wick.BloomreachWidget.el.previousQuantityData) || 1;
|
|
1031
|
+
|
|
1032
|
+
if (!$input.data(Wick.BloomreachWidget.el.quantityReadyData)) {
|
|
1033
|
+
$input.data(Wick.BloomreachWidget.el.previousQuantityData, qty || 1);
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
if (!Wick.BloomreachWidget.validateCardDropdown($card)) {
|
|
1038
|
+
$input.val(previousQuantity);
|
|
1039
|
+
|
|
1040
|
+
const $minus = $card.find('.count-btn--minus');
|
|
1041
|
+
|
|
1042
|
+
if (previousQuantity <= 1) {
|
|
1043
|
+
$minus.prop('disabled', true);
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
$checkbox.prop('checked', true);
|
|
1050
|
+
$card.addClass(Wick.BloomreachWidget.el.selectedClass);
|
|
1051
|
+
|
|
1052
|
+
$input.data(Wick.BloomreachWidget.el.previousQuantityData, qty);
|
|
1053
|
+
$input.trigger('change');
|
|
1054
|
+
|
|
1055
|
+
if ($completeWidget.length) {
|
|
1056
|
+
Wick.BloomreachWidget.dispatchCalculateTotal($completeWidget);
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
});
|
|
1060
|
+
|
|
1061
|
+
stepper.init($root);
|
|
1062
|
+
|
|
1063
|
+
$root.find(inputSel).data(Wick.BloomreachWidget.el.quantityReadyData, true);
|
|
1064
|
+
|
|
1065
|
+
Wick.BloomreachWidget.steppers.push(stepper);
|
|
1066
|
+
},
|
|
1067
|
+
|
|
1068
|
+
initQuantityFields($root) {
|
|
1069
|
+
const {
|
|
1070
|
+
quantityInput,
|
|
1071
|
+
countStepperInitializedData,
|
|
1072
|
+
countStepperRoot,
|
|
1073
|
+
previousQuantityData,
|
|
1074
|
+
} = Wick.BloomreachWidget.el;
|
|
1075
|
+
|
|
1076
|
+
$root.find(quantityInput).each(function () {
|
|
1077
|
+
const $input = $(this);
|
|
1078
|
+
|
|
1079
|
+
if ($input.data(countStepperInitializedData)) {
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
const inputId = $input.attr('id');
|
|
1084
|
+
|
|
1085
|
+
if (!inputId) {
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
$input.data(countStepperInitializedData, true);
|
|
1090
|
+
$input.data(previousQuantityData, parseInt($input.val(), 10) || 1);
|
|
1091
|
+
|
|
1092
|
+
Wick.BloomreachWidget.initQuantityField(
|
|
1093
|
+
$input.closest(countStepperRoot),
|
|
1094
|
+
`#${inputId}`
|
|
1095
|
+
);
|
|
1096
|
+
});
|
|
1097
|
+
},
|
|
1098
|
+
|
|
1099
|
+
formatPrice(value) {
|
|
1100
|
+
return new Intl.NumberFormat('en-GB', {
|
|
1101
|
+
style: 'currency',
|
|
1102
|
+
currency: 'GBP',
|
|
1103
|
+
minimumFractionDigits: 2,
|
|
1104
|
+
maximumFractionDigits: 2,
|
|
1105
|
+
}).format(value);
|
|
1106
|
+
},
|
|
1107
|
+
|
|
1108
|
+
resetWidgetState($root) {
|
|
1109
|
+
$root.find(Wick.BloomreachWidget.el.cardCheckbox).prop('checked', false);
|
|
1110
|
+
|
|
1111
|
+
$root
|
|
1112
|
+
.find(Wick.BloomreachWidget.el.completeCard)
|
|
1113
|
+
.removeClass(Wick.BloomreachWidget.el.selectedClass);
|
|
1114
|
+
|
|
1115
|
+
$root
|
|
1116
|
+
.find(Wick.BloomreachWidget.el.quantityInput)
|
|
1117
|
+
.val(1)
|
|
1118
|
+
.data(Wick.BloomreachWidget.el.previousQuantityData, 1);
|
|
1119
|
+
},
|
|
1120
|
+
|
|
1121
|
+
resetBackForwardState() {
|
|
1122
|
+
$(Wick.BloomreachWidget.el.completeWidget).each(function () {
|
|
1123
|
+
const $widget = $(this);
|
|
1124
|
+
|
|
1125
|
+
Wick.BloomreachWidget.resetWidgetState($widget);
|
|
1126
|
+
Wick.BloomreachWidget.bindCardSelection($widget);
|
|
1127
|
+
});
|
|
1128
|
+
},
|
|
1129
|
+
|
|
1130
|
+
initRenderedWidget($container) {
|
|
1131
|
+
if (!Wick.BloomreachWidget.toast) {
|
|
1132
|
+
Wick.BloomreachWidget.toast = createToast({
|
|
1133
|
+
template: notificationTemplate,
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
if (!Wick.BloomreachWidget.loadingButton) {
|
|
1137
|
+
Wick.BloomreachWidget.loadingButton = createLoadingButton();
|
|
1138
|
+
}
|
|
1139
|
+
const $completeWidget = $container.find(Wick.BloomreachWidget.el.completeWidget);
|
|
1140
|
+
|
|
1141
|
+
if (!$completeWidget.length) {
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
Wick.BloomreachWidget.drawRating($completeWidget);
|
|
1146
|
+
Wick.BloomreachWidget.bindCardSelection($completeWidget);
|
|
1147
|
+
Wick.BloomreachWidget.bindDropdowns();
|
|
1148
|
+
Wick.BloomreachWidget.bindDropdownValidation($completeWidget);
|
|
1149
|
+
Wick.BloomreachWidget.bindAddToCart($completeWidget);
|
|
1150
|
+
Wick.BloomreachWidget.initQuantityFields($completeWidget);
|
|
1151
|
+
|
|
1152
|
+
$completeWidget
|
|
1153
|
+
.find(Wick.BloomreachWidget.el.dropdownRoot)
|
|
1154
|
+
.removeClass(Wick.BloomreachWidget.el.dropdownErrorClass);
|
|
1155
|
+
|
|
1156
|
+
Wick.BloomreachWidget.alignCardBlocks($completeWidget);
|
|
1157
|
+
Wick.BloomreachWidget.updateCta($completeWidget);
|
|
1158
|
+
Wick.BloomreachWidget.setInitialSummary($completeWidget);
|
|
1159
|
+
},
|
|
1160
|
+
|
|
1161
|
+
init(payloadData) {
|
|
1162
|
+
const $containers = $(Wick.BloomreachWidget.el.widgetContainer);
|
|
1163
|
+
|
|
1164
|
+
if (!payloadData || !Wick.BloomreachWidget.hasRecommendations(payloadData)) {
|
|
1165
|
+
$containers.find(Wick.BloomreachWidget.el.completeWidget).hide();
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
Wick.BloomreachWidget.renderWidgetFromPayload(payloadData);
|
|
1170
|
+
},
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
$(document).ready(function () {
|
|
1174
|
+
Wick.Responsive.onResize(function () {
|
|
1175
|
+
$(Wick.BloomreachWidget.el.widgetContainer).each(function () {
|
|
1176
|
+
const $completeWidget = $(this).find(Wick.BloomreachWidget.el.completeWidget);
|
|
1177
|
+
|
|
1178
|
+
if ($completeWidget.length) {
|
|
1179
|
+
Wick.BloomreachWidget.alignCardBlocks($completeWidget);
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
});
|
|
1183
|
+
});
|
|
1184
|
+
|
|
1185
|
+
window.addEventListener('pagehide', function () {
|
|
1186
|
+
Wick.BloomreachWidget.resetBackForwardState();
|
|
1187
|
+
});
|