wickes-css2 2.103.0-RG-1742-billie-30-60-90-days.3 → 2.103.0-develop.10
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 +5 -1
- package/build/css/category-main.css +1 -1
- package/build/css/components/card-product-banner.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/page_products-list-combined.css +1 -1
- package/build/css/pages/page_products-list.css +1 -1
- package/build/css/pdp-main-before-combine.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/basket.min.js +2 -2
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +2 -2
- package/build/js/emulation.min.js +1301 -369
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/merged-checkout.min.js +2 -2
- package/build/js/mini-basket-slider.min.js +1 -0
- package/build/js/page/basket/basket-update-cart-action.js +59 -0
- package/build/js/page/basket/basket-update-cart.js +29 -0
- package/build/js/page/basket/basket-utils.js +50 -0
- package/build/js/page/basket/mini-basket-total.js +97 -0
- package/build/js/page/basket/quantity-change-handler.js +64 -0
- package/build/js/page/basket/update-quantity-operation.js +37 -0
- package/build/js/page/basket/update-quantity.js +65 -0
- package/build/js/page/basket-v2.js +138 -244
- package/build/js/page/checkout-payment-details.js +43 -96
- package/build/js/page/components/discounts.js +6 -6
- package/build/js/page/components/mini-basket-slider.js +569 -0
- package/build/js/page/plp-cards-v2.js +15 -6
- package/build/js/page/plp-load-more.js +1 -1
- package/build/js/pdp.bundle.min.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/project-list.min.js +1 -1
- package/package.json +18 -3
- 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 +23 -35
- package/src/components/injected-content.hbs +1 -1
- package/src/components/mini-basket/mini-basket-empty.hbs +3 -13
- package/src/components/mini-basket/mini-basket-order-item.hbs +73 -0
- package/src/components/mini-basket/mini-basket.hbs +32 -13
- package/src/components/mini-basket/product-item.hbs +37 -16
- package/src/components/srp-injected.hbs +3 -13
- package/src/data/data_confirmation-summary.json +4 -2
- package/src/data/data_mini-basket.json +4 -80
- package/src/data/data_search-results_v2.json +56 -141
- package/src/js/components/banner-placement-manager.js +267 -0
- package/src/js/components/general/cart-slider.js +4 -0
- package/src/js/components/general/create-popup-slider.js +5 -2
- package/src/js/emulation/account-hub.js +40 -40
- package/src/js/emulation/banner-placement-manager.js +53 -0
- package/src/js/emulation/checkout-payment-details.js +8 -8
- package/src/js/emulation/custom-slider-emulation.js +4 -10
- package/src/js/emulation/forms.js +89 -118
- package/src/js/emulation/mini-basket-data.js +949 -0
- package/src/js/emulation/paymentLoader.js +3 -4
- package/src/js/page/basket/basket-update-cart-action.js +59 -0
- package/src/js/page/basket/basket-update-cart.js +29 -0
- package/src/js/page/basket/basket-utils.js +50 -0
- package/src/js/page/basket/mini-basket-total.js +97 -0
- package/src/js/page/basket/quantity-change-handler.js +64 -0
- package/src/js/page/basket/update-quantity-operation.js +37 -0
- package/src/js/page/basket/update-quantity.js +65 -0
- package/src/js/page/basket-v2.js +138 -244
- package/src/js/page/checkout-payment-details.js +43 -96
- package/src/js/page/components/discounts.js +6 -6
- package/src/js/page/components/mini-basket-slider.js +569 -0
- package/src/js/page/plp-cards-v2.js +15 -6
- package/src/js/page/plp-load-more.js +1 -1
- package/src/layouts/base.hbs +0 -6
- package/src/page_plp_v2.html +17 -6
- package/src/page_search-results.html +12 -2
- package/src/partials/scripts.hbs +1 -0
- package/src/scss/category-main.scss +1 -0
- package/src/scss/components/_custom-slider.scss +131 -3
- package/src/scss/components/_popover-mini-basket.scss +0 -4
- package/src/scss/components/card-product-banner.scss +91 -3
- package/src/scss/emulation.scss +3 -3
- package/src/scss/helpers/_colors-semantic.scss +120 -0
- package/src/scss/helpers/_variables.scss +2 -0
- package/src/scss/main.scss +0 -2
- package/src/scss/pages/_facets.scss +86 -0
- package/src/scss/pages/page_products-list-combined.scss +11 -0
- package/src/scss/pages/page_products-list.scss +8 -0
- package/src/scss/plp-main.scss +1 -0
- package/build/css/components/checkout-chip.css +0 -1
- package/build/css/components/checkout-payment-repayment-terms.css +0 -1
- package/src/components/checkout-chip.hbs +0 -15
- package/src/components/checkout-payment-repayment-terms.hbs +0 -12
- package/src/data/data_billie-terms.json +0 -7
- package/src/js/components/general/mini-basket-slider.js +0 -8
- package/src/js/components/product-banner.js +0 -148
- package/src/js/emulation/repayment-toggle.js +0 -35
- package/src/scss/components/checkout-chip.scss +0 -64
- package/src/scss/components/checkout-payment-repayment-terms.scss +0 -39
|
@@ -31,6 +31,19 @@ import {displayEnergyEfficiency} from "./basket/display-energy-efficiency";
|
|
|
31
31
|
import {appendLoader, hideLoader, showLoader} from "./utils/loader";
|
|
32
32
|
import { initStickyObserver } from './components/sticky-order-observer';
|
|
33
33
|
import {addClassToSummaryAside} from "./basket/summary-mobile";
|
|
34
|
+
import {handleQuantityChange} from "./basket/quantity-change-handler";
|
|
35
|
+
import {updateQuantityAction} from "./basket/update-quantity";
|
|
36
|
+
import {updateQuantityOperation} from "./basket/update-quantity-operation";
|
|
37
|
+
import {
|
|
38
|
+
checkProductArrays,
|
|
39
|
+
getCartEntries,
|
|
40
|
+
getMessageInfo,
|
|
41
|
+
isMessageExist,
|
|
42
|
+
updatePromotion,
|
|
43
|
+
showNotification
|
|
44
|
+
} from "./basket/basket-utils";
|
|
45
|
+
import {updateCartBase} from "./basket/basket-update-cart";
|
|
46
|
+
import {updateCartActionBase} from "./basket/basket-update-cart-action";
|
|
34
47
|
|
|
35
48
|
var Wick = window.Wick || {};
|
|
36
49
|
Wick.BasketPage = {
|
|
@@ -192,36 +205,17 @@ Wick.BasketPage = {
|
|
|
192
205
|
}
|
|
193
206
|
|
|
194
207
|
//for local update quantity value before API Call
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
Wick.BasketPage.updateQuantity(quantityInput, value);
|
|
207
|
-
Wick.BasketPage.debounceQuantityChange(entryNumber, value, quantityInput, context);
|
|
208
|
-
} else {
|
|
209
|
-
Wick.BasketPage.removeQuantityDisable();
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
break;
|
|
213
|
-
case 'remove':
|
|
214
|
-
value = 0;
|
|
215
|
-
charity || Wick.BasketPage.updateQuantity(quantityInput, value);
|
|
216
|
-
Wick.BasketPage.debounceQuantityChange(entryNumber, value, quantityInput, context);
|
|
217
|
-
break;
|
|
218
|
-
default:
|
|
219
|
-
if (+value !== 0) {
|
|
220
|
-
Wick.BasketPage.updateQuantity(quantityInput, value);
|
|
221
|
-
Wick.BasketPage.debounceQuantityChange(entryNumber, value, quantityInput, context);
|
|
222
|
-
}
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
208
|
+
handleQuantityChange({
|
|
209
|
+
quantityInput,
|
|
210
|
+
action,
|
|
211
|
+
value,
|
|
212
|
+
context,
|
|
213
|
+
charity,
|
|
214
|
+
entryNumber,
|
|
215
|
+
onQuantityChange: Wick.BasketPage.updateQuantityAction,
|
|
216
|
+
debounceQuantityChange: Wick.BasketPage.debounceQuantityChange,
|
|
217
|
+
onRemoveQuantityDisable: Wick.BasketPage.removeQuantityDisable
|
|
218
|
+
});
|
|
225
219
|
|
|
226
220
|
changeWisdomWhenQuantityUpdated(e, context);
|
|
227
221
|
Wick.BasketPage.toggleItemTotal(context, +quantityInput.val())
|
|
@@ -231,54 +225,23 @@ Wick.BasketPage = {
|
|
|
231
225
|
Wick.BasketPage.updateQuantityAction(entryNumber, value, quantityInput, context)
|
|
232
226
|
}, 500),
|
|
233
227
|
updateQuantityAction: function (entryNumber, quantityToUpdate, quantityInput, context) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
callAction(
|
|
252
|
-
payload,
|
|
253
|
-
Wick.BasketPage.updateAction,
|
|
254
|
-
quantityToUpdate,
|
|
255
|
-
quantityInput,
|
|
256
|
-
context,
|
|
257
|
-
(response) => {
|
|
258
|
-
if (response.statusMessage === 'accConfirmedMsgs') {
|
|
259
|
-
const basketSection = Wick.BasketPage.el.basketMainSection;
|
|
260
|
-
$(document).trigger("EEUpdateCart", {
|
|
261
|
-
cartEntryNumber: entryNumber,
|
|
262
|
-
initialCartQuantity: response.quantity - response.quantityAdded,
|
|
263
|
-
newCartQuantity: response.quantity,
|
|
264
|
-
fulfillment: context.hasClass('charity-new') ? 'Delivery' : context.closest(basketSection).attr('data-type'),
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
context.find(Wick.BasketPage.el.actionButton).removeClass('disabled');
|
|
268
|
-
});
|
|
269
|
-
} else {
|
|
270
|
-
Wick.BasketPage.updateQuantityOperation(
|
|
271
|
-
quantityToUpdate,
|
|
272
|
-
quantityInput,
|
|
273
|
-
context,
|
|
274
|
-
Wick.BasketData.updateQuantity
|
|
275
|
-
);
|
|
276
|
-
Wick.BasketPage.addQuantityDisable(context);
|
|
277
|
-
setTimeout(() => {
|
|
278
|
-
Wick.BasketPage.removeQuantityDisable();
|
|
279
|
-
hideLoader(Wick.BasketPage.el.loader);
|
|
280
|
-
}, 500);
|
|
281
|
-
}
|
|
228
|
+
updateQuantityAction({
|
|
229
|
+
entryNumber,
|
|
230
|
+
quantityToUpdate,
|
|
231
|
+
quantityInput,
|
|
232
|
+
context,
|
|
233
|
+
addQuantityDisable: Wick.BasketPage.addQuantityDisable,
|
|
234
|
+
removeQuantityDisable: Wick.BasketPage.removeQuantityDisable,
|
|
235
|
+
hideLoader: hideLoader,
|
|
236
|
+
loaderSelector: Wick.BasketPage.el.loader,
|
|
237
|
+
updateAction: Wick.BasketPage.updateAction,
|
|
238
|
+
updateQuantityOperation: Wick.BasketPage.updateQuantityOperation,
|
|
239
|
+
basketData: Wick.BasketData,
|
|
240
|
+
isLocalEnv: Wick.checkLocalEnv,
|
|
241
|
+
callActionFn: callAction,
|
|
242
|
+
routes: ROUTES,
|
|
243
|
+
basketSectionSelector: Wick.BasketPage.el.basketMainSection
|
|
244
|
+
});
|
|
282
245
|
},
|
|
283
246
|
updateAction: function (response, quantityToUpdate, quantityInput, context, successCallback) {
|
|
284
247
|
Wick.BasketPage.updateQuantityOperation(
|
|
@@ -290,54 +253,17 @@ Wick.BasketPage = {
|
|
|
290
253
|
successCallback(response);
|
|
291
254
|
},
|
|
292
255
|
updateQuantityOperation: function (quantityToUpdate, quantityInput, context, data) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
console.log('errorStatus:', negativeStatus);
|
|
304
|
-
|
|
305
|
-
minValue === 0 ? minValue = 1 : minValue = minValue;
|
|
306
|
-
|
|
307
|
-
if (negativeStatus) {
|
|
308
|
-
Wick.BasketPage.updateCart(messageInfo);
|
|
309
|
-
Wick.BasketPage.updateQuantity(quantityInput, data.quantity);
|
|
310
|
-
Wick.BasketPage.showNotification(data);
|
|
311
|
-
} else {
|
|
312
|
-
if (charity) {
|
|
313
|
-
Wick.BasketPage.updateCart();
|
|
314
|
-
} else {
|
|
315
|
-
if (maxValue > 1 || minValue > 1) {
|
|
316
|
-
if (quantityToUpdate > maxValue || quantityToUpdate < minValue) {
|
|
317
|
-
Wick.BasketPage.showNotification(data);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (quantityToUpdate === 0) {
|
|
322
|
-
Wick.BasketPage.showNotification(data);
|
|
323
|
-
Wick.BasketPage.updateCart(messageInfo);
|
|
324
|
-
} else {
|
|
325
|
-
Wick.BasketPage.updateItemTotal(data, context)
|
|
326
|
-
Wick.BasketPage.updateCart(null, context)
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
},
|
|
332
|
-
isMessageExist: function (data) {
|
|
333
|
-
return data.message && data.statusMessage;
|
|
334
|
-
},
|
|
335
|
-
getMessageInfo: function (data) {
|
|
336
|
-
return {
|
|
337
|
-
message: data.message,
|
|
338
|
-
status: data.statusMessage,
|
|
339
|
-
}
|
|
256
|
+
updateQuantityOperation(quantityToUpdate, quantityInput, context, data, {
|
|
257
|
+
updateCart: Wick.BasketPage.updateCart,
|
|
258
|
+
showNotification: Wick.BasketPage.showNotification,
|
|
259
|
+
updateQuantity: Wick.BasketPage.updateQuantity,
|
|
260
|
+
updateItemTotal: Wick.BasketPage.updateItemTotal,
|
|
261
|
+
isMessageExist: Wick.BasketPage.isMessageExist,
|
|
262
|
+
getMessageInfo: Wick.BasketPage.getMessageInfo
|
|
263
|
+
});
|
|
340
264
|
},
|
|
265
|
+
isMessageExist: isMessageExist,
|
|
266
|
+
getMessageInfo: getMessageInfo,
|
|
341
267
|
loadIndexing: function () {
|
|
342
268
|
Wick.BasketPage.el.$orderItem.each(function (index) {
|
|
343
269
|
$(this).attr('data-id', index);
|
|
@@ -364,107 +290,92 @@ Wick.BasketPage = {
|
|
|
364
290
|
}
|
|
365
291
|
}
|
|
366
292
|
},
|
|
367
|
-
toggleItemTotal: function
|
|
293
|
+
toggleItemTotal: function(context, quantity) {
|
|
368
294
|
quantity <= 1
|
|
369
|
-
|
|
370
|
-
|
|
295
|
+
? $(context).find(Wick.BasketPage.el.total).addClass(Wick.BasketPage.el.totalHide)
|
|
296
|
+
: $(context).find(Wick.BasketPage.el.total).removeClass(Wick.BasketPage.el.totalHide);
|
|
371
297
|
},
|
|
372
298
|
updateCart: function (repaintData, context, charity, initial, callback) {
|
|
373
299
|
console.log('case(api) to update cart');
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
300
|
+
updateCartBase({
|
|
301
|
+
isLocalEnv: Wick.checkLocalEnv,
|
|
302
|
+
apiUrl: ROUTES.BASKET_GET_CART,
|
|
303
|
+
apiType: 'GET',
|
|
304
|
+
hideLoader: () => setTimeout(() => hideLoader(Wick.BasketPage.el.loader), 1000),
|
|
305
|
+
callActionFn: callAction,
|
|
306
|
+
actionCallback: callback || Wick.BasketPage.updateCartAction,
|
|
307
|
+
repaintData,
|
|
308
|
+
context,
|
|
309
|
+
charity,
|
|
310
|
+
initial,
|
|
311
|
+
localUpdateFn: function(initial, repaintData, context, charity) {
|
|
312
|
+
if (initial) {
|
|
313
|
+
Wick.BasketPage.getCartEntries(Wick.BasketData.initialCartState);
|
|
314
|
+
addClassToSummaryAside(Wick.BasketData.initialCartState);
|
|
315
|
+
const initialTotalPrice = Wick.BasketData.initialCartState.totalPrice.value;
|
|
316
|
+
updateClearpayVisibility(initialTotalPrice);
|
|
317
|
+
} else {
|
|
318
|
+
updateBasketDataQuantity();
|
|
319
|
+
updateOrderSummary(
|
|
320
|
+
Wick.BasketData.updateCart,
|
|
321
|
+
Wick.BasketPage.getEqualMapForUpdateCart(Wick.BasketData.updateCart)
|
|
322
|
+
);
|
|
323
|
+
!repaintData || Wick.BasketPage.repaintOrderItems(Wick.BasketData.updateCart, repaintData);
|
|
324
|
+
!charity || Wick.BasketPage.addCharityEntryNumber(Wick.BasketData.updateCart);
|
|
325
|
+
if (context && context.length) {
|
|
326
|
+
Wick.BasketPage.updatePromotion(Wick.BasketData.updateCart, context);
|
|
327
|
+
}
|
|
328
|
+
updateKlarnaPlacements(Wick.BasketData.updateCart.totalPrice.formattedPriceWithoutCurrencySymbol);
|
|
329
|
+
updateClearpayPlacements(Wick.BasketData.updateCart.totalPrice.value);
|
|
330
|
+
updateClearpayVisibility(Wick.BasketData.updateCart.totalPrice.value);
|
|
331
|
+
Wick.BasketPage.addPotentialPromo(Wick.BasketData.updateCart);
|
|
332
|
+
addClassToSummaryAside(Wick.BasketData.updateCart);
|
|
333
|
+
Wick.BasketPage.getCartEntries(Wick.BasketData.updateCart);
|
|
334
|
+
Wick.BasketPage.checkProductArrays(Wick.BasketData.updateCart) || Wick.BasketPage.removeOrderItem(repaintData);
|
|
335
|
+
updateBasketSession();
|
|
336
|
+
Wick.EnergyEfficiency && Wick.EnergyEfficiency.drawEnergyLabels();
|
|
337
|
+
setTimeout(() => hideLoader(Wick.BasketPage.el.loader), 1000);
|
|
404
338
|
}
|
|
405
|
-
|
|
406
|
-
updateKlarnaPlacements(Wick.BasketData.updateCart.totalPrice.formattedPriceWithoutCurrencySymbol);
|
|
407
|
-
updateClearpayPlacements(Wick.BasketData.updateCart.totalPrice.value);
|
|
408
|
-
updateClearpayVisibility(Wick.BasketData.updateCart.totalPrice.value);
|
|
409
|
-
Wick.BasketPage.addPotentialPromo(Wick.BasketData.updateCart);
|
|
410
|
-
addClassToSummaryAside(Wick.BasketData.updateCart);
|
|
411
|
-
Wick.BasketPage.getCartEntries(Wick.BasketData.updateCart);
|
|
412
|
-
Wick.BasketPage.checkProductArrays(Wick.BasketData.updateCart) || Wick.BasketPage.removeOrderItem(repaintData);
|
|
413
|
-
updateBasketSession();
|
|
414
|
-
Wick.EnergyEfficiency && Wick.EnergyEfficiency.drawEnergyLabels();
|
|
415
|
-
setTimeout(hideLoader, 1000);
|
|
416
339
|
}
|
|
417
|
-
}
|
|
340
|
+
});
|
|
418
341
|
},
|
|
419
|
-
updateCartAction: function (response,
|
|
420
|
-
updateClearpayVisibility(response.totalPrice.value)
|
|
421
|
-
addClassToSummaryAside(response)
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
342
|
+
updateCartAction: function (response, {repaintData, charity, initial, context}) {
|
|
343
|
+
updateClearpayVisibility(response.totalPrice.value);
|
|
344
|
+
addClassToSummaryAside(response);
|
|
345
|
+
|
|
346
|
+
updateCartActionBase({
|
|
347
|
+
response,
|
|
348
|
+
repaintData,
|
|
349
|
+
context,
|
|
350
|
+
charity,
|
|
351
|
+
initial,
|
|
352
|
+
updateOrderSummaryFn: updateOrderSummary,
|
|
353
|
+
getEqualMapFn: Wick.BasketPage.getEqualMapForUpdateCart,
|
|
354
|
+
repaintOrderItemsFn: Wick.BasketPage.repaintOrderItems,
|
|
355
|
+
addCharityEntryNumberFn: Wick.BasketPage.addCharityEntryNumber,
|
|
356
|
+
updatePromotionFn: Wick.BasketPage.updatePromotion,
|
|
357
|
+
addPotentialPromoFn: Wick.BasketPage.addPotentialPromo,
|
|
358
|
+
cartEntries: Wick.BasketPage.cartEntries,
|
|
359
|
+
getCartEntriesFn: () => Wick.BasketPage.getCartEntries(response),
|
|
360
|
+
checkProductArraysFn: Wick.BasketPage.checkProductArrays,
|
|
361
|
+
removeOrderItemFn: Wick.BasketPage.removeOrderItem,
|
|
362
|
+
elOrderItem: Wick.BasketPage.el.orderItem,
|
|
363
|
+
updateKlarnaPlacementsFn: updateKlarnaPlacements,
|
|
364
|
+
updateClearpayPlacementsFn: updateClearpayPlacements,
|
|
365
|
+
updateClearpayVisibilityFn: updateClearpayVisibility,
|
|
366
|
+
addClassToSummaryAsideFn: addClassToSummaryAside,
|
|
367
|
+
updateBasketSessionFn: updateBasketSession,
|
|
368
|
+
drawEnergyLabelsFn: Wick.EnergyEfficiency && Wick.EnergyEfficiency.drawEnergyLabels,
|
|
369
|
+
extraActions: (response) => {
|
|
370
|
+
updateEeaProducts(response.deliveryOrderGroups, response.pickupOrderGroups);
|
|
371
|
+
updateEeaCheckoutProducts(response.deliveryOrderGroups, response.pickupOrderGroups);
|
|
372
|
+
syncEeaProducts();
|
|
446
373
|
}
|
|
447
|
-
|
|
448
|
-
Wick.BasketPage.addPotentialPromo(response);
|
|
449
|
-
updateEeaProducts(response.deliveryOrderGroups, response.pickupOrderGroups);
|
|
450
|
-
updateEeaCheckoutProducts(response.deliveryOrderGroups, response.pickupOrderGroups);
|
|
451
|
-
syncEeaProducts();
|
|
452
|
-
$(document).trigger("cartUpdate");
|
|
453
|
-
Wick.BasketPage.getCartEntries(response);
|
|
454
|
-
updateKlarnaPlacements(response.totalPrice.formattedPriceWithoutCurrencySymbol);
|
|
455
|
-
updateClearpayPlacements(response.totalPrice.value);
|
|
456
|
-
updateClearpayVisibility(response.totalPrice.value);
|
|
457
|
-
updateBasketSession();
|
|
458
|
-
Wick.EnergyEfficiency.drawEnergyLabels()
|
|
459
|
-
}
|
|
460
|
-
},
|
|
461
|
-
checkProductArrays(cart) {
|
|
462
|
-
return cart.pickupUniqueItemsNumber || cart.deliveryUniqueItemsNumber;
|
|
374
|
+
});
|
|
463
375
|
},
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
.flatMap(entries => entries);
|
|
376
|
+
checkProductArrays: checkProductArrays,
|
|
377
|
+
getCartEntries: function(data) {
|
|
378
|
+
Wick.BasketPage.cartEntries = getCartEntries(data);
|
|
468
379
|
},
|
|
469
380
|
addCharityEntryNumber: function (data) {
|
|
470
381
|
let entryNumber;
|
|
@@ -481,34 +392,17 @@ Wick.BasketPage = {
|
|
|
481
392
|
)
|
|
482
393
|
}
|
|
483
394
|
},
|
|
484
|
-
updatePromotion: function
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
395
|
+
updatePromotion: function(data, context) {
|
|
396
|
+
updatePromotion(
|
|
397
|
+
data,
|
|
398
|
+
Wick.BasketPage.el.orderItem,
|
|
399
|
+
Wick.BasketPage.el.orderItemOffers,
|
|
400
|
+
Wick.BasketPage.el.orderItemInfo,
|
|
401
|
+
Wick.BasketPage.addPromotions
|
|
402
|
+
);
|
|
490
403
|
},
|
|
491
|
-
showNotification: function
|
|
492
|
-
|
|
493
|
-
switch (data.statusMessage) {
|
|
494
|
-
case 'accConfirmedMsgs':
|
|
495
|
-
notificationType = 'success'
|
|
496
|
-
break;
|
|
497
|
-
case 'accWarnMsgs':
|
|
498
|
-
notificationType = 'warning'
|
|
499
|
-
break;
|
|
500
|
-
case 'accErrorMsgs':
|
|
501
|
-
notificationType = 'error'
|
|
502
|
-
break;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
Wick.Notification.show({
|
|
506
|
-
text: data.message,
|
|
507
|
-
container: '.notification-area',
|
|
508
|
-
type: notificationType,
|
|
509
|
-
closeBtn: true
|
|
510
|
-
});
|
|
511
|
-
|
|
404
|
+
showNotification: function(data) {
|
|
405
|
+
showNotification(data, '.notification-area');
|
|
512
406
|
},
|
|
513
407
|
hideUnusedDeliveryTypeCost: function (data, isVoucher) {
|
|
514
408
|
$(Wick.BasketPage.el.delivery).show()
|
|
@@ -8,8 +8,6 @@ Wick.CheckoutPaymentDetails = (function() {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const elements = {
|
|
11
|
-
$billieRepaymentTerms: $('.js-billie-repayment-terms'),
|
|
12
|
-
$billieInfoBlock: $('.checkout-payment-details__billie'),
|
|
13
11
|
$wrapperPaymentInput: $('.checkout-payment-details__row'),
|
|
14
12
|
paymentInputName: '[name=payment-method]',
|
|
15
13
|
$cardDetails: $('.checkout-payment-details__card-details'),
|
|
@@ -17,81 +15,45 @@ Wick.CheckoutPaymentDetails = (function() {
|
|
|
17
15
|
$billingAddress: $('.billing-address'),
|
|
18
16
|
hiddenCardDetailsClass: 'checkout-payment-details__card-details_hidden',
|
|
19
17
|
hiddenClass: 'd-none',
|
|
20
|
-
}
|
|
18
|
+
}
|
|
21
19
|
|
|
22
20
|
function preparePage() {
|
|
23
|
-
var modalOpened = $(
|
|
21
|
+
var modalOpened = $(".modal.show").length;
|
|
24
22
|
if (!modalOpened) {
|
|
25
23
|
return;
|
|
26
24
|
}
|
|
27
25
|
var modalContent = $modal.find('.modal-content').clone();
|
|
28
|
-
$modal.modal(
|
|
29
|
-
modalContent.addClass(
|
|
30
|
-
$(
|
|
31
|
-
.addClass(
|
|
26
|
+
$modal.modal("hide");
|
|
27
|
+
modalContent.addClass("print-area");
|
|
28
|
+
$("body")
|
|
29
|
+
.addClass("print-mode")
|
|
32
30
|
.append(modalContent);
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
function resetPage() {
|
|
36
|
-
var modalPrintModeActive = $(
|
|
34
|
+
var modalPrintModeActive = $("body.print-mode").length;
|
|
37
35
|
if (!modalPrintModeActive) {
|
|
38
36
|
return;
|
|
39
37
|
}
|
|
40
|
-
$(
|
|
41
|
-
$(
|
|
42
|
-
$modal.modal(
|
|
38
|
+
$("body").removeClass("print-mode");
|
|
39
|
+
$(".print-area").remove();
|
|
40
|
+
$modal.modal("show");
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
function getPaymentMethods() {
|
|
46
44
|
return $(elements.paymentInputName)
|
|
47
45
|
.map((_, item) => $(item).val())
|
|
48
|
-
.get()
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function setBillieStepVisibility(isReady) {
|
|
52
|
-
setBillingDetailsRowVisibility(isReady);
|
|
53
|
-
|
|
54
|
-
elements.$billieInfoBlock.toggle(isReady);
|
|
46
|
+
.get()
|
|
55
47
|
}
|
|
56
48
|
|
|
57
49
|
function togglePaymentBlocks(paymentMethods, checkedMethod) {
|
|
58
50
|
paymentMethods.forEach(method => {
|
|
59
|
-
$(`[data-${method}]`).toggle(checkedMethod === method)
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function setBillingDetailsRowVisibility(isVisible) {
|
|
64
|
-
const $row = elements.$billingAddress.find('.checkout-payment-details__row');
|
|
65
|
-
|
|
66
|
-
$row.toggle(isVisible);
|
|
67
|
-
|
|
68
|
-
$row.find(':input').prop('disabled', !isVisible);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
function resetBillieRepaymentSelection() {
|
|
73
|
-
elements.$billieRepaymentTerms.find('input[name="repaymentTerms"]').prop('checked', false);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function bindBillieRepaymentGate() {
|
|
77
|
-
$(document).on('change', 'input[name="repaymentTerms"]', function() {
|
|
78
|
-
const currentMethod = $(elements.paymentInputName + ':checked').val();
|
|
79
|
-
if (currentMethod !== 'billie') return;
|
|
80
|
-
|
|
81
|
-
const hasSelection = $('input[name="repaymentTerms"]:checked').length > 0;
|
|
82
|
-
setBillingDetailsRowVisibility(hasSelection);
|
|
83
|
-
|
|
84
|
-
const $row = $(this).closest('.form-row[data-row-required]');
|
|
85
|
-
$row.removeClass('form-row_validation-error').find('.form-row__error').remove();
|
|
86
|
-
});
|
|
51
|
+
$(`[data-${method}]`).toggle(checkedMethod === method)
|
|
52
|
+
})
|
|
87
53
|
}
|
|
88
54
|
|
|
89
55
|
function changeDetailsBlock(checkedMethod) {
|
|
90
|
-
|
|
91
|
-
setBillingDetailsRowVisibility(true);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
switch (checkedMethod) {
|
|
56
|
+
switch(checkedMethod) {
|
|
95
57
|
case 'paypal':
|
|
96
58
|
hideCardDetails();
|
|
97
59
|
showPlaceOrder();
|
|
@@ -104,48 +66,42 @@ Wick.CheckoutPaymentDetails = (function() {
|
|
|
104
66
|
detailsLabel = {
|
|
105
67
|
...detailsLabel,
|
|
106
68
|
labelText: 'Name on Billie account',
|
|
107
|
-
buttonText: 'Pay with Billie'
|
|
108
|
-
}
|
|
69
|
+
buttonText: 'Pay with Billie'
|
|
70
|
+
}
|
|
109
71
|
changeLabelText(detailsLabel);
|
|
110
|
-
|
|
111
|
-
setBillieStepVisibility(false);
|
|
112
|
-
|
|
113
|
-
resetBillieRepaymentSelection();
|
|
114
72
|
break;
|
|
115
|
-
|
|
116
|
-
|
|
117
73
|
case 'clearpay':
|
|
118
74
|
detailsLabel = {
|
|
119
75
|
...detailsLabel,
|
|
120
76
|
labelText: 'Name on Clearpay account',
|
|
121
|
-
buttonText: 'Pay with Clearpay'
|
|
122
|
-
}
|
|
77
|
+
buttonText: 'Pay with Clearpay'
|
|
78
|
+
}
|
|
123
79
|
prevClearableMethod === 'card' && clearInputFields();
|
|
124
80
|
changeLabelText(detailsLabel);
|
|
125
81
|
prevClearableMethod = checkedMethod;
|
|
126
82
|
break;
|
|
127
83
|
case 'apple':
|
|
128
|
-
hideCardDetails()
|
|
129
|
-
hidePlaceOrder()
|
|
130
|
-
hideBillingAddres()
|
|
84
|
+
hideCardDetails()
|
|
85
|
+
hidePlaceOrder()
|
|
86
|
+
hideBillingAddres()
|
|
131
87
|
break;
|
|
132
88
|
case 'google':
|
|
133
|
-
hideCardDetails()
|
|
134
|
-
hidePlaceOrder()
|
|
135
|
-
hideBillingAddres()
|
|
89
|
+
hideCardDetails()
|
|
90
|
+
hidePlaceOrder()
|
|
91
|
+
hideBillingAddres()
|
|
136
92
|
break;
|
|
137
93
|
case 'card':
|
|
138
94
|
detailsLabel = {
|
|
139
95
|
...detailsLabel,
|
|
140
96
|
labelText: 'Name on card',
|
|
141
|
-
buttonText: 'Enter card details'
|
|
142
|
-
}
|
|
97
|
+
buttonText: 'Enter card details'
|
|
98
|
+
}
|
|
143
99
|
prevClearableMethod === 'clearpay' && clearInputFields();
|
|
144
100
|
changeLabelText(detailsLabel);
|
|
145
101
|
prevClearableMethod = checkedMethod;
|
|
146
102
|
break;
|
|
147
103
|
default:
|
|
148
|
-
showPlaceOrder()
|
|
104
|
+
showPlaceOrder()
|
|
149
105
|
}
|
|
150
106
|
}
|
|
151
107
|
|
|
@@ -161,7 +117,7 @@ Wick.CheckoutPaymentDetails = (function() {
|
|
|
161
117
|
const { inputName, labelText, buttonName, buttonText } = params;
|
|
162
118
|
elements.$billingAddress.removeClass(elements.hiddenClass);
|
|
163
119
|
let labelElement = elements.$billingAddress.find('[for="' + inputName + '"]');
|
|
164
|
-
let buttonElement = elements.$billingAddress.find(
|
|
120
|
+
let buttonElement = elements.$billingAddress.find("." + buttonName + " .btn__text");
|
|
165
121
|
|
|
166
122
|
labelElement && labelElement.text(labelText);
|
|
167
123
|
buttonElement && buttonElement.text(buttonText);
|
|
@@ -182,27 +138,11 @@ Wick.CheckoutPaymentDetails = (function() {
|
|
|
182
138
|
function init() {
|
|
183
139
|
const paymentMethods = getPaymentMethods();
|
|
184
140
|
|
|
185
|
-
$(document).on('change', 'input[name="repaymentTerms"]', function() {
|
|
186
|
-
const currentMethod = $(elements.paymentInputName + ':checked').val();
|
|
187
|
-
if (currentMethod !== 'billie') return;
|
|
188
|
-
|
|
189
|
-
const hasSelection = $('input[name="repaymentTerms"]:checked').length > 0;
|
|
190
|
-
|
|
191
|
-
setBillieStepVisibility(hasSelection);
|
|
192
|
-
|
|
193
|
-
const $row = $(this).closest('.form-row[data-row-required]');
|
|
194
|
-
$row.removeClass('form-row_validation-error')
|
|
195
|
-
.find('.form-row__error').remove();
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
|
|
199
141
|
elements.$wrapperPaymentInput.on('change', elements.paymentInputName, function() {
|
|
200
|
-
const form = $(this).closest('form')[0];
|
|
201
|
-
form && Wick.Forms.clearValidationErrors(form);
|
|
202
|
-
|
|
203
142
|
const checkedMethod = $(this).val();
|
|
204
|
-
|
|
205
|
-
|
|
143
|
+
|
|
144
|
+
togglePaymentBlocks(paymentMethods, checkedMethod)
|
|
145
|
+
changeDetailsBlock(checkedMethod)
|
|
206
146
|
});
|
|
207
147
|
|
|
208
148
|
$('.btn-new-card').on('click', function() {
|
|
@@ -217,20 +157,27 @@ Wick.CheckoutPaymentDetails = (function() {
|
|
|
217
157
|
return false;
|
|
218
158
|
});
|
|
219
159
|
|
|
220
|
-
if
|
|
160
|
+
// do not subscribe if no T&C modal on a current page
|
|
161
|
+
if (!$modal.length) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
221
164
|
|
|
222
|
-
if (typeof
|
|
165
|
+
if (typeof(window.onbeforeprint) !== 'undefined') {
|
|
166
|
+
// subscriptions for browsers
|
|
223
167
|
window.onbeforeprint = preparePage;
|
|
224
168
|
window.onafterprint = resetPage;
|
|
225
169
|
} else if (window.matchMedia) {
|
|
170
|
+
// subscriptions for iOS devices
|
|
226
171
|
var mediaQueryList = window.matchMedia('print');
|
|
227
172
|
mediaQueryList.addListener(function(mql) {
|
|
228
|
-
if (mql.matches)
|
|
229
|
-
|
|
173
|
+
if (mql.matches) {
|
|
174
|
+
preparePage();
|
|
175
|
+
} else {
|
|
176
|
+
resetPage();
|
|
177
|
+
}
|
|
230
178
|
});
|
|
231
179
|
}
|
|
232
180
|
}
|
|
233
181
|
|
|
234
|
-
|
|
235
182
|
init();
|
|
236
183
|
})();
|