wickes-css2 2.105.0-develop.7 → 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.
Files changed (211) hide show
  1. package/Readme.md +2 -2
  2. package/build/css/category-main.css +1 -1
  3. package/build/css/homepage-main.css +1 -1
  4. package/build/css/kitchen-plp-main.css +1 -1
  5. package/build/css/main.css +1 -1
  6. package/build/css/my-account-main-v2.css +1 -1
  7. package/build/css/my-account-main.css +1 -1
  8. package/build/css/pages/my-account-v2.css +1 -1
  9. package/build/css/pages/page_discount.css +1 -1
  10. package/build/css/pages/page_product_search.css +1 -1
  11. package/build/css/pages/page_products-list-combined.css +1 -1
  12. package/build/css/pages/page_products-list.css +1 -1
  13. package/build/css/pages/tradePro-rewards.css +1 -1
  14. package/build/css/pdp-main-before-combine.css +1 -1
  15. package/build/css/pdp-main-non-critical.css +1 -1
  16. package/build/css/pdp-main.css +1 -1
  17. package/build/css/plp-main.css +1 -1
  18. package/build/css/store-locator-main.css +1 -1
  19. package/build/js/basket.min.js +2 -2
  20. package/build/js/bundle.min.js +1 -1
  21. package/build/js/checkout.min.js +2 -2
  22. package/build/js/emulation.min.js +10255 -10784
  23. package/build/js/general.bundle.min.js +1 -1
  24. package/build/js/kitchen/kitchen-plp.min.js +9 -1
  25. package/build/js/merged-checkout.min.js +2 -2
  26. package/build/js/mini-basket-slider.min.js +1 -1
  27. package/build/js/my-account.min.js +1 -1
  28. package/build/js/page/accordion.js +35 -0
  29. package/build/js/page/basket/basket-update-cart-action.js +56 -59
  30. package/build/js/page/basket/basket-update-cart.js +27 -27
  31. package/build/js/page/basket/basket-utils.js +33 -40
  32. package/build/js/page/basket/mini-basket-total.js +66 -70
  33. package/build/js/page/basket/quantity-change-handler.js +55 -73
  34. package/build/js/page/basket/update-quantity-operation.js +30 -39
  35. package/build/js/page/basket/update-quantity.js +62 -62
  36. package/build/js/page/basket-v2.js +229 -362
  37. package/build/js/page/billie-business-type.js +27 -27
  38. package/build/js/page/checkout-payment-details.js +299 -301
  39. package/build/js/page/components/discounts.js +36 -39
  40. package/build/js/page/components/mini-basket-slider.js +545 -604
  41. package/build/js/page/kitchen/plp-filters-chips.js +90 -0
  42. package/build/js/page/kitchen/plp-filters-mobile.js +72 -0
  43. package/build/js/page/kitchen/plp-filters-panel.js +119 -0
  44. package/build/js/page/kitchen/plp-filters-utils.js +65 -0
  45. package/build/js/page/kitchen/plp-filters.js +205 -0
  46. package/build/js/page/kitchen/sort-by.js +157 -0
  47. package/build/js/page/klarna-modal-scroll-disable.js +4 -4
  48. package/build/js/page/my-account.js +14 -29
  49. package/build/js/page/online-exclusive.js +30 -28
  50. package/build/js/page/tradePro-rewards.js +39 -69
  51. package/build/js/page/utils/copy-to-clipboard.js +47 -79
  52. package/build/js/page/utils/helpers.js +9 -14
  53. package/build/js/pdp.bundle.min.js +1 -1
  54. package/build/js/plp.bundle.min.js +1 -1
  55. package/build/js/project-list.min.js +85 -143
  56. package/build/js/tradePro-rewards.min.js +1 -1
  57. package/package.json +3 -3
  58. package/src/components/.DS_Store +0 -0
  59. package/src/components/accordion.hbs +2 -2
  60. package/src/components/kitchen/dropdown.hbs +3 -6
  61. package/src/components/kitchen/filter-modal.hbs +13 -10
  62. package/src/components/kitchen/plp-filters.hbs +1 -3
  63. package/src/components/kitchen/sort-by.hbs +1 -1
  64. package/src/components/my-account/barcode.hbs +1 -3
  65. package/src/components/my-account/cards-swap.hbs +10 -0
  66. package/src/components/my-account/clipboard-code-card.hbs +3 -3
  67. package/src/components/my-account/discount.hbs +1 -1
  68. package/src/components/my-account/greetings.hbs +1 -1
  69. package/src/components/search-filter.hbs +112 -121
  70. package/src/data/data_plp_load-more.json +1 -1
  71. package/src/data/my-account/data_my-account.json +9 -0
  72. package/src/js/components/cards-swap.js +72 -0
  73. package/src/js/components/general/accordion.js +33 -44
  74. package/src/js/components/general/cart-slider.js +16 -19
  75. package/src/js/components/general/create-popup-slider.js +173 -168
  76. package/src/js/components/general/search-filter.js +21 -0
  77. package/src/js/components/share-project-list.js +53 -0
  78. package/src/js/emulation/big-wins.js +904 -1081
  79. package/src/js/emulation/billie-modal.js +19 -23
  80. package/src/js/emulation/checkout-payment-details.js +38 -47
  81. package/src/js/emulation/custom-slider-emulation.js +13 -17
  82. package/src/js/emulation/forms.js +323 -360
  83. package/src/js/emulation/mini-basket-data.js +923 -1051
  84. package/src/js/emulation/paymentLoader.js +17 -17
  85. package/src/js/emulation/pdf-file-loader.js +91 -89
  86. package/src/js/emulation/popover-mini-basket.js +239 -246
  87. package/src/js/emulation/project-list-pdp.js +316 -320
  88. package/src/js/emulation/repayment-toggle.js +24 -23
  89. package/src/js/emulation/selectable.js +18 -22
  90. package/src/js/emulation/wismo-details.js +31 -23
  91. package/src/js/page/accordion.js +35 -0
  92. package/src/js/page/basket/basket-update-cart-action.js +56 -59
  93. package/src/js/page/basket/basket-update-cart.js +27 -27
  94. package/src/js/page/basket/basket-utils.js +33 -40
  95. package/src/js/page/basket/mini-basket-total.js +66 -70
  96. package/src/js/page/basket/quantity-change-handler.js +55 -73
  97. package/src/js/page/basket/update-quantity-operation.js +30 -39
  98. package/src/js/page/basket/update-quantity.js +62 -62
  99. package/src/js/page/basket-v2.js +229 -362
  100. package/src/js/page/billie-business-type.js +27 -27
  101. package/src/js/page/checkout-payment-details.js +299 -301
  102. package/src/js/page/components/discounts.js +36 -39
  103. package/src/js/page/components/mini-basket-slider.js +545 -604
  104. package/src/js/page/kitchen/plp-filters-chips.js +90 -0
  105. package/src/js/page/kitchen/plp-filters-mobile.js +72 -0
  106. package/src/js/page/kitchen/plp-filters-panel.js +119 -0
  107. package/src/js/page/kitchen/plp-filters-utils.js +65 -0
  108. package/src/js/page/kitchen/plp-filters.js +205 -0
  109. package/src/js/page/kitchen/sort-by.js +157 -0
  110. package/src/js/page/klarna-modal-scroll-disable.js +4 -4
  111. package/src/js/page/my-account.js +14 -29
  112. package/src/js/page/online-exclusive.js +30 -28
  113. package/src/js/page/tradePro-rewards.js +39 -69
  114. package/src/js/page/utils/copy-to-clipboard.js +47 -79
  115. package/src/js/page/utils/helpers.js +9 -14
  116. package/src/page_empty-shared-project-list-bicester-hub.html +0 -4
  117. package/src/page_empty-shopping-list_guest.html +0 -1
  118. package/src/page_kitchen-plp.html +2 -2
  119. package/src/page_my-account-installer.html +1 -1
  120. package/src/page_my-account-trade-pro-carousel-double.html +127 -0
  121. package/src/page_my-account-trade-pro-carousel.html +134 -0
  122. package/src/page_my-account-trade-pro.html +1 -1
  123. package/src/page_my-shopping-list-add-notes.html +0 -1
  124. package/src/page_my-shopping-list-energy.html +0 -1
  125. package/src/page_my-shopping-list-hide-download.html +1 -2
  126. package/src/page_my-shopping-list-pdf.html +0 -2
  127. package/src/page_my-shopping-list-saved-ref.html +0 -1
  128. package/src/page_my-shopping-list-wisdom-oos-registered.html +0 -1
  129. package/src/page_my-shopping-list-wisdom-oos.html +0 -1
  130. package/src/page_my-shopping-list-wisdom-partial-registered.html +0 -1
  131. package/src/page_my-shopping-list-wisdom-registered.html +0 -1
  132. package/src/page_my-shopping-list-wisdom.html +0 -1
  133. package/src/page_my-shopping-list.html +0 -1
  134. package/src/page_my-shopping-list_not-register.html +0 -3
  135. package/src/page_plp-with-paint.html +7 -2
  136. package/src/page_plp.html +7 -2
  137. package/src/page_plp_v2-energy-efficiency.html +6 -1
  138. package/src/page_plp_v2-favourite-products.html +7 -6
  139. package/src/page_plp_v2-vat.html +7 -2
  140. package/src/page_plp_v2.html +9 -22
  141. package/src/page_product_search-vat.html +7 -2
  142. package/src/page_product_search.html +7 -2
  143. package/src/page_project-list-generate-project-list-ID.html +0 -3
  144. package/src/page_project-list-vat.html +0 -4
  145. package/src/page_project-list-with-new-share-popup-android.html +1 -3
  146. package/src/page_project-list-with-new-share-popup-ios.html +1 -3
  147. package/src/page_project-list-with-new-share-popup.html +1 -2
  148. package/src/page_search-results.html +7 -2
  149. package/src/page_shared-project-list-bicester-hub.html +1 -3
  150. package/src/page_tradepro-discount-app.html +1 -1
  151. package/src/page_tradepro-discount-double.html +109 -0
  152. package/src/page_tradepro-discount.html +36 -2
  153. package/src/scss/common/_common.scss +4 -5
  154. package/src/scss/components/_accordion.scss +3 -1
  155. package/src/scss/components/_custom-slider.scss +14 -15
  156. package/src/scss/components/_date-selection-add-new-styles.scss +7 -6
  157. package/src/scss/components/_date-selection.scss +1 -1
  158. package/src/scss/components/_popover-mini-basket.scss +3 -3
  159. package/src/scss/components/_search-filter.scss +15 -95
  160. package/src/scss/components/checkout-chip.scss +2 -2
  161. package/src/scss/components/checkout-payment-repayment-terms.scss +1 -1
  162. package/src/scss/components/{_filter-modal.scss → kitchen/_filter-modal.scss} +4 -55
  163. package/src/scss/components/{_plp-filters.scss → kitchen/_plp-filters.scss} +13 -31
  164. package/src/scss/components/my-account/_barcode.scss +8 -0
  165. package/src/scss/components/my-account/_cards-swap.scss +58 -0
  166. package/src/scss/components/my-account/_clipboard-code.scss +8 -0
  167. package/src/scss/components/my-account/_discount.scss +10 -0
  168. package/src/scss/globals/_global-components.scss +0 -3
  169. package/src/scss/helpers/_colors-semantic.scss +68 -68
  170. package/src/scss/helpers/_variables.scss +196 -242
  171. package/src/scss/kitchen-plp-main.scss +3 -0
  172. package/src/scss/main.scss +65 -65
  173. package/src/scss/pages/my-account-v2.scss +37 -0
  174. package/src/scss/pages/page_discount.scss +8 -4
  175. package/src/scss/pages/page_product-details-v2.scss +4 -1
  176. package/src/scss/pages/page_product_search.scss +1 -9
  177. package/src/scss/pages/page_products-list-combined.scss +24 -28
  178. package/src/scss/pages/page_products-list.scss +0 -8
  179. package/src/scss/pages/tradePro-rewards.scss +4 -3
  180. package/src/sitemap.html +3 -0
  181. package/build/js/page/filters/desktop-nav.js +0 -64
  182. package/build/js/page/filters/mobile-nav.js +0 -93
  183. package/build/js/page/filters/plp-filters-chips.js +0 -92
  184. package/build/js/page/filters/plp-filters-mobile.js +0 -150
  185. package/build/js/page/filters/plp-filters-panel.js +0 -123
  186. package/build/js/page/filters/plp-filters-utils.js +0 -66
  187. package/build/js/page/filters/plp-filters.js +0 -256
  188. package/build/js/page/filters/sort-by.js +0 -172
  189. package/build/js/page/search-filter.js +0 -62
  190. package/build/js/page/share-project-list.js +0 -57
  191. package/build/js/page/utils/show-more-less.js +0 -273
  192. package/build/js/plp-filters.min.js +0 -9
  193. package/build/js/search-filter.min.js +0 -1
  194. package/src/components/kitchen/filter-modal-content-kitchen.hbs +0 -10
  195. package/src/components/search-filter-modal-content.hbs +0 -102
  196. package/src/elements/btn.hbs +0 -7
  197. package/src/js/emulation/filters-emulation.js +0 -164
  198. package/src/js/emulation/product-counter.js +0 -50
  199. package/src/js/emulation/reset-filter-desktop.js +0 -5
  200. package/src/js/page/filters/desktop-nav.js +0 -64
  201. package/src/js/page/filters/mobile-nav.js +0 -93
  202. package/src/js/page/filters/plp-filters-chips.js +0 -92
  203. package/src/js/page/filters/plp-filters-mobile.js +0 -150
  204. package/src/js/page/filters/plp-filters-panel.js +0 -123
  205. package/src/js/page/filters/plp-filters-utils.js +0 -66
  206. package/src/js/page/filters/plp-filters.js +0 -256
  207. package/src/js/page/filters/sort-by.js +0 -172
  208. package/src/js/page/search-filter.js +0 -62
  209. package/src/js/page/share-project-list.js +0 -57
  210. package/src/js/page/utils/show-more-less.js +0 -273
  211. package/src/scss/components/_sort-by.scss +0 -190
