wickes-css2 2.103.0-IC-976-pre-commit-lint.4 → 2.103.0-IC-976-pre-commit-lint.7

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 (694) hide show
  1. package/build/css/category-main.css +1 -1
  2. package/build/css/homepage-main.css +1 -1
  3. package/build/css/kitchen-plp-main.css +1 -1
  4. package/build/css/main.css +1 -1
  5. package/build/css/my-account-main-v2.css +1 -1
  6. package/build/css/my-account-main.css +1 -1
  7. package/build/css/pages/page_book-consultant-thank-you-new.css +1 -1
  8. package/build/css/pages/page_my-orders.css +1 -1
  9. package/build/css/pages/page_pre_home_thank-you.css +1 -1
  10. package/build/css/pages/page_top-rated.css +1 -1
  11. package/build/css/pdp-main-before-combine.css +1 -1
  12. package/build/css/pdp-main-non-critical.css +1 -1
  13. package/build/css/pdp-main.css +1 -1
  14. package/build/css/plp-main.css +1 -1
  15. package/build/css/store-locator-main.css +1 -1
  16. package/build/img/TradePaint.svg +14 -42
  17. package/build/img/apple-pay.svg +7 -12
  18. package/build/img/big-white-apple-pay.svg +5 -10
  19. package/build/img/billie-logo.svg +2 -4
  20. package/build/img/billie-modal.svg +2 -4
  21. package/build/img/billie-pdp.svg +9 -12
  22. package/build/img/billie-spinner.svg +3 -5
  23. package/build/img/billie.svg +1 -3
  24. package/build/img/clearpay-logo.svg +1 -6
  25. package/build/img/clearpay-spinner.svg +1 -4
  26. package/build/img/energy-efficiency/energy-marker.svg +1 -12
  27. package/build/img/google-spinner.svg +7 -14
  28. package/build/img/googlepay.svg +12 -23
  29. package/build/img/home-banner_arrow.svg +1 -7
  30. package/build/img/ic-menu.svg +1 -7
  31. package/build/img/ic_info_big.svg +1 -4
  32. package/build/img/klarna-big.svg +9 -18
  33. package/build/img/klarna-sm.svg +2 -5
  34. package/build/img/klarna-spinner.svg +1 -3
  35. package/build/img/logo-klarna.svg +2 -5
  36. package/build/img/mastercard.svg +3 -6
  37. package/build/img/payapal_text.svg +1 -6
  38. package/build/img/payment/checkout/applepay.svg +7 -12
  39. package/build/img/payment/checkout/billie.svg +2 -4
  40. package/build/img/payment/checkout/clearpay.svg +1 -5
  41. package/build/img/payment/checkout/googlepay.svg +12 -23
  42. package/build/img/payment/checkout/mastercard.svg +1 -13
  43. package/build/img/payment/checkout/paypal.svg +1 -37
  44. package/build/img/payment/checkout/visa.svg +1 -8
  45. package/build/img/payment/footer/applepay.svg +7 -12
  46. package/build/img/payment/footer/billie.svg +1 -3
  47. package/build/img/payment/footer/clearpay.svg +10 -18
  48. package/build/img/payment/footer/googlepay.svg +12 -23
  49. package/build/img/payment/footer/mastercard.svg +1 -13
  50. package/build/img/payment/footer/paypal.svg +1 -37
  51. package/build/img/payment/footer/visa.svg +1 -8
  52. package/build/img/paypal.svg +1 -8
  53. package/build/img/paypal_logo_loader_paypal.svg +1 -4
  54. package/build/img/paypal_logo_loader_pp.svg +1 -10
  55. package/build/img/placeholders/full-width-img.svg +1 -9
  56. package/build/img/placeholders/img-2-to-1.svg +1 -9
  57. package/build/img/placeholders/img-3-to-4.svg +1 -9
  58. package/build/img/placeholders/img-4-to-3.svg +1 -9
  59. package/build/img/proposition_arrow_click.svg +1 -7
  60. package/build/img/proposition_delivery.svg +1 -7
  61. package/build/img/proposition_price.svg +1 -7
  62. package/build/img/proposition_returns.svg +1 -7
  63. package/build/img/social-icon-facebook.svg +1 -8
  64. package/build/img/social-icon-instagram.svg +1 -15
  65. package/build/img/social-icon-pinterest.svg +1 -7
  66. package/build/img/socials/facebook.svg +1 -5
  67. package/build/img/socials/instagram.svg +1 -5
  68. package/build/img/socials/pinterest.svg +1 -5
  69. package/build/img/socials/tiktok.svg +1 -5
  70. package/build/img/socials/x-twitter.svg +1 -5
  71. package/build/img/socials/youtube.svg +1 -5
  72. package/build/img/socials_facebook_color.svg +1 -7
  73. package/build/img/socials_facebook_white_blue_color.svg +1 -5
  74. package/build/img/socials_info_big.svg +1 -7
  75. package/build/img/socials_instagram_color.svg +1 -16
  76. package/build/img/socials_pinterest_color.svg +1 -4
  77. package/build/img/socials_twitter_color.svg +1 -4
  78. package/build/img/socials_whatsapp_color.svg +1 -5
  79. package/build/img/socials_youtube_color.svg +1 -4
  80. package/build/img/stars.svg +1 -8
  81. package/build/img/visa-logo.svg +1 -3
  82. package/build/img/wickes-dc-logo.svg +13 -17
  83. package/build/img/wickes-logo-v2.svg +1 -15
  84. package/build/img/wickes-logo.svg +1 -36
  85. package/build/img/young-minds.svg +8 -10
  86. package/build/js/account-members.min.js +1 -1
  87. package/build/js/basket.min.js +2 -2
  88. package/build/js/bootstrap.bundle.min.js +1 -1
  89. package/build/js/bundle.min.js +1 -1
  90. package/build/js/checkout.min.js +2 -2
  91. package/build/js/emulation.min.js +10325 -11858
  92. package/build/js/general.bundle.min.js +1 -1
  93. package/build/js/iframeResizer.min.js +2 -2
  94. package/build/js/kitchen/kitchen-plp.min.js +1 -1
  95. package/build/js/merged-checkout.min.js +2 -2
  96. package/build/js/my-orders.min.js +1 -1
  97. package/build/js/page/accordion.js +29 -31
  98. package/build/js/page/account-deletion.js +13 -13
  99. package/build/js/page/account-hub.js +119 -128
  100. package/build/js/page/account-members.js +216 -229
  101. package/build/js/page/address-book.js +184 -186
  102. package/build/js/page/basket/add-project-list-id.js +130 -158
  103. package/build/js/page/basket/clearpay.js +17 -17
  104. package/build/js/page/basket/display-energy-efficiency.js +13 -13
  105. package/build/js/page/basket/gtm.js +54 -60
  106. package/build/js/page/basket/klarna.js +2 -2
  107. package/build/js/page/basket/paypal.js +33 -33
  108. package/build/js/page/basket/session-sync.js +5 -5
  109. package/build/js/page/basket/summary-mobile.js +16 -16
  110. package/build/js/page/basket/wisdom.js +39 -54
  111. package/build/js/page/basket-v2.js +261 -415
  112. package/build/js/page/basket.js +39 -42
  113. package/build/js/page/billie-business-type.js +22 -22
  114. package/build/js/page/business-account-form.js +12 -12
  115. package/build/js/page/business-pages.js +13 -0
  116. package/build/js/page/buying-guides-guttering.js +3 -3
  117. package/build/js/page/category-landing.js +11 -18
  118. package/build/js/page/change-password.js +99 -100
  119. package/build/js/page/checkout-confirmation-new.js +70 -127
  120. package/build/js/page/checkout-confirmation.js +6 -6
  121. package/build/js/page/checkout-delivery-address.js +32 -35
  122. package/build/js/page/checkout-delivery-details-loader.js +5 -2
  123. package/build/js/page/checkout-edit-address.js +1 -1
  124. package/build/js/page/checkout-payment-details.js +172 -170
  125. package/build/js/page/checkout-sign-in.js +11 -15
  126. package/build/js/page/checkout.js +1 -1
  127. package/build/js/page/cms-homepage.js +45 -87
  128. package/build/js/page/components/charity.js +120 -114
  129. package/build/js/page/components/csrf.js +4 -4
  130. package/build/js/page/components/discounts.js +39 -39
  131. package/build/js/page/components/favourite-product.js +113 -125
  132. package/build/js/page/components/global-search.js +192 -204
  133. package/build/js/page/components/modal-observer.js +46 -43
  134. package/build/js/page/components/order-summary.js +22 -26
  135. package/build/js/page/components/pagination.js +117 -124
  136. package/build/js/page/components/retry-action.js +2 -2
  137. package/build/js/page/components/saving-shopping-list.js +314 -381
  138. package/build/js/page/components/sticky-order-observer.js +39 -36
  139. package/build/js/page/components/voucher.js +47 -46
  140. package/build/js/page/copy-project-id.js +23 -23
  141. package/build/js/page/countdown-timer.js +6 -6
  142. package/build/js/page/default-store.js +34 -40
  143. package/build/js/page/design-appointment.js +3 -6
  144. package/build/js/page/energy-efficiency.js +25 -39
  145. package/build/js/page/finance-tabs.js +4 -4
  146. package/build/js/page/general/cookie.js +10 -20
  147. package/build/js/page/installation/calculator.js +16 -12
  148. package/build/js/page/installation/fi.js +71 -76
  149. package/build/js/page/installation/generic.js +20 -21
  150. package/build/js/page/installation/installation.js +22 -36
  151. package/build/js/page/installation/pdp-generic.js +9 -3
  152. package/build/js/page/installation/ti.js +24 -26
  153. package/build/js/page/installer-files-form.js +76 -98
  154. package/build/js/page/installer-form.js +447 -502
  155. package/build/js/page/installer-validation.js +761 -848
  156. package/build/js/page/instore-checkout.js +2 -2
  157. package/build/js/page/kitchen/card-carousel.js +21 -21
  158. package/build/js/page/kitchen/colour-swatches.js +149 -153
  159. package/build/js/page/kitchen/kitchen-card.js +64 -62
  160. package/build/js/page/kitchen/mobile-nav.js +27 -26
  161. package/build/js/page/kitchen/plp-filters-chips.js +70 -72
  162. package/build/js/page/kitchen/plp-filters-mobile.js +60 -64
  163. package/build/js/page/kitchen/plp-filters-panel.js +102 -106
  164. package/build/js/page/kitchen/plp-filters-utils.js +53 -54
  165. package/build/js/page/kitchen/plp-filters.js +194 -210
  166. package/build/js/page/kitchen/sort-by.js +149 -149
  167. package/build/js/page/klarna-modal-scroll-disable.js +4 -4
  168. package/build/js/page/merged-checkout.js +3 -6
  169. package/build/js/page/my-account.js +46 -44
  170. package/build/js/page/my-orders.js +149 -153
  171. package/build/js/page/online-exclusive.js +31 -28
  172. package/build/js/page/pdp-favourite.js +4 -4
  173. package/build/js/page/pdp-tile.js +4 -0
  174. package/build/js/page/pdp.js +37 -41
  175. package/build/js/page/personal-details.js +277 -307
  176. package/build/js/page/plp-cards-v2.js +25 -39
  177. package/build/js/page/plp-favourite.js +9 -9
  178. package/build/js/page/plp-img-v2.js +3 -2
  179. package/build/js/page/plp-load-more.js +66 -66
  180. package/build/js/page/plp.js +10 -9
  181. package/build/js/page/pre-home.js +144 -159
  182. package/build/js/page/project-list/generate-project-id.js +68 -77
  183. package/build/js/page/project-list-note.js +232 -234
  184. package/build/js/page/project-list.js +3 -2
  185. package/build/js/page/quiz.js +292 -292
  186. package/build/js/page/select-address.js +14 -27
  187. package/build/js/page/smart-banner.js +5 -8
  188. package/build/js/page/ti.js +42 -67
  189. package/build/js/page/top-rated.js +29 -36
  190. package/build/js/page/track-my-order.js +156 -172
  191. package/build/js/page/tradePro-rewards.js +36 -34
  192. package/build/js/page/utils/array-utils.js +10 -13
  193. package/build/js/page/utils/copy-to-clipboard.js +45 -45
  194. package/build/js/page/utils/create-event.js +8 -8
  195. package/build/js/page/utils/errorMesages.js +11 -12
  196. package/build/js/page/utils/helpers.js +9 -14
  197. package/build/js/page/utils/http-action.js +5 -4
  198. package/build/js/page/utils/loader.js +5 -5
  199. package/build/js/page/utils/routes.js +9 -9
  200. package/build/js/page/utils/url-query.js +4 -4
  201. package/build/js/page/utils/validation.js +96 -93
  202. package/build/js/page/wickes-dc.js +44 -51
  203. package/build/js/page/wismo.js +12 -12
  204. package/build/js/page/your-details.js +41 -77
  205. package/build/js/pdp-favourite-product.bundle.min.js +1 -1
  206. package/build/js/pdp.bundle.min.js +1 -1
  207. package/build/js/personal-details.min.js +1 -1
  208. package/build/js/plp-favourite-product.bundle.min.js +1 -1
  209. package/build/js/plp.bundle.min.js +1 -1
  210. package/build/js/project-list.min.js +16 -16
  211. package/build/js/pstrength.min.js +34 -28
  212. package/build/js/wickers.json +2069 -2069
  213. package/package.json +3 -8
  214. package/src/data/data_account-families.json +1 -1
  215. package/src/data/data_bathroom-installation.json +1 -1
  216. package/src/data/data_bathroom-ranges.json +14 -14
  217. package/src/data/data_business-pages.json +27 -27
  218. package/src/data/data_calendar.json +1 -7
  219. package/src/data/data_checkout-order.json +306 -306
  220. package/src/data/data_contact-us-form.json +17 -17
  221. package/src/data/data_contact-us-reasons.json +16 -16
  222. package/src/data/data_design-appointment.json +12 -27
  223. package/src/data/data_discounts.json +4 -4
  224. package/src/data/data_fdl-new-product.json +6 -6
  225. package/src/data/data_fdl-product.json +87 -75
  226. package/src/data/data_flooring-installation.json +6 -6
  227. package/src/data/data_great-quality.json +2 -2
  228. package/src/data/data_heating-plumbing.json +2 -2
  229. package/src/data/data_how-to_fit-corrugated-sheeting.json +258 -245
  230. package/src/data/data_journey-price-lists.json +1 -1
  231. package/src/data/data_kb-brouchure-requests.json +10 -10
  232. package/src/data/data_kitchen-brochure-request.json +1 -1
  233. package/src/data/data_kitchen-cabinets.json +1 -1
  234. package/src/data/data_kitchen-plp.json +18 -24
  235. package/src/data/data_kitchen-ranges.json +23 -21
  236. package/src/data/data_latest-offers.json +1044 -1044
  237. package/src/data/data_locators.json +132 -130
  238. package/src/data/data_next-steps.json +20 -20
  239. package/src/data/data_notification-page.json +24 -72
  240. package/src/data/data_online-ranges.json +1 -1
  241. package/src/data/data_page-category-hub.json +1 -1
  242. package/src/data/data_page-confirmation.json +9 -9
  243. package/src/data/data_page-project-multiple-list.json +18 -18
  244. package/src/data/data_pre-home.json +1082 -1090
  245. package/src/data/data_price-event-new.json +1 -1
  246. package/src/data/data_saved-project-list.json +8 -8
  247. package/src/data/data_seo-widgets.json +31 -31
  248. package/src/data/data_shopping-cart-v2.json +2 -1
  249. package/src/data/data_shopping-cart-with-energy.json +229 -229
  250. package/src/data/data_storage-solutions.json +99 -99
  251. package/src/data/data_tile-installation.json +1 -1
  252. package/src/data/data_top-rated-perfect-product.json +204 -204
  253. package/src/data/data_trade-essentials.json +1 -1
  254. package/src/data/data_tradePro_cards.json +1 -0
  255. package/src/data/data_user-address-saved.json +33 -33
  256. package/src/data/data_voucher_tradePro.json +5 -5
  257. package/src/data/data_wismo.json +12 -12
  258. package/src/data/how-to-guides/data-how_to_fit-bath-and-taps.json +2 -2
  259. package/src/data/how-to-guides/data_how-to-change-door-window-furniture.json +274 -274
  260. package/src/data/how-to-guides/data_how-to-fit-door-locks.json +8 -3
  261. package/src/data/how-to-guides/data_how-to-fit-worktop.json +13 -5
  262. package/src/data/how-to-guides/data_how-to-fit_basin-and-taps.json +6 -2
  263. package/src/data/how-to-guides/data_how-to-fit_bath-and-taps.json +10 -3
  264. package/src/data/how-to-guides/data_how-to-plumb-a-kitchen-appliance.json +7 -3
  265. package/src/data/how-to-guides/data_how-to-unblock-sink.json +7 -5
  266. package/src/data/how-to-guides/data_how-to_bleed-radiator.json +134 -134
  267. package/src/data/how-to-guides/data_how-to_build-raised-deck.json +4 -4
  268. package/src/data/how-to-guides/data_how-to_change-socket.json +2 -2
  269. package/src/data/how-to-guides/data_how-to_fit-guttering.json +282 -282
  270. package/src/data/how-to-guides/data_how-to_fit-toilet.json +2 -2
  271. package/src/data/how-to-guides/data_how-to_fit-wall-tiles.json +23 -77
  272. package/src/data/how-to-guides/data_how-to_fit-worktops.json +4 -3
  273. package/src/data/how-to-guides/data_how-to_fix-leaking-sink.json +3 -3
  274. package/src/data/how-to-guides/data_how-to_fix-leaking-tap.json +3 -3
  275. package/src/data/how-to-guides/data_how-to_garden-calendar.json +5 -4
  276. package/src/data/how-to-guides/data_how-to_grow-fruit-veg.json +3 -3
  277. package/src/data/how-to-guides/data_how-to_hang-internal-door.json +266 -266
  278. package/src/data/how-to-guides/data_how-to_install-artificial-grass.json +4 -3
  279. package/src/data/how-to-guides/data_how-to_install-base-wall-cabinets.json +4 -3
  280. package/src/data/how-to-guides/data_how-to_install-composite-decking.json +14 -6
  281. package/src/data/how-to-guides/data_how-to_install-deck-lighting.json +7 -4
  282. package/src/data/how-to-guides/data_how-to_install-fence.json +5 -5
  283. package/src/data/how-to-guides/data_how-to_insulate-loft.json +2 -2
  284. package/src/data/how-to-guides/data_how-to_lay-deck.json +6 -4
  285. package/src/data/how-to-guides/data_how-to_lay-laminate-flooring.json +8 -3
  286. package/src/data/how-to-guides/data_how-to_lay-maintain-turf.json +4 -4
  287. package/src/data/how-to-guides/data_how-to_lay-path.json +6 -5
  288. package/src/data/how-to-guides/data_how-to_lay-patio.json +5 -5
  289. package/src/data/how-to-guides/data_how-to_lay-solid-wood-flooring.json +8 -0
  290. package/src/data/how-to-guides/data_how-to_lay-vinyl-carpet-tiles.json +3 -3
  291. package/src/data/how-to-guides/data_how-to_paint-a-room.json +5 -5
  292. package/src/data/how-to-guides/data_how-to_plaster-wall.json +6 -8
  293. package/src/data/how-to-guides/data_how-to_plumb-kitchen-appliances.json +3 -3
  294. package/src/data/how-to-guides/data_how-to_prepare-interior-woodwork.json +5 -5
  295. package/src/data/how-to-guides/data_how-to_prepare-paint-exterior-walls.json +1 -1
  296. package/src/data/how-to-guides/data_how-to_prepare-wall-and-ceilings.json +9 -9
  297. package/src/data/how-to-guides/data_how-to_put_up_shelf.json +4 -4
  298. package/src/data/how-to-guides/data_how-to_remove-replace-tiles.json +3 -3
  299. package/src/data/how-to-guides/data_how-to_repair-wall.json +385 -384
  300. package/src/data/how-to-guides/data_how-to_tile-bathroom.json +4 -3
  301. package/src/data/how-to-guides/data_how-to_unblock-sink.json +3 -3
  302. package/src/data/how-to-guides/data_install-composite-decking.json +4 -4
  303. package/src/data/how-to-guides/data_planting-techniques.json +3 -3
  304. package/src/data/how-to-guides/fit-roofing-shingles.json +4 -4
  305. package/src/data/how-to-guides/hubs/data_how-to_hub_home.json +1 -1
  306. package/src/data/my-account/data_address-book.json +3 -12
  307. package/src/data/my-account/data_my-order.json +1 -1
  308. package/src/data/my-account/data_personal-details.json +8 -32
  309. package/src/data/navigation.json +805 -1016
  310. package/src/data/page_how-to-choose-your-doors.json +2 -1
  311. package/src/data/public/wickers.json +2069 -2069
  312. package/src/img/TradePaint.svg +14 -42
  313. package/src/img/apple-pay.svg +7 -12
  314. package/src/img/big-white-apple-pay.svg +5 -10
  315. package/src/img/billie-logo.svg +2 -4
  316. package/src/img/billie-modal.svg +2 -4
  317. package/src/img/billie-pdp.svg +9 -12
  318. package/src/img/billie-spinner.svg +3 -5
  319. package/src/img/billie.svg +1 -3
  320. package/src/img/clearpay-logo.svg +1 -6
  321. package/src/img/clearpay-spinner.svg +1 -4
  322. package/src/img/energy-efficiency/energy-marker.svg +1 -12
  323. package/src/img/google-spinner.svg +7 -14
  324. package/src/img/googlepay.svg +12 -23
  325. package/src/img/home-banner_arrow.svg +1 -7
  326. package/src/img/ic-menu.svg +1 -7
  327. package/src/img/ic_info_big.svg +1 -4
  328. package/src/img/klarna-big.svg +9 -18
  329. package/src/img/klarna-sm.svg +2 -5
  330. package/src/img/klarna-spinner.svg +1 -3
  331. package/src/img/logo-klarna.svg +2 -5
  332. package/src/img/mastercard.svg +3 -6
  333. package/src/img/payapal_text.svg +1 -6
  334. package/src/img/payment/checkout/applepay.svg +7 -12
  335. package/src/img/payment/checkout/billie.svg +2 -4
  336. package/src/img/payment/checkout/clearpay.svg +1 -5
  337. package/src/img/payment/checkout/googlepay.svg +12 -23
  338. package/src/img/payment/checkout/mastercard.svg +1 -13
  339. package/src/img/payment/checkout/paypal.svg +1 -37
  340. package/src/img/payment/checkout/visa.svg +1 -8
  341. package/src/img/payment/footer/applepay.svg +7 -12
  342. package/src/img/payment/footer/billie.svg +1 -3
  343. package/src/img/payment/footer/clearpay.svg +10 -18
  344. package/src/img/payment/footer/googlepay.svg +12 -23
  345. package/src/img/payment/footer/mastercard.svg +1 -13
  346. package/src/img/payment/footer/paypal.svg +1 -37
  347. package/src/img/payment/footer/visa.svg +1 -8
  348. package/src/img/paypal.svg +1 -8
  349. package/src/img/paypal_logo_loader_paypal.svg +1 -4
  350. package/src/img/paypal_logo_loader_pp.svg +1 -10
  351. package/src/img/placeholders/full-width-img.svg +1 -9
  352. package/src/img/placeholders/img-2-to-1.svg +1 -9
  353. package/src/img/placeholders/img-3-to-4.svg +1 -9
  354. package/src/img/placeholders/img-4-to-3.svg +1 -9
  355. package/src/img/proposition_arrow_click.svg +1 -7
  356. package/src/img/proposition_delivery.svg +1 -7
  357. package/src/img/proposition_price.svg +1 -7
  358. package/src/img/proposition_returns.svg +1 -7
  359. package/src/img/social-icon-facebook.svg +1 -8
  360. package/src/img/social-icon-instagram.svg +1 -15
  361. package/src/img/social-icon-pinterest.svg +1 -7
  362. package/src/img/socials/facebook.svg +1 -5
  363. package/src/img/socials/instagram.svg +1 -5
  364. package/src/img/socials/pinterest.svg +1 -5
  365. package/src/img/socials/tiktok.svg +1 -5
  366. package/src/img/socials/x-twitter.svg +1 -5
  367. package/src/img/socials/youtube.svg +1 -5
  368. package/src/img/socials_facebook_color.svg +1 -7
  369. package/src/img/socials_facebook_white_blue_color.svg +1 -5
  370. package/src/img/socials_info_big.svg +1 -7
  371. package/src/img/socials_instagram_color.svg +1 -16
  372. package/src/img/socials_pinterest_color.svg +1 -4
  373. package/src/img/socials_twitter_color.svg +1 -4
  374. package/src/img/socials_whatsapp_color.svg +1 -5
  375. package/src/img/socials_youtube_color.svg +1 -4
  376. package/src/img/stars.svg +1 -8
  377. package/src/img/visa-logo.svg +1 -3
  378. package/src/img/wickes-dc-logo.svg +13 -17
  379. package/src/img/wickes-logo-v2.svg +1 -15
  380. package/src/img/wickes-logo.svg +1 -36
  381. package/src/img/young-minds.svg +8 -10
  382. package/src/js/components/anchors-scroll.js +6 -9
  383. package/src/js/components/badge-cashback.js +6 -5
  384. package/src/js/components/banner-placement-manager.js +232 -269
  385. package/src/js/components/card-color-slider.js +29 -29
  386. package/src/js/components/card-slider.js +73 -78
  387. package/src/js/components/cards-slider.js +58 -64
  388. package/src/js/components/charity-donations.js +4 -3
  389. package/src/js/components/checkout_your-details.js +67 -68
  390. package/src/js/components/clamp.js +32 -47
  391. package/src/js/components/click-disable.js +7 -7
  392. package/src/js/components/date-selection.js +37 -50
  393. package/src/js/components/file-loader.js +33 -33
  394. package/src/js/components/finance.js +4 -3
  395. package/src/js/components/flatpickr.js +149 -135
  396. package/src/js/components/gallery-pdp.js +98 -97
  397. package/src/js/components/gallery-range.js +109 -107
  398. package/src/js/components/general/accordion.js +29 -31
  399. package/src/js/components/general/back-to-top.js +37 -40
  400. package/src/js/components/general/backdrop.js +15 -15
  401. package/src/js/components/general/cart-slider.js +12 -15
  402. package/src/js/components/general/clamp-content.js +80 -80
  403. package/src/js/components/general/clamp.js +38 -53
  404. package/src/js/components/general/clear-input.js +25 -25
  405. package/src/js/components/general/cookie-chat-back.js +13 -19
  406. package/src/js/components/general/cookies-policy.js +5 -5
  407. package/src/js/components/general/create-popup-slider.js +175 -169
  408. package/src/js/components/general/device-type.js +3 -3
  409. package/src/js/components/general/footer.js +52 -82
  410. package/src/js/components/general/handleAccordion.js +28 -28
  411. package/src/js/components/general/is-trade-pro.js +9 -15
  412. package/src/js/components/general/main-nav.js +8 -8
  413. package/src/js/components/general/main-navigation.js +73 -67
  414. package/src/js/components/general/mini-basket-slider.js +6 -6
  415. package/src/js/components/general/notification.js +40 -58
  416. package/src/js/components/general/offer-banner.js +58 -58
  417. package/src/js/components/general/scroll-disable.js +44 -45
  418. package/src/js/components/general/search-filter.js +16 -16
  419. package/src/js/components/general/search.js +29 -27
  420. package/src/js/components/general/snack-bar.js +11 -20
  421. package/src/js/components/general/sticky_header.js +7 -8
  422. package/src/js/components/general/switchVat.js +154 -154
  423. package/src/js/components/general/text-clamp.js +16 -14
  424. package/src/js/components/general/tooltips.js +2 -2
  425. package/src/js/components/general/validation.js +41 -47
  426. package/src/js/components/leave-event.js +113 -116
  427. package/src/js/components/loader.js +11 -11
  428. package/src/js/components/modal-slider.js +52 -57
  429. package/src/js/components/order-item-cc.js +69 -59
  430. package/src/js/components/pdp-read-more.js +11 -7
  431. package/src/js/components/pdp-video.js +2 -2
  432. package/src/js/components/pwdstrength.js +17 -13
  433. package/src/js/components/range-cards.js +12 -12
  434. package/src/js/components/range-types.js +11 -11
  435. package/src/js/components/scrollbar.js +20 -23
  436. package/src/js/components/share-project-list.js +5 -4
  437. package/src/js/components/show-more-less.js +2 -2
  438. package/src/js/components/similar-slider.js +10 -19
  439. package/src/js/components/sticky-aside.js +83 -84
  440. package/src/js/components/store-locator-facilities.js +15 -17
  441. package/src/js/components/tabs.js +17 -16
  442. package/src/js/components/toggle-password-visibility.js +50 -50
  443. package/src/js/components/tradepro-notification-copy.js +6 -5
  444. package/src/js/components/voucher-remove.js +2 -1
  445. package/src/js/components/wisdom.js +26 -35
  446. package/src/js/components/zoom.js +59 -67
  447. package/src/js/emulation/account-hub.js +40 -40
  448. package/src/js/emulation/account-members.js +36 -37
  449. package/src/js/emulation/add-project-list-id-local.js +18 -24
  450. package/src/js/emulation/add.to.any.customisation.js +38 -44
  451. package/src/js/emulation/autocomplete.js +114 -123
  452. package/src/js/emulation/banner-placement-manager.js +35 -40
  453. package/src/js/emulation/basket-data.js +2037 -2123
  454. package/src/js/emulation/basket.js +57 -58
  455. package/src/js/emulation/big-wins.js +903 -1079
  456. package/src/js/emulation/chat-bot.js +14 -14
  457. package/src/js/emulation/checkLocalEnv.js +4 -4
  458. package/src/js/emulation/checkout-delivery-details.js +25 -28
  459. package/src/js/emulation/checkout-payment-details.js +37 -46
  460. package/src/js/emulation/checkout-sign-in-emulation.js +33 -36
  461. package/src/js/emulation/checkout_your-details.js +46 -47
  462. package/src/js/emulation/click-and-collect-modal.js +20 -18
  463. package/src/js/emulation/cnc-notifications.js +10 -9
  464. package/src/js/emulation/custom-slider-emulation.js +17 -16
  465. package/src/js/emulation/date-selection.js +25 -25
  466. package/src/js/emulation/default-store.js +86 -92
  467. package/src/js/emulation/favourite-product-local.js +29 -31
  468. package/src/js/emulation/find-address.js +42 -41
  469. package/src/js/emulation/footer-date.js +3 -6
  470. package/src/js/emulation/forms.js +308 -352
  471. package/src/js/emulation/generate-project-id-local.js +23 -26
  472. package/src/js/emulation/global-search-local.js +122 -125
  473. package/src/js/emulation/google-maps-store-info.js +29 -25
  474. package/src/js/emulation/home-movers.js +49 -47
  475. package/src/js/emulation/input-file.js +558 -638
  476. package/src/js/emulation/kitchen-plp-data.js +3670 -4528
  477. package/src/js/emulation/loadMore.js +14 -13
  478. package/src/js/emulation/main-nav-data.js +848 -1058
  479. package/src/js/emulation/mini-basket.js +34 -34
  480. package/src/js/emulation/mini-cart.js +11 -12
  481. package/src/js/emulation/mock.js +23 -23
  482. package/src/js/emulation/my-orders-local.js +30 -30
  483. package/src/js/emulation/paymentLoader.js +16 -16
  484. package/src/js/emulation/pdf-file-loader.js +90 -88
  485. package/src/js/emulation/pdp.js +12 -18
  486. package/src/js/emulation/personal-details-local.js +56 -57
  487. package/src/js/emulation/plp-load-more.js +13 -16
  488. package/src/js/emulation/popover-mini-basket.js +238 -244
  489. package/src/js/emulation/project-list-multiple.js +18 -24
  490. package/src/js/emulation/project-list-pdp.js +316 -319
  491. package/src/js/emulation/project-list-print.js +40 -43
  492. package/src/js/emulation/quiz-local.js +11 -11
  493. package/src/js/emulation/reference-field.js +7 -2
  494. package/src/js/emulation/selectable.js +18 -19
  495. package/src/js/emulation/shopping-list.js +17 -19
  496. package/src/js/emulation/sign-up.js +21 -17
  497. package/src/js/emulation/store-locator-list.js +13 -11
  498. package/src/js/emulation/switchCalendar.js +8 -12
  499. package/src/js/emulation/total-amount-loader.js +13 -14
  500. package/src/js/emulation/user.js +32 -32
  501. package/src/js/emulation/vat-toggle.js +1 -1
  502. package/src/js/emulation/wickes-responsive.js +189 -178
  503. package/src/js/emulation/wismo-details.js +30 -22
  504. package/src/js/emulation/your-details.js +22 -34
  505. package/src/js/helpers/jquery.cookiebar.js +192 -270
  506. package/src/js/helpers/responsive.js +69 -69
  507. package/src/js/helpers/safari-back.js +4 -4
  508. package/src/js/libs/bootstrap.bundle.min.js +1 -1
  509. package/src/js/libs/iframeResizer.min.js +2 -2
  510. package/src/js/libs/jquery.pstrength.custom-1.2.0.js +34 -28
  511. package/src/js/libs/simplebar.js +3 -3
  512. package/src/js/page/accordion.js +29 -31
  513. package/src/js/page/account-deletion.js +13 -13
  514. package/src/js/page/account-hub.js +119 -128
  515. package/src/js/page/account-members.js +216 -229
  516. package/src/js/page/address-book.js +184 -186
  517. package/src/js/page/basket/add-project-list-id.js +130 -158
  518. package/src/js/page/basket/clearpay.js +17 -17
  519. package/src/js/page/basket/display-energy-efficiency.js +13 -13
  520. package/src/js/page/basket/gtm.js +54 -60
  521. package/src/js/page/basket/klarna.js +2 -2
  522. package/src/js/page/basket/paypal.js +33 -33
  523. package/src/js/page/basket/session-sync.js +5 -5
  524. package/src/js/page/basket/summary-mobile.js +16 -16
  525. package/src/js/page/basket/wisdom.js +39 -54
  526. package/src/js/page/basket-v2.js +261 -415
  527. package/src/js/page/basket.js +39 -42
  528. package/src/js/page/billie-business-type.js +22 -22
  529. package/src/js/page/business-account-form.js +12 -12
  530. package/src/js/page/business-pages.js +13 -0
  531. package/src/js/page/buying-guides-guttering.js +3 -3
  532. package/src/js/page/category-landing.js +11 -18
  533. package/src/js/page/change-password.js +99 -100
  534. package/src/js/page/checkout-confirmation-new.js +70 -127
  535. package/src/js/page/checkout-confirmation.js +6 -6
  536. package/src/js/page/checkout-delivery-address.js +32 -35
  537. package/src/js/page/checkout-delivery-details-loader.js +5 -2
  538. package/src/js/page/checkout-edit-address.js +1 -1
  539. package/src/js/page/checkout-payment-details.js +172 -170
  540. package/src/js/page/checkout-sign-in.js +11 -15
  541. package/src/js/page/checkout.js +1 -1
  542. package/src/js/page/cms-homepage.js +45 -87
  543. package/src/js/page/components/charity.js +120 -114
  544. package/src/js/page/components/csrf.js +4 -4
  545. package/src/js/page/components/discounts.js +39 -39
  546. package/src/js/page/components/favourite-product.js +113 -125
  547. package/src/js/page/components/global-search.js +192 -204
  548. package/src/js/page/components/modal-observer.js +46 -43
  549. package/src/js/page/components/order-summary.js +22 -26
  550. package/src/js/page/components/pagination.js +117 -124
  551. package/src/js/page/components/retry-action.js +2 -2
  552. package/src/js/page/components/saving-shopping-list.js +314 -381
  553. package/src/js/page/components/sticky-order-observer.js +39 -36
  554. package/src/js/page/components/voucher.js +47 -46
  555. package/src/js/page/copy-project-id.js +23 -23
  556. package/src/js/page/countdown-timer.js +6 -6
  557. package/src/js/page/default-store.js +34 -40
  558. package/src/js/page/design-appointment.js +3 -6
  559. package/src/js/page/energy-efficiency.js +25 -39
  560. package/src/js/page/finance-tabs.js +4 -4
  561. package/src/js/page/general/cookie.js +10 -20
  562. package/src/js/page/installation/calculator.js +16 -12
  563. package/src/js/page/installation/fi.js +71 -76
  564. package/src/js/page/installation/generic.js +20 -21
  565. package/src/js/page/installation/installation.js +22 -36
  566. package/src/js/page/installation/pdp-generic.js +9 -3
  567. package/src/js/page/installation/ti.js +24 -26
  568. package/src/js/page/installer-files-form.js +76 -98
  569. package/src/js/page/installer-form.js +447 -502
  570. package/src/js/page/installer-validation.js +761 -848
  571. package/src/js/page/instore-checkout.js +2 -2
  572. package/src/js/page/kitchen/card-carousel.js +21 -21
  573. package/src/js/page/kitchen/colour-swatches.js +149 -153
  574. package/src/js/page/kitchen/kitchen-card.js +64 -62
  575. package/src/js/page/kitchen/mobile-nav.js +27 -26
  576. package/src/js/page/kitchen/plp-filters-chips.js +70 -72
  577. package/src/js/page/kitchen/plp-filters-mobile.js +60 -64
  578. package/src/js/page/kitchen/plp-filters-panel.js +102 -106
  579. package/src/js/page/kitchen/plp-filters-utils.js +53 -54
  580. package/src/js/page/kitchen/plp-filters.js +194 -210
  581. package/src/js/page/kitchen/sort-by.js +149 -149
  582. package/src/js/page/klarna-modal-scroll-disable.js +4 -4
  583. package/src/js/page/merged-checkout.js +3 -6
  584. package/src/js/page/my-account.js +46 -44
  585. package/src/js/page/my-orders.js +149 -153
  586. package/src/js/page/online-exclusive.js +31 -28
  587. package/src/js/page/pdp-favourite.js +4 -4
  588. package/src/js/page/pdp-tile.js +4 -0
  589. package/src/js/page/pdp.js +37 -41
  590. package/src/js/page/personal-details.js +277 -307
  591. package/src/js/page/plp-cards-v2.js +25 -39
  592. package/src/js/page/plp-favourite.js +9 -9
  593. package/src/js/page/plp-img-v2.js +3 -2
  594. package/src/js/page/plp-load-more.js +66 -66
  595. package/src/js/page/plp.js +10 -9
  596. package/src/js/page/pre-home.js +144 -159
  597. package/src/js/page/project-list/generate-project-id.js +68 -77
  598. package/src/js/page/project-list-note.js +232 -234
  599. package/src/js/page/project-list.js +3 -2
  600. package/src/js/page/quiz.js +292 -292
  601. package/src/js/page/select-address.js +14 -27
  602. package/src/js/page/smart-banner.js +5 -8
  603. package/src/js/page/ti.js +42 -67
  604. package/src/js/page/top-rated.js +29 -36
  605. package/src/js/page/track-my-order.js +156 -172
  606. package/src/js/page/tradePro-rewards.js +36 -34
  607. package/src/js/page/utils/array-utils.js +10 -13
  608. package/src/js/page/utils/copy-to-clipboard.js +45 -45
  609. package/src/js/page/utils/create-event.js +8 -8
  610. package/src/js/page/utils/errorMesages.js +11 -12
  611. package/src/js/page/utils/helpers.js +9 -14
  612. package/src/js/page/utils/http-action.js +5 -4
  613. package/src/js/page/utils/loader.js +5 -5
  614. package/src/js/page/utils/routes.js +9 -9
  615. package/src/js/page/utils/url-query.js +4 -4
  616. package/src/js/page/utils/validation.js +96 -93
  617. package/src/js/page/wickes-dc.js +44 -51
  618. package/src/js/page/wismo.js +12 -12
  619. package/src/js/page/your-details.js +41 -77
  620. package/src/layouts/app_sticky_header.hbs +1 -0
  621. package/src/scss/barclays-paypage-combined.css +585 -585
  622. package/src/scss/barclays-paypage-desktop.css +496 -496
  623. package/src/scss/barclays-paypage-mobile.css +494 -494
  624. package/src/scss/category-main.scss +2 -8
  625. package/src/scss/common/_cat-common.scss +0 -1
  626. package/src/scss/common/_plp-common.scss +0 -1
  627. package/src/scss/components/_billie-modal.scss +2 -2
  628. package/src/scss/components/_card.scss +0 -1
  629. package/src/scss/components/_custom-slider.scss +6 -6
  630. package/src/scss/components/_find-a-store.scss +0 -1
  631. package/src/scss/components/_gallery-pdp-critical.scss +2 -2
  632. package/src/scss/components/_kitchen-card.scss +2 -2
  633. package/src/scss/components/_notifications-critical.scss +2 -2
  634. package/src/scss/components/_offer-banner.scss +0 -1
  635. package/src/scss/components/_order-summary.scss +1 -1
  636. package/src/scss/components/_page-overlay.scss +1 -1
  637. package/src/scss/components/_price-block.scss +0 -1
  638. package/src/scss/components/_price.scss +1 -1
  639. package/src/scss/components/_range-card.scss +1 -0
  640. package/src/scss/components/_recommended.scss +1 -0
  641. package/src/scss/components/_rewards.scss +1 -1
  642. package/src/scss/components/_share-list-modal.scss +1 -1
  643. package/src/scss/components/_shopping-list-note.scss +1 -1
  644. package/src/scss/components/_steps-three.scss +1 -1
  645. package/src/scss/components/_steps.scss +2 -2
  646. package/src/scss/components/_tc-generic.scss +1 -1
  647. package/src/scss/components/_thank-you-modal.scss +1 -3
  648. package/src/scss/components/_ti-total-area.scss +1 -1
  649. package/src/scss/components/_user-address-delivery.scss +1 -1
  650. package/src/scss/components/kitchen/_price.scss +1 -1
  651. package/src/scss/components/my-account/_contacts.scss +1 -3
  652. package/src/scss/components/special-opening-schedule-v2.scss +3 -3
  653. package/src/scss/components/special-opening-schedule.scss +2 -2
  654. package/src/scss/helpers/_colors-semantic.scss +120 -0
  655. package/src/scss/helpers/_variables.scss +155 -158
  656. package/src/scss/helpers/helpers-pdp-critical/_elements-critical-pdp.scss +0 -1
  657. package/src/scss/helpers/helpers-pdp-critical/_helpers-critical-pdp.scss +0 -4
  658. package/src/scss/libs/_bootstrap-extracted.scss +8 -26
  659. package/src/scss/libs/_cat-libs.scss +10 -10
  660. package/src/scss/libs/_font-awesome-icons.scss +0 -2
  661. package/src/scss/libs/_homepage-libs.scss +12 -12
  662. package/src/scss/libs/_plp-libs.scss +11 -11
  663. package/src/scss/libs/_skeleton.scss +5 -5
  664. package/src/scss/libs/_store-locator-libs.scss +1 -1
  665. package/src/scss/libs/flatpickr.scss +4 -4
  666. package/src/scss/libs/simplebar.css +3 -3
  667. package/src/scss/libs/swiper.css +384 -479
  668. package/src/scss/main.scss +70 -140
  669. package/src/scss/my-account-main-v2.scss +19 -38
  670. package/src/scss/my-account-main.scss +19 -38
  671. package/src/scss/pages/_checkout-confirmation-new.scss +2 -2
  672. package/src/scss/pages/_checkout-widget.scss +1 -1
  673. package/src/scss/pages/_checkout_your-details.scss +0 -1
  674. package/src/scss/pages/_facets.scss +86 -0
  675. package/src/scss/pages/checkout-new.scss +0 -1
  676. package/src/scss/pages/checkout.scss +0 -1
  677. package/src/scss/pages/iframe-paypage.scss +8 -9
  678. package/src/scss/pages/page_book-consultant-thank-you-new.scss +2 -2
  679. package/src/scss/pages/page_installer.scss +2 -2
  680. package/src/scss/pages/page_my-account_tradePro.scss +1 -1
  681. package/src/scss/pages/page_new-checkout_login-register.scss +1 -1
  682. package/src/scss/pages/page_pre_home_thank-you.scss +2 -2
  683. package/src/scss/pages/page_product-details-critical.scss +0 -1
  684. package/src/scss/pages/page_products-list-combined.scss +0 -4
  685. package/src/scss/pages/page_store-locator-details.scss +1 -1
  686. package/src/scss/pages/page_top-rated.scss +14 -14
  687. package/src/scss/pages/page_wismo-details.scss +1 -1
  688. package/src/scss/pages/tradePro-rewards-old.scss +1 -1
  689. package/src/scss/partials/_breadcrumbs-critical.scss +2 -2
  690. package/src/scss/partials/_breadcrumbs.scss +2 -2
  691. package/src/scss/partials/_header-critical.scss +1 -1
  692. package/src/scss/partials/_header.scss +1 -1
  693. package/src/scss/partials/_main-nav.scss +2 -2
  694. package/src/scss/store-locator-main.scss +0 -3
