wickes-css2 2.107.0-develop.3 → 2.107.0-develop.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/css/components/checkout-chip.css +1 -1
- package/build/css/components/checkout-payment-details-v2.css +1 -1
- package/build/css/main.css +1 -1
- package/build/js/emulation.min.js +27 -1
- package/build/js/gift-cards.min.js +1 -1
- package/build/js/page/checkout-payment-details.js +96 -9
- package/build/js/page/checkout.js +1 -1
- package/build/js/page/components/gift-cards.js +1 -1
- package/package.json +1 -1
- package/src/components/checkout-payment-details-v2.hbs +4 -4
- package/src/components/checkout-payment-info-block.hbs +1 -1
- package/src/js/emulation/checkout-payment-details.js +34 -1
- package/src/js/page/checkout-payment-details.js +96 -9
- package/src/js/page/checkout.js +1 -1
- package/src/js/page/components/gift-cards.js +1 -1
- package/src/scss/components/checkout-chip.scss +1 -0
- package/src/scss/components/checkout-payment-details-v2.scss +12 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var Wick = Wick || {};
|
|
2
|
+
window.INIT_KLARNA_PAYMENT = window.INIT_KLARNA_PAYMENT || 'INIT_KLARNA_PAYMENT';
|
|
3
|
+
window.INIT_BILLIE_PAYMENT = window.INIT_BILLIE_PAYMENT || 'INIT_BILLIE_PAYMENT';
|
|
2
4
|
Wick.CheckoutPaymentDetails = (function () {
|
|
3
5
|
const $modal = $('#modal-terms-and-conditions');
|
|
4
6
|
|
|
@@ -10,9 +12,11 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
10
12
|
buttonName: 'btn-enter-details',
|
|
11
13
|
};
|
|
12
14
|
|
|
15
|
+
const toggleBillieRepaymentTermsClass = 'js-billie-repayment-terms--has-selection';
|
|
16
|
+
|
|
13
17
|
const elements = {
|
|
14
18
|
$billieRepaymentTerms: $('.js-billie-repayment-terms'),
|
|
15
|
-
$
|
|
19
|
+
$billieWidget: $('.checkout-payment-details__billie[data-billie]'),
|
|
16
20
|
$wrapperPaymentInput: $('.checkout-payment-details__row'),
|
|
17
21
|
paymentInputName: '[name=payment-method]',
|
|
18
22
|
$cardDetails: $('.checkout-payment-details__card-details'),
|
|
@@ -26,6 +30,52 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
26
30
|
hiddenClass: 'd-none',
|
|
27
31
|
};
|
|
28
32
|
|
|
33
|
+
let klarnaInited = false;
|
|
34
|
+
let billieInited = false;
|
|
35
|
+
|
|
36
|
+
function initKlarnaPayment() {
|
|
37
|
+
if (klarnaInited) return Promise.resolve({ ok: true, cached: true });
|
|
38
|
+
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
const payload = {};
|
|
41
|
+
const detail = {
|
|
42
|
+
resolve: (data) => {
|
|
43
|
+
klarnaInited = true;
|
|
44
|
+
resolve(data);
|
|
45
|
+
},
|
|
46
|
+
reject,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const evt = createEvent(window.INIT_KLARNA_PAYMENT, payload, detail);
|
|
50
|
+
window.dispatchEvent(evt);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function initBilliePayment() {
|
|
55
|
+
if (billieInited) return Promise.resolve({ ok: true, cached: true });
|
|
56
|
+
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
const payload = {};
|
|
59
|
+
const detail = {
|
|
60
|
+
resolve: (data) => {
|
|
61
|
+
billieInited = true;
|
|
62
|
+
resolve(data);
|
|
63
|
+
},
|
|
64
|
+
reject,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const evt = createEvent(window.INIT_BILLIE_PAYMENT, payload, detail);
|
|
68
|
+
window.dispatchEvent(evt);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function getBillieRepaymentTermsLength() {
|
|
73
|
+
const billieRepaymentTerms =
|
|
74
|
+
(window.Wick && window.Wick?.BillieData?.billiePaymentTerms) || [];
|
|
75
|
+
|
|
76
|
+
return Array.isArray(billieRepaymentTerms) ? billieRepaymentTerms.length : 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
29
79
|
function preparePage() {
|
|
30
80
|
var modalOpened = $('.modal.show').length;
|
|
31
81
|
if (!modalOpened) return;
|
|
@@ -54,10 +104,14 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
54
104
|
|
|
55
105
|
function togglePaymentBlocks(paymentMethods, checkedMethod) {
|
|
56
106
|
paymentMethods.forEach((method) => {
|
|
57
|
-
$(`[data-${method}]`).
|
|
107
|
+
$(`[data-${method}]`).hide();
|
|
58
108
|
});
|
|
59
|
-
}
|
|
60
109
|
|
|
110
|
+
const $selected = $(`[data-${checkedMethod}]`);
|
|
111
|
+
if ($selected.length) {
|
|
112
|
+
$selected.show();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
61
115
|
function resetAllCheckoutForms(keepPaymentMethod) {
|
|
62
116
|
const $container = elements.$wrapperPaymentInput.closest('.checkout-payment-details');
|
|
63
117
|
if (!$container.length) return;
|
|
@@ -101,9 +155,18 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
101
155
|
$row.find(':input').prop('disabled', !isVisible);
|
|
102
156
|
}
|
|
103
157
|
|
|
158
|
+
function _syncBillieUI(isReady) {
|
|
159
|
+
elements.$billieWidget.toggle(isReady);
|
|
160
|
+
elements.$billieRepaymentTerms.toggleClass(toggleBillieRepaymentTermsClass, isReady);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function resetBillieUi() {
|
|
164
|
+
_syncBillieUI(false);
|
|
165
|
+
}
|
|
166
|
+
|
|
104
167
|
function setBillieStepVisibility(isReady) {
|
|
168
|
+
_syncBillieUI(isReady);
|
|
105
169
|
setBillingDetailsRowVisibility(isReady);
|
|
106
|
-
elements.$billieInfoBlock.toggle(isReady);
|
|
107
170
|
}
|
|
108
171
|
|
|
109
172
|
function resetBillieRepaymentSelection() {
|
|
@@ -129,13 +192,27 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
129
192
|
const isUnregistered = type === 'unregistered';
|
|
130
193
|
const isRegistered = type === 'registered';
|
|
131
194
|
|
|
132
|
-
elements.$unregisteredFields
|
|
133
|
-
|
|
195
|
+
elements.$unregisteredFields
|
|
196
|
+
.toggleClass(elements.hiddenClass, !isUnregistered)
|
|
197
|
+
.removeAttr('style');
|
|
198
|
+
elements.$registeredFields
|
|
199
|
+
.toggleClass(elements.hiddenClass, !isRegistered)
|
|
200
|
+
.removeAttr('style');
|
|
134
201
|
}
|
|
135
202
|
|
|
136
203
|
function changeDetailsBlock(checkedMethod) {
|
|
137
204
|
if (checkedMethod !== 'billie') {
|
|
205
|
+
resetBillieUi();
|
|
138
206
|
setBillingDetailsRowVisibility(true);
|
|
207
|
+
hideBillieBusiness();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (checkedMethod === 'klarna') {
|
|
211
|
+
initKlarnaPayment().catch(() => {});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (checkedMethod === 'billie' && getBillieRepaymentTermsLength() === 1) {
|
|
215
|
+
initBilliePayment().catch(() => {});
|
|
139
216
|
}
|
|
140
217
|
|
|
141
218
|
switch (checkedMethod) {
|
|
@@ -157,7 +234,7 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
157
234
|
};
|
|
158
235
|
changeLabelText(detailsLabel);
|
|
159
236
|
|
|
160
|
-
setBillieStepVisibility(
|
|
237
|
+
setBillieStepVisibility(getBillieRepaymentTermsLength() === 1);
|
|
161
238
|
resetBillieRepaymentSelection();
|
|
162
239
|
showBillieBusiness();
|
|
163
240
|
break;
|
|
@@ -173,13 +250,13 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
173
250
|
prevClearableMethod = checkedMethod;
|
|
174
251
|
break;
|
|
175
252
|
|
|
176
|
-
case 'apple':
|
|
253
|
+
case 'apple-pay':
|
|
177
254
|
hideCardDetails();
|
|
178
255
|
hidePlaceOrder();
|
|
179
256
|
hideBillingAddres();
|
|
180
257
|
break;
|
|
181
258
|
|
|
182
|
-
case 'google':
|
|
259
|
+
case 'google-pay':
|
|
183
260
|
hideCardDetails();
|
|
184
261
|
hidePlaceOrder();
|
|
185
262
|
hideBillingAddres();
|
|
@@ -239,6 +316,12 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
239
316
|
});
|
|
240
317
|
}
|
|
241
318
|
|
|
319
|
+
function forceReflow($element) {
|
|
320
|
+
if (!$element.length) return;
|
|
321
|
+
void $element[0].offsetHeight;
|
|
322
|
+
$(window).trigger('resize');
|
|
323
|
+
}
|
|
324
|
+
|
|
242
325
|
function init() {
|
|
243
326
|
const paymentMethods = getPaymentMethods();
|
|
244
327
|
initBillieBusinessTypeToggle();
|
|
@@ -248,6 +331,10 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
248
331
|
const currentMethod = $(elements.paymentInputName + ':checked').val();
|
|
249
332
|
if (currentMethod !== 'billie') return;
|
|
250
333
|
|
|
334
|
+
requestAnimationFrame(() => {
|
|
335
|
+
forceReflow(elements.$billieWidget);
|
|
336
|
+
});
|
|
337
|
+
|
|
251
338
|
const hasSelection = $('input[name="repaymentTerms"]:checked').length > 0;
|
|
252
339
|
setBillieStepVisibility(hasSelection);
|
|
253
340
|
|
|
@@ -111,7 +111,7 @@ Wick.GiftCard = {
|
|
|
111
111
|
klarnaInfo: '.checkout-payment-details__klarna',
|
|
112
112
|
billingAddress: '.billing-address',
|
|
113
113
|
altPaymentRowsAttr:
|
|
114
|
-
'[data-apple],[data-google],[data-paypal],[data-klarna],[data-billie],[data-clearpay],[data-existing-card]',
|
|
114
|
+
'[data-apple-pay],[data-google-pay],[data-paypal],[data-klarna],[data-billie],[data-clearpay],[data-existing-card]',
|
|
115
115
|
hiddenCard: 'checkout-payment-details__card-details_hidden',
|
|
116
116
|
cardDetails: '.checkout-payment-details__card-details',
|
|
117
117
|
},
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
type="radio"
|
|
26
26
|
id="checkout-payment-details-apple"
|
|
27
27
|
name="payment-method"
|
|
28
|
-
value="apple">
|
|
28
|
+
value="apple-pay">
|
|
29
29
|
<ins></ins>
|
|
30
30
|
<div class="apple-logo">
|
|
31
31
|
<img src="img/apple-pay.svg" alt="apple pay">
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
type="radio"
|
|
45
45
|
id="checkout-payment-details-google"
|
|
46
46
|
name="payment-method"
|
|
47
|
-
value="google">
|
|
47
|
+
value="google-pay">
|
|
48
48
|
<ins></ins>
|
|
49
49
|
<div class="google-logo">
|
|
50
50
|
<img src="img/google-pay-mark.svg" alt="google pay">
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
</div>
|
|
135
135
|
</div>
|
|
136
136
|
|
|
137
|
-
<div data-apple class="form-row form-row__action form-row__save apple-wrap" style="display: none;">
|
|
137
|
+
<div data-apple-pay class="form-row form-row__action form-row__save apple-wrap" style="display: none;">
|
|
138
138
|
<div class="form-row__col-btn">
|
|
139
139
|
<apple-pay-button class="apple__button" buttonstyle="black" type="pay" locale="en-GB"></apple-pay-button>
|
|
140
140
|
</div>
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
</div>
|
|
147
147
|
</div>
|
|
148
148
|
|
|
149
|
-
<div data-google class="form-row form-row__action form-row__save google-wrap" style="display: none;">
|
|
149
|
+
<div data-google-pay class="form-row form-row__action form-row__save google-wrap" style="display: none;">
|
|
150
150
|
<div class="form-row__col-btn">
|
|
151
151
|
<div class="google__button" id="google-pay-btn">
|
|
152
152
|
<button type="button" aria-label="Pay with GPay" class="gpay-button black pay en"></button>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div {{#if dataAttr}}{{dataAttr}}{{/if}} class="{{blockClass}}" style="display: none;">
|
|
2
|
-
<div class="{{infoClass}}">
|
|
2
|
+
<div class="{{infoClass}}" style="display: none;">
|
|
3
3
|
<div class="{{infoClass}}__header">
|
|
4
4
|
<h4 class="{{infoClass}}__header_title">{{{heading}}}</h4>
|
|
5
5
|
<div class="{{infoClass}}__logo-img-big">
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
window.Wick = window.Wick || {};
|
|
2
|
+
window.Wick.BillieData = window.Wick.BillieData || {};
|
|
3
|
+
window.Wick.BillieData.billiePaymentTerms = ['30', '60', '90'];
|
|
4
|
+
window.INIT_KLARNA_PAYMENT = window.INIT_KLARNA_PAYMENT || 'INIT_KLARNA_PAYMENT';
|
|
5
|
+
window.INIT_BILLIE_PAYMENT = window.INIT_BILLIE_PAYMENT || 'INIT_BILLIE_PAYMENT';
|
|
2
6
|
|
|
3
7
|
Wick.PaymentDetails = (function () {
|
|
4
8
|
var $btnEnterDetails = $('.btn-enter-details'),
|
|
5
9
|
isGuestPage = $('.page_checkout-payment-details_guest').length;
|
|
6
10
|
|
|
11
|
+
const $billieInfo = $('.checkout-payment-details__billie .billie-info');
|
|
12
|
+
const $klarnaInfo = $('.checkout-payment-details__klarna .klarna-info');
|
|
13
|
+
|
|
7
14
|
function bindEvents() {
|
|
8
15
|
$btnEnterDetails.on('click', function (e) {
|
|
9
16
|
e.preventDefault();
|
|
@@ -49,6 +56,32 @@ Wick.PaymentDetails = (function () {
|
|
|
49
56
|
Wick.Forms.showValidationErrors(this);
|
|
50
57
|
return false;
|
|
51
58
|
});
|
|
59
|
+
|
|
60
|
+
$(window).on(window.INIT_BILLIE_PAYMENT, function (e) {
|
|
61
|
+
const detail = e.detail || (e.originalEvent && e.originalEvent.detail) || {};
|
|
62
|
+
|
|
63
|
+
if (detail && detail.resolve) {
|
|
64
|
+
$billieInfo.show();
|
|
65
|
+
detail.resolve();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
$(window).on(window.INIT_KLARNA_PAYMENT, function (e) {
|
|
70
|
+
const detail = e.detail || (e.originalEvent && e.originalEvent.detail) || {};
|
|
71
|
+
|
|
72
|
+
if (detail && detail.resolve) {
|
|
73
|
+
$klarnaInfo.show();
|
|
74
|
+
detail.resolve();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
$(document).on('change', 'input[name="repaymentTerms"]', function () {
|
|
79
|
+
const hasSelection = $('input[name="repaymentTerms"]:checked').length > 0;
|
|
80
|
+
|
|
81
|
+
if (hasSelection) {
|
|
82
|
+
$billieInfo.show();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
52
85
|
}
|
|
53
86
|
|
|
54
87
|
bindEvents();
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var Wick = Wick || {};
|
|
2
|
+
window.INIT_KLARNA_PAYMENT = window.INIT_KLARNA_PAYMENT || 'INIT_KLARNA_PAYMENT';
|
|
3
|
+
window.INIT_BILLIE_PAYMENT = window.INIT_BILLIE_PAYMENT || 'INIT_BILLIE_PAYMENT';
|
|
2
4
|
Wick.CheckoutPaymentDetails = (function () {
|
|
3
5
|
const $modal = $('#modal-terms-and-conditions');
|
|
4
6
|
|
|
@@ -10,9 +12,11 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
10
12
|
buttonName: 'btn-enter-details',
|
|
11
13
|
};
|
|
12
14
|
|
|
15
|
+
const toggleBillieRepaymentTermsClass = 'js-billie-repayment-terms--has-selection';
|
|
16
|
+
|
|
13
17
|
const elements = {
|
|
14
18
|
$billieRepaymentTerms: $('.js-billie-repayment-terms'),
|
|
15
|
-
$
|
|
19
|
+
$billieWidget: $('.checkout-payment-details__billie[data-billie]'),
|
|
16
20
|
$wrapperPaymentInput: $('.checkout-payment-details__row'),
|
|
17
21
|
paymentInputName: '[name=payment-method]',
|
|
18
22
|
$cardDetails: $('.checkout-payment-details__card-details'),
|
|
@@ -26,6 +30,52 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
26
30
|
hiddenClass: 'd-none',
|
|
27
31
|
};
|
|
28
32
|
|
|
33
|
+
let klarnaInited = false;
|
|
34
|
+
let billieInited = false;
|
|
35
|
+
|
|
36
|
+
function initKlarnaPayment() {
|
|
37
|
+
if (klarnaInited) return Promise.resolve({ ok: true, cached: true });
|
|
38
|
+
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
const payload = {};
|
|
41
|
+
const detail = {
|
|
42
|
+
resolve: (data) => {
|
|
43
|
+
klarnaInited = true;
|
|
44
|
+
resolve(data);
|
|
45
|
+
},
|
|
46
|
+
reject,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const evt = createEvent(window.INIT_KLARNA_PAYMENT, payload, detail);
|
|
50
|
+
window.dispatchEvent(evt);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function initBilliePayment() {
|
|
55
|
+
if (billieInited) return Promise.resolve({ ok: true, cached: true });
|
|
56
|
+
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
const payload = {};
|
|
59
|
+
const detail = {
|
|
60
|
+
resolve: (data) => {
|
|
61
|
+
billieInited = true;
|
|
62
|
+
resolve(data);
|
|
63
|
+
},
|
|
64
|
+
reject,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const evt = createEvent(window.INIT_BILLIE_PAYMENT, payload, detail);
|
|
68
|
+
window.dispatchEvent(evt);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function getBillieRepaymentTermsLength() {
|
|
73
|
+
const billieRepaymentTerms =
|
|
74
|
+
(window.Wick && window.Wick?.BillieData?.billiePaymentTerms) || [];
|
|
75
|
+
|
|
76
|
+
return Array.isArray(billieRepaymentTerms) ? billieRepaymentTerms.length : 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
29
79
|
function preparePage() {
|
|
30
80
|
var modalOpened = $('.modal.show').length;
|
|
31
81
|
if (!modalOpened) return;
|
|
@@ -54,10 +104,14 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
54
104
|
|
|
55
105
|
function togglePaymentBlocks(paymentMethods, checkedMethod) {
|
|
56
106
|
paymentMethods.forEach((method) => {
|
|
57
|
-
$(`[data-${method}]`).
|
|
107
|
+
$(`[data-${method}]`).hide();
|
|
58
108
|
});
|
|
59
|
-
}
|
|
60
109
|
|
|
110
|
+
const $selected = $(`[data-${checkedMethod}]`);
|
|
111
|
+
if ($selected.length) {
|
|
112
|
+
$selected.show();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
61
115
|
function resetAllCheckoutForms(keepPaymentMethod) {
|
|
62
116
|
const $container = elements.$wrapperPaymentInput.closest('.checkout-payment-details');
|
|
63
117
|
if (!$container.length) return;
|
|
@@ -101,9 +155,18 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
101
155
|
$row.find(':input').prop('disabled', !isVisible);
|
|
102
156
|
}
|
|
103
157
|
|
|
158
|
+
function _syncBillieUI(isReady) {
|
|
159
|
+
elements.$billieWidget.toggle(isReady);
|
|
160
|
+
elements.$billieRepaymentTerms.toggleClass(toggleBillieRepaymentTermsClass, isReady);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function resetBillieUi() {
|
|
164
|
+
_syncBillieUI(false);
|
|
165
|
+
}
|
|
166
|
+
|
|
104
167
|
function setBillieStepVisibility(isReady) {
|
|
168
|
+
_syncBillieUI(isReady);
|
|
105
169
|
setBillingDetailsRowVisibility(isReady);
|
|
106
|
-
elements.$billieInfoBlock.toggle(isReady);
|
|
107
170
|
}
|
|
108
171
|
|
|
109
172
|
function resetBillieRepaymentSelection() {
|
|
@@ -129,13 +192,27 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
129
192
|
const isUnregistered = type === 'unregistered';
|
|
130
193
|
const isRegistered = type === 'registered';
|
|
131
194
|
|
|
132
|
-
elements.$unregisteredFields
|
|
133
|
-
|
|
195
|
+
elements.$unregisteredFields
|
|
196
|
+
.toggleClass(elements.hiddenClass, !isUnregistered)
|
|
197
|
+
.removeAttr('style');
|
|
198
|
+
elements.$registeredFields
|
|
199
|
+
.toggleClass(elements.hiddenClass, !isRegistered)
|
|
200
|
+
.removeAttr('style');
|
|
134
201
|
}
|
|
135
202
|
|
|
136
203
|
function changeDetailsBlock(checkedMethod) {
|
|
137
204
|
if (checkedMethod !== 'billie') {
|
|
205
|
+
resetBillieUi();
|
|
138
206
|
setBillingDetailsRowVisibility(true);
|
|
207
|
+
hideBillieBusiness();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (checkedMethod === 'klarna') {
|
|
211
|
+
initKlarnaPayment().catch(() => {});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (checkedMethod === 'billie' && getBillieRepaymentTermsLength() === 1) {
|
|
215
|
+
initBilliePayment().catch(() => {});
|
|
139
216
|
}
|
|
140
217
|
|
|
141
218
|
switch (checkedMethod) {
|
|
@@ -157,7 +234,7 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
157
234
|
};
|
|
158
235
|
changeLabelText(detailsLabel);
|
|
159
236
|
|
|
160
|
-
setBillieStepVisibility(
|
|
237
|
+
setBillieStepVisibility(getBillieRepaymentTermsLength() === 1);
|
|
161
238
|
resetBillieRepaymentSelection();
|
|
162
239
|
showBillieBusiness();
|
|
163
240
|
break;
|
|
@@ -173,13 +250,13 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
173
250
|
prevClearableMethod = checkedMethod;
|
|
174
251
|
break;
|
|
175
252
|
|
|
176
|
-
case 'apple':
|
|
253
|
+
case 'apple-pay':
|
|
177
254
|
hideCardDetails();
|
|
178
255
|
hidePlaceOrder();
|
|
179
256
|
hideBillingAddres();
|
|
180
257
|
break;
|
|
181
258
|
|
|
182
|
-
case 'google':
|
|
259
|
+
case 'google-pay':
|
|
183
260
|
hideCardDetails();
|
|
184
261
|
hidePlaceOrder();
|
|
185
262
|
hideBillingAddres();
|
|
@@ -239,6 +316,12 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
239
316
|
});
|
|
240
317
|
}
|
|
241
318
|
|
|
319
|
+
function forceReflow($element) {
|
|
320
|
+
if (!$element.length) return;
|
|
321
|
+
void $element[0].offsetHeight;
|
|
322
|
+
$(window).trigger('resize');
|
|
323
|
+
}
|
|
324
|
+
|
|
242
325
|
function init() {
|
|
243
326
|
const paymentMethods = getPaymentMethods();
|
|
244
327
|
initBillieBusinessTypeToggle();
|
|
@@ -248,6 +331,10 @@ Wick.CheckoutPaymentDetails = (function () {
|
|
|
248
331
|
const currentMethod = $(elements.paymentInputName + ':checked').val();
|
|
249
332
|
if (currentMethod !== 'billie') return;
|
|
250
333
|
|
|
334
|
+
requestAnimationFrame(() => {
|
|
335
|
+
forceReflow(elements.$billieWidget);
|
|
336
|
+
});
|
|
337
|
+
|
|
251
338
|
const hasSelection = $('input[name="repaymentTerms"]:checked').length > 0;
|
|
252
339
|
setBillieStepVisibility(hasSelection);
|
|
253
340
|
|
package/src/js/page/checkout.js
CHANGED
|
@@ -111,7 +111,7 @@ Wick.GiftCard = {
|
|
|
111
111
|
klarnaInfo: '.checkout-payment-details__klarna',
|
|
112
112
|
billingAddress: '.billing-address',
|
|
113
113
|
altPaymentRowsAttr:
|
|
114
|
-
'[data-apple],[data-google],[data-paypal],[data-klarna],[data-billie],[data-clearpay],[data-existing-card]',
|
|
114
|
+
'[data-apple-pay],[data-google-pay],[data-paypal],[data-klarna],[data-billie],[data-clearpay],[data-existing-card]',
|
|
115
115
|
hiddenCard: 'checkout-payment-details__card-details_hidden',
|
|
116
116
|
cardDetails: '.checkout-payment-details__card-details',
|
|
117
117
|
},
|