wickes-css2 2.103.0-IC-976-pre-commit-lint.1 → 2.103.0-IC-976-pre-commit-lint.3

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 (672) hide show
  1. package/build/css/main.css +1 -1
  2. package/build/css/pages/page_book-consultant-thank-you-new.css +1 -1
  3. package/build/css/pages/page_pre_home_thank-you.css +1 -1
  4. package/build/css/pages/page_top-rated.css +1 -1
  5. package/build/img/TradePaint.svg +42 -14
  6. package/build/img/apple-pay.svg +12 -7
  7. package/build/img/big-white-apple-pay.svg +10 -5
  8. package/build/img/billie-logo.svg +4 -2
  9. package/build/img/billie-modal.svg +4 -2
  10. package/build/img/billie-pdp.svg +12 -9
  11. package/build/img/billie-spinner.svg +5 -3
  12. package/build/img/billie.svg +3 -1
  13. package/build/img/clearpay-logo.svg +6 -1
  14. package/build/img/clearpay-spinner.svg +4 -1
  15. package/build/img/energy-efficiency/energy-marker.svg +12 -1
  16. package/build/img/google-spinner.svg +14 -7
  17. package/build/img/googlepay.svg +23 -12
  18. package/build/img/home-banner_arrow.svg +7 -1
  19. package/build/img/ic-menu.svg +7 -1
  20. package/build/img/ic_info_big.svg +4 -1
  21. package/build/img/klarna-big.svg +18 -9
  22. package/build/img/klarna-sm.svg +5 -2
  23. package/build/img/klarna-spinner.svg +3 -1
  24. package/build/img/logo-klarna.svg +5 -2
  25. package/build/img/mastercard.svg +6 -3
  26. package/build/img/payapal_text.svg +6 -1
  27. package/build/img/payment/checkout/applepay.svg +12 -7
  28. package/build/img/payment/checkout/billie.svg +4 -2
  29. package/build/img/payment/checkout/clearpay.svg +5 -1
  30. package/build/img/payment/checkout/googlepay.svg +23 -12
  31. package/build/img/payment/checkout/mastercard.svg +13 -1
  32. package/build/img/payment/checkout/paypal.svg +37 -1
  33. package/build/img/payment/checkout/visa.svg +8 -1
  34. package/build/img/payment/footer/applepay.svg +12 -7
  35. package/build/img/payment/footer/billie.svg +3 -1
  36. package/build/img/payment/footer/clearpay.svg +18 -10
  37. package/build/img/payment/footer/googlepay.svg +23 -12
  38. package/build/img/payment/footer/mastercard.svg +13 -1
  39. package/build/img/payment/footer/paypal.svg +37 -1
  40. package/build/img/payment/footer/visa.svg +8 -1
  41. package/build/img/paypal.svg +8 -1
  42. package/build/img/paypal_logo_loader_paypal.svg +4 -1
  43. package/build/img/paypal_logo_loader_pp.svg +10 -1
  44. package/build/img/placeholders/full-width-img.svg +9 -1
  45. package/build/img/placeholders/img-2-to-1.svg +9 -1
  46. package/build/img/placeholders/img-3-to-4.svg +9 -1
  47. package/build/img/placeholders/img-4-to-3.svg +9 -1
  48. package/build/img/proposition_arrow_click.svg +7 -1
  49. package/build/img/proposition_delivery.svg +7 -1
  50. package/build/img/proposition_price.svg +7 -1
  51. package/build/img/proposition_returns.svg +7 -1
  52. package/build/img/social-icon-facebook.svg +8 -1
  53. package/build/img/social-icon-instagram.svg +15 -1
  54. package/build/img/social-icon-pinterest.svg +7 -1
  55. package/build/img/socials/facebook.svg +5 -1
  56. package/build/img/socials/instagram.svg +5 -1
  57. package/build/img/socials/pinterest.svg +5 -1
  58. package/build/img/socials/tiktok.svg +5 -1
  59. package/build/img/socials/x-twitter.svg +5 -1
  60. package/build/img/socials/youtube.svg +5 -1
  61. package/build/img/socials_facebook_color.svg +7 -1
  62. package/build/img/socials_facebook_white_blue_color.svg +5 -1
  63. package/build/img/socials_info_big.svg +7 -1
  64. package/build/img/socials_instagram_color.svg +16 -1
  65. package/build/img/socials_pinterest_color.svg +4 -1
  66. package/build/img/socials_twitter_color.svg +4 -1
  67. package/build/img/socials_whatsapp_color.svg +5 -1
  68. package/build/img/socials_youtube_color.svg +4 -1
  69. package/build/img/stars.svg +8 -1
  70. package/build/img/visa-logo.svg +3 -1
  71. package/build/img/wickes-dc-logo.svg +17 -13
  72. package/build/img/wickes-logo-v2.svg +15 -1
  73. package/build/img/wickes-logo.svg +36 -1
  74. package/build/img/young-minds.svg +10 -8
  75. package/build/js/account-members.min.js +1 -1
  76. package/build/js/basket.min.js +2 -2
  77. package/build/js/bootstrap.bundle.min.js +1 -1
  78. package/build/js/bundle.min.js +1 -1
  79. package/build/js/checkout.min.js +2 -2
  80. package/build/js/emulation.min.js +11866 -10333
  81. package/build/js/general.bundle.min.js +1 -1
  82. package/build/js/iframeResizer.min.js +2 -2
  83. package/build/js/kitchen/kitchen-plp.min.js +1 -1
  84. package/build/js/merged-checkout.min.js +2 -2
  85. package/build/js/my-orders.min.js +1 -1
  86. package/build/js/page/accordion.js +31 -29
  87. package/build/js/page/account-deletion.js +13 -13
  88. package/build/js/page/account-hub.js +128 -119
  89. package/build/js/page/account-members.js +229 -216
  90. package/build/js/page/address-book.js +186 -184
  91. package/build/js/page/basket/add-project-list-id.js +158 -130
  92. package/build/js/page/basket/clearpay.js +17 -17
  93. package/build/js/page/basket/display-energy-efficiency.js +13 -13
  94. package/build/js/page/basket/gtm.js +60 -54
  95. package/build/js/page/basket/klarna.js +2 -2
  96. package/build/js/page/basket/paypal.js +33 -33
  97. package/build/js/page/basket/session-sync.js +5 -5
  98. package/build/js/page/basket/summary-mobile.js +16 -16
  99. package/build/js/page/basket/wisdom.js +54 -39
  100. package/build/js/page/basket-v2.js +415 -261
  101. package/build/js/page/basket.js +42 -39
  102. package/build/js/page/billie-business-type.js +22 -22
  103. package/build/js/page/business-account-form.js +12 -12
  104. package/build/js/page/buying-guides-guttering.js +3 -3
  105. package/build/js/page/category-landing.js +18 -11
  106. package/build/js/page/change-password.js +100 -99
  107. package/build/js/page/checkout-confirmation-new.js +127 -70
  108. package/build/js/page/checkout-confirmation.js +6 -6
  109. package/build/js/page/checkout-delivery-address.js +35 -32
  110. package/build/js/page/checkout-delivery-details-loader.js +2 -5
  111. package/build/js/page/checkout-edit-address.js +1 -1
  112. package/build/js/page/checkout-payment-details.js +170 -172
  113. package/build/js/page/checkout-sign-in.js +15 -11
  114. package/build/js/page/checkout.js +1 -1
  115. package/build/js/page/cms-homepage.js +87 -45
  116. package/build/js/page/components/charity.js +114 -120
  117. package/build/js/page/components/csrf.js +4 -4
  118. package/build/js/page/components/discounts.js +39 -39
  119. package/build/js/page/components/favourite-product.js +125 -113
  120. package/build/js/page/components/global-search.js +204 -192
  121. package/build/js/page/components/modal-observer.js +43 -46
  122. package/build/js/page/components/order-summary.js +26 -22
  123. package/build/js/page/components/pagination.js +124 -117
  124. package/build/js/page/components/retry-action.js +2 -2
  125. package/build/js/page/components/saving-shopping-list.js +381 -314
  126. package/build/js/page/components/sticky-order-observer.js +36 -39
  127. package/build/js/page/components/voucher.js +46 -47
  128. package/build/js/page/copy-project-id.js +23 -23
  129. package/build/js/page/countdown-timer.js +6 -6
  130. package/build/js/page/default-store.js +40 -34
  131. package/build/js/page/design-appointment.js +6 -3
  132. package/build/js/page/energy-efficiency.js +39 -25
  133. package/build/js/page/finance-tabs.js +4 -4
  134. package/build/js/page/general/cookie.js +20 -10
  135. package/build/js/page/installation/calculator.js +12 -16
  136. package/build/js/page/installation/fi.js +76 -71
  137. package/build/js/page/installation/generic.js +21 -20
  138. package/build/js/page/installation/installation.js +36 -22
  139. package/build/js/page/installation/pdp-generic.js +3 -9
  140. package/build/js/page/installation/ti.js +26 -24
  141. package/build/js/page/installer-files-form.js +98 -76
  142. package/build/js/page/installer-form.js +502 -447
  143. package/build/js/page/installer-validation.js +848 -761
  144. package/build/js/page/instore-checkout.js +2 -2
  145. package/build/js/page/kitchen/card-carousel.js +21 -21
  146. package/build/js/page/kitchen/colour-swatches.js +153 -149
  147. package/build/js/page/kitchen/kitchen-card.js +62 -64
  148. package/build/js/page/kitchen/mobile-nav.js +26 -27
  149. package/build/js/page/kitchen/plp-filters-chips.js +72 -70
  150. package/build/js/page/kitchen/plp-filters-mobile.js +64 -60
  151. package/build/js/page/kitchen/plp-filters-panel.js +106 -102
  152. package/build/js/page/kitchen/plp-filters-utils.js +54 -53
  153. package/build/js/page/kitchen/plp-filters.js +210 -194
  154. package/build/js/page/kitchen/sort-by.js +149 -149
  155. package/build/js/page/klarna-modal-scroll-disable.js +4 -4
  156. package/build/js/page/merged-checkout.js +6 -3
  157. package/build/js/page/my-account.js +44 -46
  158. package/build/js/page/my-orders.js +153 -149
  159. package/build/js/page/online-exclusive.js +28 -31
  160. package/build/js/page/pdp-favourite.js +4 -4
  161. package/build/js/page/pdp-tile.js +0 -4
  162. package/build/js/page/pdp.js +41 -37
  163. package/build/js/page/personal-details.js +307 -277
  164. package/build/js/page/plp-cards-v2.js +39 -25
  165. package/build/js/page/plp-favourite.js +9 -9
  166. package/build/js/page/plp-img-v2.js +2 -3
  167. package/build/js/page/plp-load-more.js +66 -66
  168. package/build/js/page/plp.js +9 -10
  169. package/build/js/page/pre-home.js +159 -144
  170. package/build/js/page/project-list/generate-project-id.js +77 -68
  171. package/build/js/page/project-list-note.js +234 -232
  172. package/build/js/page/project-list.js +2 -3
  173. package/build/js/page/quiz.js +292 -292
  174. package/build/js/page/select-address.js +27 -14
  175. package/build/js/page/smart-banner.js +8 -5
  176. package/build/js/page/ti.js +67 -42
  177. package/build/js/page/top-rated.js +36 -29
  178. package/build/js/page/track-my-order.js +172 -156
  179. package/build/js/page/tradePro-rewards.js +34 -36
  180. package/build/js/page/utils/array-utils.js +13 -10
  181. package/build/js/page/utils/copy-to-clipboard.js +45 -45
  182. package/build/js/page/utils/create-event.js +8 -8
  183. package/build/js/page/utils/errorMesages.js +12 -11
  184. package/build/js/page/utils/helpers.js +14 -9
  185. package/build/js/page/utils/http-action.js +4 -5
  186. package/build/js/page/utils/loader.js +5 -5
  187. package/build/js/page/utils/routes.js +9 -9
  188. package/build/js/page/utils/url-query.js +4 -4
  189. package/build/js/page/utils/validation.js +93 -96
  190. package/build/js/page/wickes-dc.js +51 -44
  191. package/build/js/page/wismo.js +12 -12
  192. package/build/js/page/your-details.js +77 -41
  193. package/build/js/pdp-favourite-product.bundle.min.js +1 -1
  194. package/build/js/pdp.bundle.min.js +1 -1
  195. package/build/js/personal-details.min.js +1 -1
  196. package/build/js/plp-favourite-product.bundle.min.js +1 -1
  197. package/build/js/plp.bundle.min.js +1 -1
  198. package/build/js/project-list.min.js +16 -16
  199. package/build/js/pstrength.min.js +28 -34
  200. package/build/js/wickers.json +2069 -2069
  201. package/package.json +7 -3
  202. package/src/data/data_account-families.json +1 -1
  203. package/src/data/data_bathroom-installation.json +1 -1
  204. package/src/data/data_bathroom-ranges.json +14 -14
  205. package/src/data/data_business-pages.json +27 -27
  206. package/src/data/data_calendar.json +7 -1
  207. package/src/data/data_checkout-order.json +306 -306
  208. package/src/data/data_contact-us-form.json +17 -17
  209. package/src/data/data_contact-us-reasons.json +16 -16
  210. package/src/data/data_design-appointment.json +27 -12
  211. package/src/data/data_discounts.json +4 -4
  212. package/src/data/data_fdl-new-product.json +6 -6
  213. package/src/data/data_fdl-product.json +75 -87
  214. package/src/data/data_flooring-installation.json +6 -6
  215. package/src/data/data_great-quality.json +2 -2
  216. package/src/data/data_heating-plumbing.json +2 -2
  217. package/src/data/data_how-to_fit-corrugated-sheeting.json +245 -258
  218. package/src/data/data_journey-price-lists.json +1 -1
  219. package/src/data/data_kb-brouchure-requests.json +10 -10
  220. package/src/data/data_kitchen-brochure-request.json +1 -1
  221. package/src/data/data_kitchen-cabinets.json +1 -1
  222. package/src/data/data_kitchen-plp.json +24 -18
  223. package/src/data/data_kitchen-ranges.json +21 -23
  224. package/src/data/data_latest-offers.json +1044 -1044
  225. package/src/data/data_locators.json +130 -132
  226. package/src/data/data_next-steps.json +20 -20
  227. package/src/data/data_notification-page.json +72 -24
  228. package/src/data/data_online-ranges.json +1 -1
  229. package/src/data/data_page-category-hub.json +1 -1
  230. package/src/data/data_page-confirmation.json +9 -9
  231. package/src/data/data_page-project-multiple-list.json +18 -18
  232. package/src/data/data_pre-home.json +1090 -1082
  233. package/src/data/data_price-event-new.json +1 -1
  234. package/src/data/data_saved-project-list.json +8 -8
  235. package/src/data/data_seo-widgets.json +31 -31
  236. package/src/data/data_shopping-cart-v2.json +1 -2
  237. package/src/data/data_shopping-cart-with-energy.json +229 -229
  238. package/src/data/data_storage-solutions.json +99 -99
  239. package/src/data/data_tile-installation.json +1 -1
  240. package/src/data/data_top-rated-perfect-product.json +204 -204
  241. package/src/data/data_trade-essentials.json +1 -1
  242. package/src/data/data_tradePro_cards.json +0 -1
  243. package/src/data/data_user-address-saved.json +33 -33
  244. package/src/data/data_voucher_tradePro.json +5 -5
  245. package/src/data/data_wismo.json +12 -12
  246. package/src/data/how-to-guides/data-how_to_fit-bath-and-taps.json +2 -2
  247. package/src/data/how-to-guides/data_how-to-change-door-window-furniture.json +274 -274
  248. package/src/data/how-to-guides/data_how-to-fit-door-locks.json +3 -8
  249. package/src/data/how-to-guides/data_how-to-fit-worktop.json +5 -13
  250. package/src/data/how-to-guides/data_how-to-fit_basin-and-taps.json +2 -6
  251. package/src/data/how-to-guides/data_how-to-fit_bath-and-taps.json +3 -10
  252. package/src/data/how-to-guides/data_how-to-plumb-a-kitchen-appliance.json +3 -7
  253. package/src/data/how-to-guides/data_how-to-unblock-sink.json +5 -7
  254. package/src/data/how-to-guides/data_how-to_bleed-radiator.json +134 -134
  255. package/src/data/how-to-guides/data_how-to_build-raised-deck.json +4 -4
  256. package/src/data/how-to-guides/data_how-to_change-socket.json +2 -2
  257. package/src/data/how-to-guides/data_how-to_fit-guttering.json +282 -282
  258. package/src/data/how-to-guides/data_how-to_fit-toilet.json +2 -2
  259. package/src/data/how-to-guides/data_how-to_fit-wall-tiles.json +77 -23
  260. package/src/data/how-to-guides/data_how-to_fit-worktops.json +3 -4
  261. package/src/data/how-to-guides/data_how-to_fix-leaking-sink.json +3 -3
  262. package/src/data/how-to-guides/data_how-to_fix-leaking-tap.json +3 -3
  263. package/src/data/how-to-guides/data_how-to_garden-calendar.json +4 -5
  264. package/src/data/how-to-guides/data_how-to_grow-fruit-veg.json +3 -3
  265. package/src/data/how-to-guides/data_how-to_hang-internal-door.json +266 -266
  266. package/src/data/how-to-guides/data_how-to_install-artificial-grass.json +3 -4
  267. package/src/data/how-to-guides/data_how-to_install-base-wall-cabinets.json +3 -4
  268. package/src/data/how-to-guides/data_how-to_install-composite-decking.json +6 -14
  269. package/src/data/how-to-guides/data_how-to_install-deck-lighting.json +4 -7
  270. package/src/data/how-to-guides/data_how-to_install-fence.json +5 -5
  271. package/src/data/how-to-guides/data_how-to_insulate-loft.json +2 -2
  272. package/src/data/how-to-guides/data_how-to_lay-deck.json +4 -6
  273. package/src/data/how-to-guides/data_how-to_lay-laminate-flooring.json +3 -8
  274. package/src/data/how-to-guides/data_how-to_lay-maintain-turf.json +4 -4
  275. package/src/data/how-to-guides/data_how-to_lay-path.json +5 -6
  276. package/src/data/how-to-guides/data_how-to_lay-patio.json +5 -5
  277. package/src/data/how-to-guides/data_how-to_lay-solid-wood-flooring.json +0 -8
  278. package/src/data/how-to-guides/data_how-to_lay-vinyl-carpet-tiles.json +3 -3
  279. package/src/data/how-to-guides/data_how-to_paint-a-room.json +5 -5
  280. package/src/data/how-to-guides/data_how-to_plaster-wall.json +8 -6
  281. package/src/data/how-to-guides/data_how-to_plumb-kitchen-appliances.json +3 -3
  282. package/src/data/how-to-guides/data_how-to_prepare-interior-woodwork.json +5 -5
  283. package/src/data/how-to-guides/data_how-to_prepare-paint-exterior-walls.json +1 -1
  284. package/src/data/how-to-guides/data_how-to_prepare-wall-and-ceilings.json +9 -9
  285. package/src/data/how-to-guides/data_how-to_put_up_shelf.json +4 -4
  286. package/src/data/how-to-guides/data_how-to_remove-replace-tiles.json +3 -3
  287. package/src/data/how-to-guides/data_how-to_repair-wall.json +384 -385
  288. package/src/data/how-to-guides/data_how-to_tile-bathroom.json +3 -4
  289. package/src/data/how-to-guides/data_how-to_unblock-sink.json +3 -3
  290. package/src/data/how-to-guides/data_install-composite-decking.json +4 -4
  291. package/src/data/how-to-guides/data_planting-techniques.json +3 -3
  292. package/src/data/how-to-guides/fit-roofing-shingles.json +4 -4
  293. package/src/data/how-to-guides/hubs/data_how-to_hub_home.json +1 -1
  294. package/src/data/my-account/data_address-book.json +12 -3
  295. package/src/data/my-account/data_my-order.json +1 -1
  296. package/src/data/my-account/data_personal-details.json +32 -8
  297. package/src/data/navigation.json +1016 -805
  298. package/src/data/page_how-to-choose-your-doors.json +1 -2
  299. package/src/data/public/wickers.json +2069 -2069
  300. package/src/img/TradePaint.svg +42 -14
  301. package/src/img/apple-pay.svg +12 -7
  302. package/src/img/big-white-apple-pay.svg +10 -5
  303. package/src/img/billie-logo.svg +4 -2
  304. package/src/img/billie-modal.svg +4 -2
  305. package/src/img/billie-pdp.svg +12 -9
  306. package/src/img/billie-spinner.svg +5 -3
  307. package/src/img/billie.svg +3 -1
  308. package/src/img/clearpay-logo.svg +6 -1
  309. package/src/img/clearpay-spinner.svg +4 -1
  310. package/src/img/energy-efficiency/energy-marker.svg +12 -1
  311. package/src/img/google-spinner.svg +14 -7
  312. package/src/img/googlepay.svg +23 -12
  313. package/src/img/home-banner_arrow.svg +7 -1
  314. package/src/img/ic-menu.svg +7 -1
  315. package/src/img/ic_info_big.svg +4 -1
  316. package/src/img/klarna-big.svg +18 -9
  317. package/src/img/klarna-sm.svg +5 -2
  318. package/src/img/klarna-spinner.svg +3 -1
  319. package/src/img/logo-klarna.svg +5 -2
  320. package/src/img/mastercard.svg +6 -3
  321. package/src/img/payapal_text.svg +6 -1
  322. package/src/img/payment/checkout/applepay.svg +12 -7
  323. package/src/img/payment/checkout/billie.svg +4 -2
  324. package/src/img/payment/checkout/clearpay.svg +5 -1
  325. package/src/img/payment/checkout/googlepay.svg +23 -12
  326. package/src/img/payment/checkout/mastercard.svg +13 -1
  327. package/src/img/payment/checkout/paypal.svg +37 -1
  328. package/src/img/payment/checkout/visa.svg +8 -1
  329. package/src/img/payment/footer/applepay.svg +12 -7
  330. package/src/img/payment/footer/billie.svg +3 -1
  331. package/src/img/payment/footer/clearpay.svg +18 -10
  332. package/src/img/payment/footer/googlepay.svg +23 -12
  333. package/src/img/payment/footer/mastercard.svg +13 -1
  334. package/src/img/payment/footer/paypal.svg +37 -1
  335. package/src/img/payment/footer/visa.svg +8 -1
  336. package/src/img/paypal.svg +8 -1
  337. package/src/img/paypal_logo_loader_paypal.svg +4 -1
  338. package/src/img/paypal_logo_loader_pp.svg +10 -1
  339. package/src/img/placeholders/full-width-img.svg +9 -1
  340. package/src/img/placeholders/img-2-to-1.svg +9 -1
  341. package/src/img/placeholders/img-3-to-4.svg +9 -1
  342. package/src/img/placeholders/img-4-to-3.svg +9 -1
  343. package/src/img/proposition_arrow_click.svg +7 -1
  344. package/src/img/proposition_delivery.svg +7 -1
  345. package/src/img/proposition_price.svg +7 -1
  346. package/src/img/proposition_returns.svg +7 -1
  347. package/src/img/social-icon-facebook.svg +8 -1
  348. package/src/img/social-icon-instagram.svg +15 -1
  349. package/src/img/social-icon-pinterest.svg +7 -1
  350. package/src/img/socials/facebook.svg +5 -1
  351. package/src/img/socials/instagram.svg +5 -1
  352. package/src/img/socials/pinterest.svg +5 -1
  353. package/src/img/socials/tiktok.svg +5 -1
  354. package/src/img/socials/x-twitter.svg +5 -1
  355. package/src/img/socials/youtube.svg +5 -1
  356. package/src/img/socials_facebook_color.svg +7 -1
  357. package/src/img/socials_facebook_white_blue_color.svg +5 -1
  358. package/src/img/socials_info_big.svg +7 -1
  359. package/src/img/socials_instagram_color.svg +16 -1
  360. package/src/img/socials_pinterest_color.svg +4 -1
  361. package/src/img/socials_twitter_color.svg +4 -1
  362. package/src/img/socials_whatsapp_color.svg +5 -1
  363. package/src/img/socials_youtube_color.svg +4 -1
  364. package/src/img/stars.svg +8 -1
  365. package/src/img/visa-logo.svg +3 -1
  366. package/src/img/wickes-dc-logo.svg +17 -13
  367. package/src/img/wickes-logo-v2.svg +15 -1
  368. package/src/img/wickes-logo.svg +36 -1
  369. package/src/img/young-minds.svg +10 -8
  370. package/src/js/components/anchors-scroll.js +9 -6
  371. package/src/js/components/badge-cashback.js +5 -6
  372. package/src/js/components/banner-placement-manager.js +269 -232
  373. package/src/js/components/card-color-slider.js +29 -29
  374. package/src/js/components/card-slider.js +78 -73
  375. package/src/js/components/cards-slider.js +64 -58
  376. package/src/js/components/charity-donations.js +3 -4
  377. package/src/js/components/checkout_your-details.js +68 -67
  378. package/src/js/components/clamp.js +47 -32
  379. package/src/js/components/click-disable.js +7 -7
  380. package/src/js/components/date-selection.js +50 -37
  381. package/src/js/components/file-loader.js +33 -33
  382. package/src/js/components/finance.js +3 -4
  383. package/src/js/components/flatpickr.js +135 -149
  384. package/src/js/components/gallery-pdp.js +97 -98
  385. package/src/js/components/gallery-range.js +107 -109
  386. package/src/js/components/general/accordion.js +31 -29
  387. package/src/js/components/general/back-to-top.js +40 -37
  388. package/src/js/components/general/backdrop.js +15 -15
  389. package/src/js/components/general/cart-slider.js +15 -12
  390. package/src/js/components/general/clamp-content.js +80 -80
  391. package/src/js/components/general/clamp.js +53 -38
  392. package/src/js/components/general/clear-input.js +25 -25
  393. package/src/js/components/general/cookie-chat-back.js +19 -13
  394. package/src/js/components/general/cookies-policy.js +5 -5
  395. package/src/js/components/general/create-popup-slider.js +169 -175
  396. package/src/js/components/general/device-type.js +3 -3
  397. package/src/js/components/general/footer.js +82 -52
  398. package/src/js/components/general/handleAccordion.js +28 -28
  399. package/src/js/components/general/is-trade-pro.js +15 -9
  400. package/src/js/components/general/main-nav.js +8 -8
  401. package/src/js/components/general/main-navigation.js +67 -73
  402. package/src/js/components/general/mini-basket-slider.js +6 -6
  403. package/src/js/components/general/notification.js +58 -40
  404. package/src/js/components/general/offer-banner.js +58 -58
  405. package/src/js/components/general/scroll-disable.js +45 -44
  406. package/src/js/components/general/search-filter.js +16 -16
  407. package/src/js/components/general/search.js +27 -29
  408. package/src/js/components/general/snack-bar.js +20 -11
  409. package/src/js/components/general/sticky_header.js +8 -7
  410. package/src/js/components/general/switchVat.js +154 -154
  411. package/src/js/components/general/text-clamp.js +14 -16
  412. package/src/js/components/general/tooltips.js +2 -2
  413. package/src/js/components/general/validation.js +47 -41
  414. package/src/js/components/leave-event.js +116 -113
  415. package/src/js/components/loader.js +11 -11
  416. package/src/js/components/modal-slider.js +57 -52
  417. package/src/js/components/order-item-cc.js +59 -69
  418. package/src/js/components/pdp-read-more.js +7 -11
  419. package/src/js/components/pdp-video.js +2 -2
  420. package/src/js/components/pwdstrength.js +13 -17
  421. package/src/js/components/range-cards.js +12 -12
  422. package/src/js/components/range-types.js +11 -11
  423. package/src/js/components/scrollbar.js +23 -20
  424. package/src/js/components/share-project-list.js +4 -5
  425. package/src/js/components/show-more-less.js +2 -2
  426. package/src/js/components/similar-slider.js +19 -10
  427. package/src/js/components/sticky-aside.js +84 -83
  428. package/src/js/components/store-locator-facilities.js +17 -15
  429. package/src/js/components/tabs.js +16 -17
  430. package/src/js/components/toggle-password-visibility.js +50 -50
  431. package/src/js/components/tradepro-notification-copy.js +5 -6
  432. package/src/js/components/voucher-remove.js +1 -2
  433. package/src/js/components/wisdom.js +35 -26
  434. package/src/js/components/zoom.js +67 -59
  435. package/src/js/emulation/account-hub.js +40 -40
  436. package/src/js/emulation/account-members.js +37 -36
  437. package/src/js/emulation/add-project-list-id-local.js +24 -18
  438. package/src/js/emulation/add.to.any.customisation.js +44 -38
  439. package/src/js/emulation/autocomplete.js +123 -114
  440. package/src/js/emulation/banner-placement-manager.js +40 -35
  441. package/src/js/emulation/basket-data.js +2123 -2037
  442. package/src/js/emulation/basket.js +58 -57
  443. package/src/js/emulation/big-wins.js +1079 -903
  444. package/src/js/emulation/chat-bot.js +14 -14
  445. package/src/js/emulation/checkLocalEnv.js +4 -4
  446. package/src/js/emulation/checkout-delivery-details.js +28 -25
  447. package/src/js/emulation/checkout-payment-details.js +46 -37
  448. package/src/js/emulation/checkout-sign-in-emulation.js +36 -33
  449. package/src/js/emulation/checkout_your-details.js +47 -46
  450. package/src/js/emulation/click-and-collect-modal.js +18 -20
  451. package/src/js/emulation/cnc-notifications.js +9 -10
  452. package/src/js/emulation/custom-slider-emulation.js +16 -17
  453. package/src/js/emulation/date-selection.js +25 -25
  454. package/src/js/emulation/default-store.js +92 -86
  455. package/src/js/emulation/favourite-product-local.js +31 -29
  456. package/src/js/emulation/find-address.js +41 -42
  457. package/src/js/emulation/footer-date.js +6 -3
  458. package/src/js/emulation/forms.js +352 -308
  459. package/src/js/emulation/generate-project-id-local.js +26 -23
  460. package/src/js/emulation/global-search-local.js +125 -122
  461. package/src/js/emulation/google-maps-store-info.js +25 -29
  462. package/src/js/emulation/home-movers.js +47 -49
  463. package/src/js/emulation/input-file.js +638 -558
  464. package/src/js/emulation/kitchen-plp-data.js +4528 -3670
  465. package/src/js/emulation/loadMore.js +13 -14
  466. package/src/js/emulation/main-nav-data.js +1058 -848
  467. package/src/js/emulation/mini-basket.js +34 -34
  468. package/src/js/emulation/mini-cart.js +12 -11
  469. package/src/js/emulation/mock.js +23 -23
  470. package/src/js/emulation/my-orders-local.js +30 -30
  471. package/src/js/emulation/paymentLoader.js +16 -16
  472. package/src/js/emulation/pdf-file-loader.js +88 -90
  473. package/src/js/emulation/pdp.js +18 -12
  474. package/src/js/emulation/personal-details-local.js +57 -56
  475. package/src/js/emulation/plp-load-more.js +16 -13
  476. package/src/js/emulation/popover-mini-basket.js +244 -238
  477. package/src/js/emulation/project-list-multiple.js +24 -18
  478. package/src/js/emulation/project-list-pdp.js +319 -316
  479. package/src/js/emulation/project-list-print.js +43 -40
  480. package/src/js/emulation/quiz-local.js +11 -11
  481. package/src/js/emulation/reference-field.js +2 -7
  482. package/src/js/emulation/selectable.js +19 -18
  483. package/src/js/emulation/shopping-list.js +19 -17
  484. package/src/js/emulation/sign-up.js +17 -21
  485. package/src/js/emulation/store-locator-list.js +11 -13
  486. package/src/js/emulation/switchCalendar.js +12 -8
  487. package/src/js/emulation/total-amount-loader.js +14 -13
  488. package/src/js/emulation/user.js +32 -32
  489. package/src/js/emulation/vat-toggle.js +1 -1
  490. package/src/js/emulation/wickes-responsive.js +178 -189
  491. package/src/js/emulation/wismo-details.js +22 -30
  492. package/src/js/emulation/your-details.js +34 -22
  493. package/src/js/helpers/jquery.cookiebar.js +270 -192
  494. package/src/js/helpers/responsive.js +69 -69
  495. package/src/js/helpers/safari-back.js +4 -4
  496. package/src/js/libs/bootstrap.bundle.min.js +1 -1
  497. package/src/js/libs/iframeResizer.min.js +2 -2
  498. package/src/js/libs/jquery.pstrength.custom-1.2.0.js +28 -34
  499. package/src/js/libs/simplebar.js +3 -3
  500. package/src/js/page/accordion.js +31 -29
  501. package/src/js/page/account-deletion.js +13 -13
  502. package/src/js/page/account-hub.js +128 -119
  503. package/src/js/page/account-members.js +229 -216
  504. package/src/js/page/address-book.js +186 -184
  505. package/src/js/page/basket/add-project-list-id.js +158 -130
  506. package/src/js/page/basket/clearpay.js +17 -17
  507. package/src/js/page/basket/display-energy-efficiency.js +13 -13
  508. package/src/js/page/basket/gtm.js +60 -54
  509. package/src/js/page/basket/klarna.js +2 -2
  510. package/src/js/page/basket/paypal.js +33 -33
  511. package/src/js/page/basket/session-sync.js +5 -5
  512. package/src/js/page/basket/summary-mobile.js +16 -16
  513. package/src/js/page/basket/wisdom.js +54 -39
  514. package/src/js/page/basket-v2.js +415 -261
  515. package/src/js/page/basket.js +42 -39
  516. package/src/js/page/billie-business-type.js +22 -22
  517. package/src/js/page/business-account-form.js +12 -12
  518. package/src/js/page/buying-guides-guttering.js +3 -3
  519. package/src/js/page/category-landing.js +18 -11
  520. package/src/js/page/change-password.js +100 -99
  521. package/src/js/page/checkout-confirmation-new.js +127 -70
  522. package/src/js/page/checkout-confirmation.js +6 -6
  523. package/src/js/page/checkout-delivery-address.js +35 -32
  524. package/src/js/page/checkout-delivery-details-loader.js +2 -5
  525. package/src/js/page/checkout-edit-address.js +1 -1
  526. package/src/js/page/checkout-payment-details.js +170 -172
  527. package/src/js/page/checkout-sign-in.js +15 -11
  528. package/src/js/page/checkout.js +1 -1
  529. package/src/js/page/cms-homepage.js +87 -45
  530. package/src/js/page/components/charity.js +114 -120
  531. package/src/js/page/components/csrf.js +4 -4
  532. package/src/js/page/components/discounts.js +39 -39
  533. package/src/js/page/components/favourite-product.js +125 -113
  534. package/src/js/page/components/global-search.js +204 -192
  535. package/src/js/page/components/modal-observer.js +43 -46
  536. package/src/js/page/components/order-summary.js +26 -22
  537. package/src/js/page/components/pagination.js +124 -117
  538. package/src/js/page/components/retry-action.js +2 -2
  539. package/src/js/page/components/saving-shopping-list.js +381 -314
  540. package/src/js/page/components/sticky-order-observer.js +36 -39
  541. package/src/js/page/components/voucher.js +46 -47
  542. package/src/js/page/copy-project-id.js +23 -23
  543. package/src/js/page/countdown-timer.js +6 -6
  544. package/src/js/page/default-store.js +40 -34
  545. package/src/js/page/design-appointment.js +6 -3
  546. package/src/js/page/energy-efficiency.js +39 -25
  547. package/src/js/page/finance-tabs.js +4 -4
  548. package/src/js/page/general/cookie.js +20 -10
  549. package/src/js/page/installation/calculator.js +12 -16
  550. package/src/js/page/installation/fi.js +76 -71
  551. package/src/js/page/installation/generic.js +21 -20
  552. package/src/js/page/installation/installation.js +36 -22
  553. package/src/js/page/installation/pdp-generic.js +3 -9
  554. package/src/js/page/installation/ti.js +26 -24
  555. package/src/js/page/installer-files-form.js +98 -76
  556. package/src/js/page/installer-form.js +502 -447
  557. package/src/js/page/installer-validation.js +848 -761
  558. package/src/js/page/instore-checkout.js +2 -2
  559. package/src/js/page/kitchen/card-carousel.js +21 -21
  560. package/src/js/page/kitchen/colour-swatches.js +153 -149
  561. package/src/js/page/kitchen/kitchen-card.js +62 -64
  562. package/src/js/page/kitchen/mobile-nav.js +26 -27
  563. package/src/js/page/kitchen/plp-filters-chips.js +72 -70
  564. package/src/js/page/kitchen/plp-filters-mobile.js +64 -60
  565. package/src/js/page/kitchen/plp-filters-panel.js +106 -102
  566. package/src/js/page/kitchen/plp-filters-utils.js +54 -53
  567. package/src/js/page/kitchen/plp-filters.js +210 -194
  568. package/src/js/page/kitchen/sort-by.js +149 -149
  569. package/src/js/page/klarna-modal-scroll-disable.js +4 -4
  570. package/src/js/page/merged-checkout.js +6 -3
  571. package/src/js/page/my-account.js +44 -46
  572. package/src/js/page/my-orders.js +153 -149
  573. package/src/js/page/online-exclusive.js +28 -31
  574. package/src/js/page/pdp-favourite.js +4 -4
  575. package/src/js/page/pdp-tile.js +0 -4
  576. package/src/js/page/pdp.js +41 -37
  577. package/src/js/page/personal-details.js +307 -277
  578. package/src/js/page/plp-cards-v2.js +39 -25
  579. package/src/js/page/plp-favourite.js +9 -9
  580. package/src/js/page/plp-img-v2.js +2 -3
  581. package/src/js/page/plp-load-more.js +66 -66
  582. package/src/js/page/plp.js +9 -10
  583. package/src/js/page/pre-home.js +159 -144
  584. package/src/js/page/project-list/generate-project-id.js +77 -68
  585. package/src/js/page/project-list-note.js +234 -232
  586. package/src/js/page/project-list.js +2 -3
  587. package/src/js/page/quiz.js +292 -292
  588. package/src/js/page/select-address.js +27 -14
  589. package/src/js/page/smart-banner.js +8 -5
  590. package/src/js/page/ti.js +67 -42
  591. package/src/js/page/top-rated.js +36 -29
  592. package/src/js/page/track-my-order.js +172 -156
  593. package/src/js/page/tradePro-rewards.js +34 -36
  594. package/src/js/page/utils/array-utils.js +13 -10
  595. package/src/js/page/utils/copy-to-clipboard.js +45 -45
  596. package/src/js/page/utils/create-event.js +8 -8
  597. package/src/js/page/utils/errorMesages.js +12 -11
  598. package/src/js/page/utils/helpers.js +14 -9
  599. package/src/js/page/utils/http-action.js +4 -5
  600. package/src/js/page/utils/loader.js +5 -5
  601. package/src/js/page/utils/routes.js +9 -9
  602. package/src/js/page/utils/url-query.js +4 -4
  603. package/src/js/page/utils/validation.js +93 -96
  604. package/src/js/page/wickes-dc.js +51 -44
  605. package/src/js/page/wismo.js +12 -12
  606. package/src/js/page/your-details.js +77 -41
  607. package/src/layouts/app_sticky_header.hbs +0 -1
  608. package/src/scss/barclays-paypage-combined.css +585 -585
  609. package/src/scss/barclays-paypage-desktop.css +496 -496
  610. package/src/scss/barclays-paypage-mobile.css +494 -494
  611. package/src/scss/category-main.scss +8 -2
  612. package/src/scss/common/_cat-common.scss +1 -0
  613. package/src/scss/common/_plp-common.scss +1 -0
  614. package/src/scss/components/_billie-modal.scss +2 -2
  615. package/src/scss/components/_card.scss +1 -0
  616. package/src/scss/components/_find-a-store.scss +1 -0
  617. package/src/scss/components/_gallery-pdp-critical.scss +2 -2
  618. package/src/scss/components/_kitchen-card.scss +2 -2
  619. package/src/scss/components/_notifications-critical.scss +2 -2
  620. package/src/scss/components/_offer-banner.scss +1 -0
  621. package/src/scss/components/_order-summary.scss +1 -1
  622. package/src/scss/components/_page-overlay.scss +1 -1
  623. package/src/scss/components/_price-block.scss +1 -0
  624. package/src/scss/components/_price.scss +1 -1
  625. package/src/scss/components/_range-card.scss +0 -1
  626. package/src/scss/components/_recommended.scss +0 -1
  627. package/src/scss/components/_rewards.scss +1 -1
  628. package/src/scss/components/_share-list-modal.scss +1 -1
  629. package/src/scss/components/_shopping-list-note.scss +1 -1
  630. package/src/scss/components/_steps-three.scss +1 -1
  631. package/src/scss/components/_steps.scss +2 -2
  632. package/src/scss/components/_tc-generic.scss +1 -1
  633. package/src/scss/components/_thank-you-modal.scss +3 -1
  634. package/src/scss/components/_ti-total-area.scss +1 -1
  635. package/src/scss/components/_user-address-delivery.scss +1 -1
  636. package/src/scss/components/kitchen/_price.scss +1 -1
  637. package/src/scss/components/my-account/_contacts.scss +3 -1
  638. package/src/scss/components/special-opening-schedule-v2.scss +3 -3
  639. package/src/scss/components/special-opening-schedule.scss +2 -2
  640. package/src/scss/helpers/_variables.scss +157 -154
  641. package/src/scss/helpers/helpers-pdp-critical/_elements-critical-pdp.scss +1 -0
  642. package/src/scss/helpers/helpers-pdp-critical/_helpers-critical-pdp.scss +4 -0
  643. package/src/scss/libs/_bootstrap-extracted.scss +24 -6
  644. package/src/scss/libs/_skeleton.scss +3 -3
  645. package/src/scss/libs/simplebar.css +3 -3
  646. package/src/scss/libs/swiper.css +479 -384
  647. package/src/scss/main.scss +140 -70
  648. package/src/scss/my-account-main-v2.scss +38 -19
  649. package/src/scss/my-account-main.scss +38 -19
  650. package/src/scss/pages/_checkout-widget.scss +1 -1
  651. package/src/scss/pages/_checkout_your-details.scss +1 -0
  652. package/src/scss/pages/checkout-new.scss +1 -0
  653. package/src/scss/pages/checkout.scss +1 -0
  654. package/src/scss/pages/iframe-paypage.scss +9 -8
  655. package/src/scss/pages/page_book-consultant-thank-you-new.scss +2 -2
  656. package/src/scss/pages/page_installer.scss +2 -2
  657. package/src/scss/pages/page_my-account_tradePro.scss +1 -1
  658. package/src/scss/pages/page_new-checkout_login-register.scss +1 -1
  659. package/src/scss/pages/page_pre_home_thank-you.scss +2 -2
  660. package/src/scss/pages/page_product-details-critical.scss +1 -0
  661. package/src/scss/pages/page_products-list-combined.scss +4 -0
  662. package/src/scss/pages/page_store-locator-details.scss +1 -1
  663. package/src/scss/pages/page_top-rated.scss +14 -14
  664. package/src/scss/pages/page_wismo-details.scss +1 -1
  665. package/src/scss/pages/tradePro-rewards-old.scss +1 -1
  666. package/src/scss/partials/_breadcrumbs-critical.scss +2 -2
  667. package/src/scss/partials/_breadcrumbs.scss +2 -2
  668. package/src/scss/partials/_header-critical.scss +1 -1
  669. package/src/scss/partials/_header.scss +1 -1
  670. package/src/scss/store-locator-main.scss +3 -0
  671. package/build/js/page/business-pages.js +0 -13
  672. package/src/js/page/business-pages.js +0 -13