@@ -2,18 +2,18 @@ var Wick = Wick || {};
2
2
 
3
3
  Wick.KlarnaModalScrollDisable = (function () {
4
4
  const $body = $('body'),
5
- klarnaPopUp = 'klarna-osm-interstitial',
6
- scrollDisableClass = 'overflow-hidden';
5
+ klarnaPopUp = 'klarna-osm-interstitial',
6
+ scrollDisableClass = 'overflow-hidden';
7
7
 
8
8
  window.addEventListener(klarnaPopUp, (e) => {
9
9
  let isKlarnaPopUpActive = e.detail.action === 'show';
10
10
 
11
11
  if (isKlarnaPopUpActive) {
12
12
  $body.addClass(scrollDisableClass);
13
- $body.trigger('tagKlarnaModalAdded');
13
+ $body.trigger('tagKlarnaModalAdded')
14
14
  } else {
15
15
  $body.removeClass(scrollDisableClass);
16
16
  $body.trigger('tagKlarnaModalRemoved');
17
- }
17
+ };
18
18
  });
19
19
  })();
@@ -9,38 +9,23 @@ Wick.MyAccount = {
9
9
  appInfo: '.app-info',
10
10
  hideAppInfo: 'app-info--hide'
11
11
  },
12
- clipboardCodes: {
13
- tradeProId: {
14
- titleEl: '.clipboard-code.trade-pro-id .title',
15
- subtitleEl: '.clipboard-code.trade-pro-id .subtitle',
16
- btnCopy: '.btn--trade-pro-id',
17
- },
18
- discountCode: {
19
- titleEl: '.clipboard-code.discount-code .title',
20
- subtitleEl: '.clipboard-code.discount-code .subtitle',
21
- btnCopy: '.btn--discount-code',
22
- },
23
- },
24
- copyCode(codeType) {
25
- const { titleEl, subtitleEl, btnCopy } = Wick.MyAccount.clipboardCodes[codeType];
26
- const value = $(subtitleEl).text().trim();
27
- const title = $(titleEl).text().trim();
12
+ copyCode($btn) {
13
+ const $container = $btn.closest('.clipboard-code');
14
+ const value = $container.find('.subtitle').text().trim();
15
+ const title = $container.find('.title').text().trim();
28
16
 
29
- copyToClipboard(value, btnCopy);
30
- Wick.SnackBar.show(
31
- {
32
- text: `${title} copied to clipboard`,
33
- type: Wick.SnackBar.types.SUCCESS,
34
- withCloseButton: false,
35
- autoClose: true,
36
- delayBeforeClose: 1500
37
- }
38
- );
17
+ copyToClipboard(value, $btn);
18
+ Wick.SnackBar.show({
19
+ text: `${title} copied to clipboard`,
20
+ type: Wick.SnackBar.types.SUCCESS,
21
+ withCloseButton: false,
22
+ autoClose: true,
23
+ delayBeforeClose: 1500
24
+ });
39
25
  },
40
26
  init() {
41
- Object.keys(Wick.MyAccount.clipboardCodes).forEach((codeType) => {
42
- const { btnCopy } = Wick.MyAccount.clipboardCodes[codeType];
43
- $(btnCopy).on('click', () => Wick.MyAccount.copyCode(codeType));
27
+ Wick.MyAccount.el.$clipboardCode.find('.copy-code').on('click', function() {
28
+ Wick.MyAccount.copyCode($(this));
44
29
  });
45
30
 
46
31
  if($(Wick.MyAccount.el.appInfo).length && isApp()) {
@@ -1,5 +1,6 @@
1
1
  var Wick = Wick || {};
2
2
  Wick.onlineExclusive = (function () {
3
+
3
4
  let rangesToggler = $('.ranges-toggle'),
4
5
  rangesList = $('.ranges'),
5
6
  otherRanges = $('.other-ranges'),
@@ -26,10 +27,8 @@ Wick.onlineExclusive = (function () {
26
27
  otherRangesHeating = $('.other-ranges__item_heating');
27
28
 
28
29
  rangesToggler.on('click', function () {
29
- rangesToggler
30
- .toggleClass('border-bottom-rounded_false')
31
- .find('.icon')
32
- .toggleClass('icon-rotated');
30
+ rangesToggler.toggleClass('border-bottom-rounded_false')
31
+ .find('.icon').toggleClass('icon-rotated');
33
32
  if (window.innerWidth > 768) {
34
33
  rangesList.toggleClass('d-block border-bottom-rounded');
35
34
  } else if (window.innerWidth < 768) {
@@ -39,17 +38,18 @@ Wick.onlineExclusive = (function () {
39
38
  });
40
39
 
41
40
  if (window.innerWidth < 768) {
42
- rangesList.on('click', 'a', function (e) {
41
+ rangesList.on( 'click', 'a', function(e) {
43
42
  e.preventDefault();
44
43
  otherRanges.show();
45
44
 
46
- $(document).mouseup(function (e) {
47
- if (!rangesList.is(e.target) && rangesList.has(e.target).length === 0) {
45
+ $(document).mouseup(function(e) {
46
+ if (!rangesList.is(e.target) && rangesList.has(e.target).length === 0)
47
+ {
48
48
  rangesList.hide();
49
49
  }
50
50
  });
51
51
 
52
- switch ($(this).parent().attr('data-value')) {
52
+ switch ($(this).parent().attr("data-value")) {
53
53
  case 'gardens-btn':
54
54
  rangesComponent.hide();
55
55
  gardensComponent.show();
@@ -96,13 +96,15 @@ Wick.onlineExclusive = (function () {
96
96
  otherRanges.hide();
97
97
  break;
98
98
  }
99
+
99
100
  });
100
- } else if (window.innerWidth >= 768) {
101
- rangesList.on('click', 'a', function (e) {
101
+ }
102
+ else if (window.innerWidth >= 768) {
103
+ rangesList.on( 'click', 'a', function(e) {
102
104
  e.preventDefault();
103
105
  otherRanges.show();
104
106
 
105
- switch ($(this).parent().attr('data-value')) {
107
+ switch ($(this).parent().attr("data-value")) {
106
108
  case 'gardens-btn':
107
109
  rangesEl.removeClass('range-btn');
108
110
  $(this).addClass('range-btn');
@@ -169,10 +171,10 @@ Wick.onlineExclusive = (function () {
169
171
  break;
170
172
  }
171
173
  });
172
- otherRangesList.on('click', 'a', function (e) {
174
+ otherRangesList.on( 'click', 'a', function(e) {
173
175
  e.preventDefault();
174
176
 
175
- switch ($(this).parent().parent().attr('data-value')) {
177
+ switch ($(this).parent().parent().attr("data-value")) {
176
178
  case 'gardens-btn':
177
179
  rangesEl.removeClass('range-btn');
178
180
  $('#gardens-btn').addClass('range-btn');
@@ -241,33 +243,33 @@ Wick.onlineExclusive = (function () {
241
243
  });
242
244
  }
243
245
 
244
- viewBtn.on('click', function (e) {
246
+ viewBtn.on('click', function(e) {
245
247
  e.preventDefault();
246
248
  rangesComponent.show();
247
249
  otherRanges.hide();
248
250
  rangesEl.removeClass('range-btn');
249
251
  });
250
252
 
251
- $(function () {
252
- $('a.online-exclusive__banner').on('click', function (event) {
253
+ $(function(){
254
+ $('a.online-exclusive__banner').on('click', function(event) {
253
255
  event.preventDefault();
254
- let sc = $(this).attr('href'),
256
+ let sc = $(this).attr("href"),
255
257
  dn = $(sc).offset().top - 10;
256
- $('html, body').animate({ scrollTop: dn }, 1000);
258
+ $('html, body').animate({scrollTop: dn}, 1000);
257
259
  });
258
260
  });
259
261
 
260
- $(function () {
261
- $('a.view-link').on('click', function (event) {
262
+ $(function(){
263
+ $('a.view-link').on('click', function(event) {
262
264
  event.preventDefault();
263
- let sc = $(this).attr('href'),
265
+ let sc = $(this).attr("href"),
264
266
  dn = $(sc).offset().top - 10;
265
- $('html, body').animate({ scrollTop: dn }, 1000);
267
+ $('html, body').animate({scrollTop: dn}, 1000);
266
268
  });
267
269
  });
268
270
 
269
- $(function () {
270
- $('a.ranges-el').on('click', function (event) {
271
+ $(function(){
272
+ $('a.ranges-el').on('click', function(event) {
271
273
  event.preventDefault();
272
274
  let dn;
273
275
 
@@ -279,12 +281,12 @@ Wick.onlineExclusive = (function () {
279
281
  dn = 990;
280
282
  }
281
283
 
282
- $('html, body').animate({ scrollTop: dn }, 1000);
284
+ $('html, body').animate({scrollTop: dn}, 1000);
283
285
  });
284
286
  });
285
287
 
286
- $(function () {
287
- $('.other-ranges__item').on('click', function (event) {
288
+ $(function(){
289
+ $('.other-ranges__item').on('click', function(event) {
288
290
  event.preventDefault();
289
291
  let dn;
290
292
 
@@ -296,7 +298,7 @@ Wick.onlineExclusive = (function () {
296
298
  dn = 810;
297
299
  }
298
300
 
299
- $('html, body').animate({ scrollTop: dn }, 1000);
301
+ $('html, body').animate({scrollTop: dn}, 1000);
300
302
  });
301
303
  });
302
304
  })();
@@ -1,76 +1,46 @@
1
- import { copyToClipboard } from './utils/copy-to-clipboard';
1
+ import {copyToClipboard} from "./utils/copy-to-clipboard";
2
2
 
3
3
  var Wick = window.Wick || {};
4
4
 
5
5
  Wick.TradeProRewards = {
6
- el: {
7
- $tradeProRewards: $('.page_tradePro-rewards'),
8
- buttonSelector: '.copy-tradePro-barcode',
9
- },
10
-
11
- message: 'Code copied to clipboard',
12
- errorMessage: 'Unable to copy. Please copy manually',
13
-
14
- copyToClipboardInit() {
15
- Wick.SnackBar.init();
16
-
17
- $(document).on('click', Wick.TradeProRewards.el.buttonSelector, async function (e) {
18
- e.preventDefault();
19
- e.stopPropagation();
20
-
21
- const $btn = $(this);
22
- const $input = $btn.parent().find('input');
23
-
24
- if (!$input.length) return false;
25
-
26
- const discountCodeValue = ($input.val() || '').trim();
27
- if (!discountCodeValue) return false;
28
-
29
- $input.removeAttr('disabled').attr('readonly', 'readonly');
30
-
31
- try {
32
- await copyToClipboard(discountCodeValue, e.currentTarget, { noUpperCase: true });
33
-
34
- Wick.SnackBar.show({
35
- text: Wick.TradeProRewards.message,
36
- type: Wick.SnackBar.types.SUCCESS,
37
- withCloseButton: false,
38
- autoClose: true,
39
- delayBeforeClose: 3000,
40
- });
41
- } catch (err) {
42
- try {
43
- const el = $input.get(0);
44
- el.focus();
45
- el.select();
46
- el.setSelectionRange(0, 999999);
47
- } catch (e) {
48
- console.error(e);
49
- }
50
-
51
- Wick.SnackBar.show({
52
- text: Wick.TradeProRewards.errorMessage,
53
- type: Wick.SnackBar.types.ERROR,
54
- withCloseButton: false,
55
- autoClose: true,
56
- delayBeforeClose: 4000,
57
- });
58
- }
59
-
60
- $input.attr('disabled', 'disabled').removeAttr('readonly');
61
- window.getSelection()?.removeAllRanges?.();
62
-
63
- return false;
64
- });
65
- },
66
-
67
- init() {
68
- Wick.TradeProRewards.copyToClipboardInit();
69
- },
70
- };
6
+ el: {
7
+ $tradeProRewards: $('.page_tradePro-rewards'),
8
+ buttonSelector: '.copy-tradePro-barcode',
9
+ },
10
+ message: 'Code copied to clipboard',
11
+ copyToClipboardInit() {
12
+ Wick.SnackBar.init();
13
+ $(Wick.TradeProRewards.el.buttonSelector).on('click', function (e) {
14
+ e.preventDefault();
15
+ e.stopPropagation();
16
+ var discountCode = $(this).parent().find('input');
17
+ var discountCodeValue = discountCode.val().trim();
18
+ discountCode.removeAttr('disabled').attr('readonly', 'readonly');
19
+
20
+ copyToClipboard(discountCodeValue, e.currentTarget, { noUpperCase: true });
21
+
22
+ discountCode.attr('disabled', 'disabled').removeAttr('readonly');
23
+ window.getSelection().removeAllRanges();
24
+
25
+ Wick.SnackBar.show(
26
+ {
27
+ text: Wick.TradeProRewards.message,
28
+ type: Wick.SnackBar.types.SUCCESS,
29
+ withCloseButton: false,
30
+ autoClose: true,
31
+ delayBeforeClose: 3000
32
+ }
33
+ );
34
+ return false;
35
+ });
36
+ },
37
+ init() {
38
+ Wick.TradeProRewards.copyToClipboardInit();
39
+ }
40
+ }
71
41
 
72
42
  $(document).ready(function () {
73
- if (Wick.TradeProRewards.el.$tradeProRewards.length) {
74
- Wick.TradeProRewards.init();
75
- }
43
+ if (Wick.TradeProRewards.el.$tradeProRewards.length) {
44
+ Wick.TradeProRewards.init();
45
+ }
76
46
  });
@@ -1,88 +1,56 @@
1
1
  export function copyToClipboard(copyValue, currentSelector, options = {}) {
2
- const textTrimmed = normalizeCopyText(copyValue, options);
2
+ const $temp = $('<textarea>').css({
3
+ position: 'absolute',
4
+ top: 0,
5
+ left: 0,
6
+ opacity: 0
7
+ });
8
+
9
+ $(currentSelector).parent().append($temp);
10
+
11
+ let str;
12
+ if (options.noUpperCase) {
13
+ str = copyValue;
14
+ } else {
15
+ str = copyValue.replace(/(^\w|\s\w)/g, function (m) {
16
+ return m.toUpperCase()
17
+ });
18
+ }
3
19
 
4
- if (!textTrimmed) return Promise.reject(new Error('Empty text'));
20
+ const textFiltered = str.split(' ').filter(function (value) {
21
+ return value !== ''
22
+ });
5
23
 
6
- // 1) iOS app bridge (WKWebView)
7
- if (window.webkit?.messageHandlers?.copy) {
8
- try {
9
- window.webkit.messageHandlers.copy.postMessage(textTrimmed);
10
- return Promise.resolve(true);
11
- } catch (e) {
12
- console.error(e);
13
- }
14
- }
24
+ const textTrimmed = textFiltered.join(' ');
15
25
 
16
- // 2) Android app bridge
17
- if (window.Android?.copyToClipboard && typeof window.Android.copyToClipboard === 'function') {
18
- try {
19
- window.Android.copyToClipboard(textTrimmed);
20
- return Promise.resolve(true);
21
- } catch (e) {
22
- console.error(e);
23
- }
24
- }
26
+ $temp.val(textTrimmed);
25
27
 
26
- if (navigator.clipboard?.writeText) {
27
- return navigator.clipboard.writeText(textTrimmed).then(() => true);
28
- }
28
+ if (navigator.userAgent.match(/TradeProMobile_iOS|DIYMobile_iOS/i)) {
29
+ iosCopyToClipboard($temp);
30
+ } else if (navigator.userAgent.match(/ipad|ipod|iphone/i)) {
31
+ $temp.select();
32
+ $temp[0].setSelectionRange(0, 999999);
33
+ } else {
34
+ $temp.select();
35
+ }
29
36
 
30
- return legacyExecCommandCopy(textTrimmed, currentSelector);
37
+ document.execCommand("copy");
38
+ $temp.remove();
31
39
  }
32
40
 
33
- function normalizeCopyText(copyValue, options) {
34
- let raw = copyValue == null ? '' : copyValue + '';
35
-
36
- const str = options.noUpperCase ? raw : raw.replace(/(^\w|\s\w)/g, (m) => m.toUpperCase());
37
-
38
- return str
39
- .split(' ')
40
- .filter((v) => v !== '')
41
- .join(' ')
42
- .trim();
43
- }
44
-
45
- function legacyExecCommandCopy(text, currentSelector) {
46
- return new Promise(function (resolve, reject) {
47
- try {
48
- let $parent = $(currentSelector).parent();
49
-
50
- let $temp = $('<textarea>').val(text).attr('readonly', 'readonly').css({
51
- position: 'fixed',
52
- top: 0,
53
- left: '-9999px',
54
- opacity: 0,
55
- width: '1px',
56
- height: '1px',
57
- padding: 0,
58
- border: 0,
59
- margin: 0,
60
- });
61
-
62
- $parent.append($temp);
63
-
64
- let el = $temp.get(0);
65
-
66
- el.focus();
67
- let len = (el.value || '').length;
68
- if (typeof el.setSelectionRange === 'function') {
69
- el.setSelectionRange(0, len);
70
- } else {
71
- $temp.select();
72
- }
73
-
74
- let ok = document.execCommand('copy');
75
-
76
- $temp.remove();
77
-
78
- if (window.getSelection) {
79
- let sel = window.getSelection();
80
- if (sel && sel.removeAllRanges) sel.removeAllRanges();
81
- }
82
-
83
- ok ? resolve(true) : reject(new Error('execCommand failed'));
84
- } catch (e) {
85
- reject(e);
86
- }
87
- });
41
+ function iosCopyToClipboard($input) {
42
+ const el = $input.get(0);
43
+ const editable = el.contentEditable;
44
+ const readOnly = el.readOnly;
45
+ const range = document.createRange();
46
+ const sel = window.getSelection();
47
+
48
+ el.contentEditable = true;
49
+ el.readOnly = false;
50
+ range.selectNodeContents(el);
51
+ sel.removeAllRanges();
52
+ sel.addRange(range);
53
+ el.setSelectionRange(0, 999999);
54
+ el.contentEditable = editable;
55
+ el.readOnly = readOnly;
88
56
  }
@@ -3,7 +3,7 @@ export function highlightCharacter(str, char, charClass) {
3
3
  return str;
4
4
  }
5
5
 
6
- const pattern = new RegExp(`\\${char}+`, 'g');
6
+ const pattern = new RegExp(`\\${char}+`, "g");
7
7
  const replacement = `<span class="${charClass}">$&</span>`;
8
8
 
9
9
  return str.replace(pattern, replacement);
@@ -12,7 +12,7 @@ export function highlightCharacter(str, char, charClass) {
12
12
  export function createImageElements(images, alt) {
13
13
  return images.map((link) => {
14
14
  return $('<img>').attr('src', link).attr('alt', alt);
15
- });
15
+ })
16
16
  }
17
17
 
18
18
  export function countLetters(str) {
@@ -35,17 +35,15 @@ export function isKeyboardOpen() {
35
35
  return screenHeight !== screenHeightWithoutKeyboard;
36
36
  }
37
37
 
38
- export function isTouchDevice() {
38
+ export function isTouchDevice () {
39
39
  return 'ontouchstart' in window;
40
40
  }
41
41
 
42
- export function isApp() {
43
- return navigator.userAgent.match(
44
- /TradeProMobile_iOS|TradeProMobile_Android|DIYMobile_iOS|DIYMobile_Android|DIYApp_Guest_Mobile_iOS|DIYApp_Guest_Mobile_Android|AGENT_PLACEHOLDER/i
45
- );
42
+ export function isApp () {
43
+ return navigator.userAgent.match(/TradeProMobile_iOS|TradeProMobile_Android|DIYMobile_iOS|DIYMobile_Android|DIYApp_Guest_Mobile_iOS|DIYApp_Guest_Mobile_Android|AGENT_PLACEHOLDER/i);
46
44
  }
47
45
 
48
- export function trimFields() {
46
+ export function trimFields () {
49
47
  const fields = Wick.AddressBook.getFieldsConfigurations();
50
48
  fields.forEach((field) => {
51
49
  const trimmedValue = field.input.val().trim();
@@ -57,11 +55,8 @@ export function scrollToElement(element, offset = 20) {
57
55
  const targetElement = $(element);
58
56
 
59
57
  if (targetElement.length > 0) {
60
- $('html, body').animate(
61
- {
62
- scrollTop: targetElement.offset().top - offset,
63
- },
64
- 300
65
- );
58
+ $('html, body').animate({
59
+ scrollTop: targetElement.offset().top - offset
60
+ }, 300);
66
61
  }
67
62
  }
@@ -6,9 +6,5 @@
6
6
  <main>
7
7
  {{> shopping-list-bicester-hub emptyShopList="true" }}
8
8
  </main>
9
- <script defer src="./js/share-project-list.min.js"></script>
10
- {{/content}}
11
- {{#content "foot" mode="append"}}
12
- <script defer src="./js/saving-shopping-list.min.js"></script>
13
9
  {{/content}}
14
10
  {{/extend}}
@@ -5,6 +5,5 @@
5
5
  <main>
6
6
  {{> shopping-list emptyShopList=true pagination=false}}
7
7
  </main>
8
- <script defer src="./js/share-project-list.min.js"></script>
9
8
  {{/content}}
10
9
  {{/extend}}
@@ -11,8 +11,8 @@
11
11
  </main>
12
12
  {{/content}}
13
13
  {{#content "foot" mode="append"}}
14
- {{> kitchen/filter-modal isKitchenMode=true modalTitle="Filter by" }}
14
+ {{> kitchen/filter-modal }}
15
+ <script src="./js/page/accordion.js"></script>
15
16
  <script src="./js/kitchen/kitchen-plp.min.js"></script>
16
- <script src="./js/plp-filters.min.js"></script>
17
17
  {{/content}}
18
18
  {{/extend}}
@@ -33,7 +33,7 @@
33
33
  subtitle=my_account.user.email
34
34
  }}
35
35
  {{> my-account/discount
36
- discountSrc=my_account.installer.discount
36
+ discountText=my_account.installer.discountText
37
37
  installer=true
38
38
  title="In-store discount"
39
39
  code=my_account.discount