wickes-css2 2.113.0 → 2.117.0-develop.1

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 (233) hide show
  1. package/Readme.md +1 -1
  2. package/build/css/category-main.css +1 -1
  3. package/build/css/components/checkout-payment-details-v2.css +1 -1
  4. package/build/css/components/checkout-payment-repayment-terms.css +1 -1
  5. package/build/css/components/price-block-v2-critical.css +1 -1
  6. package/build/css/components/price-block-v2.css +1 -1
  7. package/build/css/kitchen-plp-main.css +1 -1
  8. package/build/css/main.css +1 -1
  9. package/build/css/my-account-main-v2.css +1 -1
  10. package/build/css/my-account-main.css +1 -1
  11. package/build/css/pages/checkout-new.css +1 -1
  12. package/build/css/pages/checkout.css +1 -1
  13. package/build/css/pages/page_checkout_delivery-new.css +1 -1
  14. package/build/css/pages/page_product-details-v2-critical.css +1 -1
  15. package/build/css/pages/page_product-details-v2.css +1 -1
  16. package/build/css/pages/page_product-details.css +1 -1
  17. package/build/css/pages/page_products-list-combined.css +1 -1
  18. package/build/css/pages/page_products-list_v2.css +1 -1
  19. package/build/css/pages/tradePro-signup.css +1 -1
  20. package/build/css/pdp-main-before-combine.css +1 -1
  21. package/build/css/pdp-main-critical.css +1 -1
  22. package/build/css/pdp-main-non-critical.css +1 -1
  23. package/build/css/pdp-main.css +1 -1
  24. package/build/css/plp-main.css +1 -1
  25. package/build/css/store-locator-main.css +1 -1
  26. package/build/img/file-pdf-solid-full.svg +3 -0
  27. package/build/img/lorem_ipsum.pdf +150 -0
  28. package/build/js/account-members.min.js +1 -1
  29. package/build/js/add-project-list-id.min.js +1 -1
  30. package/build/js/address-book.min.js +1 -1
  31. package/build/js/basket.min.js +2 -2
  32. package/build/js/bloomreach-widget.min.js +1 -1
  33. package/build/js/bundle.min.js +1 -1
  34. package/build/js/change-password.min.js +1 -1
  35. package/build/js/checkout.min.js +2 -2
  36. package/build/js/emulation.min.js +400 -192
  37. package/build/js/general.bundle.min.js +1 -1
  38. package/build/js/gift-cards.min.js +1 -1
  39. package/build/js/kitchen/kitchen-plp.min.js +1 -1
  40. package/build/js/merged-checkout.min.js +2 -2
  41. package/build/js/package-bulk-add.min.js +1 -0
  42. package/build/js/page/bloomreach-widget/bloomreach-recommendation-carousel-widget.js +7 -6
  43. package/build/js/page/bloomreach-widget/bloomreach-widget-core.js +47 -27
  44. package/build/js/page/bloomreach-widget/bloomreach-widget.js +5 -0
  45. package/build/js/page/bloomreach-widget/complete-your-project/view.js +11 -6
  46. package/build/js/page/bloomreach-widget/complete-your-project/widget.js +0 -1
  47. package/build/js/page/bloomreach-widget/similar-products-widget.js +17 -0
  48. package/build/js/page/plp-load-more.js +81 -66
  49. package/build/js/page/ripple/bulk-add.js +71 -0
  50. package/build/js/page/ripple/package-bulk-add.js +43 -0
  51. package/build/js/page/ripple/postcode-checker.js +83 -0
  52. package/build/js/page/ripple/thumb-gallery.js +236 -0
  53. package/build/js/page/utils/validation.js +1 -1
  54. package/build/js/pdf-preview.min.js +1 -0
  55. package/build/js/pdp.bundle.min.js +2 -2
  56. package/build/js/personal-details.min.js +1 -1
  57. package/build/js/plp.bundle.min.js +1 -1
  58. package/build/js/postcode-checker.min.js +1 -0
  59. package/build/js/project-list.min.js +2 -2
  60. package/build/js/quiz.min.js +1 -1
  61. package/build/js/track-my-order.min.js +1 -1
  62. package/package.json +1 -1
  63. package/src/badges-ripple.html +120 -0
  64. package/src/badges.html +9 -18
  65. package/src/components/bloomreach/complete-card.hbs +1 -1
  66. package/src/components/bloomreach/why-not-add-card.hbs +26 -7
  67. package/src/components/bloomreach/why-not-add.hbs +1 -1
  68. package/src/components/fulfilment-accordions.hbs +1 -1
  69. package/src/components/image-accordion.hbs +18 -0
  70. package/src/components/kitchen/price.hbs +49 -29
  71. package/src/components/kitchen/strip-stickers.hbs +9 -3
  72. package/src/components/modal-capture.hbs +1 -1
  73. package/src/components/modal-id-type.hbs +271 -0
  74. package/src/components/modal-pdf-preview.hbs +70 -0
  75. package/src/components/package-card.hbs +30 -0
  76. package/src/components/partner-signup-form.hbs +1 -231
  77. package/src/components/pdp-price-actions.hbs +17 -0
  78. package/src/components/postcode-checker.hbs +24 -0
  79. package/src/components/price-badges.hbs +12 -10
  80. package/src/components/price-block-v2.hbs +289 -199
  81. package/src/components/product-main-info-v2.hbs +2 -0
  82. package/src/components/suite-includes.hbs +66 -0
  83. package/src/components/suite-product-card.hbs +47 -0
  84. package/src/components/thumb-gallery.hbs +23 -0
  85. package/src/data/data_badges.json +143 -0
  86. package/src/data/data_bathroom-plp.json +814 -0
  87. package/src/data/data_suite-includes-products.json +134 -0
  88. package/src/img/file-pdf-solid-full.svg +3 -0
  89. package/src/img/lorem_ipsum.pdf +150 -0
  90. package/src/js/components/banner-placement-manager.js +25 -9
  91. package/src/js/components/general/image-accordion.js +54 -0
  92. package/src/js/components/general/switchVat.js +8 -1
  93. package/src/js/components/package-card.js +69 -0
  94. package/src/js/components/store-locator-cards.js +76 -0
  95. package/src/js/emulation/banner-placement-manager.js +219 -188
  96. package/src/js/emulation/bloomreach-widget-calculations.js +1 -1
  97. package/src/js/emulation/mock.js +66 -34
  98. package/src/js/emulation/plp-load-more.js +13 -4
  99. package/src/js/emulation/postcode-checker.js +11 -0
  100. package/src/js/emulation/similar-products-loading.js +22 -0
  101. package/src/js/emulation/tradepro-id-pdf.js +182 -0
  102. package/src/js/libs/pdf-preview.js +1177 -0
  103. package/src/js/page/bloomreach-widget/bloomreach-recommendation-carousel-widget.js +7 -6
  104. package/src/js/page/bloomreach-widget/bloomreach-widget-core.js +47 -27
  105. package/src/js/page/bloomreach-widget/bloomreach-widget.js +5 -0
  106. package/src/js/page/bloomreach-widget/complete-your-project/view.js +11 -6
  107. package/src/js/page/bloomreach-widget/complete-your-project/widget.js +0 -1
  108. package/src/js/page/bloomreach-widget/similar-products-widget.js +17 -0
  109. package/src/js/page/plp-load-more.js +81 -66
  110. package/src/js/page/ripple/bulk-add.js +71 -0
  111. package/src/js/page/ripple/package-bulk-add.js +43 -0
  112. package/src/js/page/ripple/postcode-checker.js +83 -0
  113. package/src/js/page/ripple/thumb-gallery.js +236 -0
  114. package/src/js/page/utils/validation.js +1 -1
  115. package/src/page_bathroom-plp-vat.html +81 -0
  116. package/src/page_bathroom-plp-without-load-more.html +83 -0
  117. package/src/page_bathroom-plp.html +98 -0
  118. package/src/page_checkout_confirmation-billie.html +5 -231
  119. package/src/page_checkout_confirmation-clearpay.html +5 -231
  120. package/src/page_checkout_confirmation-new-apple.html +5 -231
  121. package/src/page_checkout_confirmation-new-google.html +5 -231
  122. package/src/page_checkout_confirmation-new-klarna.html +5 -231
  123. package/src/page_checkout_confirmation-new-paypal.html +5 -231
  124. package/src/page_checkout_delivery-details-v2-calendar-not-loaded.html +167 -0
  125. package/src/page_checkout_payment-details-v2-asm.html +2 -3
  126. package/src/page_checkout_payment-details-v2.html +2 -3
  127. package/src/page_checkout_payment-details_with-card-loader.html +2 -3
  128. package/src/page_checkout_payment-details_with-klarna-loader.html +2 -3
  129. package/src/page_checkout_payment-details_with-loader-v2.html +2 -3
  130. package/src/page_klarna_payment-details_with-klarna.html +2 -3
  131. package/src/page_payment-details-billie-registered-only.html +2 -3
  132. package/src/page_payment-details-billie-unregistered-only.html +2 -3
  133. package/src/page_payment-details-with-billie.html +2 -3
  134. package/src/page_payment-details-with-clearpay.html +2 -3
  135. package/src/page_payment-details-with-gift-card.html +2 -3
  136. package/src/page_payment-details_with_apple-pay.html +0 -1
  137. package/src/page_payment-details_with_google-pay.html +2 -3
  138. package/src/page_pdf-preview-example.html +955 -0
  139. package/src/page_product-details-banner.html +1 -3
  140. package/src/page_product-details-big-wins-disabled-delivery.html +1 -3
  141. package/src/page_product-details-big-wins-non-registered.html +1 -3
  142. package/src/page_product-details-big-wins-out-nearest.html +1 -3
  143. package/src/page_product-details-big-wins-unhappy.html +1 -3
  144. package/src/page_product-details-big-wins.html +1 -3
  145. package/src/page_product-details-billie.html +1 -3
  146. package/src/page_product-details-calculator.html +1 -3
  147. package/src/page_product-details-cashback-v2.html +1 -3
  148. package/src/page_product-details-clearpay.html +1 -3
  149. package/src/page_product-details-cnc-error-notification.html +1 -3
  150. package/src/page_product-details-cnc-success-notification-vat.html +1 -4
  151. package/src/page_product-details-cnc-success-notification.html +1 -3
  152. package/src/page_product-details-default-store.html +1 -3
  153. package/src/page_product-details-energy-efficiency.html +1 -3
  154. package/src/page_product-details-flooring-with-pr-placeholder.html +1 -3
  155. package/src/page_product-details-flooring.html +1 -3
  156. package/src/page_product-details-gallery-actual.html +1 -3
  157. package/src/page_product-details-mfe-calculator.html +1 -3
  158. package/src/page_product-details-mtm-doors.html +1 -3
  159. package/src/page_product-details-only-clearpay.html +1 -3
  160. package/src/page_product-details-paint-mixing.html +1 -3
  161. package/src/page_product-details-ripple-gallery-1-image.html +120 -0
  162. package/src/page_product-details-ripple-gallery-missing-image.html +121 -0
  163. package/src/page_product-details-ripple-gallery.html +121 -0
  164. package/src/page_product-details-saved-pl.html +1 -3
  165. package/src/page_product-details-suite-includes-banners.html +139 -0
  166. package/src/page_product-details-suite-includes-billie.html +128 -0
  167. package/src/page_product-details-suite-includes-klarna.html +120 -0
  168. package/src/page_product-details-suite-includes-vat.html +126 -0
  169. package/src/page_product-details-suite-includes.html +122 -0
  170. package/src/page_product-details-tile-steps-klarna-widget-with-method-ids.html +1 -3
  171. package/src/page_product-details-tile-steps-logout.html +1 -3
  172. package/src/page_product-details-tile-steps-no-new-project-list.html +1 -3
  173. package/src/page_product-details-tile-steps-with-klarna.html +1 -3
  174. package/src/page_product-details-tile-steps.html +1 -3
  175. package/src/page_product-details-v2.html +1 -3
  176. package/src/page_product-details-vat.html +1 -3
  177. package/src/page_product-details-wisdom-mcfc-registered.html +1 -3
  178. package/src/page_product-details-wisdom-mcfc.html +1 -3
  179. package/src/page_product-details-wisdom-oos-registered.html +1 -3
  180. package/src/page_product-details-wisdom-oos.html +1 -3
  181. package/src/page_product-details-wisdom-registered.html +1 -3
  182. package/src/page_product-details-wisdom.html +1 -3
  183. package/src/page_product-details-with-favourite.html +1 -3
  184. package/src/page_product-details-with-global-search-v2.html +2 -3
  185. package/src/page_product-details-with-similar-products-widget.html +132 -0
  186. package/src/page_product-details-with-why-not-add-single.html +1 -0
  187. package/src/page_product-details_no-previous-default.html +1 -3
  188. package/src/page_tradePro-checkout-summary-klarna.html +4 -231
  189. package/src/page_tradePro-checkout-summary.html +4 -231
  190. package/src/page_tradePro-signup.html +5 -0
  191. package/src/scss/common/_loading-button.scss +3 -1
  192. package/src/scss/components/_date-selection-add-new-styles.scss +53 -3
  193. package/src/scss/components/_gift-cards.scss +1 -1
  194. package/src/scss/components/_id-type-modal.scss +39 -0
  195. package/src/scss/components/_image-accordion.scss +54 -0
  196. package/src/scss/components/_kitchen-card.scss +1 -0
  197. package/src/scss/components/_map.scss +38 -0
  198. package/src/scss/components/_package-card.scss +65 -0
  199. package/src/scss/components/_package-plp.scss +88 -0
  200. package/src/scss/components/_pdf-preview-modal.scss +122 -0
  201. package/src/scss/components/_postcode-checker.scss +115 -0
  202. package/src/scss/components/_price-badges-critical.scss +10 -0
  203. package/src/scss/components/_price-badges.scss +10 -0
  204. package/src/scss/components/_price-block-critical.scss +1 -0
  205. package/src/scss/components/_price-block.scss +1 -0
  206. package/src/scss/components/_suite-includes.scss +141 -0
  207. package/src/scss/components/_suite-product-card.scss +98 -0
  208. package/src/scss/components/_thumb-gallery-critical.scss +35 -0
  209. package/src/scss/components/_thumb-gallery.scss +200 -0
  210. package/src/scss/components/bloomreach/_why-not-add.scss +3 -1
  211. package/src/scss/components/checkout-payment-details-v2.scss +44 -20
  212. package/src/scss/components/checkout-payment-repayment-terms.scss +0 -1
  213. package/src/scss/components/kitchen/_price.scss +10 -0
  214. package/src/scss/components/kitchen/_strip-stickers.scss +46 -0
  215. package/src/scss/components/price-block-v2-critical.scss +62 -0
  216. package/src/scss/components/price-block-v2.scss +62 -0
  217. package/src/scss/pages/_checkout-tradepro.scss +1 -0
  218. package/src/scss/pages/_checkout_delivery-details.scss +16 -104
  219. package/src/scss/pages/page_checkout_delivery-new.scss +252 -164
  220. package/src/scss/pages/page_product-details-v2-critical.scss +216 -109
  221. package/src/scss/pages/page_product-details-v2.scss +168 -107
  222. package/src/scss/pages/page_product-details.scss +11 -0
  223. package/src/scss/pages/page_products-list-combined.scss +8 -6
  224. package/src/scss/pages/page_products-list_v2.scss +8 -6
  225. package/src/scss/pages/tradePro-signup.scss +1 -0
  226. package/src/scss/pdp-main-critical.scss +1 -0
  227. package/src/scss/pdp-main.scss +6 -0
  228. package/src/scss/plp-main.scss +5 -0
  229. package/src/sitemap.html +30 -6
  230. package/build/css/components/kitchen/strip-stickers.css +0 -1
  231. package/build/css/components/strip-stickers.css +0 -1
  232. package/src/scss/components/kitchen/strip-stickers.scss +0 -18
  233. package/src/scss/components/strip-stickers.scss +0 -18