@@ -1,935 +1,1111 @@
1
1
  var Wick = Wick || {};
2
- Wick.BigWinsProto = function () {
3
-
4
- var bwVar = {
5
- $body: $('body'),
6
- $bigWins: $('.bw'),
7
- $bwActions: $('.bw_act'),
8
- $bwChosen: $('.bw__chosen'),
9
- $pdpPrice: $('.pdp-price'),
10
- $defStoreWrap: $('.my-account_default_store'),
11
- $tiTotal: $('.ti__total'),
12
- $stock: $('.stock'),
13
- $stockTabs: $('.stock__tabs'),
14
- $stockTab: $('.stock__tab'),
15
- $defStockTab: $('.def-stock__tab'),
16
- $stockInfo: $('.stock__info'),
17
- $stockAccordion: $('.stock__accordion'),
18
- $stockContent: $('.stock__content'),
19
- $stockMore: $('.stock-more'),
20
- $stockResult: $('.stock__result'),
21
- $stockFind: $('.stock__find'),
22
- $stockFindBtn: $('.stock__find_btn'),
23
- $stockEditBtn: $('.stock__edit_btn'),
24
- $stockQuestions: $('.stock__quest'),
25
- $stockRadio: $('.stock__radio label'),
26
- $stockQuantity: $('.tbx_quantity'),
27
- $stockPostcode: $('.stock__postcode input'),
28
- $stockPostcodeEl: $('.stock__postcode'),
29
- $stockAmount: $('.stock__amount-val'),
30
- $stockDescr: $('.stock__descr'),
31
- $stockPost: $('.stock__descr_post'),
32
- $stockClose: $('.stock__close '),
33
- $stockCancel: $('.stock__cancel-text'),
34
- $storeMoreLink: $('.store__more a'),
35
- $sDetails: $('.s-details'),
36
- $sDetailsClose: $('.s-details__close'),
37
- $sDetailsToggleMap: $('.s-details__tgl-map'),
38
- $sDetailsToggleMapText: $('.s-details__tgl-map_text'),
39
- $sDetailsMap: $('.s-details__map'),
40
- $sDetailsCopy: $('.s-details__copy'),
41
- $sDetailsAddress: $('.s-details__address'),
42
- $chosen: $('.chosen'),
43
- $protoOnlyPopulated: $('.proto-only-populated'),
44
- $storeState: $('.store-state'),
45
- $makeDefault: $('.default-store__make'),
46
- $nameDefault: $('.default-store__name'),
47
- $defaultCurrent: $('.default-store__default'),
48
- $defaultInfo: $('.default-store__det'),
49
- $store: $('.store'),
50
- $chosenItem: $('.chosen__item'),
51
- $storeCount: $('.store__count'),
52
- $stockList: $('.stock__list'),
53
- $stockTarget: $('.stock__target'),
54
- $storeSearch: $('.store-search'),
55
- $storeChange: $('.store-change'),
56
- $addStore: $('.my-account_add-store'),
57
- $addForDelivery: $('.btn-add-to-basket'),
58
- $addClickAndCollect: $('.nearest-store-purchasable'),
59
- $cancelStore: $('.my-account_cancel-store'),
60
- $toDefaultIcon: $('.store__tick'),
61
- $isDefaultIcon: $('.store__marker'),
62
- $currentDefault: $('.default-store__det__current'),
63
- $findStore: $('.my-account_find-store'),
64
- $postCodeErrorMsg: $('.stock__postcode_invalid-msg'),
65
- $ccOrder: $('.cc-order'),
66
- storeState: 'store__state',
67
- storeCount: '.store__count',
68
- ccBtn: '.bw__cc-btn',
69
- pdpPriceBW: 'pdp-price_bw',
70
- tiTotalBW: 'ti__total_bw',
71
- stockTab: '.stock__tab',
72
- active: 'active',
73
- stockMore: 'stock-more',
74
- stockItem: '.stock__item',
75
- stockContentNearest: 'stock__content_nearest',
76
- stockContentMore: 'stock__content_more',
77
- stockResultHide: 'stock__result_hide',
78
- stockResultSuccess: 'stock__result_success',
79
- stockTabsHide: 'stock__tabs_hide',
80
- stockFindHide: 'stock__find_hide',
81
- stockFindBtn: '.stock__find_btn',
82
- stockQuestionInvalid: 'stock__quest_invalid',
83
- stockDescrC: 'stock__descr_c',
84
- stockDescrS: 'stock__descr_s',
85
- stockPostcodeInvalid: 'stock__postcode_invalid',
86
- stockDetailsOpen: 'stock__det-open',
87
- stockBot: 'stock__bot',
88
- pdpPriceDetailsOpen: 'pdp-price__det-open',
89
- sDetailsHide: 's-details_hide',
90
- sDetails: '.s-details',
91
- sDetailsStoreName: '.s-details__s-name',
92
- sDetailsInfo: '.s-details__info',
93
- sDetailsMapHide: 's-details__map_hide',
94
- sDetailsAddress: '.s-details__address',
95
- chosenHide: 'chosen_hide',
96
- chosenNearest: 'chosen__nearest',
97
- chosenSuccess: 'chosen__success',
98
- chosenError: 'chosen__error',
99
- store: '.store',
100
- storeName: '.store__name-text',
101
- defaultStoreName: '.default-store__name-txt',
102
- collapsed: 'collapsed',
103
- show: 'show',
104
- scrollDisable: 'scroll-disable',
105
- bwMinHeight: 'bw_min-h',
106
- copyLinkHovered: 'copy-link_hovered',
107
- protoOnlyPopulated: 'proto-only-populated',
108
- moreStoresPresent: 'more-stores-present',
109
- defStoresPresent: 'def-stores-present',
110
- CLICK_AND_COLLECT: 'FREE Click & Collect within 30 minutes',
111
- CLICK_AND_COLLECT_NOT_AVAILABLE: 'Click & Collect not available',
112
- };
113
-
114
- function init() {
115
- Wick.SnackBar.init();
116
- bwVar.$stockTabs.on('click', bwVar.stockTab, function () {
117
- if ($(bwVar.ccBtn).attr('disabled') && $(bwVar.ccBtn).hasClass('nearest-store-purchasable')) {
118
- $(bwVar.ccBtn).removeAttr('disabled');
119
- $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT);
120
- }
121
-
122
- if (!$(this).hasClass(bwVar.active)) {
123
- //toggle tabs
124
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockTab).removeClass(bwVar.active);
125
- $(this).addClass(bwVar.active);
126
-
127
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockFindBtn).unbind();
128
-
129
- //show/close modal with more stores
130
- if ($(this).attr('data-stores') === 'more') {
131
-
132
- //open block
133
- $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockBot);
134
- $(this).closest(bwVar.$bigWins).addClass(bwVar.bwMinHeight);
135
-
136
- if ($(window).width() < 767) {
137
- $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockMore);
138
- } else {
139
- var self = this;
140
- setTimeout(function () {
141
- $(self).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockMore);
142
- }, 1);
143
- }
144
-
145
- // remove ability collapse block
146
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockAccordion).removeAttr('data-toggle');
147
-
148
- //event to show results
149
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockFindBtn).on('click', function (e) {
150
- showSearchResultMore(e, this);
151
- showSearchResultMoreProto(this);
152
- });
153
-
154
- //delete error validation
155
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockPostcodeEl).removeClass(bwVar.stockPostcodeInvalid);
156
-
157
- if ($(window).width() < 767) {
158
- //disable scroll for modal
159
- bwVar.$body.addClass(bwVar.scrollDisable);
160
- }
161
-
162
- $(this).closest(bwVar.$bigWins).find(bwVar.stockItem).each(function () {
163
- var attr = $(this).find('.stock__radio input').attr('checked');
164
- if (typeof attr !== 'undefined' && attr !== false) {
165
- var value = $(this).closest(bwVar.stockItem).find('.store__stock_val').text();
166
- if (value.match(/^out$/)) {
167
- $(this).closest(bwVar.stockItem).find('.stock__valid').addClass('stock__valid_show');
168
- $(bwVar.ccBtn).attr('disabled', 'disabled');
169
- $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
170
- }
2
+ Wick.BigWinsProto = (function () {
3
+ var bwVar = {
4
+ $body: $('body'),
5
+ $bigWins: $('.bw'),
6
+ $bwActions: $('.bw_act'),
7
+ $bwChosen: $('.bw__chosen'),
8
+ $pdpPrice: $('.pdp-price'),
9
+ $defStoreWrap: $('.my-account_default_store'),
10
+ $tiTotal: $('.ti__total'),
11
+ $stock: $('.stock'),
12
+ $stockTabs: $('.stock__tabs'),
13
+ $stockTab: $('.stock__tab'),
14
+ $defStockTab: $('.def-stock__tab'),
15
+ $stockInfo: $('.stock__info'),
16
+ $stockAccordion: $('.stock__accordion'),
17
+ $stockContent: $('.stock__content'),
18
+ $stockMore: $('.stock-more'),
19
+ $stockResult: $('.stock__result'),
20
+ $stockFind: $('.stock__find'),
21
+ $stockFindBtn: $('.stock__find_btn'),
22
+ $stockEditBtn: $('.stock__edit_btn'),
23
+ $stockQuestions: $('.stock__quest'),
24
+ $stockRadio: $('.stock__radio label'),
25
+ $stockQuantity: $('.tbx_quantity'),
26
+ $stockPostcode: $('.stock__postcode input'),
27
+ $stockPostcodeEl: $('.stock__postcode'),
28
+ $stockAmount: $('.stock__amount-val'),
29
+ $stockDescr: $('.stock__descr'),
30
+ $stockPost: $('.stock__descr_post'),
31
+ $stockClose: $('.stock__close '),
32
+ $stockCancel: $('.stock__cancel-text'),
33
+ $storeMoreLink: $('.store__more a'),
34
+ $sDetails: $('.s-details'),
35
+ $sDetailsClose: $('.s-details__close'),
36
+ $sDetailsToggleMap: $('.s-details__tgl-map'),
37
+ $sDetailsToggleMapText: $('.s-details__tgl-map_text'),
38
+ $sDetailsMap: $('.s-details__map'),
39
+ $sDetailsCopy: $('.s-details__copy'),
40
+ $sDetailsAddress: $('.s-details__address'),
41
+ $chosen: $('.chosen'),
42
+ $protoOnlyPopulated: $('.proto-only-populated'),
43
+ $storeState: $('.store-state'),
44
+ $makeDefault: $('.default-store__make'),
45
+ $nameDefault: $('.default-store__name'),
46
+ $defaultCurrent: $('.default-store__default'),
47
+ $defaultInfo: $('.default-store__det'),
48
+ $store: $('.store'),
49
+ $chosenItem: $('.chosen__item'),
50
+ $storeCount: $('.store__count'),
51
+ $stockList: $('.stock__list'),
52
+ $stockTarget: $('.stock__target'),
53
+ $storeSearch: $('.store-search'),
54
+ $storeChange: $('.store-change'),
55
+ $addStore: $('.my-account_add-store'),
56
+ $addForDelivery: $('.btn-add-to-basket'),
57
+ $addClickAndCollect: $('.nearest-store-purchasable'),
58
+ $cancelStore: $('.my-account_cancel-store'),
59
+ $toDefaultIcon: $('.store__tick'),
60
+ $isDefaultIcon: $('.store__marker'),
61
+ $currentDefault: $('.default-store__det__current'),
62
+ $findStore: $('.my-account_find-store'),
63
+ $postCodeErrorMsg: $('.stock__postcode_invalid-msg'),
64
+ $ccOrder: $('.cc-order'),
65
+ storeState: 'store__state',
66
+ storeCount: '.store__count',
67
+ ccBtn: '.bw__cc-btn',
68
+ pdpPriceBW: 'pdp-price_bw',
69
+ tiTotalBW: 'ti__total_bw',
70
+ stockTab: '.stock__tab',
71
+ active: 'active',
72
+ stockMore: 'stock-more',
73
+ stockItem: '.stock__item',
74
+ stockContentNearest: 'stock__content_nearest',
75
+ stockContentMore: 'stock__content_more',
76
+ stockResultHide: 'stock__result_hide',
77
+ stockResultSuccess: 'stock__result_success',
78
+ stockTabsHide: 'stock__tabs_hide',
79
+ stockFindHide: 'stock__find_hide',
80
+ stockFindBtn: '.stock__find_btn',
81
+ stockQuestionInvalid: 'stock__quest_invalid',
82
+ stockDescrC: 'stock__descr_c',
83
+ stockDescrS: 'stock__descr_s',
84
+ stockPostcodeInvalid: 'stock__postcode_invalid',
85
+ stockDetailsOpen: 'stock__det-open',
86
+ stockBot: 'stock__bot',
87
+ pdpPriceDetailsOpen: 'pdp-price__det-open',
88
+ sDetailsHide: 's-details_hide',
89
+ sDetails: '.s-details',
90
+ sDetailsStoreName: '.s-details__s-name',
91
+ sDetailsInfo: '.s-details__info',
92
+ sDetailsMapHide: 's-details__map_hide',
93
+ sDetailsAddress: '.s-details__address',
94
+ chosenHide: 'chosen_hide',
95
+ chosenNearest: 'chosen__nearest',
96
+ chosenSuccess: 'chosen__success',
97
+ chosenError: 'chosen__error',
98
+ store: '.store',
99
+ storeName: '.store__name-text',
100
+ defaultStoreName: '.default-store__name-txt',
101
+ collapsed: 'collapsed',
102
+ show: 'show',
103
+ scrollDisable: 'scroll-disable',
104
+ bwMinHeight: 'bw_min-h',
105
+ copyLinkHovered: 'copy-link_hovered',
106
+ protoOnlyPopulated: 'proto-only-populated',
107
+ moreStoresPresent: 'more-stores-present',
108
+ defStoresPresent: 'def-stores-present',
109
+ CLICK_AND_COLLECT: 'FREE Click & Collect within 30 minutes',
110
+ CLICK_AND_COLLECT_NOT_AVAILABLE: 'Click & Collect not available',
111
+ };
112
+
113
+ function init() {
114
+ Wick.SnackBar.init();
115
+ bwVar.$stockTabs.on('click', bwVar.stockTab, function () {
116
+ if (
117
+ $(bwVar.ccBtn).attr('disabled') &&
118
+ $(bwVar.ccBtn).hasClass('nearest-store-purchasable')
119
+ ) {
120
+ $(bwVar.ccBtn).removeAttr('disabled');
121
+ $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT);
171
122
  }
172
123
 
173
- })
174
-
175
- } else if ($(this).attr('data-stores') === 'nearest') {
176
- //close more block
177
- $(this).closest(bwVar.$bigWins).find(bwVar.$stock).removeClass(bwVar.stockMore);
178
-
179
- if ($(window).width() < 767) {
180
- $(this).closest(bwVar.$bigWins).find(bwVar.$stock).removeClass(bwVar.stockBot);
181
- $(this).closest(bwVar.$bigWins).removeClass(bwVar.bwMinHeight);
182
- } else {
183
- var self = this;
184
- setTimeout(function () {
185
- $(self).closest(bwVar.$bigWins).find(bwVar.$stock).removeClass(bwVar.stockBot);
186
- $(self).closest(bwVar.$bigWins).removeClass(bwVar.bwMinHeight);
187
- }, 600);
188
- }
189
-
190
- // add ability collapse block
191
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockAccordion).attr('data-toggle', 'collapse');
192
- //event to show results
193
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockFindBtn).on('click', showSearchResultNearest);
194
- //unlock scroll for modal
195
- bwVar.$body.removeClass(bwVar.scrollDisable);
196
- //delete error validation
197
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockPostcodeEl).removeClass(bwVar.stockPostcodeInvalid);
198
-
199
- scrollToBlockMobile(this);
200
- }
201
- }
202
- closeStoreDetails(this);
203
- });
204
-
205
- bwVar.$stockFindBtn.on('click', function () {
206
- showSearchResultNearest(this);
207
- });
208
-
209
- bwVar.$defStockTab.on('click', function (e) {
210
- e.preventDefault();
211
-
212
- bwVar.$stockResult.removeClass('stock__result_hide')
213
- $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockBot);
214
- $(this).closest(bwVar.$bigWins).addClass(bwVar.bwMinHeight);
215
-
216
- if ($(window).width() < 767) {
217
- $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockMore);
218
- } else {
219
- var self = this;
220
- setTimeout(function () {
221
- $(self).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockMore);
222
- }, 1);
223
- }
224
- });
225
-
226
- //choose default store in more stores section
227
- bwVar.$storeState.on('click', function (e) {
228
- let defVal = $(this).text().trim(),
229
- toDefault = 'Make this your default store',
230
- isDefault = 'Default store',
231
- selectedStore = $(this).closest(bwVar.$store).html();
232
-
233
- e.preventDefault();
234
-
235
- if (defVal === toDefault) {
236
- bwVar.$storeState.text(toDefault)
237
- $(this).text(isDefault)
238
- bwVar.$bwChosen.find(bwVar.$store).html(selectedStore);
239
- bwVar.$storeState.parent().find(bwVar.$toDefaultIcon).hide()
240
- bwVar.$storeState.parent().find(bwVar.$isDefaultIcon).show()
241
-
242
- $(this).parent().find(bwVar.$isDefaultIcon).hide()
243
- $(this).parent().find(bwVar.$toDefaultIcon).show()
244
- }
245
- else {
246
- $(this).click(false)
247
- }
248
- });
249
-
250
- //make store default from main page
251
- bwVar.$nameDefault.on('click', function (e) {
252
- e.preventDefault();
253
- let makeDefValue = $(this).find(bwVar.defaultStoreName).text();
254
-
255
- bwVar.$stockList.find(bwVar.storeName).each(function () {
256
- if ($(this).text() === makeDefValue) {
257
- $(this).closest(bwVar.$store).find('.store-state').click()
258
- }
259
- })
260
-
261
- bwVar.$makeDefault.hide();
262
- bwVar.$defaultInfo.hide();
263
- bwVar.$defaultCurrent.show();
264
-
265
- });
266
-
267
- bwVar.$currentDefault.on('click', function (e) {
268
- e.preventDefault();
269
- let makeDefValue = $(this).find(bwVar.defaultStoreName).text();
270
-
271
- bwVar.$stockList.find(bwVar.storeName).each(function () {
272
- if ($(this).text() === makeDefValue) {
273
- $(this).closest(bwVar.$store).find('.store-state').click()
274
- }
275
- })
276
-
277
- bwVar.$makeDefault.hide();
278
- bwVar.$defaultInfo.hide();
279
- bwVar.$defaultCurrent.show();
280
-
281
- });
282
-
283
- //my-acc default store component logic
284
- bwVar.$storeSearch.on('click', function (e) {
285
- e.preventDefault();
286
- bwVar.$storeSearch.hide();
287
- bwVar.$stockPostcodeEl.show();
288
- })
289
-
290
- //my-acc scroll to default store component logic
291
- $(".scrollToDefault").on('click', function(e) {
292
- e.preventDefault();
293
- var target = $(this).attr('href');
294
- $('html, body').animate({
295
- scrollTop: ($(target).offset().top)
296
- }, 'slow');
297
- });
298
-
299
- bwVar.$findStore.on('click', function (e) {
300
- e.preventDefault();
301
-
302
- if($('.stock__input').val().length !== 0) {
303
- bwVar.$stockPostcodeEl.removeClass(bwVar.stockPostcodeInvalid);
304
- bwVar.$postCodeErrorMsg.hide();
305
- bwVar.$bigWins.show();
306
-
307
- if(bwVar.$bigWins.css('display') === 'block') {
308
- bwVar.$bwActions.css('display', 'flex')
309
- } else {
310
- bwVar.$bwActions.hide()
311
- }
312
- } else {
313
- bwVar.$stockPostcodeEl.addClass(bwVar.stockPostcodeInvalid);
314
- bwVar.$postCodeErrorMsg.css('display', 'inherit');
315
- }
316
- })
317
-
318
- bwVar.$addStore.on('click', function (e) {
319
- e.preventDefault();
320
- bwVar.$bigWins.hide();
321
- bwVar.$stockPostcodeEl.hide();
322
- bwVar.$storeChange.css('display', 'block');
323
- bwVar.$bwActions.hide();
324
- bwVar.$addStore.text('Update Default Store')
325
- })
326
-
327
- bwVar.$cancelStore.on('click', function (e) {
328
- e.preventDefault();
329
- bwVar.$bigWins.hide();
330
- bwVar.$bwActions.hide();
331
- bwVar.$stockPostcodeEl.hide();
332
- bwVar.$storeSearch.show();
333
- })
334
-
335
- bwVar.$storeChange.on('click', function (e) {
336
- e.preventDefault();
337
- bwVar.$bigWins.show();
338
- bwVar.$stockPostcodeEl.show();
339
- bwVar.$bwActions.show();
340
- bwVar.$storeChange.hide();
341
- })
342
-
343
- bwVar.$defStoreWrap.find(bwVar.$addStore).on('click', function (e) {
344
- if($("input:radio[name='store']").is(":checked")) {
345
- let currentInp = $("input:radio[name='store'][checked='checked']"),
346
- selectedVal = currentInp.closest(bwVar.stockItem).find(bwVar.sDetailsAddress).text();
347
-
348
- bwVar.$defStoreWrap.find('.table__content-address').text(selectedVal)
349
- }
350
- })
351
-
352
- //show store details
353
- bwVar.$storeMoreLink.on('click', function (e) {
354
- e.preventDefault();
355
-
356
- console.log($(this).closest('.basket').length);
357
- if(!$(this).closest('.basket').length) {
358
- var storeName = $(this)
359
- .closest('.store')
360
- .find(bwVar.storeName)
361
- .text()
362
- .trim()
363
- .toLowerCase();
364
-
365
- if ($(this).text().trim() === 'Store Info') {
366
- closeStoreDetails(this);
367
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockRadio).find('input').removeAttr('checked');
368
- $(this).closest(bwVar.stockItem).find(bwVar.$stockRadio).trigger('click');
369
- $(this).closest(bwVar.stockItem).find(bwVar.$stockRadio).attr('checked', 'checked');
370
-
371
- $(this).text('Hide Info');
372
-
373
- //show pseudoclass
374
- $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockDetailsOpen);
375
-
376
- //classes only for Price
377
- console.log($(this).closest(bwVar.$pdpPrice).length);
378
-
379
- if ($(this).closest(bwVar.$pdpPrice).length) {
380
- $(this).closest(bwVar.$pdpPrice)
381
- .addClass(bwVar.stockDetailsOpen);
382
- $(this).closest(bwVar.$pdpPrice)
383
- .addClass(bwVar.pdpPriceBW);
384
- } else if ($(this).closest(bwVar.$tiTotal).length) {
385
- $(this).closest(bwVar.$tiTotal)
386
- .addClass(bwVar.stockDetailsOpen);
387
- $(this).closest(bwVar.$tiTotal)
388
- .addClass(bwVar.tiTotalBW);
389
- }
390
-
391
- $(this).closest(bwVar.$bigWins).find(bwVar.$sDetails).addClass(bwVar.sDetailsHide);
392
- //open tab with current store
393
- $(this).closest(bwVar.$bigWins).find(bwVar.$sDetails).each(function () {
394
- if ($(this)
395
- .find(bwVar.sDetailsStoreName)
396
- .text()
397
- .trim()
398
- .toLowerCase() === storeName) {
399
- $(this).removeClass(bwVar.sDetailsHide);
124
+ if (!$(this).hasClass(bwVar.active)) {
125
+ //toggle tabs
126
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stockTab).removeClass(bwVar.active);
127
+ $(this).addClass(bwVar.active);
128
+
129
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stockFindBtn).unbind();
130
+
131
+ var self;
132
+ //show/close modal with more stores
133
+ if ($(this).attr('data-stores') === 'more') {
134
+ //open block
135
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockBot);
136
+ $(this).closest(bwVar.$bigWins).addClass(bwVar.bwMinHeight);
137
+
138
+ if ($(window).width() < 767) {
139
+ $(this)
140
+ .closest(bwVar.$bigWins)
141
+ .find(bwVar.$stock)
142
+ .addClass(bwVar.stockMore);
143
+ } else {
144
+ self = this;
145
+ setTimeout(function () {
146
+ $(self)
147
+ .closest(bwVar.$bigWins)
148
+ .find(bwVar.$stock)
149
+ .addClass(bwVar.stockMore);
150
+ }, 1);
151
+ }
152
+
153
+ // remove ability collapse block
154
+ $(this)
155
+ .closest(bwVar.$bigWins)
156
+ .find(bwVar.$stockAccordion)
157
+ .removeAttr('data-toggle');
158
+
159
+ //event to show results
160
+ $(this)
161
+ .closest(bwVar.$bigWins)
162
+ .find(bwVar.$stockFindBtn)
163
+ .on('click', function (e) {
164
+ showSearchResultMore(e, this);
165
+ showSearchResultMoreProto(this);
166
+ });
167
+
168
+ //delete error validation
169
+ $(this)
170
+ .closest(bwVar.$bigWins)
171
+ .find(bwVar.$stockPostcodeEl)
172
+ .removeClass(bwVar.stockPostcodeInvalid);
173
+
174
+ if ($(window).width() < 767) {
175
+ //disable scroll for modal
176
+ bwVar.$body.addClass(bwVar.scrollDisable);
177
+ }
178
+
179
+ $(this)
180
+ .closest(bwVar.$bigWins)
181
+ .find(bwVar.stockItem)
182
+ .each(function () {
183
+ var attr = $(this).find('.stock__radio input').attr('checked');
184
+ if (typeof attr !== 'undefined' && attr !== false) {
185
+ var value = $(this)
186
+ .closest(bwVar.stockItem)
187
+ .find('.store__stock_val')
188
+ .text();
189
+ if (value.match(/^out$/)) {
190
+ $(this)
191
+ .closest(bwVar.stockItem)
192
+ .find('.stock__valid')
193
+ .addClass('stock__valid_show');
194
+ $(bwVar.ccBtn).attr('disabled', 'disabled');
195
+ $(bwVar.ccBtn)
196
+ .find('.btn__text')
197
+ .text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
198
+ }
199
+ }
200
+ });
201
+ } else if ($(this).attr('data-stores') === 'nearest') {
202
+ //close more block
203
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stock).removeClass(bwVar.stockMore);
204
+
205
+ if ($(window).width() < 767) {
206
+ $(this)
207
+ .closest(bwVar.$bigWins)
208
+ .find(bwVar.$stock)
209
+ .removeClass(bwVar.stockBot);
210
+ $(this).closest(bwVar.$bigWins).removeClass(bwVar.bwMinHeight);
211
+ } else {
212
+ self = this;
213
+ setTimeout(function () {
214
+ $(self)
215
+ .closest(bwVar.$bigWins)
216
+ .find(bwVar.$stock)
217
+ .removeClass(bwVar.stockBot);
218
+ $(self).closest(bwVar.$bigWins).removeClass(bwVar.bwMinHeight);
219
+ }, 600);
220
+ }
221
+
222
+ // add ability collapse block
223
+ $(this)
224
+ .closest(bwVar.$bigWins)
225
+ .find(bwVar.$stockAccordion)
226
+ .attr('data-toggle', 'collapse');
227
+ //event to show results
228
+ $(this)
229
+ .closest(bwVar.$bigWins)
230
+ .find(bwVar.$stockFindBtn)
231
+ .on('click', showSearchResultNearest);
232
+ //unlock scroll for modal
233
+ bwVar.$body.removeClass(bwVar.scrollDisable);
234
+ //delete error validation
235
+ $(this)
236
+ .closest(bwVar.$bigWins)
237
+ .find(bwVar.$stockPostcodeEl)
238
+ .removeClass(bwVar.stockPostcodeInvalid);
239
+
240
+ scrollToBlockMobile(this);
241
+ }
400
242
  }
401
- });
243
+ closeStoreDetails(this);
244
+ });
245
+
246
+ bwVar.$stockFindBtn.on('click', function () {
247
+ showSearchResultNearest(this);
248
+ });
249
+
250
+ bwVar.$defStockTab.on('click', function (e) {
251
+ e.preventDefault();
252
+
253
+ bwVar.$stockResult.removeClass('stock__result_hide');
254
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockBot);
255
+ $(this).closest(bwVar.$bigWins).addClass(bwVar.bwMinHeight);
402
256
 
403
- if (!bwVar.$ccOrder.length) {
404
257
  if ($(window).width() < 767) {
405
- //disable scroll for modal
406
- bwVar.$body.addClass(bwVar.scrollDisable);
258
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockMore);
259
+ } else {
260
+ var self = this;
261
+ setTimeout(function () {
262
+ $(self).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockMore);
263
+ }, 1);
407
264
  }
