wickes-css2 2.112.0-develop.1 → 2.112.0-develop.11
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/Readme.md +1 -5
- package/build/css/account-families-main.css +1 -1
- package/build/css/category-main.css +1 -1
- package/build/css/components/card-product-banner.css +1 -1
- package/build/css/components/card-store-locator-v2.css +1 -1
- package/build/css/components/global-search.css +1 -1
- package/build/css/components/special-opening-schedule-v2.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/checkout-new.css +1 -1
- package/build/css/pages/checkout.css +1 -1
- package/build/css/pages/home-movers.css +1 -1
- package/build/css/pages/my-account-v2.css +1 -1
- package/build/css/pages/my-account.css +1 -1
- package/build/css/pages/oldweb_header.css +1 -1
- package/build/css/pages/page_act-trade-pro.css +1 -1
- package/build/css/pages/page_book-consultant-thank-you-new.css +1 -1
- package/build/css/pages/page_checkout-payment-details.css +1 -1
- package/build/css/pages/page_checkout_delivery-new.css +1 -1
- package/build/css/pages/page_content.css +1 -1
- package/build/css/pages/page_default-store.css +1 -1
- package/build/css/pages/page_fdl-management.css +1 -1
- package/build/css/pages/page_fi.css +1 -1
- package/build/css/pages/page_forgotten-password.css +1 -1
- package/build/css/pages/page_home.css +1 -1
- package/build/css/pages/page_in-store-checkout.css +1 -1
- package/build/css/pages/page_installer_form.css +1 -1
- package/build/css/pages/page_kitchen-claims.css +1 -1
- package/build/css/pages/page_merged-basket.css +1 -1
- package/build/css/pages/page_my-order.css +1 -1
- package/build/css/pages/page_my-orders.css +1 -1
- package/build/css/pages/page_new-checkout-forgot.css +1 -1
- package/build/css/pages/page_online-exclusive.css +1 -1
- package/build/css/pages/page_pre_home.css +1 -1
- package/build/css/pages/page_pre_home_thank-you.css +1 -1
- package/build/css/pages/page_product-details-critical.css +1 -1
- package/build/css/pages/page_product-details-v2.css +1 -1
- package/build/css/pages/page_product-details.css +1 -1
- package/build/css/pages/page_product_search.css +1 -1
- package/build/css/pages/page_products-list-combined.css +1 -1
- package/build/css/pages/page_products-list.css +1 -1
- package/build/css/pages/page_registration.css +1 -1
- package/build/css/pages/page_shopping-cart-v2.css +1 -1
- package/build/css/pages/page_shopping-cart.css +1 -1
- package/build/css/pages/page_store-locator-details.css +1 -1
- package/build/css/pages/page_thankyou.css +1 -1
- package/build/css/pages/page_ti.css +1 -1
- package/build/css/pages/page_top-rated.css +1 -1
- package/build/css/pages/page_upd-pass.css +1 -1
- package/build/css/pages/page_wismo-details.css +1 -1
- package/build/css/pages/page_wismo-orders.css +1 -1
- package/build/css/pages/sticky_header.css +1 -1
- package/build/css/pages/tradePro-signup.css +1 -1
- package/build/css/pdp-main-before-combine.css +1 -1
- package/build/css/pdp-main-critical.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/shopping-list-pdf.css +1 -1
- package/build/css/store-locator-main.css +1 -1
- package/build/js/basket.min.js +1 -1
- package/build/js/bloomreach-widget.min.js +1 -1
- package/build/js/emulation.min.js +3072 -2397
- package/build/js/page/basket-v2.js +29 -20
- package/build/js/page/bloomreach-widget/bloomreach-widget-tracking.js +87 -0
- package/build/js/page/bloomreach-widget/bloomreach-widget.js +250 -0
- package/build/js/page/{bloomreach-widget.js → bloomreach-widget/complete-your-project-widget.js} +270 -359
- package/build/js/page/bloomreach-widget/why-not-add-widget.js +230 -0
- package/build/js/page/checkout-payment-details.js +10 -0
- package/build/js/page/utils/data-layer.js +9 -0
- package/package.json +3 -9
- package/src/components/address-billie.hbs +22 -18
- package/src/components/bloomreach/complete-card.hbs +6 -34
- package/src/components/bloomreach/complete-summary.hbs +2 -2
- package/src/components/bloomreach/why-not-add-card-skeleton.hbs +14 -0
- package/src/components/bloomreach/why-not-add-card.hbs +73 -0
- package/src/components/bloomreach/why-not-add-content.hbs +41 -0
- package/src/components/bloomreach/why-not-add-skeleton.hbs +9 -0
- package/src/components/bloomreach/why-not-add.hbs +6 -0
- package/src/components/checkout-edit-billing-address.hbs +1 -1
- package/src/components/checkout-payment-details-v2.hbs +6 -1
- package/src/components/my-account/order.hbs +6 -1
- package/src/components/order-item.hbs +7 -7
- package/src/components/pdp-price-actions.hbs +2 -2
- package/src/components/potential-promotion.hbs +4 -4
- package/src/components/price-badges.hbs +12 -0
- package/src/components/price-block-v2.hbs +5 -12
- package/src/components/reviews-rating.hbs +22 -0
- package/src/components/share-list-modal-without-social-icons.hbs +2 -2
- package/src/components/share-list-modal.hbs +7 -3
- package/src/data/data_shopping-cart-v2.json +46 -2
- package/src/data/data_shopping-cart-with-energy.json +26 -2
- package/src/data/my-account/data_my-order.json +8 -0
- package/src/js/emulation/basket-data.js +312 -0
- package/src/js/emulation/bloomreach-widget-loading.js +2 -2
- package/src/js/emulation/mock.js +2718 -2363
- package/src/js/emulation/shopping-list.js +40 -49
- package/src/js/emulation/tracking-emulation.js +38 -0
- package/src/js/emulation/why-not-add-loading.js +11 -0
- package/src/js/emulation/why-not-add.js +28 -0
- package/src/js/page/basket-v2.js +29 -20
- package/src/js/page/bloomreach-widget/bloomreach-widget-tracking.js +87 -0
- package/src/js/page/bloomreach-widget/bloomreach-widget.js +250 -0
- package/src/js/page/{bloomreach-widget.js → bloomreach-widget/complete-your-project-widget.js} +270 -359
- package/src/js/page/bloomreach-widget/why-not-add-widget.js +230 -0
- package/src/js/page/checkout-payment-details.js +10 -0
- package/src/js/page/utils/data-layer.js +9 -0
- package/src/page_payment-details-billie-registered-only.html +76 -0
- package/src/page_payment-details-billie-unregistered-only.html +76 -0
- package/src/page_product-details-bloomreach.html +1 -1
- package/src/page_product-details-with-global-search-v2.html +2 -1
- package/src/page_product-details-with-why-not-add-single.html +131 -0
- package/src/page_track-my-order-result.html +1 -0
- package/src/scss/category-main.scss +5 -7
- package/src/scss/common/_app.scss +1 -1
- package/src/scss/common/_rewards-counter.scss +1 -2
- package/src/scss/common/_typography.scss +1 -1
- package/src/scss/common/_vat-toggle.scss +1 -1
- package/src/scss/components/_add-list-id.scss +0 -1
- package/src/scss/components/_advice-inspiration-critical.scss +2 -2
- package/src/scss/components/_advice-inspiration.scss +2 -3
- package/src/scss/components/_anchor-nav.scss +1 -1
- package/src/scss/components/_aside-accordion.scss +0 -5
- package/src/scss/components/_aside-nav.scss +1 -1
- package/src/scss/components/_aside-nav2.scss +0 -2
- package/src/scss/components/_autocomplete.scss +0 -1
- package/src/scss/components/_banner-2.scss +1 -1
- package/src/scss/components/_banner-info.scss +1 -1
- package/src/scss/components/_banner.scss +0 -2
- package/src/scss/components/_barcode.scss +0 -1
- package/src/scss/components/_big-wins-critical.scss +8 -9
- package/src/scss/components/_big-wins.scss +25 -32
- package/src/scss/components/_billie-modal.scss +5 -6
- package/src/scss/components/_billie-online-messaging.scss +2 -2
- package/src/scss/components/_card.scss +1 -5
- package/src/scss/components/_cards-slider.scss +1 -1
- package/src/scss/components/_category-tree.scss +2 -2
- package/src/scss/components/_charity-donations.scss +7 -7
- package/src/scss/components/_checkout-action.scss +0 -2
- package/src/scss/components/_colour-block.scss +0 -2
- package/src/scss/components/_cookies-policy.scss +1 -1
- package/src/scss/components/_copy-project-id.scss +0 -1
- package/src/scss/components/_donation-cart-new.scss +6 -6
- package/src/scss/components/_donation-cart.scss +3 -4
- package/src/scss/components/_favourite-product.scss +1 -1
- package/src/scss/components/_gallery-critical.scss +3 -3
- package/src/scss/components/_gallery-pdp-critical.scss +4 -4
- package/src/scss/components/_gallery-pdp.scss +2 -2
- package/src/scss/components/_gallery.scss +2 -2
- package/src/scss/components/_hero.scss +0 -1
- package/src/scss/components/_home-banner.scss +1 -1
- package/src/scss/components/_kitchen-card.scss +4 -4
- package/src/scss/components/_lines-group.scss +0 -1
- package/src/scss/components/_marketing-preferences.scss +1 -1
- package/src/scss/components/_merge-basket-options.scss +0 -1
- package/src/scss/components/_modal-box.scss +5 -5
- package/src/scss/components/_new-checkout-form.scss +1 -1
- package/src/scss/components/_notifications-critical.scss +1 -3
- package/src/scss/components/_order-item-cc.scss +6 -7
- package/src/scss/components/_order-item.scss +11 -12
- package/src/scss/components/_order-line-shop-list.scss +2 -2
- package/src/scss/components/_order-line.scss +3 -3
- package/src/scss/components/_page-overlay.scss +3 -9
- package/src/scss/components/_payment-transactions.scss +5 -5
- package/src/scss/components/_payments.scss +0 -1
- package/src/scss/components/_pdp-cta.scss +0 -4
- package/src/scss/components/_pdp-info-v2.scss +2 -5
- package/src/scss/components/_popular-categories.scss +0 -2
- package/src/scss/components/_potential-promotion.scss +1 -1
- package/src/scss/components/_price-badges-critical.scss +0 -1
- package/src/scss/components/_price-badges.scss +0 -2
- package/src/scss/components/_price-tooltip.scss +3 -2
- package/src/scss/components/_price.scss +2 -2
- package/src/scss/components/_product-card-critical.scss +1 -2
- package/src/scss/components/_product-card.scss +3 -5
- package/src/scss/components/_product-main-info.scss +4 -5
- package/src/scss/components/_project-list-multiple.scss +4 -4
- package/src/scss/components/_project-list-total.scss +1 -1
- package/src/scss/components/_proposition.scss +2 -2
- package/src/scss/components/_range-card.scss +1 -3
- package/src/scss/components/_range-types.scss +2 -2
- package/src/scss/components/_recommended.scss +1 -5
- package/src/scss/components/_rewards.scss +1 -1
- package/src/scss/components/_saving-shopping-list-modal.scss +1 -2
- package/src/scss/components/_seo-widgets.scss +1 -2
- package/src/scss/components/_share-list-modal.scss +1 -2
- package/src/scss/components/_shop-colour.scss +1 -1
- package/src/scss/components/_shopping-list-note.scss +2 -2
- package/src/scss/components/_smart-banner.scss +4 -5
- package/src/scss/components/_snack-bar.scss +2 -2
- package/src/scss/components/_steps-three.scss +3 -3
- package/src/scss/components/_steps.scss +2 -2
- package/src/scss/components/_sticky-element-appearance.scss +2 -2
- package/src/scss/components/_tables.scss +1 -2
- package/src/scss/components/_tabs.scss +0 -1
- package/src/scss/components/_tc-generic-floor.scss +3 -3
- package/src/scss/components/_tc-generic.scss +4 -4
- package/src/scss/components/_thank-you-modal.scss +3 -1
- package/src/scss/components/_ti-floor.scss +3 -4
- package/src/scss/components/_ti-header.scss +2 -2
- package/src/scss/components/_ti-radio.scss +4 -4
- package/src/scss/components/_ti-total-area.scss +10 -10
- package/src/scss/components/_tile-banner.scss +1 -1
- package/src/scss/components/_tile-product.scss +3 -4
- package/src/scss/components/_tooltip.scss +2 -2
- package/src/scss/components/_trade-offers.scss +0 -1
- package/src/scss/components/_tradepro-discount-banner.scss +10 -15
- package/src/scss/components/_user-address-delivery.scss +1 -3
- package/src/scss/components/_user-address.scss +1 -1
- package/src/scss/components/_usp-component.scss +0 -1
- package/src/scss/components/_voucher-accordion.scss +3 -3
- package/src/scss/components/_wisdom-critical.scss +2 -3
- package/src/scss/components/_wisdom.scss +6 -9
- package/src/scss/components/_your-details.scss +0 -1
- package/src/scss/components/account-families/_add-members.scss +1 -3
- package/src/scss/components/account-families/_member-card.scss +3 -3
- package/src/scss/components/bloomreach/_bloomreach.scss +3 -0
- package/src/scss/components/bloomreach/_complete-card.scss +0 -38
- package/src/scss/components/bloomreach/_reviews.scss +60 -0
- package/src/scss/components/bloomreach/_why-not-add-card.scss +223 -0
- package/src/scss/components/bloomreach/_why-not-add.scss +143 -0
- package/src/scss/components/card-store-locator-v2.scss +0 -1
- package/src/scss/components/card_v2.scss +3 -7
- package/src/scss/components/checkout-loader-modal.scss +0 -1
- package/src/scss/components/energy-efficiency.scss +6 -6
- package/src/scss/components/global-search.scss +14 -20
- package/src/scss/components/kitchen/_chips.scss +7 -6
- package/src/scss/components/kitchen/_filter-card.scss +1 -1
- package/src/scss/components/kitchen/_sort-by.scss +2 -3
- package/src/scss/components/kitchen/strip-stickers.scss +1 -1
- package/src/scss/components/loader.scss +5 -6
- package/src/scss/components/my-account/_active-orders.scss +6 -6
- package/src/scss/components/my-account/_consignment-info.scss +3 -3
- package/src/scss/components/my-account/_contacts.scss +2 -2
- package/src/scss/components/my-account/_menu.scss +2 -2
- package/src/scss/components/my-account/_mobile-nav.scss +4 -4
- package/src/scss/components/my-account/_order-process.scss +3 -3
- package/src/scss/components/my-account/_order-status.scss +3 -3
- package/src/scss/components/my-account/_orders-nav.scss +1 -1
- package/src/scss/components/my-account/_payment-status.scss +2 -2
- package/src/scss/components/my-account/_saving-totaliser.scss +8 -7
- package/src/scss/components/my-account/_shipment.scss +2 -2
- package/src/scss/components/pdf-loader.scss +1 -2
- package/src/scss/components/price-block-v2-critical.scss +0 -1
- package/src/scss/components/price-block-v2.scss +0 -3
- package/src/scss/components/store-locator-v2-details.scss +2 -2
- package/src/scss/components/strip-stickers.scss +1 -1
- package/src/scss/helpers/_elements.scss +0 -1
- package/src/scss/helpers/_mixins.scss +5 -5
- package/src/scss/helpers/_store-locator-elements.scss +0 -1
- package/src/scss/helpers/_typography.scss +3 -3
- package/src/scss/helpers/_utilities.scss +0 -1
- package/src/scss/helpers/helpers-pdp-critical/_CTAs-critical-pdp.scss +1 -1
- package/src/scss/helpers/helpers-pdp-critical/_elements-critical-pdp.scss +0 -1
- package/src/scss/helpers/helpers-pdp-critical/_helpers-critical-pdp.scss +1 -1
- package/src/scss/helpers/helpers-pdp-critical/_typography-critical-pdp.scss +4 -4
- package/src/scss/libs/_bootstrap-extracted.scss +42 -12
- package/src/scss/libs/_cat-libs.scss +10 -10
- package/src/scss/libs/_font-awesome-icons.scss +133 -113
- package/src/scss/libs/_homepage-libs.scss +12 -12
- package/src/scss/libs/_plp-libs.scss +11 -11
- package/src/scss/libs/_skeleton.scss +4 -4
- package/src/scss/libs/_store-locator-libs.scss +1 -1
- package/src/scss/libs/flatpickr.scss +6 -6
- package/src/scss/my-account-main-v2.scss +19 -19
- package/src/scss/my-account-main.scss +19 -19
- package/src/scss/pages/_checkout-confirmation.scss +1 -3
- package/src/scss/pages/_checkout-sign-in.scss +1 -2
- package/src/scss/pages/_checkout-tradepro.scss +3 -4
- package/src/scss/pages/_checkout-widget.scss +10 -16
- package/src/scss/pages/_checkout_delivery-details.scss +1 -3
- package/src/scss/pages/_checkout_edit-delivery-address.scss +0 -1
- package/src/scss/pages/_checkout_terms-and-conditions.scss +0 -1
- package/src/scss/pages/_checkout_your-details.scss +1 -1
- package/src/scss/pages/_contact-us.scss +0 -1
- package/src/scss/pages/_facets.scss +0 -2
- package/src/scss/pages/_my-account_address-details.scss +0 -3
- package/src/scss/pages/_my-account_change-email.scss +0 -1
- package/src/scss/pages/_my-account_new.scss +25 -31
- package/src/scss/pages/_my-account_order-details.scss +1 -1
- package/src/scss/pages/_my-account_order-history.scss +1 -2
- package/src/scss/pages/_my-account_personal-details.scss +0 -5
- package/src/scss/pages/_my-account_profile.scss +1 -2
- package/src/scss/pages/_my-account_your-account.scss +0 -1
- package/src/scss/pages/_page_category-landing.scss +3 -2
- package/src/scss/pages/bicester-header.scss +0 -1
- package/src/scss/pages/checkout.scss +4 -5
- package/src/scss/pages/home-movers.scss +1 -1
- package/src/scss/pages/iframe-paypage.scss +44 -44
- package/src/scss/pages/my-account.scss +3 -3
- package/src/scss/pages/oldweb_header.scss +5 -6
- package/src/scss/pages/page_account-deletion.scss +1 -1
- package/src/scss/pages/page_act-trade-pro.scss +0 -1
- package/src/scss/pages/page_address-book.scss +0 -1
- package/src/scss/pages/page_bathroom-trends.scss +0 -1
- package/src/scss/pages/page_book-consultant-thank-you-new.scss +3 -5
- package/src/scss/pages/page_checkout-payment-details.scss +2 -5
- package/src/scss/pages/page_cms_homepage.scss +1 -1
- package/src/scss/pages/page_contact-us.scss +1 -1
- package/src/scss/pages/page_content.scss +0 -4
- package/src/scss/pages/page_default-store.scss +2 -3
- package/src/scss/pages/page_empty-basket.scss +0 -5
- package/src/scss/pages/page_fdl-management.scss +0 -1
- package/src/scss/pages/page_fi.scss +0 -2
- package/src/scss/pages/page_home.scss +0 -2
- package/src/scss/pages/page_hotspot-guttering.scss +0 -1
- package/src/scss/pages/page_in-store-checkout.scss +1 -3
- package/src/scss/pages/page_installer.scss +3 -5
- package/src/scss/pages/page_installer_form.scss +0 -1
- package/src/scss/pages/page_kitchen-claims.scss +2 -5
- package/src/scss/pages/page_kitchen-list.scss +1 -1
- package/src/scss/pages/page_marketing-preferences.scss +1 -1
- package/src/scss/pages/page_merged-basket.scss +2 -2
- package/src/scss/pages/page_my-account_tradePro.scss +1 -1
- package/src/scss/pages/page_my-order.scss +15 -15
- package/src/scss/pages/page_my-orders.scss +2 -2
- package/src/scss/pages/page_new-checkout_login-register.scss +1 -2
- package/src/scss/pages/page_no-results.scss +1 -2
- package/src/scss/pages/page_online-exclusive.scss +6 -6
- package/src/scss/pages/page_personal-details.scss +2 -2
- package/src/scss/pages/page_pre_home.scss +7 -7
- package/src/scss/pages/page_pre_home_thank-you.scss +2 -2
- package/src/scss/pages/page_product-details-critical.scss +7 -1
- package/src/scss/pages/page_product-details-v2-critical.scss +1 -2
- package/src/scss/pages/page_product-details.scss +7 -1
- package/src/scss/pages/page_products-list-phone.scss +0 -7
- package/src/scss/pages/page_products-list.scss +2 -2
- package/src/scss/pages/page_quiz.scss +3 -3
- package/src/scss/pages/page_rate-review.scss +0 -3
- package/src/scss/pages/page_registration.scss +0 -3
- package/src/scss/pages/page_store-locator-details.scss +2 -2
- package/src/scss/pages/page_ti.scss +1 -5
- package/src/scss/pages/page_top-rated.scss +5 -5
- package/src/scss/pages/page_track-my-order.scss +1 -1
- package/src/scss/pages/page_track_your_order.scss +5 -5
- package/src/scss/pages/page_upd-pass.scss +0 -1
- package/src/scss/pages/page_wismo-details.scss +8 -8
- package/src/scss/pages/page_wismo-order-history.scss +3 -3
- package/src/scss/pages/page_wismo-orders.scss +7 -7
- package/src/scss/pages/print_quiz.scss +3 -1
- package/src/scss/pages/sticky_header.scss +5 -6
- package/src/scss/pages/tradePro-about.scss +1 -1
- package/src/scss/pages/tradePro-discount.scss +1 -2
- package/src/scss/pages/tradePro-rewards-old.scss +4 -3
- package/src/scss/pages/tradePro-signup.scss +3 -5
- package/src/scss/partials/_breadcrumbs-critical.scss +2 -2
- package/src/scss/partials/_breadcrumbs.scss +2 -2
- package/src/scss/partials/_footer-v2.scss +2 -2
- package/src/scss/partials/_footer.scss +4 -4
- package/src/scss/partials/_footer_checkout-new.scss +1 -1
- package/src/scss/partials/_footer_checkout.scss +1 -1
- package/src/scss/partials/_header-critical.scss +6 -9
- package/src/scss/partials/_header.scss +7 -9
- package/src/scss/partials/_header_checkout.scss +2 -2
- package/src/scss/partials/_main-nav.scss +7 -11
- package/src/scss/partials/_sign-up.scss +3 -3
- package/src/scss/shopping-list-pdf.scss +1 -1
- package/src/sitemap.html +22 -4
- package/src/components/.DS_Store +0 -0
- package/src/img/.DS_Store +0 -0
- package/src/img/placeholders/.DS_Store +0 -0
- package/src/js/page/.DS_Store +0 -0
- package/src/scss/.DS_Store +0 -0
- package/src/scss/pages/.DS_Store +0 -0
package/build/js/page/{bloomreach-widget.js → bloomreach-widget/complete-your-project-widget.js}
RENAMED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
var Wick = window.Wick || {};
|
|
2
2
|
|
|
3
|
-
import { createCountStepper } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { createCountStepper } from '../utils/create-count-stepper';
|
|
4
|
+
import { createDropdown } from '../utils/custom-dropdown';
|
|
5
|
+
import { createLoadingButton } from '../utils/create-loading-button';
|
|
6
|
+
import { createToast } from '../utils/create-toast';
|
|
7
|
+
import { createBloomreachWidgetTracking } from './bloomreach-widget-tracking';
|
|
8
8
|
|
|
9
9
|
const Handlebars = require('hbsfy/runtime');
|
|
10
10
|
|
|
11
|
-
Handlebars.registerPartial('checkbox', require('
|
|
12
|
-
Handlebars.registerPartial('loader', require('
|
|
13
|
-
Handlebars.registerPartial('button', require('
|
|
11
|
+
Handlebars.registerPartial('checkbox', require('../../../elements/checkbox.hbs'));
|
|
12
|
+
Handlebars.registerPartial('loader', require('../../../elements/loader.hbs'));
|
|
13
|
+
Handlebars.registerPartial('button', require('../../../components/base/button.hbs'));
|
|
14
14
|
Handlebars.registerPartial(
|
|
15
15
|
'bloomreach/complete-card-dropdown',
|
|
16
|
-
require('
|
|
16
|
+
require('../../../components/bloomreach/complete-card-dropdown.hbs')
|
|
17
17
|
);
|
|
18
|
-
Handlebars.registerPartial('notifications', require('
|
|
18
|
+
Handlebars.registerPartial('notifications', require('../../../elements/notifications.hbs'));
|
|
19
|
+
Handlebars.registerPartial('reviews-rating', require('../../../components/reviews-rating.hbs'));
|
|
19
20
|
|
|
20
|
-
const notificationTemplate = require('
|
|
21
|
-
const completeWrapperTemplate = require('
|
|
22
|
-
const completeDividerTemplate = require('
|
|
23
|
-
const completeCardTemplate = require('
|
|
24
|
-
const completeSummaryTemplate = require('
|
|
21
|
+
const notificationTemplate = require('../../../elements/notifications.hbs');
|
|
22
|
+
const completeWrapperTemplate = require('../../../components/bloomreach/complete-wrapper.hbs');
|
|
23
|
+
const completeDividerTemplate = require('../../../components/bloomreach/complete-divider.hbs');
|
|
24
|
+
const completeCardTemplate = require('../../../components/bloomreach/complete-card.hbs');
|
|
25
|
+
const completeSummaryTemplate = require('../../../components/bloomreach/complete-summary.hbs');
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
const CompleteYourProjectWidget = {
|
|
27
28
|
CALCULATE_PRODUCT_BUNDLE_TOTAL_EVENT: 'calculateProductBundleTotal',
|
|
28
29
|
ADD_PRODUCT_BUNDLE_TO_CART_EVENT: 'bulkAddToCart',
|
|
29
30
|
|
|
@@ -34,6 +35,7 @@ Wick.BloomreachWidget = {
|
|
|
34
35
|
lastCalculationResponse: null,
|
|
35
36
|
dropdownCurrent: {},
|
|
36
37
|
toast: null,
|
|
38
|
+
tracking: createBloomreachWidgetTracking(),
|
|
37
39
|
|
|
38
40
|
el: {
|
|
39
41
|
cardCheckbox: '.complete-card__select input[type="checkbox"]',
|
|
@@ -43,14 +45,8 @@ Wick.BloomreachWidget = {
|
|
|
43
45
|
countStepperInitializedData: 'count-stepper-initialized',
|
|
44
46
|
countStepperRoot: '.count-stepper',
|
|
45
47
|
ctaButton: '.complete-widget__cta .btn',
|
|
46
|
-
ctaButtonText: '.loading-button__text',
|
|
47
|
-
ctaButtonLoader: '.loading-button__loader',
|
|
48
48
|
summaryPriceValue: '.complete-widget__price-value',
|
|
49
49
|
summarySalePrice: '.complete-widget__sale-price',
|
|
50
|
-
summaryPriceInc: '.including-vat-inherit',
|
|
51
|
-
summaryPriceExc: '.excluding-vat-inherit',
|
|
52
|
-
summarySalePriceInc: '.including-vat-inherit',
|
|
53
|
-
summarySalePriceExc: '.excluding-vat-inherit',
|
|
54
50
|
|
|
55
51
|
dropdownErrorClass: 'complete-card-dropdown--error',
|
|
56
52
|
dropdownOpenClass: 'complete-card-dropdown--open',
|
|
@@ -68,8 +64,6 @@ Wick.BloomreachWidget = {
|
|
|
68
64
|
recommendationIndexAttr: 'data-recommendation-index',
|
|
69
65
|
selectedClass: 'complete-card--selected',
|
|
70
66
|
selectedValueData: 'selected-value',
|
|
71
|
-
starOverlay: '.star-overlay',
|
|
72
|
-
|
|
73
67
|
titleEl: '.complete-card__title',
|
|
74
68
|
|
|
75
69
|
widgetContainer: '[data-complete-widget]',
|
|
@@ -94,8 +88,7 @@ Wick.BloomreachWidget = {
|
|
|
94
88
|
},
|
|
95
89
|
|
|
96
90
|
setCtaText($button, text) {
|
|
97
|
-
const
|
|
98
|
-
const $text = $button.find(ctaButtonText);
|
|
91
|
+
const $text = $button.find(Wick.BloomreachWidget.el.loadingButtonText);
|
|
99
92
|
|
|
100
93
|
if ($text.length) {
|
|
101
94
|
$text.text(text);
|
|
@@ -106,61 +99,7 @@ Wick.BloomreachWidget = {
|
|
|
106
99
|
},
|
|
107
100
|
|
|
108
101
|
getBadgeColor(color) {
|
|
109
|
-
return
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
hasRecommendations(payloadData) {
|
|
113
|
-
if (Array.isArray(payloadData)) {
|
|
114
|
-
return payloadData.length > 0;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return Boolean(
|
|
118
|
-
payloadData &&
|
|
119
|
-
Array.isArray(payloadData.recommendedProducts) &&
|
|
120
|
-
payloadData.recommendedProducts.length
|
|
121
|
-
);
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
normalizePayload(payloadData) {
|
|
125
|
-
if (Array.isArray(payloadData)) {
|
|
126
|
-
return payloadData;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (payloadData && Array.isArray(payloadData.recommendedProducts)) {
|
|
130
|
-
return payloadData.recommendedProducts;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return [];
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
getDisplayPrice(product) {
|
|
137
|
-
return product.displayPrice || product.price || {};
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
dispatchWidgetEvent(eventName, payload) {
|
|
141
|
-
return new Promise(function (resolve, reject) {
|
|
142
|
-
const eventDetail = { resolve, reject };
|
|
143
|
-
const event = createEvent(eventName, payload, eventDetail);
|
|
144
|
-
|
|
145
|
-
window.dispatchEvent(event);
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
getProductImage(product, fallbackProduct) {
|
|
150
|
-
const productImages = product.images || [];
|
|
151
|
-
const fallbackImages = fallbackProduct ? fallbackProduct.images || [] : [];
|
|
152
|
-
const images = productImages.length ? productImages : fallbackImages;
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
images.find(function (item) {
|
|
156
|
-
return item.format === 'product';
|
|
157
|
-
}) ||
|
|
158
|
-
images.find(function (item) {
|
|
159
|
-
return item.imageType === 'PRIMARY';
|
|
160
|
-
}) ||
|
|
161
|
-
images[0] ||
|
|
162
|
-
{}
|
|
163
|
-
);
|
|
102
|
+
return CompleteYourProjectWidget.badgeColorMap[color] || color;
|
|
164
103
|
},
|
|
165
104
|
|
|
166
105
|
getDropdownOptions(product) {
|
|
@@ -199,7 +138,7 @@ Wick.BloomreachWidget = {
|
|
|
199
138
|
return;
|
|
200
139
|
}
|
|
201
140
|
|
|
202
|
-
|
|
141
|
+
CompleteYourProjectWidget.toast.show({
|
|
203
142
|
type: bulkData.messageType,
|
|
204
143
|
text: bulkData.messageText,
|
|
205
144
|
});
|
|
@@ -212,10 +151,10 @@ Wick.BloomreachWidget = {
|
|
|
212
151
|
if (promotionAttributes && promotionAttributes.overlayText) {
|
|
213
152
|
return {
|
|
214
153
|
text: promotionAttributes.overlayText,
|
|
215
|
-
textColor:
|
|
154
|
+
textColor: CompleteYourProjectWidget.getBadgeColor(
|
|
216
155
|
promotionAttributes.overlayTextColor
|
|
217
156
|
),
|
|
218
|
-
color:
|
|
157
|
+
color: CompleteYourProjectWidget.getBadgeColor(
|
|
219
158
|
promotionAttributes.overlayBackgroundColor
|
|
220
159
|
),
|
|
221
160
|
};
|
|
@@ -224,70 +163,6 @@ Wick.BloomreachWidget = {
|
|
|
224
163
|
return product.badge;
|
|
225
164
|
},
|
|
226
165
|
|
|
227
|
-
getWasPrice(product) {
|
|
228
|
-
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
229
|
-
|
|
230
|
-
return displayPrice && displayPrice.wasPrice ? displayPrice.wasPrice : null;
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
getWasPriceFormatted(product) {
|
|
234
|
-
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
235
|
-
const wasPrice = Wick.BloomreachWidget.getWasPrice(product);
|
|
236
|
-
|
|
237
|
-
if (wasPrice && wasPrice.formattedValue) {
|
|
238
|
-
return wasPrice.formattedValue;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if (typeof wasPrice === 'number') {
|
|
242
|
-
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (wasPrice) {
|
|
246
|
-
return `${displayPrice.currencySymbol || '£'}${wasPrice}`;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return '';
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
getDisplayPriceExcVat(product) {
|
|
253
|
-
return product.displayPriceExclusiveVat || product.priceExclusiveVat || null;
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
getPriceValue(price) {
|
|
257
|
-
return price && typeof price.value === 'number' ? price.value : 0;
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
getPriceFormattedValue(price) {
|
|
261
|
-
if (!price) {
|
|
262
|
-
return '';
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if (price.formattedValue) {
|
|
266
|
-
return price.formattedValue;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (typeof price.value === 'number') {
|
|
270
|
-
return Wick.BloomreachWidget.formatPrice(price.value);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
return '';
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
getExcVatWasPrice(product) {
|
|
277
|
-
const displayPriceExclusiveVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
278
|
-
const wasPrice = displayPriceExclusiveVat && displayPriceExclusiveVat.wasPrice;
|
|
279
|
-
|
|
280
|
-
if (wasPrice && wasPrice.formattedValue) {
|
|
281
|
-
return wasPrice.formattedValue;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (typeof wasPrice === 'number') {
|
|
285
|
-
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return wasPrice || '';
|
|
289
|
-
},
|
|
290
|
-
|
|
291
166
|
getExcVatFormattedValue(displayPrice, product) {
|
|
292
167
|
const excVat = product ? Wick.BloomreachWidget.getDisplayPriceExcVat(product) : null;
|
|
293
168
|
if (excVat && excVat.formattedValue) {
|
|
@@ -303,10 +178,10 @@ Wick.BloomreachWidget = {
|
|
|
303
178
|
getProductRenderData(product, index, options = {}) {
|
|
304
179
|
const shouldShowDropdown = index !== 0;
|
|
305
180
|
const dropdownOptions = shouldShowDropdown
|
|
306
|
-
?
|
|
181
|
+
? CompleteYourProjectWidget.getDropdownOptions(product)
|
|
307
182
|
: [];
|
|
308
183
|
const selectedDropdownValue = options.selectedDropdownValue || '';
|
|
309
|
-
const selectedDropdownLabel =
|
|
184
|
+
const selectedDropdownLabel = CompleteYourProjectWidget.getSelectedDropdownLabel(
|
|
310
185
|
dropdownOptions,
|
|
311
186
|
selectedDropdownValue
|
|
312
187
|
);
|
|
@@ -319,19 +194,17 @@ Wick.BloomreachWidget = {
|
|
|
319
194
|
);
|
|
320
195
|
|
|
321
196
|
const wasPriceFormatted = Wick.BloomreachWidget.getWasPriceFormatted(product);
|
|
322
|
-
const excVatFormattedValue =
|
|
197
|
+
const excVatFormattedValue = CompleteYourProjectWidget.getExcVatFormattedValue(
|
|
323
198
|
displayPrice,
|
|
324
199
|
product
|
|
325
200
|
);
|
|
326
201
|
const isSwitchVat = !!(window.ACC && window.ACC.app && window.ACC.app.isVatToggleAvailable);
|
|
327
202
|
|
|
328
|
-
const excVatWasPriceFormatted =
|
|
329
|
-
? Wick.BloomreachWidget.getExcVatWasPrice(product)
|
|
330
|
-
: '';
|
|
203
|
+
const excVatWasPriceFormatted = Wick.BloomreachWidget.getExcVatWasPrice(product);
|
|
331
204
|
|
|
332
205
|
return {
|
|
333
206
|
...product,
|
|
334
|
-
badge:
|
|
207
|
+
badge: CompleteYourProjectWidget.getBadge(product),
|
|
335
208
|
price: displayPrice,
|
|
336
209
|
wasPriceFormatted,
|
|
337
210
|
'switch-vat': isSwitchVat,
|
|
@@ -342,7 +215,11 @@ Wick.BloomreachWidget = {
|
|
|
342
215
|
Wick.BloomreachWidget.getDisplayPriceExcVat(product)
|
|
343
216
|
),
|
|
344
217
|
incVatWasPriceFormatted: wasPriceFormatted,
|
|
218
|
+
wasPriceIncVatFormattedValue: wasPriceFormatted,
|
|
219
|
+
incVatWasPriceFormattedValue: wasPriceFormatted,
|
|
345
220
|
excVatWasPriceFormatted,
|
|
221
|
+
wasPriceExcVatFormattedValue: excVatWasPriceFormatted,
|
|
222
|
+
excVatWasPriceFormattedValue: excVatWasPriceFormatted,
|
|
346
223
|
showFromPrice,
|
|
347
224
|
image:
|
|
348
225
|
options.image ||
|
|
@@ -363,7 +240,7 @@ Wick.BloomreachWidget = {
|
|
|
363
240
|
|
|
364
241
|
renderWidget($container, context) {
|
|
365
242
|
const { widgetContent, widgetWrapper, completeCard, recommendationIndexAttr } =
|
|
366
|
-
|
|
243
|
+
CompleteYourProjectWidget.el;
|
|
367
244
|
|
|
368
245
|
const $content = $container.find(widgetContent);
|
|
369
246
|
const recommendations = Wick.BloomreachWidget.normalizePayload(context);
|
|
@@ -372,16 +249,16 @@ Wick.BloomreachWidget = {
|
|
|
372
249
|
return;
|
|
373
250
|
}
|
|
374
251
|
|
|
375
|
-
|
|
252
|
+
CompleteYourProjectWidget.recommendations = recommendations;
|
|
376
253
|
|
|
377
254
|
$content.html(completeWrapperTemplate());
|
|
378
255
|
|
|
379
256
|
const $wrapper = $content.find(widgetWrapper);
|
|
380
257
|
|
|
381
|
-
|
|
258
|
+
CompleteYourProjectWidget.dropdownCurrent = {};
|
|
382
259
|
|
|
383
260
|
recommendations.forEach(function (recommendation, index) {
|
|
384
|
-
const product =
|
|
261
|
+
const product = CompleteYourProjectWidget.getProductRenderData(
|
|
385
262
|
recommendation.baseProduct,
|
|
386
263
|
index
|
|
387
264
|
);
|
|
@@ -402,7 +279,7 @@ Wick.BloomreachWidget = {
|
|
|
402
279
|
},
|
|
403
280
|
|
|
404
281
|
renderWidgetFromPayload(payloadData) {
|
|
405
|
-
const { widgetContainer, completeWidget } =
|
|
282
|
+
const { widgetContainer, completeWidget } = CompleteYourProjectWidget.el;
|
|
406
283
|
const $containers = $(widgetContainer);
|
|
407
284
|
|
|
408
285
|
if (!$containers.length) {
|
|
@@ -417,46 +294,23 @@ Wick.BloomreachWidget = {
|
|
|
417
294
|
$containers.each(function () {
|
|
418
295
|
const $container = $(this);
|
|
419
296
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
});
|
|
423
|
-
},
|
|
424
|
-
|
|
425
|
-
drawRating($root) {
|
|
426
|
-
const $ratingOverlay = $root.find('.rating-overlay');
|
|
427
|
-
|
|
428
|
-
$ratingOverlay.each(function () {
|
|
429
|
-
let rating = parseFloat($(this).attr('data-rating')) || 0;
|
|
430
|
-
const $stars = $(this).children(Wick.BloomreachWidget.el.starOverlay);
|
|
431
|
-
|
|
432
|
-
$stars.each(function () {
|
|
433
|
-
const $star = $(this);
|
|
434
|
-
|
|
435
|
-
if (rating >= 1) {
|
|
436
|
-
rating--;
|
|
437
|
-
} else if (rating > 0) {
|
|
438
|
-
const width = Math.asin(2 * rating - 1) / Math.PI + 0.5;
|
|
439
|
-
$star.css('width', width + 'rem');
|
|
440
|
-
rating = 0;
|
|
441
|
-
} else {
|
|
442
|
-
$star.css('width', '0rem');
|
|
443
|
-
}
|
|
444
|
-
});
|
|
297
|
+
CompleteYourProjectWidget.renderWidget($container, payloadData);
|
|
298
|
+
CompleteYourProjectWidget.initRenderedWidget($container);
|
|
445
299
|
});
|
|
446
300
|
},
|
|
447
301
|
|
|
448
302
|
getDropdownCard($dropdown) {
|
|
449
|
-
return $dropdown.closest(
|
|
303
|
+
return $dropdown.closest(CompleteYourProjectWidget.el.completeCard);
|
|
450
304
|
},
|
|
451
305
|
|
|
452
306
|
getDropdownCheckbox($dropdown) {
|
|
453
|
-
return
|
|
454
|
-
|
|
307
|
+
return CompleteYourProjectWidget.getDropdownCard($dropdown).find(
|
|
308
|
+
CompleteYourProjectWidget.el.cardCheckbox
|
|
455
309
|
);
|
|
456
310
|
},
|
|
457
311
|
|
|
458
312
|
setDropdownCheckboxState($dropdown, isChecked, shouldTriggerChange = true) {
|
|
459
|
-
const $checkbox =
|
|
313
|
+
const $checkbox = CompleteYourProjectWidget.getDropdownCheckbox($dropdown);
|
|
460
314
|
|
|
461
315
|
if (!$checkbox.length) {
|
|
462
316
|
return;
|
|
@@ -470,18 +324,18 @@ Wick.BloomreachWidget = {
|
|
|
470
324
|
},
|
|
471
325
|
|
|
472
326
|
setDropdownError($dropdown, hasError) {
|
|
473
|
-
$dropdown.toggleClass(
|
|
327
|
+
$dropdown.toggleClass(CompleteYourProjectWidget.el.dropdownErrorClass, hasError);
|
|
474
328
|
},
|
|
475
329
|
|
|
476
330
|
validateDropdown($dropdown, options = {}) {
|
|
477
|
-
const isValid = Boolean($dropdown.data(
|
|
331
|
+
const isValid = Boolean($dropdown.data(CompleteYourProjectWidget.el.selectedValueData));
|
|
478
332
|
|
|
479
|
-
|
|
333
|
+
CompleteYourProjectWidget.setDropdownError($dropdown, !isValid);
|
|
480
334
|
|
|
481
335
|
if (!isValid && options.uncheck) {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
336
|
+
CompleteYourProjectWidget.setDropdownCheckboxState($dropdown, false, false);
|
|
337
|
+
CompleteYourProjectWidget.getDropdownCard($dropdown).removeClass(
|
|
338
|
+
CompleteYourProjectWidget.el.selectedClass
|
|
485
339
|
);
|
|
486
340
|
}
|
|
487
341
|
|
|
@@ -489,13 +343,13 @@ Wick.BloomreachWidget = {
|
|
|
489
343
|
},
|
|
490
344
|
|
|
491
345
|
validateCardDropdown($card, options = {}) {
|
|
492
|
-
const $dropdown = $card.find(
|
|
346
|
+
const $dropdown = $card.find(CompleteYourProjectWidget.el.dropdownRoot);
|
|
493
347
|
|
|
494
348
|
if (!$dropdown.length) {
|
|
495
349
|
return true;
|
|
496
350
|
}
|
|
497
351
|
|
|
498
|
-
return
|
|
352
|
+
return CompleteYourProjectWidget.validateDropdown($dropdown, options);
|
|
499
353
|
},
|
|
500
354
|
|
|
501
355
|
findVariantProduct(recommendation, selectedValue) {
|
|
@@ -509,7 +363,7 @@ Wick.BloomreachWidget = {
|
|
|
509
363
|
},
|
|
510
364
|
|
|
511
365
|
getCardQuantity($card) {
|
|
512
|
-
const $input = $card.find(
|
|
366
|
+
const $input = $card.find(CompleteYourProjectWidget.el.quantityInput);
|
|
513
367
|
const quantity = parseInt($input.val(), 10);
|
|
514
368
|
|
|
515
369
|
return Number.isNaN(quantity) ? 1 : quantity;
|
|
@@ -517,10 +371,10 @@ Wick.BloomreachWidget = {
|
|
|
517
371
|
|
|
518
372
|
getCardProduct($card) {
|
|
519
373
|
const { recommendationIndexAttr, dropdownRoot, selectedValueData } =
|
|
520
|
-
|
|
374
|
+
CompleteYourProjectWidget.el;
|
|
521
375
|
|
|
522
376
|
const recommendationIndex = Number($card.attr(recommendationIndexAttr));
|
|
523
|
-
const recommendation =
|
|
377
|
+
const recommendation = CompleteYourProjectWidget.recommendations[recommendationIndex];
|
|
524
378
|
|
|
525
379
|
if (!recommendation) {
|
|
526
380
|
return null;
|
|
@@ -531,7 +385,7 @@ Wick.BloomreachWidget = {
|
|
|
531
385
|
|
|
532
386
|
if (selectedValue) {
|
|
533
387
|
return (
|
|
534
|
-
|
|
388
|
+
CompleteYourProjectWidget.findVariantProduct(recommendation, selectedValue) ||
|
|
535
389
|
recommendation.baseProduct
|
|
536
390
|
);
|
|
537
391
|
}
|
|
@@ -540,7 +394,7 @@ Wick.BloomreachWidget = {
|
|
|
540
394
|
},
|
|
541
395
|
|
|
542
396
|
getSelectedEntries($root) {
|
|
543
|
-
const { completeCard, cardCheckbox } =
|
|
397
|
+
const { completeCard, cardCheckbox } = CompleteYourProjectWidget.el;
|
|
544
398
|
const entries = [];
|
|
545
399
|
|
|
546
400
|
$root.find(completeCard).each(function () {
|
|
@@ -551,7 +405,7 @@ Wick.BloomreachWidget = {
|
|
|
551
405
|
return;
|
|
552
406
|
}
|
|
553
407
|
|
|
554
|
-
const product =
|
|
408
|
+
const product = CompleteYourProjectWidget.getCardProduct($card);
|
|
555
409
|
|
|
556
410
|
if (!product) {
|
|
557
411
|
return;
|
|
@@ -559,7 +413,7 @@ Wick.BloomreachWidget = {
|
|
|
559
413
|
|
|
560
414
|
entries.push({
|
|
561
415
|
product,
|
|
562
|
-
quantity:
|
|
416
|
+
quantity: CompleteYourProjectWidget.getCardQuantity($card),
|
|
563
417
|
});
|
|
564
418
|
});
|
|
565
419
|
|
|
@@ -567,7 +421,7 @@ Wick.BloomreachWidget = {
|
|
|
567
421
|
},
|
|
568
422
|
|
|
569
423
|
getAddToCartEntries($root) {
|
|
570
|
-
return
|
|
424
|
+
return CompleteYourProjectWidget.getSelectedEntries($root).map(function (entry) {
|
|
571
425
|
return {
|
|
572
426
|
productCode: entry.product.code,
|
|
573
427
|
quantity: entry.quantity,
|
|
@@ -575,22 +429,65 @@ Wick.BloomreachWidget = {
|
|
|
575
429
|
});
|
|
576
430
|
},
|
|
577
431
|
|
|
432
|
+
getSelectedTrackingItems($root) {
|
|
433
|
+
const { completeCard, cardCheckbox, recommendationIndexAttr } =
|
|
434
|
+
CompleteYourProjectWidget.el;
|
|
435
|
+
const items = [];
|
|
436
|
+
|
|
437
|
+
$root.find(completeCard).each(function () {
|
|
438
|
+
const $card = $(this);
|
|
439
|
+
const recommendationIndex = Number($card.attr(recommendationIndexAttr));
|
|
440
|
+
|
|
441
|
+
if (recommendationIndex === 0 || !$card.find(cardCheckbox).prop('checked')) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const recommendation = CompleteYourProjectWidget.recommendations[recommendationIndex];
|
|
446
|
+
const baseProduct = recommendation && recommendation.baseProduct;
|
|
447
|
+
const selectedProduct = CompleteYourProjectWidget.getCardProduct($card);
|
|
448
|
+
|
|
449
|
+
if (!baseProduct || !baseProduct.code || !selectedProduct || !selectedProduct.code) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
items.push({
|
|
454
|
+
item_id: baseProduct.code,
|
|
455
|
+
sku: selectedProduct.code,
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
return items;
|
|
460
|
+
},
|
|
461
|
+
|
|
462
|
+
bindProductTracking($root) {
|
|
463
|
+
const { completeCard, recommendationIndexAttr, titleEl } = CompleteYourProjectWidget.el;
|
|
464
|
+
|
|
465
|
+
$root.off('click.bloomreachWidgetTracking', titleEl);
|
|
466
|
+
$root.on('click.bloomreachWidgetTracking', titleEl, function () {
|
|
467
|
+
const $card = $(this).closest(completeCard);
|
|
468
|
+
const recommendationIndex = Number($card.attr(recommendationIndexAttr));
|
|
469
|
+
|
|
470
|
+
if (recommendationIndex === 0) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const recommendation = CompleteYourProjectWidget.recommendations[recommendationIndex];
|
|
475
|
+
const baseProduct = recommendation && recommendation.baseProduct;
|
|
476
|
+
|
|
477
|
+
CompleteYourProjectWidget.tracking.trackClick(baseProduct && baseProduct.code);
|
|
478
|
+
});
|
|
479
|
+
},
|
|
480
|
+
|
|
578
481
|
updateSummary($root, response = {}) {
|
|
579
482
|
const totalPriceExclusiveVat = response.totalPriceExclusiveVat || response.totalExcVatPrice;
|
|
580
483
|
|
|
581
484
|
const totalWasPriceExclusiveVat =
|
|
582
485
|
response.totalWasPriceExclusiveVat || response.totalExcVatWasPrice;
|
|
583
486
|
|
|
584
|
-
const {
|
|
585
|
-
|
|
586
|
-
summarySalePrice,
|
|
587
|
-
summaryPriceInc,
|
|
588
|
-
summaryPriceExc,
|
|
589
|
-
summarySalePriceInc,
|
|
590
|
-
summarySalePriceExc,
|
|
591
|
-
} = Wick.BloomreachWidget.el;
|
|
487
|
+
const { summaryPriceValue, summarySalePrice } = CompleteYourProjectWidget.el;
|
|
488
|
+
const { vatInc, vatExc } = Wick.BloomreachWidget.el;
|
|
592
489
|
|
|
593
|
-
|
|
490
|
+
CompleteYourProjectWidget.lastCalculationResponse = response;
|
|
594
491
|
|
|
595
492
|
const $price = $root.find(summaryPriceValue);
|
|
596
493
|
const $salePrice = $root.find(summarySalePrice);
|
|
@@ -602,46 +499,43 @@ Wick.BloomreachWidget = {
|
|
|
602
499
|
|
|
603
500
|
if (response.totalWasPrice) {
|
|
604
501
|
$total.addClass('complete-widget__total-sale');
|
|
605
|
-
const $priceInc = $price.find(
|
|
502
|
+
const $priceInc = $price.find(vatInc);
|
|
606
503
|
|
|
607
504
|
if ($priceInc.length) {
|
|
608
505
|
$priceInc.text(response.totalWasPrice);
|
|
609
|
-
$price
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
$salePrice.find(summarySalePriceInc).text(response.totalPrice || '');
|
|
614
|
-
$salePrice
|
|
615
|
-
.find(summarySalePriceExc)
|
|
616
|
-
.text(totalPriceExclusiveVat || response.totalPrice || '');
|
|
506
|
+
$price.find(vatExc).text(totalWasPriceExclusiveVat || response.totalWasPrice);
|
|
507
|
+
|
|
508
|
+
$salePrice.find(vatInc).text(response.totalPrice || '');
|
|
509
|
+
$salePrice.find(vatExc).text(totalPriceExclusiveVat || response.totalPrice || '');
|
|
617
510
|
} else {
|
|
618
511
|
$price.text(response.totalWasPrice);
|
|
619
512
|
$salePrice.text(response.totalPrice || '');
|
|
620
513
|
}
|
|
621
514
|
|
|
622
515
|
$salePrice.show();
|
|
516
|
+
Wick.BloomreachWidget.reapplyVatDisplay();
|
|
623
517
|
return;
|
|
624
518
|
}
|
|
625
519
|
|
|
626
520
|
$total.removeClass('complete-widget__total-sale');
|
|
627
|
-
const $priceInc = $price.find(
|
|
521
|
+
const $priceInc = $price.find(vatInc);
|
|
628
522
|
if ($priceInc.length) {
|
|
629
523
|
$priceInc.text(response.totalPrice || '£0.00');
|
|
630
|
-
$price
|
|
631
|
-
.find(summaryPriceExc)
|
|
632
|
-
.text(totalPriceExclusiveVat || response.totalPrice || '£0.00');
|
|
524
|
+
$price.find(vatExc).text(totalPriceExclusiveVat || response.totalPrice || '£0.00');
|
|
633
525
|
|
|
634
|
-
$salePrice.find(
|
|
635
|
-
$salePrice.find(
|
|
526
|
+
$salePrice.find(vatInc).text('');
|
|
527
|
+
$salePrice.find(vatExc).text('');
|
|
636
528
|
$salePrice.hide();
|
|
637
529
|
} else {
|
|
638
530
|
$price.text(response.totalPrice || '£0.00');
|
|
639
531
|
$salePrice.text('').hide();
|
|
640
532
|
}
|
|
533
|
+
|
|
534
|
+
Wick.BloomreachWidget.reapplyVatDisplay();
|
|
641
535
|
},
|
|
642
536
|
|
|
643
537
|
updateCta($root) {
|
|
644
|
-
const { ctaButton, cardCheckbox } =
|
|
538
|
+
const { ctaButton, cardCheckbox } = CompleteYourProjectWidget.el;
|
|
645
539
|
const selectedCount = $root.find(cardCheckbox).filter(':checked').length;
|
|
646
540
|
const $cta = $root.find(ctaButton);
|
|
647
541
|
|
|
@@ -650,44 +544,43 @@ Wick.BloomreachWidget = {
|
|
|
650
544
|
}
|
|
651
545
|
|
|
652
546
|
$cta.prop('disabled', !selectedCount);
|
|
653
|
-
|
|
547
|
+
CompleteYourProjectWidget.setCtaText(
|
|
548
|
+
$cta,
|
|
549
|
+
CompleteYourProjectWidget.getCtaText(selectedCount)
|
|
550
|
+
);
|
|
654
551
|
},
|
|
655
552
|
|
|
656
553
|
dispatchCalculateTotal($root) {
|
|
657
|
-
|
|
554
|
+
CompleteYourProjectWidget.updateCta($root);
|
|
658
555
|
|
|
659
556
|
return Wick.BloomreachWidget.dispatchWidgetEvent(
|
|
660
|
-
|
|
557
|
+
CompleteYourProjectWidget.CALCULATE_PRODUCT_BUNDLE_TOTAL_EVENT,
|
|
661
558
|
{
|
|
662
|
-
entries:
|
|
559
|
+
entries: CompleteYourProjectWidget.getSelectedEntries($root),
|
|
663
560
|
}
|
|
664
561
|
).then(function (response) {
|
|
665
|
-
|
|
562
|
+
CompleteYourProjectWidget.updateSummary($root, response);
|
|
666
563
|
});
|
|
667
564
|
},
|
|
668
565
|
|
|
669
566
|
dispatchAddToCart($root, $button) {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
return new Promise(function (resolve, reject) {
|
|
673
|
-
const eventDetail = { resolve, reject };
|
|
674
|
-
const event = createEvent(
|
|
675
|
-
Wick.BloomreachWidget.ADD_PRODUCT_BUNDLE_TO_CART_EVENT,
|
|
676
|
-
{
|
|
677
|
-
entries: Wick.BloomreachWidget.getAddToCartEntries($root),
|
|
678
|
-
},
|
|
679
|
-
eventDetail
|
|
680
|
-
);
|
|
567
|
+
CompleteYourProjectWidget.loadingButton.start($button);
|
|
681
568
|
|
|
682
|
-
|
|
683
|
-
|
|
569
|
+
return Wick.BloomreachWidget.dispatchWidgetEvent(
|
|
570
|
+
CompleteYourProjectWidget.ADD_PRODUCT_BUNDLE_TO_CART_EVENT,
|
|
571
|
+
{
|
|
572
|
+
entries: CompleteYourProjectWidget.getAddToCartEntries($root),
|
|
573
|
+
}
|
|
574
|
+
)
|
|
684
575
|
.then(function (response) {
|
|
685
|
-
|
|
576
|
+
CompleteYourProjectWidget.handleBulkAddToCartResponse(response);
|
|
686
577
|
|
|
687
|
-
Wick.MiniBasketSliderFE
|
|
578
|
+
if (Wick.MiniBasketSliderFE) {
|
|
579
|
+
Wick.MiniBasketSliderFE.isMiniBasketLoaded = false;
|
|
580
|
+
}
|
|
688
581
|
})
|
|
689
582
|
.catch(function () {
|
|
690
|
-
|
|
583
|
+
CompleteYourProjectWidget.handleBulkAddToCartResponse({
|
|
691
584
|
bulkAddToCartData: {
|
|
692
585
|
messageType: 'error',
|
|
693
586
|
messageText: 'Selected product(s) were not added to basket',
|
|
@@ -695,19 +588,20 @@ Wick.BloomreachWidget = {
|
|
|
695
588
|
});
|
|
696
589
|
})
|
|
697
590
|
.finally(function () {
|
|
698
|
-
|
|
699
|
-
|
|
591
|
+
CompleteYourProjectWidget.loadingButton.stop($button);
|
|
592
|
+
CompleteYourProjectWidget.updateCta($root);
|
|
700
593
|
});
|
|
701
594
|
},
|
|
702
595
|
|
|
703
596
|
reinitCard($card) {
|
|
704
|
-
const { countBtn, completeWidget } =
|
|
597
|
+
const { countBtn, completeWidget } = CompleteYourProjectWidget.el;
|
|
705
598
|
|
|
706
599
|
$card.find(countBtn).remove();
|
|
707
600
|
|
|
708
|
-
|
|
601
|
+
CompleteYourProjectWidget.initQuantityFields($card);
|
|
709
602
|
Wick.BloomreachWidget.drawRating($card);
|
|
710
|
-
|
|
603
|
+
CompleteYourProjectWidget.alignCardBlocks($card.closest(completeWidget));
|
|
604
|
+
Wick.BloomreachWidget.reapplyVatDisplay();
|
|
711
605
|
},
|
|
712
606
|
|
|
713
607
|
replaceCardWithBaseProduct($dropdown, options = {}) {
|
|
@@ -717,17 +611,17 @@ Wick.BloomreachWidget = {
|
|
|
717
611
|
dropdownRoot,
|
|
718
612
|
dropdownErrorClass,
|
|
719
613
|
cardCheckbox,
|
|
720
|
-
} =
|
|
614
|
+
} = CompleteYourProjectWidget.el;
|
|
721
615
|
|
|
722
616
|
const $card = $dropdown.closest(completeCard);
|
|
723
617
|
const recommendationIndex = Number($card.attr(recommendationIndexAttr));
|
|
724
|
-
const recommendation =
|
|
618
|
+
const recommendation = CompleteYourProjectWidget.recommendations[recommendationIndex];
|
|
725
619
|
|
|
726
620
|
if (!recommendation || !recommendation.baseProduct) {
|
|
727
621
|
return null;
|
|
728
622
|
}
|
|
729
623
|
|
|
730
|
-
const productData =
|
|
624
|
+
const productData = CompleteYourProjectWidget.getProductRenderData(
|
|
731
625
|
recommendation.baseProduct,
|
|
732
626
|
recommendationIndex,
|
|
733
627
|
{
|
|
@@ -750,13 +644,13 @@ Wick.BloomreachWidget = {
|
|
|
750
644
|
$newCard.find(cardCheckbox).prop('checked', false);
|
|
751
645
|
|
|
752
646
|
$newCard
|
|
753
|
-
.find(
|
|
647
|
+
.find(CompleteYourProjectWidget.el.quantityInput)
|
|
754
648
|
.val(1)
|
|
755
|
-
.data(
|
|
756
|
-
.removeData(
|
|
757
|
-
.removeData(
|
|
649
|
+
.data(CompleteYourProjectWidget.el.previousQuantityData, 1)
|
|
650
|
+
.removeData(CompleteYourProjectWidget.el.quantityReadyData)
|
|
651
|
+
.removeData(CompleteYourProjectWidget.el.countStepperInitializedData);
|
|
758
652
|
|
|
759
|
-
|
|
653
|
+
CompleteYourProjectWidget.reinitCard($newCard);
|
|
760
654
|
|
|
761
655
|
return $newCard;
|
|
762
656
|
},
|
|
@@ -769,17 +663,17 @@ Wick.BloomreachWidget = {
|
|
|
769
663
|
dropdownRoot,
|
|
770
664
|
selectedValueData,
|
|
771
665
|
cardCheckbox,
|
|
772
|
-
} =
|
|
666
|
+
} = CompleteYourProjectWidget.el;
|
|
773
667
|
|
|
774
668
|
const $card = $dropdown.closest(completeCard);
|
|
775
669
|
const recommendationIndex = Number($card.attr(recommendationIndexAttr));
|
|
776
|
-
const recommendation =
|
|
670
|
+
const recommendation = CompleteYourProjectWidget.recommendations[recommendationIndex];
|
|
777
671
|
|
|
778
672
|
if (!recommendation) {
|
|
779
673
|
return null;
|
|
780
674
|
}
|
|
781
675
|
|
|
782
|
-
const variantProduct =
|
|
676
|
+
const variantProduct = CompleteYourProjectWidget.findVariantProduct(
|
|
783
677
|
recommendation,
|
|
784
678
|
selectedValue
|
|
785
679
|
);
|
|
@@ -788,7 +682,7 @@ Wick.BloomreachWidget = {
|
|
|
788
682
|
return null;
|
|
789
683
|
}
|
|
790
684
|
|
|
791
|
-
const productData =
|
|
685
|
+
const productData = CompleteYourProjectWidget.getProductRenderData(
|
|
792
686
|
{
|
|
793
687
|
...variantProduct,
|
|
794
688
|
variantOptions: recommendation.baseProduct.variantOptions,
|
|
@@ -818,51 +712,53 @@ Wick.BloomreachWidget = {
|
|
|
818
712
|
$newCard.find(cardCheckbox).prop('checked', true);
|
|
819
713
|
|
|
820
714
|
$newCard
|
|
821
|
-
.find(
|
|
715
|
+
.find(CompleteYourProjectWidget.el.quantityInput)
|
|
822
716
|
.val(1)
|
|
823
|
-
.data(
|
|
824
|
-
.removeData(
|
|
825
|
-
.removeData(
|
|
717
|
+
.data(CompleteYourProjectWidget.el.previousQuantityData, 1)
|
|
718
|
+
.removeData(CompleteYourProjectWidget.el.quantityReadyData)
|
|
719
|
+
.removeData(CompleteYourProjectWidget.el.countStepperInitializedData);
|
|
826
720
|
|
|
827
|
-
|
|
721
|
+
CompleteYourProjectWidget.reinitCard($newCard);
|
|
828
722
|
|
|
829
723
|
return $newCard;
|
|
830
724
|
},
|
|
831
725
|
|
|
832
726
|
handleDropdownSelect($dropdown, selectedValue) {
|
|
833
|
-
const $card = $dropdown.closest(
|
|
834
|
-
const recommendationIndex = $card.attr(
|
|
835
|
-
|
|
727
|
+
const $card = $dropdown.closest(CompleteYourProjectWidget.el.completeCard);
|
|
728
|
+
const recommendationIndex = $card.attr(
|
|
729
|
+
CompleteYourProjectWidget.el.recommendationIndexAttr
|
|
730
|
+
);
|
|
731
|
+
const currentValue = CompleteYourProjectWidget.dropdownCurrent[recommendationIndex];
|
|
836
732
|
|
|
837
733
|
if (`${currentValue}` === `${selectedValue}`) {
|
|
838
734
|
return;
|
|
839
735
|
}
|
|
840
736
|
|
|
841
|
-
|
|
737
|
+
CompleteYourProjectWidget.dropdownCurrent[recommendationIndex] = selectedValue;
|
|
842
738
|
|
|
843
|
-
const $completeWidget = $dropdown.closest(
|
|
739
|
+
const $completeWidget = $dropdown.closest(CompleteYourProjectWidget.el.completeWidget);
|
|
844
740
|
const isPlaceholder = !selectedValue;
|
|
845
741
|
|
|
846
742
|
if (isPlaceholder) {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
743
|
+
CompleteYourProjectWidget.setDropdownError($dropdown, true);
|
|
744
|
+
CompleteYourProjectWidget.setDropdownCheckboxState($dropdown, false, false);
|
|
745
|
+
CompleteYourProjectWidget.replaceCardWithBaseProduct($dropdown, {
|
|
850
746
|
dropdownError: true,
|
|
851
747
|
});
|
|
852
748
|
|
|
853
749
|
if ($completeWidget.length) {
|
|
854
|
-
|
|
750
|
+
CompleteYourProjectWidget.dispatchCalculateTotal($completeWidget);
|
|
855
751
|
}
|
|
856
752
|
|
|
857
753
|
return;
|
|
858
754
|
}
|
|
859
755
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
756
|
+
CompleteYourProjectWidget.setDropdownError($dropdown, false);
|
|
757
|
+
CompleteYourProjectWidget.setDropdownCheckboxState($dropdown, true, false);
|
|
758
|
+
CompleteYourProjectWidget.replaceCardWithVariant($dropdown, selectedValue);
|
|
863
759
|
|
|
864
760
|
if ($completeWidget.length) {
|
|
865
|
-
|
|
761
|
+
CompleteYourProjectWidget.dispatchCalculateTotal($completeWidget);
|
|
866
762
|
}
|
|
867
763
|
},
|
|
868
764
|
|
|
@@ -874,9 +770,9 @@ Wick.BloomreachWidget = {
|
|
|
874
770
|
dropdownOption,
|
|
875
771
|
dropdownOpenClass,
|
|
876
772
|
dropdownOptionSelectedClass,
|
|
877
|
-
} =
|
|
773
|
+
} = CompleteYourProjectWidget.el;
|
|
878
774
|
|
|
879
|
-
|
|
775
|
+
CompleteYourProjectWidget.dropdown = createDropdown({
|
|
880
776
|
root: dropdownRoot,
|
|
881
777
|
toggle: dropdownToggle,
|
|
882
778
|
value: dropdownValue,
|
|
@@ -885,15 +781,15 @@ Wick.BloomreachWidget = {
|
|
|
885
781
|
selectedClass: dropdownOptionSelectedClass,
|
|
886
782
|
namespace: 'bloomreachDropdown',
|
|
887
783
|
onSelect($dropdown, $option, selectedValue) {
|
|
888
|
-
|
|
784
|
+
CompleteYourProjectWidget.handleDropdownSelect($dropdown, selectedValue);
|
|
889
785
|
},
|
|
890
786
|
});
|
|
891
787
|
|
|
892
|
-
|
|
788
|
+
CompleteYourProjectWidget.dropdown.bind();
|
|
893
789
|
},
|
|
894
790
|
|
|
895
791
|
bindCardSelection($root) {
|
|
896
|
-
const { completeCard, cardCheckbox, selectedClass } =
|
|
792
|
+
const { completeCard, cardCheckbox, selectedClass } = CompleteYourProjectWidget.el;
|
|
897
793
|
|
|
898
794
|
const $firstCard = $root.find(completeCard).first();
|
|
899
795
|
|
|
@@ -904,11 +800,11 @@ Wick.BloomreachWidget = {
|
|
|
904
800
|
$root.on('change.bloomreachCardSelection', cardCheckbox, function () {
|
|
905
801
|
const $checkbox = $(this);
|
|
906
802
|
const $card = $checkbox.closest(completeCard);
|
|
907
|
-
const $dropdown = $card.find(
|
|
803
|
+
const $dropdown = $card.find(CompleteYourProjectWidget.el.dropdownRoot);
|
|
908
804
|
|
|
909
805
|
if (
|
|
910
806
|
!$checkbox.prop('checked') &&
|
|
911
|
-
$dropdown.hasClass(
|
|
807
|
+
$dropdown.hasClass(CompleteYourProjectWidget.el.dropdownErrorClass)
|
|
912
808
|
) {
|
|
913
809
|
$card.removeClass(selectedClass);
|
|
914
810
|
return;
|
|
@@ -916,7 +812,7 @@ Wick.BloomreachWidget = {
|
|
|
916
812
|
|
|
917
813
|
if (
|
|
918
814
|
$checkbox.prop('checked') &&
|
|
919
|
-
!
|
|
815
|
+
!CompleteYourProjectWidget.validateCardDropdown($card, {
|
|
920
816
|
uncheck: true,
|
|
921
817
|
})
|
|
922
818
|
) {
|
|
@@ -927,12 +823,12 @@ Wick.BloomreachWidget = {
|
|
|
927
823
|
|
|
928
824
|
$card.toggleClass(selectedClass, this.checked);
|
|
929
825
|
|
|
930
|
-
|
|
826
|
+
CompleteYourProjectWidget.dispatchCalculateTotal($root);
|
|
931
827
|
});
|
|
932
828
|
},
|
|
933
829
|
|
|
934
830
|
bindDropdownValidation($root) {
|
|
935
|
-
const { cardCheckbox, completeCard } =
|
|
831
|
+
const { cardCheckbox, completeCard } = CompleteYourProjectWidget.el;
|
|
936
832
|
|
|
937
833
|
$root.off('click.bloomreachDropdownValidation', cardCheckbox);
|
|
938
834
|
$root.on('click.bloomreachDropdownValidation', cardCheckbox, function () {
|
|
@@ -941,18 +837,24 @@ Wick.BloomreachWidget = {
|
|
|
941
837
|
|
|
942
838
|
if (
|
|
943
839
|
$checkbox.prop('checked') &&
|
|
944
|
-
!
|
|
840
|
+
!CompleteYourProjectWidget.validateCardDropdown($card, {
|
|
945
841
|
uncheck: true,
|
|
946
842
|
})
|
|
947
843
|
) {
|
|
948
844
|
$checkbox.prop('checked', false);
|
|
949
|
-
$card.removeClass(
|
|
845
|
+
$card.removeClass(CompleteYourProjectWidget.el.selectedClass);
|
|
950
846
|
}
|
|
951
847
|
});
|
|
952
848
|
},
|
|
953
849
|
|
|
850
|
+
bindVatToggle() {
|
|
851
|
+
if (Wick.BloomreachWidget.bindVatToggle) {
|
|
852
|
+
Wick.BloomreachWidget.bindVatToggle('completeYourProjectVatToggle');
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
|
|
954
856
|
bindAddToCart($root) {
|
|
955
|
-
const { ctaButton } =
|
|
857
|
+
const { ctaButton } = CompleteYourProjectWidget.el;
|
|
956
858
|
|
|
957
859
|
$root.off('click.bloomreachAddToCart', ctaButton);
|
|
958
860
|
$root.on('click.bloomreachAddToCart', ctaButton, function (event) {
|
|
@@ -962,12 +864,18 @@ Wick.BloomreachWidget = {
|
|
|
962
864
|
|
|
963
865
|
if (
|
|
964
866
|
$button.prop('disabled') ||
|
|
965
|
-
|
|
867
|
+
CompleteYourProjectWidget.loadingButton.isLoading($button)
|
|
966
868
|
) {
|
|
967
869
|
return;
|
|
968
870
|
}
|
|
969
871
|
|
|
970
|
-
|
|
872
|
+
const trackingItems = CompleteYourProjectWidget.getSelectedTrackingItems($root);
|
|
873
|
+
|
|
874
|
+
if (trackingItems.length) {
|
|
875
|
+
CompleteYourProjectWidget.tracking.trackAddToCart(trackingItems);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
CompleteYourProjectWidget.dispatchAddToCart($root, $button);
|
|
971
879
|
});
|
|
972
880
|
},
|
|
973
881
|
|
|
@@ -992,14 +900,14 @@ Wick.BloomreachWidget = {
|
|
|
992
900
|
},
|
|
993
901
|
|
|
994
902
|
alignCardBlocks($root) {
|
|
995
|
-
const { titleEl, optionsEl } =
|
|
903
|
+
const { titleEl, optionsEl } = CompleteYourProjectWidget.el;
|
|
996
904
|
|
|
997
|
-
|
|
998
|
-
|
|
905
|
+
CompleteYourProjectWidget.alignBlock(titleEl, $root);
|
|
906
|
+
CompleteYourProjectWidget.alignBlock(optionsEl, $root);
|
|
999
907
|
},
|
|
1000
908
|
|
|
1001
909
|
setInitialSummary($root) {
|
|
1002
|
-
const entries =
|
|
910
|
+
const entries = CompleteYourProjectWidget.getSelectedEntries($root);
|
|
1003
911
|
const firstEntry = entries[0];
|
|
1004
912
|
|
|
1005
913
|
if (!firstEntry || !firstEntry.product) {
|
|
@@ -1011,7 +919,7 @@ Wick.BloomreachWidget = {
|
|
|
1011
919
|
const priceExcVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
1012
920
|
const wasPriceFormatted = Wick.BloomreachWidget.getWasPriceFormatted(product);
|
|
1013
921
|
|
|
1014
|
-
|
|
922
|
+
CompleteYourProjectWidget.updateSummary($root, {
|
|
1015
923
|
totalPrice: Wick.BloomreachWidget.getPriceFormattedValue(displayPrice) || '£0.00',
|
|
1016
924
|
totalWasPrice: wasPriceFormatted || null,
|
|
1017
925
|
totalPriceExclusiveVat: Wick.BloomreachWidget.getPriceFormattedValue(priceExcVat),
|
|
@@ -1025,18 +933,18 @@ Wick.BloomreachWidget = {
|
|
|
1025
933
|
min: 1,
|
|
1026
934
|
onChange(qty, inputEl) {
|
|
1027
935
|
const $input = $(inputEl);
|
|
1028
|
-
const $card = $input.closest(
|
|
1029
|
-
const $completeWidget = $input.closest(
|
|
1030
|
-
const $checkbox = $card.find(
|
|
936
|
+
const $card = $input.closest(CompleteYourProjectWidget.el.completeCard);
|
|
937
|
+
const $completeWidget = $input.closest(CompleteYourProjectWidget.el.completeWidget);
|
|
938
|
+
const $checkbox = $card.find(CompleteYourProjectWidget.el.cardCheckbox);
|
|
1031
939
|
const previousQuantity =
|
|
1032
|
-
$input.data(
|
|
940
|
+
$input.data(CompleteYourProjectWidget.el.previousQuantityData) || 1;
|
|
1033
941
|
|
|
1034
|
-
if (!$input.data(
|
|
1035
|
-
$input.data(
|
|
942
|
+
if (!$input.data(CompleteYourProjectWidget.el.quantityReadyData)) {
|
|
943
|
+
$input.data(CompleteYourProjectWidget.el.previousQuantityData, qty || 1);
|
|
1036
944
|
return;
|
|
1037
945
|
}
|
|
1038
946
|
|
|
1039
|
-
if (!
|
|
947
|
+
if (!CompleteYourProjectWidget.validateCardDropdown($card)) {
|
|
1040
948
|
$input.val(previousQuantity);
|
|
1041
949
|
|
|
1042
950
|
const $minus = $card.find('.count-btn--minus');
|
|
@@ -1049,22 +957,22 @@ Wick.BloomreachWidget = {
|
|
|
1049
957
|
}
|
|
1050
958
|
|
|
1051
959
|
$checkbox.prop('checked', true);
|
|
1052
|
-
$card.addClass(
|
|
960
|
+
$card.addClass(CompleteYourProjectWidget.el.selectedClass);
|
|
1053
961
|
|
|
1054
|
-
$input.data(
|
|
962
|
+
$input.data(CompleteYourProjectWidget.el.previousQuantityData, qty);
|
|
1055
963
|
$input.trigger('change');
|
|
1056
964
|
|
|
1057
965
|
if ($completeWidget.length) {
|
|
1058
|
-
|
|
966
|
+
CompleteYourProjectWidget.dispatchCalculateTotal($completeWidget);
|
|
1059
967
|
}
|
|
1060
968
|
},
|
|
1061
969
|
});
|
|
1062
970
|
|
|
1063
971
|
stepper.init($root);
|
|
1064
972
|
|
|
1065
|
-
$root.find(inputSel).data(
|
|
973
|
+
$root.find(inputSel).data(CompleteYourProjectWidget.el.quantityReadyData, true);
|
|
1066
974
|
|
|
1067
|
-
|
|
975
|
+
CompleteYourProjectWidget.steppers.push(stepper);
|
|
1068
976
|
},
|
|
1069
977
|
|
|
1070
978
|
initQuantityFields($root) {
|
|
@@ -1073,7 +981,7 @@ Wick.BloomreachWidget = {
|
|
|
1073
981
|
countStepperInitializedData,
|
|
1074
982
|
countStepperRoot,
|
|
1075
983
|
previousQuantityData,
|
|
1076
|
-
} =
|
|
984
|
+
} = CompleteYourProjectWidget.el;
|
|
1077
985
|
|
|
1078
986
|
$root.find(quantityInput).each(function () {
|
|
1079
987
|
const $input = $(this);
|
|
@@ -1091,99 +999,102 @@ Wick.BloomreachWidget = {
|
|
|
1091
999
|
$input.data(countStepperInitializedData, true);
|
|
1092
1000
|
$input.data(previousQuantityData, parseInt($input.val(), 10) || 1);
|
|
1093
1001
|
|
|
1094
|
-
|
|
1002
|
+
CompleteYourProjectWidget.initQuantityField(
|
|
1095
1003
|
$input.closest(countStepperRoot),
|
|
1096
1004
|
`#${inputId}`
|
|
1097
1005
|
);
|
|
1098
1006
|
});
|
|
1099
1007
|
},
|
|
1100
1008
|
|
|
1101
|
-
formatPrice(value) {
|
|
1102
|
-
return new Intl.NumberFormat('en-GB', {
|
|
1103
|
-
style: 'currency',
|
|
1104
|
-
currency: 'GBP',
|
|
1105
|
-
minimumFractionDigits: 2,
|
|
1106
|
-
maximumFractionDigits: 2,
|
|
1107
|
-
}).format(value);
|
|
1108
|
-
},
|
|
1109
|
-
|
|
1110
1009
|
resetWidgetState($root) {
|
|
1111
|
-
$root.find(
|
|
1010
|
+
$root.find(CompleteYourProjectWidget.el.cardCheckbox).prop('checked', false);
|
|
1112
1011
|
|
|
1113
1012
|
$root
|
|
1114
|
-
.find(
|
|
1115
|
-
.removeClass(
|
|
1013
|
+
.find(CompleteYourProjectWidget.el.completeCard)
|
|
1014
|
+
.removeClass(CompleteYourProjectWidget.el.selectedClass);
|
|
1116
1015
|
|
|
1117
1016
|
$root
|
|
1118
|
-
.find(
|
|
1017
|
+
.find(CompleteYourProjectWidget.el.quantityInput)
|
|
1119
1018
|
.val(1)
|
|
1120
|
-
.data(
|
|
1019
|
+
.data(CompleteYourProjectWidget.el.previousQuantityData, 1);
|
|
1121
1020
|
},
|
|
1122
1021
|
|
|
1123
1022
|
resetBackForwardState() {
|
|
1124
|
-
$(
|
|
1023
|
+
$(CompleteYourProjectWidget.el.completeWidget).each(function () {
|
|
1125
1024
|
const $widget = $(this);
|
|
1126
1025
|
|
|
1127
|
-
|
|
1128
|
-
|
|
1026
|
+
CompleteYourProjectWidget.resetWidgetState($widget);
|
|
1027
|
+
CompleteYourProjectWidget.bindCardSelection($widget);
|
|
1129
1028
|
});
|
|
1130
1029
|
},
|
|
1131
1030
|
|
|
1132
1031
|
initRenderedWidget($container) {
|
|
1133
|
-
if (!
|
|
1134
|
-
|
|
1032
|
+
if (!CompleteYourProjectWidget.toast) {
|
|
1033
|
+
CompleteYourProjectWidget.toast = createToast({
|
|
1135
1034
|
template: notificationTemplate,
|
|
1136
1035
|
});
|
|
1137
1036
|
}
|
|
1138
|
-
if (!
|
|
1139
|
-
|
|
1037
|
+
if (!CompleteYourProjectWidget.loadingButton) {
|
|
1038
|
+
CompleteYourProjectWidget.loadingButton = createLoadingButton();
|
|
1140
1039
|
}
|
|
1141
|
-
const $completeWidget = $container.find(
|
|
1040
|
+
const $completeWidget = $container.find(CompleteYourProjectWidget.el.completeWidget);
|
|
1142
1041
|
|
|
1143
1042
|
if (!$completeWidget.length) {
|
|
1144
1043
|
return;
|
|
1145
1044
|
}
|
|
1146
1045
|
|
|
1147
1046
|
Wick.BloomreachWidget.drawRating($completeWidget);
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1047
|
+
CompleteYourProjectWidget.bindCardSelection($completeWidget);
|
|
1048
|
+
CompleteYourProjectWidget.bindDropdowns();
|
|
1049
|
+
CompleteYourProjectWidget.bindDropdownValidation($completeWidget);
|
|
1050
|
+
CompleteYourProjectWidget.bindAddToCart($completeWidget);
|
|
1051
|
+
CompleteYourProjectWidget.bindProductTracking($completeWidget);
|
|
1052
|
+
CompleteYourProjectWidget.bindVatToggle();
|
|
1053
|
+
CompleteYourProjectWidget.initQuantityFields($completeWidget);
|
|
1153
1054
|
|
|
1154
1055
|
$completeWidget
|
|
1155
|
-
.find(
|
|
1156
|
-
.removeClass(
|
|
1056
|
+
.find(CompleteYourProjectWidget.el.dropdownRoot)
|
|
1057
|
+
.removeClass(CompleteYourProjectWidget.el.dropdownErrorClass);
|
|
1157
1058
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1059
|
+
CompleteYourProjectWidget.alignCardBlocks($completeWidget);
|
|
1060
|
+
CompleteYourProjectWidget.updateCta($completeWidget);
|
|
1061
|
+
CompleteYourProjectWidget.setInitialSummary($completeWidget);
|
|
1062
|
+
Wick.BloomreachWidget.reapplyVatDisplay();
|
|
1161
1063
|
},
|
|
1162
1064
|
|
|
1163
1065
|
init(payloadData) {
|
|
1164
|
-
const $containers = $(
|
|
1066
|
+
const $containers = $(CompleteYourProjectWidget.el.widgetContainer);
|
|
1067
|
+
|
|
1068
|
+
CompleteYourProjectWidget.tracking.setPayload(payloadData);
|
|
1165
1069
|
|
|
1166
1070
|
if (!payloadData || !Wick.BloomreachWidget.hasRecommendations(payloadData)) {
|
|
1167
|
-
$containers.find(
|
|
1071
|
+
$containers.find(CompleteYourProjectWidget.el.completeWidget).hide();
|
|
1168
1072
|
return;
|
|
1169
1073
|
}
|
|
1170
1074
|
|
|
1171
|
-
|
|
1075
|
+
CompleteYourProjectWidget.renderWidgetFromPayload(payloadData);
|
|
1076
|
+
|
|
1077
|
+
CompleteYourProjectWidget.tracking.observeView([
|
|
1078
|
+
$containers.find(CompleteYourProjectWidget.el.titleEl).get(0),
|
|
1079
|
+
$containers.find(CompleteYourProjectWidget.el.ctaButton).get(0),
|
|
1080
|
+
]);
|
|
1172
1081
|
},
|
|
1173
1082
|
};
|
|
1174
1083
|
|
|
1175
1084
|
$(document).ready(function () {
|
|
1176
1085
|
Wick.Responsive.onResize(function () {
|
|
1177
|
-
$(
|
|
1178
|
-
const $completeWidget = $(this).find(
|
|
1086
|
+
$(CompleteYourProjectWidget.el.widgetContainer).each(function () {
|
|
1087
|
+
const $completeWidget = $(this).find(CompleteYourProjectWidget.el.completeWidget);
|
|
1179
1088
|
|
|
1180
1089
|
if ($completeWidget.length) {
|
|
1181
|
-
|
|
1090
|
+
CompleteYourProjectWidget.alignCardBlocks($completeWidget);
|
|
1182
1091
|
}
|
|
1183
1092
|
});
|
|
1184
1093
|
});
|
|
1185
1094
|
});
|
|
1186
1095
|
|
|
1187
1096
|
window.addEventListener('pagehide', function () {
|
|
1188
|
-
|
|
1097
|
+
CompleteYourProjectWidget.resetBackForwardState();
|
|
1189
1098
|
});
|
|
1099
|
+
|
|
1100
|
+
export default CompleteYourProjectWidget;
|