wickes-css2 2.112.0-develop.6 → 2.112.0-develop.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +1 -1
- package/build/css/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/js/bloomreach-widget.min.js +1 -1
- package/build/js/emulation.min.js +334 -8
- package/build/js/page/bloomreach-widget/bloomreach-widget.js +250 -0
- package/build/js/page/{bloomreach-widget.js → bloomreach-widget/complete-your-project-widget.js} +205 -359
- package/build/js/page/bloomreach-widget/why-not-add-widget.js +198 -0
- package/package.json +1 -5
- package/src/components/bloomreach/complete-card.hbs +4 -32
- package/src/components/bloomreach/why-not-add-card-skeleton.hbs +14 -0
- package/src/components/bloomreach/why-not-add-card.hbs +73 -0
- package/src/components/bloomreach/why-not-add-content.hbs +41 -0
- package/src/components/bloomreach/why-not-add-skeleton.hbs +9 -0
- package/src/components/bloomreach/why-not-add.hbs +6 -0
- package/src/components/pdp-price-actions.hbs +2 -2
- package/src/components/price-block-v2.hbs +2 -0
- package/src/components/reviews-rating.hbs +22 -0
- package/src/components/share-list-modal-without-social-icons.hbs +1 -1
- package/src/components/share-list-modal.hbs +1 -1
- package/src/js/emulation/bloomreach-widget-loading.js +2 -2
- package/src/js/emulation/mock.js +309 -0
- package/src/js/emulation/why-not-add-loading.js +11 -0
- package/src/js/emulation/why-not-add.js +28 -0
- package/src/js/page/bloomreach-widget/bloomreach-widget.js +250 -0
- package/src/js/page/{bloomreach-widget.js → bloomreach-widget/complete-your-project-widget.js} +205 -359
- package/src/js/page/bloomreach-widget/why-not-add-widget.js +198 -0
- package/src/page_product-details-bloomreach.html +1 -1
- package/src/page_product-details-with-global-search-v2.html +2 -1
- package/src/page_product-details-with-why-not-add-single.html +131 -0
- package/src/scss/components/bloomreach/_bloomreach.scss +3 -0
- package/src/scss/components/bloomreach/_complete-card.scss +0 -38
- package/src/scss/components/bloomreach/_reviews.scss +60 -0
- package/src/scss/components/bloomreach/_why-not-add-card.scss +223 -0
- package/src/scss/components/bloomreach/_why-not-add.scss +143 -0
- package/src/sitemap.html +10 -4
|
@@ -5309,9 +5309,9 @@ var Wick = window.Wick || {};
|
|
|
5309
5309
|
$(document).ready(function () {
|
|
5310
5310
|
window.setTimeout(function () {
|
|
5311
5311
|
var $container = $('[data-complete-widget]');
|
|
5312
|
-
var contextKey = $container.data('
|
|
5312
|
+
var contextKey = $container.data('mock-key');
|
|
5313
5313
|
var payloadData = Wick.FEMock.dataBloomreach[contextKey];
|
|
5314
|
-
Wick.BloomreachWidget.init(payloadData);
|
|
5314
|
+
Wick.BloomreachWidget.init('completeYourProject', payloadData);
|
|
5315
5315
|
}, 3000);
|
|
5316
5316
|
});
|
|
5317
5317
|
|
|
@@ -6072,7 +6072,7 @@ function waitFor(getter, cb, opts) {
|
|
|
6072
6072
|
});
|
|
6073
6073
|
})();
|
|
6074
6074
|
|
|
6075
|
-
},{"../page/utils/show-more-less":
|
|
6075
|
+
},{"../page/utils/show-more-less":99}],52:[function(require,module,exports){
|
|
6076
6076
|
"use strict";
|
|
6077
6077
|
|
|
6078
6078
|
var Wick = Wick || {};
|
|
@@ -13244,6 +13244,294 @@ Wick.FEMock = {
|
|
|
13244
13244
|
}));
|
|
13245
13245
|
},
|
|
13246
13246
|
dataBloomreach: {
|
|
13247
|
+
whyNotAddRecommendationsSingle: {
|
|
13248
|
+
recommendedProducts: [{
|
|
13249
|
+
baseProduct: {
|
|
13250
|
+
code: '153731',
|
|
13251
|
+
name: 'Wickes Trade Paint Roller Set - 9in',
|
|
13252
|
+
url: '/Wickes-Trade-Paint-Roller-Set---9in/p/153731',
|
|
13253
|
+
purchasable: true,
|
|
13254
|
+
productType: 'ProductModel',
|
|
13255
|
+
isBaseProduct: false,
|
|
13256
|
+
availabilityRestriction: 'NO_RESTRICTIONS',
|
|
13257
|
+
fulfilmentType: 'STANDARD',
|
|
13258
|
+
stock: {
|
|
13259
|
+
stockLevelStatus: {
|
|
13260
|
+
code: 'inStock'
|
|
13261
|
+
}
|
|
13262
|
+
},
|
|
13263
|
+
fulfillmentAttributes: {
|
|
13264
|
+
type: 'STANDARD'
|
|
13265
|
+
},
|
|
13266
|
+
images: [{
|
|
13267
|
+
imageType: 'PRIMARY',
|
|
13268
|
+
format: 'product',
|
|
13269
|
+
url: 'https://placehold.co/68x68?text=roller',
|
|
13270
|
+
altText: 'Wickes Trade Paint Roller Set - 9in'
|
|
13271
|
+
}],
|
|
13272
|
+
externalAverageRating: 5,
|
|
13273
|
+
externalReviewCount: 100,
|
|
13274
|
+
displayPrice: {
|
|
13275
|
+
currencyIso: 'GBP',
|
|
13276
|
+
value: 9999,
|
|
13277
|
+
priceType: 'BUY',
|
|
13278
|
+
formattedValue: '£9,999.00',
|
|
13279
|
+
formattedPriceWithoutCurrencySymbol: '16',
|
|
13280
|
+
currencySymbol: '£',
|
|
13281
|
+
vatRatePercentage: 20,
|
|
13282
|
+
valueInPence: 999900,
|
|
13283
|
+
wasPrice: 30
|
|
13284
|
+
},
|
|
13285
|
+
displayPriceExclusiveVat: {
|
|
13286
|
+
currencyIso: 'GBP',
|
|
13287
|
+
value: 9998,
|
|
13288
|
+
priceType: 'BUY',
|
|
13289
|
+
formattedValue: '£9,998.00',
|
|
13290
|
+
formattedPriceWithoutCurrencySymbol: '13.33',
|
|
13291
|
+
currencySymbol: '£',
|
|
13292
|
+
valueInPence: 999800,
|
|
13293
|
+
wasPrice: 25
|
|
13294
|
+
}
|
|
13295
|
+
}
|
|
13296
|
+
}]
|
|
13297
|
+
},
|
|
13298
|
+
whyNotAddRecommendations: {
|
|
13299
|
+
recommendedProducts: [{
|
|
13300
|
+
baseProduct: {
|
|
13301
|
+
code: '153731',
|
|
13302
|
+
name: 'Wickes Trade Paint Roller Set - 9in',
|
|
13303
|
+
url: '/Wickes-Trade-Paint-Roller-Set---9in/p/153731',
|
|
13304
|
+
purchasable: true,
|
|
13305
|
+
productType: 'ProductModel',
|
|
13306
|
+
isBaseProduct: false,
|
|
13307
|
+
availabilityRestriction: 'NO_RESTRICTIONS',
|
|
13308
|
+
fulfilmentType: 'STANDARD',
|
|
13309
|
+
stock: {
|
|
13310
|
+
stockLevelStatus: {
|
|
13311
|
+
code: 'inStock'
|
|
13312
|
+
}
|
|
13313
|
+
},
|
|
13314
|
+
fulfillmentAttributes: {
|
|
13315
|
+
type: 'STANDARD'
|
|
13316
|
+
},
|
|
13317
|
+
images: [{
|
|
13318
|
+
imageType: 'PRIMARY',
|
|
13319
|
+
format: 'product',
|
|
13320
|
+
url: 'https://placehold.co/68x68?text=roller',
|
|
13321
|
+
altText: 'Wickes Trade Paint Roller Set - 9in'
|
|
13322
|
+
}],
|
|
13323
|
+
externalAverageRating: 5,
|
|
13324
|
+
externalReviewCount: 100,
|
|
13325
|
+
displayPrice: {
|
|
13326
|
+
currencyIso: 'GBP',
|
|
13327
|
+
value: 9999,
|
|
13328
|
+
priceType: 'BUY',
|
|
13329
|
+
formattedValue: '£9,999.00',
|
|
13330
|
+
formattedPriceWithoutCurrencySymbol: '16',
|
|
13331
|
+
currencySymbol: '£',
|
|
13332
|
+
vatRatePercentage: 20,
|
|
13333
|
+
valueInPence: 999900,
|
|
13334
|
+
wasPrice: 3000
|
|
13335
|
+
},
|
|
13336
|
+
displayPriceExclusiveVat: {
|
|
13337
|
+
currencyIso: 'GBP',
|
|
13338
|
+
value: 9998,
|
|
13339
|
+
priceType: 'BUY',
|
|
13340
|
+
formattedValue: '£9,998.00',
|
|
13341
|
+
formattedPriceWithoutCurrencySymbol: '13.33',
|
|
13342
|
+
currencySymbol: '£',
|
|
13343
|
+
valueInPence: 999800,
|
|
13344
|
+
wasPrice: 2500
|
|
13345
|
+
}
|
|
13346
|
+
}
|
|
13347
|
+
}, {
|
|
13348
|
+
baseProduct: {
|
|
13349
|
+
code: '349137',
|
|
13350
|
+
name: 'Wickes Microfibre Paint Roller Sleeve - 9in',
|
|
13351
|
+
url: '/Wickes-Microfibre-Paint-Roller-Sleeve---9in/p/349137',
|
|
13352
|
+
purchasable: true,
|
|
13353
|
+
productType: 'ProductModel',
|
|
13354
|
+
isBaseProduct: false,
|
|
13355
|
+
availabilityRestriction: 'NO_RESTRICTIONS',
|
|
13356
|
+
fulfilmentType: 'STANDARD',
|
|
13357
|
+
stock: {
|
|
13358
|
+
stockLevelStatus: {
|
|
13359
|
+
code: 'inStock'
|
|
13360
|
+
}
|
|
13361
|
+
},
|
|
13362
|
+
fulfillmentAttributes: {
|
|
13363
|
+
type: 'STANDARD'
|
|
13364
|
+
},
|
|
13365
|
+
images: [{
|
|
13366
|
+
imageType: 'PRIMARY',
|
|
13367
|
+
format: 'product',
|
|
13368
|
+
url: 'https://placehold.co/68x68?text=sleeve',
|
|
13369
|
+
altText: 'Wickes Microfibre Paint Roller Sleeve - 9in'
|
|
13370
|
+
}],
|
|
13371
|
+
externalAverageRating: 4.2,
|
|
13372
|
+
externalReviewCount: 48,
|
|
13373
|
+
displayPrice: {
|
|
13374
|
+
currencyIso: 'GBP',
|
|
13375
|
+
value: 9999,
|
|
13376
|
+
priceType: 'BUY',
|
|
13377
|
+
formattedValue: '£7.5220',
|
|
13378
|
+
formattedPriceWithoutCurrencySymbol: '7.50',
|
|
13379
|
+
currencySymbol: '£',
|
|
13380
|
+
vatRatePercentage: 20,
|
|
13381
|
+
valueInPence: 999900
|
|
13382
|
+
},
|
|
13383
|
+
displayPriceExclusiveVat: {
|
|
13384
|
+
currencyIso: 'GBP',
|
|
13385
|
+
value: 9998,
|
|
13386
|
+
priceType: 'BUY',
|
|
13387
|
+
formattedValue: '£6.25',
|
|
13388
|
+
formattedPriceWithoutCurrencySymbol: '6.25',
|
|
13389
|
+
currencySymbol: '£',
|
|
13390
|
+
valueInPence: 999800
|
|
13391
|
+
}
|
|
13392
|
+
}
|
|
13393
|
+
}, {
|
|
13394
|
+
baseProduct: {
|
|
13395
|
+
code: '221048',
|
|
13396
|
+
name: 'Wickes Paint Tray - 9in',
|
|
13397
|
+
url: '/Wickes-Paint-Tray---9in/p/221048',
|
|
13398
|
+
purchasable: true,
|
|
13399
|
+
productType: 'ProductModel',
|
|
13400
|
+
isBaseProduct: false,
|
|
13401
|
+
availabilityRestriction: 'NO_RESTRICTIONS',
|
|
13402
|
+
fulfilmentType: 'STANDARD',
|
|
13403
|
+
stock: {
|
|
13404
|
+
stockLevelStatus: {
|
|
13405
|
+
code: 'inStock'
|
|
13406
|
+
}
|
|
13407
|
+
},
|
|
13408
|
+
fulfillmentAttributes: {
|
|
13409
|
+
type: 'STANDARD'
|
|
13410
|
+
},
|
|
13411
|
+
images: [{
|
|
13412
|
+
imageType: 'PRIMARY',
|
|
13413
|
+
format: 'product',
|
|
13414
|
+
url: 'https://placehold.co/68x68?text=tray',
|
|
13415
|
+
altText: 'Wickes Paint Tray - 9in'
|
|
13416
|
+
}],
|
|
13417
|
+
externalAverageRating: 3.8,
|
|
13418
|
+
externalReviewCount: 19,
|
|
13419
|
+
displayPrice: {
|
|
13420
|
+
currencyIso: 'GBP',
|
|
13421
|
+
value: 4,
|
|
13422
|
+
priceType: 'BUY',
|
|
13423
|
+
formattedValue: '£4',
|
|
13424
|
+
formattedPriceWithoutCurrencySymbol: '4',
|
|
13425
|
+
currencySymbol: '£',
|
|
13426
|
+
vatRatePercentage: 20,
|
|
13427
|
+
valueInPence: 400
|
|
13428
|
+
},
|
|
13429
|
+
displayPriceExclusiveVat: {
|
|
13430
|
+
currencyIso: 'GBP',
|
|
13431
|
+
value: 3.33,
|
|
13432
|
+
priceType: 'BUY',
|
|
13433
|
+
formattedValue: '£3.33',
|
|
13434
|
+
formattedPriceWithoutCurrencySymbol: '3.33',
|
|
13435
|
+
currencySymbol: '£',
|
|
13436
|
+
valueInPence: 333
|
|
13437
|
+
}
|
|
13438
|
+
}
|
|
13439
|
+
}, {
|
|
13440
|
+
baseProduct: {
|
|
13441
|
+
code: '654221',
|
|
13442
|
+
name: 'Wickes Professional Masking Tape - 48mm x 50m',
|
|
13443
|
+
url: '/Wickes-Professional-Masking-Tape---48mm-x-50m/p/654221',
|
|
13444
|
+
purchasable: true,
|
|
13445
|
+
productType: 'ProductModel',
|
|
13446
|
+
isBaseProduct: false,
|
|
13447
|
+
availabilityRestriction: 'NO_RESTRICTIONS',
|
|
13448
|
+
fulfilmentType: 'STANDARD',
|
|
13449
|
+
stock: {
|
|
13450
|
+
stockLevelStatus: {
|
|
13451
|
+
code: 'inStock'
|
|
13452
|
+
}
|
|
13453
|
+
},
|
|
13454
|
+
fulfillmentAttributes: {
|
|
13455
|
+
type: 'STANDARD'
|
|
13456
|
+
},
|
|
13457
|
+
images: [{
|
|
13458
|
+
imageType: 'PRIMARY',
|
|
13459
|
+
format: 'product',
|
|
13460
|
+
url: 'https://placehold.co/68x68?text=tape',
|
|
13461
|
+
altText: 'Wickes Professional Masking Tape - 48mm x 50m'
|
|
13462
|
+
}],
|
|
13463
|
+
externalAverageRating: 4.6,
|
|
13464
|
+
externalReviewCount: 72,
|
|
13465
|
+
displayPrice: {
|
|
13466
|
+
currencyIso: 'GBP',
|
|
13467
|
+
value: 5.5,
|
|
13468
|
+
priceType: 'BUY',
|
|
13469
|
+
formattedValue: '£5.50',
|
|
13470
|
+
formattedPriceWithoutCurrencySymbol: '5.50',
|
|
13471
|
+
currencySymbol: '£',
|
|
13472
|
+
vatRatePercentage: 20,
|
|
13473
|
+
valueInPence: 550
|
|
13474
|
+
},
|
|
13475
|
+
displayPriceExclusiveVat: {
|
|
13476
|
+
currencyIso: 'GBP',
|
|
13477
|
+
value: 4.58,
|
|
13478
|
+
priceType: 'BUY',
|
|
13479
|
+
formattedValue: '£4.58',
|
|
13480
|
+
formattedPriceWithoutCurrencySymbol: '4.58',
|
|
13481
|
+
currencySymbol: '£',
|
|
13482
|
+
valueInPence: 458
|
|
13483
|
+
}
|
|
13484
|
+
}
|
|
13485
|
+
}, {
|
|
13486
|
+
baseProduct: {
|
|
13487
|
+
code: '782913',
|
|
13488
|
+
name: 'Wickes Dust Sheet Cotton Twill - 3.6m x 2.7m Extra Long Product Name For Two Line Truncation Test',
|
|
13489
|
+
url: '/Wickes-Dust-Sheet-Cotton-Twill---3-6m-x-2-7m/p/782913',
|
|
13490
|
+
purchasable: true,
|
|
13491
|
+
productType: 'ProductModel',
|
|
13492
|
+
isBaseProduct: false,
|
|
13493
|
+
availabilityRestriction: 'NO_RESTRICTIONS',
|
|
13494
|
+
fulfilmentType: 'STANDARD',
|
|
13495
|
+
stock: {
|
|
13496
|
+
stockLevelStatus: {
|
|
13497
|
+
code: 'inStock'
|
|
13498
|
+
}
|
|
13499
|
+
},
|
|
13500
|
+
fulfillmentAttributes: {
|
|
13501
|
+
type: 'STANDARD'
|
|
13502
|
+
},
|
|
13503
|
+
images: [{
|
|
13504
|
+
imageType: 'PRIMARY',
|
|
13505
|
+
format: 'product',
|
|
13506
|
+
url: 'https://placehold.co/68x68?text=sheet',
|
|
13507
|
+
altText: 'Wickes Dust Sheet Cotton Twill - 3.6m x 2.7m'
|
|
13508
|
+
}],
|
|
13509
|
+
externalAverageRating: 4.1,
|
|
13510
|
+
externalReviewCount: 34,
|
|
13511
|
+
displayPrice: {
|
|
13512
|
+
currencyIso: 'GBP',
|
|
13513
|
+
value: 12,
|
|
13514
|
+
priceType: 'BUY',
|
|
13515
|
+
formattedValue: '£12',
|
|
13516
|
+
formattedPriceWithoutCurrencySymbol: '12',
|
|
13517
|
+
currencySymbol: '£',
|
|
13518
|
+
vatRatePercentage: 20,
|
|
13519
|
+
valueInPence: 1200,
|
|
13520
|
+
wasPrice: 18
|
|
13521
|
+
},
|
|
13522
|
+
displayPriceExclusiveVat: {
|
|
13523
|
+
currencyIso: 'GBP',
|
|
13524
|
+
value: 10,
|
|
13525
|
+
priceType: 'BUY',
|
|
13526
|
+
formattedValue: '£10',
|
|
13527
|
+
formattedPriceWithoutCurrencySymbol: '10',
|
|
13528
|
+
currencySymbol: '£',
|
|
13529
|
+
valueInPence: 1000,
|
|
13530
|
+
wasPrice: 15
|
|
13531
|
+
}
|
|
13532
|
+
}
|
|
13533
|
+
}]
|
|
13534
|
+
},
|
|
13247
13535
|
completeYourProject3Recomendations: [{
|
|
13248
13536
|
baseProduct: {
|
|
13249
13537
|
code: '191018',
|
|
@@ -17273,7 +17561,7 @@ $(document).ready(function () {
|
|
|
17273
17561
|
initStoreLocatorLoadMore();
|
|
17274
17562
|
});
|
|
17275
17563
|
|
|
17276
|
-
},{"../page/utils/loader":
|
|
17564
|
+
},{"../page/utils/loader":98}],88:[function(require,module,exports){
|
|
17277
17565
|
"use strict";
|
|
17278
17566
|
|
|
17279
17567
|
var Wick = window.Wick || {};
|
|
@@ -17423,6 +17711,44 @@ window.ACC.app.isVatToggleAvailable = !!$('.switch-vat input').length;
|
|
|
17423
17711
|
},{}],94:[function(require,module,exports){
|
|
17424
17712
|
"use strict";
|
|
17425
17713
|
|
|
17714
|
+
var Wick = window.Wick || {};
|
|
17715
|
+
$(document).ready(function () {
|
|
17716
|
+
window.setTimeout(function () {
|
|
17717
|
+
var $container = $('[data-why-not-add-widget]');
|
|
17718
|
+
var mockDataKey = $container.data('mock-key');
|
|
17719
|
+
var payloadData = Wick.FEMock.dataBloomreach[mockDataKey];
|
|
17720
|
+
Wick.BloomreachWidget.init('whyNotAdd', payloadData);
|
|
17721
|
+
}, 3000);
|
|
17722
|
+
});
|
|
17723
|
+
|
|
17724
|
+
},{}],95:[function(require,module,exports){
|
|
17725
|
+
"use strict";
|
|
17726
|
+
|
|
17727
|
+
var Wick = window.Wick || {};
|
|
17728
|
+
function simulateHybrisSendingHtml() {
|
|
17729
|
+
var htmlFromHybris = Wick.FEMock.cartPDP;
|
|
17730
|
+
window.dispatchEvent(new CustomEvent('productAddedToCart', {
|
|
17731
|
+
detail: {
|
|
17732
|
+
html: htmlFromHybris
|
|
17733
|
+
}
|
|
17734
|
+
}));
|
|
17735
|
+
}
|
|
17736
|
+
function bindWhyNotAddToCartEvent() {
|
|
17737
|
+
$(window).off('addToCart.whyNotAddEmulation').on('addToCart.whyNotAddEmulation', function (_ref) {
|
|
17738
|
+
var resolve = _ref.detail.resolve;
|
|
17739
|
+
setTimeout(function () {
|
|
17740
|
+
resolve();
|
|
17741
|
+
simulateHybrisSendingHtml();
|
|
17742
|
+
}, 3000);
|
|
17743
|
+
});
|
|
17744
|
+
}
|
|
17745
|
+
$(document).ready(function () {
|
|
17746
|
+
bindWhyNotAddToCartEvent();
|
|
17747
|
+
});
|
|
17748
|
+
|
|
17749
|
+
},{}],96:[function(require,module,exports){
|
|
17750
|
+
"use strict";
|
|
17751
|
+
|
|
17426
17752
|
var Wick = window.Wick = window.Wick || {};
|
|
17427
17753
|
Wick.Wismo = function () {
|
|
17428
17754
|
Wick.SnackBar.init();
|
|
@@ -17452,7 +17778,7 @@ Wick.Wismo = function () {
|
|
|
17452
17778
|
});
|
|
17453
17779
|
}();
|
|
17454
17780
|
|
|
17455
|
-
},{}],
|
|
17781
|
+
},{}],97:[function(require,module,exports){
|
|
17456
17782
|
"use strict";
|
|
17457
17783
|
|
|
17458
17784
|
var Wick = Wick || {};
|
|
@@ -17531,7 +17857,7 @@ Wick.YourDetails = function () {
|
|
|
17531
17857
|
});
|
|
17532
17858
|
}();
|
|
17533
17859
|
|
|
17534
|
-
},{}],
|
|
17860
|
+
},{}],98:[function(require,module,exports){
|
|
17535
17861
|
"use strict";
|
|
17536
17862
|
|
|
17537
17863
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -17557,7 +17883,7 @@ function hideLoader(loaderSelector) {
|
|
|
17557
17883
|
$(defineLoaderWrapper(loaderSelector)).addClass(HIDDEN_CLASS_NAME);
|
|
17558
17884
|
}
|
|
17559
17885
|
|
|
17560
|
-
},{"../../../elements/loader.hbs":25}],
|
|
17886
|
+
},{"../../../elements/loader.hbs":25}],99:[function(require,module,exports){
|
|
17561
17887
|
"use strict";
|
|
17562
17888
|
|
|
17563
17889
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -17794,4 +18120,4 @@ function createShowMoreLess() {
|
|
|
17794
18120
|
};
|
|
17795
18121
|
}
|
|
17796
18122
|
|
|
17797
|
-
},{"../../../elements/btn.hbs":24}]},{},[26,27,28,29,30,31,32,33,34,35,36,37,38,39,44,40,41,42,43,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95]);
|
|
18123
|
+
},{"../../../elements/btn.hbs":24}]},{},[26,27,28,29,30,31,32,33,34,35,36,37,38,39,44,40,41,42,43,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97]);
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
var Wick = window.Wick || {};
|
|
2
|
+
|
|
3
|
+
import { isApp } from '../utils/helpers';
|
|
4
|
+
import { createEvent } from '../utils/create-event';
|
|
5
|
+
import CompleteYourProjectWidget from './complete-your-project-widget';
|
|
6
|
+
import WhyNotAddWidget from './why-not-add-widget';
|
|
7
|
+
|
|
8
|
+
Wick.BloomreachWidget = {
|
|
9
|
+
widgets: {},
|
|
10
|
+
|
|
11
|
+
el: {
|
|
12
|
+
loadingButtonText: '.loading-button__text',
|
|
13
|
+
loadingButtonLoader: '.loading-button__loader',
|
|
14
|
+
ratingOverlay: '.rating-overlay',
|
|
15
|
+
starOverlay: '.star-overlay',
|
|
16
|
+
vatInc: '.including-vat-inherit',
|
|
17
|
+
vatExc: '.excluding-vat-inherit',
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
registerWidgets(widgetList) {
|
|
21
|
+
widgetList.forEach(function ({ type, widget }) {
|
|
22
|
+
Wick.BloomreachWidget.widgets[type] = widget;
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
getWidget(type) {
|
|
27
|
+
return Wick.BloomreachWidget.widgets[type];
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
init(type, payloadData) {
|
|
31
|
+
const widget = Wick.BloomreachWidget.getWidget(type);
|
|
32
|
+
|
|
33
|
+
if (!widget || typeof widget.init !== 'function') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
widget.init(payloadData, Wick.BloomreachWidget);
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
normalizePayload(payloadData) {
|
|
41
|
+
if (Array.isArray(payloadData)) {
|
|
42
|
+
return payloadData;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (payloadData && Array.isArray(payloadData.recommendedProducts)) {
|
|
46
|
+
return payloadData.recommendedProducts;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return [];
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
hasRecommendations(payloadData) {
|
|
53
|
+
return Wick.BloomreachWidget.normalizePayload(payloadData).length > 0;
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
getDisplayPrice(product) {
|
|
57
|
+
return product.displayPrice || product.price || {};
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
getDisplayPriceExcVat(product) {
|
|
61
|
+
return product.displayPriceExclusiveVat || product.priceExclusiveVat || null;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
getPriceValue(price) {
|
|
65
|
+
return price && typeof price.value === 'number' ? price.value : 0;
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
getPriceFormattedValue(price) {
|
|
69
|
+
if (!price) {
|
|
70
|
+
return '';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (price.formattedValue) {
|
|
74
|
+
return price.formattedValue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (typeof price.value === 'number') {
|
|
78
|
+
return Wick.BloomreachWidget.formatPrice(price.value);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return '';
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
removeBlankTargets($root) {
|
|
85
|
+
if (!isApp()) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
$root.find('a[target="_blank"]').removeAttr('target');
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
getWasPrice(product) {
|
|
93
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
94
|
+
|
|
95
|
+
return displayPrice && displayPrice.wasPrice ? displayPrice.wasPrice : null;
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
getWasPriceFormatted(product) {
|
|
99
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
100
|
+
const wasPrice = Wick.BloomreachWidget.getWasPrice(product);
|
|
101
|
+
|
|
102
|
+
if (wasPrice && wasPrice.formattedValue) {
|
|
103
|
+
return wasPrice.formattedValue;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (typeof wasPrice === 'number') {
|
|
107
|
+
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (wasPrice) {
|
|
111
|
+
return `${displayPrice.currencySymbol || '£'}${wasPrice}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return '';
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
getExcVatWasPrice(product) {
|
|
118
|
+
const priceExclusiveVat = product.priceExclusiveVat || null;
|
|
119
|
+
const displayPriceExclusiveVat = product.displayPriceExclusiveVat || null;
|
|
120
|
+
const wasPrice =
|
|
121
|
+
(displayPriceExclusiveVat && displayPriceExclusiveVat.wasPrice) ||
|
|
122
|
+
(priceExclusiveVat && priceExclusiveVat.wasPrice);
|
|
123
|
+
|
|
124
|
+
if (wasPrice && wasPrice.formattedValue) {
|
|
125
|
+
return wasPrice.formattedValue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (typeof wasPrice === 'number') {
|
|
129
|
+
return Wick.BloomreachWidget.formatPrice(wasPrice);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return wasPrice || '';
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
getProductImage(product, fallbackProduct) {
|
|
136
|
+
const productImages = product.images || [];
|
|
137
|
+
const fallbackImages = fallbackProduct ? fallbackProduct.images || [] : [];
|
|
138
|
+
const images = productImages.length ? productImages : fallbackImages;
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
images.find(function (item) {
|
|
142
|
+
return item.format === 'product';
|
|
143
|
+
}) ||
|
|
144
|
+
images.find(function (item) {
|
|
145
|
+
return item.imageType === 'PRIMARY';
|
|
146
|
+
}) ||
|
|
147
|
+
images[0] ||
|
|
148
|
+
{}
|
|
149
|
+
);
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
getProductRenderData(product, options = {}) {
|
|
153
|
+
const displayPrice = Wick.BloomreachWidget.getDisplayPrice(product);
|
|
154
|
+
const displayPriceExcVat = Wick.BloomreachWidget.getDisplayPriceExcVat(product);
|
|
155
|
+
const wasPriceFormatted = Wick.BloomreachWidget.getWasPriceFormatted(product);
|
|
156
|
+
const excVatWasPriceFormatted = Wick.BloomreachWidget.getExcVatWasPrice(product);
|
|
157
|
+
const isSwitchVat = !!(window.ACC && window.ACC.app && window.ACC.app.isVatToggleAvailable);
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
...product,
|
|
161
|
+
price: displayPrice,
|
|
162
|
+
image:
|
|
163
|
+
options.image ||
|
|
164
|
+
Wick.BloomreachWidget.getProductImage(product, options.fallbackProduct),
|
|
165
|
+
wasPriceFormatted,
|
|
166
|
+
'switch-vat': isSwitchVat,
|
|
167
|
+
incVatFormattedValue: Wick.BloomreachWidget.getPriceFormattedValue(displayPrice),
|
|
168
|
+
incVatValue: Wick.BloomreachWidget.getPriceValue(displayPrice),
|
|
169
|
+
excVatFormattedValue: Wick.BloomreachWidget.getPriceFormattedValue(displayPriceExcVat),
|
|
170
|
+
excVatValue: Wick.BloomreachWidget.getPriceValue(displayPriceExcVat),
|
|
171
|
+
incVatWasPriceFormatted: wasPriceFormatted,
|
|
172
|
+
excVatWasPriceFormatted: Wick.BloomreachWidget.getExcVatWasPrice(product),
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
drawRating($root) {
|
|
177
|
+
const { ratingOverlay, starOverlay } = Wick.BloomreachWidget.el;
|
|
178
|
+
|
|
179
|
+
$root.find(ratingOverlay).each(function () {
|
|
180
|
+
let rating = parseFloat($(this).attr('data-rating')) || 0;
|
|
181
|
+
const $stars = $(this).children(starOverlay);
|
|
182
|
+
|
|
183
|
+
$stars.each(function () {
|
|
184
|
+
const $star = $(this);
|
|
185
|
+
|
|
186
|
+
if (rating >= 1) {
|
|
187
|
+
rating--;
|
|
188
|
+
} else if (rating > 0) {
|
|
189
|
+
const width = Math.asin(2 * rating - 1) / Math.PI + 0.5;
|
|
190
|
+
$star.css('width', width + 'rem');
|
|
191
|
+
rating = 0;
|
|
192
|
+
} else {
|
|
193
|
+
$star.css('width', '0rem');
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
dispatchWidgetEvent(eventName, payload) {
|
|
200
|
+
return new Promise(function (resolve, reject) {
|
|
201
|
+
const eventDetail = { resolve, reject };
|
|
202
|
+
const event = createEvent(eventName, payload, eventDetail);
|
|
203
|
+
|
|
204
|
+
window.dispatchEvent(event);
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
reapplyVatDisplay() {
|
|
209
|
+
if (!Wick.VatToggle || typeof Wick.VatToggle.isActive !== 'function') {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const { vatInc, vatExc } = Wick.BloomreachWidget.el;
|
|
214
|
+
const hiddenClassName = Wick.VatToggle.HIDDEN_CLASS_NAME || 'd-none';
|
|
215
|
+
const isExcVatActive = Wick.VatToggle.isActive();
|
|
216
|
+
|
|
217
|
+
$(vatInc).toggleClass(hiddenClassName, isExcVatActive);
|
|
218
|
+
$(vatExc).toggleClass(hiddenClassName, !isExcVatActive);
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
bindVatToggle(namespace) {
|
|
222
|
+
if (!Wick.VatToggle || !Wick.VatToggle.TOGGLE_VAT_EVENT_NAME) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const eventName = `${Wick.VatToggle.TOGGLE_VAT_EVENT_NAME}.${namespace}`;
|
|
227
|
+
|
|
228
|
+
$(window).off(eventName).on(eventName, Wick.BloomreachWidget.reapplyVatDisplay);
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
formatPrice(value) {
|
|
232
|
+
return new Intl.NumberFormat('en-GB', {
|
|
233
|
+
style: 'currency',
|
|
234
|
+
currency: 'GBP',
|
|
235
|
+
minimumFractionDigits: 2,
|
|
236
|
+
maximumFractionDigits: 2,
|
|
237
|
+
}).format(value);
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
Wick.BloomreachWidget.registerWidgets([
|
|
242
|
+
{
|
|
243
|
+
type: 'completeYourProject',
|
|
244
|
+
widget: CompleteYourProjectWidget,
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
type: 'whyNotAdd',
|
|
248
|
+
widget: WhyNotAddWidget,
|
|
249
|
+
},
|
|
250
|
+
]);
|