408
- }
265
+ });
409
266
 
410
- } else if ($(this).text().trim() === 'Hide Info') {
411
- closeStoreDetails(this);
412
- }
413
- }
414
- });
415
-
416
- //hide store details
417
- bwVar.$sDetailsClose.on('click', function (e) {
418
- e.preventDefault();
419
- closeStoreDetails(this);
420
- });
421
-
422
- // show store via radio buttons
423
- bwVar.$stockRadio.on('change', function () {
424
- $(this).closest(bwVar.$bigWins).find('.stock__valid')
425
- .removeClass('stock__valid_show');
426
- if ( $(this).closest(bwVar.$bigWins).find(bwVar.ccBtn)
427
- .attr('disabled')) {
428
- $(this).closest(bwVar.$bigWins).find(bwVar.ccBtn)
429
- .removeAttr('disabled');
430
- $(this).closest(bwVar.$bigWins).find(bwVar.ccBtn)
431
- .find('.btn__text').text(bwVar.CLICK_AND_COLLECT);
432
- }
433
-
434
- var openedInfo = false;
435
- $(this).closest(bwVar.$bigWins).find('.s-details').each(function () {
436
- if (!$(this).hasClass('s-details_hide')) {
437
- openedInfo = true
438
- }
439
- });
440
-
441
- if (openedInfo) {
442
- var storeName = $(this)
443
- .closest('.stock__item')
444
- .find(bwVar.storeName)
445
- .text()
446
- .trim()
447
- .toLowerCase();
448
- $(this).closest(bwVar.$bigWins).find(bwVar.$storeMoreLink).text('Store Info');
449
- $(this).closest('.stock__item').find(bwVar.$storeMoreLink).text('Hide Info');
450
-
451
- //show pseudoclass
452
- $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockDetailsOpen);
453
- $(this).closest(bwVar.$bigWins).find(bwVar.$pdpPrice).addClass(bwVar.stockDetailsOpen);
454
-
455
- $(this).closest(bwVar.$pdpPrice).addClass(bwVar.pdpPriceBW);
456
-
457
- $(this).closest(bwVar.$bigWins).find(bwVar.$sDetails)
458
- .addClass(bwVar.sDetailsHide);
459
-
460
- //open tab with current store
461
- $(this).closest(bwVar.$bigWins).find(bwVar.$sDetails)
462
- .each(function () {
463
- if ($(this)
464
- .find(bwVar.sDetailsStoreName)
465
- .text()
466
- .trim()
467
- .toLowerCase() === storeName) {
468
- $(this).removeClass(bwVar.sDetailsHide);
469
- }
267
+ //choose default store in more stores section
268
+ bwVar.$storeState.on('click', function (e) {
269
+ let defVal = $(this).text().trim(),
270
+ toDefault = 'Make this your default store',
271
+ isDefault = 'Default store',
272
+ selectedStore = $(this).closest(bwVar.$store).html();
273
+
274
+ e.preventDefault();
275
+
276
+ if (defVal === toDefault) {
277
+ bwVar.$storeState.text(toDefault);
278
+ $(this).text(isDefault);
279
+ bwVar.$bwChosen.find(bwVar.$store).html(selectedStore);
280
+ bwVar.$storeState.parent().find(bwVar.$toDefaultIcon).hide();
281
+ bwVar.$storeState.parent().find(bwVar.$isDefaultIcon).show();
282
+
283
+ $(this).parent().find(bwVar.$isDefaultIcon).hide();
284
+ $(this).parent().find(bwVar.$toDefaultIcon).show();
285
+ } else {
286
+ $(this).click(false);
287
+ }
470
288
  });
471
289
 
472
- if ($(window).width() < 767) {
473
- //disable scroll for modal
474
- bwVar.$body.addClass(bwVar.scrollDisable);
475
- }
290
+ //make store default from main page
291
+ bwVar.$nameDefault.on('click', function (e) {
292
+ e.preventDefault();
293
+ let makeDefValue = $(this).find(bwVar.defaultStoreName).text();
476
294
 
477
- } else {
478
- closeStoreDetails(this)
479
- }
480
-
481
- $(this).trigger('click');
482
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockRadio).find('input').removeAttr('checked');
483
- $(this).find('input').attr('checked', 'checked');
484
-
485
- var attr = $(this).find('input').attr('checked');
486
- if (typeof attr !== 'undefined' && attr !== false) {
487
- var value = $(this).closest('.stock__item').find('.store__stock_val').text();
488
- if (!value.match(/^-{0,1}\d+$/)) {
489
- $(this).closest('.stock__item').find('.stock__valid').addClass('stock__valid_show');
490
- $(bwVar.ccBtn).attr('disabled', 'disabled');
491
- $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
492
- }
493
- }
494
- });
495
-
496
- //toggle map
497
- bwVar.$sDetailsToggleMap.on('click', function (e) {
498
- e.preventDefault();
499
- $(this).closest(bwVar.$bigWins).find(bwVar.$pdpPrice).removeClass(bwVar.pdpPriceBW);
500
-
501
- if ($(this)
502
- .closest(bwVar.sDetailsInfo)
503
- .find(bwVar.$sDetailsToggleMapText)
504
- .text()
505
- .trim() === 'Hide Map'
506
- ) {
507
- $(this)
508
- .closest(bwVar.sDetailsInfo)
509
- .find(bwVar.$sDetailsToggleMapText)
510
- .text('Show Map');
511
- $(this)
512
- .closest(bwVar.sDetailsInfo)
513
- .find(bwVar.$sDetailsMap)
514
- .addClass(bwVar.sDetailsMapHide);
515
- } else if ($(this)
516
- .closest(bwVar.sDetailsInfo)
517
- .find(bwVar.$sDetailsToggleMapText)
518
- .text()
519
- .trim() === 'Show Map'
520
- ) {
521
- $(this)
522
- .closest(bwVar.sDetailsInfo)
523
- .find(bwVar.$sDetailsToggleMapText)
524
- .text('Hide Map');
525
- $(this)
526
- .closest(bwVar.sDetailsInfo)
527
- .find(bwVar.$sDetailsMap)
528
- .removeClass(bwVar.sDetailsMapHide);
529
- }
530
- });
531
-
532
- bwVar.$stockQuestions.find('input').on('click', function () {
533
- if ($(this).attr('checked') === 'checked') {
534
- $(this).removeAttr('checked')
535
- } else {
536
- $(this).attr('checked', 'checked');
537
- }
538
- });
539
-
540
- bwVar.$stockClose.on('click', function (e) {
541
- closeMoreStorestModal(e, this);
542
- closeStoreDetails(this);
543
- });
544
-
545
- //come back to search tab
546
- bwVar.$stockEditBtn.on('click', function () {
547
- closeStoreDetails(this);
548
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockResult)
549
- .addClass(bwVar.stockResultHide);
550
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockTabs)
551
- .removeClass(bwVar.stockTabsHide);
552
- $(this).closest(bwVar.$bigWins).find(bwVar.$stockFind)
553
- .removeClass(bwVar.stockFindHide);
554
- });
555
-
556
- bwVar.$stockCancel.on('click', function (e) {
557
- closeMoreStorestModal(e, this);
558
- });
559
-
560
- //C&C btn
561
- bwVar.$bigWins.on('click', bwVar.ccBtn, function (e) {
562
- closeMoreStorestModal(e, this);
563
-
564
- //hide store info
565
- $(this).closest(bwVar.$bigWins).find(bwVar.$sDetails)
566
- .addClass(bwVar.sDetailsHide);
567
- $(this).closest(bwVar.$pdpPrice).removeClass(bwVar.pdpPriceBW);
568
-
569
- //show store info
570
- $(this).closest(bwVar.$bigWins).find(bwVar.$chosen).removeClass(bwVar.chosenHide);
571
-
572
- if ($(this).closest(bwVar.$bigWins).hasClass('bw_unhappy')) {
573
- $(this).closest(bwVar.$bigWins).find(bwVar.$chosen).addClass(bwVar.chosenError);
574
- } else {
575
- $(this).closest(bwVar.$bigWins).find(bwVar.$chosen).addClass(bwVar.chosenSuccess);
576
- }
577
-
578
-
579
- //hide pseudoclass
580
- $(this).closest(bwVar.$bigWins).find(bwVar.$stock).removeClass(bwVar.stockDetailsOpen);
581
-
582
- //unlock scroll for modal
583
- bwVar.$body.removeClass(bwVar.scrollDisable);
584
-
585
- scrollToBlockMobile(this);
586
- });
587
-
588
- bwVar.$sDetailsCopy.on('click', function (e) {
589
- e.preventDefault();
590
- var $temp = $('<input>');
591
- $(this.parentElement).append($temp);//workaround for iPad scrolling
592
- var text = $(this).closest(bwVar.sDetails).find(bwVar.$sDetailsAddress).text().trim();
593
- var str = text.replace(/(^\w|\s\w)/g, function (m) {
594
- return m.toUpperCase()
595
- });
596
- var textFiltered = str.split(' ').filter(function (value) {
597
- return value !== ''
598
- });
599
- var textTrimmed = textFiltered.join(' ');
600
- $temp.val(textTrimmed);
601
- if (navigator.userAgent.match(/TradeProMobile_iOS|DIYMobile_iOS/i)) {
602
- iosCopyToClipboard($temp);
603
- } else if (navigator.userAgent.match(/ipad|ipod|iphone/i)) {
604
- $temp.select();
605
- $temp.setSelectionRange(0, 999999);
606
- } else {
607
- $temp.select();
608
- }
609
-
610
- document.execCommand("copy");
611
- $(this).addClass(bwVar.copyLinkHovered);
612
- $temp.remove();
613
- });
614
-
615
- // bwVar.$addForDelivery.on('click', function () {
616
- // Wick.SnackBar.show(
617
- // {
618
- // text: 'Notification success message for Delivery with Close Btn',
619
- // type: Wick.SnackBar.types.SUCCESS
620
- // }
621
- // );
622
- // Wick.SnackBar.show(
623
- // {
624
- // text: 'Notification warning message for Delivery with Close Btn',
625
- // type: Wick.SnackBar.types.WARNING
626
- // }
627
- // );
628
- // Wick.SnackBar.show(
629
- // {
630
- // text: 'Notification error message for Delivery with Close Btn',
631
- // type: Wick.SnackBar.types.ERROR
632
- // }
633
- // );
634
- // Wick.SnackBar.show(
635
- // {
636
- // text: 'Notification success message for Delivery with Autoclose',
637
- // type: Wick.SnackBar.types.SUCCESS,
638
- // withCloseButton: false,
639
- // autoClose: true,
640
- // delayBeforeClose: 3000
641
- // }
642
- // );
643
- // });
644
-
645
- bwVar.$addClickAndCollect.on('click', function (e) {
646
- e.stopPropagation();
647
- Wick.SnackBar.show(
648
- {
649
- text: 'Notification success message for Click & Collect with Close Btn',
650
- type: Wick.SnackBar.types.SUCCESS,
651
- withCloseButton: true,
652
- }
653
- );
654
- Wick.SnackBar.show(
655
- {
656
- text: 'Notification warning message for Click & Collect with Close Btn',
657
- type: Wick.SnackBar.types.WARNING,
658
- withCloseButton: true,
659
- }
660
- );
661
- Wick.SnackBar.show(
662
- {
663
- text: 'Notification error message for Click & Collect with Close Btn',
664
- type: Wick.SnackBar.types.ERROR,
665
- withCloseButton: true,
666
- }
667
- );
668
- Wick.SnackBar.show(
669
- {
670
- text: 'Notification success message for Click & Collect with Autoclose',
671
- type: Wick.SnackBar.types.SUCCESS,
672
- withCloseButton: false,
673
- autoClose: true,
674
- delayBeforeClose: 3000
675
- }
676
- );
677
- })
678
-
679
- //func to show results
680
- function showSearchResultMore(e, context) {
681
- e.preventDefault();
682
- var postcodeLength = $(context).closest(bwVar.$bigWins).find(bwVar.$stockPostcode).val().length;
683
-
684
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockPostcodeEl).removeClass(bwVar.stockPostcodeInvalid);
685
-
686
- if (postcodeLength >= 5) {
687
- if ($(window).width() < 767) {
688
- bwVar.$body.addClass(bwVar.scrollDisable);
689
- }
690
- //open new section
691
- if (!$(context).closest(bwVar.$bigWins).find(bwVar.$stockTabs).hasClass('more-stores-present')) {
692
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockResult).removeClass(bwVar.stockResultHide);
693
- } else {
694
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockTabs).addClass(bwVar.stockTabsHide);
695
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockFind).addClass(bwVar.stockFindHide);
696
- }
295
+ bwVar.$stockList.find(bwVar.storeName).each(function () {
296
+ if ($(this).text() === makeDefValue) {
297
+ $(this).closest(bwVar.$store).find('.store-state').click();
298
+ }
299
+ });
697
300
 