@@ -1,692 +1,612 @@
1
1
  var Wick = Wick || {};
2
2
 
3
3
  Wick.multipleFiles = {
4
- valueFiles: [],
5
- count: 5,
6
- filesForm: {
7
- getPreviewTemplate(installerFileName) {
8
- var previewTemplate = $(
9
- '.installer_question-file_result_wrapper[data-installer-file-name="' +
10
- installerFileName +
11
- '"]'
12
- );
13
- return $(previewTemplate[Wick.multipleFiles.valueFiles.length]);
14
- },
15
- setValue: function (installerFileName, value) {
16
- Wick.multipleFiles.valueFiles.push(value);
17
- },
18
- removeValue: function (installerFileName, order) {
19
- Wick.multipleFiles.valueFiles.splice(order, 1);
20
- },
21
- showAddFileTemplate: function (installerFileName) {
22
- if (Wick.multipleFiles.valueFiles.length < Wick.multipleFiles.count) {
23
- var addFileTemplate = $(
24
- 'label.installer_question-file_label[data-installer-file-name="' +
25
- installerFileName +
26
- '"]'
27
- );
28
- addFileTemplate.removeClass('hide');
29
- }
30
- },
31
- hideAddFileTemplate: function (installerFileName) {
32
- if (Wick.multipleFiles.valueFiles.length >= Wick.multipleFiles.count) {
33
- var addFileTemplate = $(
34
- 'label.installer_question-file_label[data-installer-file-name="' +
35
- installerFileName +
36
- '"]'
37
- );
38
- addFileTemplate.addClass('hide');
39
- }
40
- },
41
- showErrorNotification: function (installerFileName, error) {
42
- Wick.InstallerValidation.addErrorNotificationToElement(installerFileName, error, true);
43
- },
44
- hideErrorNotification: function (installerFileName) {
45
- Wick.InstallerValidation.removeErrorNotificationFromElement(installerFileName);
46
- },
47
- hideDefaultError: function (element) {
48
- Wick.InstallerValidation.removeErrorNotificationFromElement(element.attr('name'));
49
- },
50
- showImagePreviewTemplate: function (installerFileName) {
51
- var previewTemplate =
52
- Wick.multipleFiles.filesForm.getPreviewTemplate(installerFileName);
53
- previewTemplate.removeClass('hide');
54
- },
55
- hideImagePreviewTemplate: function (installerFileName, order) {
56
- var previewTemplates = $(
57
- '.installer_question-file_result_wrapper[data-installer-file-name="' +
58
- installerFileName +
59
- '"]'
60
- );
61
-
62
- var i = order + 1;
63
- while (Wick.multipleFiles.count > i) {
64
- $(previewTemplates[i]).data('file', i - 1);
65
- i++;
66
- }
67
-
68
- $(previewTemplates[order]).addClass('hide');
69
- $(previewTemplates[order]).data('file', Wick.multipleFiles.count - 1);
70
- $(previewTemplates[order]).appendTo('.your-details__file-wrapper');
71
- },
72
- readFile: function (file, installerFileName) {
73
- var reader = new FileReader();
74
- var imagePreviewTemplate =
75
- Wick.multipleFiles.filesForm.getPreviewTemplate(installerFileName);
76
-
77
- reader.onload = function (e) {
78
- var imagePreviewElement = imagePreviewTemplate.find('img');
79
-
80
- imagePreviewElement.attr('src', e.target.result);
81
- };
82
-
83
- reader.readAsDataURL(file);
84
- },
85
- showSpinner: function () {
86
- var loader = $('.installer__loader');
87
- loader.addClass('show');
88
- },
89
- hideSpinner: function () {
90
- var loader = $('.installer__loader');
91
- loader.removeClass('show');
92
- },
93
- addFileHandler: function (file, installerFileName) {
94
- Wick.S3bucketUpload.uploadImage(file, installerFileName);
95
- },
96
- onSuccessFileAdd: function (file, installerFileName, fileLink) {
97
- Wick.multipleFiles.filesForm.hideErrorNotification(installerFileName);
98
- Wick.multipleFiles.filesForm.showImagePreviewTemplate(installerFileName);
99
- Wick.multipleFiles.filesForm.readFile(file, installerFileName);
100
- Wick.multipleFiles.filesForm.setValue(installerFileName, fileLink);
101
- Wick.multipleFiles.filesForm.hideAddFileTemplate(installerFileName);
102
- },
103
- removeFileHandler: function (installerFileName, order) {
104
- Wick.multipleFiles.filesForm.hideErrorNotification(installerFileName);
105
- Wick.multipleFiles.filesForm.removeValue(installerFileName, order);
106
- Wick.multipleFiles.filesForm.hideImagePreviewTemplate(installerFileName, order);
107
- Wick.multipleFiles.filesForm.showAddFileTemplate(installerFileName);
108
- },
4
+ valueFiles: [],
5
+ count: 5,
6
+ filesForm: {
7
+ getPreviewTemplate (installerFileName) {
8
+ var previewTemplate = $('.installer_question-file_result_wrapper[data-installer-file-name="' + installerFileName + '"]');
9
+ return $(previewTemplate[Wick.multipleFiles.valueFiles.length])
109
10
  },
110
- bindFileInputs: function () {
111
- $('body').on('change', '.installer_question-file_input', function () {
112
- var closestLabel = $(this).closest('.installer_question-file_label');
113
- var files = $(this).get(0).files;
114
- var delta = Wick.multipleFiles.count - Wick.multipleFiles.valueFiles.length;
115
- var i = files.length < delta ? files.length : delta;
116
- while (i) {
117
- i--;
118
- var file = files[i];
119
- Wick.multipleFiles.filesForm.addFileHandler(
120
- file,
121
- closestLabel.attr('data-installer-file-name')
122
- );
123
- }
124
- });
11
+ setValue: function(installerFileName, value) {
12
+ Wick.multipleFiles.valueFiles.push(value)
125
13
  },
126
- bindImageTemplate: function () {
127
- var element = $('.your-details__file-wrapper .installer_question-file_result_wrapper');
128
- var i = 0;
129
- element.data('file', i);
130
- while (Wick.multipleFiles.count - 1 > i) {
131
- i++;
132
- element.clone().data('file', i).appendTo('.your-details__file-wrapper');
133
- }
14
+ removeValue: function(installerFileName, order) {
15
+ Wick.multipleFiles.valueFiles.splice(order, 1)
134
16
  },
135
- bindDeleteFileButtons: function () {
136
- $('body').on('click', '.delete_action', function () {
137
- var closestLabel = $(this).closest('.installer_question-file_result_wrapper');
138
- Wick.multipleFiles.filesForm.removeFileHandler(
139
- closestLabel.attr('data-installer-file-name'),
140
- closestLabel.data('file')
141
- );
142
- });
17
+ showAddFileTemplate: function (installerFileName) {
18
+ if (Wick.multipleFiles.valueFiles.length < Wick.multipleFiles.count) {
19
+ var addFileTemplate = $('label.installer_question-file_label[data-installer-file-name="' + installerFileName + '"]');
20
+ addFileTemplate.removeClass('hide');
21
+ }
143
22
  },
144
-
145
- RECAPTCHA_PUBLIC_KEY: '6LdVZ74ZAAAAABiyCm6Szsv5T9wbrOCegkskM2iR',
146
-
147
- recaptchaDecorate: function (action, f) {
148
- return function () {
149
- const context = this;
150
- const args = arguments;
151
- grecaptcha.ready(function () {
152
- grecaptcha
153
- .execute(Wick.multipleFiles.RECAPTCHA_PUBLIC_KEY, {
154
- action: action,
155
- })
156
- .then(function (token) {
157
- f.call(context, token, ...args);
158
- });
159
- });
160
- };
23
+ hideAddFileTemplate: function (installerFileName) {
24
+ if (Wick.multipleFiles.valueFiles.length >= Wick.multipleFiles.count) {
25
+ var addFileTemplate = $('label.installer_question-file_label[data-installer-file-name="' + installerFileName + '"]');
26
+ addFileTemplate.addClass('hide');
27
+ }
161
28
  },
162
- };
163
-
164
- $(document).ready(function () {
165
- Wick.multipleFiles.bindImageTemplate();
166
- Wick.multipleFiles.bindFileInputs();
167
- Wick.multipleFiles.bindDeleteFileButtons();
168
- });
169
-
170
- // Polyfills
171
- if (!String.prototype.startsWith) {
172
- String.prototype.startsWith = function (searchString, position) {
173
- position = position || 0;
174
- return this.indexOf(searchString, position) === position;
175
- };
176
- }
177
-
178
- Wick.S3bucketUpload = {
179
- validExtensionsList: ['jpg', 'jpeg', 'png', 'bmp', 'webp', 'tiff', 'heif', 'heic'],
180
- isFileExtensionValid: function (file) {
181
- var fileName = file.name.split('.');
182
- return Wick.S3bucketUpload.validExtensionsList.includes(
183
- fileName[fileName.length - 1].toLowerCase()
184
- );
29
+ showErrorNotification: function (installerFileName, error) {
30
+ Wick.InstallerValidation.addErrorNotificationToElement(installerFileName, error, true)
185
31
  },
186
- transformXmlError: function (error) {
187
- var parser = new DOMParser();
188
- var xmlDoc = parser.parseFromString(error.responseText, 'text/xml');
189
- var errorMessage = xmlDoc.all[2].innerHTML;
190
- if (errorMessage === 'Your proposed upload exceeds the maximum allowed size') {
191
- return 'Unfortunately your document could not be uploaded, as the file exceeds the 5MB limit. Please try again with a file no greater than 5MB.';
192
- }
193
- return errorMessage;
32
+ hideErrorNotification: function (installerFileName) {
33
+ Wick.InstallerValidation.removeErrorNotificationFromElement(installerFileName)
194
34
  },
195
- transformError: function (error) {
196
- if (error.responseXML) {
197
- return Wick.S3bucketUpload.transformXmlError(error);
198
- }
199
- return error.statusText;
35
+ hideDefaultError: function (element) {
36
+ Wick.InstallerValidation.removeErrorNotificationFromElement(element.attr('name'))
200
37
  },
201
- uploadImage: function (file, installerFileName) {
202
- var isExtesionValid = Wick.S3bucketUpload.isFileExtensionValid(file);
203
-
204
- if (!isExtesionValid) {
205
- Wick.multipleFiles.filesForm.showErrorNotification(installerFileName, [
206
- 'Unable to attach file. Only JPG, JPEG, PNG, BMP, WEBP, TIFF, HEIC and HEIF image files are supported.',
207
- ]);
208
-
209
- return;
210
- }
211
-
212
- Wick.multipleFiles.filesForm.showSpinner();
213
-
214
- setTimeout(() => {
215
- Wick.multipleFiles.filesForm.hideSpinner();
216
- Wick.multipleFiles.filesForm.onSuccessFileAdd(
217
- file,
218
- installerFileName,
219
- installerFileName
220
- );
221
- }, 1000);
38
+ showImagePreviewTemplate: function (installerFileName) {
39
+ var previewTemplate = Wick.multipleFiles.filesForm.getPreviewTemplate(installerFileName)
40
+ previewTemplate.removeClass('hide');
222
41
  },
223
- };
224
-
225
- Wick.InstallerValidation = {
226
- findRequirementsByName: function (elementName) {
227
- var step = $('[name="' + elementName + '"]')
228
- .closest('.installer-block')
229
- .attr('data-step');
230
- return Wick.InstallerValidation.steps[step][elementName];
42
+ hideImagePreviewTemplate: function (installerFileName, order) {
43
+ var previewTemplates = $('.installer_question-file_result_wrapper[data-installer-file-name="' + installerFileName + '"]');
44
+
45
+ var i = order + 1;
46
+ while (Wick.multipleFiles.count > i) {
47
+ $(previewTemplates[i]).data('file', i-1)
48
+ i++;
49
+ }
50
+
51
+ $(previewTemplates[order]).addClass('hide');
52
+ $(previewTemplates[order]).data('file', (Wick.multipleFiles.count-1));
53
+ $(previewTemplates[order]).appendTo('.your-details__file-wrapper');
231
54
  },
232
- getValueByName: function (elementName) {
233
- var element = $('[name="' + elementName + '"]');
234
- var type = element.attr('type');
55
+ readFile: function (file, installerFileName) {
56
+ var reader = new FileReader();
57
+ var imagePreviewTemplate = Wick.multipleFiles.filesForm.getPreviewTemplate(installerFileName)
235
58
 
236
- if (element.prop('tagName') === 'SELECT') {
237
- return element.val();
238
- }
59
+ reader.onload = function(e) {
60
+ var imagePreviewElement = imagePreviewTemplate.find('img');
239
61
 
240
- switch (type) {
241
- case 'radio':
242
- return $('[name="' + elementName + '"]:checked').val();
243
- case 'checkbox':
244
- return $('[name="' + elementName + '"]:checked')
245
- .map(function () {
246
- return $(this).val();
247
- })
248
- .get();
249
- case 'file':
250
- return element.attr('data-value');
251
- default:
252
- return element.val().trim();
253
- }
254
- },
255
- isInputValueNotEmpty: function (value) {
256
- if (typeof value === 'string') return !!value;
257
- if (Array.isArray(value)) return value.length > 0;
62
+ imagePreviewElement.attr('src', e.target.result);
63
+ };
258
64
 
259
- return false;
65
+ reader.readAsDataURL(file);
260
66
  },
261
- elemDependsCheck: function (dependentValue, requirements) {
262
- var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(dependentValue);
263
- if (isValueExist) {
264
- if (requirements.dependsOnValue) {
265
- if (typeof dependentValue === 'string' || Array.isArray(dependentValue)) {
266
- return Wick.InstallerValidation.elemPossibleValuesCheck(
267
- dependentValue,
268
- requirements.dependsOnValue
269
- );
270
- } else {
271
- return false;
272
- }
273
- }
274
- } else {
275
- return false;
276
- }
277
-
278
- return true;
67
+ showSpinner: function () {
68
+ var loader = $('.installer__loader');
69
+ loader.addClass('show');
279
70
  },
280
- elemRequiredCheck: function (value, requirements) {
281
- var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(value);
282
- if (requirements.required && !isValueExist) {
283
- return false;
284
- }
285
-
286
- return true;
71
+ hideSpinner: function () {
72
+ var loader = $('.installer__loader');
73
+ loader.removeClass('show');
287
74
  },
288
- elemPossibleValuesCheck: function (value, possibleValues) {
289
- if (Array.isArray(possibleValues) && possibleValues.length > 0) {
290
- if (typeof value === 'string') {
291
- if (possibleValues && possibleValues.indexOf(value) < 0) {
292
- return false;
293
- }
294
- }
295
- if (Array.isArray(value) && value.length > 0) {
296
- if (possibleValues) {
297
- var isValid = value
298
- .map(function (arrayValue) {
299
- return possibleValues.indexOf(arrayValue) >= 0;
300
- })
301
- .some(function (result) {
302
- return !!result;
303
- });
304
-
305
- if (!isValid) {
306
- return false;
307
- }
308
- }
309
- }
310
- }
311
- return true;
75
+ addFileHandler: function (file, installerFileName) {
76
+ Wick.S3bucketUpload.uploadImage(file, installerFileName);
312
77
  },
313
- elemRegexCheck: function (value, requirements) {
314
- if (requirements.regex && !RegExp(requirements.regex).test(value)) {
315
- return false;
316
- }
317
-
318
- return true;
78
+ onSuccessFileAdd: function (file, installerFileName, fileLink) {
79
+ Wick.multipleFiles.filesForm.hideErrorNotification(installerFileName);
80
+ Wick.multipleFiles.filesForm.showImagePreviewTemplate(installerFileName);
81
+ Wick.multipleFiles.filesForm.readFile(file, installerFileName);
82
+ Wick.multipleFiles.filesForm.setValue(installerFileName, fileLink);
83
+ Wick.multipleFiles.filesForm.hideAddFileTemplate(installerFileName);
319
84
  },
320
- elemMaxLengthCheck: function (value, requirements) {
321
- if (typeof value === 'string' && requirements.maxLength) {
322
- return value.length <= requirements.maxLength;
323
- }
85
+ removeFileHandler: function (installerFileName, order) {
86
+ Wick.multipleFiles.filesForm.hideErrorNotification(installerFileName);
87
+ Wick.multipleFiles.filesForm.removeValue(installerFileName, order);
88
+ Wick.multipleFiles.filesForm.hideImagePreviewTemplate(installerFileName, order);
89
+ Wick.multipleFiles.filesForm.showAddFileTemplate(installerFileName);
90
+ }
91
+ },
92
+ bindFileInputs: function () {
93
+ $('body').on('change', '.installer_question-file_input', function() {
94
+ var closestLabel = $(this).closest('.installer_question-file_label');
95
+ var files = $(this).get(0).files
96
+ var delta = Wick.multipleFiles.count - Wick.multipleFiles.valueFiles.length;
97
+ var i = (files.length < delta)
98
+ ? files.length
99
+ : delta;
100
+ while(i) {
101
+ i--
102
+ var file = files[i]
103
+ Wick.multipleFiles.filesForm.addFileHandler(file, closestLabel.attr('data-installer-file-name'));
104
+ }
105
+ });
106
+ },
107
+ bindImageTemplate: function() {
108
+ var element = $('.your-details__file-wrapper .installer_question-file_result_wrapper')
109
+ var i = 0;
110
+ element.data('file', i)
111
+ while ((Wick.multipleFiles.count-1) > i) {
112
+ i++
113
+ element
114
+ .clone()
115
+ .data('file', i)
116
+ .appendTo('.your-details__file-wrapper');
117
+ }
118
+ },
119
+ bindDeleteFileButtons: function () {
120
+ $('body').on('click', '.delete_action', function() {
121
+ var closestLabel = $(this).closest('.installer_question-file_result_wrapper');
122
+ Wick.multipleFiles.filesForm.removeFileHandler(closestLabel.attr('data-installer-file-name'), closestLabel.data('file'));
123
+ });
124
+ },
125
+
126
+ RECAPTCHA_PUBLIC_KEY: '6LdVZ74ZAAAAABiyCm6Szsv5T9wbrOCegkskM2iR',
127
+
128
+ recaptchaDecorate: function (action, f) {
129
+ return function() {
130
+ const context = this
131
+ const args = arguments
132
+ grecaptcha.ready(function () {
133
+ grecaptcha.execute(Wick.multipleFiles.RECAPTCHA_PUBLIC_KEY, {
134
+ action: action
135
+ }).then(function (token) {
136
+ f.call(context, token, ...args)
137
+ })
138
+ })
139
+ }
140
+ }
141
+ };
324
142
 
325
- return true;
326
- },
327
- isElementValid: function (elementName) {
328
- var requirements = Wick.InstallerValidation.findRequirementsByName(elementName);
329
- var value = Wick.InstallerValidation.getValueByName(elementName);
330
- var error = requirements.error;
331
- var result;
332
-
333
- if (value && typeof value === 'string') {
334
- value = value.trim();
335
- }
143
+ $(document).ready(function () {
144
+ Wick.multipleFiles.bindImageTemplate();
145
+ Wick.multipleFiles.bindFileInputs();
146
+ Wick.multipleFiles.bindDeleteFileButtons();
147
+ });
336
148
 
337
- if (requirements.required) {
338
- if (requirements.dependsOnInput) {
339
- var dependentValue = Wick.InstallerValidation.getValueByName(
340
- requirements.dependsOnInput
341
- );
342
- if (dependentValue) {
343
- if (requirements.dependsOnValue) {
344
- var elemDependsCheckResult = Wick.InstallerValidation.elemDependsCheck(
345
- dependentValue,
346
- requirements
347
- );
348
- if (elemDependsCheckResult) {
349
- result = Wick.InstallerValidation.checkElementValidations(
350
- value,
351
- requirements
352
- );
353
- return { valid: result.valid, errorType: result.errorType, error };
354
- }
355
- } else {
356
- result = Wick.InstallerValidation.checkElementValidations(
357
- value,
358
- requirements
359
- );
360
- return { valid: result.valid, errorType: result.errorType, error };
361
- }
362
- }
363
- } else {
364
- result = Wick.InstallerValidation.checkElementValidations(value, requirements);
365
- return { valid: result.valid, errorType: result.errorType, error };
366
- }
367
- } else {
368
- var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(value);
369
- if (isValueExist) {
370
- result = Wick.InstallerValidation.checkElementValidations(value, requirements);
371
- return { valid: result.valid, errorType: result.errorType, error };
372
- }
373
- }
149
+ // Polyfills
150
+ if (!String.prototype.startsWith) {
151
+ String.prototype.startsWith = function(searchString, position) {
152
+ position = position || 0;
153
+ return this.indexOf(searchString, position) === position;
154
+ };
155
+ }
374
156
 
375
- return { valid: true, error };
376
- },
377
- checkElementValidations: function (value, requirements) {
378
- var elemRequiredCheckResult = Wick.InstallerValidation.elemRequiredCheck(
379
- value,
380
- requirements
381
- );
382
- var elemPossibleValuesCheckResult = Wick.InstallerValidation.elemPossibleValuesCheck(
383
- value,
384
- requirements.possibleValues
385
- );
386
- var elemRegexCheckResult = Wick.InstallerValidation.elemRegexCheck(value, requirements);
387
- var elemMaxLengthCheckResult = Wick.InstallerValidation.elemMaxLengthCheck(
388
- value,
389
- requirements
390
- );
391
-
392
- if (!elemRequiredCheckResult) return { valid: false, errorType: 'required' };
393
- if (!elemPossibleValuesCheckResult || !elemRegexCheckResult || !elemMaxLengthCheckResult)
394
- return {
395
- valid: false,
396
- errorType: 'validation',
397
- };
398
-
399
- return { valid: true };
400
- },
401
- runElementCallback: function (elementName, changedElemValue) {
402
- var value = Wick.InstallerValidation.getValueByName(elementName);
403
- var requirements = Wick.InstallerValidation.findRequirementsByName(elementName);
404
- if (requirements.callback) {
405
- requirements.callback(value, changedElemValue);
406
- }
407
- },
408
- checkElement: function (elementName, onChange) {
409
- var result = Wick.InstallerValidation.isElementValid(elementName);
410
- if (result.valid) {
411
- if (onChange) {
412
- Wick.InstallerValidation.removeErrorNotificationFromElement(elementName);
413
- Wick.InstallerValidation.removeGlobalErrorNotification();
414
- }
415
- return result;
416
- }
157
+ Wick.S3bucketUpload = {
158
+ validExtensionsList: ['jpg', 'jpeg', 'png', 'bmp', 'webp', 'tiff', 'heif', 'heic'],
159
+ isFileExtensionValid: function (file) {
160
+ var fileName = file.name.split('.')
161
+ return Wick.S3bucketUpload.validExtensionsList.includes(fileName[fileName.length - 1].toLowerCase())
162
+ },
163
+ transformXmlError: function (error) {
164
+ var parser = new DOMParser();
165
+ var xmlDoc = parser.parseFromString(error.responseText, "text/xml");
166
+ var errorMessage = xmlDoc.all[2].innerHTML;
167
+ if (errorMessage === 'Your proposed upload exceeds the maximum allowed size') {
168
+ return 'Unfortunately your document could not be uploaded, as the file exceeds the 5MB limit. Please try again with a file no greater than 5MB.';
169
+ }
170
+ return errorMessage;
171
+ },
172
+ transformError: function (error) {
173
+ if (error.responseXML) {
174
+ return Wick.S3bucketUpload.transformXmlError(error);
175
+ }
176
+ return error.statusText;
177
+ },
178
+ uploadImage: function(file, installerFileName) {
179
+ var isExtesionValid = Wick.S3bucketUpload.isFileExtensionValid(file);
180
+
181
+ if (!isExtesionValid) {
182
+ Wick.multipleFiles.filesForm.showErrorNotification(installerFileName, [
183
+ 'Unable to attach file. Only JPG, JPEG, PNG, BMP, WEBP, TIFF, HEIC and HEIF image files are supported.'
184
+ ]);
185
+
186
+ return;
187
+ }
188
+
189
+ Wick.multipleFiles.filesForm.showSpinner();
190
+
191
+ setTimeout(()=> {
192
+ Wick.multipleFiles.filesForm.hideSpinner();
193
+ Wick.multipleFiles.filesForm.onSuccessFileAdd(file, installerFileName, installerFileName);
194
+ }, 1000)
195
+ }
196
+ };
417
197
 
418
- Wick.InstallerValidation.addErrorNotificationToElement(elementName, result.error, true);
419
198
 
420
- return result;
421
- },
422
- appendErrorMessage: function (wrapper, elementName, error) {
423
- var notification =
424
- '<div' +
425
- ' data-installer-input-name="' +
426
- elementName +
427
- '"' +
428
- ' class="form-row__error"' +
429
- ' >' +
430
- error
431
- .map(function (err) {
432
- return '<p>' + err + '</p>';
433
- })
434
- .join('') +
435
- ' </div>';
436
- wrapper.append(notification);
437
- },
438
- addErrorNotificationToElement: function (elementName, error, removePrevNotification) {
439
- if (!error) return;
440
- var element = $('[name="' + elementName + '"]');
441
- var wrapper = element.closest('[data-form-field]');
442
- var prevNotification = wrapper.children(
443
- '.form-row__error[data-installer-input-name="' + elementName + '"]'
444
- );
445
- if (prevNotification.length === 0) {
446
- Wick.InstallerValidation.appendErrorMessage(wrapper, elementName, error);
199
+ Wick.InstallerValidation = {
200
+ findRequirementsByName: function (elementName) {
201
+ var step = $('[name="'+ elementName +'"]').closest('.installer-block').attr('data-step');
202
+ return Wick.InstallerValidation.steps[step][elementName];
203
+ },
204
+ getValueByName: function (elementName) {
205
+ var element = $('[name="'+ elementName +'"]');
206
+ var type = element.attr("type");
207
+
208
+ if (element.prop('tagName') === 'SELECT') {
209
+ return element.val()
210
+ }
211
+
212
+ switch (type) {
213
+ case 'radio':
214
+ return $('[name="'+ elementName +'"]:checked').val();
215
+ case 'checkbox':
216
+ return $('[name="'+ elementName +'"]:checked').map(function(){
217
+ return $(this).val();
218
+ }).get();
219
+ case 'file':
220
+ return element.attr('data-value');
221
+ default:
222
+ return element.val().trim();
223
+ }
224
+ },
225
+ isInputValueNotEmpty: function (value) {
226
+ if (typeof value === 'string') return !!value;
227
+ if (Array.isArray(value)) return value.length > 0;
228
+
229
+ return false;
230
+ },
231
+ elemDependsCheck: function (dependentValue, requirements) {
232
+ var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(dependentValue);
233
+ if (isValueExist) {
234
+ if (requirements.dependsOnValue) {
235
+ if (typeof dependentValue === 'string' || Array.isArray(dependentValue)) {
236
+ return Wick.InstallerValidation.elemPossibleValuesCheck(dependentValue, requirements.dependsOnValue);
447
237
  } else {
448
- if (removePrevNotification) {
449
- prevNotification.remove();
450
- Wick.InstallerValidation.appendErrorMessage(wrapper, elementName, error);
451
- }
238
+ return false;
452
239
  }
453
- },
454
- removeErrorNotificationFromElement: function (elementName) {
455
- var element = $('[name="' + elementName + '"]');
456
- var wrapper = element.closest('[data-form-field]');
457
- var error = wrapper.children(
458
- '.installer_question-error_wrapper[data-installer-input-name="' + elementName + '"]'
459
- );
460
- var formError = wrapper.find(
461
- '.form-row__error[data-installer-input-name="' + elementName + '"]'
462
- );
463
- error.remove();
464
- formError.remove();
465
- },
466
- removeAllErrorsFromStep: function (step) {
467
- var installerBlock = $('.installer-block[data-step="' + step + '"]');
468
- installerBlock.find('.form-row__error').remove();
469
- },
470
- addGlobalErrorNotification: function (step, errorTypes) {
471
- var wrapper = $('.installer-step-errors');
472
- wrapper.attr('data-step', step);
473
- wrapper.attr('data-step-error', '');
474
- errorTypes.forEach(function (type) {
475
- wrapper.attr(`data-error-${type}`, '');
476
- });
477
- },
478
- removeGlobalErrorNotification: function () {
479
- var wrapper = $('.installer-step-errors');
480
- wrapper.removeAttr('data-step-error');
481
- wrapper.removeAttr('data-error-required');
482
- wrapper.removeAttr('data-error-validation');
483
- },
484
- validateStepForInstallerForm: function (step) {
485
- Wick.InstallerValidation.removeAllErrorsFromStep(step);
486
-
487
- var inputNames = Object.keys(Wick.InstallerValidation.steps[step]);
488
- var results = inputNames.map(function (elementName) {
489
- return {
490
- name: elementName,
491
- result: Wick.InstallerValidation.checkElement(elementName),
492
- };
493
- });
494
- var isStepInvalid = results.some(function (result) {
495
- return !result.result.valid;
496
- });
497
- var errorTypes = results.reduce(function (prev, next) {
498
- var result = next.result.errorType ? { [next.result.errorType]: true } : {};
499
- return Object.assign(prev, result);
500
- }, {});
501
- errorTypes = Object.keys(errorTypes);
502
-
503
- if (isStepInvalid) {
504
- var firstErrorField = results.find(function (result) {
505
- return !result.result.valid;
506
- });
507
- Wick.InstallerValidation.scrollToField(firstErrorField.name);
508
- Wick.InstallerValidation.addGlobalErrorNotification(step, errorTypes);
240
+ }
241
+ } else {
242
+ return false;
243
+ }
244
+
245
+ return true;
246
+ },
247
+ elemRequiredCheck: function (value, requirements) {
248
+ var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(value);
249
+ if (requirements.required && !isValueExist) {
250
+ return false;
251
+ }
252
+
253
+ return true;
254
+ },
255
+ elemPossibleValuesCheck: function (value, possibleValues) {
256
+ if (Array.isArray(possibleValues) && possibleValues.length > 0) {
257
+ if (typeof value === 'string') {
258
+ if (possibleValues && possibleValues.indexOf(value) < 0) {
259
+ return false;
509
260
  }
510
-
511
- return !isStepInvalid;
512
- },
513
- scrollToField: function (name) {
514
- var element = $('[name="' + name + '"]:first');
515
- var elementHeight = element.height();
516
- $([document.documentElement, document.body]).animate(
517
- {
518
- scrollTop: element.offset().top - elementHeight,
519
- },
520
- 1500
521
- );
522
- },
523
- validatemultipleFiles: function () {
524
- var isStepsValid = Wick.multipleFiles.steps
525
- .map(function (step) {
526
- return Wick.InstallerValidation.validateStepFormultipleFiles(step);
527
- })
528
- .every(function (result) {
529
- return !!result;
530
- });
531
-
532
- return isStepsValid;
533
- },
261
+ }
262
+ if (Array.isArray(value) && value.length > 0) {
263
+ if (possibleValues) {
264
+ var isValid = value
265
+ .map(function (arrayValue) { return possibleValues.indexOf(arrayValue) >= 0 })
266
+ .some(function (result) { return !!result });
267
+
268
+ if (!isValid) {
269
+ return false;
270
+ }
271
+ }
272
+ }
273
+ }
274
+ return true;
275
+ },
276
+ elemRegexCheck: function (value, requirements) {
277
+ if (requirements.regex && !RegExp(requirements.regex).test(value)) {
278
+ return false;
279
+ }
280
+
281
+ return true;
282
+ },
283
+ elemMaxLengthCheck: function (value, requirements) {
284
+ if (typeof value === 'string' && requirements.maxLength) {
285
+ return value.length <= requirements.maxLength;
286
+ }
287
+
288
+ return true;
289
+ },
290
+ isElementValid: function (elementName) {
291
+ var requirements = Wick.InstallerValidation.findRequirementsByName(elementName);
292
+ var value = Wick.InstallerValidation.getValueByName(elementName);
293
+ var error = requirements.error;
294
+
295
+ if (value && typeof value === 'string') {
296
+ value = value.trim();
297
+ }
298
+
299
+ if (requirements.required) {
300
+ if (requirements.dependsOnInput) {
301
+ var dependentValue = Wick.InstallerValidation.getValueByName(requirements.dependsOnInput);
302
+ if (dependentValue) {
303
+ if (requirements.dependsOnValue) {
304
+ var elemDependsCheckResult = Wick.InstallerValidation.elemDependsCheck(dependentValue, requirements);
305
+ if (elemDependsCheckResult) {
306
+ var result = Wick.InstallerValidation.checkElementValidations(value, requirements);
307
+ return { valid: result.valid, errorType: result.errorType, error };
308
+ }
309
+ } else {
310
+ var result = Wick.InstallerValidation.checkElementValidations(value, requirements);
311
+ return { valid: result.valid, errorType: result.errorType, error };
312
+ }
313
+ }
314
+ } else {
315
+ var result = Wick.InstallerValidation.checkElementValidations(value, requirements);
316
+ return { valid: result.valid, errorType: result.errorType, error };
317
+ }
318
+ } else {
319
+ var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(value);
320
+ if (isValueExist) {
321
+ var result = Wick.InstallerValidation.checkElementValidations(value, requirements);
322
+ return { valid: result.valid, errorType: result.errorType, error };
323
+ }
324
+ }
325
+
326
+ return { valid: true, error };
327
+ },
328
+ checkElementValidations: function (value, requirements) {
329
+ var elemRequiredCheckResult = Wick.InstallerValidation.elemRequiredCheck(value, requirements);
330
+ var elemPossibleValuesCheckResult = Wick.InstallerValidation.elemPossibleValuesCheck(value, requirements.possibleValues);
331
+ var elemRegexCheckResult = Wick.InstallerValidation.elemRegexCheck(value, requirements);
332
+ var elemMaxLengthCheckResult = Wick.InstallerValidation.elemMaxLengthCheck(value, requirements);
333
+
334
+ if (!elemRequiredCheckResult) return { valid: false, errorType: 'required' };
335
+ if (!elemPossibleValuesCheckResult || !elemRegexCheckResult || !elemMaxLengthCheckResult) return { valid: false, errorType: 'validation' };
336
+
337
+ return { valid: true };
338
+ },
339
+ runElementCallback: function (elementName, changedElemValue) {
340
+ var value = Wick.InstallerValidation.getValueByName(elementName);
341
+ var requirements = Wick.InstallerValidation.findRequirementsByName(elementName);
342
+ if (requirements.callback) {
343
+ requirements.callback(value, changedElemValue);
344
+ }
345
+ },
346
+ checkElement: function (elementName, onChange) {
347
+ var result = Wick.InstallerValidation.isElementValid(elementName);
348
+ if (result.valid) {
349
+ if (onChange) {
350
+ Wick.InstallerValidation.removeErrorNotificationFromElement(elementName);
351
+ Wick.InstallerValidation.removeGlobalErrorNotification();
352
+ }
353
+ return result;
354
+ }
355
+
356
+ Wick.InstallerValidation.addErrorNotificationToElement(elementName, result.error, true);
357
+
358
+ return result;
359
+ },
360
+ appendErrorMessage: function (wrapper, elementName, error) {
361
+ var notification = '<div' +
362
+ ' data-installer-input-name="' + elementName + '"' +
363
+ ' class="form-row__error"' +
364
+ ' >' + error.map(function (err) { return '<p>' + err + '</p>';}).join('') +
365
+ ' </div>';
366
+ wrapper.append(notification);
367
+ },
368
+ addErrorNotificationToElement: function (elementName, error, removePrevNotification) {
369
+ if (!error) return;
370
+ var element = $('[name="'+ elementName +'"]');
371
+ var wrapper = element.closest('[data-form-field]');
372
+ var prevNotification = wrapper.children('.form-row__error[data-installer-input-name="'+ elementName +'"]');
373
+ if (prevNotification.length === 0) {
374
+ Wick.InstallerValidation.appendErrorMessage(wrapper, elementName, error);
375
+ } else {
376
+ if (removePrevNotification) {
377
+ prevNotification.remove();
378
+ Wick.InstallerValidation.appendErrorMessage(wrapper, elementName, error);
379
+ }
380
+ }
381
+ },
382
+ removeErrorNotificationFromElement: function (elementName) {
383
+ var element = $('[name="'+ elementName +'"]');
384
+ var wrapper = element.closest('[data-form-field]');
385
+ var error = wrapper.children('.installer_question-error_wrapper[data-installer-input-name="'+ elementName +'"]');
386
+ var formError = wrapper.find('.form-row__error[data-installer-input-name="'+ elementName +'"]');
387
+ error.remove();
388
+ formError.remove();
389
+ },
390
+ removeAllErrorsFromStep: function (step) {
391
+ var installerBlock = $('.installer-block[data-step="'+ step +'"]');
392
+ installerBlock.find('.form-row__error').remove();
393
+ },
394
+ addGlobalErrorNotification: function (step, errorTypes) {
395
+ var wrapper = $('.installer-step-errors');
396
+ wrapper.attr('data-step', step);
397
+ wrapper.attr('data-step-error', '');
398
+ errorTypes.forEach(function (type) {
399
+ wrapper.attr(`data-error-${type}`, '');
400
+ });
401
+ },
402
+ removeGlobalErrorNotification: function () {
403
+ var wrapper = $('.installer-step-errors');
404
+ wrapper.removeAttr('data-step-error');
405
+ wrapper.removeAttr('data-error-required');
406
+ wrapper.removeAttr('data-error-validation');
407
+ },
408
+ validateStepForInstallerForm: function (step) {
409
+ Wick.InstallerValidation.removeAllErrorsFromStep(step);
410
+
411
+ var inputNames = Object.keys(Wick.InstallerValidation.steps[step]);
412
+ var results = inputNames
413
+ .map(function (elementName) {
414
+ return {
415
+ name: elementName,
416
+ result: Wick.InstallerValidation.checkElement(elementName)
417
+ };
418
+ });
419
+ var isStepInvalid = results.some(function (result) { return !result.result.valid; });
420
+ var errorTypes = results.reduce(function (prev, next) {
421
+ var result = next.result.errorType ? { [next.result.errorType]: true } : {};
422
+ return Object.assign(
423
+ prev,
424
+ result
425
+ )
426
+ }, {});
427
+ errorTypes = Object.keys(errorTypes);
428
+
429
+ if (isStepInvalid) {
430
+ var firstErrorField = results.find(function (result) { return !result.result.valid; });
431
+ Wick.InstallerValidation.scrollToField(firstErrorField.name);
432
+ Wick.InstallerValidation.addGlobalErrorNotification(step, errorTypes);
433
+ }
434
+
435
+ return !isStepInvalid;
436
+ },
437
+ scrollToField: function (name) {
438
+ var element = $('[name="'+ name +'"]:first');
439
+ var elementHeight = element.height();
440
+ $([document.documentElement, document.body]).animate({
441
+ scrollTop: element.offset().top - elementHeight
442
+ }, 1500);
443
+ },
444
+ validatemultipleFiles: function () {
445
+ var isStepsValid = Wick.multipleFiles.steps
446
+ .map(function (step) { return Wick.InstallerValidation.validateStepFormultipleFiles(step); })
447
+ .every(function (result) { return !!result; });
448
+
449
+ return isStepsValid;
450
+ }
534
451
  };
535
452
 
536
453
  // Polyfills
537
454
  if (!Array.prototype.some) {
538
- Array.prototype.some = function (fun, thisArg) {
539
- 'use strict';
455
+ Array.prototype.some = function(fun, thisArg) {
456
+ 'use strict';
540
457
 
541
- if (this == null) {
542
- throw new TypeError('Array.prototype.some called on null or undefined');
543
- }
458
+ if (this == null) {
459
+ throw new TypeError('Array.prototype.some called on null or undefined');
460
+ }
544
461
 
545
- if (typeof fun !== 'function') {
546
- throw new TypeError();
547
- }
462
+ if (typeof fun !== 'function') {
463
+ throw new TypeError();
464
+ }
548
465
 
549
- var t = Object(this);
550
- var len = t.length >>> 0;
466
+ var t = Object(this);
467
+ var len = t.length >>> 0;
551
468
 
552
- for (var i = 0; i < len; i++) {
553
- if (i in t && fun.call(thisArg, t[i], i, t)) {
554
- return true;
555
- }
556
- }
469
+ for (var i = 0; i < len; i++) {
470
+ if (i in t && fun.call(thisArg, t[i], i, t)) {
471
+ return true;
472
+ }
473
+ }
557
474
 
558
- return false;
559
- };
475
+ return false;
476
+ };
560
477
  }
561
478
 
562
479
  if (!Array.isArray) {
563
- Array.isArray = function (arg) {
564
- return Object.prototype.toString.call(arg) === '[object Array]';
565
- };
480
+ Array.isArray = function(arg) {
481
+ return Object.prototype.toString.call(arg) === '[object Array]';
482
+ };
566
483
  }
567
484
 
568
485
  if (!Array.prototype.every) {
569
- Array.prototype.every = function (callbackfn, thisArg) {
570
- 'use strict';
571
- var T, k;
572
-
573
- if (this == null) {
574
- throw new TypeError('this is null or not defined');
486
+ Array.prototype.every = function(callbackfn, thisArg) {
487
+ 'use strict';
488
+ var T, k;
489
+
490
+ if (this == null) {
491
+ throw new TypeError('this is null or not defined');
492
+ }
493
+
494
+ // 1. Let O be the result of calling ToObject passing the this
495
+ // value as the argument.
496
+ var O = Object(this);
497
+
498
+ // 2. Let lenValue be the result of calling the Get internal method
499
+ // of O with the argument "length".
500
+ // 3. Let len be ToUint32(lenValue).
501
+ var len = O.length >>> 0;
502
+
503
+ // 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
504
+ if (typeof callbackfn !== 'function' && Object.prototype.toString.call(callbackfn) !== '[object Function]') {
505
+ throw new TypeError();
506
+ }
507
+
508
+ // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
509
+ if (arguments.length > 1) {
510
+ T = thisArg;
511
+ }
512
+
513
+ // 6. Let k be 0.
514
+ k = 0;
515
+
516
+ // 7. Repeat, while k < len
517
+ while (k < len) {
518
+
519
+ var kValue;
520
+
521
+ // a. Let Pk be ToString(k).
522
+ // This is implicit for LHS operands of the in operator
523
+ // b. Let kPresent be the result of calling the HasProperty internal
524
+ // method of O with argument Pk.
525
+ // This step can be combined with c
526
+ // c. If kPresent is true, then
527
+ if (k in O) {
528
+ var testResult;
529
+ // i. Let kValue be the result of calling the Get internal method
530
+ // of O with argument Pk.
531
+ kValue = O[k];
532
+
533
+ // ii. Let testResult be the result of calling the Call internal method
534
+ // of callbackfn with T as the this value if T is not undefined
535
+ // else is the result of calling callbackfn
536
+ // and argument list containing kValue, k, and O.
537
+ if(T) testResult = callbackfn.call(T, kValue, k, O);
538
+ else testResult = callbackfn(kValue,k,O)
539
+
540
+ // iii. If ToBoolean(testResult) is false, return false.
541
+ if (!testResult) {
542
+ return false;
575
543
  }
544
+ }
545
+ k++;
546
+ }
547
+ return true;
548
+ };
549
+ }
576
550
 
577
- // 1. Let O be the result of calling ToObject passing the this
578
- // value as the argument.
579
- var O = Object(this);
580
-
581
- // 2. Let lenValue be the result of calling the Get internal method
582
- // of O with the argument "length".
583
- // 3. Let len be ToUint32(lenValue).
584
- var len = O.length >>> 0;
585
-
586
- // 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
587
- if (
588
- typeof callbackfn !== 'function' &&
589
- Object.prototype.toString.call(callbackfn) !== '[object Function]'
590
- ) {
591
- throw new TypeError();
551
+ if (!Array.prototype.reduce) {
552
+ Object.defineProperty(Array.prototype, 'reduce', {
553
+ value: function(callback /*, initialValue*/) {
554
+ if (this === null) {
555
+ throw new TypeError( 'Array.prototype.reduce ' +
556
+ 'called on null or undefined' );
557
+ }
558
+ if (typeof callback !== 'function') {
559
+ throw new TypeError( callback +
560
+ ' is not a function');
561
+ }
562
+
563
+ // 1. Let O be ? ToObject(this value).
564
+ var o = Object(this);
565
+
566
+ // 2. Let len be ? ToLength(? Get(O, "length")).
567
+ var len = o.length >>> 0;
568
+
569
+ // Steps 3, 4, 5, 6, 7
570
+ var k = 0;
571
+ var value;
572
+
573
+ if (arguments.length >= 2) {
574
+ value = arguments[1];
575
+ } else {
576
+ while (k < len && !(k in o)) {
577
+ k++;
592
578
  }
593
579
 
594
- // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
595
- if (arguments.length > 1) {
596
- T = thisArg;
580
+ // 3. If len is 0 and initialValue is not present,
581
+ // throw a TypeError exception.
582
+ if (k >= len) {
583
+ throw new TypeError( 'Reduce of empty array ' +
584
+ 'with no initial value' );
597
585
  }
598
-
599
- // 6. Let k be 0.
600
- k = 0;
601
-
602
- // 7. Repeat, while k < len
603
- while (k < len) {
604
- var kValue;
605
-
606
- // a. Let Pk be ToString(k).
607
- // This is implicit for LHS operands of the in operator
608
- // b. Let kPresent be the result of calling the HasProperty internal
609
- // method of O with argument Pk.
610
- // This step can be combined with c
611
- // c. If kPresent is true, then
612
- if (k in O) {
613
- var testResult;
614
- // i. Let kValue be the result of calling the Get internal method
615
- // of O with argument Pk.
616
- kValue = O[k];
617
-
618
- // ii. Let testResult be the result of calling the Call internal method
619
- // of callbackfn with T as the this value if T is not undefined
620
- // else is the result of calling callbackfn
621
- // and argument list containing kValue, k, and O.
622
- if (T) testResult = callbackfn.call(T, kValue, k, O);
623
- else testResult = callbackfn(kValue, k, O);
624
-
625
- // iii. If ToBoolean(testResult) is false, return false.
626
- if (!testResult) {
627
- return false;
628
- }
629
- }
630
- k++;
586
+ value = o[k++];
587
+ }
588
+
589
+ // 8. Repeat, while k < len
590
+ while (k < len) {
591
+ // a. Let Pk be ! ToString(k).
592
+ // b. Let kPresent be ? HasProperty(O, Pk).
593
+ // c. If kPresent is true, then
594
+ // i. Let kValue be ? Get(O, Pk).
595
+ // ii. Let accumulator be ? Call(
596
+ // callbackfn, undefined,
597
+ // « accumulator, kValue, k, O »).
598
+ if (k in o) {
599
+ value = callback(value, o[k], k, o);
631
600
  }
632
- return true;
633
- };
634
- }
635
601
 
636
- if (!Array.prototype.reduce) {
637
- Object.defineProperty(Array.prototype, 'reduce', {
638
- value: function (callback /*, initialValue*/) {
639
- if (this === null) {
640
- throw new TypeError('Array.prototype.reduce ' + 'called on null or undefined');
641
- }
642
- if (typeof callback !== 'function') {
643
- throw new TypeError(callback + ' is not a function');
644
- }
602
+ // d. Increase k by 1.
603
+ k++;
604
+ }
645
605
 
646
- // 1. Let O be ? ToObject(this value).
647
- var o = Object(this);
648
-
649
- // 2. Let len be ? ToLength(? Get(O, "length")).
650
- var len = o.length >>> 0;
651
-
652
- // Steps 3, 4, 5, 6, 7
653
- var k = 0;
654
- var value;
655
-
656
- if (arguments.length >= 2) {
657
- value = arguments[1];
658
- } else {
659
- while (k < len && !(k in o)) {
660
- k++;
661
- }
662
-
663
- // 3. If len is 0 and initialValue is not present,
664
- // throw a TypeError exception.
665
- if (k >= len) {
666
- throw new TypeError('Reduce of empty array ' + 'with no initial value');
667
- }
668
- value = o[k++];
669
- }
606
+ // 9. Return accumulator.
607
+ return value;
608
+ }
609
+ });
610
+ }
670
611
 
671
- // 8. Repeat, while k < len
672
- while (k < len) {
673
- // a. Let Pk be ! ToString(k).
674
- // b. Let kPresent be ? HasProperty(O, Pk).
675
- // c. If kPresent is true, then
676
- // i. Let kValue be ? Get(O, Pk).
677
- // ii. Let accumulator be ? Call(
678
- // callbackfn, undefined,
679
- // « accumulator, kValue, k, O »).
680
- if (k in o) {
681
- value = callback(value, o[k], k, o);
682
- }
683
-
684
- // d. Increase k by 1.
685
- k++;
686
- }
687
612
 
688
- // 9. Return accumulator.
689
- return value;
690
- },
691
- });
692
- }