wickes-css2 2.94.0-develop.5 → 2.94.0-ic-298-mega-nav.1

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.
Files changed (175) hide show
  1. package/Readme.md +1 -1
  2. package/build/css/category-main.css +1 -1
  3. package/build/css/emulation.css +1 -1
  4. package/build/css/homepage-main.css +1 -1
  5. package/build/css/main.css +1 -1
  6. package/build/css/my-account-main.css +1 -1
  7. package/build/css/pages/checkout-new.css +1 -1
  8. package/build/css/pages/checkout.css +1 -1
  9. package/build/css/pages/my-account.css +1 -1
  10. package/build/css/pages/page_checkout_delivery-new.css +1 -1
  11. package/build/css/pages/page_product-details-v2-critical.css +1 -1
  12. package/build/css/pages/page_product-details-v2.css +1 -1
  13. package/build/css/pages/page_shopping-cart-v2.css +1 -1
  14. package/build/css/pdp-main-before-combine.css +1 -1
  15. package/build/css/pdp-main-critical.css +1 -1
  16. package/build/css/pdp-main-non-critical.css +1 -1
  17. package/build/css/pdp-main.css +1 -1
  18. package/build/css/plp-main.css +1 -1
  19. package/build/css/store-locator-main.css +1 -1
  20. package/build/img/placeholders/discount-sm-15.jpg +0 -0
  21. package/build/img/placeholders/discount-sm.png +0 -0
  22. package/build/js/account-members.min.js +1 -1
  23. package/build/js/basket.min.js +1 -1
  24. package/build/js/bundle.min.js +1 -1
  25. package/build/js/checkout.min.js +1 -1
  26. package/build/js/emulation.min.js +30 -177
  27. package/build/js/general.bundle.min.js +1 -1
  28. package/build/js/merged-checkout.min.js +1 -1
  29. package/build/js/page/plp-load-more.js +0 -1
  30. package/build/js/pdp.bundle.min.js +1 -1
  31. package/build/js/plp.bundle.min.js +1 -1
  32. package/build/js/project-list.min.js +1 -1
  33. package/package.json +1 -1
  34. package/src/components/account-families/actions-bar.hbs +3 -6
  35. package/src/components/aside-nav2.hbs +1 -1
  36. package/src/components/calendar-time-table-v2.hbs +3 -0
  37. package/src/components/calendar-time-table.hbs +3 -0
  38. package/src/components/date-selection-v2.hbs +106 -0
  39. package/src/components/date-selection.hbs +59 -46
  40. package/src/components/delivery-selection.hbs +11 -0
  41. package/src/components/delivery-types-v2.hbs +17 -0
  42. package/src/components/delivery-types.hbs +38 -18
  43. package/src/components/navigation/menu-item-sub.hbs +33 -0
  44. package/src/components/navigation/menu-item-top.hbs +32 -0
  45. package/src/components/navigation/menu-item.hbs +32 -0
  46. package/src/components/navigation/nav-wrapper.hbs +12 -0
  47. package/src/components/store-details.hbs +20 -22
  48. package/src/components/store-preview.hbs +11 -0
  49. package/src/components.html +0 -1
  50. package/src/data/data_big-wins-stores.json +22 -0
  51. package/src/data/data_notification-page.json +0 -4
  52. package/src/data/navigation.json +854 -0
  53. package/src/elements/dropdown.hbs +5 -16
  54. package/src/elements/form-row.hbs +1 -1
  55. package/src/elements/input.hbs +2 -2
  56. package/src/img/placeholders/discount-sm-15.jpg +0 -0
  57. package/src/img/placeholders/discount-sm.png +0 -0
  58. package/src/js/components/date-selection.js +20 -6
  59. package/src/js/components/general/main-nav.js +23 -14
  60. package/src/js/components/general/switchVat.js +1 -27
  61. package/src/js/components/leave-event.js +5 -51
  62. package/src/js/emulation/big-wins.js +2 -0
  63. package/src/js/emulation/date-selection.js +21 -0
  64. package/src/js/emulation/forms.js +1 -1
  65. package/src/js/emulation/main-nav-local.js +6 -4
  66. package/src/js/page/plp-load-more.js +0 -1
  67. package/src/layouts/my-account.hbs +1 -1
  68. package/src/page_checkout_delivery-address.html +70 -0
  69. package/src/page_checkout_delivery-details-ASM.html +251 -0
  70. package/src/page_checkout_delivery-details-oos-partially.html +215 -0
  71. package/src/page_checkout_delivery-details-oos.html +232 -0
  72. package/src/page_checkout_delivery-details-v2-asm.html +3 -3
  73. package/src/page_checkout_delivery-details-v2-calendar-message.html +1 -1
  74. package/src/page_checkout_delivery-details-v2-oos.html +1 -1
  75. package/src/page_checkout_delivery-details-v2-wisdom-not-available.html +2 -2
  76. package/src/page_checkout_delivery-details-v2-wisdom.html +2 -2
  77. package/src/{page_checkout_rapid-delivery-details.html → page_checkout_delivery-details-v2.html} +3 -14
  78. package/src/page_checkout_delivery-details-with-loader-v2.html +1 -1
  79. package/src/page_checkout_delivery-details-with-loader.html +220 -0
  80. package/src/page_checkout_delivery-details.html +221 -0
  81. package/src/page_checkout_delivery-details_guest-new.html +1 -1
  82. package/src/page_checkout_delivery-details_guest.html +198 -0
  83. package/src/page_discount_installer.html +1 -7
  84. package/src/page_marketing-preferences.html +1 -7
  85. package/src/page_my-account.html +59 -56
  86. package/src/page_my-account_address-book.html +2 -8
  87. package/src/page_my-account_order-history.html +3 -8
  88. package/src/page_my-account_personal-details.html +1 -7
  89. package/src/page_old-navigation.html +10 -0
  90. package/src/page_tradePro_delivery-details.html +243 -0
  91. package/src/page_tradePro_discount.html +2 -8
  92. package/src/page_tradePro_rewards.html +1 -7
  93. package/src/page_wismo-order-history-loadmore.html +3 -3
  94. package/src/partials/breadcrumbs.hbs +8 -27
  95. package/src/partials/head.hbs +1 -5
  96. package/src/partials/header.hbs +49 -68
  97. package/src/partials/main-nav.hbs +15 -19
  98. package/src/scss/components/_aside-nav2.scss +0 -18
  99. package/src/scss/components/_big-wins-critical.scss +1 -0
  100. package/src/scss/components/_big-wins.scss +8 -1
  101. package/src/scss/components/_date-selection-add-new-styles.scss +19 -78
  102. package/src/scss/components/_date-selection.scss +215 -30
  103. package/src/scss/components/_order-item-cc.scss +6 -0
  104. package/src/scss/emulation.scss +24 -0
  105. package/src/scss/helpers/_variables.scss +1 -3
  106. package/src/scss/pages/_my-account_new.scss +12 -1
  107. package/src/scss/pages/checkout-new.scss +0 -51
  108. package/src/scss/pages/my-account.scss +0 -1
  109. package/src/scss/pages/page_checkout_delivery-new.scss +1 -2
  110. package/src/scss/pages/page_paint-mixing-error.scss +1 -1
  111. package/src/scss/partials/_header.scss +0 -35
  112. package/src/scss/partials/_main-nav.scss +11 -6
  113. package/src/sitemap.html +78 -47
  114. package/build/css/my-account-main-v2.css +0 -1
  115. package/build/css/pages/my-account-v2.css +0 -1
  116. package/build/css/pages/page_default-store.css +0 -1
  117. package/build/css/pages/page_personal-details.css +0 -1
  118. package/build/js/default-store.min.js +0 -1
  119. package/build/js/my-account.min.js +0 -1
  120. package/build/js/page/default-store.js +0 -44
  121. package/build/js/page/my-account.js +0 -51
  122. package/build/js/page/personal-details.js +0 -286
  123. package/build/js/personal-details.min.js +0 -1
  124. package/src/components/banner-news.hbs +0 -8
  125. package/src/components/default-store/current-store.hbs +0 -60
  126. package/src/components/default-store/list-of-store.hbs +0 -39
  127. package/src/components/default-store/store-form.hbs +0 -29
  128. package/src/components/default-store/store-unavailable.hbs +0 -4
  129. package/src/components/my-account/active-orders/consignment-info.hbs +0 -11
  130. package/src/components/my-account/active-orders/header.hbs +0 -4
  131. package/src/components/my-account/active-orders/list-orders.hbs +0 -9
  132. package/src/components/my-account/active-orders/order-details.hbs +0 -18
  133. package/src/components/my-account/active-orders/order-header.hbs +0 -7
  134. package/src/components/my-account/active-orders/order.hbs +0 -20
  135. package/src/components/my-account/active-orders/shipment-detail.hbs +0 -13
  136. package/src/components/my-account/barcode.hbs +0 -17
  137. package/src/components/my-account/clipboard-code-card.hbs +0 -16
  138. package/src/components/my-account/contact-us.hbs +0 -23
  139. package/src/components/my-account/discount.hbs +0 -11
  140. package/src/components/my-account/greetings.hbs +0 -7
  141. package/src/components/my-account/leave-modal.hbs +0 -13
  142. package/src/components/my-account/menu-items.hbs +0 -25
  143. package/src/components/my-account/mobile-nav.hbs +0 -46
  144. package/src/components/my-account/personal-details-form.hbs +0 -29
  145. package/src/components/my-account/personal-details.hbs +0 -14
  146. package/src/components/my-account/user-account-actions.hbs +0 -18
  147. package/src/components/user-information-field.hbs +0 -4
  148. package/src/data/data_calendar.json +0 -149
  149. package/src/data/my-account/data_my-account.json +0 -469
  150. package/src/data/my-account/data_personal-details.json +0 -204
  151. package/src/data/my-account/page_default-store.json +0 -158
  152. package/src/js/components/leave-event-v2.js +0 -0
  153. package/src/js/emulation/default-store.js +0 -97
  154. package/src/js/emulation/personal-details-local.js +0 -73
  155. package/src/js/page/default-store.js +0 -44
  156. package/src/js/page/my-account.js +0 -51
  157. package/src/js/page/personal-details.js +0 -286
  158. package/src/layouts/my-account-v2.hbs +0 -27
  159. package/src/page_checkout_next-day-delivery-details.html +0 -161
  160. package/src/page_default-store-page-empty.html +0 -48
  161. package/src/page_default-store-page.html +0 -55
  162. package/src/page_my-account-installer.html +0 -93
  163. package/src/page_my-account-trade-pro.html +0 -91
  164. package/src/page_personal-details-installer.html +0 -62
  165. package/src/page_personal-details.html +0 -60
  166. package/src/scss/components/my-account/_consignment-info.scss +0 -46
  167. package/src/scss/components/my-account/_contacts.scss +0 -116
  168. package/src/scss/components/my-account/_menu.scss +0 -215
  169. package/src/scss/components/my-account/_mobile-nav.scss +0 -130
  170. package/src/scss/components/my-account/_order.scss +0 -112
  171. package/src/scss/components/my-account/_shipment.scss +0 -93
  172. package/src/scss/my-account-main-v2.scss +0 -32
  173. package/src/scss/pages/my-account-v2.scss +0 -570
  174. package/src/scss/pages/page_default-store.scss +0 -634
  175. package/src/scss/pages/page_personal-details.scss +0 -281