698
- //clean classes for descr
699
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockDescr).removeClass(bwVar.stockDescrS);
700
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockDescr).removeClass(bwVar.stockDescrC);
701
-
702
- var quantity = $(context).closest(bwVar.$bigWins).find(bwVar.$stockQuantity).val(),
703
- postcode = $(context).closest(bwVar.$bigWins).find(bwVar.$stockPostcode).val(),
704
- onlyStock = $(context).closest(bwVar.$bigWins)
705
- .find(bwVar.$stockQuestions)
706
- .find('input[name="stock-only"]')
707
- .attr('checked') === 'checked',
708
- onlyCC = $(context).closest(bwVar.$bigWins)
709
- .find(bwVar.$stockQuestions)
710
- .find('input[name="cc-only"]')
711
- .attr('checked') === 'checked';
712
-
713
- //amend text in info block
714
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockAmount).text(quantity);
715
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockPost).text(postcode);
716
-
717
- if (onlyCC !== onlyStock) {
718
- if (onlyStock) {
719
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockDescr).addClass(bwVar.stockDescrS)
720
- } else if (onlyCC) {
721
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockDescr).addClass(bwVar.stockDescrC)
722
- }
723
- } else if (onlyStock === false && onlyCC === false) {
724
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockDescr).addClass(bwVar.stockDescrS)
725
- }
726
- } else {
727
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockPostcodeEl).addClass(bwVar.stockPostcodeInvalid);
728
- }
729
- }
301
+ bwVar.$makeDefault.hide();
302
+ bwVar.$defaultInfo.hide();
303
+ bwVar.$defaultCurrent.show();
304
+ });
305
+
306
+ bwVar.$currentDefault.on('click', function (e) {
307
+ e.preventDefault();
308
+ let makeDefValue = $(this).find(bwVar.defaultStoreName).text();
309
+
310
+ bwVar.$stockList.find(bwVar.storeName).each(function () {
311
+ if ($(this).text() === makeDefValue) {
312
+ $(this).closest(bwVar.$store).find('.store-state').click();
313
+ }
314
+ });
315
+
316
+ bwVar.$makeDefault.hide();
317
+ bwVar.$defaultInfo.hide();
318
+ bwVar.$defaultCurrent.show();
319
+ });
730
320
 
