wickes-css2 2.110.0 → 2.111.0-complete-your-project.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/build/css/category-main.css +1 -1
  2. package/build/css/homepage-main.css +1 -1
  3. package/build/css/kitchen-plp-main.css +1 -1
  4. package/build/css/main.css +1 -1
  5. package/build/css/my-account-main-v2.css +1 -1
  6. package/build/css/my-account-main.css +1 -1
  7. package/build/css/pages/page_personal-details.css +1 -1
  8. package/build/css/pages/page_product-details-v2.css +1 -1
  9. package/build/css/pdp-main-before-combine.css +1 -1
  10. package/build/css/pdp-main-critical.css +1 -1
  11. package/build/css/pdp-main-non-critical.css +1 -1
  12. package/build/css/pdp-main.css +1 -1
  13. package/build/css/plp-main.css +1 -1
  14. package/build/css/store-locator-main.css +1 -1
  15. package/build/js/account-hub.min.js +1 -1
  16. package/build/js/basket.min.js +1 -1
  17. package/build/js/bloomreach-widget.min.js +1 -0
  18. package/build/js/bundle.min.js +1 -1
  19. package/build/js/checkout.min.js +1 -1
  20. package/build/js/emulation.min.js +3025 -217
  21. package/build/js/general.bundle.min.js +1 -1
  22. package/build/js/merged-checkout.min.js +1 -1
  23. package/build/js/page/bloomreach-widget.js +1173 -0
  24. package/build/js/page/utils/create-count-stepper.js +30 -9
  25. package/build/js/page/utils/create-loading-button.js +37 -0
  26. package/build/js/page/utils/create-toast.js +79 -0
  27. package/build/js/page/utils/custom-dropdown.js +80 -0
  28. package/build/js/pdp-count-stepper.min.js +1 -1
  29. package/build/js/pdp.bundle.min.js +1 -1
  30. package/build/js/plp.bundle.min.js +1 -1
  31. package/build/js/project-list.min.js +1 -1
  32. package/build/js/saving-shopping-list.min.js +1 -1
  33. package/package.json +1 -1
  34. package/src/components/base/button.hbs +23 -5
  35. package/src/components/bloomreach/complete-card-dropdown.hbs +47 -0
  36. package/src/components/bloomreach/complete-card-skeleton.hbs +19 -0
  37. package/src/components/bloomreach/complete-card.hbs +138 -0
  38. package/src/components/bloomreach/complete-divider.hbs +3 -0
  39. package/src/components/bloomreach/complete-summary-skeleton.hbs +12 -0
  40. package/src/components/bloomreach/complete-summary.hbs +43 -0
  41. package/src/components/bloomreach/complete-wrapper.hbs +1 -0
  42. package/src/components/bloomreach/complete-your-project.hbs +21 -0
  43. package/src/components/gift-cards.hbs +1 -1
  44. package/src/elements/checkbox.hbs +8 -1
  45. package/src/js/components/general/cart-slider.js +19 -6
  46. package/src/js/emulation/bloomreach-widget-calculations.js +140 -0
  47. package/src/js/emulation/bloomreach-widget-loading.js +11 -0
  48. package/src/js/emulation/mock.js +3097 -1
  49. package/src/js/emulation/notify-me.js +1 -1
  50. package/src/js/page/bloomreach-widget.js +1173 -0
  51. package/src/js/page/utils/create-count-stepper.js +30 -9
  52. package/src/js/page/utils/create-loading-button.js +37 -0
  53. package/src/js/page/utils/create-toast.js +79 -0
  54. package/src/js/page/utils/custom-dropdown.js +80 -0
  55. package/src/page_product-details-banner.html +0 -1
  56. package/src/page_product-details-big-wins-disabled-delivery.html +0 -1
  57. package/src/page_product-details-big-wins-non-registered.html +0 -1
  58. package/src/page_product-details-big-wins-out-nearest.html +0 -1
  59. package/src/page_product-details-big-wins-unhappy.html +0 -1
  60. package/src/page_product-details-big-wins.html +0 -1
  61. package/src/page_product-details-billie.html +0 -1
  62. package/src/page_product-details-bloomreach.html +130 -0
  63. package/src/page_product-details-calculator.html +0 -1
  64. package/src/page_product-details-cashback-v2.html +0 -1
  65. package/src/page_product-details-clearpay.html +0 -1
  66. package/src/page_product-details-cnc-error-notification.html +0 -1
  67. package/src/page_product-details-cnc-success-notification-vat.html +0 -1
  68. package/src/page_product-details-cnc-success-notification.html +0 -1
  69. package/src/page_product-details-default-store.html +0 -1
  70. package/src/page_product-details-energy-efficiency.html +0 -1
  71. package/src/page_product-details-flooring-with-pr-placeholder.html +0 -1
  72. package/src/page_product-details-flooring.html +0 -1
  73. package/src/page_product-details-gallery-actual.html +0 -1
  74. package/src/page_product-details-mfe-calculator.html +0 -1
  75. package/src/page_product-details-minimum-v2.html +0 -1
  76. package/src/page_product-details-mtm-doors.html +0 -1
  77. package/src/page_product-details-only-clearpay.html +0 -1
  78. package/src/page_product-details-paint-mixing.html +0 -1
  79. package/src/page_product-details-saved-pl.html +0 -1
  80. package/src/page_product-details-tile-steps-klarna-widget-with-method-ids.html +0 -1
  81. package/src/page_product-details-tile-steps-logout.html +0 -1
  82. package/src/page_product-details-tile-steps-no-new-project-list.html +0 -1
  83. package/src/page_product-details-tile-steps-with-klarna.html +0 -1
  84. package/src/page_product-details-tile-steps.html +0 -1
  85. package/src/page_product-details-v2.html +0 -1
  86. package/src/page_product-details-vat.html +0 -1
  87. package/src/page_product-details-wisdom-mcfc-registered.html +0 -1
  88. package/src/page_product-details-wisdom-mcfc.html +0 -1
  89. package/src/page_product-details-wisdom-oos-registered.html +0 -1
  90. package/src/page_product-details-wisdom-oos.html +0 -1
  91. package/src/page_product-details-wisdom-registered.html +0 -1
  92. package/src/page_product-details-wisdom.html +0 -1
  93. package/src/page_product-details-with-favourite.html +0 -1
  94. package/src/page_product-details-with-global-search-v2.html +7 -1
  95. package/src/page_product-details_no-previous-default.html +0 -1
  96. package/src/page_track-my-order-result.html +1 -0
  97. package/src/partials/scripts.hbs +1 -0
  98. package/src/scss/common/_common.scss +1 -0
  99. package/src/scss/common/_elements.scss +13 -1
  100. package/src/scss/common/_loading-button.scss +49 -0
  101. package/src/scss/components/_notifications.scss +86 -5
  102. package/src/scss/components/bloomreach/_bloomreach.scss +3 -0
  103. package/src/scss/components/bloomreach/_complete-card-dropdown.scss +174 -0
  104. package/src/scss/components/bloomreach/_complete-card.scss +402 -0
  105. package/src/scss/components/bloomreach/_complete-your-project.scss +207 -0
  106. package/src/scss/helpers/_variables.scss +1 -0
  107. package/src/scss/pages/page_product-details-v2.scss +45 -2
  108. package/src/scss/pdp-main-critical.scss +0 -1
  109. package/src/scss/pdp-main.scss +1 -1
  110. package/src/sitemap.html +6 -0
  111. package/src/scss/components/_pdp-action-v2-critical.scss +0 -27
  112. package/src/scss/components/_pdp-action-v2.scss +0 -27
