wickes-css2 2.103.0-RG-1658-apply-dynamic-logic-gift-card.1 → 2.103.0-develop.1
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 +3 -1
- package/build/css/components/card-product-banner.css +1 -1
- package/build/css/components/checkout-payment-details-v2.css +1 -1
- package/build/css/main.css +1 -1
- package/build/css/pages/page_checkout_delivery-new.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/plp-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/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 +70 -268
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/merged-checkout.min.js +2 -2
- package/build/js/page/components/order-summary.js +25 -42
- package/build/js/page/plp-cards-v2.js +15 -6
- package/build/js/page/plp-load-more.js +1 -1
- package/build/js/page/utils/validation.js +1 -46
- package/build/js/pdp.bundle.min.js +1 -1
- package/build/js/personal-details.min.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/project-list.min.js +1 -44
- package/build/js/quiz.min.js +1 -1
- package/build/js/track-my-order.min.js +1 -1
- package/package.json +2 -2
- package/src/components/card_product_v2.hbs +10 -5
- package/src/components/card_sponsor_banner.hbs +8 -0
- package/src/components/card_sponsor_product.hbs +6 -0
- package/src/components/checkout-payment-details-v2.hbs +2 -3
- package/src/components/injected-content.hbs +1 -1
- package/src/data/data_search-results_v2.json +56 -141
- package/src/elements/form-row.hbs +1 -1
- package/src/elements/input.hbs +2 -31
- package/src/js/components/banner-placement-manager.js +258 -0
- package/src/js/components/general/notification.js +1 -2
- package/src/js/components/toggle-password-visibility.js +58 -0
- package/src/js/emulation/banner-placement-manager.js +53 -0
- package/src/js/emulation/checkout-payment-details.js +14 -23
- package/src/js/emulation/forms.js +2 -7
- package/src/js/page/components/order-summary.js +25 -42
- package/src/js/page/plp-cards-v2.js +15 -6
- package/src/js/page/plp-load-more.js +1 -1
- package/src/js/page/utils/validation.js +1 -46
- package/src/layouts/checkout.hbs +5 -1
- package/src/page_my-account_change-password.html +0 -1
- package/src/page_payment-details-with-gift-card.html +4 -7
- package/src/page_plp_v2.html +16 -6
- package/src/page_search-results.html +12 -2
- package/src/scss/components/card-product-banner.scss +91 -3
- package/src/scss/components/checkout-payment-details-v2.scss +0 -2
- package/src/scss/pages/page_checkout_delivery-new.scss +0 -26
- package/src/scss/pages/page_products-list-combined.scss +11 -0
- package/src/scss/pages/page_products-list.scss +8 -0
- package/build/img/giftcard.svg +0 -28
- package/build/js/gift-cards.min.js +0 -1
- package/build/js/page/components/gift-cards.js +0 -877
- package/build/js/page/components/toggle-password-visibility.js +0 -22
- package/build/js/page/utils/gift-cards-utils.js +0 -144
- package/build/js/page/utils/input-handling.js +0 -92
- package/build/js/page/utils/show-hide-input.js +0 -28
- package/build/js/toggle-password-visibility.min.js +0 -1
- package/src/components/gift-cards-hint.hbs +0 -9
- package/src/components/gift-cards.hbs +0 -90
- package/src/components/giftcard-chip.hbs +0 -23
- package/src/components/giftcard-summary.hbs +0 -6
- package/src/img/giftcard.svg +0 -28
- package/src/js/components/product-banner.js +0 -148
- package/src/js/emulation/checkout-data.js +0 -35
- package/src/js/emulation/gift-cards.js +0 -201
- package/src/js/page/components/gift-cards.js +0 -877
- package/src/js/page/components/toggle-password-visibility.js +0 -22
- package/src/js/page/utils/gift-cards-utils.js +0 -144
- package/src/js/page/utils/input-handling.js +0 -92
- package/src/js/page/utils/show-hide-input.js +0 -28
- package/src/scss/components/_gift-cards.scss +0 -361
|
@@ -13,46 +13,31 @@ const osEl = {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function updateOrderSummary(data, equalMap, isVoucher) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
16
|
+
equalMap.forEach((obj) => {
|
|
17
|
+
if ($(obj.item).length) {
|
|
18
|
+
$(obj.item).show();
|
|
19
|
+
} else {
|
|
20
|
+
if ($(osEl.checkoutWidgetDetailsDiscount).length) {
|
|
21
|
+
$(osEl.checkoutWidgetDetailsDiscount).before(createCheckoutWidgetItem(obj))
|
|
22
|
+
} else {
|
|
23
|
+
$(osEl.checkoutWidgetDetails).append(createCheckoutWidgetItem(obj))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
$(obj.item).find(obj.itemValue).text(obj.dataValue);
|
|
28
|
+
if (isVoucher ? obj.dataValue : obj.value && obj.dataValue) {
|
|
29
|
+
$(obj.item).find(obj.itemValue).show();
|
|
30
|
+
} else {
|
|
31
|
+
$(obj.item).hide();
|
|
32
|
+
}
|
|
33
|
+
})
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
const hasAny = (...arr) => arr.some(k => keys.has(k));
|
|
35
|
+
const value = data.totalPrice?.formattedValue || data.total;
|
|
39
36
|
|
|
40
|
-
const value = data.totalPrice?.formattedValue || data.total;
|
|
41
|
-
if (typeof value !== 'undefined' && hasAny('total', 'totalPrice')) {
|
|
42
|
-
updateSummaryMobileBarTotal(value);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (hasAny('promotionsInfo')) {
|
|
46
37
|
updateDiscount(data, isVoucher);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (hasAny('deliveryOrder', 'clickAndCollectOrder', 'clickAndCollectOnly', 'deliveryItemsQuantity', 'pickupItemsQuantity')) {
|
|
50
38
|
hideUnusedDeliveryTypeCost(data, isVoucher);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (hasAny('freeDelivery', 'messageForFreeDelivery', 'clickAndCollectOnly')) {
|
|
54
39
|
calculateFreeDelivery(data);
|
|
55
|
-
|
|
40
|
+
updateSummaryMobileBarTotal(value);
|
|
56
41
|
}
|
|
57
42
|
|
|
58
43
|
function createCheckoutWidgetItem(obj) {
|
|
@@ -68,14 +53,12 @@ function hideUnusedDeliveryTypeCost(data, isVoucher) {
|
|
|
68
53
|
$(osEl.delivery).show()
|
|
69
54
|
$(osEl.cc).show()
|
|
70
55
|
if (isVoucher) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
56
|
+
if (!data.deliveryOrder) {
|
|
57
|
+
$(osEl.delivery).hide()
|
|
58
|
+
} else if (!data.clickAndCollectOrder) {
|
|
59
|
+
$(osEl.cc).hide()
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
79
62
|
if (data.clickAndCollectOnly) {
|
|
80
63
|
$(osEl.delivery).hide()
|
|
81
64
|
} else if (data.deliveryItemsQuantity > 0 && data.pickupItemsQuantity === 0) {
|
|
@@ -6,7 +6,9 @@ $(document).ready(function () {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
function cardsContent(itemsInRow) {
|
|
9
|
-
let card = $('.content .product-card, .content .card-product-banner')
|
|
9
|
+
let card = $('.content .product-card, .content .card-product-banner, .content .card-sponsor-banner, .content .card-sponsor-product').filter(function() {
|
|
10
|
+
return $(this).parents('.product-card, .card-product-banner, .card-sponsor-banner, .card-sponsor-product').length === 0;
|
|
11
|
+
});
|
|
10
12
|
let priceSelectors = [
|
|
11
13
|
'.including-vat .product-card__price__old-price',
|
|
12
14
|
'.excluding-vat .product-card__price__old-price',
|
|
@@ -17,6 +19,7 @@ $(document).ready(function () {
|
|
|
17
19
|
revealAll(card, ['.product-card__price__old-price',
|
|
18
20
|
'.product-card__price-sqm',
|
|
19
21
|
'.product-card__price-value',
|
|
22
|
+
'.product-card__sponsored',
|
|
20
23
|
'.energy-efficiency',
|
|
21
24
|
'.energy-efficiency__link']);
|
|
22
25
|
|
|
@@ -33,6 +36,8 @@ $(document).ready(function () {
|
|
|
33
36
|
hideEmptiness(currentRow, '.product-card__price-sqm');
|
|
34
37
|
}
|
|
35
38
|
hideEmptiness(currentRow, '.product-card__price-value');
|
|
39
|
+
hideEmptiness(currentRow, '.product-card__sponsored');
|
|
40
|
+
hideEmptiness(currentRow, '.product-card__price__old-price');
|
|
36
41
|
hideEmptiness(currentRow, '.energy-efficiency');
|
|
37
42
|
hideEmptiness(currentRow, '.energy-efficiency__link');
|
|
38
43
|
|
|
@@ -43,11 +48,15 @@ $(document).ready(function () {
|
|
|
43
48
|
function hideEmptiness(query, className) {
|
|
44
49
|
let currentQuery = query.find(className);
|
|
45
50
|
let rowContent = currentQuery.text();
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
const classEmptyCheckMap = {
|
|
52
|
+
'.energy-efficiency': 'energy-efficiency--empty',
|
|
53
|
+
'.product-card__sponsored': 'product-card__sponsored--empty',
|
|
54
|
+
'.product-card__price__old-price': 'product-card__price_empty'
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
if (classEmptyCheckMap[className]) {
|
|
58
|
+
let isClassEmpty = isClassPresentInQuery(currentQuery, classEmptyCheckMap[className]);
|
|
59
|
+
if (isClassEmpty) {
|
|
51
60
|
currentQuery.hide();
|
|
52
61
|
}
|
|
53
62
|
return;
|
|
@@ -43,7 +43,7 @@ Wick.PLPLoadMore = {
|
|
|
43
43
|
.finally(() => {
|
|
44
44
|
hideLoader(Wick.PLPLoadMore.el.loader);
|
|
45
45
|
Wick.PLPLoadMore.el.$loadMoreBtn.blur();
|
|
46
|
-
Wick.
|
|
46
|
+
Wick.BannerPlacementManager.checkProductsInColumn();
|
|
47
47
|
$(window).trigger('productBannerPositionChanged');
|
|
48
48
|
Wick.EnergyEfficiency.drawEnergyLabels();
|
|
49
49
|
Wick.PLP?.bindEvents();
|
|
@@ -257,6 +257,7 @@ export function wrapWithError(element) {
|
|
|
257
257
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
|
|
260
261
|
export function addErrorMessage(element, errorMessage) {
|
|
261
262
|
if (errorMessage) {
|
|
262
263
|
$(element).append('<div class="form-row__error">' + errorMessage + '</div>');
|
|
@@ -315,49 +316,3 @@ export function validateGuidPattern (value) {
|
|
|
315
316
|
export function validateUserFriendlyIdPattern (value) {
|
|
316
317
|
return patterns.userFriendlyIdPattern.test(value);
|
|
317
318
|
}
|
|
318
|
-
|
|
319
|
-
export function showErrorText($input, message, fieldSelector, errorTextClass, errorClass, ariaInvalidAttr) {
|
|
320
|
-
const $field = $input.closest(fieldSelector);
|
|
321
|
-
$field.addClass(errorClass);
|
|
322
|
-
$input.attr(ariaInvalidAttr, 'true');
|
|
323
|
-
|
|
324
|
-
let $err = $field.find(errorTextClass);
|
|
325
|
-
if (!$err.length) {
|
|
326
|
-
$err = $(`<div class="${errorTextClass.slice(1)}" />`).appendTo($field);
|
|
327
|
-
}
|
|
328
|
-
$err.text(message);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export function clearErrorText($input, fieldSelector, errorTextClass, errorClass, ariaInvalidAttr) {
|
|
332
|
-
const $field = $input.closest(fieldSelector);
|
|
333
|
-
$field.removeClass(errorClass);
|
|
334
|
-
$input.removeAttr(ariaInvalidAttr);
|
|
335
|
-
$field.find(errorTextClass).remove();
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function digitsOnly(value) {
|
|
339
|
-
return String(value || '').replace(/\D/g, '');
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function hasExactDigits(value, n) {
|
|
343
|
-
return digitsOnly(value).length === Number(n);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
function validateByPredicate($input, predicate, message, {
|
|
347
|
-
fieldSelector,
|
|
348
|
-
errorText: errorTextClass,
|
|
349
|
-
fieldError: errorClass,
|
|
350
|
-
ariaInvalidAttr,
|
|
351
|
-
}) {
|
|
352
|
-
const ok = !!predicate(String($input.val() || ''));
|
|
353
|
-
if (!ok) {
|
|
354
|
-
showErrorText($input, message, fieldSelector, errorTextClass, errorClass, ariaInvalidAttr);
|
|
355
|
-
} else {
|
|
356
|
-
clearErrorText($input, fieldSelector, errorTextClass, errorClass, ariaInvalidAttr);
|
|
357
|
-
}
|
|
358
|
-
return ok;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
export function validateExactDigits($input, n, message, cfg) {
|
|
362
|
-
return validateByPredicate($input, (v) => hasExactDigits(v, n), message, cfg);
|
|
363
|
-
}
|