731
- function showSearchResultNearest(context) {
732
- var postcodeLength = $(context).closest(bwVar.$bigWins).find(bwVar.$stockPostcode).val().length;
733
-
734
- if (postcodeLength >= 5) {
735
- closeStoreDetails(context);
736
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockPostcodeEl)
737
- .removeClass(bwVar.stockPostcodeInvalid);
738
- $(context).closest(bwVar.$bigWins).find(bwVar.$chosen)
739
- .removeClass(bwVar.chosenHide);
740
- $(context).closest(bwVar.$bigWins).find(bwVar.$chosen)
741
- .addClass(bwVar.chosenNearest);
742
-
743
- scrollToBlockMobile(context);
744
-
745
- var value = $(context).closest(bwVar.$bigWins).find('.chosen__nearest')
746
- .find('.store__stock_val').text();
747
- if (value.match(/^out$/)) {
748
- $(context).closest(bwVar.$bigWins).find('.chosen__nearest')
749
- .find('.stock__valid').addClass('stock__valid_show');
750
- $(context).closest(bwVar.$bigWins).find(bwVar.ccBtn)
751
- .attr('disabled', 'disabled');
752
- $(context).closest(bwVar.$bigWins).find(bwVar.ccBtn)
753
- .find('.btn__text').text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
754
- } else {
755
- if ($(context).closest(bwVar.$bigWins)
756
- .find('#isCnCForProductAndStoreDisabled').val() === "true") {
757
- $(context).closest(bwVar.$bigWins).find('.chosen__nearest')
758
- .find('.stock__valid').addClass('stock__valid_show');
759
- $(context).closest(bwVar.$bigWins).find(bwVar.ccBtn)
760
- .attr('disabled', 'disabled');
761
- $(context).closest(bwVar.$bigWins).find(bwVar.ccBtn)
762
- .find('.btn__text').text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
763
- } else {
764
- $(context).closest(bwVar.$bigWins).find('.chosen__nearest')
765
- .find('.stock__valid').removeClass('stock__valid_show');
766
- if ($(context).closest(bwVar.$bigWins).find(bwVar.ccBtn)
767
- .attr('disabled')) {
768
- $(context).closest(bwVar.$bigWins).find(bwVar.ccBtn)
769
- .removeAttr('disabled');
770
- $(context).closest(bwVar.$bigWins).find(bwVar.ccBtn)
771
- .find('.btn__text').text(bwVar.CLICK_AND_COLLECT);
321
+ //my-acc default store component logic
322
+ bwVar.$storeSearch.on('click', function (e) {
323
+ e.preventDefault();
324
+ bwVar.$storeSearch.hide();
325
+ bwVar.$stockPostcodeEl.show();
326
+ });
327
+
328
+ //my-acc scroll to default store component logic
329
+ $('.scrollToDefault').on('click', function (e) {
330
+ e.preventDefault();
331
+ var target = $(this).attr('href');
332
+ $('html, body').animate(
333
+ {
334
+ scrollTop: $(target).offset().top,
335
+ },
336
+ 'slow'
337
+ );
338
+ });
339
+
340
+ bwVar.$findStore.on('click', function (e) {
341
+ e.preventDefault();
342
+
343
+ if ($('.stock__input').val().length !== 0) {
344
+ bwVar.$stockPostcodeEl.removeClass(bwVar.stockPostcodeInvalid);
345
+ bwVar.$postCodeErrorMsg.hide();
346
+ bwVar.$bigWins.show();
347
+
348
+ if (bwVar.$bigWins.css('display') === 'block') {
349
+ bwVar.$bwActions.css('display', 'flex');
350
+ } else {
351
+ bwVar.$bwActions.hide();
352
+ }
353
+ } else {
354
+ bwVar.$stockPostcodeEl.addClass(bwVar.stockPostcodeInvalid);
355
+ bwVar.$postCodeErrorMsg.css('display', 'inherit');
772
356
  }
773
- }
774
- }
775
- } else {
776
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockPostcodeEl)
777
- .addClass(bwVar.stockPostcodeInvalid);
778
- }
779
- }
357
+ });
780
358
 