@@ -5,17 +5,30 @@ createPopupSlider({
5
5
  sliderSelector: '.custom-slider.just-added',
6
6
  onAppendEvent: 'productAddedToCart',
7
7
  onAppend: function (event, { showSlider, handleScroll, el }) {
8
+ Wick.MiniBasketSliderFE.isMiniBasketLoaded = false;
9
+
10
+ if (event.detail.bulkAddToCartData) {
11
+ return;
12
+ }
13
+
8
14
  if (!$('.custom-slider.just-added').length) {
9
15
  $('body').append(cartSliderHTML);
10
16
  }
17
+
11
18
  const htmlContent = event.detail.html;
12
- $(el.slider).append(htmlContent);
19
+
20
+ if (htmlContent) {
21
+ $(el.slider).append(htmlContent);
22
+ }
23
+
13
24
  showSlider();
14
- Wick.MiniBasketSliderFE.isMiniBasketLoaded = false;
15
- $(el.sliderWrap).on(
16
- 'scroll',
17
- _.debounce(() => handleScroll(el.sliderWrap), 100)
18
- );
25
+
26
+ if ($(el.sliderWrap).length) {
27
+ $(el.sliderWrap).on(
28
+ 'scroll',
29
+ _.debounce(() => handleScroll(el.sliderWrap), 100)
30
+ );
31
+ }
19
32
  },
20
33
  onClose: function () {
21
34
  Wick.MiniBasketSliderFE.cartEntries = [];
@@ -0,0 +1,140 @@
1
+ let addToCartResponseIndex = 0;
2
+
3
+ function formatBundlePrice(value) {
4
+ return new Intl.NumberFormat('en-GB', {
5
+ style: 'currency',
6
+ currency: 'GBP',
7
+ minimumFractionDigits: 2,
8
+ maximumFractionDigits: 2,
9
+ }).format(value);
10
+ }
11
+
12
+ function getPriceData(product) {
13
+ return product.price || product.displayPrice || {};
14
+ }
15
+
16
+ function getBundleProductPrice(product) {
17
+ const price = getPriceData(product);
18
+
19
+ return typeof price.value === 'number' ? price.value : 0;
20
+ }
21
+
22
+ function getBundleProductWasPrice(product) {
23
+ const price = getPriceData(product);
24
+
25
+ return typeof price.wasPrice === 'number' ? price.wasPrice : null;
26
+ }
27
+
28
+ function getBundleProductExcVatPrice(product) {
29
+ const priceExcVat = product.displayPriceExclusiveVat || product.priceExclusiveVat;
30
+ if (priceExcVat && typeof priceExcVat.value === 'number') return priceExcVat.value;
31
+ const price = getPriceData(product);
32
+ if (typeof price.value !== 'number') return 0;
33
+ const vatRate = price.vatRatePercentage || 20;
34
+ return price.value / (1 + vatRate / 100);
35
+ }
36
+
37
+ function getBundleProductExcVatWasPrice(product) {
38
+ const display = product.displayPriceExclusiveVat;
39
+ const raw = product.priceExclusiveVat;
40
+ if (display && typeof display.wasPrice === 'number') return display.wasPrice;
41
+ if (raw && typeof raw.wasPrice === 'number') return raw.wasPrice;
42
+ const price = getPriceData(product);
43
+ if (typeof price.wasPrice !== 'number') return null;
44
+ const vatRate = price.vatRatePercentage || 20;
45
+ return price.wasPrice / (1 + vatRate / 100);
46
+ }
47
+
48
+ function calculateBundleTotal(entries) {
49
+ let totalPrice = 0;
50
+ let totalWasPrice = 0;
51
+ let totalExcVatPrice = 0;
52
+ let totalExcVatWasPrice = 0;
53
+ let hasWasPrice = false;
54
+
55
+ entries.forEach(function (entry) {
56
+ const quantity = entry.quantity || 1;
57
+ const price = getBundleProductPrice(entry.product);
58
+ const wasPrice = getBundleProductWasPrice(entry.product);
59
+ const excVatPrice = getBundleProductExcVatPrice(entry.product);
60
+ const excVatWasPrice = getBundleProductExcVatWasPrice(entry.product);
61
+
62
+ totalPrice += price * quantity;
63
+ totalWasPrice += (wasPrice || price) * quantity;
64
+ totalExcVatPrice += excVatPrice * quantity;
65
+ totalExcVatWasPrice += (excVatWasPrice || excVatPrice) * quantity;
66
+
67
+ if (wasPrice) {
68
+ hasWasPrice = true;
69
+ }
70
+ });
71
+
72
+ return {
73
+ totalPrice: formatBundlePrice(totalPrice),
74
+ totalWasPrice: hasWasPrice ? formatBundlePrice(totalWasPrice) : null,
75
+ totalExcVatPrice: formatBundlePrice(totalExcVatPrice),
76
+ totalExcVatWasPrice: hasWasPrice ? formatBundlePrice(totalExcVatWasPrice) : null,
77
+ };
78
+ }
79
+
80
+ function bindCalculateProductBundleTotalEvent() {
81
+ $(window).on('calculateProductBundleTotal', function ({ detail: { payload, resolve } }) {
82
+ const entries = payload.entries || [];
83
+
84
+ setTimeout(function () {
85
+ resolve(calculateBundleTotal(entries));
86
+ }, 200);
87
+ });
88
+ }
89
+
90
+ function getAddProductBundleResponse() {
91
+ const responses = [
92
+ {
93
+ bulkAddToCartData: {
94
+ messageType: 'success',
95
+ messageText: 'Selected product(s) were added to basket',
96
+ },
97
+ },
98
+ {
99
+ bulkAddToCartData: {
100
+ messageType: 'warning',
101
+ messageText: 'Selected product(s) were partially added to basket',
102
+ },
103
+ },
104
+ {
105
+ bulkAddToCartData: {
106
+ messageType: 'error',
107
+ messageText: 'Selected product(s) were not added to basket',
108
+ },
109
+ },
110
+ ];
111
+
112
+ const response = responses[addToCartResponseIndex % responses.length];
113
+
114
+ addToCartResponseIndex++;
115
+
116
+ return response;
117
+ }
118
+
119
+ function bindAddProductBundleToCartEvent() {
120
+ $(window).on('bulkAddToCart', function ({ originalEvent }) {
121
+ const entries = originalEvent.detail.entries || [];
122
+
123
+ setTimeout(function () {
124
+ const response = getAddProductBundleResponse(entries);
125
+
126
+ window.dispatchEvent(
127
+ new CustomEvent('productAddedToCart', {
128
+ detail: {
129
+ bulkAddToCartData: response.bulkAddToCartData,
130
+ },
131
+ })
132
+ );
133
+ }, 1200);
134
+ });
135
+ }
136
+
137
+ $(document).ready(function () {
138
+ bindCalculateProductBundleTotalEvent();
139
+ bindAddProductBundleToCartEvent();
140
+ });
@@ -0,0 +1,11 @@
1
+ var Wick = window.Wick || {};
2
+
3
+ $(document).ready(function () {
4
+ window.setTimeout(function () {
5
+ const $container = $('[data-complete-widget]');
6
+ const contextKey = $container.data('context-key');
7
+ const payloadData = Wick.FEMock.dataBloomreach[contextKey];
8
+
9
+ Wick.BloomreachWidget.init(payloadData);
10
+ }, 3000);
11
+ });