wickes-css2 2.105.0-develop.6 → 2.105.0-develop.8
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 +2 -2
- package/build/css/category-main.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/my-account-v2.css +1 -1
- package/build/css/pages/page_discount.css +1 -1
- package/build/css/pages/page_product_search.css +1 -1
- package/build/css/pages/page_products-list-combined.css +1 -1
- package/build/css/pages/page_products-list.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-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/basket.min.js +2 -2
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +2 -2
- package/build/js/emulation.min.js +10255 -10784
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/kitchen/kitchen-plp.min.js +9 -1
- package/build/js/merged-checkout.min.js +2 -2
- package/build/js/mini-basket-slider.min.js +1 -1
- package/build/js/my-account.min.js +1 -1
- package/build/js/page/accordion.js +35 -0
- package/build/js/page/basket/basket-update-cart-action.js +56 -59
- package/build/js/page/basket/basket-update-cart.js +27 -27
- package/build/js/page/basket/basket-utils.js +33 -40
- package/build/js/page/basket/mini-basket-total.js +66 -70
- package/build/js/page/basket/quantity-change-handler.js +55 -73
- package/build/js/page/basket/update-quantity-operation.js +30 -39
- package/build/js/page/basket/update-quantity.js +62 -62
- package/build/js/page/basket-v2.js +229 -362
- package/build/js/page/billie-business-type.js +27 -27
- package/build/js/page/checkout-payment-details.js +299 -301
- package/build/js/page/components/discounts.js +36 -39
- package/build/js/page/components/mini-basket-slider.js +545 -604
- package/build/js/page/kitchen/plp-filters-chips.js +90 -0
- package/build/js/page/kitchen/plp-filters-mobile.js +72 -0
- package/build/js/page/kitchen/plp-filters-panel.js +119 -0
- package/build/js/page/kitchen/plp-filters-utils.js +65 -0
- package/build/js/page/kitchen/plp-filters.js +205 -0
- package/build/js/page/kitchen/sort-by.js +157 -0
- package/build/js/page/klarna-modal-scroll-disable.js +4 -4
- package/build/js/page/my-account.js +14 -29
- package/build/js/page/online-exclusive.js +30 -28
- package/build/js/page/tradePro-rewards.js +39 -69
- package/build/js/page/utils/copy-to-clipboard.js +47 -79
- package/build/js/page/utils/helpers.js +9 -14
- 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 +85 -143
- package/build/js/tradePro-rewards.min.js +1 -1
- package/package.json +3 -3
- package/src/components/.DS_Store +0 -0
- package/src/components/accordion.hbs +2 -2
- package/src/components/kitchen/dropdown.hbs +3 -6
- package/src/components/kitchen/filter-modal.hbs +13 -10
- package/src/components/kitchen/plp-filters.hbs +1 -3
- package/src/components/kitchen/sort-by.hbs +1 -1
- package/src/components/my-account/barcode.hbs +1 -3
- package/src/components/my-account/cards-swap.hbs +10 -0
- package/src/components/my-account/clipboard-code-card.hbs +3 -3
- package/src/components/my-account/discount.hbs +1 -1
- package/src/components/my-account/greetings.hbs +1 -1
- package/src/components/search-filter.hbs +112 -121
- package/src/data/data_plp_load-more.json +1 -1
- package/src/data/my-account/data_my-account.json +9 -0
- package/src/js/components/cards-swap.js +72 -0
- package/src/js/components/general/accordion.js +33 -44
- package/src/js/components/general/cart-slider.js +16 -19
- package/src/js/components/general/create-popup-slider.js +173 -168
- package/src/js/components/general/search-filter.js +21 -0
- package/src/js/components/share-project-list.js +53 -0
- package/src/js/emulation/big-wins.js +904 -1081
- package/src/js/emulation/billie-modal.js +19 -23
- package/src/js/emulation/checkout-payment-details.js +38 -47
- package/src/js/emulation/custom-slider-emulation.js +13 -17
- package/src/js/emulation/forms.js +323 -360
- package/src/js/emulation/mini-basket-data.js +923 -1051
- package/src/js/emulation/paymentLoader.js +17 -17
- package/src/js/emulation/pdf-file-loader.js +91 -89
- package/src/js/emulation/popover-mini-basket.js +239 -246
- package/src/js/emulation/project-list-pdp.js +316 -320
- package/src/js/emulation/repayment-toggle.js +24 -23
- package/src/js/emulation/selectable.js +18 -22
- package/src/js/emulation/wismo-details.js +31 -23
- package/src/js/page/accordion.js +35 -0
- package/src/js/page/basket/basket-update-cart-action.js +56 -59
- package/src/js/page/basket/basket-update-cart.js +27 -27
- package/src/js/page/basket/basket-utils.js +33 -40
- package/src/js/page/basket/mini-basket-total.js +66 -70
- package/src/js/page/basket/quantity-change-handler.js +55 -73
- package/src/js/page/basket/update-quantity-operation.js +30 -39
- package/src/js/page/basket/update-quantity.js +62 -62
- package/src/js/page/basket-v2.js +229 -362
- package/src/js/page/billie-business-type.js +27 -27
- package/src/js/page/checkout-payment-details.js +299 -301
- package/src/js/page/components/discounts.js +36 -39
- package/src/js/page/components/mini-basket-slider.js +545 -604
- package/src/js/page/kitchen/plp-filters-chips.js +90 -0
- package/src/js/page/kitchen/plp-filters-mobile.js +72 -0
- package/src/js/page/kitchen/plp-filters-panel.js +119 -0
- package/src/js/page/kitchen/plp-filters-utils.js +65 -0
- package/src/js/page/kitchen/plp-filters.js +205 -0
- package/src/js/page/kitchen/sort-by.js +157 -0
- package/src/js/page/klarna-modal-scroll-disable.js +4 -4
- package/src/js/page/my-account.js +14 -29
- package/src/js/page/online-exclusive.js +30 -28
- package/src/js/page/tradePro-rewards.js +39 -69
- package/src/js/page/utils/copy-to-clipboard.js +47 -79
- package/src/js/page/utils/helpers.js +9 -14
- package/src/page_empty-shared-project-list-bicester-hub.html +0 -4
- package/src/page_empty-shopping-list_guest.html +0 -1
- package/src/page_kitchen-plp.html +2 -2
- package/src/page_my-account-installer.html +1 -1
- package/src/page_my-account-trade-pro-carousel-double.html +127 -0
- package/src/page_my-account-trade-pro-carousel.html +134 -0
- package/src/page_my-account-trade-pro.html +1 -1
- package/src/page_my-shopping-list-add-notes.html +0 -1
- package/src/page_my-shopping-list-energy.html +0 -1
- package/src/page_my-shopping-list-hide-download.html +1 -2
- package/src/page_my-shopping-list-pdf.html +0 -2
- package/src/page_my-shopping-list-saved-ref.html +0 -1
- package/src/page_my-shopping-list-wisdom-oos-registered.html +0 -1
- package/src/page_my-shopping-list-wisdom-oos.html +0 -1
- package/src/page_my-shopping-list-wisdom-partial-registered.html +0 -1
- package/src/page_my-shopping-list-wisdom-registered.html +0 -1
- package/src/page_my-shopping-list-wisdom.html +0 -1
- package/src/page_my-shopping-list.html +0 -1
- package/src/page_my-shopping-list_not-register.html +0 -3
- package/src/page_plp-with-paint.html +7 -2
- package/src/page_plp.html +7 -2
- package/src/page_plp_v2-energy-efficiency.html +6 -1
- package/src/page_plp_v2-favourite-products.html +7 -6
- package/src/page_plp_v2-vat.html +7 -2
- package/src/page_plp_v2.html +9 -22
- package/src/page_product_search-vat.html +7 -2
- package/src/page_product_search.html +7 -2
- package/src/page_project-list-generate-project-list-ID.html +0 -3
- package/src/page_project-list-vat.html +0 -4
- package/src/page_project-list-with-new-share-popup-android.html +1 -3
- package/src/page_project-list-with-new-share-popup-ios.html +1 -3
- package/src/page_project-list-with-new-share-popup.html +1 -2
- package/src/page_search-results.html +7 -2
- package/src/page_shared-project-list-bicester-hub.html +1 -3
- package/src/page_tradepro-discount-app.html +1 -1
- package/src/page_tradepro-discount-double.html +109 -0
- package/src/page_tradepro-discount.html +36 -2
- package/src/scss/common/_common.scss +4 -5
- package/src/scss/components/_accordion.scss +3 -1
- package/src/scss/components/_custom-slider.scss +14 -15
- package/src/scss/components/_date-selection-add-new-styles.scss +7 -6
- package/src/scss/components/_date-selection.scss +1 -1
- package/src/scss/components/_popover-mini-basket.scss +3 -3
- package/src/scss/components/_search-filter.scss +15 -95
- package/src/scss/components/checkout-chip.scss +2 -2
- package/src/scss/components/checkout-payment-repayment-terms.scss +1 -1
- package/src/scss/components/{_filter-modal.scss → kitchen/_filter-modal.scss} +4 -55
- package/src/scss/components/{_plp-filters.scss → kitchen/_plp-filters.scss} +13 -31
- package/src/scss/components/my-account/_barcode.scss +8 -0
- package/src/scss/components/my-account/_cards-swap.scss +58 -0
- package/src/scss/components/my-account/_clipboard-code.scss +8 -0
- package/src/scss/components/my-account/_discount.scss +10 -0
- package/src/scss/globals/_global-components.scss +0 -3
- package/src/scss/helpers/_colors-semantic.scss +68 -68
- package/src/scss/helpers/_variables.scss +196 -242
- package/src/scss/kitchen-plp-main.scss +3 -0
- package/src/scss/main.scss +65 -65
- package/src/scss/pages/my-account-v2.scss +37 -0
- package/src/scss/pages/page_discount.scss +8 -4
- package/src/scss/pages/page_product-details-v2.scss +4 -1
- package/src/scss/pages/page_product_search.scss +1 -9
- package/src/scss/pages/page_products-list-combined.scss +24 -28
- package/src/scss/pages/page_products-list.scss +0 -8
- package/src/scss/pages/tradePro-rewards.scss +4 -3
- package/src/sitemap.html +3 -0
- package/build/js/page/filters/desktop-nav.js +0 -64
- package/build/js/page/filters/mobile-nav.js +0 -93
- package/build/js/page/filters/plp-filters-chips.js +0 -92
- package/build/js/page/filters/plp-filters-mobile.js +0 -150
- package/build/js/page/filters/plp-filters-panel.js +0 -123
- package/build/js/page/filters/plp-filters-utils.js +0 -66
- package/build/js/page/filters/plp-filters.js +0 -256
- package/build/js/page/filters/sort-by.js +0 -172
- package/build/js/page/search-filter.js +0 -62
- package/build/js/page/share-project-list.js +0 -57
- package/build/js/page/utils/show-more-less.js +0 -273
- package/src/components/kitchen/filter-modal-content-kitchen.hbs +0 -10
- package/src/components/search-filter-modal-content.hbs +0 -102
- package/src/elements/btn.hbs +0 -7
- package/src/js/emulation/filters-emulation.js +0 -164
- package/src/js/emulation/product-counter.js +0 -50
- package/src/js/emulation/reset-filter-desktop.js +0 -5
- package/src/js/page/filters/desktop-nav.js +0 -64
- package/src/js/page/filters/mobile-nav.js +0 -93
- package/src/js/page/filters/plp-filters-chips.js +0 -92
- package/src/js/page/filters/plp-filters-mobile.js +0 -150
- package/src/js/page/filters/plp-filters-panel.js +0 -123
- package/src/js/page/filters/plp-filters-utils.js +0 -66
- package/src/js/page/filters/plp-filters.js +0 -256
- package/src/js/page/filters/sort-by.js +0 -172
- package/src/js/page/search-filter.js +0 -62
- package/src/js/page/share-project-list.js +0 -57
- package/src/js/page/utils/show-more-less.js +0 -273
- package/src/scss/components/_sort-by.scss +0 -190
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import btn from '../../../elements/btn.hbs';
|
|
2
|
-
|
|
3
|
-
// ===== HELPERS =====
|
|
4
|
-
|
|
5
|
-
function normalizeOptions(options) {
|
|
6
|
-
return {
|
|
7
|
-
groupSel: '.accordion.filter',
|
|
8
|
-
panelSel: '.accordion__content-inner',
|
|
9
|
-
itemSel: '.filter__item',
|
|
10
|
-
|
|
11
|
-
ctaAppendToSel: '.accordion__content-inner',
|
|
12
|
-
ctaClass: 'filter__facet-cta',
|
|
13
|
-
ctaAction: 'more',
|
|
14
|
-
ctaActionAttr: 'data-action',
|
|
15
|
-
|
|
16
|
-
toggleSel: '.accordion__header',
|
|
17
|
-
|
|
18
|
-
stateKey: 'showMoreLessState',
|
|
19
|
-
stepAttr: 'data-facet-step',
|
|
20
|
-
defaultStep: 5,
|
|
21
|
-
|
|
22
|
-
excludeGroup: null,
|
|
23
|
-
|
|
24
|
-
moreText: 'Show more',
|
|
25
|
-
lessText: 'Show less',
|
|
26
|
-
|
|
27
|
-
...options,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function makeSelectors(opt) {
|
|
32
|
-
return {
|
|
33
|
-
GROUP: opt.groupSel,
|
|
34
|
-
PANEL: opt.panelSel,
|
|
35
|
-
ITEM: opt.itemSel,
|
|
36
|
-
TOGGLE: opt.toggleSel || null,
|
|
37
|
-
|
|
38
|
-
CTA: `.${opt.ctaClass}`,
|
|
39
|
-
CTA_APPEND_TO: opt.ctaAppendToSel,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function isExcluded($group, excludeFn) {
|
|
44
|
-
return typeof excludeFn === 'function' ? !!excludeFn($group) : false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function getPanel($group, sel) {
|
|
48
|
-
return $group.find(sel.PANEL).first();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function getItems($group, sel) {
|
|
52
|
-
const $panel = getPanel($group, sel);
|
|
53
|
-
if (!$panel.length) return $();
|
|
54
|
-
|
|
55
|
-
const $direct = $panel.children(sel.ITEM);
|
|
56
|
-
return $direct.length ? $direct : $panel.find(sel.ITEM);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function getStep($group, stepAttr, defaultStep) {
|
|
60
|
-
const raw = ($group.attr(stepAttr) || '').trim();
|
|
61
|
-
const n = parseInt(raw, 10);
|
|
62
|
-
return Number.isFinite(n) && n > 0 ? n : defaultStep;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function getState($group, stateKey, total, step) {
|
|
66
|
-
let state = $group.data(stateKey);
|
|
67
|
-
|
|
68
|
-
if (!state) state = { visible: step, total };
|
|
69
|
-
|
|
70
|
-
state.total = total;
|
|
71
|
-
|
|
72
|
-
if (!state.visible || state.visible < step) state.visible = step;
|
|
73
|
-
if (state.visible > total) state.visible = total;
|
|
74
|
-
|
|
75
|
-
$group.data(stateKey, state);
|
|
76
|
-
return state;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function setInitialState($group, stateKey, total, step) {
|
|
80
|
-
$group.data(stateKey, { visible: step, total });
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function getGroups($root, groupSel) {
|
|
84
|
-
const $scope = $root && $root.length ? $root : $(document);
|
|
85
|
-
const $self = $scope.is(groupSel) ? $scope : $();
|
|
86
|
-
const $found = $scope.find(groupSel);
|
|
87
|
-
return $self.add($found);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// ===== CTA helpers =====
|
|
91
|
-
|
|
92
|
-
function getCta($group, sel) {
|
|
93
|
-
return $group.find(sel.CTA).first();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function removeCta($group, sel) {
|
|
97
|
-
const $cta = getCta($group, sel);
|
|
98
|
-
if ($cta.length) $cta.remove();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function ensureCta($group, sel, opt) {
|
|
102
|
-
let $cta = getCta($group, sel);
|
|
103
|
-
if ($cta.length) return $cta;
|
|
104
|
-
|
|
105
|
-
const $appendTo = $group.find(sel.CTA_APPEND_TO).first();
|
|
106
|
-
if (!$appendTo.length) return $();
|
|
107
|
-
|
|
108
|
-
const html = btn({
|
|
109
|
-
text: opt.moreText,
|
|
110
|
-
class: opt.ctaClass,
|
|
111
|
-
action: opt.ctaAction,
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
$appendTo.append(html);
|
|
115
|
-
|
|
116
|
-
$cta = getCta($group, sel);
|
|
117
|
-
|
|
118
|
-
if ($cta.length && !$cta.attr(opt.ctaActionAttr)) {
|
|
119
|
-
$cta.attr(opt.ctaActionAttr, opt.ctaAction);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return $cta;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function setCtaState($cta, mode, opt) {
|
|
126
|
-
if (!$cta || !$cta.length) return;
|
|
127
|
-
|
|
128
|
-
if (mode === 'less') {
|
|
129
|
-
$cta.text(opt.lessText).attr(opt.ctaActionAttr, 'less').show();
|
|
130
|
-
} else {
|
|
131
|
-
$cta.text(opt.moreText).attr(opt.ctaActionAttr, 'more').show();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// ===== CORE ACTIONS =====
|
|
136
|
-
|
|
137
|
-
function applyGroup($group, opt, sel) {
|
|
138
|
-
if (!$group || !$group.length) return;
|
|
139
|
-
|
|
140
|
-
// excluded -> CTA never exists
|
|
141
|
-
if (isExcluded($group, opt.excludeGroup)) {
|
|
142
|
-
removeCta($group, sel);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const $items = getItems($group, sel);
|
|
147
|
-
const total = $items.length;
|
|
148
|
-
const step = getStep($group, opt.stepAttr, opt.defaultStep);
|
|
149
|
-
|
|
150
|
-
// 0 items -> no CTA
|
|
151
|
-
if (total === 0) {
|
|
152
|
-
removeCta($group, sel);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const state = getState($group, opt.stateKey, total, step);
|
|
157
|
-
|
|
158
|
-
// show/hide items
|
|
159
|
-
$items.each(function (idx) {
|
|
160
|
-
$(this).toggle(idx < state.visible);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
// <= step -> CTA not needed
|
|
164
|
-
if (total <= step) {
|
|
165
|
-
removeCta($group, sel);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// > step -> ensure CTA exists and update it
|
|
170
|
-
const $cta = ensureCta($group, sel, opt);
|
|
171
|
-
if (!$cta.length) return;
|
|
172
|
-
|
|
173
|
-
if (state.visible >= total) setCtaState($cta, 'less', opt);
|
|
174
|
-
else setCtaState($cta, 'more', opt);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function expandGroup($group, opt, sel) {
|
|
178
|
-
if (!$group || !$group.length) return;
|
|
179
|
-
if (isExcluded($group, opt.excludeGroup)) return;
|
|
180
|
-
|
|
181
|
-
const total = getItems($group, sel).length;
|
|
182
|
-
if (!total) return;
|
|
183
|
-
|
|
184
|
-
const step = getStep($group, opt.stepAttr, opt.defaultStep);
|
|
185
|
-
const state = getState($group, opt.stateKey, total, step);
|
|
186
|
-
|
|
187
|
-
state.visible = Math.min(state.visible + step, total);
|
|
188
|
-
$group.data(opt.stateKey, state);
|
|
189
|
-
|
|
190
|
-
applyGroup($group, opt, sel);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function collapseGroupToInitial($group, opt, sel) {
|
|
194
|
-
if (!$group || !$group.length) return;
|
|
195
|
-
|
|
196
|
-
if (isExcluded($group, opt.excludeGroup)) {
|
|
197
|
-
removeCta($group, sel);
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const total = getItems($group, sel).length;
|
|
202
|
-
const step = getStep($group, opt.stepAttr, opt.defaultStep);
|
|
203
|
-
|
|
204
|
-
setInitialState($group, opt.stateKey, total, step);
|
|
205
|
-
applyGroup($group, opt, sel);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// ===== MAIN FACTORY =====
|
|
209
|
-
|
|
210
|
-
export function createShowMoreLess(options = {}) {
|
|
211
|
-
const OPT = normalizeOptions(options);
|
|
212
|
-
const SEL = makeSelectors(OPT);
|
|
213
|
-
|
|
214
|
-
if (!SEL.GROUP || !SEL.PANEL || !SEL.ITEM) {
|
|
215
|
-
throw new Error('[createShowMoreLess] Missing required selectors');
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// namespace for delegated events (avoid duplicates if factory created multiple times)
|
|
219
|
-
const NS = `.sml_${Math.random().toString(16).slice(2)}`;
|
|
220
|
-
|
|
221
|
-
function init($root) {
|
|
222
|
-
getGroups($root, SEL.GROUP).each(function () {
|
|
223
|
-
const $group = $(this);
|
|
224
|
-
|
|
225
|
-
if (isExcluded($group, OPT.excludeGroup)) {
|
|
226
|
-
removeCta($group, SEL);
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const total = getItems($group, SEL).length;
|
|
231
|
-
const step = getStep($group, OPT.stepAttr, OPT.defaultStep);
|
|
232
|
-
|
|
233
|
-
setInitialState($group, OPT.stateKey, total, step);
|
|
234
|
-
applyGroup($group, OPT, SEL);
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function resetAll($root) {
|
|
239
|
-
getGroups($root, SEL.GROUP).each(function () {
|
|
240
|
-
collapseGroupToInitial($(this), OPT, SEL);
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// CTA click
|
|
245
|
-
$(document)
|
|
246
|
-
.off(`click${NS}`, SEL.CTA)
|
|
247
|
-
.on(`click${NS}`, SEL.CTA, function (e) {
|
|
248
|
-
e.preventDefault();
|
|
249
|
-
|
|
250
|
-
const $cta = $(this);
|
|
251
|
-
const $group = $cta.closest(SEL.GROUP);
|
|
252
|
-
|
|
253
|
-
if (!$group.length || isExcluded($group, OPT.excludeGroup)) return;
|
|
254
|
-
|
|
255
|
-
const action = ($cta.attr(OPT.ctaActionAttr) || 'more').toLowerCase();
|
|
256
|
-
|
|
257
|
-
if (action === 'less') collapseGroupToInitial($group, OPT, SEL);
|
|
258
|
-
else expandGroup($group, OPT, SEL);
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
// Toggle/header click -> collapse to initial
|
|
262
|
-
if (SEL.TOGGLE) {
|
|
263
|
-
$(document)
|
|
264
|
-
.off(`click${NS}`, SEL.TOGGLE)
|
|
265
|
-
.on(`click${NS}`, SEL.TOGGLE, function () {
|
|
266
|
-
const $group = $(this).closest(SEL.GROUP);
|
|
267
|
-
if (!$group.length || isExcluded($group, OPT.excludeGroup)) return;
|
|
268
|
-
collapseGroupToInitial($group, OPT, SEL);
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
return { init, resetAll };
|
|
273
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{{#with kitchen-plp}}
|
|
2
|
-
{{> kitchen/chips mod="mobile"}}
|
|
3
|
-
{{#each filters}}
|
|
4
|
-
{{#extend "accordion" header=name collapsed="accordion_collapsed" hidden="hidden-state"}}
|
|
5
|
-
{{#content "content"}}
|
|
6
|
-
{{> kitchen/filter-option }}
|
|
7
|
-
{{/content}}
|
|
8
|
-
{{/extend}}
|
|
9
|
-
{{/each}}
|
|
10
|
-
{{/with}}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
<form class="filter-results filter-results_mobile">
|
|
2
|
-
{{#extend "accordion" collapsed="accordion_collapsed" hidden="hidden-state" header="Color Family" mod="filter" facetStep="5" }}
|
|
3
|
-
{{#content "content"}}
|
|
4
|
-
{{#each filters.colors}}
|
|
5
|
-
<div class="filter__item">
|
|
6
|
-
<label for="m-{{id}}" class="chb chb-color">
|
|
7
|
-
<input type="checkbox" value="{{label}}" id="m-{{id}}" name="{{id}}-filter">
|
|
8
|
-
<ins><i class="fas fa-check"></i></ins>
|
|
9
|
-
<span>{{label}}</span>
|
|
10
|
-
</label>
|
|
11
|
-
</div>
|
|
12
|
-
{{/each}}
|
|
13
|
-
{{/content}}
|
|
14
|
-
{{/extend}}
|
|
15
|
-
{{#extend "accordion" collapsed="accordion_collapsed" hidden="hidden-state" header="Shop by category" mod="filter category-filter" fixed-height=""}}
|
|
16
|
-
{{#content "content"}}
|
|
17
|
-
{{>category-tree filters}}
|
|
18
|
-
{{/content}}
|
|
19
|
-
{{/extend}}
|
|
20
|
-
{{#extend "accordion" collapsed="accordion_collapsed" hidden="hidden-state" header="Shop by pack quantity" mod="filter" facetStep="5"}}
|
|
21
|
-
{{#content "content"}}
|
|
22
|
-
{{/content}}
|
|
23
|
-
{{/extend}}
|
|
24
|
-
{{#extend "accordion" collapsed="accordion_collapsed" hidden="hidden-state" header="Shop by type" mod="filter" facetStep="5"}}
|
|
25
|
-
{{#content "content"}}
|
|
26
|
-
{{#each filters.type-list}}
|
|
27
|
-
<div class="filter__item">
|
|
28
|
-
<label for="m-{{id}}" class="chb chb-{{classForGtm}}">
|
|
29
|
-
<input type="checkbox" value="{{value}}" id="m-{{id}}"
|
|
30
|
-
name="m-{{id}}" {{#if checked}}checked{{/if}} {{#if disabled}}disabled{{/if}}>
|
|
31
|
-
<ins><i class="fas fa-check"></i></ins>
|
|
32
|
-
<span>{{label}}</span>
|
|
33
|
-
<span class="filter-quantity">({{quantity}})</span>
|
|
34
|
-
</label>
|
|
35
|
-
</div>
|
|
36
|
-
{{/each}}
|
|
37
|
-
{{/content}}
|
|
38
|
-
{{/extend}}
|
|
39
|
-
{{#extend "accordion" collapsed="accordion_collapsed" hidden="hidden-state" header="Customer Rating" mod="filter" facetStep="5"}}
|
|
40
|
-
{{#content "content"}}
|
|
41
|
-
{{#each filters.rated}}
|
|
42
|
-
<div class="filter__item">
|
|
43
|
-
{{#ifvalue quantity value='0'}}
|
|
44
|
-
{{else}}
|
|
45
|
-
<label class="chb chb-{{classForGtm}}">
|
|
46
|
-
<input type="checkbox" value="{{value}}" id="{{id}}" name="{{id}}" {{#if checked}}checked{{/if}} {{#if
|
|
47
|
-
disabled}}disabled{{/if}}>
|
|
48
|
-
<ins><i class="fas fa-check"></i></ins>
|
|
49
|
-
<div class="filter__reviews">
|
|
50
|
-
<div class="product-rating">
|
|
51
|
-
<div class="rating-bg">
|
|
52
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
53
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
54
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
55
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
56
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
57
|
-
<div class="rating-overlay" data-rating="{{#if rating}}{{rating}}{{else}}0{{/if}}">
|
|
58
|
-
<span class="star-overlay">
|
|
59
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
60
|
-
</span>
|
|
61
|
-
<span class="star-overlay">
|
|
62
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
63
|
-
</span>
|
|
64
|
-
<span class="star-overlay">
|
|
65
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
66
|
-
</span>
|
|
67
|
-
<span class="star-overlay">
|
|
68
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
69
|
-
</span>
|
|
70
|
-
<span class="star-overlay">
|
|
71
|
-
<i class="fa fa-star" aria-hidden="true"></i>
|
|
72
|
-
</span>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
({{quantity}})
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
</label>
|
|
79
|
-
{{/ifvalue}}
|
|
80
|
-
</div>
|
|
81
|
-
{{/each}}
|
|
82
|
-
{{/content}}
|
|
83
|
-
{{/extend}}
|
|
84
|
-
{{#extend "accordion" collapsed="accordion_collapsed" hidden="hidden-state" header="Shop by bulb shape" mod="filter" facetStep="5"}}
|
|
85
|
-
{{#content "content"}}
|
|
86
|
-
{{/content}}
|
|
87
|
-
{{/extend}}
|
|
88
|
-
{{#extend "accordion" collapsed="accordion_collapsed" hidden="hidden-state" header="Shop by number of gangs" mod="filter" facetStep="5"}}
|
|
89
|
-
{{#content "content"}}
|
|
90
|
-
{{/content}}
|
|
91
|
-
{{/extend}}
|
|
92
|
-
{{#extend "accordion" collapsed="accordion_collapsed" hidden="hidden-state" header="Shop by bulb fitting" mod="filter" facetStep="5"}}
|
|
93
|
-
{{#content "content"}}
|
|
94
|
-
{{/content}}
|
|
95
|
-
{{/extend}}
|
|
96
|
-
{{#extend "accordion" collapsed="accordion_collapsed" hidden="hidden-state" header="Shop by wattage" mod="filter" facetStep="5"}}
|
|
97
|
-
{{#content "content"}}
|
|
98
|
-
{{/content}}
|
|
99
|
-
{{/extend}}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
</form>
|
package/src/elements/btn.hbs
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { createShowMoreLess } from '../page/utils/show-more-less';
|
|
2
|
-
|
|
3
|
-
var Wick = window.Wick || (window.Wick = {});
|
|
4
|
-
|
|
5
|
-
function waitFor(getter, cb, opts) {
|
|
6
|
-
opts = opts || {};
|
|
7
|
-
var timeout = opts.timeout || 8000;
|
|
8
|
-
var interval = opts.interval || 50;
|
|
9
|
-
|
|
10
|
-
var start = Date.now();
|
|
11
|
-
(function tick() {
|
|
12
|
-
var val;
|
|
13
|
-
try {
|
|
14
|
-
val = getter();
|
|
15
|
-
} catch (e) {
|
|
16
|
-
val = null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (val) {
|
|
20
|
-
cb(val);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (Date.now() - start > timeout) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
setTimeout(tick, interval);
|
|
29
|
-
})();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// show-more-less
|
|
33
|
-
(function () {
|
|
34
|
-
const SEL = {
|
|
35
|
-
OPEN: '#open-overlay',
|
|
36
|
-
CLOSE: '#close-overlay, .filter-results__btn-close',
|
|
37
|
-
FILTER_RESULT: '.filter-results_desktop',
|
|
38
|
-
FILTER_MOBILE: '.filter-results_mobile',
|
|
39
|
-
CATEGORY: '.filter__item--category',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const SRPShowMoreLess = createShowMoreLess({
|
|
43
|
-
excludeGroup: ($group) => $group.hasClass(SEL.CATEGORY),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
function initInScope() {
|
|
47
|
-
const $fm = $(SEL.FILTER_MOBILE);
|
|
48
|
-
SRPShowMoreLess.init($(SEL.FILTER_RESULT));
|
|
49
|
-
SRPShowMoreLess.init($fm);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function resetInMobile() {
|
|
53
|
-
const $fm = $(SEL.FILTER_MOBILE);
|
|
54
|
-
SRPShowMoreLess.resetAll($fm);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
$(function () {
|
|
58
|
-
initInScope();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
$(document)
|
|
62
|
-
.off('click.srpSmlEmu', SEL.OPEN)
|
|
63
|
-
.on('click.srpSmlEmu', SEL.OPEN, function (e) {
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
initInScope();
|
|
66
|
-
resetInMobile();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
$(document)
|
|
70
|
-
.off('click.srpSmlEmu', SEL.CLOSE)
|
|
71
|
-
.on('click.srpSmlEmu', SEL.CLOSE, function (e) {
|
|
72
|
-
e.preventDefault();
|
|
73
|
-
resetInMobile();
|
|
74
|
-
});
|
|
75
|
-
})();
|
|
76
|
-
|
|
77
|
-
(function () {
|
|
78
|
-
waitFor(
|
|
79
|
-
function () {
|
|
80
|
-
return Wick.Sort;
|
|
81
|
-
},
|
|
82
|
-
function (Sort) {
|
|
83
|
-
Sort.ROOT = '.products-list-page:not(.page-KitchenPLPPage)';
|
|
84
|
-
Wick.Sort.ROOT = Sort.ROOT;
|
|
85
|
-
|
|
86
|
-
var $root = $(Sort.ROOT);
|
|
87
|
-
if (!$root.length) return;
|
|
88
|
-
|
|
89
|
-
if (Sort.__emuBound) return;
|
|
90
|
-
Sort.__emuBound = true;
|
|
91
|
-
|
|
92
|
-
$root.off('click', Sort.TRIGGER_MOBILE);
|
|
93
|
-
$root.off('click', Sort.TRIGGER_DESKTOP_BTN);
|
|
94
|
-
$root.off('keydown', Sort.TRIGGER_MOBILE + ', ' + Sort.TRIGGER_DESKTOP_BTN);
|
|
95
|
-
$root.off('click', Sort.OPTION);
|
|
96
|
-
|
|
97
|
-
$root.on('click', Sort.TRIGGER_MOBILE, function (e) {
|
|
98
|
-
e.stopPropagation();
|
|
99
|
-
|
|
100
|
-
if ($(e.target).closest(Sort.DROPDOWN).length) return;
|
|
101
|
-
e.preventDefault();
|
|
102
|
-
Sort.toggle($(e.currentTarget));
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
$root.on('click', Sort.TRIGGER_DESKTOP_BTN, function (e) {
|
|
106
|
-
e.stopPropagation();
|
|
107
|
-
|
|
108
|
-
e.preventDefault();
|
|
109
|
-
Sort.toggle($(e.currentTarget).closest(Sort.WRAP));
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
$root.on(
|
|
113
|
-
'keydown',
|
|
114
|
-
Sort.TRIGGER_MOBILE + ', ' + Sort.TRIGGER_DESKTOP_BTN,
|
|
115
|
-
function (e) {
|
|
116
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
117
|
-
e.stopPropagation();
|
|
118
|
-
e.preventDefault();
|
|
119
|
-
Sort.toggle($(e.currentTarget).closest(Sort.WRAP));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
$root.on('click', Sort.OPTION, function (e) {
|
|
125
|
-
e.preventDefault();
|
|
126
|
-
e.stopPropagation();
|
|
127
|
-
|
|
128
|
-
var opt = $(e.currentTarget);
|
|
129
|
-
var value = opt.data('value');
|
|
130
|
-
var label = Sort.valueToLabel(value);
|
|
131
|
-
|
|
132
|
-
if (opt.data('is-plp-srp')) {
|
|
133
|
-
var wrap = opt.closest(Sort.WRAP);
|
|
134
|
-
wrap.find(Sort.OPTION).removeClass('is-active');
|
|
135
|
-
opt.addClass('is-active');
|
|
136
|
-
|
|
137
|
-
$(Sort.INFO).text(label);
|
|
138
|
-
Sort.closeAll();
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
Sort.updateSortParamInURL(value);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
(function bootstrapEmu() {
|
|
146
|
-
var urlParams = new URLSearchParams(window.location.search);
|
|
147
|
-
var value = urlParams.get('sortBy') || 'relevance';
|
|
148
|
-
var label = Sort.valueToLabel(value);
|
|
149
|
-
|
|
150
|
-
var $wraps = $root.find(Sort.WRAP);
|
|
151
|
-
|
|
152
|
-
$wraps.each(function (_, el) {
|
|
153
|
-
var w = $(el);
|
|
154
|
-
w.find(Sort.OPTION)
|
|
155
|
-
.removeClass('is-active')
|
|
156
|
-
.filter('[data-value="' + value + '"]')
|
|
157
|
-
.addClass('is-active');
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
$(Sort.INFO).text(label);
|
|
161
|
-
})();
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
})();
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var Wick = Wick || {};
|
|
2
|
-
|
|
3
|
-
Wick.ProductCounter = (function () {
|
|
4
|
-
let _count = 0;
|
|
5
|
-
|
|
6
|
-
function triggerChange() {
|
|
7
|
-
$(document).trigger('productCounter:change', [_count]);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function setCount(val) {
|
|
11
|
-
const next = Number(val) || 0;
|
|
12
|
-
if (_count === next) return;
|
|
13
|
-
|
|
14
|
-
_count = next;
|
|
15
|
-
triggerChange();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function recalcFromFilters() {
|
|
19
|
-
const checked = $('.filter-results input[type="checkbox"]:checked').length;
|
|
20
|
-
|
|
21
|
-
if (checked === 0) setCount(0);
|
|
22
|
-
else if (checked === 1) setCount(1);
|
|
23
|
-
else setCount(1838);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function bind() {
|
|
27
|
-
$(document).on('change', '.filter-results input[type="checkbox"]', recalcFromFilters);
|
|
28
|
-
|
|
29
|
-
recalcFromFilters();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
get count() {
|
|
34
|
-
return _count;
|
|
35
|
-
},
|
|
36
|
-
set count(val) {
|
|
37
|
-
setCount(val);
|
|
38
|
-
},
|
|
39
|
-
recalc: recalcFromFilters,
|
|
40
|
-
bind: bind,
|
|
41
|
-
};
|
|
42
|
-
})();
|
|
43
|
-
|
|
44
|
-
$(document).ready(function () {
|
|
45
|
-
if (Wick.ProjectListMultiple && typeof Wick.ProjectListMultiple.bindAll === 'function') {
|
|
46
|
-
Wick.ProjectListMultiple.bindAll();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
Wick.ProductCounter.bind();
|
|
50
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
function formatNumberInElement(selector) {
|
|
2
|
-
const formatter = new Intl.NumberFormat('en-GB');
|
|
3
|
-
|
|
4
|
-
document.querySelectorAll(selector).forEach((el) => {
|
|
5
|
-
const rawText = el.textContent.trim();
|
|
6
|
-
|
|
7
|
-
const number = Number(rawText.replace(/[^\d]/g, ''));
|
|
8
|
-
|
|
9
|
-
if (!Number.isNaN(number)) {
|
|
10
|
-
el.textContent = formatter.format(number);
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
(function () {
|
|
16
|
-
const SELECTORS = {
|
|
17
|
-
$sidebar: $('.filter-results_desktop'),
|
|
18
|
-
$heading: $('.filter-results__heading'),
|
|
19
|
-
$offerBanner: $('.offer-banner'),
|
|
20
|
-
$offerBannerIndent: 40,
|
|
21
|
-
offerBannerCloseIcon:
|
|
22
|
-
'.icon.notification__close, .icon.notification__close_white, .notification__close',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
function isDesktop() {
|
|
26
|
-
return Wick.Responsive.getCurrentBreakpoint() !== 'down-sm';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getOfferBannerHeight() {
|
|
30
|
-
if (!SELECTORS.$offerBanner.length) return SELECTORS.$offerBannerIndent;
|
|
31
|
-
return SELECTORS.$offerBanner.outerHeight(true) + SELECTORS.$offerBannerIndent || 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function applyTop() {
|
|
35
|
-
if (!SELECTORS.$sidebar.length) return;
|
|
36
|
-
|
|
37
|
-
if (!isDesktop()) {
|
|
38
|
-
SELECTORS.$sidebar.css('top', '');
|
|
39
|
-
SELECTORS.$heading.css('top', '');
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const top = getOfferBannerHeight();
|
|
44
|
-
|
|
45
|
-
SELECTORS.$sidebar.css('top', top + 'px');
|
|
46
|
-
|
|
47
|
-
if (SELECTORS.$heading.length) {
|
|
48
|
-
SELECTORS.$heading.css('top', top + 'px');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function setupOfferBannerCloseHook() {
|
|
53
|
-
$(document).on('click', SELECTORS.offerBannerCloseIcon, function () {
|
|
54
|
-
setTimeout(applyTop, 0);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
$(document).ready(function () {
|
|
59
|
-
formatNumberInElement('.product-count');
|
|
60
|
-
applyTop();
|
|
61
|
-
$(window).on('resize', _.debounce(applyTop, 100));
|
|
62
|
-
setupOfferBannerCloseHook();
|
|
63
|
-
});
|
|
64
|
-
})();
|