781
- function closeMoreStorestModal(e, context) {
782
- e.preventDefault();
783
- //close more block
784
- $(context).closest(bwVar.$bigWins).find(bwVar.$stock)
785
- .removeClass(bwVar.stockMore);
786
-
787
- if ($(window).width() < 767) {
788
- $(context).closest(bwVar.$bigWins).find(bwVar.$stock)
789
- .removeClass(bwVar.stockBot);
790
- $(context).closest(bwVar.$bigWins).removeClass(bwVar.bwMinHeight);
791
- } else {
792
- setTimeout(function () {
793
- $(context).closest(bwVar.$bigWins).find(bwVar.$stock)
794
- .removeClass(bwVar.stockBot);
795
- $(context).closest(bwVar.$bigWins)
796
- .removeClass(bwVar.bwMinHeight);
797
- }, 600);
798
- }
799
-
800
- //bind nearestStore event
801
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockFindBtn)
802
- .unbind();
803
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockFindBtn)
804
- .on('click', showSearchResultNearest);
805
-
806
- //toggle tabs to nearest
807
- $(context).closest(bwVar.$bigWins).find(bwVar.$stock)
808
- .removeClass(bwVar.stockMore);
809
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockTab)
810
- .removeClass(bwVar.active);
811
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockTab)
812
- .first().addClass(bwVar.active);
813
-
814
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockResult)
815
- .addClass(bwVar.stockResultHide);
816
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockTabs)
817
- .removeClass(bwVar.stockTabsHide);
818
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockFind)
819
- .removeClass(bwVar.stockFindHide);
820
-
821
- bwVar.$body.removeClass(bwVar.scrollDisable);
822
-
823
- scrollToBlockMobile(context);
824
- }
359
+ bwVar.$addStore.on('click', function (e) {
360
+ e.preventDefault();
361
+ bwVar.$bigWins.hide();
362
+ bwVar.$stockPostcodeEl.hide();
363
+ bwVar.$storeChange.css('display', 'block');
364
+ bwVar.$bwActions.hide();
365
+ bwVar.$addStore.text('Update Default Store');
366
+ });
825
367
 
826
- function closeStoreDetails(context) {
827
- bwVar.$storeMoreLink.text('Store Info');
828
- //hide pseudoclass
829
- $(context).closest(bwVar.$bigWins).find(bwVar.$stock)
830
- .removeClass(bwVar.stockDetailsOpen);
831
- $(context).closest(bwVar.$bigWins).find(bwVar.$sDetails)
832
- .addClass(bwVar.sDetailsHide);
833
- bwVar.$pdpPrice.removeClass(bwVar.pdpPriceBW);
834
- bwVar.$tiTotal.removeClass(bwVar.tiTotalBW);
835
- bwVar.$body.removeClass(bwVar.scrollDisable);
836
-
837
- scrollToBlockMobile(context);
838
- }
368
+ bwVar.$cancelStore.on('click', function (e) {
369
+ e.preventDefault();
370
+ bwVar.$bigWins.hide();
371
+ bwVar.$bwActions.hide();
372
+ bwVar.$stockPostcodeEl.hide();
373
+ bwVar.$storeSearch.show();
374
+ });
839
375
 
