wickes-css2 2.113.0 → 2.116.0
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 -1
- package/build/css/category-main.css +1 -1
- package/build/css/components/checkout-payment-details-v2.css +1 -1
- package/build/css/components/checkout-payment-repayment-terms.css +1 -1
- package/build/css/components/price-block-v2-critical.css +1 -1
- package/build/css/components/price-block-v2.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/page_checkout_delivery-new.css +1 -1
- package/build/css/pages/page_product-details-v2-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_products-list-combined.css +1 -1
- package/build/css/pages/page_products-list_v2.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/store-locator-main.css +1 -1
- package/build/js/account-members.min.js +1 -1
- package/build/js/add-project-list-id.min.js +1 -1
- package/build/js/address-book.min.js +1 -1
- package/build/js/basket.min.js +2 -2
- package/build/js/bloomreach-widget.min.js +1 -1
- package/build/js/bundle.min.js +1 -1
- package/build/js/change-password.min.js +1 -1
- package/build/js/checkout.min.js +2 -2
- package/build/js/emulation.min.js +260 -192
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/gift-cards.min.js +1 -1
- package/build/js/kitchen/kitchen-plp.min.js +1 -1
- package/build/js/merged-checkout.min.js +2 -2
- package/build/js/package-bulk-add.min.js +1 -0
- package/build/js/page/bloomreach-widget/bloomreach-recommendation-carousel-widget.js +7 -6
- package/build/js/page/bloomreach-widget/bloomreach-widget-core.js +47 -27
- package/build/js/page/bloomreach-widget/bloomreach-widget.js +5 -0
- package/build/js/page/bloomreach-widget/complete-your-project/view.js +11 -6
- package/build/js/page/bloomreach-widget/complete-your-project/widget.js +0 -1
- package/build/js/page/bloomreach-widget/similar-products-widget.js +17 -0
- package/build/js/page/plp-load-more.js +81 -66
- package/build/js/page/ripple/bulk-add.js +71 -0
- package/build/js/page/ripple/package-bulk-add.js +43 -0
- package/build/js/page/ripple/postcode-checker.js +83 -0
- package/build/js/page/ripple/thumb-gallery.js +236 -0
- package/build/js/page/utils/validation.js +1 -1
- package/build/js/pdp.bundle.min.js +2 -2
- package/build/js/personal-details.min.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/postcode-checker.min.js +1 -0
- package/build/js/project-list.min.js +2 -2
- package/build/js/quiz.min.js +1 -1
- package/build/js/track-my-order.min.js +1 -1
- package/package.json +1 -1
- package/src/badges-ripple.html +120 -0
- package/src/badges.html +9 -18
- package/src/components/bloomreach/complete-card.hbs +1 -1
- package/src/components/bloomreach/why-not-add-card.hbs +26 -7
- package/src/components/bloomreach/why-not-add.hbs +1 -1
- package/src/components/fulfilment-accordions.hbs +1 -1
- package/src/components/image-accordion.hbs +18 -0
- package/src/components/kitchen/price.hbs +49 -29
- package/src/components/kitchen/strip-stickers.hbs +9 -3
- package/src/components/package-card.hbs +30 -0
- package/src/components/pdp-price-actions.hbs +17 -0
- package/src/components/postcode-checker.hbs +24 -0
- package/src/components/price-badges.hbs +12 -10
- package/src/components/price-block-v2.hbs +289 -199
- package/src/components/product-main-info-v2.hbs +2 -0
- package/src/components/suite-includes.hbs +66 -0
- package/src/components/suite-product-card.hbs +47 -0
- package/src/components/thumb-gallery.hbs +23 -0
- package/src/data/data_badges.json +143 -0
- package/src/data/data_bathroom-plp.json +814 -0
- package/src/data/data_suite-includes-products.json +134 -0
- package/src/js/components/banner-placement-manager.js +25 -9
- package/src/js/components/general/image-accordion.js +54 -0
- package/src/js/components/general/switchVat.js +8 -1
- package/src/js/components/package-card.js +69 -0
- package/src/js/components/store-locator-cards.js +76 -0
- package/src/js/emulation/banner-placement-manager.js +219 -188
- package/src/js/emulation/bloomreach-widget-calculations.js +1 -1
- package/src/js/emulation/mock.js +66 -34
- package/src/js/emulation/plp-load-more.js +13 -4
- package/src/js/emulation/postcode-checker.js +11 -0
- package/src/js/emulation/similar-products-loading.js +22 -0
- package/src/js/page/bloomreach-widget/bloomreach-recommendation-carousel-widget.js +7 -6
- package/src/js/page/bloomreach-widget/bloomreach-widget-core.js +47 -27
- package/src/js/page/bloomreach-widget/bloomreach-widget.js +5 -0
- package/src/js/page/bloomreach-widget/complete-your-project/view.js +11 -6
- package/src/js/page/bloomreach-widget/complete-your-project/widget.js +0 -1
- package/src/js/page/bloomreach-widget/similar-products-widget.js +17 -0
- package/src/js/page/plp-load-more.js +81 -66
- package/src/js/page/ripple/bulk-add.js +71 -0
- package/src/js/page/ripple/package-bulk-add.js +43 -0
- package/src/js/page/ripple/postcode-checker.js +83 -0
- package/src/js/page/ripple/thumb-gallery.js +236 -0
- package/src/js/page/utils/validation.js +1 -1
- package/src/page_bathroom-plp-vat.html +81 -0
- package/src/page_bathroom-plp-without-load-more.html +83 -0
- package/src/page_bathroom-plp.html +98 -0
- package/src/page_checkout_delivery-details-v2-calendar-not-loaded.html +167 -0
- package/src/page_checkout_payment-details-v2-asm.html +2 -3
- package/src/page_checkout_payment-details-v2.html +2 -3
- package/src/page_checkout_payment-details_with-card-loader.html +2 -3
- package/src/page_checkout_payment-details_with-klarna-loader.html +2 -3
- package/src/page_checkout_payment-details_with-loader-v2.html +2 -3
- package/src/page_klarna_payment-details_with-klarna.html +2 -3
- package/src/page_payment-details-billie-registered-only.html +2 -3
- package/src/page_payment-details-billie-unregistered-only.html +2 -3
- package/src/page_payment-details-with-billie.html +2 -3
- package/src/page_payment-details-with-clearpay.html +2 -3
- package/src/page_payment-details-with-gift-card.html +2 -3
- package/src/page_payment-details_with_apple-pay.html +0 -1
- package/src/page_payment-details_with_google-pay.html +2 -3
- package/src/page_product-details-banner.html +1 -3
- package/src/page_product-details-big-wins-disabled-delivery.html +1 -3
- package/src/page_product-details-big-wins-non-registered.html +1 -3
- package/src/page_product-details-big-wins-out-nearest.html +1 -3
- package/src/page_product-details-big-wins-unhappy.html +1 -3
- package/src/page_product-details-big-wins.html +1 -3
- package/src/page_product-details-billie.html +1 -3
- package/src/page_product-details-calculator.html +1 -3
- package/src/page_product-details-cashback-v2.html +1 -3
- package/src/page_product-details-clearpay.html +1 -3
- package/src/page_product-details-cnc-error-notification.html +1 -3
- package/src/page_product-details-cnc-success-notification-vat.html +1 -4
- package/src/page_product-details-cnc-success-notification.html +1 -3
- package/src/page_product-details-default-store.html +1 -3
- package/src/page_product-details-energy-efficiency.html +1 -3
- package/src/page_product-details-flooring-with-pr-placeholder.html +1 -3
- package/src/page_product-details-flooring.html +1 -3
- package/src/page_product-details-gallery-actual.html +1 -3
- package/src/page_product-details-mfe-calculator.html +1 -3
- package/src/page_product-details-mtm-doors.html +1 -3
- package/src/page_product-details-only-clearpay.html +1 -3
- package/src/page_product-details-paint-mixing.html +1 -3
- package/src/page_product-details-ripple-gallery-1-image.html +120 -0
- package/src/page_product-details-ripple-gallery-missing-image.html +121 -0
- package/src/page_product-details-ripple-gallery.html +121 -0
- package/src/page_product-details-saved-pl.html +1 -3
- package/src/page_product-details-suite-includes-banners.html +139 -0
- package/src/page_product-details-suite-includes-billie.html +128 -0
- package/src/page_product-details-suite-includes-klarna.html +120 -0
- package/src/page_product-details-suite-includes-vat.html +126 -0
- package/src/page_product-details-suite-includes.html +122 -0
- package/src/page_product-details-tile-steps-klarna-widget-with-method-ids.html +1 -3
- package/src/page_product-details-tile-steps-logout.html +1 -3
- package/src/page_product-details-tile-steps-no-new-project-list.html +1 -3
- package/src/page_product-details-tile-steps-with-klarna.html +1 -3
- package/src/page_product-details-tile-steps.html +1 -3
- package/src/page_product-details-v2.html +1 -3
- package/src/page_product-details-vat.html +1 -3
- package/src/page_product-details-wisdom-mcfc-registered.html +1 -3
- package/src/page_product-details-wisdom-mcfc.html +1 -3
- package/src/page_product-details-wisdom-oos-registered.html +1 -3
- package/src/page_product-details-wisdom-oos.html +1 -3
- package/src/page_product-details-wisdom-registered.html +1 -3
- package/src/page_product-details-wisdom.html +1 -3
- package/src/page_product-details-with-favourite.html +1 -3
- package/src/page_product-details-with-global-search-v2.html +2 -3
- package/src/page_product-details-with-similar-products-widget.html +132 -0
- package/src/page_product-details-with-why-not-add-single.html +1 -0
- package/src/page_product-details_no-previous-default.html +1 -3
- package/src/scss/common/_loading-button.scss +3 -1
- package/src/scss/components/_date-selection-add-new-styles.scss +53 -3
- package/src/scss/components/_gift-cards.scss +1 -1
- package/src/scss/components/_image-accordion.scss +54 -0
- package/src/scss/components/_kitchen-card.scss +1 -0
- package/src/scss/components/_map.scss +38 -0
- package/src/scss/components/_package-card.scss +65 -0
- package/src/scss/components/_package-plp.scss +88 -0
- package/src/scss/components/_postcode-checker.scss +115 -0
- package/src/scss/components/_price-badges-critical.scss +10 -0
- package/src/scss/components/_price-badges.scss +10 -0
- package/src/scss/components/_price-block-critical.scss +1 -0
- package/src/scss/components/_price-block.scss +1 -0
- package/src/scss/components/_suite-includes.scss +141 -0
- package/src/scss/components/_suite-product-card.scss +98 -0
- package/src/scss/components/_thumb-gallery-critical.scss +35 -0
- package/src/scss/components/_thumb-gallery.scss +200 -0
- package/src/scss/components/bloomreach/_why-not-add.scss +3 -1
- package/src/scss/components/checkout-payment-details-v2.scss +44 -20
- package/src/scss/components/checkout-payment-repayment-terms.scss +0 -1
- package/src/scss/components/kitchen/_price.scss +10 -0
- package/src/scss/components/kitchen/_strip-stickers.scss +46 -0
- package/src/scss/components/price-block-v2-critical.scss +62 -0
- package/src/scss/components/price-block-v2.scss +62 -0
- package/src/scss/pages/_checkout_delivery-details.scss +16 -104
- package/src/scss/pages/page_checkout_delivery-new.scss +252 -164
- package/src/scss/pages/page_product-details-v2-critical.scss +216 -109
- package/src/scss/pages/page_product-details-v2.scss +168 -107
- package/src/scss/pages/page_product-details.scss +11 -0
- package/src/scss/pages/page_products-list-combined.scss +8 -6
- package/src/scss/pages/page_products-list_v2.scss +8 -6
- package/src/scss/pdp-main-critical.scss +1 -0
- package/src/scss/pdp-main.scss +6 -0
- package/src/scss/plp-main.scss +5 -0
- package/src/sitemap.html +29 -6
- package/build/css/components/kitchen/strip-stickers.css +0 -1
- package/build/css/components/strip-stickers.css +0 -1
- package/src/scss/components/kitchen/strip-stickers.scss +0 -18
- package/src/scss/components/strip-stickers.scss +0 -18
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isValidPostcodeField } from '../utils/validation';
|
|
2
|
+
import { createBulkAddHelper, dispatchWindowEvent } from './bulk-add';
|
|
3
|
+
|
|
4
|
+
var Wick = window.Wick || {};
|
|
5
|
+
|
|
6
|
+
Wick.PostcodeChecker = (function () {
|
|
7
|
+
const POSTCODE_CHECK_AVAILABILITY_EVENT = 'postcodeCheckAviability';
|
|
8
|
+
const QUANTITY = 1;
|
|
9
|
+
|
|
10
|
+
const selectors = {
|
|
11
|
+
root: '.postcode-checker',
|
|
12
|
+
input: '.postcode-checker__input',
|
|
13
|
+
button: '.postcode-checker__button',
|
|
14
|
+
productCodeInput: '.pdp-price input[name=productCodePost]',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const modifiers = {
|
|
18
|
+
hasError: 'postcode-checker--error',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const bulkAdd = createBulkAddHelper({ productCodeSelector: selectors.productCodeInput });
|
|
22
|
+
|
|
23
|
+
function checkPostcodeAvailability(postcode) {
|
|
24
|
+
const payload = { postcode, productCode: bulkAdd.getProductCode(), quantity: QUANTITY };
|
|
25
|
+
|
|
26
|
+
return dispatchWindowEvent(POSTCODE_CHECK_AVAILABILITY_EVENT, payload);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function bulkAddForPostcode(postcode) {
|
|
30
|
+
try {
|
|
31
|
+
await checkPostcodeAvailability(postcode);
|
|
32
|
+
bulkAdd.showBulkAddResult(await bulkAdd.addProductToCart(postcode));
|
|
33
|
+
Wick.MiniBasketSliderFE.isMiniBasketLoaded = false;
|
|
34
|
+
} catch {
|
|
35
|
+
bulkAdd.showBulkAddFailed();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function isPostcodeValid($component, $postcodeInput) {
|
|
40
|
+
const isValid = isValidPostcodeField($postcodeInput.val());
|
|
41
|
+
$component.toggleClass(modifiers.hasError, !isValid);
|
|
42
|
+
console.log({ isValid, val: $postcodeInput.val() });
|
|
43
|
+
return isValid;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function handleSubmitClick($component, $postcodeInput, $submitButton) {
|
|
47
|
+
if (
|
|
48
|
+
bulkAdd.loadingButton.isLoading($submitButton) ||
|
|
49
|
+
!isPostcodeValid($component, $postcodeInput)
|
|
50
|
+
) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
bulkAdd.loadingButton.start($submitButton);
|
|
55
|
+
|
|
56
|
+
const postcode = $postcodeInput.val();
|
|
57
|
+
|
|
58
|
+
bulkAddForPostcode(postcode).finally(function () {
|
|
59
|
+
bulkAdd.loadingButton.stop($submitButton);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function init() {
|
|
64
|
+
bulkAdd.init();
|
|
65
|
+
|
|
66
|
+
$(selectors.root).each(function () {
|
|
67
|
+
const $component = $(this);
|
|
68
|
+
const $postcodeInput = $component.find(selectors.input);
|
|
69
|
+
const $submitButton = $component.find(selectors.button);
|
|
70
|
+
|
|
71
|
+
$component.removeClass(modifiers.hasError);
|
|
72
|
+
|
|
73
|
+
$submitButton.on('click', function (e) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
handleSubmitClick($component, $postcodeInput, $submitButton);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { init };
|
|
81
|
+
})();
|
|
82
|
+
|
|
83
|
+
$(document).ready(Wick.PostcodeChecker.init);
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
var Wick = window.Wick || {};
|
|
2
|
+
|
|
3
|
+
Wick.ThumbGallery = (function () {
|
|
4
|
+
const IMG_BREAKPOINTS = [
|
|
5
|
+
{ media: '(max-width: 576px)', w: 576, h: 324 },
|
|
6
|
+
{ media: '(max-width: 768px)', w: 510, h: 287 },
|
|
7
|
+
{ media: '(max-width: 992px)', w: 310, h: 174 },
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
const MAIN_DEFAULT = { w: 710, h: 399 };
|
|
11
|
+
const THUMB = { w: 100, h: 56 };
|
|
12
|
+
|
|
13
|
+
function getMediaDomain() {
|
|
14
|
+
return (typeof window !== 'undefined' && window.mediaDomain) || 'media.wickes.co.uk';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getProductName() {
|
|
18
|
+
return (typeof window !== 'undefined' && window.pdpProduct && window.pdpProduct.name) || '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getBaseUrl(customDomain) {
|
|
22
|
+
const domain = customDomain || getMediaDomain();
|
|
23
|
+
const cleanDomain = domain.replace(/^https?:\/\//, '').replace(/\/$/, '');
|
|
24
|
+
return `https://${cleanDomain}/image/upload/`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function buildCloudinaryUrl(publicId, w, h, baseUrl) {
|
|
28
|
+
const base = baseUrl || getBaseUrl();
|
|
29
|
+
const cleanId = String(publicId).replace(/^\/+/, '');
|
|
30
|
+
const transforms = `b_rgb:FFFFFF,c_pad,dpr_1.0,f_jpg,h_${h},q_auto:good,w_${w}`;
|
|
31
|
+
return `${base}${transforms}/c_pad,h_${h},w_${w}/v1/${cleanId}?pgw=1`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function parseIdentifiers(hybrisString) {
|
|
35
|
+
if (Array.isArray(hybrisString)) {
|
|
36
|
+
return hybrisString.filter(Boolean);
|
|
37
|
+
}
|
|
38
|
+
if (!hybrisString || typeof hybrisString !== 'string') {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const trimmed = hybrisString.trim();
|
|
42
|
+
const content = trimmed.startsWith('[') && trimmed.endsWith(']')
|
|
43
|
+
? trimmed.slice(1, -1)
|
|
44
|
+
: trimmed;
|
|
45
|
+
|
|
46
|
+
return content
|
|
47
|
+
.split(',')
|
|
48
|
+
.map((s) => s.trim())
|
|
49
|
+
.filter(Boolean);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function renderMainSlide(src, sourcesHtml = '') {
|
|
53
|
+
const productName = getProductName();
|
|
54
|
+
return `<div class="thumb-gallery__slide-wrapper swiper-slide">
|
|
55
|
+
<picture>
|
|
56
|
+
${sourcesHtml}
|
|
57
|
+
<img class="swiper-slide-main" src="${src}" alt="${productName}">
|
|
58
|
+
</picture>
|
|
59
|
+
</div>`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function renderThumbSlide(src) {
|
|
63
|
+
const productName = getProductName();
|
|
64
|
+
return `<div class="thumb-gallery__slide-wrapper swiper-slide">
|
|
65
|
+
<img class="swiper-slide-thumbs" src="${src}" alt="${productName}">
|
|
66
|
+
</div>`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function generateCloudinaryMainSlide(publicId, baseUrl) {
|
|
70
|
+
const sourcesHtml = IMG_BREAKPOINTS.map(
|
|
71
|
+
(bp) => `<source srcset="${buildCloudinaryUrl(publicId, bp.w, bp.h, baseUrl)}" media="${bp.media}">`
|
|
72
|
+
).join('\n ');
|
|
73
|
+
const fallbackSrc = buildCloudinaryUrl(publicId, MAIN_DEFAULT.w, MAIN_DEFAULT.h, baseUrl);
|
|
74
|
+
return renderMainSlide(fallbackSrc, sourcesHtml);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function generateCloudinaryThumbSlide(publicId, baseUrl) {
|
|
78
|
+
const src = buildCloudinaryUrl(publicId, THUMB.w, THUMB.h, baseUrl);
|
|
79
|
+
return renderThumbSlide(src);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const SELECTORS = {
|
|
83
|
+
galleryCarousel: '.thumb-gallery',
|
|
84
|
+
swiperContainerMain: '.swiper-container-main',
|
|
85
|
+
swiperContainerThumbs: '.swiper-container-thumbs',
|
|
86
|
+
swiperMainWrapper: '.swiper-container-main .swiper-wrapper',
|
|
87
|
+
swiperThumbsWrapper: '.swiper-container-thumbs .swiper-wrapper',
|
|
88
|
+
nextBtn: '.thumb-gallery__next-btn',
|
|
89
|
+
prevBtn: '.thumb-gallery__prev-btn',
|
|
90
|
+
thumbNextBtn: '.swiper-container-thumbs__next-btn',
|
|
91
|
+
thumbPrevBtn: '.swiper-container-thumbs__prev-btn',
|
|
92
|
+
swiperSlide: '.swiper-slide',
|
|
93
|
+
activeThumbClass: 'swiper-true-active',
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const THUMBS_SWIPER_CONFIG = {
|
|
97
|
+
spaceBetween: 8,
|
|
98
|
+
slidesPerView: 8,
|
|
99
|
+
watchSlidesVisibility: true,
|
|
100
|
+
watchSlidesProgress: true,
|
|
101
|
+
watchOverflow: true,
|
|
102
|
+
observer: true,
|
|
103
|
+
observeParents: true,
|
|
104
|
+
simulateTouch: false,
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const THUMBS_BREAKPOINTS = {
|
|
108
|
+
991: { slidesPerView: 5 },
|
|
109
|
+
767: { allowTouchMove: true, slidesPerView: 5 },
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const MAIN_SWIPER_CONFIG = {
|
|
113
|
+
speed: 400,
|
|
114
|
+
slidesPerView: 1,
|
|
115
|
+
loop: true,
|
|
116
|
+
observer: true,
|
|
117
|
+
observeParents: true,
|
|
118
|
+
simulateTouch: false,
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
function handleThumbClick(swiper) {
|
|
122
|
+
return function () {
|
|
123
|
+
const clickedIndex = $(this).index();
|
|
124
|
+
if (swiper.params && swiper.params.loop) {
|
|
125
|
+
swiper.slideToLoop(clickedIndex);
|
|
126
|
+
} else {
|
|
127
|
+
swiper.slideTo(clickedIndex);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function updateActiveThumbnail(swiper, thumbsSwiper) {
|
|
133
|
+
const activeIndex = swiper.realIndex;
|
|
134
|
+
thumbsSwiper.slides.removeClass(SELECTORS.activeThumbClass);
|
|
135
|
+
thumbsSwiper.slides.eq(activeIndex).addClass(SELECTORS.activeThumbClass);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function getThumbsConfig($thumbNextBtn, $thumbPrevBtn) {
|
|
139
|
+
return {
|
|
140
|
+
...THUMBS_SWIPER_CONFIG,
|
|
141
|
+
navigation: {
|
|
142
|
+
nextEl: $thumbNextBtn[0],
|
|
143
|
+
prevEl: $thumbPrevBtn[0],
|
|
144
|
+
},
|
|
145
|
+
breakpoints: { ...THUMBS_BREAKPOINTS },
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function getMainSwiperConfig($nextBtn, $prevBtn, thumbsSwiper, onSlideChange, count) {
|
|
150
|
+
return {
|
|
151
|
+
...MAIN_SWIPER_CONFIG,
|
|
152
|
+
loop: count > 1,
|
|
153
|
+
simulateTouch: count > 1,
|
|
154
|
+
navigation: {
|
|
155
|
+
nextEl: $nextBtn[0],
|
|
156
|
+
prevEl: $prevBtn[0],
|
|
157
|
+
},
|
|
158
|
+
thumbs: { swiper: thumbsSwiper },
|
|
159
|
+
on: { slideChange: onSlideChange },
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function initializeCarousel($slider, ids, baseUrl, missingImage) {
|
|
164
|
+
const isMissing = ids.length === 0 && Boolean(missingImage);
|
|
165
|
+
if (ids.length === 0 && !missingImage) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const $container = $slider.find(SELECTORS.swiperContainerMain);
|
|
170
|
+
const $thumbContainer = $slider.find(SELECTORS.swiperContainerThumbs);
|
|
171
|
+
if (!$container.length || !$thumbContainer.length) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if ($container[0].swiper) {
|
|
176
|
+
$container[0].swiper.destroy(true, true);
|
|
177
|
+
}
|
|
178
|
+
if ($thumbContainer[0].swiper) {
|
|
179
|
+
$thumbContainer[0].swiper.destroy(true, true);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const total = isMissing ? 1 : ids.length;
|
|
183
|
+
$slider.attr('data-length', total);
|
|
184
|
+
|
|
185
|
+
if (isMissing) {
|
|
186
|
+
$slider.addClass('thumb-gallery--missing-image');
|
|
187
|
+
$slider.find(SELECTORS.swiperMainWrapper).html(renderMainSlide(missingImage));
|
|
188
|
+
$slider.find(SELECTORS.swiperThumbsWrapper).html(renderThumbSlide(missingImage));
|
|
189
|
+
} else {
|
|
190
|
+
$slider.removeClass('thumb-gallery--missing-image');
|
|
191
|
+
$slider
|
|
192
|
+
.find(SELECTORS.swiperMainWrapper)
|
|
193
|
+
.html(ids.map((id) => generateCloudinaryMainSlide(id, baseUrl)).join('\n'));
|
|
194
|
+
$slider
|
|
195
|
+
.find(SELECTORS.swiperThumbsWrapper)
|
|
196
|
+
.html(ids.map((id) => generateCloudinaryThumbSlide(id, baseUrl)).join('\n'));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const $nextBtn = $slider.find(SELECTORS.nextBtn);
|
|
200
|
+
const $prevBtn = $slider.find(SELECTORS.prevBtn);
|
|
201
|
+
const $thumbNextBtn = $slider.find(SELECTORS.thumbNextBtn);
|
|
202
|
+
const $thumbPrevBtn = $slider.find(SELECTORS.thumbPrevBtn);
|
|
203
|
+
|
|
204
|
+
const thumbsSwiper = new Swiper(
|
|
205
|
+
$thumbContainer[0],
|
|
206
|
+
getThumbsConfig($thumbNextBtn, $thumbPrevBtn)
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const swiper = new Swiper(
|
|
210
|
+
$container[0],
|
|
211
|
+
getMainSwiperConfig($nextBtn, $prevBtn, thumbsSwiper, () => {
|
|
212
|
+
updateActiveThumbnail(swiper, thumbsSwiper);
|
|
213
|
+
}, total)
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
$thumbContainer
|
|
217
|
+
.off('click', SELECTORS.swiperSlide)
|
|
218
|
+
.on('click', SELECTORS.swiperSlide, handleThumbClick(swiper));
|
|
219
|
+
|
|
220
|
+
updateActiveThumbnail(swiper, thumbsSwiper);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function init(hybrisString, options = {}) {
|
|
224
|
+
const ids = parseIdentifiers(hybrisString);
|
|
225
|
+
|
|
226
|
+
const opts = typeof options === 'string' ? { mediaDomain: options } : (options || {});
|
|
227
|
+
const baseUrl = getBaseUrl(opts.mediaDomain);
|
|
228
|
+
const missingImage = opts.missingImage || '';
|
|
229
|
+
|
|
230
|
+
$(SELECTORS.galleryCarousel).each(function (_, slider) {
|
|
231
|
+
initializeCarousel($(slider), ids, baseUrl, missingImage);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return { init };
|
|
236
|
+
})();
|
|
@@ -148,7 +148,7 @@ export function validatePostcode(element, ifConvert) {
|
|
|
148
148
|
export function isValidPostcodeField(value) {
|
|
149
149
|
const transformedValue = value.toUpperCase().replaceAll(' ', '');
|
|
150
150
|
const regExp = new RegExp(
|
|
151
|
-
'^(
|
|
151
|
+
'^((GIR0AA)|((([A-PR-UWYZ][0-9][0-9]?)|([A-PR-UWYZ][A-HK-Y][0-9][0-9]?)|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))[0-9][A-BD-HJLNP-UW-Z]{2}))$'
|
|
152
152
|
);
|
|
153
153
|
return transformedValue.replace(/\s+/g, '').length > 4 && regExp.test(transformedValue);
|
|
154
154
|
}
|