@@ -1,158 +0,0 @@
1
- {
2
- "default-store": {
3
- "title": "Default Store",
4
- "subtitle": "Add default store",
5
- "subtitleChange": "Change default store",
6
- "searchField": {
7
- "id": "postcode",
8
- "label": "Search by postcode/town name",
9
- "placeholder": "Postcode / city",
10
- "iconSearch": "fas fa-search",
11
- "iconLocation": "fas fa-crosshairs",
12
- "iconError": "fas fa-exclamation-triangle",
13
- "iconCross": "far fa-times fa-lg",
14
- "error": "Check that you’ve entered a valid postcode or place name"
15
- },
16
- "unavailable": {
17
- "title": "You have no default store",
18
- "icon": "fas fa-warehouse"
19
- },
20
- "breadcrumbs": [
21
- {
22
- "url": "/",
23
- "text": "Home"
24
- },
25
- {
26
- "url": "/page_my-account.html",
27
- "text": "My Account"
28
- },
29
- {
30
- "url": "/page_default-store-page.html",
31
- "text": "Default Store"
32
- }
33
- ],
34
- "menu": [
35
- {
36
- "icon": "fas fa-user",
37
- "title": "My Account",
38
- "link": "./page_my-account.html"
39
- },
40
- {
41
- "icon": "fas fa-box-open",
42
- "link": "./page_my-account_order-history.html",
43
- "title": "My Orders",
44
- "description": "View and manage your orders."
45
- },
46
- {
47
- "icon": "fas fa-address-card",
48
- "link": "./page_my-account_personal-details.html",
49
- "title": "Personal Details",
50
- "description": "View and update your Personal Details."
51
- },
52
- {
53
- "icon": "fas fa-book",
54
- "link": "./page_my-account_address-book.html",
55
- "title": "Address Book",
56
- "description": "Manage your delivery addresses."
57
- },
58
- {
59
- "icon": "fas fa-sliders-h",
60
- "link": "./page_marketing-preferences.html",
61
- "title": "Marketing Preferences",
62
- "description": "Manage how you would like to receive the latest offers and deals."
63
- },
64
- {
65
- "icon": "fas fa-list",
66
- "link": "./page_my-shopping-list.html",
67
- "title": "Project Lists",
68
- "description": "Save products to your project lists."
69
- },
70
- {
71
- "icon": "fas fa-warehouse",
72
- "link": "./page_default-store-page.html",
73
- "title": "Default Store",
74
- "description": "Set your default store."
75
- }
76
- ],
77
- "currentStore": {
78
- "id": 1,
79
- "name": "Blackheath",
80
- "phone": "01869 356200",
81
- "address": "271 Winchester Road, Southampton, Hampshire, SO16 6TP",
82
- "facilities": [
83
- {
84
- "title": "Burger van",
85
- "icon": "fas fa-burger-soda"
86
- },
87
- {
88
- "title": "Kitchen & bathroom displays",
89
- "icon": "fas fa-drafting-compass"
90
- },
91
- {
92
- "title": "Installation service",
93
- "icon": "fas fa-user-hard-hat"
94
- },
95
- {
96
- "title": "Design appointments",
97
- "icon": "fas fa-user-friends"
98
- },
99
- {
100
- "title": "Paint mixing",
101
- "icon": "fas fa-paint-roller"
102
- }
103
- ],
104
- "openingTimes": [
105
- {
106
- "day": "Monday",
107
- "time": "07:00 AM - 08:00 PM"
108
- },
109
- {
110
- "day": "Tuesday",
111
- "time": "07:00 AM - 08:00 PM"
112
- },
113
- {
114
- "day": "Wednesday",
115
- "time": "07:00 AM - 08:00 PM"
116
- },
117
- {
118
- "day": "Thursday",
119
- "time": "07:00 AM - 08:00 PM"
120
- },
121
- {
122
- "day": "Friday",
123
- "time": "07:00 AM - 08:00 PM"
124
- },
125
- {
126
- "day": "Saturday",
127
- "time": "07:00 AM - 08:00 PM"
128
- },
129
- {
130
- "day": "Sunday",
131
- "time": "10:00 AM - 04:00 PM"
132
- }
133
- ],
134
- "specialOpeningTimes": [
135
- {
136
- "name": "Good Friday",
137
- "day": "Fri 10 Apr",
138
- "time": "10:00 AM - 4:00 PM"
139
- },
140
- {
141
- "name": "Saturday",
142
- "day": "Sat 11 Apr",
143
- "time": "Closed"
144
- },
145
- {
146
- "name": "Easter Sunday",
147
- "day": "Sun 12 Apr",
148
- "time": "Closed"
149
- },
150
- {
151
- "name": "Easter Monday",
152
- "day": "Mon 13 Apr",
153
- "time": "10:00 AM - 4:00 PM"
154
- }
155
- ]
156
- }
157
- }
158
- }
File without changes
@@ -1,97 +0,0 @@
1
- var Wick = Wick || {};
2
- Wick.DefaultStoreProto = {
3
- el: {
4
- searchStoreForm: '.search-store',
5
- $searchStoreWrapInput: $('.search-store__input'),
6
- searchStoreErrorClass: 'search-store__input-error',
7
- searchStoreInput: '.search-store #postcode',
8
- $searchStoreError: $('.form-row__error'),
9
- $storeUnavailableSection: $('.store-unavailable'),
10
- $listOfStoreForm: $('.list-of-store'),
11
- btnCancel: '.my-account_cancel-store',
12
- btnLocation: '.btn--location',
13
- iconLocation: '.btn--location .icon',
14
- errorIconLocation: '.btn--location .icon-error',
15
- $bigWins: $('.bw'),
16
- $bwActions: $('.bw_act'),
17
- $sDetails: $('.s-details_hide'),
18
- sDetailsHide: 's-details_hide',
19
- $storeMoreLink: $('.store__more a'),
20
- },
21
- showStoreList() {
22
- Wick.DefaultStoreProto.el.$searchStoreError.hide();
23
- Wick.DefaultStoreProto.el.$storeUnavailableSection.hide();
24
- Wick.DefaultStoreProto.el.$listOfStoreForm.show();
25
- Wick.DefaultStoreProto.el.$searchStoreWrapInput.removeClass(Wick.DefaultStoreProto.el.searchStoreErrorClass);
26
-
27
- if (Wick.DefaultStoreProto.el.$bigWins.css('display') === 'none') {
28
- Wick.DefaultStoreProto.el.$bigWins.show();
29
- }
30
-
31
- if (Wick.DefaultStoreProto.el.$bwActions.css('display') === 'none') {
32
- Wick.DefaultStoreProto.el.$bwActions.show();
33
- }
34
- },
35
- showErrorState() {
36
- Wick.DefaultStoreProto.el.$searchStoreError.show();
37
- Wick.DefaultStoreProto.el.$storeUnavailableSection.show();
38
- Wick.DefaultStoreProto.el.$listOfStoreForm.hide();
39
- Wick.DefaultStoreProto.el.$searchStoreWrapInput.addClass(Wick.DefaultStoreProto.el.searchStoreErrorClass);
40
- },
41
- showUnavailableState() {
42
- Wick.DefaultStoreProto.el.$storeUnavailableSection.show();
43
- Wick.DefaultStoreProto.el.$listOfStoreForm.hide();
44
-
45
- Wick.DefaultStoreProto.el.$sDetails.filter(function () {
46
- let isNotElementHide = !$(this).hasClass(Wick.DefaultStoreProto.el.sDetailsHide);
47
-
48
- if (isNotElementHide) {
49
- $(this)
50
- .closest(Wick.DefaultStoreProto.el.$bigWins)
51
- .find(Wick.DefaultStoreProto.el.$storeMoreLink)
52
- .text('Store Info');
53
- }
54
-
55
- return isNotElementHide;
56
- }).addClass(Wick.DefaultStoreProto.el.sDetailsHide);
57
- },
58
- clearSearchInput() {
59
- $(Wick.DefaultStoreProto.el.searchStoreInput).val('');
60
- Wick.DefaultStore.checkVisibilityOfClearButton();
61
- },
62
- toggleErrorStateForLocation() {
63
- const iconIsVisible = $(Wick.DefaultStoreProto.el.iconLocation).is(':visible');
64
-
65
- if (iconIsVisible) {
66
- $(Wick.DefaultStoreProto.el.iconLocation).hide();
67
- $(Wick.DefaultStoreProto.el.errorIconLocation).show();
68
- } else {
69
- $(Wick.DefaultStoreProto.el.iconLocation).show();
70
- $(Wick.DefaultStoreProto.el.errorIconLocation).hide();
71
- }
72
- },
73
- init() {
74
- $(Wick.DefaultStoreProto.el.searchStoreForm).on('submit', (event) => {
75
- event.preventDefault();
76
- const value = Wick.DefaultStore.getPostCode();
77
- if (value.length) {
78
- Wick.DefaultStoreProto.showStoreList();
79
- } else {
80
- Wick.DefaultStoreProto.showErrorState();
81
- }
82
- });
83
- $(Wick.DefaultStoreProto.el.btnCancel).on('click', (event) => {
84
- event.preventDefault();
85
- Wick.DefaultStoreProto.clearSearchInput();
86
- Wick.DefaultStoreProto.showUnavailableState();
87
- })
88
- $(Wick.DefaultStoreProto.el.btnLocation).on('click', (event) => {
89
- event.preventDefault();
90
- Wick.DefaultStoreProto.toggleErrorStateForLocation();
91
- })
92
- }
93
- }
94
-
95
- $(document).ready(function () {
96
- Wick.DefaultStoreProto.init();
97
- });
@@ -1,73 +0,0 @@
1
- var Wick = Wick || {};
2
- Wick.PersonalDetailsData = (function(){
3
- return {
4
- success: {
5
- globalMessage: {
6
- status: 'success',
7
- message: 'Your profile has been updated',
8
- },
9
- fieldErrors: null,
10
- },
11
- validationError: {
12
- globalMessage: {
13
- status: 'error',
14
- message: 'Please correct the errors below.',
15
- },
16
- fieldErrors: [
17
- { field: 'email', message: 'Please enter your email' },
18
- ],
19
- },
20
- serverError: {
21
- globalMessage: {
22
- status: 'error',
23
- message: 'Sorry, we were unable to update your personal details, please try again',
24
- },
25
- fieldErrors: null,
26
- },
27
- }
28
- })()
29
-
30
- function getResponseBasedOnField(personalDetails) {
31
- const personalDetailsObject = personalDetails.reduce((acc, { name, value }) => {
32
- acc[name] = value;
33
- return acc;
34
- }, {});
35
-
36
- const { firstName, email } = personalDetailsObject;
37
- const isValidationError = email === 'test@gmail.com';
38
- const isServerError = firstName === 'server_error';
39
-
40
- if (isValidationError) {
41
- return { success: false, response: Wick.PersonalDetailsData.validationError };
42
- }
43
-
44
- if (isServerError) {
45
- return { success: false, response: Wick.PersonalDetailsData.serverError };
46
- }
47
-
48
- return { success: true, response: Wick.PersonalDetailsData.success };
49
- }
50
-
51
- function initPersonalDetails() {
52
- if (!Wick?.PersonalDetails?.UPDATE_PERSONAL_DETAILS_EVENT) {
53
- return;
54
- }
55
-
56
- $(window).on(Wick.PersonalDetails.UPDATE_PERSONAL_DETAILS_EVENT, function ({ detail: { resolve, reject } }) {
57
- setTimeout(() => {
58
- const personalDetails = Wick.LeaveEvent.getState(Wick.PersonalDetails.el.userForm);
59
-
60
- const { success, response } = getResponseBasedOnField(personalDetails);
61
-
62
- if (success) {
63
- return resolve(response);
64
- } else {
65
- return reject(response);
66
- }
67
- }, 500);
68
- });
69
- }
70
-
71
- $(document).ready(function () {
72
- initPersonalDetails();
73
- });
@@ -1,44 +0,0 @@
1
- var Wick = window.Wick || {};
2
-
3
- Wick.DefaultStore = {
4
- HIDDEN_CLASS_NAME: 'd-none',
5
- el: {
6
- searchForm: '.search-store',
7
- $searchInput: $('.search-store #postcode'),
8
- $btnClear: $('.search-store .btn--clear'),
9
- $btnSubmit: $('.search-store .btn-search'),
10
- },
11
- getPostCode () {
12
- return Wick.DefaultStore.el.$searchInput.val();
13
- },
14
- checkVisibilityOfClearButton () {
15
- Wick.DefaultStore.el.$btnClear.toggleClass('d-block', Wick.DefaultStore.getPostCode().length > 0);
16
- },
17
- updateCollapseState() {
18
- const dropdowns = $("#openingTimes, #specialTimes, #facilities");
19
- const btn = $('[data-toggle="collapse"]');
20
-
21
- if ($(window).width() >= 768) {
22
- dropdowns.addClass("show");
23
- if (btn.length) {
24
- btn.attr("aria-expanded", "true");
25
- }
26
- } else {
27
- dropdowns.removeClass("show");
28
- if (btn.length) {
29
- btn.attr("aria-expanded", "false");
30
- }
31
- }
32
- },
33
- init () {
34
- Wick.DefaultStore.updateCollapseState();
35
- $(window).resize( _.debounce(function () {
36
- Wick.DefaultStore.updateCollapseState();
37
- }, 200));
38
- Wick.DefaultStore.el.$searchInput.on('input', Wick.DefaultStore.checkVisibilityOfClearButton);
39
- }
40
- }
41
-
42
- $(document).ready(function () {
43
- Wick.DefaultStore.init();
44
- });
@@ -1,51 +0,0 @@
1
- import {copyToClipboard} from "./utils/copy-to-clipboard";
2
-
3
- var Wick = window.Wick || {};
4
-
5
- Wick.MyAccount = {
6
- el: {
7
- $myAccount: $('.my-account'),
8
- },
9
- clipboardCodes: {
10
- tradeProId: {
11
- titleEl: '.clipboard-code.trade-pro-id .title',
12
- subtitleEl: '.clipboard-code.trade-pro-id .subtitle',
13
- btnCopy: '.btn--trade-pro-id',
14
- },
15
- discountCode: {
16
- titleEl: '.clipboard-code.discount-code .title',
17
- subtitleEl: '.clipboard-code.discount-code .subtitle',
18
- btnCopy: '.btn--discount-code',
19
- },
20
- },
21
- copyCode(codeType) {
22
- const { titleEl, subtitleEl, btnCopy } = Wick.MyAccount.clipboardCodes[codeType];
23
- const value = $(subtitleEl).text().trim();
24
- const title = $(titleEl).text().trim();
25
-
26
- copyToClipboard(value, btnCopy);
27
- Wick.SnackBar.show(
28
- {
29
- text: `${title} copied to clipboard`,
30
- type: Wick.SnackBar.types.SUCCESS,
31
- withCloseButton: false,
32
- autoClose: true,
33
- delayBeforeClose: 1500
34
- }
35
- );
36
- },
37
- init() {
38
- Object.keys(Wick.MyAccount.clipboardCodes).forEach((codeType) => {
39
- const { btnCopy } = Wick.MyAccount.clipboardCodes[codeType];
40
- $(btnCopy).on('click', () => Wick.MyAccount.copyCode(codeType));
41
- });
42
- }
43
- }
44
-
45
- $(document).ready(function () {
46
- if (!Wick.MyAccount.el.$myAccount.length) {
47
- return;
48
- }
49
-
50
- Wick.MyAccount.init();
51
- });