@@ -479,24 +479,24 @@ Wick.FEMock = {
479
479
 
480
480
  displayPrice: {
481
481
  currencyIso: 'GBP',
482
- value: 9999,
482
+ value: 1605,
483
483
  priceType: 'BUY',
484
- formattedValue: '£9,999.00',
485
- formattedPriceWithoutCurrencySymbol: '16',
484
+ formattedValue: '£1,605.00',
485
+ formattedPriceWithoutCurrencySymbol: '1605.00',
486
486
  currencySymbol: '£',
487
487
  vatRatePercentage: 20,
488
- valueInPence: 999900,
489
- wasPrice: 3000,
488
+ valueInPence: 160500,
489
+ wasPrice: 1899,
490
490
  },
491
491
  displayPriceExclusiveVat: {
492
492
  currencyIso: 'GBP',
493
- value: 9998,
493
+ value: 1337.5,
494
494
  priceType: 'BUY',
495
- formattedValue: '£9,998.00',
496
- formattedPriceWithoutCurrencySymbol: '13.33',
495
+ formattedValue: '£1,337.50',
496
+ formattedPriceWithoutCurrencySymbol: '1337.50',
497
497
  currencySymbol: '£',
498
- valueInPence: 999800,
499
- wasPrice: 2500,
498
+ valueInPence: 133750,
499
+ wasPrice: 1582.5,
500
500
  },
501
501
  },