840
- function showSearchResultMoreProto(context) {
841
- if ($(context).closest(bwVar.$bigWins).find('.stock__tab.active').attr('data-stores') === 'more') {
842
- var postcodeLength;
843
-
844
- if ($(context).closest(bwVar.$bigWins).find(bwVar.$bwChosen).hasClass(bwVar.protoOnlyPopulated)) {
845
- postcodeLength = $(context).closest(bwVar.$bigWins)
846
- .find(bwVar.$protoOnlyPopulated)
847
- .find(bwVar.storeName)
848
- .text().length;
849
- } else {
850
- postcodeLength = $(context).closest(bwVar.$bigWins).find(bwVar.$stockPostcode).val().length;
851
- }
376
+ bwVar.$storeChange.on('click', function (e) {
377
+ e.preventDefault();
378
+ bwVar.$bigWins.show();
379
+ bwVar.$stockPostcodeEl.show();
380
+ bwVar.$bwActions.show();
381
+ bwVar.$storeChange.hide();
382
+ });
852
383
 
853
- if (postcodeLength >= 5) {
854
- if ($(context).closest(bwVar.$bigWins).find(bwVar.$stockTabs).hasClass(bwVar.moreStoresPresent || bwVar.defStoresPresent)) {
855
- $(context).closest(bwVar.$bigWins).find(bwVar.$stockResult).removeClass(bwVar.stockResultHide);
856
- }
857
- }
858
- }
859
- }
384
+ bwVar.$defStoreWrap.find(bwVar.$addStore).on('click', function () {
385
+ if ($("input:radio[name='store']").is(':checked')) {
386
+ let currentInp = $("input:radio[name='store'][checked='checked']"),
387
+ selectedVal = currentInp
388
+ .closest(bwVar.stockItem)
389
+ .find(bwVar.sDetailsAddress)
390
+ .text();
860
391
 
861
- function iosCopyToClipboard($input) {
862
- var el = $input.get(0);
863
- var editable = el.contentEditable;
864
- var readOnly = el.readOnly;
865
-
866
- el.contentEditable = true;
867
- el.readOnly = false;
868
- var range = document.createRange();
869
- range.selectNodeContents(el);
870
- var sel = window.getSelection();
871
- sel.removeAllRanges();
872
- sel.addRange(range);
873
- el.setSelectionRange(0, 999999);
874
- el.contentEditable = editable;
875
- el.readOnly = readOnly;
876
- }
392
+ bwVar.$defStoreWrap.find('.table__content-address').text(selectedVal);
393
+ }
394
+ });
395
+
396
+ //show store details
397
+ bwVar.$storeMoreLink.on('click', function (e) {
398
+ e.preventDefault();
399
+
400
+ console.log($(this).closest('.basket').length);
401
+ if (!$(this).closest('.basket').length) {
402
+ var storeName = $(this)
403
+ .closest('.store')
404
+ .find(bwVar.storeName)
405
+ .text()
406
+ .trim()
407
+ .toLowerCase();
408
+
409
+ if ($(this).text().trim() === 'Store Info') {
410
+ closeStoreDetails(this);
411
+ $(this)
412
+ .closest(bwVar.$bigWins)
413
+ .find(bwVar.$stockRadio)
414
+ .find('input')
415
+ .removeAttr('checked');
416
+ $(this).closest(bwVar.stockItem).find(bwVar.$stockRadio).trigger('click');
417
+ $(this)
418
+ .closest(bwVar.stockItem)
419
+ .find(bwVar.$stockRadio)
420
+ .attr('checked', 'checked');
421
+
422
+ $(this).text('Hide Info');
423
+
424
+ //show pseudoclass
425
+ $(this)
426
+ .closest(bwVar.$bigWins)
427
+ .find(bwVar.$stock)
428
+ .addClass(bwVar.stockDetailsOpen);
429
+
430
+ //classes only for Price
431
+ console.log($(this).closest(bwVar.$pdpPrice).length);
432
+
433
+ if ($(this).closest(bwVar.$pdpPrice).length) {
434
+ $(this).closest(bwVar.$pdpPrice).addClass(bwVar.stockDetailsOpen);
435
+ $(this).closest(bwVar.$pdpPrice).addClass(bwVar.pdpPriceBW);
436
+ } else if ($(this).closest(bwVar.$tiTotal).length) {
437
+ $(this).closest(bwVar.$tiTotal).addClass(bwVar.stockDetailsOpen);
438
+ $(this).closest(bwVar.$tiTotal).addClass(bwVar.tiTotalBW);
439
+ }
440
+
441
+ $(this)
442
+ .closest(bwVar.$bigWins)
443
+ .find(bwVar.$sDetails)
444
+ .addClass(bwVar.sDetailsHide);
445
+ //open tab with current store
446
+ $(this)
447
+ .closest(bwVar.$bigWins)
448
+ .find(bwVar.$sDetails)
449
+ .each(function () {
450
+ if (
451
+ $(this)
452
+ .find(bwVar.sDetailsStoreName)
453
+ .text()
454
+ .trim()
455
+ .toLowerCase() === storeName
456
+ ) {
457
+ $(this).removeClass(bwVar.sDetailsHide);
458
+ }
459
+ });
460
+
461
+ if (!bwVar.$ccOrder.length) {
462
+ if ($(window).width() < 767) {
463
+ //disable scroll for modal
464
+ bwVar.$body.addClass(bwVar.scrollDisable);
465
+ }
466
+ }
467
+ } else if ($(this).text().trim() === 'Hide Info') {
468
+ closeStoreDetails(this);
469
+ }
470
+ }
471
+ });
472
+
473
+ //hide store details
474
+ bwVar.$sDetailsClose.on('click', function (e) {
475
+ e.preventDefault();
476
+ closeStoreDetails(this);
477
+ });
478
+
479
+ // show store via radio buttons
480
+ bwVar.$stockRadio.on('change', function () {
481
+ $(this).closest(bwVar.$bigWins).find('.stock__valid').removeClass('stock__valid_show');
482
+ if ($(this).closest(bwVar.$bigWins).find(bwVar.ccBtn).attr('disabled')) {
483
+ $(this).closest(bwVar.$bigWins).find(bwVar.ccBtn).removeAttr('disabled');
484
+ $(this)
485
+ .closest(bwVar.$bigWins)
486
+ .find(bwVar.ccBtn)
487
+ .find('.btn__text')
488
+ .text(bwVar.CLICK_AND_COLLECT);
489
+ }
490
+
491
+ var openedInfo = false;
492
+ $(this)
493
+ .closest(bwVar.$bigWins)
494
+ .find('.s-details')
495
+ .each(function () {
496
+ if (!$(this).hasClass('s-details_hide')) {
497
+ openedInfo = true;
498
+ }
499
+ });
500
+
501
+ if (openedInfo) {
502
+ var storeName = $(this)
503
+ .closest('.stock__item')
504
+ .find(bwVar.storeName)
505
+ .text()
506
+ .trim()
507
+ .toLowerCase();
508
+ $(this).closest(bwVar.$bigWins).find(bwVar.$storeMoreLink).text('Store Info');
509
+ $(this).closest('.stock__item').find(bwVar.$storeMoreLink).text('Hide Info');
510
+
511
+ //show pseudoclass
512
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stock).addClass(bwVar.stockDetailsOpen);
513
+ $(this)
514
+ .closest(bwVar.$bigWins)
515
+ .find(bwVar.$pdpPrice)
516
+ .addClass(bwVar.stockDetailsOpen);
517
+
518
+ $(this).closest(bwVar.$pdpPrice).addClass(bwVar.pdpPriceBW);
519
+
520
+ $(this).closest(bwVar.$bigWins).find(bwVar.$sDetails).addClass(bwVar.sDetailsHide);
521
+
522
+ //open tab with current store
523
+ $(this)
524
+ .closest(bwVar.$bigWins)
525
+ .find(bwVar.$sDetails)
526
+ .each(function () {
527
+ if (
528
+ $(this).find(bwVar.sDetailsStoreName).text().trim().toLowerCase() ===
529
+ storeName
530
+ ) {
531
+ $(this).removeClass(bwVar.sDetailsHide);
532
+ }
533
+ });
534
+
535
+ if ($(window).width() < 767) {
536
+ //disable scroll for modal
537
+ bwVar.$body.addClass(bwVar.scrollDisable);
538
+ }
539
+ } else {
540
+ closeStoreDetails(this);
541
+ }
542
+
543
+ $(this).trigger('click');
544
+ $(this)
545
+ .closest(bwVar.$bigWins)
546
+ .find(bwVar.$stockRadio)
547
+ .find('input')
548
+ .removeAttr('checked');
549
+ $(this).find('input').attr('checked', 'checked');
550
+
551
+ var attr = $(this).find('input').attr('checked');
552
+ if (typeof attr !== 'undefined' && attr !== false) {
553
+ var value = $(this).closest('.stock__item').find('.store__stock_val').text();
554
+ if (!value.match(/^-{0,1}\d+$/)) {
555
+ $(this)
556
+ .closest('.stock__item')
557
+ .find('.stock__valid')
558
+ .addClass('stock__valid_show');
559
+ $(bwVar.ccBtn).attr('disabled', 'disabled');
560
+ $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
561
+ }
562
+ }
563
+ });
564
+
565
+ //toggle map
566
+ bwVar.$sDetailsToggleMap.on('click', function (e) {
567
+ e.preventDefault();
568
+ $(this).closest(bwVar.$bigWins).find(bwVar.$pdpPrice).removeClass(bwVar.pdpPriceBW);
569
+
570
+ if (
571
+ $(this)
572
+ .closest(bwVar.sDetailsInfo)
573
+ .find(bwVar.$sDetailsToggleMapText)
574
+ .text()
575
+ .trim() === 'Hide Map'
576
+ ) {
577
+ $(this)
578
+ .closest(bwVar.sDetailsInfo)
579
+ .find(bwVar.$sDetailsToggleMapText)
580
+ .text('Show Map');
581
+ $(this)
582
+ .closest(bwVar.sDetailsInfo)
583
+ .find(bwVar.$sDetailsMap)
584
+ .addClass(bwVar.sDetailsMapHide);
585
+ } else if (
586
+ $(this)
587
+ .closest(bwVar.sDetailsInfo)
588
+ .find(bwVar.$sDetailsToggleMapText)
589
+ .text()
590
+ .trim() === 'Show Map'
591
+ ) {
592
+ $(this)
593
+ .closest(bwVar.sDetailsInfo)
594
+ .find(bwVar.$sDetailsToggleMapText)
595
+ .text('Hide Map');
596
+ $(this)
597
+ .closest(bwVar.sDetailsInfo)
598
+ .find(bwVar.$sDetailsMap)
599
+ .removeClass(bwVar.sDetailsMapHide);
600
+ }
601
+ });
602
+
603
+ bwVar.$stockQuestions.find('input').on('click', function () {
604
+ if ($(this).attr('checked') === 'checked') {
605
+ $(this).removeAttr('checked');
606
+ } else {
607
+ $(this).attr('checked', 'checked');
608
+ }
609
+ });
610
+
611
+ bwVar.$stockClose.on('click', function (e) {
612
+ closeMoreStorestModal(e, this);
613
+ closeStoreDetails(this);
614
+ });
615
+
616
+ //come back to search tab
617
+ bwVar.$stockEditBtn.on('click', function () {
618
+ closeStoreDetails(this);
619
+ $(this)
620
+ .closest(bwVar.$bigWins)
621
+ .find(bwVar.$stockResult)
622
+ .addClass(bwVar.stockResultHide);
623
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stockTabs).removeClass(bwVar.stockTabsHide);
624
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stockFind).removeClass(bwVar.stockFindHide);
625
+ });
626
+
627
+ bwVar.$stockCancel.on('click', function (e) {
628
+ closeMoreStorestModal(e, this);
629
+ });
630
+
631
+ //C&C btn
632
+ bwVar.$bigWins.on('click', bwVar.ccBtn, function (e) {
633
+ closeMoreStorestModal(e, this);
634
+
635
+ //hide store info
636
+ $(this).closest(bwVar.$bigWins).find(bwVar.$sDetails).addClass(bwVar.sDetailsHide);
637
+ $(this).closest(bwVar.$pdpPrice).removeClass(bwVar.pdpPriceBW);
638
+
639
+ //show store info
640
+ $(this).closest(bwVar.$bigWins).find(bwVar.$chosen).removeClass(bwVar.chosenHide);
641
+
642
+ if ($(this).closest(bwVar.$bigWins).hasClass('bw_unhappy')) {
643
+ $(this).closest(bwVar.$bigWins).find(bwVar.$chosen).addClass(bwVar.chosenError);
644
+ } else {
645
+ $(this).closest(bwVar.$bigWins).find(bwVar.$chosen).addClass(bwVar.chosenSuccess);
646
+ }
647
+
648
+ //hide pseudoclass
649
+ $(this).closest(bwVar.$bigWins).find(bwVar.$stock).removeClass(bwVar.stockDetailsOpen);
650
+
651
+ //unlock scroll for modal
652
+ bwVar.$body.removeClass(bwVar.scrollDisable);
653
+
654
+ scrollToBlockMobile(this);
655
+ });
656
+
657
+ bwVar.$sDetailsCopy.on('click', function (e) {
658
+ e.preventDefault();
659
+ var $temp = $('<input>');
660
+ $(this.parentElement).append($temp); //workaround for iPad scrolling
661
+ var text = $(this).closest(bwVar.sDetails).find(bwVar.$sDetailsAddress).text().trim();
662
+ var str = text.replace(/(^\w|\s\w)/g, function (m) {
663
+ return m.toUpperCase();
664
+ });
665
+ var textFiltered = str.split(' ').filter(function (value) {
666
+ return value !== '';
667
+ });
668
+ var textTrimmed = textFiltered.join(' ');
669
+ $temp.val(textTrimmed);
670
+ if (navigator.userAgent.match(/TradeProMobile_iOS|DIYMobile_iOS/i)) {
671
+ iosCopyToClipboard($temp);
672
+ } else if (navigator.userAgent.match(/ipad|ipod|iphone/i)) {
673
+ $temp.select();
674
+ $temp.setSelectionRange(0, 999999);
675
+ } else {
676
+ $temp.select();
677
+ }
678
+
679
+ document.execCommand('copy');
680
+ $(this).addClass(bwVar.copyLinkHovered);
681
+ $temp.remove();
682
+ });
683
+
684
+ // bwVar.$addForDelivery.on('click', function () {
685
+ // Wick.SnackBar.show(
686
+ // {
687
+ // text: 'Notification success message for Delivery with Close Btn',
688
+ // type: Wick.SnackBar.types.SUCCESS
689
+ // }
690
+ // );
691
+ // Wick.SnackBar.show(
692
+ // {
693
+ // text: 'Notification warning message for Delivery with Close Btn',
694
+ // type: Wick.SnackBar.types.WARNING
695
+ // }
696
+ // );
697
+ // Wick.SnackBar.show(
698
+ // {
699
+ // text: 'Notification error message for Delivery with Close Btn',
700
+ // type: Wick.SnackBar.types.ERROR
701
+ // }
702
+ // );
703
+ // Wick.SnackBar.show(
704
+ // {
705
+ // text: 'Notification success message for Delivery with Autoclose',
706
+ // type: Wick.SnackBar.types.SUCCESS,
707
+ // withCloseButton: false,
708
+ // autoClose: true,
709
+ // delayBeforeClose: 3000
710
+ // }
711
+ // );
712
+ // });
713
+
714
+ bwVar.$addClickAndCollect.on('click', function (e) {
715
+ e.stopPropagation();
716
+ Wick.SnackBar.show({
717
+ text: 'Notification success message for Click & Collect with Close Btn',
718
+ type: Wick.SnackBar.types.SUCCESS,
719
+ withCloseButton: true,
720
+ });
721
+ Wick.SnackBar.show({
722
+ text: 'Notification warning message for Click & Collect with Close Btn',
723
+ type: Wick.SnackBar.types.WARNING,
724
+ withCloseButton: true,
725
+ });
726
+ Wick.SnackBar.show({
727
+ text: 'Notification error message for Click & Collect with Close Btn',
728
+ type: Wick.SnackBar.types.ERROR,
729
+ withCloseButton: true,
730
+ });
731
+ Wick.SnackBar.show({
732
+ text: 'Notification success message for Click & Collect with Autoclose',
733
+ type: Wick.SnackBar.types.SUCCESS,
734
+ withCloseButton: false,
735
+ autoClose: true,
736
+ delayBeforeClose: 3000,
737
+ });
738
+ });
877
739
 
