wickes-css2 2.103.0-RG-1587-replace-klarna-logo-with-svg-image.1 → 2.103.0-RG-1742-billie-30-60-90-days.2
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 -0
- package/build/css/components/card-product-banner.css +1 -1
- package/build/css/components/checkout-payment-details-v2.css +1 -1
- package/build/css/components/checkout-payment-repayment-terms.css +1 -0
- package/build/css/main.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/pdp-main-non-critical.css +1 -1
- package/build/css/plp-main.css +1 -1
- package/build/js/basket.min.js +1 -1
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +1 -1
- package/build/js/emulation.min.js +164 -152
- package/build/js/merged-checkout.min.js +1 -1
- package/build/js/page/checkout-payment-details.js +96 -43
- package/build/js/page/plp-cards-v2.js +6 -15
- package/build/js/page/plp-load-more.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/project-list.min.js +1 -1
- package/package.json +2 -2
- package/src/components/card_product_v2.hbs +5 -10
- package/src/components/checkout-payment-details-v2.hbs +48 -30
- package/src/components/checkout-payment-repayment-terms.hbs +25 -0
- package/src/components/checkout_payment-new.hbs +4 -1
- package/src/components/checkout_payment-other-methods.hbs +4 -1
- package/src/components/injected-content.hbs +1 -1
- package/src/components/payments-checkout-v2.hbs +7 -2
- package/src/components/payments-checkout.hbs +6 -1
- package/src/components/payments.hbs +5 -1
- package/src/components/table_order-details-klarna.hbs +1 -1
- package/src/components/table_payment.hbs +4 -1
- package/src/data/data_search-results_v2.json +141 -56
- package/src/data/data_wismo.json +1 -1
- package/src/js/components/product-banner.js +148 -0
- package/src/js/emulation/checkout-payment-details.js +8 -8
- package/src/js/emulation/forms.js +118 -89
- package/src/js/emulation/paymentLoader.js +4 -3
- package/src/js/emulation/repayment-toggle.js +35 -0
- package/src/js/page/checkout-payment-details.js +96 -43
- package/src/js/page/plp-cards-v2.js +6 -15
- package/src/js/page/plp-load-more.js +1 -1
- package/src/page_checkout_payment-details_guest-with-checkout-journey.html +1 -1
- package/src/page_my-order.html +1 -1
- package/src/page_payment-details-with-clearpay.html +2 -2
- package/src/page_plp_v2.html +6 -16
- package/src/page_search-results.html +2 -12
- package/src/page_shopping-cart-v2.html +2 -2
- package/src/page_split-orders-klarna.html +106 -0
- package/src/scss/components/card-product-banner.scss +3 -91
- package/src/scss/components/checkout-payment-details-v2.scss +1 -0
- package/src/scss/components/checkout-payment-repayment-terms.scss +104 -0
- package/src/scss/pages/page_products-list-combined.scss +0 -11
- package/src/scss/pages/page_products-list.scss +0 -8
- package/src/sitemap.html +6 -0
- package/build/img/klarna.svg +0 -10
- package/build/img/payment/checkout/klarna.svg +0 -10
- package/build/img/payment/footer/klarna.svg +0 -10
- package/src/components/card_sponsor_banner.hbs +0 -8
- package/src/components/card_sponsor_product.hbs +0 -6
- package/src/img/klarna.svg +0 -10
- package/src/img/payment/checkout/klarna.svg +0 -10
- package/src/img/payment/footer/klarna.svg +0 -10
- package/src/js/components/banner-placement-manager.js +0 -267
- package/src/js/emulation/banner-placement-manager.js +0 -53
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
Wick.ProductBanner = {
|
|
3
|
+
el: {
|
|
4
|
+
banners: '.card-product-banner',
|
|
5
|
+
bannerInactiveClass: 'card-product-banner--inactive',
|
|
6
|
+
productsWrap: '.products-list-v2',
|
|
7
|
+
$products: $('.product-card'),
|
|
8
|
+
attrPositionDesktop: 'data-desktop-position',
|
|
9
|
+
attrPositionMobile: 'data-mobile-position',
|
|
10
|
+
attrRequiredAmountDesktop: 'data-required-amount-desktop',
|
|
11
|
+
attrRequiredAmountMobile: 'data-required-amount-mobile',
|
|
12
|
+
hide: 'd-none'
|
|
13
|
+
},
|
|
14
|
+
currentBreakpoint: null,
|
|
15
|
+
checkProductsInColumn() {
|
|
16
|
+
Wick.ProductBanner.addInactiveClasses();
|
|
17
|
+
Wick.ProductBanner.arrangeBannersInRightOrder();
|
|
18
|
+
$(Wick.ProductBanner.el.banners).each((index, banner) => {
|
|
19
|
+
Wick.ProductBanner.hideBannerDueLimit(banner, index);
|
|
20
|
+
Wick.ProductBanner.moveBannerToSpecifiedPosition(banner);
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
moveBannerToSpecifiedPosition(banner) {
|
|
24
|
+
const $listSlots = Wick.ProductBanner.getListSlots();
|
|
25
|
+
const bannerPosition = Wick.ProductBanner.getBannerPosition(banner) - 2;
|
|
26
|
+
const listSlotsLength = $listSlots.length;
|
|
27
|
+
|
|
28
|
+
if(Wick.ProductBanner.isBannerVisible(banner)) {
|
|
29
|
+
if (bannerPosition <= listSlotsLength) {
|
|
30
|
+
if ($listSlots[bannerPosition]) {
|
|
31
|
+
Wick.ProductBanner.showBanner(banner);
|
|
32
|
+
Wick.ProductBanner.removeInactiveClass(banner);
|
|
33
|
+
Wick.ProductBanner.moveBanner(banner, $listSlots[bannerPosition]);
|
|
34
|
+
} else {
|
|
35
|
+
Wick.ProductBanner.hideBanner(banner);
|
|
36
|
+
Wick.ProductBanner.coverEdgeCases(banner);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
Wick.ProductBanner.hideBanner(banner);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
moveBanner(banner, targetElement) {
|
|
44
|
+
$(banner).remove();
|
|
45
|
+
$(targetElement).after(banner);
|
|
46
|
+
},
|
|
47
|
+
hideBanner(banner) {
|
|
48
|
+
$(banner).addClass(Wick.ProductBanner.el.hide);
|
|
49
|
+
},
|
|
50
|
+
showBanner(banner) {
|
|
51
|
+
$(banner).removeClass(Wick.ProductBanner.el.hide);
|
|
52
|
+
},
|
|
53
|
+
isBannerVisible(banner) {
|
|
54
|
+
return !$(banner).hasClass(Wick.ProductBanner.el.hide);
|
|
55
|
+
},
|
|
56
|
+
hideBannerDueLimit(banner) {
|
|
57
|
+
const bannerMinLimit = Wick.ProductBanner.getBannerLimit(banner) - 1;
|
|
58
|
+
const $listSlots = Wick.ProductBanner.getListSlots();
|
|
59
|
+
const listProductsLength = $listSlots.length;
|
|
60
|
+
Wick.ProductBanner.showBanner(banner);
|
|
61
|
+
|
|
62
|
+
if (bannerMinLimit > listProductsLength) {
|
|
63
|
+
Wick.ProductBanner.hideBanner(banner);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
getBannerPosition(banner) {
|
|
67
|
+
const isMobile = Wick.ProductBanner.isMobileResolution();
|
|
68
|
+
const positionAttribute = isMobile
|
|
69
|
+
? Wick.ProductBanner.el.attrPositionMobile
|
|
70
|
+
: Wick.ProductBanner.el.attrPositionDesktop
|
|
71
|
+
|
|
72
|
+
return banner.hasAttribute(positionAttribute)
|
|
73
|
+
? Number(banner.getAttribute(positionAttribute))
|
|
74
|
+
: Number(Wick.ProductBanner.getListLength() + Wick.ProductBanner.getBannersAmount());
|
|
75
|
+
},
|
|
76
|
+
getBannerLimit(banner) {
|
|
77
|
+
const isMobile = Wick.ProductBanner.isMobileResolution();
|
|
78
|
+
|
|
79
|
+
const limitAttribute = isMobile
|
|
80
|
+
? Wick.ProductBanner.el.attrRequiredAmountMobile
|
|
81
|
+
: Wick.ProductBanner.el.attrRequiredAmountDesktop;
|
|
82
|
+
|
|
83
|
+
return banner.hasAttribute(limitAttribute)
|
|
84
|
+
? Number(banner.getAttribute(limitAttribute))
|
|
85
|
+
: 0;
|
|
86
|
+
},
|
|
87
|
+
isMobileResolution() {
|
|
88
|
+
return Wick.Responsive.getCurrentBreakpoint() !== 'up-lg';
|
|
89
|
+
},
|
|
90
|
+
getListLength() {
|
|
91
|
+
const $listItems = $(Wick.ProductBanner.el.productsWrap).find('.product-card');
|
|
92
|
+
return $listItems.length;
|
|
93
|
+
},
|
|
94
|
+
getBannersAmount() {
|
|
95
|
+
return $(Wick.ProductBanner.el.banners).length;
|
|
96
|
+
},
|
|
97
|
+
getProductsAmount() {
|
|
98
|
+
return Wick.ProductBanner.el.$products.length;
|
|
99
|
+
},
|
|
100
|
+
arrangeBannersInRightOrder() {
|
|
101
|
+
$(Wick.ProductBanner.el.banners).sort((a, b) => {
|
|
102
|
+
let bannerPositionA = Wick.ProductBanner.getBannerPosition(a);
|
|
103
|
+
let bannerPositionB = Wick.ProductBanner.getBannerPosition(b);
|
|
104
|
+
|
|
105
|
+
return bannerPositionA - bannerPositionB
|
|
106
|
+
}).appendTo(Wick.ProductBanner.el.productsWrap);
|
|
107
|
+
},
|
|
108
|
+
addInactiveClasses() {
|
|
109
|
+
$(Wick.ProductBanner.el.banners).addClass(Wick.ProductBanner.el.bannerInactiveClass);
|
|
110
|
+
},
|
|
111
|
+
removeInactiveClass(banner) {
|
|
112
|
+
$(banner).removeClass(Wick.ProductBanner.el.bannerInactiveClass)
|
|
113
|
+
},
|
|
114
|
+
insertFirstBanner(banner) {
|
|
115
|
+
const bannerPosition = Wick.ProductBanner.getBannerPosition(banner);
|
|
116
|
+
|
|
117
|
+
if (bannerPosition === 1) {
|
|
118
|
+
Wick.ProductBanner.showBanner(banner);
|
|
119
|
+
Wick.ProductBanner.removeInactiveClass(banner);
|
|
120
|
+
$(banner).remove();
|
|
121
|
+
$(Wick.ProductBanner.el.productsWrap).prepend(banner);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
coverEdgeCases(banner) {
|
|
125
|
+
Wick.ProductBanner.insertFirstBanner(banner);
|
|
126
|
+
},
|
|
127
|
+
getListSlots() {
|
|
128
|
+
return $(Wick.ProductBanner.el.productsWrap)
|
|
129
|
+
.find('.product-card, .card-product-banner:not(.card-product-banner--inactive)');
|
|
130
|
+
},
|
|
131
|
+
init() {
|
|
132
|
+
Wick.Responsive.onResize(function () {
|
|
133
|
+
if(Wick.ProductBanner.currentBreakpoint !== Wick.Responsive.getCurrentBreakpoint()) {
|
|
134
|
+
Wick.ProductBanner.currentBreakpoint = Wick.Responsive.getCurrentBreakpoint()
|
|
135
|
+
Wick.ProductBanner.checkProductsInColumn();
|
|
136
|
+
$(window).trigger('productBannerPositionChanged');
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
$(document).ready(function () {
|
|
143
|
+
if (!Wick.ProductBanner.getBannersAmount() || !Wick.ProductBanner.getProductsAmount()) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
Wick.ProductBanner.init();
|
|
148
|
+
})
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var Wick = Wick || {};
|
|
2
2
|
|
|
3
|
-
Wick.PaymentDetails = (function
|
|
3
|
+
Wick.PaymentDetails = (function() {
|
|
4
4
|
var $btnEnterDetails = $('.btn-enter-details'),
|
|
5
5
|
$form = $btnEnterDetails.parents('form'),
|
|
6
6
|
isGuestPage = $('.page_checkout-payment-details_guest').length;
|
|
7
7
|
|
|
8
|
-
function bindEvents
|
|
9
|
-
$btnEnterDetails.on('click', function(){
|
|
10
|
-
if ($form.find('#card-name').val()
|
|
8
|
+
function bindEvents() {
|
|
9
|
+
$btnEnterDetails.on('click', function() {
|
|
10
|
+
if ($form.find('#card-name').val()?.length &&
|
|
11
11
|
$form.find('#first-line-address').val().length &&
|
|
12
12
|
$form.find('#address-line-1').val().length &&
|
|
13
13
|
$form.find('#town-city').val().length &&
|
|
14
|
-
$form.find('#postcode_additional').val().length){
|
|
14
|
+
$form.find('#postcode_additional').val().length) {
|
|
15
15
|
$('.checkout-payment-details__card-details').removeClass('checkout-payment-details__card-details_hidden');
|
|
16
16
|
$('html, body').animate({
|
|
17
|
-
scrollTop: $('.checkout-payment-details__card-details').offset().top - 15
|
|
17
|
+
scrollTop: $('.checkout-payment-details__card-details').offset().top - 15,
|
|
18
18
|
}, 700);
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
@@ -22,14 +22,14 @@ Wick.PaymentDetails = (function () {
|
|
|
22
22
|
return false;
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
$('.checkout-payment-details__card-details').on('submit', function(){
|
|
25
|
+
$('.checkout-payment-details__card-details').on('submit', function() {
|
|
26
26
|
var $form = $(this);
|
|
27
27
|
if ($form.find('#card-type').val() &&
|
|
28
28
|
$form.find('#card-name1').val().length &&
|
|
29
29
|
$form.find('#card-number').val().length &&
|
|
30
30
|
$form.find('#month').val() &&
|
|
31
31
|
$form.find('#year').val() &&
|
|
32
|
-
$form.find('#security-code').val()){
|
|
32
|
+
$form.find('#security-code').val()) {
|
|
33
33
|
window.location.href = isGuestPage
|
|
34
34
|
? './page_checkout_confirmation_guest.html'
|
|
35
35
|
: './page_checkout_confirmation.html';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var Wick = Wick || {};
|
|
2
|
-
Wick.Forms = (function(){
|
|
2
|
+
Wick.Forms = (function() {
|
|
3
3
|
var fieldRow = '.form-row[data-row-required]',
|
|
4
4
|
field = '.form-row__field',
|
|
5
5
|
fieldError = '.form-row__error',
|
|
@@ -9,43 +9,44 @@ Wick.Forms = (function(){
|
|
|
9
9
|
// validationError = '<div class="form-row__error">Error message here</div>',
|
|
10
10
|
$forgotPassword = $('.link-forgot-password'),
|
|
11
11
|
scenarios = [{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
12
|
+
condition: function() {
|
|
13
|
+
// fill in the valid returning customer's details
|
|
14
|
+
// Email: responsive@test.com; Password: 123456
|
|
15
|
+
return $('#login-email').val() === 'responsive@test.com' && $('#password').val() === '123456';
|
|
16
|
+
},
|
|
17
|
+
action: function() {
|
|
18
|
+
// redirected to the homepage
|
|
19
|
+
Wick.User.login();
|
|
20
|
+
window.location.href = './';
|
|
22
21
|
},
|
|
22
|
+
},
|
|
23
23
|
{
|
|
24
|
-
condition: function(){
|
|
24
|
+
condition: function() {
|
|
25
25
|
// continue as a new user with "test+random@user.com"
|
|
26
26
|
return $('#registration-email').val().length;
|
|
27
27
|
// return $('#registration-email').val() === 'test+random@user.com';
|
|
28
28
|
},
|
|
29
|
-
action: function(){
|
|
29
|
+
action: function() {
|
|
30
30
|
// redirected to the register form
|
|
31
31
|
window.location.href = './page_registration.html';
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
condition: function(){
|
|
35
|
+
condition: function() {
|
|
36
36
|
// When I click forgotten password link
|
|
37
37
|
},
|
|
38
|
-
action: function(){
|
|
38
|
+
action: function() {
|
|
39
39
|
// redirected on the "Forgotten Password" page
|
|
40
40
|
window.location.href = './page_forgotten-password.html';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
]
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
validationError = function(errorMsg) {
|
|
46
|
+
return `<div class="form-row__error"> ${errorMsg || 'Error message here'}</div>`;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function isElementInViewport(el) {
|
|
49
50
|
if (typeof jQuery === 'function' && el instanceof jQuery) {
|
|
50
51
|
el = el[0];
|
|
51
52
|
}
|
|
@@ -58,15 +59,21 @@ Wick.Forms = (function(){
|
|
|
58
59
|
);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
var showValidationErrors = function
|
|
62
|
+
var showValidationErrors = function(form, errorMsg) {
|
|
62
63
|
var $form = $(form);
|
|
63
64
|
if (!$form.hasClass(formInvalid)) {
|
|
64
65
|
$form.find('.form-row__error').remove();
|
|
65
|
-
$form.
|
|
66
|
+
var $rows = $form.find(fieldRow).filter(function() {
|
|
67
|
+
return $(this).css('display') !== 'none';
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
$rows.append(validationError(errorMsg)).addClass(rowValidationError);
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
var $firstMsg = $form.find(fieldRow).
|
|
69
|
-
|
|
73
|
+
var $firstMsg = $form.find(fieldRow).filter(function() {
|
|
74
|
+
return $(this).css('display') !== 'none';
|
|
75
|
+
}).first();
|
|
76
|
+
if ($firstMsg.length && !isElementInViewport($firstMsg)) {
|
|
70
77
|
var inModal = $firstMsg.closest('.modal').length,
|
|
71
78
|
$scrollableEl = inModal ? $firstMsg.closest('.modal') : $('html, body'),
|
|
72
79
|
y = inModal ? 0 : $firstMsg.offset().top - 30;
|
|
@@ -75,22 +82,26 @@ Wick.Forms = (function(){
|
|
|
75
82
|
}
|
|
76
83
|
};
|
|
77
84
|
|
|
78
|
-
var clearValidationErrors = function
|
|
85
|
+
var clearValidationErrors = function(form) {
|
|
79
86
|
var $form = $(form);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
|
|
88
|
+
$form.removeClass(formInvalid);
|
|
89
|
+
|
|
90
|
+
$form.find(fieldRow)
|
|
91
|
+
.removeClass(rowValidationError)
|
|
92
|
+
.find(fieldError).remove();
|
|
93
|
+
|
|
94
|
+
$form.find(fieldError).remove();
|
|
85
95
|
};
|
|
86
96
|
|
|
87
|
-
|
|
97
|
+
|
|
98
|
+
var handleSmoothScroll = function() {
|
|
88
99
|
$('html, body').animate({
|
|
89
|
-
scrollTop: $('.cards-store-list').offset().top - 60
|
|
100
|
+
scrollTop: $('.cards-store-list').offset().top - 60,
|
|
90
101
|
}, 300);
|
|
91
102
|
};
|
|
92
103
|
|
|
93
|
-
var handleFormSubmit = function
|
|
104
|
+
var handleFormSubmit = function() {
|
|
94
105
|
var form = this;
|
|
95
106
|
|
|
96
107
|
if ($(form).is('#form-login') || $(form).is('#form-register')) {
|
|
@@ -104,21 +115,21 @@ Wick.Forms = (function(){
|
|
|
104
115
|
}
|
|
105
116
|
|
|
106
117
|
if ($(form).is('#form-forgotten-password')) {
|
|
107
|
-
if ($(form).find('#email').val().length){
|
|
118
|
+
if ($(form).find('#email').val().length) {
|
|
108
119
|
window.location.href = './page_upd-pass.html';
|
|
109
120
|
return false;
|
|
110
121
|
}
|
|
111
122
|
}
|
|
112
123
|
|
|
113
124
|
if ($(form).is('#form-forgotten-password-popup')) {
|
|
114
|
-
if ($(form).find('#email').val().length){
|
|
125
|
+
if ($(form).find('#email').val().length) {
|
|
115
126
|
window.location.href = './page_checkout_sign-in.html';
|
|
116
127
|
return false;
|
|
117
128
|
}
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
if ($(form).is('#checkout-form-forgotten-password-popup')) {
|
|
121
|
-
if ($(form).find('#email').val().length){
|
|
132
|
+
if ($(form).find('#email').val().length) {
|
|
122
133
|
$('.modal-reset-wrap').addClass('d-block');
|
|
123
134
|
$('.request-pass').addClass('d-none');
|
|
124
135
|
$('.modal-title').text('Password Reset');
|
|
@@ -127,7 +138,7 @@ Wick.Forms = (function(){
|
|
|
127
138
|
}
|
|
128
139
|
|
|
129
140
|
if ($(form).is('.update-pass')) {
|
|
130
|
-
if ($(form).find('#new-password').val().length && $(form).find('#confirmed-password').val().length){
|
|
141
|
+
if ($(form).find('#new-password').val().length && $(form).find('#confirmed-password').val().length) {
|
|
131
142
|
window.location.href = './page_login.html';
|
|
132
143
|
return false;
|
|
133
144
|
}
|
|
@@ -136,7 +147,7 @@ Wick.Forms = (function(){
|
|
|
136
147
|
if ($(form).is('.change-email')) {
|
|
137
148
|
if ($(form).find('#new-email').val().length &&
|
|
138
149
|
$(form).find('#confirm-new-email').val().length &&
|
|
139
|
-
$(form).find('#password').val().length){
|
|
150
|
+
$(form).find('#password').val().length) {
|
|
140
151
|
window.location.href = './page_my-account.html';
|
|
141
152
|
return false;
|
|
142
153
|
}
|
|
@@ -145,7 +156,7 @@ Wick.Forms = (function(){
|
|
|
145
156
|
if ($(form).is('.form-change-password')) {
|
|
146
157
|
if ($(form).find('#current-password').val().length &&
|
|
147
158
|
$(form).find('#new-password').val().length &&
|
|
148
|
-
$(form).find('#confirm-password').val().length){
|
|
159
|
+
$(form).find('#confirm-password').val().length) {
|
|
149
160
|
window.location.href = './page_my-account.html';
|
|
150
161
|
return false;
|
|
151
162
|
}
|
|
@@ -157,14 +168,14 @@ Wick.Forms = (function(){
|
|
|
157
168
|
$(form).find('#postcode').val().length &&
|
|
158
169
|
$(form).find('#email').val().length &&
|
|
159
170
|
$(form).find('#password').val().length &&
|
|
160
|
-
$(form).find('#confirm-password').val().length){
|
|
171
|
+
$(form).find('#confirm-password').val().length) {
|
|
161
172
|
window.location.href = './page_my-account.html';
|
|
162
173
|
return false;
|
|
163
174
|
}
|
|
164
175
|
}
|
|
165
176
|
|
|
166
177
|
if ($(form).is('.form-personal-details')) {
|
|
167
|
-
if ($(form).find('#first-name').val().length && $(form).find('#surname').val().length){
|
|
178
|
+
if ($(form).find('#first-name').val().length && $(form).find('#surname').val().length) {
|
|
168
179
|
window.location.href = './page_my-account.html';
|
|
169
180
|
return false;
|
|
170
181
|
}
|
|
@@ -172,26 +183,26 @@ Wick.Forms = (function(){
|
|
|
172
183
|
|
|
173
184
|
if ($(form).is('.form-address-details')) {
|
|
174
185
|
if ($(form).find('#first-name').val().length &&
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
186
|
+
$(form).find('#second-name').val().length &&
|
|
187
|
+
$(form).find('#address1').val().length &&
|
|
188
|
+
$(form).find('#town-city').val().length &&
|
|
189
|
+
$(form).find('#mobile-telephone').val().length) {
|
|
179
190
|
window.location.href = './page_my-account_address-book.html';
|
|
180
191
|
return false;
|
|
181
192
|
}
|
|
182
193
|
}
|
|
183
194
|
|
|
184
195
|
if ($(form).is('.form-locator')) {
|
|
185
|
-
if ($(form).find('#store-id').val()){
|
|
196
|
+
if ($(form).find('#store-id').val()) {
|
|
186
197
|
window.location.href = './page_store-locator-details.html';
|
|
187
198
|
return false;
|
|
188
199
|
}
|
|
189
200
|
}
|
|
190
201
|
|
|
191
202
|
if ($(form).is('.form-locator-list')) {
|
|
192
|
-
if ($(form).find('#postcode-town').val().length){
|
|
203
|
+
if ($(form).find('#postcode-town').val().length) {
|
|
193
204
|
var actionAfterSubmit = $(form).attr('data-action');
|
|
194
|
-
if (actionAfterSubmit === 'scroll-to-list'){
|
|
205
|
+
if (actionAfterSubmit === 'scroll-to-list') {
|
|
195
206
|
clearValidationErrors(this);
|
|
196
207
|
handleSmoothScroll();
|
|
197
208
|
} else {
|
|
@@ -202,7 +213,7 @@ Wick.Forms = (function(){
|
|
|
202
213
|
}
|
|
203
214
|
|
|
204
215
|
if ($(form).is('#form-mini-basket')) {
|
|
205
|
-
if (Wick.User.isLoggedIn()){
|
|
216
|
+
if (Wick.User.isLoggedIn()) {
|
|
206
217
|
window.location.href = './page_checkout_delivery-address.html';
|
|
207
218
|
} else {
|
|
208
219
|
window.location.href = './page_checkout_sign-in.html';
|
|
@@ -210,13 +221,31 @@ Wick.Forms = (function(){
|
|
|
210
221
|
return false;
|
|
211
222
|
}
|
|
212
223
|
|
|
213
|
-
function isNotEmpty(field){
|
|
214
|
-
|
|
224
|
+
function isNotEmpty(field) {
|
|
225
|
+
var $field = $(field);
|
|
226
|
+
var type = ($field.attr('type') || '').toLowerCase();
|
|
227
|
+
|
|
228
|
+
if (type === 'checkbox') {
|
|
229
|
+
return $field.is(':checked');
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (type === 'radio') {
|
|
233
|
+
var name = $field.attr('name');
|
|
234
|
+
if (!name) return false;
|
|
235
|
+
|
|
236
|
+
var $scope = $field.closest('[data-row-required]');
|
|
237
|
+
if (!$scope.length) $scope = $field.closest('form');
|
|
238
|
+
|
|
239
|
+
return $scope.find('input[type="radio"][name="' + name.replace(/"/g, '\\"') + '"]').is(':checked');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return !!$field.val();
|
|
215
243
|
}
|
|
216
244
|
|
|
245
|
+
|
|
217
246
|
if ($(form).is('#form-checkout-your-details')) {
|
|
218
247
|
var requiredFields = $(form).find('[data-row-required]:visible :input');
|
|
219
|
-
if (_.every(requiredFields, isNotEmpty)){
|
|
248
|
+
if (_.every(requiredFields, isNotEmpty)) {
|
|
220
249
|
window.location.href = $(form).attr('data-action');
|
|
221
250
|
return false;
|
|
222
251
|
}
|
|
@@ -224,7 +253,7 @@ Wick.Forms = (function(){
|
|
|
224
253
|
|
|
225
254
|
if ($(form).is('#checkout-your-details-modal')) {
|
|
226
255
|
var requiredFields = $(form).find('[data-row-required]:visible :input');
|
|
227
|
-
if (_.every(requiredFields, isNotEmpty)){
|
|
256
|
+
if (_.every(requiredFields, isNotEmpty)) {
|
|
228
257
|
$('#modalDeliveryEdit').modal('hide');
|
|
229
258
|
return false;
|
|
230
259
|
}
|
|
@@ -238,15 +267,15 @@ Wick.Forms = (function(){
|
|
|
238
267
|
}
|
|
239
268
|
}
|
|
240
269
|
|
|
241
|
-
if ($(form).is('.checkout-register')){
|
|
270
|
+
if ($(form).is('.checkout-register')) {
|
|
242
271
|
if ($(form).find('#password').val().length &&
|
|
243
|
-
|
|
272
|
+
$(form).find('#confirm-password').val().length) {
|
|
244
273
|
window.location.href = './page_my-account.html';
|
|
245
274
|
return false;
|
|
246
275
|
}
|
|
247
276
|
}
|
|
248
277
|
|
|
249
|
-
if ($(form).is('#form-checkout-voucher')){
|
|
278
|
+
if ($(form).is('#form-checkout-voucher')) {
|
|
250
279
|
if ($(form).find('#voucher-code').val().length) {
|
|
251
280
|
return false;
|
|
252
281
|
}
|
|
@@ -258,11 +287,11 @@ Wick.Forms = (function(){
|
|
|
258
287
|
}
|
|
259
288
|
}
|
|
260
289
|
|
|
261
|
-
if ($(form).is('.header-search')){
|
|
290
|
+
if ($(form).is('.header-search')) {
|
|
262
291
|
window.location.href = './page_search-results.html';
|
|
263
292
|
}
|
|
264
293
|
|
|
265
|
-
if ($(form).is('.click-and-collect__locator-form')){
|
|
294
|
+
if ($(form).is('.click-and-collect__locator-form')) {
|
|
266
295
|
var $form = $(form);
|
|
267
296
|
if ($form.find('#click-and-collect-town').val().length) {
|
|
268
297
|
clearValidationErrors(this);
|
|
@@ -275,24 +304,24 @@ Wick.Forms = (function(){
|
|
|
275
304
|
return false;
|
|
276
305
|
}
|
|
277
306
|
|
|
278
|
-
if($(form).is('.form-track-order')) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if ($form.find('#order').val().length &&
|
|
282
|
-
$form.find('#tel').val().length &&
|
|
283
|
-
$form.find('#email').val().length &&
|
|
284
|
-
$form.find('#postcode').val().length) {
|
|
285
|
-
clearValidationErrors(this);
|
|
286
|
-
} else if (!$form.hasClass(formInvalid)) {
|
|
287
|
-
$form.addClass(formInvalid);
|
|
288
|
-
|
|
289
|
-
$(fieldRow).each(function() {
|
|
290
|
-
$(this).addClass(rowValidationError)
|
|
291
|
-
.append('<div class="form-row__error">' + $(this).data('message') + '</div>');
|
|
292
|
-
});
|
|
293
|
-
}
|
|
307
|
+
if ($(form).is('.form-track-order')) {
|
|
308
|
+
var $form = $(form);
|
|
294
309
|
|
|
295
|
-
|
|
310
|
+
if ($form.find('#order').val().length &&
|
|
311
|
+
$form.find('#tel').val().length &&
|
|
312
|
+
$form.find('#email').val().length &&
|
|
313
|
+
$form.find('#postcode').val().length) {
|
|
314
|
+
clearValidationErrors(this);
|
|
315
|
+
} else if (!$form.hasClass(formInvalid)) {
|
|
316
|
+
$form.addClass(formInvalid);
|
|
317
|
+
|
|
318
|
+
$(fieldRow).each(function() {
|
|
319
|
+
$(this).addClass(rowValidationError)
|
|
320
|
+
.append('<div class="form-row__error">' + $(this).data('message') + '</div>');
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return false;
|
|
296
325
|
}
|
|
297
326
|
|
|
298
327
|
if ($(form).is('#edit-billing-address')) {
|
|
@@ -308,28 +337,28 @@ Wick.Forms = (function(){
|
|
|
308
337
|
};
|
|
309
338
|
|
|
310
339
|
var scrollLocatorListPage = function() {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
340
|
+
var isLocatorListPage = $('.cards-store-list').length;
|
|
341
|
+
var isScrollNeeded = window.location.hash === '#stores-list';
|
|
342
|
+
if (isLocatorListPage && isScrollNeeded) {
|
|
343
|
+
handleSmoothScroll();
|
|
344
|
+
}
|
|
316
345
|
};
|
|
317
346
|
|
|
318
|
-
let bindEvents = function
|
|
347
|
+
let bindEvents = function() {
|
|
319
348
|
let selector = excludedClassesForForm.reduce((acc, className) => {
|
|
320
349
|
return acc + ':not([class^="' + className + '"])';
|
|
321
350
|
}, 'form');
|
|
322
351
|
$(document).on('submit', selector, handleFormSubmit);
|
|
323
352
|
$forgotPassword.on('click', scenarios[2].action);
|
|
324
|
-
$('.btn-cancel').on('click', function(){
|
|
353
|
+
$('.btn-cancel').on('click', function() {
|
|
325
354
|
window.location.href = './page_my-account.html';
|
|
326
355
|
});
|
|
327
|
-
$('.btn-previous').on('click', function(){
|
|
356
|
+
$('.btn-previous').on('click', function() {
|
|
328
357
|
window.location.href = './page_login.html';
|
|
329
358
|
});
|
|
330
359
|
};
|
|
331
360
|
|
|
332
|
-
var init = function
|
|
361
|
+
var init = function() {
|
|
333
362
|
bindEvents();
|
|
334
363
|
scrollLocatorListPage();
|
|
335
364
|
};
|
|
@@ -338,6 +367,6 @@ Wick.Forms = (function(){
|
|
|
338
367
|
|
|
339
368
|
return {
|
|
340
369
|
showValidationErrors: showValidationErrors,
|
|
341
|
-
clearValidationErrors: clearValidationErrors
|
|
342
|
-
}
|
|
370
|
+
clearValidationErrors: clearValidationErrors,
|
|
371
|
+
};
|
|
343
372
|
})();
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
|
|
1
3
|
const paymentLoader= '.payment-loader';
|
|
2
4
|
const paymentLoaderHideClass= 'payment-loader--hidden';
|
|
3
5
|
const paymentLoaderModal = '.payment-loader__modal'
|
|
@@ -5,11 +7,10 @@ const paymentTypeSelectors = {
|
|
|
5
7
|
apple: '.apple__button',
|
|
6
8
|
google: '.google__button',
|
|
7
9
|
clearpay: '#checkout-payment-details-clearpay',
|
|
8
|
-
billie: '#checkout-payment-details-billie, .billie__button',
|
|
9
10
|
paypal: '#checkout-payment-details-paypal'
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
function
|
|
13
|
+
Wick.showPaymentLoader = function(paymentType) {
|
|
13
14
|
$(paymentLoader).find(`${paymentLoaderModal} > div`).hide();
|
|
14
15
|
$(`.${paymentType}-checkout-logo`).show();
|
|
15
16
|
$(`${paymentLoader} .spinner`).show();
|
|
@@ -21,5 +22,5 @@ function showPaymentLoader(paymentType) {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
Object.entries(paymentTypeSelectors).forEach(([type, triggerSelector]) => {
|
|
24
|
-
$(document).on('click', triggerSelector, () => showPaymentLoader(type));
|
|
25
|
+
$(document).on('click', triggerSelector, () => Wick.showPaymentLoader(type));
|
|
25
26
|
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
|
|
3
|
+
Wick.RepaymentToggle = (function () {
|
|
4
|
+
const SELECTORS = {
|
|
5
|
+
repaymentRadio: 'input[name="repaymentTerms"]',
|
|
6
|
+
term: '.billie-info .term',
|
|
7
|
+
paymentMethod: '[name="payment-method"]'
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function updateTerm(value) {
|
|
11
|
+
const $term = $(SELECTORS.term);
|
|
12
|
+
if (!$term.length) return;
|
|
13
|
+
|
|
14
|
+
$term.text(value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function bindEvents () {
|
|
18
|
+
$(document).on('change', SELECTORS.repaymentRadio, function () {
|
|
19
|
+
const value = $(this).val();
|
|
20
|
+
if (!value) return;
|
|
21
|
+
|
|
22
|
+
updateTerm(value);
|
|
23
|
+
|
|
24
|
+
const currentMethod = $(SELECTORS.paymentMethod + ':checked').val();
|
|
25
|
+
if (currentMethod !== 'billie') return;
|
|
26
|
+
|
|
27
|
+
if (typeof Wick.showPaymentLoader === 'function') {
|
|
28
|
+
Wick.showPaymentLoader('billie');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
bindEvents();
|
|
35
|
+
})();
|