502
502
  },
@@ -530,22 +530,22 @@ Wick.FEMock = {
530
530
  externalReviewCount: 48,
531
531
  displayPrice: {
532
532
  currencyIso: 'GBP',
533
- value: 9999,
533
+ value: 7.5,
534
534
  priceType: 'BUY',
535
- formattedValue: '£7.5220',
535
+ formattedValue: '£7.50',
536
536
  formattedPriceWithoutCurrencySymbol: '7.50',
537
537
  currencySymbol: '£',
538
538
  vatRatePercentage: 20,
539
- valueInPence: 999900,
539
+ valueInPence: 750,
540
540
  },
541
541
  displayPriceExclusiveVat: {
542
542
  currencyIso: 'GBP',
543
- value: 9998,
543
+ value: 6.25,
544
544
  priceType: 'BUY',
545
545
  formattedValue: '£6.25',
546
546
  formattedPriceWithoutCurrencySymbol: '6.25',
547
547
  currencySymbol: '£',
548
- valueInPence: 999800,
548
+ valueInPence: 625,
549
549
  },
550
550
  },
551
551
  },
@@ -767,16 +767,16 @@ Wick.FEMock = {
767
767
  price: {
768
768
  currencyIso: 'GBP',
769
769
  currencySymbol: '£',
770
- formattedPriceWithoutCurrencySymbol: '16',
771
- formattedValue: '£16',
770
+ formattedPriceWithoutCurrencySymbol: '18.50',
771
+ formattedValue: '£18.50',
772
772
  infoUom: 'L',
773
773
  infoUomDescription: 'L',
774
774
  infoUomPrice: 6.4,
775
775
  priceType: 'BUY',
776
- value: 16,
777
- valueInPence: 1600,
776
+ value: 18.5,
777
+ valueInPence: 1850,
778
778
  vatRatePercentage: 20,
779
- wasPrice: 24,
779
+ wasPrice: 24.5,
780
780
  },
781
781
  images: [
782
782
  {
@@ -1034,16 +1034,16 @@ Wick.FEMock = {
1034
1034
  },
1035
1035
  priceExclusiveVat: {
1036
1036
  currencyIso: 'GBP',
1037
- value: 15,
1037
+ value: 15.42,
1038
1038
  priceType: 'BUY',
1039
- formattedValue: '£15',
1040
- formattedPriceWithoutCurrencySymbol: '15',
1039
+ formattedValue: '£15.42',
1040
+ formattedPriceWithoutCurrencySymbol: '15.42',
1041
1041
  currencySymbol: '£',
1042
1042
  infoUom: 'length',
1043
1043
  infoUomDescription: 'length',
1044
1044
  infoUomPrice: 8.33,
1045
- valueInPence: 1500,
1046
- wasPrice: 20,
1045
+ valueInPence: 1542,
1046
+ wasPrice: 20.42,
1047
1047
  },
1048
1048
  downStreamData: {
1049
1049
  fulfillmentType: 'STANDARD',
@@ -1103,29 +1103,30 @@ Wick.FEMock = {
1103
1103
  isAddedToFavourites: false,
1104
1104
  displayPrice: {
1105
1105
  currencyIso: 'GBP',
1106
- value: 18,
1106
+ value: 18.5,
1107
1107
  priceType: 'BUY',
1108
- formattedValue: '£18',
1109
- formattedPriceWithoutCurrencySymbol: '18',
1108
+ formattedValue: '£18.50',
1109
+ formattedPriceWithoutCurrencySymbol: '18.50',
1110
1110
  currencySymbol: '£',
1111
1111
  infoUom: 'length',
1112
1112
  infoUomDescription: 'length',
1113
1113
  infoUomPrice: 10,
1114
1114
  vatRatePercentage: 20,
1115
- valueInPence: 1800,
1116
- wasPrice: 24,
1115
+ valueInPence: 1850,
1116
+ wasPrice: 24.5,
1117
1117
  },
1118
1118
  displayPriceExclusiveVat: {
1119
1119
  currencyIso: 'GBP',
1120
- value: 15,
1120
+ value: 15.42,
1121
1121
  priceType: 'BUY',
1122
- formattedValue: '£15',
1123
- formattedPriceWithoutCurrencySymbol: '15',
1122
+ formattedValue: '£15.42',
1123
+ formattedPriceWithoutCurrencySymbol: '15.42',
1124
1124
  currencySymbol: '£',
1125
1125
  infoUom: 'length',
1126
1126
  infoUomDescription: 'length',
1127
1127
  infoUomPrice: 8.33,
1128
- valueInPence: 1500,
1128
+ valueInPence: 1542,
1129
+ wasPrice: 20.42,
1129
1130
  },
1130
1131
  displayPromoDescription: '5.51 GBP discount for cart for 250064, 191018',
1131
1132
  displayPromoDescriptionExclusiveVat:
@@ -4035,3 +4036,34 @@ Wick.FEMock = {
4035
4036
  </div>
4036
4037
  `,
4037
4038
  };
4039
+
4040
+ Wick.FEMock.dataBloomreach.similarProductsRecommendations = {
4041
+ ...Wick.FEMock.dataBloomreach.whyNotAddRecommendations,
4042
+ recommendedProducts: Wick.FEMock.dataBloomreach.whyNotAddRecommendations.recommendedProducts.map(
4043
+ function (recommendation, index) {
4044
+ if (index !== 1) {
4045
+ return recommendation;
4046
+ }
4047
+
4048
+ return {
4049
+ ...recommendation,
4050
+ baseProduct: {
4051
+ ...recommendation.baseProduct,
4052
+ displayPrice: {
4053
+ ...recommendation.baseProduct.displayPrice,
4054
+ wasPrice: 9.99,
4055
+ },
4056
+ displayPriceExclusiveVat: {
4057
+ ...recommendation.baseProduct.displayPriceExclusiveVat,
4058
+ wasPrice: 8.33,
4059
+ },
4060
+ },
4061
+ };
4062
+ }
4063
+ ),
4064
+ widgetMetadata: {
4065
+ responseId: 'mock-similar-products-response',
4066
+ id: 'similar-products-12345',
4067
+ type: 'similar_products',
4068
+ },
4069
+ };
@@ -1,7 +1,16 @@
1
- function getHtmlByCurrentPage({ currentPage }) {
2
- const pagesData = Wick.VatToggle.isToggleVatAvailable()
3
- ? Wick.FEMock.productListVatPagesData
4
- : Wick.FEMock.productListPagesData;
1
+ function getHtmlByCurrentPage({ currentPage, isRippleData }) {
2
+ let pagesData;
3
+
4
+ if (isRippleData) {
5
+ pagesData = Wick.VatToggle.isToggleVatAvailable()
6
+ ? Wick.FEMock.productListVatRippleData
7
+ : Wick.FEMock.productListRippleData;
8
+ } else {
9
+ pagesData = Wick.VatToggle.isToggleVatAvailable()
10
+ ? Wick.FEMock.productListVatPagesData
11
+ : Wick.FEMock.productListPagesData;
12
+ }
13
+
5
14
  const matchingData = pagesData.find((item) => item.page === currentPage);
6
15
 
7
16
  return matchingData.html;
@@ -0,0 +1,11 @@
1
+ function bindPostcodeCheckAvailabilityEvent() {
2
+ $(window).on('postcodeCheckAviability', function ({ detail: { payload, resolve } }) {
3
+ setTimeout(function () {
4
+ resolve({ postcode: payload.postcode, isAvailable: true });
5
+ }, 600);
6
+ });
7
+ }
8
+
9
+ $(document).ready(function () {
10
+ bindPostcodeCheckAvailabilityEvent();
11
+ });
@@ -0,0 +1,22 @@
1
+ var Wick = window.Wick || {};
2
+
3
+ $(document).ready(function () {
4
+ window.setTimeout(function () {
5
+ const $container = $('[data-similar-products-widget]').first();
6
+
7
+ if (!$container.length) {
8
+ return;
9
+ }
10
+
11
+ const mockDataKey = $container.attr('data-mock-key');
12
+ const payloadData =
13
+ Wick.FEMock && Wick.FEMock.dataBloomreach && Wick.FEMock.dataBloomreach[mockDataKey];
14
+
15
+ if (!payloadData) {
16
+ $container.empty().hide();
17
+ return;
18
+ }
19
+
20
+ Wick.BloomreachWidget.init('similarProducts', payloadData);
21
+ }, 3000);
22
+ });
@@ -0,0 +1,182 @@
1
+ /* global PdfPreview */
2
+ import { showLoader, hideLoader } from '../page/utils/loader';
3
+
4
+ /**
5
+ * Prototype-only emulation of the TradePro "Choose Type of ID" PDF flow.
6
+ *
7
+ * On the live site this behaviour belongs to BE (Wick.ProofOfTrade in
8
+ * tradepro-proof-of-trade.js), which uploads the file behind the full-page
9
+ * loader, marks the field as attached, and swaps the ID list modal (#attach)
10
+ * for a preview modal. This mirrors that flow for PDFs so the prototype can be
11
+ * clicked through. What ships is the PdfPreview library, the markup and the
12
+ * CSS; this file only lives in emulation.min.js.
13
+ */
14
+ var Wick = (window.Wick = window.Wick || {});
15
+
16
+ Wick.TradeProIdPdf = {
17
+ // Stands in for the S3 upload round trip.
18
+ UPLOAD_DELAY: 1000,
19
+ // Shown for fields rendered as already attached, which have no File behind
20
+ // them (the PDF counterpart of Letterhead's placeholder thumbnail).
21
+ SAMPLE_PDF: 'img/lorem_ipsum.pdf',
22
+
23
+ el: {
24
+ field: '[data-pdf-preview-field]',
25
+ fileInput: '.tradepro-attachment',
26
+ trigger: '.signup-tradepro__modal-trigger',
27
+ pdfIcon: '.tradepro-field__pdf-icon',
28
+ paperclipIcon: '.icon__paperclip',
29
+ cameraIcon: '.icon__camera',
30
+ hasPdfClass: 'tradepro-field--has-pdf',
31
+ loader: '.tradepro-id-loader',
32
+ attachModal: '#attach',
33
+ modal: '#pdf-preview',
34
+ modalName: '.pdf-preview__name',
35
+ preview: '#pdf-preview-viewer',
36
+ yes: '.pdf-preview_yes',
37
+ no: '.pdf-preview_no',
38
+ },
39
+
40
+ // Field whose PDF is open in the preview modal.
41
+ $activeField: null,
42
+
43
+ isPdfFile(file) {
44
+ return !!file && file.type === 'application/pdf';
45
+ },
46
+
47
+ attach($field, file) {
48
+ var el = Wick.TradeProIdPdf.el;
49
+
50
+ $field.data('pdfFile', file);
51
+ $field.attr('title', file.name);
52
+ $field.find(el.pdfIcon).removeClass('d-none');
53
+ $field.find(el.paperclipIcon).addClass('d-none');
54
+ $field.find(el.cameraIcon).addClass('d-none');
55
+ $field.addClass(el.hasPdfClass);
56
+ },
57
+
58
+ detach($field) {
59
+ var el = Wick.TradeProIdPdf.el;
60
+
61
+ $field.removeData('pdfFile');
62
+ $field.removeAttr('title');
63
+ $field.find(el.pdfIcon).addClass('d-none');
64
+ $field.find(el.paperclipIcon).removeClass('d-none');
65
+ $field.find(el.cameraIcon).removeClass('d-none');
66
+ $field.removeClass(el.hasPdfClass);
67
+ },
68
+
69
+ handleFileChange() {
70
+ var el = Wick.TradeProIdPdf.el;
71
+ var $field = $(this).closest(el.field);
72
+ var file = this.files && this.files[0];
73
+
74
+ // Images keep the prototype's static image flow.
75
+ if (!Wick.TradeProIdPdf.isPdfFile(file)) {
76
+ Wick.TradeProIdPdf.detach($field);
77
+
78
+ return;
79
+ }
80
+
81
+ showLoader(el.loader);
82
+
83
+ setTimeout(function () {
84
+ hideLoader(el.loader);
85
+ Wick.TradeProIdPdf.attach($field, file);
86
+ }, Wick.TradeProIdPdf.UPLOAD_DELAY);
87
+ },
88
+
89
+ handleFieldClick(event) {
90
+ var el = Wick.TradeProIdPdf.el;
91
+ var $field = $(this);
92
+
93
+ if (!$field.hasClass(el.hasPdfClass)) {
94
+ return;
95
+ }
96
+
97
+ event.preventDefault();
98
+
99
+ Wick.TradeProIdPdf.$activeField = $field;
100
+ $(el.modal)
101
+ .find(el.modalName)
102
+ .text($.trim($field.find(el.trigger).first().text()));
103
+
104
+ // Swap the modals rather than stacking them, as BE does for #capture.
105
+ // Waiting for #attach to finish hiding stops Bootstrap from clearing
106
+ // the body's modal-open class after the preview has opened.
107
+ $(el.attachModal)
108
+ .one('hidden.bs.modal', function () {
109
+ $(el.modal).modal('show');
110
+ })
111
+ .modal('hide');
112
+ },
113
+
114
+ handleModalShown() {
115
+ var $field = Wick.TradeProIdPdf.$activeField;
116
+
117
+ if ($field) {
118
+ new PdfPreview(Wick.TradeProIdPdf.el.preview).load(
119
+ $field.data('pdfFile') || Wick.TradeProIdPdf.SAMPLE_PDF
120
+ );
121
+ }
122
+ },
123
+
124
+ handleModalHidden() {
125
+ var el = Wick.TradeProIdPdf.el;
126
+ var preview = PdfPreview.get(el.preview);
127
+
128
+ if (preview) {
129
+ preview.reset();
130
+ }
131
+
132
+ Wick.TradeProIdPdf.$activeField = null;
133
+ $(el.attachModal).modal('show');
134
+ },
135
+
136
+ handleYesClick(event) {
137
+ event.preventDefault();
138
+ $(Wick.TradeProIdPdf.el.modal).modal('hide');
139
+ },
140
+
141
+ handleNoClick(event) {
142
+ event.preventDefault();
143
+
144
+ var $field = Wick.TradeProIdPdf.$activeField;
145
+
146
+ if ($field) {
147
+ Wick.TradeProIdPdf.detach($field);
148
+ // Deleting also forgets the chosen file, so the same one can be
149
+ // picked again (an unchanged input fires no change event).
150
+ $field.find(Wick.TradeProIdPdf.el.fileInput).val('');
151
+ }
152
+
153
+ $(Wick.TradeProIdPdf.el.modal).modal('hide');
154
+ },
155
+
156
+ init() {
157
+ var el = Wick.TradeProIdPdf.el;
158
+
159
+ $(document).on(
160
+ 'change',
161
+ el.field + ' ' + el.fileInput,
162
+ Wick.TradeProIdPdf.handleFileChange
163
+ );
164
+ $(document).on('click', el.field, Wick.TradeProIdPdf.handleFieldClick);
165
+
166
+ $(el.modal)
167
+ .on('shown.bs.modal', Wick.TradeProIdPdf.handleModalShown)
168
+ .on('hidden.bs.modal', Wick.TradeProIdPdf.handleModalHidden)
169
+ .on('click', el.yes, Wick.TradeProIdPdf.handleYesClick)
170
+ .on('click', el.no, Wick.TradeProIdPdf.handleNoClick);
171
+ },
172
+ };
173
+
174
+ $(document).ready(function () {
175
+ var el = Wick.TradeProIdPdf.el;
176
+
177
+ if (!$(el.field).length || !$(el.modal).length || typeof PdfPreview === 'undefined') {
178
+ return;
179
+ }
180
+
181
+ Wick.TradeProIdPdf.init();
182
+ });