878
- function scrollToBlockMobile (context) {
879
- if ($(window).width() < 767) {
880
- if($(context).closest(bwVar.$tiTotal).length) {
881
- window.scroll(0, bwVar.$tiTotal.offset().top - 60);
882
- } else if ($(context).closest(bwVar.$pdpPrice).length) {
883
- window.scroll(0, bwVar.$bigWins.offset().top - 60);
740
+ //func to show results
741
+ function showSearchResultMore(e, context) {
742
+ e.preventDefault();
743
+ var postcodeLength = $(context)
744
+ .closest(bwVar.$bigWins)
745
+ .find(bwVar.$stockPostcode)
746
+ .val().length;
747
+
748
+ $(context)
749
+ .closest(bwVar.$bigWins)
750
+ .find(bwVar.$stockPostcodeEl)
751
+ .removeClass(bwVar.stockPostcodeInvalid);
752
+
753
+ if (postcodeLength >= 5) {
754
+ if ($(window).width() < 767) {
755
+ bwVar.$body.addClass(bwVar.scrollDisable);
756
+ }
757
+ //open new section
758
+ if (
759
+ !$(context)
760
+ .closest(bwVar.$bigWins)
761
+ .find(bwVar.$stockTabs)
762
+ .hasClass('more-stores-present')
763
+ ) {
764
+ $(context)
765
+ .closest(bwVar.$bigWins)
766
+ .find(bwVar.$stockResult)
767
+ .removeClass(bwVar.stockResultHide);
768
+ } else {
769
+ $(context)
770
+ .closest(bwVar.$bigWins)
771
+ .find(bwVar.$stockTabs)
772
+ .addClass(bwVar.stockTabsHide);
773
+ $(context)
774
+ .closest(bwVar.$bigWins)
775
+ .find(bwVar.$stockFind)
776
+ .addClass(bwVar.stockFindHide);
777
+ }
778
+
779
+ //clean classes for descr
780
+ $(context)
781
+ .closest(bwVar.$bigWins)
782
+ .find(bwVar.$stockDescr)
783
+ .removeClass(bwVar.stockDescrS);
784
+ $(context)
785
+ .closest(bwVar.$bigWins)
786
+ .find(bwVar.$stockDescr)
787
+ .removeClass(bwVar.stockDescrC);
788
+
789
+ var quantity = $(context).closest(bwVar.$bigWins).find(bwVar.$stockQuantity).val(),
790
+ postcode = $(context).closest(bwVar.$bigWins).find(bwVar.$stockPostcode).val(),
791
+ onlyStock =
792
+ $(context)
793
+ .closest(bwVar.$bigWins)
794
+ .find(bwVar.$stockQuestions)
795
+ .find('input[name="stock-only"]')
796
+ .attr('checked') === 'checked',
797
+ onlyCC =
798
+ $(context)
799
+ .closest(bwVar.$bigWins)
800
+ .find(bwVar.$stockQuestions)
801
+ .find('input[name="cc-only"]')
802
+ .attr('checked') === 'checked';
803
+
804
+ //amend text in info block
805
+ $(context).closest(bwVar.$bigWins).find(bwVar.$stockAmount).text(quantity);
806
+ $(context).closest(bwVar.$bigWins).find(bwVar.$stockPost).text(postcode);
807
+
808
+ if (onlyCC !== onlyStock) {
809
+ if (onlyStock) {
810
+ $(context)
811
+ .closest(bwVar.$bigWins)
812
+ .find(bwVar.$stockDescr)
813
+ .addClass(bwVar.stockDescrS);
814
+ } else if (onlyCC) {
815
+ $(context)
816
+ .closest(bwVar.$bigWins)
817
+ .find(bwVar.$stockDescr)
818
+ .addClass(bwVar.stockDescrC);
819
+ }
820
+ } else if (onlyStock === false && onlyCC === false) {
821
+ $(context)
822
+ .closest(bwVar.$bigWins)
823
+ .find(bwVar.$stockDescr)
824
+ .addClass(bwVar.stockDescrS);
825
+ }
826
+ } else {
827
+ $(context)
828
+ .closest(bwVar.$bigWins)
829
+ .find(bwVar.$stockPostcodeEl)
830
+ .addClass(bwVar.stockPostcodeInvalid);
831
+ }
884
832
  }
885
- }
886
- }
887
833
 
888
- (function checkStoreProductsNearest() {
889
- var value = $('.chosen__item').find('.store__stock_val').text();
890
- if (value.match(/^out$/)) {
891
- $('.chosen').find('.stock__valid').addClass('stock__valid_show');
892
- $(bwVar.ccBtn).attr('disabled', 'disabled');
893
- $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
894
- } else {
895
- if ($('#isCnCForProductAndStoreDisabled').val() === "true") {
896
- $('.chosen__nearest').find('.stock__valid').addClass('stock__valid_show')
897
- $(bwVar.ccBtn).attr('disabled', 'disabled');
898
- $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
899
- } else {
900
- $('.chosen__nearest').find('.stock__valid').removeClass('stock__valid_show');
901
- if ($(bwVar.ccBtn).attr('disabled')) {
902
- $(bwVar.ccBtn).removeAttr('disabled');
903
- $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT);
904
- }
834
+ function showSearchResultNearest(context) {
835
+ var postcodeLength = $(context)
836
+ .closest(bwVar.$bigWins)
837
+ .find(bwVar.$stockPostcode)
838
+ .val().length;
839
+
840
+ if (postcodeLength >= 5) {
841
+ closeStoreDetails(context);
842
+ $(context)
843
+ .closest(bwVar.$bigWins)
844
+ .find(bwVar.$stockPostcodeEl)
845
+ .removeClass(bwVar.stockPostcodeInvalid);
846
+ $(context)
847
+ .closest(bwVar.$bigWins)
848
+ .find(bwVar.$chosen)
849
+ .removeClass(bwVar.chosenHide);
850
+ $(context)
851
+ .closest(bwVar.$bigWins)
852
+ .find(bwVar.$chosen)
853
+ .addClass(bwVar.chosenNearest);
854
+
855
+ scrollToBlockMobile(context);
856
+
857
+ var value = $(context)
858
+ .closest(bwVar.$bigWins)
859
+ .find('.chosen__nearest')
860
+ .find('.store__stock_val')
861
+ .text();
862
+ if (value.match(/^out$/)) {
863
+ $(context)
864
+ .closest(bwVar.$bigWins)
865
+ .find('.chosen__nearest')
866
+ .find('.stock__valid')
867
+ .addClass('stock__valid_show');
868
+ $(context)
869
+ .closest(bwVar.$bigWins)
870
+ .find(bwVar.ccBtn)
871
+ .attr('disabled', 'disabled');
872
+ $(context)
873
+ .closest(bwVar.$bigWins)
874
+ .find(bwVar.ccBtn)
875
+ .find('.btn__text')
876
+ .text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
877
+ } else {
878
+ if (
879
+ $(context)
880
+ .closest(bwVar.$bigWins)
881
+ .find('#isCnCForProductAndStoreDisabled')
882
+ .val() === 'true'
883
+ ) {
884
+ $(context)
885
+ .closest(bwVar.$bigWins)
886
+ .find('.chosen__nearest')
887
+ .find('.stock__valid')
888
+ .addClass('stock__valid_show');
889
+ $(context)
890
+ .closest(bwVar.$bigWins)
891
+ .find(bwVar.ccBtn)
892
+ .attr('disabled', 'disabled');
893
+ $(context)
894
+ .closest(bwVar.$bigWins)
895
+ .find(bwVar.ccBtn)
896
+ .find('.btn__text')
897
+ .text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
898
+ } else {
899
+ $(context)
900
+ .closest(bwVar.$bigWins)
901
+ .find('.chosen__nearest')
902
+ .find('.stock__valid')
903
+ .removeClass('stock__valid_show');
904
+ if ($(context).closest(bwVar.$bigWins).find(bwVar.ccBtn).attr('disabled')) {
905
+ $(context)
906
+ .closest(bwVar.$bigWins)
907
+ .find(bwVar.ccBtn)
908
+ .removeAttr('disabled');
909
+ $(context)
910
+ .closest(bwVar.$bigWins)
911
+ .find(bwVar.ccBtn)
912
+ .find('.btn__text')
913
+ .text(bwVar.CLICK_AND_COLLECT);
914
+ }
915
+ }
916
+ }
917
+ } else {
918
+ $(context)
919
+ .closest(bwVar.$bigWins)
920
+ .find(bwVar.$stockPostcodeEl)
921
+ .addClass(bwVar.stockPostcodeInvalid);
922
+ }
905
923
  }
906
- }
907
- })();
908
924
 
909
- (function getCorrectIdToCheckbox() {
910
- bwVar.$stockQuestions.each(function (index) {
911
- $(this).find("label[for='stock-only']").attr('for', 'stock-only' + index);
912
- $(this).find("label[for='cc-only']").attr('for', 'cc-only' + index);
925
+ function closeMoreStorestModal(e, context) {
926
+ e.preventDefault();
927
+ //close more block
928
+ $(context).closest(bwVar.$bigWins).find(bwVar.$stock).removeClass(bwVar.stockMore);
929
+
930
+ if ($(window).width() < 767) {
931
+ $(context).closest(bwVar.$bigWins).find(bwVar.$stock).removeClass(bwVar.stockBot);
932
+ $(context).closest(bwVar.$bigWins).removeClass(bwVar.bwMinHeight);
933
+ } else {
934
+ setTimeout(function () {
935
+ $(context)
936
+ .closest(bwVar.$bigWins)
937
+ .find(bwVar.$stock)
938
+ .removeClass(bwVar.stockBot);
939
+ $(context).closest(bwVar.$bigWins).removeClass(bwVar.bwMinHeight);
940
+ }, 600);
941
+ }
913
942
 
914
- $(this).find('#stock-only').attr('id', 'stock-only' + index);
915
- $(this).find('#cc-only').attr('id', 'cc-only' + index);
943
+ //bind nearestStore event
944
+ $(context).closest(bwVar.$bigWins).find(bwVar.$stockFindBtn).unbind();
945
+ $(context)
946
+ .closest(bwVar.$bigWins)
947
+ .find(bwVar.$stockFindBtn)
948
+ .on('click', showSearchResultNearest);
949
+
950
+ //toggle tabs to nearest
951
+ $(context).closest(bwVar.$bigWins).find(bwVar.$stock).removeClass(bwVar.stockMore);
952
+ $(context).closest(bwVar.$bigWins).find(bwVar.$stockTab).removeClass(bwVar.active);
953
+ $(context).closest(bwVar.$bigWins).find(bwVar.$stockTab).first().addClass(bwVar.active);
954
+
955
+ $(context)
956
+ .closest(bwVar.$bigWins)
957
+ .find(bwVar.$stockResult)
958
+ .addClass(bwVar.stockResultHide);
959
+ $(context)
960
+ .closest(bwVar.$bigWins)
961
+ .find(bwVar.$stockTabs)
962
+ .removeClass(bwVar.stockTabsHide);
963
+ $(context)
964
+ .closest(bwVar.$bigWins)
965
+ .find(bwVar.$stockFind)
966
+ .removeClass(bwVar.stockFindHide);
967
+
968
+ bwVar.$body.removeClass(bwVar.scrollDisable);
969
+
970
+ scrollToBlockMobile(context);
971
+ }
916
972
 
917
- });
973
+ function closeStoreDetails(context) {
974
+ bwVar.$storeMoreLink.text('Store Info');
975
+ //hide pseudoclass
976
+ $(context)
977
+ .closest(bwVar.$bigWins)
978
+ .find(bwVar.$stock)
979
+ .removeClass(bwVar.stockDetailsOpen);
980
+ $(context).closest(bwVar.$bigWins).find(bwVar.$sDetails).addClass(bwVar.sDetailsHide);
981
+ bwVar.$pdpPrice.removeClass(bwVar.pdpPriceBW);
982
+ bwVar.$tiTotal.removeClass(bwVar.tiTotalBW);
983
+ bwVar.$body.removeClass(bwVar.scrollDisable);
984
+
985
+ scrollToBlockMobile(context);
986
+ }
918
987
 
919
- bwVar.$stockRadio.each(function (index) {
920
- var currentName = $(this).attr('for');
921
- $(this).attr('for', currentName + index);
922
- $(this).find('input').attr('id', currentName + index);
988
+ function showSearchResultMoreProto(context) {
989
+ if (
990
+ $(context)
991
+ .closest(bwVar.$bigWins)
992
+ .find('.stock__tab.active')
993
+ .attr('data-stores') === 'more'
994
+ ) {
995
+ var postcodeLength;
996
+
997
+ if (
998
+ $(context)
999
+ .closest(bwVar.$bigWins)
1000
+ .find(bwVar.$bwChosen)
1001
+ .hasClass(bwVar.protoOnlyPopulated)
1002
+ ) {
1003
+ postcodeLength = $(context)
1004
+ .closest(bwVar.$bigWins)
1005
+ .find(bwVar.$protoOnlyPopulated)
1006
+ .find(bwVar.storeName)
1007
+ .text().length;
1008
+ } else {
1009
+ postcodeLength = $(context)
1010
+ .closest(bwVar.$bigWins)
1011
+ .find(bwVar.$stockPostcode)
1012
+ .val().length;
1013
+ }
1014
+
1015
+ if (postcodeLength >= 5) {
1016
+ if (
1017
+ $(context)
1018
+ .closest(bwVar.$bigWins)
1019
+ .find(bwVar.$stockTabs)
1020
+ .hasClass(bwVar.moreStoresPresent || bwVar.defStoresPresent)
1021
+ ) {
1022
+ $(context)
1023
+ .closest(bwVar.$bigWins)
1024
+ .find(bwVar.$stockResult)
1025
+ .removeClass(bwVar.stockResultHide);
1026
+ }
1027
+ }
1028
+ }
1029
+ }
923
1030
 
924
- })
1031
+ function iosCopyToClipboard($input) {
1032
+ var el = $input.get(0);
1033
+ var editable = el.contentEditable;
1034
+ var readOnly = el.readOnly;
1035
+
1036
+ el.contentEditable = true;
1037
+ el.readOnly = false;
1038
+ var range = document.createRange();
1039
+ range.selectNodeContents(el);
1040
+ var sel = window.getSelection();
1041
+ sel.removeAllRanges();
1042
+ sel.addRange(range);
1043
+ el.setSelectionRange(0, 999999);
1044
+ el.contentEditable = editable;
1045
+ el.readOnly = readOnly;
1046
+ }
925
1047
 
926
- })()
927
- }
1048
+ function scrollToBlockMobile(context) {
1049
+ if ($(window).width() < 767) {
1050
+ if ($(context).closest(bwVar.$tiTotal).length) {
1051
+ window.scroll(0, bwVar.$tiTotal.offset().top - 60);
1052
+ } else if ($(context).closest(bwVar.$pdpPrice).length) {
1053
+ window.scroll(0, bwVar.$bigWins.offset().top - 60);
1054
+ }
1055
+ }
1056
+ }
928
1057
 
929
- if (!bwVar.$bigWins.length) {
930
- return;
931
- }
1058
+ (function checkStoreProductsNearest() {
1059
+ var value = $('.chosen__item').find('.store__stock_val').text();
1060
+ if (value.match(/^out$/)) {
1061
+ $('.chosen').find('.stock__valid').addClass('stock__valid_show');
1062
+ $(bwVar.ccBtn).attr('disabled', 'disabled');
1063
+ $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
1064
+ } else {
1065
+ if ($('#isCnCForProductAndStoreDisabled').val() === 'true') {
1066
+ $('.chosen__nearest').find('.stock__valid').addClass('stock__valid_show');
1067
+ $(bwVar.ccBtn).attr('disabled', 'disabled');
1068
+ $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT_NOT_AVAILABLE);
1069
+ } else {
1070
+ $('.chosen__nearest').find('.stock__valid').removeClass('stock__valid_show');
1071
+ if ($(bwVar.ccBtn).attr('disabled')) {
1072
+ $(bwVar.ccBtn).removeAttr('disabled');
1073
+ $(bwVar.ccBtn).find('.btn__text').text(bwVar.CLICK_AND_COLLECT);
1074
+ }
1075
+ }
1076
+ }
1077
+ })();
1078
+
1079
+ (function getCorrectIdToCheckbox() {
1080
+ bwVar.$stockQuestions.each(function (index) {
1081
+ $(this)
1082
+ .find("label[for='stock-only']")
1083
+ .attr('for', 'stock-only' + index);
1084
+ $(this)
1085
+ .find("label[for='cc-only']")
1086
+ .attr('for', 'cc-only' + index);
1087
+
1088
+ $(this)
1089
+ .find('#stock-only')
1090
+ .attr('id', 'stock-only' + index);
1091
+ $(this)
1092
+ .find('#cc-only')
1093
+ .attr('id', 'cc-only' + index);
1094
+ });
1095
+
1096
+ bwVar.$stockRadio.each(function (index) {
1097
+ var currentName = $(this).attr('for');
1098
+ $(this).attr('for', currentName + index);
1099
+ $(this)
1100
+ .find('input')
1101
+ .attr('id', currentName + index);
1102
+ });
1103
+ })();
1104
+ }
932
1105
 
933
- init();
934
- }();
1106
+ if (!bwVar.$bigWins.length) {
1107
+ return;
1108
+ }
935
1109
 
1110
+ init();
1111
+ })();