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