wickes-css2 2.98.0-develop.3 → 2.98.0-develop.5
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/category-main.css +1 -1
- package/build/css/components/energy-efficiency.css +1 -1
- package/build/css/components/legal-info.css +1 -1
- package/build/css/homepage-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_quiz.css +1 -1
- package/build/css/pdp-main-before-combine.css +1 -1
- package/build/css/pdp-main-critical.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 +1 -1
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +1 -1
- package/build/js/emulation.min.js +106 -32
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/merged-checkout.min.js +1 -1
- package/build/js/page/pdp.js +4 -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 +1 -1
- package/src/components/checkout_order-summary-new.hbs +18 -13
- package/src/components/header-minicart.hbs +3 -3
- package/src/components/legal-info.hbs +22 -25
- package/src/components/mini-basket/mini-basket-empty.hbs +17 -0
- package/src/components/mini-basket/mini-basket.hbs +39 -0
- package/src/components/mini-basket/product-item.hbs +22 -0
- package/src/components/pdp-price-actions.hbs +1 -1
- package/src/components/price-block-v2.hbs +0 -1
- package/src/data/data_confirmation-summary.json +3 -3
- package/src/data/data_latest-offers.json +1 -1
- package/src/data/data_mini-basket.json +80 -6
- package/src/data/data_page-category.json +2 -1
- package/src/data/data_page-merge-basket.json +1 -1
- package/src/data/data_store-locator-v2.json +1 -1
- package/src/js/components/general/backdrop.js +23 -0
- package/src/js/components/general/cart-slider.js +16 -0
- package/src/js/components/general/create-popup-slider.js +196 -0
- package/src/js/components/general/mini-basket-slider.js +8 -0
- package/src/js/emulation/big-wins.js +29 -29
- package/src/js/emulation/custom-slider-emulation.js +28 -0
- package/src/js/emulation/mock.js +46 -1
- package/src/js/emulation/popover-mini-basket.js +2 -2
- package/src/js/page/pdp.js +4 -1
- package/src/layouts/base.hbs +6 -0
- package/src/layouts/my-account-v2.hbs +7 -0
- package/src/page_product-details-saved-pl.html +16 -13
- package/src/page_product-details-with-global-search-v2.html +1 -0
- package/src/scss/common/_scroll-disable.scss +4 -2
- package/src/scss/components/_custom-slider.scss +512 -0
- package/src/scss/components/legal-info.scss +61 -0
- package/src/scss/globals/_global-components.scss +1 -0
- package/src/scss/helpers/_mixins.scss +8 -0
- package/src/scss/helpers/_variables.scss +1 -0
- package/src/scss/homepage-main.scss +1 -0
- package/src/scss/main.scss +1 -0
- package/src/scss/partials/_header-critical.scss +14 -0
- package/src/scss/partials/_header.scss +14 -0
package/package.json
CHANGED
|
@@ -18,21 +18,26 @@
|
|
|
18
18
|
</li>
|
|
19
19
|
{{/each}}
|
|
20
20
|
{{/if}}
|
|
21
|
-
{{
|
|
21
|
+
{{#unless hideApplyVoucher}}
|
|
22
|
+
{{> checkout-voucher-accordion id=id}}
|
|
23
|
+
{{/unless}}
|
|
22
24
|
{{#if discounts}}
|
|
23
25
|
<li class="checkout-widget__accordion-wrap checkout-widget__details-discount">
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
<span
|
|
27
|
+
class="checkout-widget__detail-name checkout-widget__detail-name_accordion collapsed"
|
|
28
|
+
data-toggle="collapse"
|
|
29
|
+
data-target="#acheckout-widget-accordion-{{id}}">
|
|
30
|
+
Discount(s):
|
|
31
|
+
<span class="icon accordion__header-icon-small">
|
|
32
|
+
<i class="fas fa-angle-up"></i>
|
|
33
|
+
</span>
|
|
34
|
+
</span>
|
|
35
|
+
<ul class="checkout-widget__details-hidden collapse" id="acheckout-widget-accordion-{{id}}">
|
|
36
|
+
{{#each discounts}}
|
|
37
|
+
{{> cart-voucher}}
|
|
38
|
+
{{/each}}
|
|
39
|
+
</ul>
|
|
40
|
+
<span class="checkout-widget__detail-value">£0.00</span>
|
|
36
41
|
</li>
|
|
37
42
|
{{/if}}
|
|
38
43
|
</ul>
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
</span>
|
|
7
7
|
<span class="header-right__link-title">Basket</span>
|
|
8
8
|
</span>
|
|
9
|
-
<
|
|
9
|
+
<button type="button" class="header-right__link header-minicart__btn header-minicart__btn_link" style="display: none;">
|
|
10
10
|
<span class="btn__text">
|
|
11
11
|
<i class="fas fa-shopping-basket fa-2x"></i>
|
|
12
12
|
</span>
|
|
13
13
|
<span class="header-right__link-title">Basket</span>
|
|
14
|
-
</
|
|
14
|
+
</button>
|
|
15
15
|
</div>
|
|
16
16
|
<span class="header-minicart__counter">0</span>
|
|
17
|
-
</div>
|
|
17
|
+
</div>
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
21
|
-
pariatur.
|
|
22
|
-
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
|
|
23
|
-
laborum.
|
|
24
|
-
</p>
|
|
1
|
+
<div class="container">
|
|
2
|
+
<div class="row">
|
|
3
|
+
<div class="col-12">
|
|
4
|
+
<div class="legal-info">
|
|
5
|
+
<h3 class="legal-info__toggle" data-toggle="collapse" data-target="#collapseInfo" aria-expanded="false" aria-controls="collapseInfo">
|
|
6
|
+
{{#if customTitle}}
|
|
7
|
+
{{customTitle}}
|
|
8
|
+
{{else}}
|
|
9
|
+
Frequently Asked Questions
|
|
10
|
+
{{/if}}
|
|
11
|
+
<span class="icon-wrap"></span>
|
|
12
|
+
</h3>
|
|
13
|
+
|
|
14
|
+
<div class="collapse" id="collapseInfo">
|
|
15
|
+
<div class="collapse-wrap">
|
|
16
|
+
<div class="container">
|
|
17
|
+
{{{page_category-landing.legal-info}}}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
25
20
|
</div>
|
|
21
|
+
</div>
|
|
26
22
|
</div>
|
|
27
|
-
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div class="custom-slider mini-basket d-none">
|
|
2
|
+
<div class="custom-slider__wrap">
|
|
3
|
+
<div class="custom-slider__header">
|
|
4
|
+
<span class="custom-slider__count">Your basket (0)</span>
|
|
5
|
+
<a href="#" type="button" class="icon-wrap close-popup">
|
|
6
|
+
<i class="far fa-times icon"></i>
|
|
7
|
+
</a>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="custom-slider__empty">
|
|
10
|
+
<span class="icon-wrap icon-wrap--xl">
|
|
11
|
+
<i class="fas fa-shopping-basket"></i>
|
|
12
|
+
</span>
|
|
13
|
+
<p class="text">Your basket is currently empty.</p>
|
|
14
|
+
<button class="btn btn-primary close-popup">Continue Shopping</button>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<div class="custom-slider mini-basket d-none">
|
|
2
|
+
<div class="custom-slider__wrap custom-slider__wrap--scroll">
|
|
3
|
+
<div class="custom-slider__header">
|
|
4
|
+
<span class="custom-slider__count">Your basket (1)</span>
|
|
5
|
+
<button type="button" class="icon-wrap close-popup">
|
|
6
|
+
<i class="far fa-times icon"></i>
|
|
7
|
+
</button>
|
|
8
|
+
</div>
|
|
9
|
+
<ul class="products">
|
|
10
|
+
{{#each mini-basket.products}}
|
|
11
|
+
{{> mini-basket/product-item this switch-vat=true}}
|
|
12
|
+
{{/each}}
|
|
13
|
+
</ul>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="custom-slider__footer footer-fixed">
|
|
16
|
+
<div class="mini-basket__total">
|
|
17
|
+
<button class="btn mini-basket__total-toggle" type="button" data-toggle="collapse" data-target="#checkout-details-accordion-3" aria-expanded="false" aria-controls="checkout-details-accordion-3">
|
|
18
|
+
<span class="mini-basket__wrap-total">
|
|
19
|
+
<span class="icon-wrap">
|
|
20
|
+
<i class="fas fa-chevron-down arrow-icon"></i>
|
|
21
|
+
</span>
|
|
22
|
+
<span class="text">Total:</span>
|
|
23
|
+
</span>
|
|
24
|
+
<span class="value">{{mini-basket.total.totalPrice.formattedValue}}</span>
|
|
25
|
+
</button>
|
|
26
|
+
|
|
27
|
+
{{> checkout_order-summary-new confirmationSummary=true head=true mod=true id=3 mobile=true hideApplyVoucher=true}}
|
|
28
|
+
</div>
|
|
29
|
+
<div class="custom-slider__ctas">
|
|
30
|
+
<a href="page_shopping-cart.html" class="btn btn_full btn-secondary">View Basket</a>
|
|
31
|
+
<button class="btn btn-action btn_full btn-checkout">
|
|
32
|
+
Checkout
|
|
33
|
+
<span class="icon-wrap ml-2">
|
|
34
|
+
<i class="fas fa-arrow-right"></i>
|
|
35
|
+
</span>
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<li class="products__item">
|
|
2
|
+
<a class="products__image" href="page_product-details-with-global-search-v2.html">
|
|
3
|
+
<img class="product-img" src="{{src}}" alt="">
|
|
4
|
+
</a>
|
|
5
|
+
<div class="products__details">
|
|
6
|
+
<a href="#" class="title">{{title}}</a>
|
|
7
|
+
<p class="item">Click & Collect: <span class="value">{{CC}}</span></p>
|
|
8
|
+
<p class="item">Qty: <span class="value">{{quantity.value}}</span></p>
|
|
9
|
+
{{#if switch-vat}}
|
|
10
|
+
<p class="price including-vat-inherit">
|
|
11
|
+
{{incVatPrice}}
|
|
12
|
+
<span class="inc">Inc.VAT</span>
|
|
13
|
+
</p>
|
|
14
|
+
<p class="price excluding-vat-inherit">
|
|
15
|
+
{{excVatPrice}}
|
|
16
|
+
<span class="inc">Exc.VAT</span>
|
|
17
|
+
</p>
|
|
18
|
+
{{else}}
|
|
19
|
+
<p class="price">{{price}}</p>
|
|
20
|
+
{{/if}}
|
|
21
|
+
</div>
|
|
22
|
+
</li>
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"confirmation-summary": {
|
|
3
3
|
"info": [
|
|
4
4
|
{
|
|
5
|
-
"title": "Items
|
|
5
|
+
"title": "Items subtotal:",
|
|
6
6
|
"value": "£44.44",
|
|
7
7
|
"mod": "bold"
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
|
-
"title": "
|
|
10
|
+
"title": "VAT:",
|
|
11
11
|
"value": "£71.66",
|
|
12
12
|
"mod": "vat"
|
|
13
13
|
},
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"mod": "delivery"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"title": "
|
|
24
|
+
"title": "Charity donation:",
|
|
25
25
|
"value": "£1.00"
|
|
26
26
|
}
|
|
27
27
|
],
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"price": "£2,009.00",
|
|
12
12
|
"incVatPrice": "£30.00",
|
|
13
13
|
"excVatPrice": "£10.00",
|
|
14
|
-
"lower-quantity": true
|
|
14
|
+
"lower-quantity": true,
|
|
15
|
+
"CC": "East Grinstead"
|
|
15
16
|
},
|
|
16
17
|
{
|
|
17
18
|
"quantity": {
|
|
@@ -31,9 +32,77 @@
|
|
|
31
32
|
"title": "Rangemaster Classic Deluxe 90 Ceramic Range Cooker - Black with Chrome Trim",
|
|
32
33
|
"src": "img/placeholders/[e-img-4to3].jpg",
|
|
33
34
|
"price": "£2,009.00",
|
|
34
|
-
"incVatPrice": "£
|
|
35
|
-
"excVatPrice": "£
|
|
36
|
-
"
|
|
35
|
+
"incVatPrice": "£309.00",
|
|
36
|
+
"excVatPrice": "£109.00",
|
|
37
|
+
"bad-amount": true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"quantity": {
|
|
41
|
+
"value": "1"
|
|
42
|
+
},
|
|
43
|
+
"title": "Rangemaster Classic Deluxe 90 Ceramic Range Cooker - Black with Chrome Trim",
|
|
44
|
+
"src": "img/placeholders/tap.jpg",
|
|
45
|
+
"price": "£2,009.00",
|
|
46
|
+
"incVatPrice": "£30.00",
|
|
47
|
+
"excVatPrice": "£10.00",
|
|
48
|
+
"lower-quantity": true,
|
|
49
|
+
"CC": "East Grinstead"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"quantity": {
|
|
53
|
+
"value": "1"
|
|
54
|
+
},
|
|
55
|
+
"title": "Rangemaster Classic Deluxe 90 Ceramic Range Cooker - Black with Chrome Trim",
|
|
56
|
+
"src": "img/placeholders/[e-img-4to3].jpg",
|
|
57
|
+
"price": "£2,009.00",
|
|
58
|
+
"incVatPrice": "£309.00",
|
|
59
|
+
"excVatPrice": "£109.00",
|
|
60
|
+
"bad-amount": true
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"quantity": {
|
|
64
|
+
"value": "1"
|
|
65
|
+
},
|
|
66
|
+
"title": "Rangemaster Classic Deluxe 90 Ceramic Range Cooker - Black with Chrome Trim",
|
|
67
|
+
"src": "img/placeholders/[e-img-4to3].jpg",
|
|
68
|
+
"price": "£2,009.00",
|
|
69
|
+
"incVatPrice": "£309.00",
|
|
70
|
+
"excVatPrice": "£109.00",
|
|
71
|
+
"bad-amount": true
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"quantity": {
|
|
75
|
+
"value": "1"
|
|
76
|
+
},
|
|
77
|
+
"title": "Rangemaster Classic Deluxe 90 Ceramic Range Cooker - Black with Chrome Trim",
|
|
78
|
+
"src": "img/placeholders/tap.jpg",
|
|
79
|
+
"price": "£2,009.00",
|
|
80
|
+
"incVatPrice": "£30.00",
|
|
81
|
+
"excVatPrice": "£10.00",
|
|
82
|
+
"lower-quantity": true,
|
|
83
|
+
"CC": "East Grinstead"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"quantity": {
|
|
87
|
+
"value": "1"
|
|
88
|
+
},
|
|
89
|
+
"title": "Rangemaster Classic Deluxe 90 Ceramic Range Cooker - Black with Chrome Trim",
|
|
90
|
+
"src": "img/placeholders/[e-img-4to3].jpg",
|
|
91
|
+
"price": "£2,009.00",
|
|
92
|
+
"incVatPrice": "£309.00",
|
|
93
|
+
"excVatPrice": "£109.00",
|
|
94
|
+
"bad-amount": true
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"quantity": {
|
|
98
|
+
"value": "1"
|
|
99
|
+
},
|
|
100
|
+
"title": "Rangemaster Classic Deluxe 90 Ceramic Range Cooker - Black with Chrome Trim",
|
|
101
|
+
"src": "img/placeholders/[e-img-4to3].jpg",
|
|
102
|
+
"price": "£2,009.00",
|
|
103
|
+
"incVatPrice": "£309.00",
|
|
104
|
+
"excVatPrice": "£109.00",
|
|
105
|
+
"bad-amount": true
|
|
37
106
|
}
|
|
38
107
|
],
|
|
39
108
|
"just-added": [
|
|
@@ -48,6 +117,11 @@
|
|
|
48
117
|
"excVatPrice": "£1,009.00",
|
|
49
118
|
"basket-product": true
|
|
50
119
|
}
|
|
51
|
-
]
|
|
120
|
+
],
|
|
121
|
+
"total": {
|
|
122
|
+
"totalPrice": {
|
|
123
|
+
"formattedValue": "£17.50"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
52
126
|
}
|
|
53
|
-
}
|
|
127
|
+
}
|
|
@@ -217,6 +217,7 @@
|
|
|
217
217
|
}
|
|
218
218
|
]
|
|
219
219
|
}
|
|
220
|
-
]
|
|
220
|
+
],
|
|
221
|
+
"legal-info": "<p>Our selection of toilets is crafted to suit a wide range of <a href=\"https://www.wickes.co.uk/bathroom/suites\">bathroom suites</a>, from compact cloakrooms to spacious bathrooms. With our large selection, you’ll easily find a solution for both modern and traditional spaces. Each toilet is built for efficiency and easy maintenance, helping you achieve a stylish, functional bathroom with a range of finishes and shapes.</p>\n<h3>FAQs</h3>\n<h4>What are the different types of toilets?</h4>\n<p>Different toilet types include close-coupled, back-to-wall, rimless, wall-hung, and <a href=\"https://www.wickes.co.uk/Products/Bathrooms/Toilets+Accessories/Low+High-Level-Toilets/c/1000359\">high and low-level toilets</a>. Each has unique installation and style benefits, suitable for various bathroom sizes and styles.</p>\n<h4>What toilets suit a modern bathroom?</h4>\n<p>Rimless, wall-hung and <a href=\"https://www.wickes.co.uk/Products/Bathrooms/Toilets+Accessories/Back-to-Wall-Toilets/c/1000282\">back-to-wall toilets</a> fit well in modern bathrooms. Their sleek designs and efficient features offer a clean, contemporary look.</p>\n<h4>What toilets look best in a traditional bathroom?</h4>\n<p>High-level and low-level toilets are popular in traditional designs, adding elegance and classic style with vintage-inspired cisterns and details.</p>"
|
|
221
222
|
}
|
|
222
223
|
}
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"energyEfficiency": {
|
|
111
111
|
"type": "Old",
|
|
112
112
|
"rating": "C",
|
|
113
|
-
"linkProduct": "https://media.wickes.co.uk/image/upload/v1676542815/documents/wickes/Product-Info-Example_qj5mln.pdf"
|
|
113
|
+
"linkProduct": "https://media.wickes.co.uk/image/upload/v1676542815/documents/wickes/Product-Info-Example_qj5mln.pdf"
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
{
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"telephone": "01872 6511 101",
|
|
9
9
|
"fax": "01872 6511 101",
|
|
10
10
|
"sat-nav": "X11 1TT",
|
|
11
|
-
"store-info": "Maecenas nisl leo, consectetur a lacus eu, lacinia tincidunt elit. Suspendisse bibendum molestie lectus sit amet vehicula. Vestibulum in nisi at felis finibus maximus. Fusce placerat viverra semper. Sed in nulla quis neque commodo faucibus a ut eros."
|
|
11
|
+
"store-info": "Maecenas nisl leo, consectetur a lacus eu, lacinia tincidunt elit. Suspendisse bibendum molestie lectus sit amet vehicula. Vestibulum in nisi at felis finibus maximus. Fusce placerat viverra semper. Sed in nulla quis neque commodo faucibus a ut eros."
|
|
12
12
|
},
|
|
13
13
|
"accordion-data": [
|
|
14
14
|
{
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
|
|
3
|
+
Wick.Backdrop = (function () {
|
|
4
|
+
const el = {
|
|
5
|
+
modalBackdrop: 'modal-backdrop',
|
|
6
|
+
modalBackdropShow: 'show'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function show() {
|
|
10
|
+
if (!$(`.${el.modalBackdrop}`).length) {
|
|
11
|
+
$('body').append(`<div class="${el.modalBackdrop} ${el.modalBackdropShow}"></div>`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function hide() {
|
|
16
|
+
$('body').find(`.${el.modalBackdrop}.${el.modalBackdropShow}`).remove();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
show,
|
|
21
|
+
hide,
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const cartSliderHTML = '<div class="custom-slider just-added d-none"></div>';
|
|
2
|
+
|
|
3
|
+
createPopupSlider({
|
|
4
|
+
type: 'cart',
|
|
5
|
+
sliderSelector: '.custom-slider.just-added',
|
|
6
|
+
onAppendEvent: 'productAddedToCart',
|
|
7
|
+
onAppend: function (event, { showSlider, handleScroll, el }) {
|
|
8
|
+
if (!$('.custom-slider.just-added').length) {
|
|
9
|
+
$('body').append(cartSliderHTML);
|
|
10
|
+
}
|
|
11
|
+
const htmlContent = event.detail.html;
|
|
12
|
+
$(el.slider).append(htmlContent);
|
|
13
|
+
showSlider();
|
|
14
|
+
$(el.sliderWrap).on('scroll', _.debounce(() => handleScroll(el.sliderWrap), 100));
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
function createEvent(eventName, payload, eventDetail) {
|
|
2
|
+
return new CustomEvent(eventName, {
|
|
3
|
+
detail: {
|
|
4
|
+
payload,
|
|
5
|
+
resolve: eventDetail.resolve,
|
|
6
|
+
reject: eventDetail.reject,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function createPopupSlider({ type, sliderSelector, onAppendEvent, onAppend }) {
|
|
12
|
+
const events = {
|
|
13
|
+
CLOSE_JUST_ADDED: 'CLOSE_JUST_ADDED',
|
|
14
|
+
CLOSE_MINI_BASKET: 'CLOSE_MINI_BASKET'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const el = {
|
|
18
|
+
$body: $('body'),
|
|
19
|
+
slider: sliderSelector,
|
|
20
|
+
sliderWrap: `${sliderSelector} .custom-slider__wrap`,
|
|
21
|
+
sliderWrapScroll: 'custom-slider__wrap--scroll',
|
|
22
|
+
footer: '.custom-slider__footer',
|
|
23
|
+
closePopup: `${sliderSelector} .close-popup`,
|
|
24
|
+
$stickyWrapper: $('.sticky-wrapper'),
|
|
25
|
+
$headerWrapper: $('.header-wrapper'),
|
|
26
|
+
scrollDisable: 'slider-scroll-disable',
|
|
27
|
+
footerFixed: 'footer-fixed',
|
|
28
|
+
btnMiniBasket: '.header-minicart__btn',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function isSmallBreakpoint() {
|
|
32
|
+
return Wick.Responsive.getCurrentBreakpoint() === 'down-sm';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getAnimationClass() {
|
|
36
|
+
return isSmallBreakpoint() ? 'bottom-to-top' : 'right-to-left';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function adjustHeight() {
|
|
40
|
+
const stickyWrapperHeight = el.$stickyWrapper.outerHeight() || 0;
|
|
41
|
+
const headerWrapperHeight = el.$headerWrapper.outerHeight() || 0;
|
|
42
|
+
|
|
43
|
+
const totalHeight = stickyWrapperHeight + headerWrapperHeight;
|
|
44
|
+
$(el.slider).css('height', `calc(100% - ${totalHeight}px)`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function hideSlider() {
|
|
48
|
+
$(el.slider).removeClass('show');
|
|
49
|
+
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
el.$body.removeClass(el.scrollDisable);
|
|
52
|
+
|
|
53
|
+
if (!isSmallBreakpoint()) {
|
|
54
|
+
el.$body.css('padding-right', '');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (type === 'cart') {
|
|
58
|
+
$(el.slider)
|
|
59
|
+
.removeAttr('style')
|
|
60
|
+
.empty();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
$(el.slider).addClass('d-none');
|
|
64
|
+
}, 400);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function handleScroll(sliderWrap) {
|
|
68
|
+
const scrollHeight = $(sliderWrap)[0].scrollHeight;
|
|
69
|
+
const scrollTop = $(sliderWrap).scrollTop();
|
|
70
|
+
const clientHeight = $(sliderWrap)[0].clientHeight;
|
|
71
|
+
const scrollBottom = scrollHeight - scrollTop - clientHeight;
|
|
72
|
+
|
|
73
|
+
if (scrollBottom > 75) {
|
|
74
|
+
$(el.footer).addClass(el.footerFixed);
|
|
75
|
+
$(sliderWrap).addClass(el.sliderWrapScroll);
|
|
76
|
+
} else {
|
|
77
|
+
$(el.footer).removeClass(el.footerFixed);
|
|
78
|
+
$(sliderWrap).removeClass(el.sliderWrapScroll);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function showSlider() {
|
|
83
|
+
if (isSmallBreakpoint()) {
|
|
84
|
+
adjustHeight();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const animationClass = getAnimationClass();
|
|
88
|
+
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
89
|
+
$(el.slider)
|
|
90
|
+
.removeClass('bottom-to-top right-to-left')
|
|
91
|
+
.addClass(animationClass);
|
|
92
|
+
|
|
93
|
+
$('html, body').animate({ scrollTop: 0 }, 300, () => {
|
|
94
|
+
Wick.Backdrop.show();
|
|
95
|
+
$(el.slider).removeClass('d-none');
|
|
96
|
+
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
$(el.slider).addClass('show');
|
|
99
|
+
handleScroll(el.sliderWrap);
|
|
100
|
+
el.$body.addClass(el.scrollDisable);
|
|
101
|
+
|
|
102
|
+
if (!isSmallBreakpoint()) {
|
|
103
|
+
el.$body.css('padding-right', `${scrollBarWidth}px`);
|
|
104
|
+
}
|
|
105
|
+
}, 100);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function handleSliderClose(eventName) {
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
const eventDetail = {resolve, reject};
|
|
112
|
+
const event = createEvent(eventName, {}, eventDetail);
|
|
113
|
+
window.dispatchEvent(event);
|
|
114
|
+
})
|
|
115
|
+
.then(() => {})
|
|
116
|
+
.catch((error) => {
|
|
117
|
+
console.error(error);
|
|
118
|
+
})
|
|
119
|
+
.finally(() => {
|
|
120
|
+
hideSlider();
|
|
121
|
+
Wick.Backdrop.hide();
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function bindClosePopup() {
|
|
126
|
+
$(document).on('click', el.closePopup, async () => {
|
|
127
|
+
if (type === 'cart') {
|
|
128
|
+
await handleSliderClose(events.CLOSE_JUST_ADDED);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (type === 'miniBasket') {
|
|
132
|
+
await handleSliderClose(events.CLOSE_MINI_BASKET)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
hideSlider();
|
|
136
|
+
Wick.Backdrop.hide();
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function handleResize() {
|
|
141
|
+
const animationClass = getAnimationClass();
|
|
142
|
+
|
|
143
|
+
if ($(el.slider).hasClass('show')) {
|
|
144
|
+
$(el.slider)
|
|
145
|
+
.removeClass('bottom-to-top right-to-left')
|
|
146
|
+
.addClass(animationClass);
|
|
147
|
+
|
|
148
|
+
if (isSmallBreakpoint()) {
|
|
149
|
+
adjustHeight();
|
|
150
|
+
} else {
|
|
151
|
+
$(el.slider).css('height', '');
|
|
152
|
+
Wick.Backdrop.show();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function shouldClosePopup(event) {
|
|
158
|
+
const $target = $(event.target);
|
|
159
|
+
return (
|
|
160
|
+
!$target.closest(el.slider).length &&
|
|
161
|
+
!$target.closest(el.closePopup).length &&
|
|
162
|
+
$(el.slider).hasClass('show')
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function init() {
|
|
167
|
+
bindClosePopup();
|
|
168
|
+
|
|
169
|
+
if (onAppendEvent && onAppend) {
|
|
170
|
+
document.addEventListener(onAppendEvent, (event) => {
|
|
171
|
+
onAppend(event, { showSlider, handleScroll, el });
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
$(window).on('resize', _.debounce(handleResize, 100));
|
|
176
|
+
|
|
177
|
+
$('body').on('click', async (event) => {
|
|
178
|
+
if (shouldClosePopup(event)) {
|
|
179
|
+
if (type === 'cart') {
|
|
180
|
+
await handleSliderClose(events.CLOSE_JUST_ADDED);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (type === 'miniBasket') {
|
|
184
|
+
await handleSliderClose(events.CLOSE_MINI_BASKET)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
init();
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
showSlider,
|
|
194
|
+
handleScroll,
|
|
195
|
+
};
|
|
196
|
+
}
|