wickes-css2 2.103.0-IC-976-pre-commit-lint.5 → 2.103.0-IC-976-pre-commit-lint.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/css/category-main.css +1 -1
- package/build/css/homepage-main.css +1 -1
- package/build/css/kitchen-plp-main.css +1 -1
- package/build/css/main.css +1 -1
- package/build/css/my-account-main-v2.css +1 -1
- package/build/css/my-account-main.css +1 -1
- package/build/css/pages/page_book-consultant-thank-you-new.css +1 -1
- package/build/css/pages/page_my-orders.css +1 -1
- package/build/css/pages/page_pre_home_thank-you.css +1 -1
- package/build/css/pages/page_top-rated.css +1 -1
- package/build/css/pdp-main-before-combine.css +1 -1
- package/build/css/pdp-main-non-critical.css +1 -1
- package/build/css/pdp-main.css +1 -1
- package/build/css/plp-main.css +1 -1
- package/build/css/store-locator-main.css +1 -1
- package/build/img/TradePaint.svg +14 -42
- package/build/img/apple-pay.svg +7 -12
- package/build/img/big-white-apple-pay.svg +5 -10
- package/build/img/billie-logo.svg +2 -4
- package/build/img/billie-modal.svg +2 -4
- package/build/img/billie-pdp.svg +9 -12
- package/build/img/billie-spinner.svg +3 -5
- package/build/img/billie.svg +1 -3
- package/build/img/clearpay-logo.svg +1 -6
- package/build/img/clearpay-spinner.svg +1 -4
- package/build/img/energy-efficiency/energy-marker.svg +1 -12
- package/build/img/google-spinner.svg +7 -14
- package/build/img/googlepay.svg +12 -23
- package/build/img/home-banner_arrow.svg +1 -7
- package/build/img/ic-menu.svg +1 -7
- package/build/img/ic_info_big.svg +1 -4
- package/build/img/klarna-big.svg +9 -18
- package/build/img/klarna-sm.svg +2 -5
- package/build/img/klarna-spinner.svg +1 -3
- package/build/img/logo-klarna.svg +2 -5
- package/build/img/mastercard.svg +3 -6
- package/build/img/payapal_text.svg +1 -6
- package/build/img/payment/checkout/applepay.svg +7 -12
- package/build/img/payment/checkout/billie.svg +2 -4
- package/build/img/payment/checkout/clearpay.svg +1 -5
- package/build/img/payment/checkout/googlepay.svg +12 -23
- package/build/img/payment/checkout/mastercard.svg +1 -13
- package/build/img/payment/checkout/paypal.svg +1 -37
- package/build/img/payment/checkout/visa.svg +1 -8
- package/build/img/payment/footer/applepay.svg +7 -12
- package/build/img/payment/footer/billie.svg +1 -3
- package/build/img/payment/footer/clearpay.svg +10 -18
- package/build/img/payment/footer/googlepay.svg +12 -23
- package/build/img/payment/footer/mastercard.svg +1 -13
- package/build/img/payment/footer/paypal.svg +1 -37
- package/build/img/payment/footer/visa.svg +1 -8
- package/build/img/paypal.svg +1 -8
- package/build/img/paypal_logo_loader_paypal.svg +1 -4
- package/build/img/paypal_logo_loader_pp.svg +1 -10
- package/build/img/placeholders/full-width-img.svg +1 -9
- package/build/img/placeholders/img-2-to-1.svg +1 -9
- package/build/img/placeholders/img-3-to-4.svg +1 -9
- package/build/img/placeholders/img-4-to-3.svg +1 -9
- package/build/img/proposition_arrow_click.svg +1 -7
- package/build/img/proposition_delivery.svg +1 -7
- package/build/img/proposition_price.svg +1 -7
- package/build/img/proposition_returns.svg +1 -7
- package/build/img/social-icon-facebook.svg +1 -8
- package/build/img/social-icon-instagram.svg +1 -15
- package/build/img/social-icon-pinterest.svg +1 -7
- package/build/img/socials/facebook.svg +1 -5
- package/build/img/socials/instagram.svg +1 -5
- package/build/img/socials/pinterest.svg +1 -5
- package/build/img/socials/tiktok.svg +1 -5
- package/build/img/socials/x-twitter.svg +1 -5
- package/build/img/socials/youtube.svg +1 -5
- package/build/img/socials_facebook_color.svg +1 -7
- package/build/img/socials_facebook_white_blue_color.svg +1 -5
- package/build/img/socials_info_big.svg +1 -7
- package/build/img/socials_instagram_color.svg +1 -16
- package/build/img/socials_pinterest_color.svg +1 -4
- package/build/img/socials_twitter_color.svg +1 -4
- package/build/img/socials_whatsapp_color.svg +1 -5
- package/build/img/socials_youtube_color.svg +1 -4
- package/build/img/stars.svg +1 -8
- package/build/img/visa-logo.svg +1 -3
- package/build/img/wickes-dc-logo.svg +13 -17
- package/build/img/wickes-logo-v2.svg +1 -15
- package/build/img/wickes-logo.svg +1 -36
- package/build/img/young-minds.svg +8 -10
- package/build/js/account-members.min.js +1 -1
- package/build/js/basket.min.js +2 -2
- package/build/js/bootstrap.bundle.min.js +1 -1
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +2 -2
- package/build/js/emulation.min.js +10325 -11858
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/iframeResizer.min.js +2 -2
- package/build/js/kitchen/kitchen-plp.min.js +1 -1
- package/build/js/merged-checkout.min.js +2 -2
- package/build/js/my-orders.min.js +1 -1
- package/build/js/page/accordion.js +29 -31
- package/build/js/page/account-deletion.js +13 -13
- package/build/js/page/account-hub.js +119 -128
- package/build/js/page/account-members.js +216 -229
- package/build/js/page/address-book.js +184 -186
- package/build/js/page/basket/add-project-list-id.js +130 -158
- package/build/js/page/basket/clearpay.js +17 -17
- package/build/js/page/basket/display-energy-efficiency.js +13 -13
- package/build/js/page/basket/gtm.js +54 -60
- package/build/js/page/basket/klarna.js +2 -2
- package/build/js/page/basket/paypal.js +33 -33
- package/build/js/page/basket/session-sync.js +5 -5
- package/build/js/page/basket/summary-mobile.js +16 -16
- package/build/js/page/basket/wisdom.js +39 -54
- package/build/js/page/basket-v2.js +261 -415
- package/build/js/page/basket.js +39 -42
- package/build/js/page/billie-business-type.js +22 -22
- package/build/js/page/business-account-form.js +12 -12
- package/build/js/page/business-pages.js +13 -0
- package/build/js/page/buying-guides-guttering.js +3 -3
- package/build/js/page/category-landing.js +11 -18
- package/build/js/page/change-password.js +99 -100
- package/build/js/page/checkout-confirmation-new.js +70 -127
- package/build/js/page/checkout-confirmation.js +6 -6
- package/build/js/page/checkout-delivery-address.js +32 -35
- package/build/js/page/checkout-delivery-details-loader.js +5 -2
- package/build/js/page/checkout-edit-address.js +1 -1
- package/build/js/page/checkout-payment-details.js +172 -170
- package/build/js/page/checkout-sign-in.js +11 -15
- package/build/js/page/checkout.js +1 -1
- package/build/js/page/cms-homepage.js +45 -87
- package/build/js/page/components/charity.js +120 -114
- package/build/js/page/components/csrf.js +4 -4
- package/build/js/page/components/discounts.js +39 -39
- package/build/js/page/components/favourite-product.js +113 -125
- package/build/js/page/components/global-search.js +192 -204
- package/build/js/page/components/modal-observer.js +46 -43
- package/build/js/page/components/order-summary.js +22 -26
- package/build/js/page/components/pagination.js +117 -124
- package/build/js/page/components/retry-action.js +2 -2
- package/build/js/page/components/saving-shopping-list.js +314 -381
- package/build/js/page/components/sticky-order-observer.js +39 -36
- package/build/js/page/components/voucher.js +47 -46
- package/build/js/page/copy-project-id.js +23 -23
- package/build/js/page/countdown-timer.js +6 -6
- package/build/js/page/default-store.js +34 -40
- package/build/js/page/design-appointment.js +3 -6
- package/build/js/page/energy-efficiency.js +25 -39
- package/build/js/page/finance-tabs.js +4 -4
- package/build/js/page/general/cookie.js +10 -20
- package/build/js/page/installation/calculator.js +16 -12
- package/build/js/page/installation/fi.js +71 -76
- package/build/js/page/installation/generic.js +20 -21
- package/build/js/page/installation/installation.js +22 -36
- package/build/js/page/installation/pdp-generic.js +9 -3
- package/build/js/page/installation/ti.js +24 -26
- package/build/js/page/installer-files-form.js +76 -98
- package/build/js/page/installer-form.js +447 -502
- package/build/js/page/installer-validation.js +761 -848
- package/build/js/page/instore-checkout.js +2 -2
- package/build/js/page/kitchen/card-carousel.js +21 -21
- package/build/js/page/kitchen/colour-swatches.js +149 -153
- package/build/js/page/kitchen/kitchen-card.js +64 -62
- package/build/js/page/kitchen/mobile-nav.js +27 -26
- package/build/js/page/kitchen/plp-filters-chips.js +70 -72
- package/build/js/page/kitchen/plp-filters-mobile.js +60 -64
- package/build/js/page/kitchen/plp-filters-panel.js +102 -106
- package/build/js/page/kitchen/plp-filters-utils.js +53 -54
- package/build/js/page/kitchen/plp-filters.js +194 -210
- package/build/js/page/kitchen/sort-by.js +149 -149
- package/build/js/page/klarna-modal-scroll-disable.js +4 -4
- package/build/js/page/merged-checkout.js +3 -6
- package/build/js/page/my-account.js +46 -44
- package/build/js/page/my-orders.js +149 -153
- package/build/js/page/online-exclusive.js +31 -28
- package/build/js/page/pdp-favourite.js +4 -4
- package/build/js/page/pdp-tile.js +4 -0
- package/build/js/page/pdp.js +37 -41
- package/build/js/page/personal-details.js +277 -307
- package/build/js/page/plp-cards-v2.js +25 -39
- package/build/js/page/plp-favourite.js +9 -9
- package/build/js/page/plp-img-v2.js +3 -2
- package/build/js/page/plp-load-more.js +66 -66
- package/build/js/page/plp.js +10 -9
- package/build/js/page/pre-home.js +144 -159
- package/build/js/page/project-list/generate-project-id.js +68 -77
- package/build/js/page/project-list-note.js +232 -234
- package/build/js/page/project-list.js +3 -2
- package/build/js/page/quiz.js +292 -292
- package/build/js/page/select-address.js +14 -27
- package/build/js/page/smart-banner.js +5 -8
- package/build/js/page/ti.js +42 -67
- package/build/js/page/top-rated.js +29 -36
- package/build/js/page/track-my-order.js +156 -172
- package/build/js/page/tradePro-rewards.js +36 -34
- package/build/js/page/utils/array-utils.js +10 -13
- package/build/js/page/utils/copy-to-clipboard.js +45 -45
- package/build/js/page/utils/create-event.js +8 -8
- package/build/js/page/utils/errorMesages.js +11 -12
- package/build/js/page/utils/helpers.js +9 -14
- package/build/js/page/utils/http-action.js +5 -4
- package/build/js/page/utils/loader.js +5 -5
- package/build/js/page/utils/routes.js +9 -9
- package/build/js/page/utils/url-query.js +4 -4
- package/build/js/page/utils/validation.js +96 -93
- package/build/js/page/wickes-dc.js +44 -51
- package/build/js/page/wismo.js +12 -12
- package/build/js/page/your-details.js +41 -77
- package/build/js/pdp-favourite-product.bundle.min.js +1 -1
- package/build/js/pdp.bundle.min.js +1 -1
- package/build/js/personal-details.min.js +1 -1
- package/build/js/plp-favourite-product.bundle.min.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/project-list.min.js +16 -16
- package/build/js/pstrength.min.js +34 -28
- package/build/js/wickers.json +2069 -2069
- package/package.json +3 -8
- package/src/data/data_account-families.json +1 -1
- package/src/data/data_bathroom-installation.json +1 -1
- package/src/data/data_bathroom-ranges.json +14 -14
- package/src/data/data_business-pages.json +27 -27
- package/src/data/data_calendar.json +1 -7
- package/src/data/data_checkout-order.json +306 -306
- package/src/data/data_contact-us-form.json +17 -17
- package/src/data/data_contact-us-reasons.json +16 -16
- package/src/data/data_design-appointment.json +12 -27
- package/src/data/data_discounts.json +4 -4
- package/src/data/data_fdl-new-product.json +6 -6
- package/src/data/data_fdl-product.json +87 -75
- package/src/data/data_flooring-installation.json +6 -6
- package/src/data/data_great-quality.json +2 -2
- package/src/data/data_heating-plumbing.json +2 -2
- package/src/data/data_how-to_fit-corrugated-sheeting.json +258 -245
- package/src/data/data_journey-price-lists.json +1 -1
- package/src/data/data_kb-brouchure-requests.json +10 -10
- package/src/data/data_kitchen-brochure-request.json +1 -1
- package/src/data/data_kitchen-cabinets.json +1 -1
- package/src/data/data_kitchen-plp.json +18 -24
- package/src/data/data_kitchen-ranges.json +23 -21
- package/src/data/data_latest-offers.json +1044 -1044
- package/src/data/data_locators.json +132 -130
- package/src/data/data_next-steps.json +20 -20
- package/src/data/data_notification-page.json +24 -72
- package/src/data/data_online-ranges.json +1 -1
- package/src/data/data_page-category-hub.json +1 -1
- package/src/data/data_page-confirmation.json +9 -9
- package/src/data/data_page-project-multiple-list.json +18 -18
- package/src/data/data_pre-home.json +1082 -1090
- package/src/data/data_price-event-new.json +1 -1
- package/src/data/data_saved-project-list.json +8 -8
- package/src/data/data_seo-widgets.json +31 -31
- package/src/data/data_shopping-cart-v2.json +2 -1
- package/src/data/data_shopping-cart-with-energy.json +229 -229
- package/src/data/data_storage-solutions.json +99 -99
- package/src/data/data_tile-installation.json +1 -1
- package/src/data/data_top-rated-perfect-product.json +204 -204
- package/src/data/data_trade-essentials.json +1 -1
- package/src/data/data_tradePro_cards.json +1 -0
- package/src/data/data_user-address-saved.json +33 -33
- package/src/data/data_voucher_tradePro.json +5 -5
- package/src/data/data_wismo.json +12 -12
- package/src/data/how-to-guides/data-how_to_fit-bath-and-taps.json +2 -2
- package/src/data/how-to-guides/data_how-to-change-door-window-furniture.json +274 -274
- package/src/data/how-to-guides/data_how-to-fit-door-locks.json +8 -3
- package/src/data/how-to-guides/data_how-to-fit-worktop.json +13 -5
- package/src/data/how-to-guides/data_how-to-fit_basin-and-taps.json +6 -2
- package/src/data/how-to-guides/data_how-to-fit_bath-and-taps.json +10 -3
- package/src/data/how-to-guides/data_how-to-plumb-a-kitchen-appliance.json +7 -3
- package/src/data/how-to-guides/data_how-to-unblock-sink.json +7 -5
- package/src/data/how-to-guides/data_how-to_bleed-radiator.json +134 -134
- package/src/data/how-to-guides/data_how-to_build-raised-deck.json +4 -4
- package/src/data/how-to-guides/data_how-to_change-socket.json +2 -2
- package/src/data/how-to-guides/data_how-to_fit-guttering.json +282 -282
- package/src/data/how-to-guides/data_how-to_fit-toilet.json +2 -2
- package/src/data/how-to-guides/data_how-to_fit-wall-tiles.json +23 -77
- package/src/data/how-to-guides/data_how-to_fit-worktops.json +4 -3
- package/src/data/how-to-guides/data_how-to_fix-leaking-sink.json +3 -3
- package/src/data/how-to-guides/data_how-to_fix-leaking-tap.json +3 -3
- package/src/data/how-to-guides/data_how-to_garden-calendar.json +5 -4
- package/src/data/how-to-guides/data_how-to_grow-fruit-veg.json +3 -3
- package/src/data/how-to-guides/data_how-to_hang-internal-door.json +266 -266
- package/src/data/how-to-guides/data_how-to_install-artificial-grass.json +4 -3
- package/src/data/how-to-guides/data_how-to_install-base-wall-cabinets.json +4 -3
- package/src/data/how-to-guides/data_how-to_install-composite-decking.json +14 -6
- package/src/data/how-to-guides/data_how-to_install-deck-lighting.json +7 -4
- package/src/data/how-to-guides/data_how-to_install-fence.json +5 -5
- package/src/data/how-to-guides/data_how-to_insulate-loft.json +2 -2
- package/src/data/how-to-guides/data_how-to_lay-deck.json +6 -4
- package/src/data/how-to-guides/data_how-to_lay-laminate-flooring.json +8 -3
- package/src/data/how-to-guides/data_how-to_lay-maintain-turf.json +4 -4
- package/src/data/how-to-guides/data_how-to_lay-path.json +6 -5
- package/src/data/how-to-guides/data_how-to_lay-patio.json +5 -5
- package/src/data/how-to-guides/data_how-to_lay-solid-wood-flooring.json +8 -0
- package/src/data/how-to-guides/data_how-to_lay-vinyl-carpet-tiles.json +3 -3
- package/src/data/how-to-guides/data_how-to_paint-a-room.json +5 -5
- package/src/data/how-to-guides/data_how-to_plaster-wall.json +6 -8
- package/src/data/how-to-guides/data_how-to_plumb-kitchen-appliances.json +3 -3
- package/src/data/how-to-guides/data_how-to_prepare-interior-woodwork.json +5 -5
- package/src/data/how-to-guides/data_how-to_prepare-paint-exterior-walls.json +1 -1
- package/src/data/how-to-guides/data_how-to_prepare-wall-and-ceilings.json +9 -9
- package/src/data/how-to-guides/data_how-to_put_up_shelf.json +4 -4
- package/src/data/how-to-guides/data_how-to_remove-replace-tiles.json +3 -3
- package/src/data/how-to-guides/data_how-to_repair-wall.json +385 -384
- package/src/data/how-to-guides/data_how-to_tile-bathroom.json +4 -3
- package/src/data/how-to-guides/data_how-to_unblock-sink.json +3 -3
- package/src/data/how-to-guides/data_install-composite-decking.json +4 -4
- package/src/data/how-to-guides/data_planting-techniques.json +3 -3
- package/src/data/how-to-guides/fit-roofing-shingles.json +4 -4
- package/src/data/how-to-guides/hubs/data_how-to_hub_home.json +1 -1
- package/src/data/my-account/data_address-book.json +3 -12
- package/src/data/my-account/data_my-order.json +1 -1
- package/src/data/my-account/data_personal-details.json +8 -32
- package/src/data/navigation.json +805 -1016
- package/src/data/page_how-to-choose-your-doors.json +2 -1
- package/src/data/public/wickers.json +2069 -2069
- package/src/img/TradePaint.svg +14 -42
- package/src/img/apple-pay.svg +7 -12
- package/src/img/big-white-apple-pay.svg +5 -10
- package/src/img/billie-logo.svg +2 -4
- package/src/img/billie-modal.svg +2 -4
- package/src/img/billie-pdp.svg +9 -12
- package/src/img/billie-spinner.svg +3 -5
- package/src/img/billie.svg +1 -3
- package/src/img/clearpay-logo.svg +1 -6
- package/src/img/clearpay-spinner.svg +1 -4
- package/src/img/energy-efficiency/energy-marker.svg +1 -12
- package/src/img/google-spinner.svg +7 -14
- package/src/img/googlepay.svg +12 -23
- package/src/img/home-banner_arrow.svg +1 -7
- package/src/img/ic-menu.svg +1 -7
- package/src/img/ic_info_big.svg +1 -4
- package/src/img/klarna-big.svg +9 -18
- package/src/img/klarna-sm.svg +2 -5
- package/src/img/klarna-spinner.svg +1 -3
- package/src/img/logo-klarna.svg +2 -5
- package/src/img/mastercard.svg +3 -6
- package/src/img/payapal_text.svg +1 -6
- package/src/img/payment/checkout/applepay.svg +7 -12
- package/src/img/payment/checkout/billie.svg +2 -4
- package/src/img/payment/checkout/clearpay.svg +1 -5
- package/src/img/payment/checkout/googlepay.svg +12 -23
- package/src/img/payment/checkout/mastercard.svg +1 -13
- package/src/img/payment/checkout/paypal.svg +1 -37
- package/src/img/payment/checkout/visa.svg +1 -8
- package/src/img/payment/footer/applepay.svg +7 -12
- package/src/img/payment/footer/billie.svg +1 -3
- package/src/img/payment/footer/clearpay.svg +10 -18
- package/src/img/payment/footer/googlepay.svg +12 -23
- package/src/img/payment/footer/mastercard.svg +1 -13
- package/src/img/payment/footer/paypal.svg +1 -37
- package/src/img/payment/footer/visa.svg +1 -8
- package/src/img/paypal.svg +1 -8
- package/src/img/paypal_logo_loader_paypal.svg +1 -4
- package/src/img/paypal_logo_loader_pp.svg +1 -10
- package/src/img/placeholders/full-width-img.svg +1 -9
- package/src/img/placeholders/img-2-to-1.svg +1 -9
- package/src/img/placeholders/img-3-to-4.svg +1 -9
- package/src/img/placeholders/img-4-to-3.svg +1 -9
- package/src/img/proposition_arrow_click.svg +1 -7
- package/src/img/proposition_delivery.svg +1 -7
- package/src/img/proposition_price.svg +1 -7
- package/src/img/proposition_returns.svg +1 -7
- package/src/img/social-icon-facebook.svg +1 -8
- package/src/img/social-icon-instagram.svg +1 -15
- package/src/img/social-icon-pinterest.svg +1 -7
- package/src/img/socials/facebook.svg +1 -5
- package/src/img/socials/instagram.svg +1 -5
- package/src/img/socials/pinterest.svg +1 -5
- package/src/img/socials/tiktok.svg +1 -5
- package/src/img/socials/x-twitter.svg +1 -5
- package/src/img/socials/youtube.svg +1 -5
- package/src/img/socials_facebook_color.svg +1 -7
- package/src/img/socials_facebook_white_blue_color.svg +1 -5
- package/src/img/socials_info_big.svg +1 -7
- package/src/img/socials_instagram_color.svg +1 -16
- package/src/img/socials_pinterest_color.svg +1 -4
- package/src/img/socials_twitter_color.svg +1 -4
- package/src/img/socials_whatsapp_color.svg +1 -5
- package/src/img/socials_youtube_color.svg +1 -4
- package/src/img/stars.svg +1 -8
- package/src/img/visa-logo.svg +1 -3
- package/src/img/wickes-dc-logo.svg +13 -17
- package/src/img/wickes-logo-v2.svg +1 -15
- package/src/img/wickes-logo.svg +1 -36
- package/src/img/young-minds.svg +8 -10
- package/src/js/components/anchors-scroll.js +6 -9
- package/src/js/components/badge-cashback.js +6 -5
- package/src/js/components/banner-placement-manager.js +232 -269
- package/src/js/components/card-color-slider.js +29 -29
- package/src/js/components/card-slider.js +73 -78
- package/src/js/components/cards-slider.js +58 -64
- package/src/js/components/charity-donations.js +4 -3
- package/src/js/components/checkout_your-details.js +67 -68
- package/src/js/components/clamp.js +32 -47
- package/src/js/components/click-disable.js +7 -7
- package/src/js/components/date-selection.js +37 -50
- package/src/js/components/file-loader.js +33 -33
- package/src/js/components/finance.js +4 -3
- package/src/js/components/flatpickr.js +149 -135
- package/src/js/components/gallery-pdp.js +98 -97
- package/src/js/components/gallery-range.js +109 -107
- package/src/js/components/general/accordion.js +29 -31
- package/src/js/components/general/back-to-top.js +37 -40
- package/src/js/components/general/backdrop.js +15 -15
- package/src/js/components/general/cart-slider.js +12 -15
- package/src/js/components/general/clamp-content.js +80 -80
- package/src/js/components/general/clamp.js +38 -53
- package/src/js/components/general/clear-input.js +25 -25
- package/src/js/components/general/cookie-chat-back.js +13 -19
- package/src/js/components/general/cookies-policy.js +5 -5
- package/src/js/components/general/create-popup-slider.js +175 -169
- package/src/js/components/general/device-type.js +3 -3
- package/src/js/components/general/footer.js +52 -82
- package/src/js/components/general/handleAccordion.js +28 -28
- package/src/js/components/general/is-trade-pro.js +9 -15
- package/src/js/components/general/main-nav.js +8 -8
- package/src/js/components/general/main-navigation.js +73 -67
- package/src/js/components/general/mini-basket-slider.js +6 -6
- package/src/js/components/general/notification.js +40 -58
- package/src/js/components/general/offer-banner.js +58 -58
- package/src/js/components/general/scroll-disable.js +44 -45
- package/src/js/components/general/search-filter.js +16 -16
- package/src/js/components/general/search.js +29 -27
- package/src/js/components/general/snack-bar.js +11 -20
- package/src/js/components/general/sticky_header.js +7 -8
- package/src/js/components/general/switchVat.js +154 -154
- package/src/js/components/general/text-clamp.js +16 -14
- package/src/js/components/general/tooltips.js +2 -2
- package/src/js/components/general/validation.js +41 -47
- package/src/js/components/leave-event.js +113 -116
- package/src/js/components/loader.js +11 -11
- package/src/js/components/modal-slider.js +52 -57
- package/src/js/components/order-item-cc.js +69 -59
- package/src/js/components/pdp-read-more.js +11 -7
- package/src/js/components/pdp-video.js +2 -2
- package/src/js/components/pwdstrength.js +17 -13
- package/src/js/components/range-cards.js +12 -12
- package/src/js/components/range-types.js +11 -11
- package/src/js/components/scrollbar.js +20 -23
- package/src/js/components/share-project-list.js +5 -4
- package/src/js/components/show-more-less.js +2 -2
- package/src/js/components/similar-slider.js +10 -19
- package/src/js/components/sticky-aside.js +83 -84
- package/src/js/components/store-locator-facilities.js +15 -17
- package/src/js/components/tabs.js +17 -16
- package/src/js/components/toggle-password-visibility.js +50 -50
- package/src/js/components/tradepro-notification-copy.js +6 -5
- package/src/js/components/voucher-remove.js +2 -1
- package/src/js/components/wisdom.js +26 -35
- package/src/js/components/zoom.js +59 -67
- package/src/js/emulation/account-hub.js +40 -40
- package/src/js/emulation/account-members.js +36 -37
- package/src/js/emulation/add-project-list-id-local.js +18 -24
- package/src/js/emulation/add.to.any.customisation.js +38 -44
- package/src/js/emulation/autocomplete.js +114 -123
- package/src/js/emulation/banner-placement-manager.js +35 -40
- package/src/js/emulation/basket-data.js +2037 -2123
- package/src/js/emulation/basket.js +57 -58
- package/src/js/emulation/big-wins.js +903 -1079
- package/src/js/emulation/chat-bot.js +14 -14
- package/src/js/emulation/checkLocalEnv.js +4 -4
- package/src/js/emulation/checkout-delivery-details.js +25 -28
- package/src/js/emulation/checkout-payment-details.js +37 -46
- package/src/js/emulation/checkout-sign-in-emulation.js +33 -36
- package/src/js/emulation/checkout_your-details.js +46 -47
- package/src/js/emulation/click-and-collect-modal.js +20 -18
- package/src/js/emulation/cnc-notifications.js +10 -9
- package/src/js/emulation/custom-slider-emulation.js +17 -16
- package/src/js/emulation/date-selection.js +25 -25
- package/src/js/emulation/default-store.js +86 -92
- package/src/js/emulation/favourite-product-local.js +29 -31
- package/src/js/emulation/find-address.js +42 -41
- package/src/js/emulation/footer-date.js +3 -6
- package/src/js/emulation/forms.js +308 -352
- package/src/js/emulation/generate-project-id-local.js +23 -26
- package/src/js/emulation/global-search-local.js +122 -125
- package/src/js/emulation/google-maps-store-info.js +29 -25
- package/src/js/emulation/home-movers.js +49 -47
- package/src/js/emulation/input-file.js +558 -638
- package/src/js/emulation/kitchen-plp-data.js +3670 -4528
- package/src/js/emulation/loadMore.js +14 -13
- package/src/js/emulation/main-nav-data.js +848 -1058
- package/src/js/emulation/mini-basket.js +34 -34
- package/src/js/emulation/mini-cart.js +11 -12
- package/src/js/emulation/mock.js +23 -23
- package/src/js/emulation/my-orders-local.js +30 -30
- package/src/js/emulation/paymentLoader.js +16 -16
- package/src/js/emulation/pdf-file-loader.js +90 -88
- package/src/js/emulation/pdp.js +12 -18
- package/src/js/emulation/personal-details-local.js +56 -57
- package/src/js/emulation/plp-load-more.js +13 -16
- package/src/js/emulation/popover-mini-basket.js +238 -244
- package/src/js/emulation/project-list-multiple.js +18 -24
- package/src/js/emulation/project-list-pdp.js +316 -319
- package/src/js/emulation/project-list-print.js +40 -43
- package/src/js/emulation/quiz-local.js +11 -11
- package/src/js/emulation/reference-field.js +7 -2
- package/src/js/emulation/selectable.js +18 -19
- package/src/js/emulation/shopping-list.js +17 -19
- package/src/js/emulation/sign-up.js +21 -17
- package/src/js/emulation/store-locator-list.js +13 -11
- package/src/js/emulation/switchCalendar.js +8 -12
- package/src/js/emulation/total-amount-loader.js +13 -14
- package/src/js/emulation/user.js +32 -32
- package/src/js/emulation/vat-toggle.js +1 -1
- package/src/js/emulation/wickes-responsive.js +189 -178
- package/src/js/emulation/wismo-details.js +30 -22
- package/src/js/emulation/your-details.js +22 -34
- package/src/js/helpers/jquery.cookiebar.js +192 -270
- package/src/js/helpers/responsive.js +69 -69
- package/src/js/helpers/safari-back.js +4 -4
- package/src/js/libs/bootstrap.bundle.min.js +1 -1
- package/src/js/libs/iframeResizer.min.js +2 -2
- package/src/js/libs/jquery.pstrength.custom-1.2.0.js +34 -28
- package/src/js/libs/simplebar.js +3 -3
- package/src/js/page/accordion.js +29 -31
- package/src/js/page/account-deletion.js +13 -13
- package/src/js/page/account-hub.js +119 -128
- package/src/js/page/account-members.js +216 -229
- package/src/js/page/address-book.js +184 -186
- package/src/js/page/basket/add-project-list-id.js +130 -158
- package/src/js/page/basket/clearpay.js +17 -17
- package/src/js/page/basket/display-energy-efficiency.js +13 -13
- package/src/js/page/basket/gtm.js +54 -60
- package/src/js/page/basket/klarna.js +2 -2
- package/src/js/page/basket/paypal.js +33 -33
- package/src/js/page/basket/session-sync.js +5 -5
- package/src/js/page/basket/summary-mobile.js +16 -16
- package/src/js/page/basket/wisdom.js +39 -54
- package/src/js/page/basket-v2.js +261 -415
- package/src/js/page/basket.js +39 -42
- package/src/js/page/billie-business-type.js +22 -22
- package/src/js/page/business-account-form.js +12 -12
- package/src/js/page/business-pages.js +13 -0
- package/src/js/page/buying-guides-guttering.js +3 -3
- package/src/js/page/category-landing.js +11 -18
- package/src/js/page/change-password.js +99 -100
- package/src/js/page/checkout-confirmation-new.js +70 -127
- package/src/js/page/checkout-confirmation.js +6 -6
- package/src/js/page/checkout-delivery-address.js +32 -35
- package/src/js/page/checkout-delivery-details-loader.js +5 -2
- package/src/js/page/checkout-edit-address.js +1 -1
- package/src/js/page/checkout-payment-details.js +172 -170
- package/src/js/page/checkout-sign-in.js +11 -15
- package/src/js/page/checkout.js +1 -1
- package/src/js/page/cms-homepage.js +45 -87
- package/src/js/page/components/charity.js +120 -114
- package/src/js/page/components/csrf.js +4 -4
- package/src/js/page/components/discounts.js +39 -39
- package/src/js/page/components/favourite-product.js +113 -125
- package/src/js/page/components/global-search.js +192 -204
- package/src/js/page/components/modal-observer.js +46 -43
- package/src/js/page/components/order-summary.js +22 -26
- package/src/js/page/components/pagination.js +117 -124
- package/src/js/page/components/retry-action.js +2 -2
- package/src/js/page/components/saving-shopping-list.js +314 -381
- package/src/js/page/components/sticky-order-observer.js +39 -36
- package/src/js/page/components/voucher.js +47 -46
- package/src/js/page/copy-project-id.js +23 -23
- package/src/js/page/countdown-timer.js +6 -6
- package/src/js/page/default-store.js +34 -40
- package/src/js/page/design-appointment.js +3 -6
- package/src/js/page/energy-efficiency.js +25 -39
- package/src/js/page/finance-tabs.js +4 -4
- package/src/js/page/general/cookie.js +10 -20
- package/src/js/page/installation/calculator.js +16 -12
- package/src/js/page/installation/fi.js +71 -76
- package/src/js/page/installation/generic.js +20 -21
- package/src/js/page/installation/installation.js +22 -36
- package/src/js/page/installation/pdp-generic.js +9 -3
- package/src/js/page/installation/ti.js +24 -26
- package/src/js/page/installer-files-form.js +76 -98
- package/src/js/page/installer-form.js +447 -502
- package/src/js/page/installer-validation.js +761 -848
- package/src/js/page/instore-checkout.js +2 -2
- package/src/js/page/kitchen/card-carousel.js +21 -21
- package/src/js/page/kitchen/colour-swatches.js +149 -153
- package/src/js/page/kitchen/kitchen-card.js +64 -62
- package/src/js/page/kitchen/mobile-nav.js +27 -26
- package/src/js/page/kitchen/plp-filters-chips.js +70 -72
- package/src/js/page/kitchen/plp-filters-mobile.js +60 -64
- package/src/js/page/kitchen/plp-filters-panel.js +102 -106
- package/src/js/page/kitchen/plp-filters-utils.js +53 -54
- package/src/js/page/kitchen/plp-filters.js +194 -210
- package/src/js/page/kitchen/sort-by.js +149 -149
- package/src/js/page/klarna-modal-scroll-disable.js +4 -4
- package/src/js/page/merged-checkout.js +3 -6
- package/src/js/page/my-account.js +46 -44
- package/src/js/page/my-orders.js +149 -153
- package/src/js/page/online-exclusive.js +31 -28
- package/src/js/page/pdp-favourite.js +4 -4
- package/src/js/page/pdp-tile.js +4 -0
- package/src/js/page/pdp.js +37 -41
- package/src/js/page/personal-details.js +277 -307
- package/src/js/page/plp-cards-v2.js +25 -39
- package/src/js/page/plp-favourite.js +9 -9
- package/src/js/page/plp-img-v2.js +3 -2
- package/src/js/page/plp-load-more.js +66 -66
- package/src/js/page/plp.js +10 -9
- package/src/js/page/pre-home.js +144 -159
- package/src/js/page/project-list/generate-project-id.js +68 -77
- package/src/js/page/project-list-note.js +232 -234
- package/src/js/page/project-list.js +3 -2
- package/src/js/page/quiz.js +292 -292
- package/src/js/page/select-address.js +14 -27
- package/src/js/page/smart-banner.js +5 -8
- package/src/js/page/ti.js +42 -67
- package/src/js/page/top-rated.js +29 -36
- package/src/js/page/track-my-order.js +156 -172
- package/src/js/page/tradePro-rewards.js +36 -34
- package/src/js/page/utils/array-utils.js +10 -13
- package/src/js/page/utils/copy-to-clipboard.js +45 -45
- package/src/js/page/utils/create-event.js +8 -8
- package/src/js/page/utils/errorMesages.js +11 -12
- package/src/js/page/utils/helpers.js +9 -14
- package/src/js/page/utils/http-action.js +5 -4
- package/src/js/page/utils/loader.js +5 -5
- package/src/js/page/utils/routes.js +9 -9
- package/src/js/page/utils/url-query.js +4 -4
- package/src/js/page/utils/validation.js +96 -93
- package/src/js/page/wickes-dc.js +44 -51
- package/src/js/page/wismo.js +12 -12
- package/src/js/page/your-details.js +41 -77
- package/src/layouts/app_sticky_header.hbs +1 -0
- package/src/scss/barclays-paypage-combined.css +585 -585
- package/src/scss/barclays-paypage-desktop.css +496 -496
- package/src/scss/barclays-paypage-mobile.css +494 -494
- package/src/scss/category-main.scss +2 -8
- package/src/scss/common/_cat-common.scss +0 -1
- package/src/scss/common/_plp-common.scss +0 -1
- package/src/scss/components/_billie-modal.scss +2 -2
- package/src/scss/components/_card.scss +0 -1
- package/src/scss/components/_custom-slider.scss +6 -6
- package/src/scss/components/_find-a-store.scss +0 -1
- package/src/scss/components/_gallery-pdp-critical.scss +2 -2
- package/src/scss/components/_kitchen-card.scss +2 -2
- package/src/scss/components/_notifications-critical.scss +2 -2
- package/src/scss/components/_offer-banner.scss +0 -1
- package/src/scss/components/_order-summary.scss +1 -1
- package/src/scss/components/_page-overlay.scss +1 -1
- package/src/scss/components/_price-block.scss +0 -1
- package/src/scss/components/_price.scss +1 -1
- package/src/scss/components/_range-card.scss +1 -0
- package/src/scss/components/_recommended.scss +1 -0
- package/src/scss/components/_rewards.scss +1 -1
- package/src/scss/components/_share-list-modal.scss +1 -1
- package/src/scss/components/_shopping-list-note.scss +1 -1
- package/src/scss/components/_steps-three.scss +1 -1
- package/src/scss/components/_steps.scss +2 -2
- package/src/scss/components/_tc-generic.scss +1 -1
- package/src/scss/components/_thank-you-modal.scss +1 -3
- package/src/scss/components/_ti-total-area.scss +1 -1
- package/src/scss/components/_user-address-delivery.scss +1 -1
- package/src/scss/components/kitchen/_price.scss +1 -1
- package/src/scss/components/my-account/_contacts.scss +1 -3
- package/src/scss/components/special-opening-schedule-v2.scss +3 -3
- package/src/scss/components/special-opening-schedule.scss +2 -2
- package/src/scss/helpers/_colors-semantic.scss +120 -0
- package/src/scss/helpers/_variables.scss +155 -158
- package/src/scss/helpers/helpers-pdp-critical/_elements-critical-pdp.scss +0 -1
- package/src/scss/helpers/helpers-pdp-critical/_helpers-critical-pdp.scss +0 -4
- package/src/scss/libs/_bootstrap-extracted.scss +8 -26
- package/src/scss/libs/_cat-libs.scss +10 -10
- package/src/scss/libs/_font-awesome-icons.scss +0 -2
- package/src/scss/libs/_homepage-libs.scss +12 -12
- package/src/scss/libs/_plp-libs.scss +11 -11
- package/src/scss/libs/_skeleton.scss +5 -5
- package/src/scss/libs/_store-locator-libs.scss +1 -1
- package/src/scss/libs/flatpickr.scss +4 -4
- package/src/scss/libs/simplebar.css +3 -3
- package/src/scss/libs/swiper.css +384 -479
- package/src/scss/main.scss +70 -140
- package/src/scss/my-account-main-v2.scss +19 -38
- package/src/scss/my-account-main.scss +19 -38
- package/src/scss/pages/_checkout-confirmation-new.scss +2 -2
- package/src/scss/pages/_checkout-widget.scss +1 -1
- package/src/scss/pages/_checkout_your-details.scss +0 -1
- package/src/scss/pages/_facets.scss +86 -0
- package/src/scss/pages/checkout-new.scss +0 -1
- package/src/scss/pages/checkout.scss +0 -1
- package/src/scss/pages/iframe-paypage.scss +8 -9
- package/src/scss/pages/page_book-consultant-thank-you-new.scss +2 -2
- package/src/scss/pages/page_installer.scss +2 -2
- package/src/scss/pages/page_my-account_tradePro.scss +1 -1
- package/src/scss/pages/page_new-checkout_login-register.scss +1 -1
- package/src/scss/pages/page_pre_home_thank-you.scss +2 -2
- package/src/scss/pages/page_product-details-critical.scss +0 -1
- package/src/scss/pages/page_products-list-combined.scss +0 -4
- package/src/scss/pages/page_store-locator-details.scss +1 -1
- package/src/scss/pages/page_top-rated.scss +14 -14
- package/src/scss/pages/page_wismo-details.scss +1 -1
- package/src/scss/pages/tradePro-rewards-old.scss +1 -1
- package/src/scss/partials/_breadcrumbs-critical.scss +2 -2
- package/src/scss/partials/_breadcrumbs.scss +2 -2
- package/src/scss/partials/_header-critical.scss +1 -1
- package/src/scss/partials/_header.scss +1 -1
- package/src/scss/partials/_main-nav.scss +2 -2
- package/src/scss/store-locator-main.scss +0 -3
|
@@ -1,895 +1,808 @@
|
|
|
1
1
|
var Wick = Wick || {};
|
|
2
2
|
|
|
3
3
|
Wick.InstallerValidation = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
installationsNumber_kitchen: {
|
|
21
|
-
dependsOnInput: 'installationTypes',
|
|
22
|
-
dependsOnValue: ['kitchens'],
|
|
23
|
-
required: true,
|
|
24
|
-
possibleValues: [
|
|
25
|
-
'kitchen_installer_application_6-10_completed',
|
|
26
|
-
'kitchen_installer_application_11_or_more_completed',
|
|
27
|
-
],
|
|
28
|
-
error: [
|
|
29
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Kitchen Installer any further at this time if you haven't completed at least 6 installations in the last 12 months.",
|
|
30
|
-
'You can however, apply to become Wickes Approved Installer for another installation type if you have met this criteria. Please deselect Kitchen to continue.',
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
canArrangePreviousWorks_kitchen: {
|
|
34
|
-
dependsOnInput: 'installationTypes',
|
|
35
|
-
dependsOnValue: ['kitchens'],
|
|
36
|
-
required: true,
|
|
37
|
-
possibleValues: ['installer_application_kitchen_installation_viewings_yes'],
|
|
38
|
-
error: [
|
|
39
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Kitchen Installer any further at this time if you are unable to arrange for 2 x viewings of your previous work over the last 12 months.",
|
|
40
|
-
'You can however, apply to become Wickes Approved Installer for another installation type if you can meet this criteria. Please deselect Kitchen to continue.',
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
gasSafeRegistration: {
|
|
44
|
-
dependsOnInput: 'installationTypes',
|
|
45
|
-
dependsOnValue: ['kitchens'],
|
|
46
|
-
required: true,
|
|
47
|
-
possibleValues: [
|
|
48
|
-
'gas_safe_kitchen_installer_application_yes_not_a_subcontractor',
|
|
49
|
-
'gas_safe_kitchen_installer_application_yes_subcontractor',
|
|
50
|
-
],
|
|
51
|
-
error: [
|
|
52
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Kitchen Installer at this this time if your business does not have Gas Safe qualified engineer.",
|
|
53
|
-
'If this changes however, we look forward to receiving a further application from you in the future.',
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
hasSolidWorktopsExperience: {
|
|
57
|
-
dependsOnInput: 'installationTypes',
|
|
58
|
-
dependsOnValue: ['kitchens'],
|
|
59
|
-
required: true,
|
|
60
|
-
},
|
|
61
|
-
installationsNumber_bathroom: {
|
|
62
|
-
dependsOnInput: 'installationTypes',
|
|
63
|
-
dependsOnValue: ['bathrooms'],
|
|
64
|
-
required: true,
|
|
65
|
-
possibleValues: [
|
|
66
|
-
'bathroom_installer_application_6-10_installations_completed',
|
|
67
|
-
'bathroom_installer_application_11_or_more_installations_completed',
|
|
68
|
-
],
|
|
69
|
-
error: [
|
|
70
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Bathroom Installer any further at this time if you haven't completed at least 6 installations in the last 12 months.",
|
|
71
|
-
'You can however, apply to become Wickes Approved Installer for another installation type if you have met this criteria. Please deselect Bathroom to continue.',
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
canArrangePreviousWorks_bathroom: {
|
|
75
|
-
dependsOnInput: 'installationTypes',
|
|
76
|
-
dependsOnValue: ['bathrooms'],
|
|
77
|
-
required: true,
|
|
78
|
-
possibleValues: ['installer_application_bathroom_installation_viewings_yes'],
|
|
79
|
-
error: [
|
|
80
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Bathroom Installer any further at this time if you are unable to arrange for 2 x viewings of your previous work over the last 12 months.",
|
|
81
|
-
'You can however, apply to become Wickes Approved Installer for another installation type if you can meet this criteria. Please deselect Bathroom to continue.',
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
installationsNumber_flooring: {
|
|
85
|
-
dependsOnInput: 'installationTypes',
|
|
86
|
-
dependsOnValue: ['flooring'],
|
|
87
|
-
required: true,
|
|
88
|
-
possibleValues: [
|
|
89
|
-
'flooring_installer_application_6-10_installations_completed',
|
|
90
|
-
'flooring_installer_application_11_or_more_completed',
|
|
91
|
-
],
|
|
92
|
-
error: [
|
|
93
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Flooring Installer any further at this time if you haven't completed at least 6 installations in the last 12 months.",
|
|
94
|
-
'You can however, apply to become Wickes Approved Installer for another installation type if you have met this criteria. Please deselect Flooring to continue.',
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
canArrangePreviousWorks_flooring: {
|
|
98
|
-
dependsOnInput: 'installationTypes',
|
|
99
|
-
dependsOnValue: ['flooring'],
|
|
100
|
-
required: true,
|
|
101
|
-
possibleValues: ['installer_application_flooring_installation_viewings_yes'],
|
|
102
|
-
error: [
|
|
103
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Flooring Installer any further at this time if you are unable to arrange for 2 x viewings of your previous work over the last 12 months.",
|
|
104
|
-
'You can however, apply to become Wickes Approved Installer for another installation type if you can meet this criteria. Please deselect Flooring to continue.',
|
|
105
|
-
],
|
|
106
|
-
},
|
|
107
|
-
flooringTypes: {
|
|
108
|
-
dependsOnInput: 'installationTypes',
|
|
109
|
-
dependsOnValue: ['flooring'],
|
|
110
|
-
required: true,
|
|
111
|
-
},
|
|
112
|
-
installers_flooring: {
|
|
113
|
-
dependsOnInput: 'installationTypes',
|
|
114
|
-
dependsOnValue: ['flooring'],
|
|
115
|
-
required: true,
|
|
116
|
-
},
|
|
117
|
-
installationsNumber_tiling: {
|
|
118
|
-
dependsOnInput: 'installationTypes',
|
|
119
|
-
dependsOnValue: ['tiling'],
|
|
120
|
-
required: true,
|
|
121
|
-
possibleValues: [
|
|
122
|
-
'tiling_installer_application_6-10_completed',
|
|
123
|
-
'tiling_installer_application_11_or_more_completed',
|
|
124
|
-
],
|
|
125
|
-
error: [
|
|
126
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Tiling Installer any further at this time if you haven't completed at least 6 installations in the last 12 months.",
|
|
127
|
-
'You can however, apply to become Wickes Approved Installer for another installation type if you have met this criteria. Please deselect Tiling to continue.',
|
|
128
|
-
],
|
|
129
|
-
},
|
|
130
|
-
canArrangePreviousWorks_tiling: {
|
|
131
|
-
dependsOnInput: 'installationTypes',
|
|
132
|
-
dependsOnValue: ['tiling'],
|
|
133
|
-
required: true,
|
|
134
|
-
possibleValues: ['installer_application_tiling_installation_viewings_yes'],
|
|
135
|
-
error: [
|
|
136
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Tiling Installer any further at this time if you are unable to arrange for 2 x viewings of your previous work over the last 12 months.",
|
|
137
|
-
'You can however, apply to become Wickes Approved Installer for another installation type if you can meet this criteria. Please deselect Tiling to continue.',
|
|
138
|
-
],
|
|
139
|
-
},
|
|
140
|
-
tilingTypes: {
|
|
141
|
-
dependsOnInput: 'installationTypes',
|
|
142
|
-
dependsOnValue: ['tiling'],
|
|
143
|
-
required: true,
|
|
144
|
-
},
|
|
145
|
-
installers_tiling: {
|
|
146
|
-
dependsOnInput: 'installationTypes',
|
|
147
|
-
dependsOnValue: ['tiling'],
|
|
148
|
-
required: true,
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
['2']: {
|
|
152
|
-
businessType: {
|
|
153
|
-
required: true,
|
|
154
|
-
callback: function (value) {
|
|
155
|
-
var incorporationWrapper = $('[name="hasCompanyIncorporationCertificate"]');
|
|
156
|
-
var utrWrapper = $('[name="hasUtrNumber"]');
|
|
157
|
-
if (value === 'sole_trader') {
|
|
158
|
-
incorporationWrapper.closest('.installer_question-wrap').slideUp();
|
|
159
|
-
utrWrapper.closest('.installer_question-wrap').slideDown();
|
|
160
|
-
} else {
|
|
161
|
-
incorporationWrapper.closest('.installer_question-wrap').slideDown();
|
|
162
|
-
utrWrapper.closest('.installer_question-wrap').slideUp();
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
hasVatCertificate: {
|
|
167
|
-
required: true,
|
|
168
|
-
possibleValues: [
|
|
169
|
-
'installer_application_vat_registered_yes',
|
|
170
|
-
'installer_application_vat_registered_no',
|
|
171
|
-
],
|
|
172
|
-
callback: function (value) {
|
|
173
|
-
var elementsToHide = ['vatCertificate'];
|
|
174
|
-
elementsToHide.forEach(function (field) {
|
|
175
|
-
var wrapper = $('[name="' + field + '"]');
|
|
176
|
-
if (value === 'installer_application_vat_registered_yes') {
|
|
177
|
-
wrapper.closest('.installer_question-wrap').slideDown();
|
|
178
|
-
} else {
|
|
179
|
-
wrapper.closest('.installer_question-wrap').slideUp();
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
hasLiabilityInsurance: {
|
|
185
|
-
required: true,
|
|
186
|
-
possibleValues: ['installer_application_public_liability_yes'],
|
|
187
|
-
error: [
|
|
188
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Installer at this this time if your business does not have public liability insurance of at least £2 million.",
|
|
189
|
-
'If this changes however, we look forward to receiving a further application from you in the future.',
|
|
190
|
-
],
|
|
191
|
-
},
|
|
192
|
-
liabilityInsurance: {
|
|
193
|
-
required: false,
|
|
194
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
195
|
-
error: ['Invalid image source.'],
|
|
196
|
-
},
|
|
197
|
-
hasAsbestosAwarenessCertificate: {
|
|
198
|
-
required: true,
|
|
199
|
-
possibleValues: [
|
|
200
|
-
'installer_application_completed_asbestos_awareness_course_yes',
|
|
201
|
-
'installer_application_completed_asbestos_awareness_course_no',
|
|
202
|
-
],
|
|
203
|
-
},
|
|
204
|
-
asbestosAwarenessCertificate: {
|
|
205
|
-
required: false,
|
|
206
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
207
|
-
error: ['Invalid image source.'],
|
|
208
|
-
},
|
|
209
|
-
hasPartPCertificate: {
|
|
210
|
-
required: true,
|
|
211
|
-
possibleValues: ['installer_application_part_p_yes'],
|
|
212
|
-
error: [
|
|
213
|
-
"Unfortunately we can't progress your application to become a Wickes Approved Installer at this this time if your business does not have a Part P qualified electrician.",
|
|
214
|
-
'If this changes however, we look forward to receiving a further application from you in the future.',
|
|
215
|
-
],
|
|
216
|
-
},
|
|
217
|
-
partPCertificateFront: {
|
|
218
|
-
required: false,
|
|
219
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
220
|
-
error: ['Invalid image source.'],
|
|
221
|
-
},
|
|
222
|
-
partPCertificateBack: {
|
|
223
|
-
required: false,
|
|
224
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
225
|
-
error: ['Invalid image source.'],
|
|
226
|
-
},
|
|
227
|
-
gasSafeCert: {
|
|
228
|
-
dependsOnInput: 'installationTypes',
|
|
229
|
-
dependsOnValue: ['kitchens'],
|
|
230
|
-
required: true,
|
|
231
|
-
possibleValues: ['gasSafeCert_yes', 'gasSafeCert_no'],
|
|
232
|
-
},
|
|
233
|
-
gasSafeCertificate: {
|
|
234
|
-
required: false,
|
|
235
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
236
|
-
error: ['Invalid image source.'],
|
|
237
|
-
},
|
|
238
|
-
gasSafeCard: {
|
|
239
|
-
dependsOnInput: 'installationTypes',
|
|
240
|
-
dependsOnValue: ['kitchens'],
|
|
241
|
-
required: true,
|
|
242
|
-
possibleValues: ['gasSafeCard_yes', 'gasSafeCard_no'],
|
|
243
|
-
},
|
|
244
|
-
gasSafeCardFront: {
|
|
245
|
-
required: false,
|
|
246
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
247
|
-
error: ['Invalid image source.'],
|
|
248
|
-
},
|
|
249
|
-
gasSafeCardBack: {
|
|
250
|
-
required: false,
|
|
251
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
252
|
-
error: ['Invalid image source.'],
|
|
253
|
-
},
|
|
254
|
-
hasCompanyIncorporationCertificate: {
|
|
255
|
-
dependsOnInput: 'businessType',
|
|
256
|
-
dependsOnValue: ['partnership', 'ltd_company', 'ltd_liability_partnership'],
|
|
257
|
-
required: true,
|
|
258
|
-
possibleValues: [
|
|
259
|
-
'installer_application_company_incorporation_cert_yes',
|
|
260
|
-
'installer_application_company_incorporation_cert_no',
|
|
261
|
-
],
|
|
262
|
-
},
|
|
263
|
-
companyIncorporationCertificate: {
|
|
264
|
-
required: false,
|
|
265
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
266
|
-
error: ['Invalid image source.'],
|
|
267
|
-
},
|
|
268
|
-
vat_registered_partner: {
|
|
269
|
-
dependsOnInput: 'vat_registered_partner',
|
|
270
|
-
dependsOnValue: ['installer_application_vat_registered_yes'],
|
|
271
|
-
required: true,
|
|
272
|
-
possibleValues: ['vat_registered_partner_yes', 'vat_registered_partner_no'],
|
|
273
|
-
},
|
|
274
|
-
vatCertificate: {
|
|
275
|
-
required: false,
|
|
276
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
277
|
-
error: ['Invalid image source.'],
|
|
278
|
-
},
|
|
279
|
-
hasUtrNumber: {
|
|
280
|
-
dependsOnInput: 'businessType',
|
|
281
|
-
dependsOnValue: ['sole_trader'],
|
|
282
|
-
required: true,
|
|
283
|
-
possibleValues: ['installer_application_utr_yes', 'installer_application_utr_no'],
|
|
284
|
-
},
|
|
285
|
-
utrNumberCopy: {
|
|
286
|
-
required: false,
|
|
287
|
-
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
288
|
-
error: ['Invalid image source.'],
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
['3']: {
|
|
292
|
-
title: {
|
|
293
|
-
required: true,
|
|
294
|
-
error: ['Please select a title'],
|
|
295
|
-
},
|
|
296
|
-
firstName: {
|
|
297
|
-
required: true,
|
|
298
|
-
regex: "^[\\w ()\/&.,‘’`´'-]+$",
|
|
299
|
-
maxLength: 255,
|
|
300
|
-
error: ['Please enter a first name'],
|
|
301
|
-
},
|
|
302
|
-
lastName: {
|
|
303
|
-
required: true,
|
|
304
|
-
regex: "^[\\w ()\/&.,‘’`´'-]+$",
|
|
305
|
-
maxLength: 255,
|
|
306
|
-
error: ['Please enter a surname'],
|
|
307
|
-
},
|
|
308
|
-
email: {
|
|
309
|
-
required: true,
|
|
310
|
-
regex: '^[\\w\\+-]+(\\.[\\w-]+)*@([A-Za-z\\d]+([A-Za-z\\d-]+(\\.[A-Za-z\\d]+)*(\\.[A-Za-z]{2,}))|(?:(?:25[0-5]|2[0-4][\\d]|[01]?[\\d][\\d]?)\\.){3}(?:25[0-5]|2[0-4][\\d]|[01]?[\\d][\\d]?))$',
|
|
311
|
-
maxLength: 255,
|
|
312
|
-
error: ['Please enter a valid email address e.g. user@domain.co.uk\n'],
|
|
313
|
-
},
|
|
314
|
-
mobileNumber: {
|
|
315
|
-
required: true,
|
|
316
|
-
regex: '^07{1}\\d{9}$|^07{1}\\d{3}\\s{1}\\d{6}$|^07{1}\\d{1}\\s{1}\\d{4}\\s{1}\\d{4}$|^07{1}\\d{2}\\s{1}\\d{3}\\s{1}\\d{4}$',
|
|
317
|
-
error: ['Please enter a valid mobile number with no spaces e.g. 07700900000'],
|
|
318
|
-
},
|
|
319
|
-
businessName: {
|
|
320
|
-
required: true,
|
|
321
|
-
regex: '^[A-Za-z0-9\\s&@£$€¥:;,.‘\'’`´\\"()\\[\\]{}<>!«»“?/\\\\=*#%+-]{1,100}$',
|
|
322
|
-
error: ['Please enter a business name'],
|
|
323
|
-
},
|
|
324
|
-
line1: {
|
|
325
|
-
required: true,
|
|
326
|
-
regex: "^[\\w ()\/&.,'-]{1,255}$",
|
|
327
|
-
error: ['Please enter address line 1'],
|
|
328
|
-
},
|
|
329
|
-
line2: {
|
|
330
|
-
required: false,
|
|
331
|
-
regex: "^[\\w ()\/&.,'-]{0,255}$",
|
|
332
|
-
error: ['Please enter address line 2'],
|
|
333
|
-
},
|
|
334
|
-
town: {
|
|
335
|
-
required: true,
|
|
336
|
-
regex: "^[\\w ()\/&.,'-]{1,255}$",
|
|
337
|
-
error: ['Please enter a town/city'],
|
|
338
|
-
},
|
|
339
|
-
postCode: {
|
|
340
|
-
required: true,
|
|
341
|
-
regex: '^([A-Za-z]{1,2}[0-9]{1,2}[A-Za-z]?)\\s*([0-9][A-Za-z]{2})$',
|
|
342
|
-
error: ['Please enter a valid postcode'],
|
|
343
|
-
},
|
|
344
|
-
additionalInstallationTypes: {
|
|
345
|
-
required: true,
|
|
346
|
-
callback: function (value, changedElemValue) {
|
|
347
|
-
if (
|
|
348
|
-
changedElemValue === 'installer_application_other_works_none_of_the_above'
|
|
349
|
-
) {
|
|
350
|
-
$(
|
|
351
|
-
'[name="additionalInstallationTypes"]:not([value="installer_application_other_works_none_of_the_above"])'
|
|
352
|
-
).prop('checked', false);
|
|
353
|
-
} else {
|
|
354
|
-
$(
|
|
355
|
-
'[name="additionalInstallationTypes"][value="installer_application_other_works_none_of_the_above"]'
|
|
356
|
-
).prop('checked', false);
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
},
|
|
360
|
-
preferences: {
|
|
361
|
-
required: false,
|
|
362
|
-
},
|
|
363
|
-
termsAgreement: {
|
|
364
|
-
required: true,
|
|
365
|
-
},
|
|
366
|
-
},
|
|
367
|
-
},
|
|
368
|
-
findRequirementsByName: function (elementName) {
|
|
369
|
-
var step = $('[name="' + elementName + '"]')
|
|
370
|
-
.closest('.installer-block')
|
|
371
|
-
.attr('data-step');
|
|
372
|
-
return Wick.InstallerValidation.steps[step][elementName];
|
|
373
|
-
},
|
|
374
|
-
getValueByName: function (elementName) {
|
|
375
|
-
var element = $('[name="' + elementName + '"]');
|
|
376
|
-
var type = element.attr('type');
|
|
377
|
-
|
|
378
|
-
if (element.prop('tagName') === 'SELECT') {
|
|
379
|
-
return element.val();
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
switch (type) {
|
|
383
|
-
case 'radio':
|
|
384
|
-
return $('[name="' + elementName + '"]:checked').val();
|
|
385
|
-
case 'checkbox':
|
|
386
|
-
return $('[name="' + elementName + '"]:checked')
|
|
387
|
-
.map(function () {
|
|
388
|
-
return $(this).val();
|
|
389
|
-
})
|
|
390
|
-
.get();
|
|
391
|
-
case 'file':
|
|
392
|
-
return element.attr('data-value');
|
|
393
|
-
default:
|
|
394
|
-
return element.val().trim();
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
isInputValueNotEmpty: function (value) {
|
|
398
|
-
if (typeof value === 'string') return !!value;
|
|
399
|
-
if (Array.isArray(value)) return value.length > 0;
|
|
400
|
-
|
|
401
|
-
return false;
|
|
402
|
-
},
|
|
403
|
-
elemDependsCheck: function (dependentValue, requirements) {
|
|
404
|
-
var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(dependentValue);
|
|
405
|
-
if (isValueExist) {
|
|
406
|
-
if (requirements.dependsOnValue) {
|
|
407
|
-
if (typeof dependentValue === 'string' || Array.isArray(dependentValue)) {
|
|
408
|
-
return Wick.InstallerValidation.elemPossibleValuesCheck(
|
|
409
|
-
dependentValue,
|
|
410
|
-
requirements.dependsOnValue
|
|
411
|
-
);
|
|
412
|
-
} else {
|
|
413
|
-
return false;
|
|
414
|
-
}
|
|
4
|
+
steps: {
|
|
5
|
+
['1']: {
|
|
6
|
+
installationTypes: {
|
|
7
|
+
required: true,
|
|
8
|
+
callback: function (value) {
|
|
9
|
+
var elementsToHide = ['gasSafeCard', 'gasSafeCert'];
|
|
10
|
+
elementsToHide.forEach(function (field) {
|
|
11
|
+
var wrapper = $('[name="'+ field +'"]');
|
|
12
|
+
if (value.indexOf('kitchens') >= 0) {
|
|
13
|
+
wrapper.closest('.installer_question-wrap').slideDown();
|
|
14
|
+
} else {
|
|
15
|
+
wrapper.closest('.installer_question-wrap').slideUp();
|
|
415
16
|
}
|
|
416
|
-
|
|
417
|
-
return false;
|
|
17
|
+
})
|
|
418
18
|
}
|
|
419
|
-
|
|
420
|
-
|
|
19
|
+
},
|
|
20
|
+
installationsNumber_kitchen: {
|
|
21
|
+
dependsOnInput: 'installationTypes',
|
|
22
|
+
dependsOnValue: ['kitchens'],
|
|
23
|
+
required: true,
|
|
24
|
+
possibleValues: [
|
|
25
|
+
'kitchen_installer_application_6-10_completed',
|
|
26
|
+
'kitchen_installer_application_11_or_more_completed'
|
|
27
|
+
],
|
|
28
|
+
error: [
|
|
29
|
+
'Unfortunately we can\'t progress your application to become a Wickes Approved Kitchen Installer any further at this time if you haven\'t completed at least 6 installations in the last 12 months.',
|
|
30
|
+
'You can however, apply to become Wickes Approved Installer for another installation type if you have met this criteria. Please deselect Kitchen to continue.'
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
canArrangePreviousWorks_kitchen: {
|
|
34
|
+
dependsOnInput: 'installationTypes',
|
|
35
|
+
dependsOnValue: ['kitchens'],
|
|
36
|
+
required: true,
|
|
37
|
+
possibleValues: ['installer_application_kitchen_installation_viewings_yes'],
|
|
38
|
+
error: [
|
|
39
|
+
'Unfortunately we can\'t progress your application to become a Wickes Approved Kitchen Installer any further at this time if you are unable to arrange for 2 x viewings of your previous work over the last 12 months.',
|
|
40
|
+
'You can however, apply to become Wickes Approved Installer for another installation type if you can meet this criteria. Please deselect Kitchen to continue.'
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
gasSafeRegistration: {
|
|
44
|
+
dependsOnInput: 'installationTypes',
|
|
45
|
+
dependsOnValue: ['kitchens'],
|
|
46
|
+
required: true,
|
|
47
|
+
possibleValues: ['gas_safe_kitchen_installer_application_yes_not_a_subcontractor', 'gas_safe_kitchen_installer_application_yes_subcontractor'],
|
|
48
|
+
error: [
|
|
49
|
+
'Unfortunately we can\'t progress your application to become a Wickes Approved Kitchen Installer at this this time if your business does not have Gas Safe qualified engineer.',
|
|
50
|
+
'If this changes however, we look forward to receiving a further application from you in the future.'
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
hasSolidWorktopsExperience: {
|
|
54
|
+
dependsOnInput: 'installationTypes',
|
|
55
|
+
dependsOnValue: ['kitchens'],
|
|
56
|
+
required: true
|
|
57
|
+
},
|
|
58
|
+
installationsNumber_bathroom: {
|
|
59
|
+
dependsOnInput: 'installationTypes',
|
|
60
|
+
dependsOnValue: ['bathrooms'],
|
|
61
|
+
required: true,
|
|
62
|
+
possibleValues: [
|
|
63
|
+
'bathroom_installer_application_6-10_installations_completed',
|
|
64
|
+
'bathroom_installer_application_11_or_more_installations_completed'
|
|
65
|
+
],
|
|
66
|
+
error: [
|
|
67
|
+
'Unfortunately we can\'t progress your application to become a Wickes Approved Bathroom Installer any further at this time if you haven\'t completed at least 6 installations in the last 12 months.',
|
|
68
|
+
'You can however, apply to become Wickes Approved Installer for another installation type if you have met this criteria. Please deselect Bathroom to continue.'
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
canArrangePreviousWorks_bathroom: {
|
|
72
|
+
dependsOnInput: 'installationTypes',
|
|
73
|
+
dependsOnValue: ['bathrooms'],
|
|
74
|
+
required: true,
|
|
75
|
+
possibleValues: ['installer_application_bathroom_installation_viewings_yes'],
|
|
76
|
+
error: [
|
|
77
|
+
'Unfortunately we can\'t progress your application to become a Wickes Approved Bathroom Installer any further at this time if you are unable to arrange for 2 x viewings of your previous work over the last 12 months.',
|
|
78
|
+
'You can however, apply to become Wickes Approved Installer for another installation type if you can meet this criteria. Please deselect Bathroom to continue.'
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
installationsNumber_flooring: {
|
|
82
|
+
dependsOnInput: 'installationTypes',
|
|
83
|
+
dependsOnValue: ['flooring'],
|
|
84
|
+
required: true,
|
|
85
|
+
possibleValues: [
|
|
86
|
+
'flooring_installer_application_6-10_installations_completed',
|
|
87
|
+
'flooring_installer_application_11_or_more_completed'
|
|
88
|
+
],
|
|
89
|
+
error: [
|
|
90
|
+
'Unfortunately we can\'t progress your application to become a Wickes Approved Flooring Installer any further at this time if you haven\'t completed at least 6 installations in the last 12 months.',
|
|
91
|
+
'You can however, apply to become Wickes Approved Installer for another installation type if you have met this criteria. Please deselect Flooring to continue.'
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
canArrangePreviousWorks_flooring: {
|
|
95
|
+
dependsOnInput: 'installationTypes',
|
|
96
|
+
dependsOnValue: ['flooring'],
|
|
97
|
+
required: true,
|
|
98
|
+
possibleValues: ['installer_application_flooring_installation_viewings_yes'],
|
|
99
|
+
error: [
|
|
100
|
+
'Unfortunately we can\'t progress your application to become a Wickes Approved Flooring Installer any further at this time if you are unable to arrange for 2 x viewings of your previous work over the last 12 months.',
|
|
101
|
+
'You can however, apply to become Wickes Approved Installer for another installation type if you can meet this criteria. Please deselect Flooring to continue.'
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
flooringTypes: {
|
|
105
|
+
dependsOnInput: 'installationTypes',
|
|
106
|
+
dependsOnValue: ['flooring'],
|
|
107
|
+
required: true
|
|
108
|
+
},
|
|
109
|
+
installers_flooring: {
|
|
110
|
+
dependsOnInput: 'installationTypes',
|
|
111
|
+
dependsOnValue: ['flooring'],
|
|
112
|
+
required: true
|
|
113
|
+
},
|
|
114
|
+
installationsNumber_tiling: {
|
|
115
|
+
dependsOnInput: 'installationTypes',
|
|
116
|
+
dependsOnValue: ['tiling'],
|
|
117
|
+
required: true,
|
|
118
|
+
possibleValues: [
|
|
119
|
+
'tiling_installer_application_6-10_completed',
|
|
120
|
+
'tiling_installer_application_11_or_more_completed'
|
|
121
|
+
],
|
|
122
|
+
error: [
|
|
123
|
+
'Unfortunately we can\'t progress your application to become a Wickes Approved Tiling Installer any further at this time if you haven\'t completed at least 6 installations in the last 12 months.',
|
|
124
|
+
'You can however, apply to become Wickes Approved Installer for another installation type if you have met this criteria. Please deselect Tiling to continue.'
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
canArrangePreviousWorks_tiling: {
|
|
128
|
+
dependsOnInput: 'installationTypes',
|
|
129
|
+
dependsOnValue: ['tiling'],
|
|
130
|
+
required: true,
|
|
131
|
+
possibleValues: ['installer_application_tiling_installation_viewings_yes'],
|
|
132
|
+
error: [
|
|
133
|
+
'Unfortunately we can\'t progress your application to become a Wickes Approved Tiling Installer any further at this time if you are unable to arrange for 2 x viewings of your previous work over the last 12 months.',
|
|
134
|
+
'You can however, apply to become Wickes Approved Installer for another installation type if you can meet this criteria. Please deselect Tiling to continue.'
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
tilingTypes: {
|
|
138
|
+
dependsOnInput: 'installationTypes',
|
|
139
|
+
dependsOnValue: ['tiling'],
|
|
140
|
+
required: true
|
|
141
|
+
},
|
|
142
|
+
installers_tiling: {
|
|
143
|
+
dependsOnInput: 'installationTypes',
|
|
144
|
+
dependsOnValue: ['tiling'],
|
|
145
|
+
required: true
|
|
146
|
+
}
|
|
421
147
|
},
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
148
|
+
['2']: {
|
|
149
|
+
businessType: {
|
|
150
|
+
required: true,
|
|
151
|
+
callback: function (value) {
|
|
152
|
+
var incorporationWrapper = $('[name="hasCompanyIncorporationCertificate"]');
|
|
153
|
+
var utrWrapper = $('[name="hasUtrNumber"]');
|
|
154
|
+
if (value === 'sole_trader') {
|
|
155
|
+
incorporationWrapper.closest('.installer_question-wrap').slideUp();
|
|
156
|
+
utrWrapper.closest('.installer_question-wrap').slideDown();
|
|
157
|
+
} else {
|
|
158
|
+
incorporationWrapper.closest('.installer_question-wrap').slideDown();
|
|
159
|
+
utrWrapper.closest('.installer_question-wrap').slideUp();
|
|
160
|
+
}
|
|
426
161
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
var isValid = value
|
|
440
|
-
.map(function (arrayValue) {
|
|
441
|
-
return possibleValues.indexOf(arrayValue) >= 0;
|
|
442
|
-
})
|
|
443
|
-
.some(function (result) {
|
|
444
|
-
return !!result;
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
if (!isValid) {
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
162
|
+
},
|
|
163
|
+
hasVatCertificate: {
|
|
164
|
+
required: true,
|
|
165
|
+
possibleValues: ['installer_application_vat_registered_yes', 'installer_application_vat_registered_no'],
|
|
166
|
+
callback: function (value) {
|
|
167
|
+
var elementsToHide = ['vatCertificate'];
|
|
168
|
+
elementsToHide.forEach(function (field) {
|
|
169
|
+
var wrapper = $('[name="'+ field +'"]');
|
|
170
|
+
if (value === 'installer_application_vat_registered_yes') {
|
|
171
|
+
wrapper.closest('.installer_question-wrap').slideDown();
|
|
172
|
+
} else {
|
|
173
|
+
wrapper.closest('.installer_question-wrap').slideUp();
|
|
451
174
|
}
|
|
175
|
+
})
|
|
452
176
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
177
|
+
},
|
|
178
|
+
hasLiabilityInsurance: {
|
|
179
|
+
required: true,
|
|
180
|
+
possibleValues: ['installer_application_public_liability_yes'],
|
|
181
|
+
error: ['Unfortunately we can\'t progress your application to become a Wickes Approved Installer at this this time if your business does not have public liability insurance of at least £2 million.', 'If this changes however, we look forward to receiving a further application from you in the future.']
|
|
182
|
+
},
|
|
183
|
+
liabilityInsurance: {
|
|
184
|
+
required: false,
|
|
185
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
186
|
+
error: ['Invalid image source.']
|
|
187
|
+
},
|
|
188
|
+
hasAsbestosAwarenessCertificate: {
|
|
189
|
+
required: true,
|
|
190
|
+
possibleValues: ['installer_application_completed_asbestos_awareness_course_yes', 'installer_application_completed_asbestos_awareness_course_no']
|
|
191
|
+
},
|
|
192
|
+
asbestosAwarenessCertificate: {
|
|
193
|
+
required: false,
|
|
194
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
195
|
+
error: ['Invalid image source.']
|
|
196
|
+
},
|
|
197
|
+
hasPartPCertificate: {
|
|
198
|
+
required: true,
|
|
199
|
+
possibleValues: ['installer_application_part_p_yes'],
|
|
200
|
+
error: ['Unfortunately we can\'t progress your application to become a Wickes Approved Installer at this this time if your business does not have a Part P qualified electrician.', 'If this changes however, we look forward to receiving a further application from you in the future.']
|
|
201
|
+
},
|
|
202
|
+
partPCertificateFront: {
|
|
203
|
+
required: false,
|
|
204
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
205
|
+
error: ['Invalid image source.']
|
|
206
|
+
},
|
|
207
|
+
partPCertificateBack: {
|
|
208
|
+
required: false,
|
|
209
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
210
|
+
error: ['Invalid image source.']
|
|
211
|
+
},
|
|
212
|
+
gasSafeCert: {
|
|
213
|
+
dependsOnInput: 'installationTypes',
|
|
214
|
+
dependsOnValue: ['kitchens'],
|
|
215
|
+
required: true,
|
|
216
|
+
possibleValues: ['gasSafeCert_yes', 'gasSafeCert_no']
|
|
217
|
+
},
|
|
218
|
+
gasSafeCertificate: {
|
|
219
|
+
required: false,
|
|
220
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
221
|
+
error: ['Invalid image source.']
|
|
222
|
+
},
|
|
223
|
+
gasSafeCard: {
|
|
224
|
+
dependsOnInput: 'installationTypes',
|
|
225
|
+
dependsOnValue: ['kitchens'],
|
|
226
|
+
required: true,
|
|
227
|
+
possibleValues: ['gasSafeCard_yes', 'gasSafeCard_no']
|
|
228
|
+
},
|
|
229
|
+
gasSafeCardFront: {
|
|
230
|
+
required: false,
|
|
231
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
232
|
+
error: ['Invalid image source.']
|
|
233
|
+
},
|
|
234
|
+
gasSafeCardBack: {
|
|
235
|
+
required: false,
|
|
236
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
237
|
+
error: ['Invalid image source.']
|
|
238
|
+
},
|
|
239
|
+
hasCompanyIncorporationCertificate: {
|
|
240
|
+
dependsOnInput: 'businessType',
|
|
241
|
+
dependsOnValue: ['partnership', 'ltd_company', 'ltd_liability_partnership'],
|
|
242
|
+
required: true,
|
|
243
|
+
possibleValues: ['installer_application_company_incorporation_cert_yes', 'installer_application_company_incorporation_cert_no'],
|
|
244
|
+
},
|
|
245
|
+
companyIncorporationCertificate: {
|
|
246
|
+
required: false,
|
|
247
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
248
|
+
error: ['Invalid image source.']
|
|
249
|
+
},
|
|
250
|
+
vat_registered_partner: {
|
|
251
|
+
dependsOnInput: 'vat_registered_partner',
|
|
252
|
+
dependsOnValue: ['installer_application_vat_registered_yes'],
|
|
253
|
+
required: true,
|
|
254
|
+
possibleValues: ['vat_registered_partner_yes', 'vat_registered_partner_no'],
|
|
255
|
+
},
|
|
256
|
+
vatCertificate: {
|
|
257
|
+
required: false,
|
|
258
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
259
|
+
error: ['Invalid image source.']
|
|
260
|
+
},
|
|
261
|
+
hasUtrNumber: {
|
|
262
|
+
dependsOnInput: 'businessType',
|
|
263
|
+
dependsOnValue: ['sole_trader'],
|
|
264
|
+
required: true,
|
|
265
|
+
possibleValues: ['installer_application_utr_yes', 'installer_application_utr_no'],
|
|
266
|
+
},
|
|
267
|
+
utrNumberCopy: {
|
|
268
|
+
required: false,
|
|
269
|
+
regex: '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(:[0-9]{2,5})?(\/.*)?$',
|
|
270
|
+
error: ['Invalid image source.']
|
|
271
|
+
}
|
|
461
272
|
},
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
273
|
+
['3']: {
|
|
274
|
+
title: {
|
|
275
|
+
required: true,
|
|
276
|
+
error: ['Please select a title']
|
|
277
|
+
},
|
|
278
|
+
firstName: {
|
|
279
|
+
required: true,
|
|
280
|
+
regex: "^[\\w ()\/&.,‘’`´'-]+$",
|
|
281
|
+
maxLength: 255,
|
|
282
|
+
error: ['Please enter a first name']
|
|
283
|
+
},
|
|
284
|
+
lastName: {
|
|
285
|
+
required: true,
|
|
286
|
+
regex: "^[\\w ()\/&.,‘’`´'-]+$",
|
|
287
|
+
maxLength: 255,
|
|
288
|
+
error: ['Please enter a surname']
|
|
289
|
+
},
|
|
290
|
+
email: {
|
|
291
|
+
required: true,
|
|
292
|
+
regex: '^[\\w\\+-]+(\\.[\\w-]+)*@([A-Za-z\\d]+([A-Za-z\\d-]+(\\.[A-Za-z\\d]+)*(\\.[A-Za-z]{2,}))|(?:(?:25[0-5]|2[0-4][\\d]|[01]?[\\d][\\d]?)\\.){3}(?:25[0-5]|2[0-4][\\d]|[01]?[\\d][\\d]?))$',
|
|
293
|
+
maxLength: 255,
|
|
294
|
+
error: ['Please enter a valid email address e.g. user@domain.co.uk\n']
|
|
295
|
+
},
|
|
296
|
+
mobileNumber: {
|
|
297
|
+
required: true,
|
|
298
|
+
regex: '^07{1}\\d{9}$|^07{1}\\d{3}\\s{1}\\d{6}$|^07{1}\\d{1}\\s{1}\\d{4}\\s{1}\\d{4}$|^07{1}\\d{2}\\s{1}\\d{3}\\s{1}\\d{4}$',
|
|
299
|
+
error: ['Please enter a valid mobile number with no spaces e.g. 07700900000']
|
|
300
|
+
},
|
|
301
|
+
businessName: {
|
|
302
|
+
required: true,
|
|
303
|
+
regex: '^[A-Za-z0-9\\s&@£$€¥:;,.‘\'’`´\\"()\\[\\]{}<>!«»“?/\\\\=*#%+-]{1,100}$',
|
|
304
|
+
error: ['Please enter a business name']
|
|
305
|
+
},
|
|
306
|
+
line1: {
|
|
307
|
+
required: true,
|
|
308
|
+
regex: '^[\\w ()\/&.,\'-]{1,255}$',
|
|
309
|
+
error: ['Please enter address line 1'],
|
|
310
|
+
},
|
|
311
|
+
line2: {
|
|
312
|
+
required: false,
|
|
313
|
+
regex: '^[\\w ()\/&.,\'-]{0,255}$',
|
|
314
|
+
error: ['Please enter address line 2'],
|
|
315
|
+
},
|
|
316
|
+
town: {
|
|
317
|
+
required: true,
|
|
318
|
+
regex: '^[\\w ()\/&.,\'-]{1,255}$',
|
|
319
|
+
error: ['Please enter a town/city']
|
|
320
|
+
},
|
|
321
|
+
postCode: {
|
|
322
|
+
required: true,
|
|
323
|
+
regex: '^([A-Za-z]{1,2}[0-9]{1,2}[A-Za-z]?)\\s*([0-9][A-Za-z]{2})$',
|
|
324
|
+
error: ['Please enter a valid postcode']
|
|
325
|
+
},
|
|
326
|
+
additionalInstallationTypes: {
|
|
327
|
+
required: true,
|
|
328
|
+
callback: function (value, changedElemValue) {
|
|
329
|
+
if (changedElemValue === 'installer_application_other_works_none_of_the_above') {
|
|
330
|
+
$('[name="additionalInstallationTypes"]:not([value="installer_application_other_works_none_of_the_above"])').prop('checked', false);
|
|
331
|
+
} else {
|
|
332
|
+
$('[name="additionalInstallationTypes"][value="installer_application_other_works_none_of_the_above"]').prop('checked', false);
|
|
333
|
+
}
|
|
465
334
|
}
|
|
466
|
-
|
|
467
|
-
|
|
335
|
+
},
|
|
336
|
+
preferences: {
|
|
337
|
+
required: false
|
|
338
|
+
},
|
|
339
|
+
termsAgreement: {
|
|
340
|
+
required: true
|
|
341
|
+
},
|
|
468
342
|
},
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
return { valid: result.valid, errorType: result.errorType, error };
|
|
508
|
-
}
|
|
343
|
+
},
|
|
344
|
+
findRequirementsByName: function (elementName) {
|
|
345
|
+
var step = $('[name="'+ elementName +'"]').closest('.installer-block').attr('data-step');
|
|
346
|
+
return Wick.InstallerValidation.steps[step][elementName];
|
|
347
|
+
},
|
|
348
|
+
getValueByName: function (elementName) {
|
|
349
|
+
var element = $('[name="'+ elementName +'"]');
|
|
350
|
+
var type = element.attr("type");
|
|
351
|
+
|
|
352
|
+
if (element.prop('tagName') === 'SELECT') {
|
|
353
|
+
return element.val()
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
switch (type) {
|
|
357
|
+
case 'radio':
|
|
358
|
+
return $('[name="'+ elementName +'"]:checked').val();
|
|
359
|
+
case 'checkbox':
|
|
360
|
+
return $('[name="'+ elementName +'"]:checked').map(function(){
|
|
361
|
+
return $(this).val();
|
|
362
|
+
}).get();
|
|
363
|
+
case 'file':
|
|
364
|
+
return element.attr('data-value');
|
|
365
|
+
default:
|
|
366
|
+
return element.val().trim();
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
isInputValueNotEmpty: function (value) {
|
|
370
|
+
if (typeof value === 'string') return !!value;
|
|
371
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
372
|
+
|
|
373
|
+
return false;
|
|
374
|
+
},
|
|
375
|
+
elemDependsCheck: function (dependentValue, requirements) {
|
|
376
|
+
var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(dependentValue);
|
|
377
|
+
if (isValueExist) {
|
|
378
|
+
if (requirements.dependsOnValue) {
|
|
379
|
+
if (typeof dependentValue === 'string' || Array.isArray(dependentValue)) {
|
|
380
|
+
return Wick.InstallerValidation.elemPossibleValuesCheck(dependentValue, requirements.dependsOnValue);
|
|
509
381
|
} else {
|
|
510
|
-
|
|
511
|
-
if (isValueExist) {
|
|
512
|
-
result = Wick.InstallerValidation.checkElementValidations(value, requirements);
|
|
513
|
-
return { valid: result.valid, errorType: result.errorType, error };
|
|
514
|
-
}
|
|
382
|
+
return false;
|
|
515
383
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
if (
|
|
535
|
-
|
|
536
|
-
return {
|
|
537
|
-
valid: false,
|
|
538
|
-
errorType: 'validation',
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
return { valid: true };
|
|
542
|
-
},
|
|
543
|
-
runElementCallback: function (elementName, changedElemValue) {
|
|
544
|
-
var value = Wick.InstallerValidation.getValueByName(elementName);
|
|
545
|
-
var requirements = Wick.InstallerValidation.findRequirementsByName(elementName);
|
|
546
|
-
if (requirements.callback) {
|
|
547
|
-
requirements.callback(value, changedElemValue);
|
|
384
|
+
}
|
|
385
|
+
} else {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return true;
|
|
390
|
+
},
|
|
391
|
+
elemRequiredCheck: function (value, requirements) {
|
|
392
|
+
var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(value);
|
|
393
|
+
if (requirements.required && !isValueExist) {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return true;
|
|
398
|
+
},
|
|
399
|
+
elemPossibleValuesCheck: function (value, possibleValues) {
|
|
400
|
+
if (Array.isArray(possibleValues) && possibleValues.length > 0) {
|
|
401
|
+
if (typeof value === 'string') {
|
|
402
|
+
if (possibleValues && possibleValues.indexOf(value) < 0) {
|
|
403
|
+
return false;
|
|
548
404
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
return
|
|
405
|
+
}
|
|
406
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
407
|
+
if (possibleValues) {
|
|
408
|
+
var isValid = value
|
|
409
|
+
.map(function (arrayValue) { return possibleValues.indexOf(arrayValue) >= 0 })
|
|
410
|
+
.some(function (result) { return !!result });
|
|
411
|
+
|
|
412
|
+
if (!isValid) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
558
415
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return true;
|
|
419
|
+
},
|
|
420
|
+
elemRegexCheck: function (value, requirements) {
|
|
421
|
+
if (requirements.regex && !RegExp(requirements.regex).test(value)) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return true;
|
|
426
|
+
},
|
|
427
|
+
elemMaxLengthCheck: function (value, requirements) {
|
|
428
|
+
if (typeof value === 'string' && requirements.maxLength) {
|
|
429
|
+
return value.length <= requirements.maxLength;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return true;
|
|
433
|
+
},
|
|
434
|
+
isElementValid: function (elementName) {
|
|
435
|
+
var requirements = Wick.InstallerValidation.findRequirementsByName(elementName);
|
|
436
|
+
var value = Wick.InstallerValidation.getValueByName(elementName);
|
|
437
|
+
var error = requirements.error;
|
|
438
|
+
|
|
439
|
+
if (value && typeof value === 'string') {
|
|
440
|
+
value = value.trim();
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (requirements.required) {
|
|
444
|
+
if (requirements.dependsOnInput) {
|
|
445
|
+
var dependentValue = Wick.InstallerValidation.getValueByName(requirements.dependsOnInput);
|
|
446
|
+
if (dependentValue) {
|
|
447
|
+
if (requirements.dependsOnValue) {
|
|
448
|
+
var elemDependsCheckResult = Wick.InstallerValidation.elemDependsCheck(dependentValue, requirements);
|
|
449
|
+
if (elemDependsCheckResult) {
|
|
450
|
+
var result = Wick.InstallerValidation.checkElementValidations(value, requirements);
|
|
451
|
+
return { valid: result.valid, errorType: result.errorType, error };
|
|
593
452
|
}
|
|
453
|
+
} else {
|
|
454
|
+
var result = Wick.InstallerValidation.checkElementValidations(value, requirements);
|
|
455
|
+
return { valid: result.valid, errorType: result.errorType, error };
|
|
456
|
+
}
|
|
594
457
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
var
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
458
|
+
} else {
|
|
459
|
+
var result = Wick.InstallerValidation.checkElementValidations(value, requirements);
|
|
460
|
+
return { valid: result.valid, errorType: result.errorType, error };
|
|
461
|
+
}
|
|
462
|
+
} else {
|
|
463
|
+
var isValueExist = Wick.InstallerValidation.isInputValueNotEmpty(value);
|
|
464
|
+
if (isValueExist) {
|
|
465
|
+
var result = Wick.InstallerValidation.checkElementValidations(value, requirements);
|
|
466
|
+
return { valid: result.valid, errorType: result.errorType, error };
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
return { valid: true, error };
|
|
471
|
+
},
|
|
472
|
+
checkElementValidations: function (value, requirements) {
|
|
473
|
+
var elemRequiredCheckResult = Wick.InstallerValidation.elemRequiredCheck(value, requirements);
|
|
474
|
+
var elemPossibleValuesCheckResult = Wick.InstallerValidation.elemPossibleValuesCheck(value, requirements.possibleValues);
|
|
475
|
+
var elemRegexCheckResult = Wick.InstallerValidation.elemRegexCheck(value, requirements);
|
|
476
|
+
var elemMaxLengthCheckResult = Wick.InstallerValidation.elemMaxLengthCheck(value, requirements);
|
|
477
|
+
|
|
478
|
+
if (!elemRequiredCheckResult) return { valid: false, errorType: 'required' };
|
|
479
|
+
if (!elemPossibleValuesCheckResult || !elemRegexCheckResult || !elemMaxLengthCheckResult) return { valid: false, errorType: 'validation' };
|
|
480
|
+
|
|
481
|
+
return { valid: true };
|
|
482
|
+
},
|
|
483
|
+
runElementCallback: function (elementName, changedElemValue) {
|
|
484
|
+
var value = Wick.InstallerValidation.getValueByName(elementName);
|
|
485
|
+
var requirements = Wick.InstallerValidation.findRequirementsByName(elementName);
|
|
486
|
+
if (requirements.callback) {
|
|
487
|
+
requirements.callback(value, changedElemValue);
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
checkElement: function (elementName, onChange) {
|
|
491
|
+
var result = Wick.InstallerValidation.isElementValid(elementName);
|
|
492
|
+
if (result.valid) {
|
|
493
|
+
if (onChange) {
|
|
494
|
+
Wick.InstallerValidation.removeErrorNotificationFromElement(elementName);
|
|
495
|
+
Wick.InstallerValidation.removeGlobalErrorNotification();
|
|
496
|
+
}
|
|
497
|
+
return result;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
Wick.InstallerValidation.addErrorNotificationToElement(elementName, result.error, true);
|
|
501
|
+
|
|
502
|
+
return result;
|
|
503
|
+
},
|
|
504
|
+
appendErrorMessage: function (wrapper, elementName, error) {
|
|
505
|
+
var notification = '<div' +
|
|
506
|
+
' data-installer-input-name="' + elementName + '"' +
|
|
507
|
+
' class="form-row__error"' +
|
|
508
|
+
' >' + error.map(function (err) { return '<p>' + err + '</p>';}).join('') +
|
|
509
|
+
' </div>';
|
|
510
|
+
wrapper.append(notification);
|
|
511
|
+
},
|
|
512
|
+
addErrorNotificationToElement: function (elementName, error, removePrevNotification) {
|
|
513
|
+
if (!error) return;
|
|
514
|
+
var element = $('[name="'+ elementName +'"]');
|
|
515
|
+
var wrapper = element.closest('[data-form-field]');
|
|
516
|
+
var prevNotification = wrapper.children('.form-row__error[data-installer-input-name="'+ elementName +'"]');
|
|
517
|
+
if (prevNotification.length === 0) {
|
|
518
|
+
Wick.InstallerValidation.appendErrorMessage(wrapper, elementName, error);
|
|
519
|
+
} else {
|
|
520
|
+
if (removePrevNotification) {
|
|
521
|
+
prevNotification.remove();
|
|
522
|
+
Wick.InstallerValidation.appendErrorMessage(wrapper, elementName, error);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
removeErrorNotificationFromElement: function (elementName) {
|
|
527
|
+
var element = $('[name="'+ elementName +'"]');
|
|
528
|
+
var wrapper = element.closest('[data-form-field]');
|
|
529
|
+
var error = wrapper.children('.installer_question-error_wrapper[data-installer-input-name="'+ elementName +'"]');
|
|
530
|
+
var formError = wrapper.find('.form-row__error[data-installer-input-name="'+ elementName +'"]');
|
|
531
|
+
error.remove();
|
|
532
|
+
formError.remove();
|
|
533
|
+
},
|
|
534
|
+
removeAllErrorsFromStep: function (step) {
|
|
535
|
+
var installerBlock = $('.installer-block[data-step="'+ step +'"]');
|
|
536
|
+
installerBlock.find('.form-row__error').remove();
|
|
537
|
+
},
|
|
538
|
+
addGlobalErrorNotification: function (step, errorTypes) {
|
|
539
|
+
var wrapper = $('.installer-step-errors');
|
|
540
|
+
wrapper.attr('data-step', step);
|
|
541
|
+
wrapper.attr('data-step-error', '');
|
|
542
|
+
errorTypes.forEach(function (type) {
|
|
543
|
+
wrapper.attr(`data-error-${type}`, '');
|
|
544
|
+
});
|
|
545
|
+
},
|
|
546
|
+
removeGlobalErrorNotification: function () {
|
|
547
|
+
var wrapper = $('.installer-step-errors');
|
|
548
|
+
wrapper.removeAttr('data-step-error');
|
|
549
|
+
wrapper.removeAttr('data-error-required');
|
|
550
|
+
wrapper.removeAttr('data-error-validation');
|
|
551
|
+
},
|
|
552
|
+
validateStepForInstallerForm: function (step) {
|
|
553
|
+
Wick.InstallerValidation.removeAllErrorsFromStep(step);
|
|
554
|
+
|
|
555
|
+
var inputNames = Object.keys(Wick.InstallerValidation.steps[step]);
|
|
556
|
+
var results = inputNames
|
|
557
|
+
.map(function (elementName) {
|
|
558
|
+
return {
|
|
559
|
+
name: elementName,
|
|
560
|
+
result: Wick.InstallerValidation.checkElement(elementName)
|
|
561
|
+
};
|
|
562
|
+
});
|
|
563
|
+
var isStepInvalid = results.some(function (result) { return !result.result.valid; });
|
|
564
|
+
var errorTypes = results.reduce(function (prev, next) {
|
|
565
|
+
var result = next.result.errorType ? { [next.result.errorType]: true } : {};
|
|
566
|
+
return Object.assign(
|
|
567
|
+
prev,
|
|
568
|
+
result
|
|
569
|
+
)
|
|
570
|
+
}, {});
|
|
571
|
+
errorTypes = Object.keys(errorTypes);
|
|
572
|
+
|
|
573
|
+
if (isStepInvalid) {
|
|
574
|
+
var firstErrorField = results.find(function (result) { return !result.result.valid; });
|
|
575
|
+
Wick.InstallerValidation.scrollToField(firstErrorField.name);
|
|
576
|
+
Wick.InstallerValidation.addGlobalErrorNotification(step, errorTypes);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
return !isStepInvalid;
|
|
580
|
+
},
|
|
581
|
+
scrollToField: function (name) {
|
|
582
|
+
var element = $('[name="'+ name +'"]:first');
|
|
583
|
+
var elementHeight = element.height();
|
|
584
|
+
$([document.documentElement, document.body]).animate({
|
|
585
|
+
scrollTop: element.offset().top - elementHeight
|
|
586
|
+
}, 1500);
|
|
587
|
+
},
|
|
588
|
+
validateInstallerForm: function () {
|
|
589
|
+
var isStepsValid = Wick.InstallerForm.steps
|
|
590
|
+
.map(function (step) { return Wick.InstallerValidation.validateStepForInstallerForm(step); })
|
|
591
|
+
.every(function (result) { return !!result; });
|
|
592
|
+
|
|
593
|
+
return isStepsValid;
|
|
594
|
+
},
|
|
595
|
+
|
|
596
|
+
bindFormTextInputs: function () {
|
|
597
|
+
$('.installer-container').on({
|
|
598
|
+
input: function() {
|
|
599
|
+
var elementName = $(this).attr('name');
|
|
600
|
+
Wick.InstallerValidation.checkElement(elementName, true);
|
|
601
|
+
Wick.InstallerValidation.runElementCallback(elementName);
|
|
602
|
+
},
|
|
603
|
+
change: function() {
|
|
604
|
+
var elementName = $(this).attr('name');
|
|
605
|
+
Wick.InstallerValidation.checkElement(elementName, true);
|
|
606
|
+
Wick.InstallerValidation.runElementCallback(elementName);
|
|
607
|
+
},
|
|
608
|
+
keydown: function(e) {
|
|
609
|
+
var keyCode = e.keyCode || e.which;
|
|
610
|
+
|
|
611
|
+
if (+keyCode === 9) {
|
|
612
|
+
var elementName = $(this).attr('name');
|
|
613
|
+
Wick.InstallerValidation.checkElement(elementName, true);
|
|
614
|
+
Wick.InstallerValidation.runElementCallback(elementName);
|
|
651
615
|
}
|
|
616
|
+
}
|
|
617
|
+
}, 'input[type="text"]');
|
|
618
|
+
|
|
619
|
+
// Need to be tested on android
|
|
620
|
+
$(document).on('focus', '.installer-container input[type="text"]', function(){
|
|
621
|
+
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
622
|
+
if (/android/i.test(userAgent)) {
|
|
623
|
+
var boxheight = $(window).height() - 60;
|
|
624
|
+
$('main').append("<div id='blank' style='height:"+boxheight+"px;'"+"></div>");
|
|
625
|
+
$('html, body').animate({scrollTop: $(this).offset().top - 100}, 500);
|
|
626
|
+
}
|
|
627
|
+
});
|
|
652
628
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
return Wick.InstallerValidation.validateStepForInstallerForm(step);
|
|
669
|
-
})
|
|
670
|
-
.every(function (result) {
|
|
671
|
-
return !!result;
|
|
672
|
-
});
|
|
673
|
-
|
|
674
|
-
return isStepsValid;
|
|
675
|
-
},
|
|
676
|
-
|
|
677
|
-
bindFormTextInputs: function () {
|
|
678
|
-
$('.installer-container').on(
|
|
679
|
-
{
|
|
680
|
-
input: function () {
|
|
681
|
-
var elementName = $(this).attr('name');
|
|
682
|
-
Wick.InstallerValidation.checkElement(elementName, true);
|
|
683
|
-
Wick.InstallerValidation.runElementCallback(elementName);
|
|
684
|
-
},
|
|
685
|
-
change: function () {
|
|
686
|
-
var elementName = $(this).attr('name');
|
|
687
|
-
Wick.InstallerValidation.checkElement(elementName, true);
|
|
688
|
-
Wick.InstallerValidation.runElementCallback(elementName);
|
|
689
|
-
},
|
|
690
|
-
keydown: function (e) {
|
|
691
|
-
var keyCode = e.keyCode || e.which;
|
|
692
|
-
|
|
693
|
-
if (+keyCode === 9) {
|
|
694
|
-
var elementName = $(this).attr('name');
|
|
695
|
-
Wick.InstallerValidation.checkElement(elementName, true);
|
|
696
|
-
Wick.InstallerValidation.runElementCallback(elementName);
|
|
697
|
-
}
|
|
698
|
-
},
|
|
699
|
-
},
|
|
700
|
-
'input[type="text"]'
|
|
701
|
-
);
|
|
702
|
-
|
|
703
|
-
// Need to be tested on android
|
|
704
|
-
$(document).on('focus', '.installer-container input[type="text"]', function () {
|
|
705
|
-
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
706
|
-
if (/android/i.test(userAgent)) {
|
|
707
|
-
var boxheight = $(window).height() - 60;
|
|
708
|
-
$('main').append("<div id='blank' style='height:" + boxheight + "px;'></div>");
|
|
709
|
-
$('html, body').animate({ scrollTop: $(this).offset().top - 100 }, 500);
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
|
|
713
|
-
$(document).on('focusout', '.installer-container input[type="text"]', function () {
|
|
714
|
-
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
715
|
-
if (/android/i.test(userAgent)) {
|
|
716
|
-
$('#blank').remove();
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
},
|
|
720
|
-
|
|
721
|
-
bindFormCheckboxInputs: function () {
|
|
722
|
-
$('.installer-container input[type="radio"], input[type="checkbox"], select').on(
|
|
723
|
-
'change',
|
|
724
|
-
function () {
|
|
725
|
-
var elementName = $(this).attr('name');
|
|
726
|
-
var changedElemValue = $(this)[0].value;
|
|
727
|
-
Wick.InstallerValidation.checkElement(elementName, true);
|
|
728
|
-
Wick.InstallerValidation.runElementCallback(elementName, changedElemValue);
|
|
729
|
-
}
|
|
730
|
-
);
|
|
731
|
-
},
|
|
629
|
+
$(document).on('focusout', '.installer-container input[type="text"]', function(){
|
|
630
|
+
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
631
|
+
if (/android/i.test(userAgent)) {
|
|
632
|
+
$('#blank').remove();
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
},
|
|
636
|
+
bindFormCheckboxInputs: function () {
|
|
637
|
+
$('.installer-container input[type="radio"], input[type="checkbox"], select').on('change', function(event) {
|
|
638
|
+
var elementName = $(this).attr('name');
|
|
639
|
+
var changedElemValue = $(this)[0].value;
|
|
640
|
+
Wick.InstallerValidation.checkElement(elementName, true);
|
|
641
|
+
Wick.InstallerValidation.runElementCallback(elementName, changedElemValue);
|
|
642
|
+
});
|
|
643
|
+
},
|
|
732
644
|
};
|
|
733
645
|
|
|
734
646
|
$(document).ready(function () {
|
|
735
|
-
|
|
736
|
-
|
|
647
|
+
Wick.InstallerValidation.bindFormTextInputs();
|
|
648
|
+
Wick.InstallerValidation.bindFormCheckboxInputs();
|
|
737
649
|
});
|
|
738
650
|
|
|
739
651
|
// Polyfills
|
|
740
652
|
if (!Array.prototype.some) {
|
|
741
|
-
|
|
742
|
-
|
|
653
|
+
Array.prototype.some = function(fun, thisArg) {
|
|
654
|
+
'use strict';
|
|
743
655
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
656
|
+
if (this == null) {
|
|
657
|
+
throw new TypeError('Array.prototype.some called on null or undefined');
|
|
658
|
+
}
|
|
747
659
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
660
|
+
if (typeof fun !== 'function') {
|
|
661
|
+
throw new TypeError();
|
|
662
|
+
}
|
|
751
663
|
|
|
752
|
-
|
|
753
|
-
|
|
664
|
+
var t = Object(this);
|
|
665
|
+
var len = t.length >>> 0;
|
|
754
666
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
667
|
+
for (var i = 0; i < len; i++) {
|
|
668
|
+
if (i in t && fun.call(thisArg, t[i], i, t)) {
|
|
669
|
+
return true;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
760
672
|
|
|
761
|
-
|
|
762
|
-
|
|
673
|
+
return false;
|
|
674
|
+
};
|
|
763
675
|
}
|
|
764
676
|
|
|
765
677
|
if (!Array.isArray) {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
678
|
+
Array.isArray = function(arg) {
|
|
679
|
+
return Object.prototype.toString.call(arg) === '[object Array]';
|
|
680
|
+
};
|
|
769
681
|
}
|
|
770
682
|
|
|
771
683
|
if (!Array.prototype.every) {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
684
|
+
Array.prototype.every = function(callbackfn, thisArg) {
|
|
685
|
+
'use strict';
|
|
686
|
+
var T, k;
|
|
687
|
+
|
|
688
|
+
if (this == null) {
|
|
689
|
+
throw new TypeError('this is null or not defined');
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// 1. Let O be the result of calling ToObject passing the this
|
|
693
|
+
// value as the argument.
|
|
694
|
+
var O = Object(this);
|
|
695
|
+
|
|
696
|
+
// 2. Let lenValue be the result of calling the Get internal method
|
|
697
|
+
// of O with the argument "length".
|
|
698
|
+
// 3. Let len be ToUint32(lenValue).
|
|
699
|
+
var len = O.length >>> 0;
|
|
700
|
+
|
|
701
|
+
// 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
|
|
702
|
+
if (typeof callbackfn !== 'function' && Object.prototype.toString.call(callbackfn) !== '[object Function]') {
|
|
703
|
+
throw new TypeError();
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
|
707
|
+
if (arguments.length > 1) {
|
|
708
|
+
T = thisArg;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// 6. Let k be 0.
|
|
712
|
+
k = 0;
|
|
713
|
+
|
|
714
|
+
// 7. Repeat, while k < len
|
|
715
|
+
while (k < len) {
|
|
716
|
+
|
|
717
|
+
var kValue;
|
|
718
|
+
|
|
719
|
+
// a. Let Pk be ToString(k).
|
|
720
|
+
// This is implicit for LHS operands of the in operator
|
|
721
|
+
// b. Let kPresent be the result of calling the HasProperty internal
|
|
722
|
+
// method of O with argument Pk.
|
|
723
|
+
// This step can be combined with c
|
|
724
|
+
// c. If kPresent is true, then
|
|
725
|
+
if (k in O) {
|
|
726
|
+
var testResult;
|
|
727
|
+
// i. Let kValue be the result of calling the Get internal method
|
|
728
|
+
// of O with argument Pk.
|
|
729
|
+
kValue = O[k];
|
|
730
|
+
|
|
731
|
+
// ii. Let testResult be the result of calling the Call internal method
|
|
732
|
+
// of callbackfn with T as the this value if T is not undefined
|
|
733
|
+
// else is the result of calling callbackfn
|
|
734
|
+
// and argument list containing kValue, k, and O.
|
|
735
|
+
if(T) testResult = callbackfn.call(T, kValue, k, O);
|
|
736
|
+
else testResult = callbackfn(kValue,k,O)
|
|
737
|
+
|
|
738
|
+
// iii. If ToBoolean(testResult) is false, return false.
|
|
739
|
+
if (!testResult) {
|
|
740
|
+
return false;
|
|
778
741
|
}
|
|
742
|
+
}
|
|
743
|
+
k++;
|
|
744
|
+
}
|
|
745
|
+
return true;
|
|
746
|
+
};
|
|
747
|
+
}
|
|
779
748
|
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
749
|
+
if (!Array.prototype.reduce) {
|
|
750
|
+
Object.defineProperty(Array.prototype, 'reduce', {
|
|
751
|
+
value: function(callback /*, initialValue*/) {
|
|
752
|
+
if (this === null) {
|
|
753
|
+
throw new TypeError( 'Array.prototype.reduce ' +
|
|
754
|
+
'called on null or undefined' );
|
|
755
|
+
}
|
|
756
|
+
if (typeof callback !== 'function') {
|
|
757
|
+
throw new TypeError( callback +
|
|
758
|
+
' is not a function');
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// 1. Let O be ? ToObject(this value).
|
|
762
|
+
var o = Object(this);
|
|
763
|
+
|
|
764
|
+
// 2. Let len be ? ToLength(? Get(O, "length")).
|
|
765
|
+
var len = o.length >>> 0;
|
|
766
|
+
|
|
767
|
+
// Steps 3, 4, 5, 6, 7
|
|
768
|
+
var k = 0;
|
|
769
|
+
var value;
|
|
770
|
+
|
|
771
|
+
if (arguments.length >= 2) {
|
|
772
|
+
value = arguments[1];
|
|
773
|
+
} else {
|
|
774
|
+
while (k < len && !(k in o)) {
|
|
775
|
+
k++;
|
|
795
776
|
}
|
|
796
777
|
|
|
797
|
-
//
|
|
798
|
-
|
|
799
|
-
|
|
778
|
+
// 3. If len is 0 and initialValue is not present,
|
|
779
|
+
// throw a TypeError exception.
|
|
780
|
+
if (k >= len) {
|
|
781
|
+
throw new TypeError( 'Reduce of empty array ' +
|
|
782
|
+
'with no initial value' );
|
|
800
783
|
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
if (k in O) {
|
|
816
|
-
var testResult;
|
|
817
|
-
// i. Let kValue be the result of calling the Get internal method
|
|
818
|
-
// of O with argument Pk.
|
|
819
|
-
kValue = O[k];
|
|
820
|
-
|
|
821
|
-
// ii. Let testResult be the result of calling the Call internal method
|
|
822
|
-
// of callbackfn with T as the this value if T is not undefined
|
|
823
|
-
// else is the result of calling callbackfn
|
|
824
|
-
// and argument list containing kValue, k, and O.
|
|
825
|
-
if (T) testResult = callbackfn.call(T, kValue, k, O);
|
|
826
|
-
else testResult = callbackfn(kValue, k, O);
|
|
827
|
-
|
|
828
|
-
// iii. If ToBoolean(testResult) is false, return false.
|
|
829
|
-
if (!testResult) {
|
|
830
|
-
return false;
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
k++;
|
|
784
|
+
value = o[k++];
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// 8. Repeat, while k < len
|
|
788
|
+
while (k < len) {
|
|
789
|
+
// a. Let Pk be ! ToString(k).
|
|
790
|
+
// b. Let kPresent be ? HasProperty(O, Pk).
|
|
791
|
+
// c. If kPresent is true, then
|
|
792
|
+
// i. Let kValue be ? Get(O, Pk).
|
|
793
|
+
// ii. Let accumulator be ? Call(
|
|
794
|
+
// callbackfn, undefined,
|
|
795
|
+
// « accumulator, kValue, k, O »).
|
|
796
|
+
if (k in o) {
|
|
797
|
+
value = callback(value, o[k], k, o);
|
|
834
798
|
}
|
|
835
|
-
return true;
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
if (!Array.prototype.reduce) {
|
|
840
|
-
Object.defineProperty(Array.prototype, 'reduce', {
|
|
841
|
-
value: function (callback /*, initialValue*/) {
|
|
842
|
-
if (this === null) {
|
|
843
|
-
throw new TypeError('Array.prototype.reduce ' + 'called on null or undefined');
|
|
844
|
-
}
|
|
845
|
-
if (typeof callback !== 'function') {
|
|
846
|
-
throw new TypeError(callback + ' is not a function');
|
|
847
|
-
}
|
|
848
799
|
|
|
849
|
-
|
|
850
|
-
|
|
800
|
+
// d. Increase k by 1.
|
|
801
|
+
k++;
|
|
802
|
+
}
|
|
851
803
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
var k = 0;
|
|
857
|
-
var value;
|
|
858
|
-
|
|
859
|
-
if (arguments.length >= 2) {
|
|
860
|
-
value = arguments[1];
|
|
861
|
-
} else {
|
|
862
|
-
while (k < len && !(k in o)) {
|
|
863
|
-
k++;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
// 3. If len is 0 and initialValue is not present,
|
|
867
|
-
// throw a TypeError exception.
|
|
868
|
-
if (k >= len) {
|
|
869
|
-
throw new TypeError('Reduce of empty array ' + 'with no initial value');
|
|
870
|
-
}
|
|
871
|
-
value = o[k++];
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
// 8. Repeat, while k < len
|
|
875
|
-
while (k < len) {
|
|
876
|
-
// a. Let Pk be ! ToString(k).
|
|
877
|
-
// b. Let kPresent be ? HasProperty(O, Pk).
|
|
878
|
-
// c. If kPresent is true, then
|
|
879
|
-
// i. Let kValue be ? Get(O, Pk).
|
|
880
|
-
// ii. Let accumulator be ? Call(
|
|
881
|
-
// callbackfn, undefined,
|
|
882
|
-
// « accumulator, kValue, k, O »).
|
|
883
|
-
if (k in o) {
|
|
884
|
-
value = callback(value, o[k], k, o);
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
// d. Increase k by 1.
|
|
888
|
-
k++;
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
// 9. Return accumulator.
|
|
892
|
-
return value;
|
|
893
|
-
},
|
|
894
|
-
});
|
|
804
|
+
// 9. Return accumulator.
|
|
805
|
+
return value;
|
|
806
|
+
}
|
|
807
|
+
});
|
|
895
808
|
}
|