wickes-css2 2.93.0 → 2.94.0-develop.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 (132) hide show
  1. package/build/css/category-main.css +1 -1
  2. package/build/css/emulation.css +1 -1
  3. package/build/css/homepage-main.css +1 -1
  4. package/build/css/main.css +1 -1
  5. package/build/css/my-account-main-v2.css +1 -0
  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-v2.css +1 -0
  10. package/build/css/pages/my-account.css +1 -1
  11. package/build/css/pages/page_checkout_delivery-new.css +1 -1
  12. package/build/css/pages/page_personal-details.css +1 -0
  13. package/build/css/pdp-main-before-combine.css +1 -1
  14. package/build/css/pdp-main-non-critical.css +1 -1
  15. package/build/css/pdp-main.css +1 -1
  16. package/build/css/plp-main.css +1 -1
  17. package/build/css/store-locator-main.css +1 -1
  18. package/build/img/placeholders/discount-sm-15.jpg +0 -0
  19. package/build/img/placeholders/discount-sm.png +0 -0
  20. package/build/js/account-members.min.js +1 -1
  21. package/build/js/basket.min.js +1 -1
  22. package/build/js/bundle.min.js +1 -1
  23. package/build/js/checkout.min.js +1 -1
  24. package/build/js/emulation.min.js +74 -21
  25. package/build/js/merged-checkout.min.js +1 -1
  26. package/build/js/my-account.min.js +1 -0
  27. package/build/js/page/my-account.js +51 -0
  28. package/build/js/page/personal-details.js +217 -0
  29. package/build/js/personal-details.min.js +1 -0
  30. package/build/js/project-list.min.js +1 -1
  31. package/package.json +1 -1
  32. package/src/components/account-families/actions-bar.hbs +3 -0
  33. package/src/components/aside-nav2.hbs +1 -1
  34. package/src/components/banner-news.hbs +8 -0
  35. package/src/components/date-selection.hbs +46 -59
  36. package/src/components/delivery-types.hbs +18 -38
  37. package/src/components/my-account/active-orders/consignment-info.hbs +11 -0
  38. package/src/components/my-account/active-orders/header.hbs +4 -0
  39. package/src/components/my-account/active-orders/list-orders.hbs +9 -0
  40. package/src/components/my-account/active-orders/order-details.hbs +18 -0
  41. package/src/components/my-account/active-orders/order-header.hbs +7 -0
  42. package/src/components/my-account/active-orders/order.hbs +20 -0
  43. package/src/components/my-account/active-orders/shipment-detail.hbs +13 -0
  44. package/src/components/my-account/barcode.hbs +17 -0
  45. package/src/components/my-account/clipboard-code-card.hbs +16 -0
  46. package/src/components/my-account/contact-us.hbs +23 -0
  47. package/src/components/my-account/discount.hbs +11 -0
  48. package/src/components/my-account/greetings.hbs +7 -0
  49. package/src/components/my-account/leave-modal.hbs +13 -0
  50. package/src/components/my-account/menu-items.hbs +25 -0
  51. package/src/components/my-account/mobile-nav.hbs +46 -0
  52. package/src/components/my-account/personal-details-form.hbs +24 -0
  53. package/src/components/my-account/personal-details.hbs +14 -0
  54. package/src/components/my-account/user-account-actions.hbs +18 -0
  55. package/src/components/user-information-field.hbs +4 -0
  56. package/src/components.html +1 -0
  57. package/src/data/data_calendar.json +149 -0
  58. package/src/data/data_notification-page.json +4 -0
  59. package/src/data/my-account/data_my-account.json +469 -0
  60. package/src/data/my-account/data_personal-details.json +179 -0
  61. package/src/elements/dropdown.hbs +16 -5
  62. package/src/elements/form-row.hbs +1 -1
  63. package/src/img/placeholders/discount-sm-15.jpg +0 -0
  64. package/src/img/placeholders/discount-sm.png +0 -0
  65. package/src/js/components/date-selection.js +6 -20
  66. package/src/js/components/leave-event-v2.js +0 -0
  67. package/src/js/components/leave-event.js +10 -3
  68. package/src/js/emulation/date-selection.js +0 -21
  69. package/src/js/emulation/personal-details-local.js +73 -0
  70. package/src/js/page/my-account.js +51 -0
  71. package/src/js/page/personal-details.js +217 -0
  72. package/src/layouts/my-account-v2.hbs +27 -0
  73. package/src/layouts/my-account.hbs +1 -1
  74. package/src/page_checkout_delivery-details-v2-asm.html +3 -3
  75. package/src/page_checkout_delivery-details-v2-calendar-message.html +1 -1
  76. package/src/page_checkout_delivery-details-v2-oos.html +1 -1
  77. package/src/page_checkout_delivery-details-v2-wisdom-not-available.html +2 -2
  78. package/src/page_checkout_delivery-details-v2-wisdom.html +2 -2
  79. package/src/page_checkout_delivery-details-with-loader-v2.html +1 -1
  80. package/src/page_checkout_delivery-details_guest-new.html +1 -1
  81. package/src/page_checkout_next-day-delivery-details.html +161 -0
  82. package/src/{page_checkout_delivery-details-v2.html → page_checkout_rapid-delivery-details.html} +14 -3
  83. package/src/page_discount_installer.html +7 -1
  84. package/src/page_marketing-preferences.html +7 -1
  85. package/src/page_my-account-installer.html +93 -0
  86. package/src/page_my-account-trade-pro.html +91 -0
  87. package/src/page_my-account.html +56 -59
  88. package/src/page_my-account_address-book.html +8 -2
  89. package/src/page_my-account_order-history.html +8 -3
  90. package/src/page_my-account_personal-details.html +7 -1
  91. package/src/page_personal-details-installer.html +52 -0
  92. package/src/page_personal-details.html +52 -0
  93. package/src/page_tradePro_discount.html +8 -2
  94. package/src/page_tradePro_rewards.html +7 -1
  95. package/src/partials/breadcrumbs.hbs +27 -8
  96. package/src/partials/head.hbs +5 -1
  97. package/src/partials/header.hbs +68 -49
  98. package/src/partials/main-nav.hbs +17 -9
  99. package/src/scss/components/_aside-nav2.scss +18 -0
  100. package/src/scss/components/_date-selection-add-new-styles.scss +78 -19
  101. package/src/scss/components/_date-selection.scss +30 -215
  102. package/src/scss/components/my-account/_consignment-info.scss +46 -0
  103. package/src/scss/components/my-account/_contacts.scss +116 -0
  104. package/src/scss/components/my-account/_menu.scss +215 -0
  105. package/src/scss/components/my-account/_mobile-nav.scss +130 -0
  106. package/src/scss/components/my-account/_order.scss +112 -0
  107. package/src/scss/components/my-account/_shipment.scss +92 -0
  108. package/src/scss/emulation.scss +0 -24
  109. package/src/scss/helpers/_variables.scss +3 -1
  110. package/src/scss/my-account-main-v2.scss +32 -0
  111. package/src/scss/pages/checkout-new.scss +51 -0
  112. package/src/scss/pages/my-account-v2.scss +570 -0
  113. package/src/scss/pages/my-account.scss +1 -0
  114. package/src/scss/pages/page_checkout_delivery-new.scss +2 -1
  115. package/src/scss/pages/page_paint-mixing-error.scss +1 -1
  116. package/src/scss/pages/page_personal-details.scss +249 -0
  117. package/src/scss/partials/_header.scss +30 -0
  118. package/src/scss/partials/_main-nav.scss +6 -2
  119. package/src/sitemap.html +44 -66
  120. package/src/components/calendar-time-table-v2.hbs +0 -3
  121. package/src/components/calendar-time-table.hbs +0 -3
  122. package/src/components/date-selection-v2.hbs +0 -106
  123. package/src/components/delivery-selection.hbs +0 -11
  124. package/src/components/delivery-types-v2.hbs +0 -17
  125. package/src/page_checkout_delivery-address.html +0 -70
  126. package/src/page_checkout_delivery-details-ASM.html +0 -251
  127. package/src/page_checkout_delivery-details-oos-partially.html +0 -215
  128. package/src/page_checkout_delivery-details-oos.html +0 -232
  129. package/src/page_checkout_delivery-details-with-loader.html +0 -220
  130. package/src/page_checkout_delivery-details.html +0 -221
  131. package/src/page_checkout_delivery-details_guest.html +0 -198
  132. package/src/page_tradePro_delivery-details.html +0 -243
@@ -0,0 +1,179 @@
1
+ {
2
+ "personal_details": {
3
+ "buttons": [
4
+ {
5
+ "class": "btn btn-primary btn_full btn--save",
6
+ "type": "submit",
7
+ "dataAction": "save-form",
8
+ "text": "Save changes"
9
+ },
10
+ {
11
+ "class": "btn btn-outline-primary btn_full btn--cancel",
12
+ "type": "button",
13
+ "dataAction": "cancel-form",
14
+ "text": "Cancel"
15
+ }
16
+ ],
17
+ "leave-popup": {
18
+ "title": "Your personal details won’t be saved",
19
+ "headerIcon": "fas fa-exclamation-circle",
20
+ "description": "Are you sure you want to continue?",
21
+ "actions": {
22
+ "mod": "actions",
23
+ "buttons": [
24
+ {
25
+ "title": "Cancel",
26
+ "isPrimary": true,
27
+ "close-modal": true
28
+ },
29
+ {
30
+ "mod": "btn-continue",
31
+ "data-action": "reset-details",
32
+ "title": "Yes, continue",
33
+ "isSecondary": true
34
+ }
35
+ ]
36
+ }
37
+ },
38
+ "diy": {
39
+ "breadcrumbs": [
40
+ {
41
+ "url": "/",
42
+ "text": "Home"
43
+ },
44
+ {
45
+ "url": "/page_my-account.html",
46
+ "text": "My Account"
47
+ },
48
+ {
49
+ "url": "/page_personal-details.html",
50
+ "text": "Personal Details"
51
+ }
52
+ ],
53
+ "currentData": {
54
+ "Title": "Mr",
55
+ "Fist name": "James",
56
+ "Surname": "Smith",
57
+ "Email address": "james_smith@gmail.com",
58
+ "How would you describe yourself or your main trade": "DIY"
59
+ },
60
+ "fields": [
61
+ {
62
+ "type": "dropdown",
63
+ "dropdown": true,
64
+ "id": "titleCode",
65
+ "label": "Title",
66
+ "rowMod": "row-title",
67
+ "required": true,
68
+ "options": [
69
+ { "value": "Mr", "label": "Mr" },
70
+ { "value": "Mrs", "label": "Mrs" },
71
+ { "value": "Dr", "label": "Dr" }
72
+ ],
73
+ "selectedIndex": "0"
74
+ },
75
+ {
76
+ "type": "text",
77
+ "id": "firstName",
78
+ "label": "First name",
79
+ "value": "James",
80
+ "required": true
81
+ },
82
+ {
83
+ "type": "text",
84
+ "id": "lastName",
85
+ "label": "Surname",
86
+ "value": "Smith",
87
+ "required": true
88
+ },
89
+ {
90
+ "type": "email",
91
+ "id": "email",
92
+ "label": "Email address",
93
+ "value": "james_smith@gmail.com",
94
+ "required": true
95
+ },
96
+ {
97
+ "type": "dropdown",
98
+ "dropdown": true,
99
+ "id": "tradeType",
100
+ "label": "How would you describe yourself or your main trade",
101
+ "placeholder": "DIY",
102
+ "required": true,
103
+ "options": [
104
+ { "value": "DIY", "label": "DIY" },
105
+ { "value": "TradePro", "label": "Trade Pro" }
106
+ ],
107
+ "selectedIndex": "0"
108
+ }
109
+ ]
110
+ },
111
+ "installer": {
112
+ "breadcrumbs": [
113
+ {
114
+ "url": "/",
115
+ "text": "Home"
116
+ },
117
+ {
118
+ "url": "/page_my-account.html",
119
+ "text": "My Installer Account"
120
+ },
121
+ {
122
+ "url": "/page_personal-details.html",
123
+ "text": "Personal Details"
124
+ }
125
+ ],
126
+ "currentData": {
127
+ "Title": "Mr",
128
+ "Fist name": "James",
129
+ "Surname": "Smith",
130
+ "Email address": "james_smith@gmail.com",
131
+ "Trade type": "Installer"
132
+ },
133
+ "fields": [
134
+ {
135
+ "type": "dropdown",
136
+ "dropdown": true,
137
+ "id": "titleCode",
138
+ "label": "Title",
139
+ "rowMod": "row-title",
140
+ "required": true,
141
+ "options": [
142
+ { "value": "Mr", "label": "Mr" },
143
+ { "value": "Mrs", "label": "Mrs" },
144
+ { "value": "Dr", "label": "Dr" }
145
+ ],
146
+ "selectedIndex": "0"
147
+ },
148
+ {
149
+ "type": "text",
150
+ "id": "firstName",
151
+ "label": "First name",
152
+ "value": "James",
153
+ "required": true
154
+ },
155
+ {
156
+ "type": "text",
157
+ "id": "lastName",
158
+ "label": "Surname",
159
+ "value": "Smith",
160
+ "required": true
161
+ },
162
+ {
163
+ "type": "email",
164
+ "id": "email",
165
+ "label": "Email address",
166
+ "value": "james_smith@gmail.com",
167
+ "required": true
168
+ },
169
+ {
170
+ "type": "tradeType",
171
+ "id": "tradeType",
172
+ "label": "Trade type",
173
+ "value": "Installer",
174
+ "disabled": true
175
+ }
176
+ ]
177
+ }
178
+ }
179
+ }
@@ -1,10 +1,21 @@
1
1
  <div class="ddn {{mod}} {{#if error}}ddn_error{{/if}}">
2
2
  <select id="{{id}}" name="{{id}}" {{#if disabled}}disabled{{/if}}>
3
- <option value="" disabled selected hidden>{{placeholder}}</option>
4
- <option>Item value</option>
5
- <option>Item value 2</option>
6
- <option>Item value 3</option>
7
- <option>Item value 4</option>
3
+ {{#if options}}
4
+ {{#each options as |option|}}
5
+ <option
6
+ {{#if (eq @index ../selectedIndex)}}selected{{/if}}
7
+ value="{{option.value}}"
8
+ >
9
+ {{option.label}}
10
+ </option>
11
+ {{/each}}
12
+ {{else}}
13
+ <option value="" disabled selected hidden>{{placeholder}}</option>
14
+ <option value="item1">Item value</option>
15
+ <option value="item2">Item value 2</option>
16
+ <option value="item3">Item value 3</option>
17
+ <option value="item4">Item value 4</option>
18
+ {{/if}}
8
19
  </select>
9
20
  <span class="icon">
10
21
  <i class="fas fa-chevron-down"></i>
@@ -22,7 +22,7 @@
22
22
  {{/if}}
23
23
  {{/unless}}
24
24
  {{#if dropdown}}
25
- {{> dropdown mod=ddn-mod }}
25
+ {{> dropdown mod=ddn-mod options=options selectedIndex=selectedIndex }}
26
26
  {{/if}}
27
27
  {{#if infoIcon}}
28
28
  {{> info-icon modification="icon-info" title=infoIcon data-container=(concat "." infoIcon-uid) data-placement="top"}}
@@ -8,24 +8,20 @@ Wick.DateSelection = function () {
8
8
  calendarCell = $(calendarCellClassName),
9
9
  calendarCellSelected = 'calendar__cell_selected',
10
10
  calendarRowExtended = '.calendar__row_extended',
11
- deliverySelection = $('.delivery-selection'),
12
- deliverySelectionMobile = $('.delivery-selection-mobile'),
13
11
  inputField = '.delivery-types__slot label',
14
12
  confirmButton = '.delivery-types__confirm',
15
- changeDateLinks = '.delivery-time__show-calendar-link, .delivery-selection__show-calendar-link',
16
13
  validationError = $('.delivery-types__error'),
17
14
  validationErrorShow = 'delivery-types__error-show',
18
- deliverySelectionShow = 'delivery-selection-show',
19
15
  deliveryTypesHide = 'delivery-types-hide',
20
16
  deliveryTypesSlotLabel = $(inputField),
21
17
  closeIcon = $('.delivery-types__accordion'),
22
18
  deliveryTypesInnerStr = '.delivery-types__inner',
23
19
  dateSelection = '.date-selection',
24
20
  dateSelectionTimeVisible = 'date-selection_time-visible',
25
- deliveryTypesWrap = $('.delivery-types-wrap'),
21
+ deliveryContainer = $('.delivery-container'),
26
22
  deliveryTypesBtn = 'button.btn',
27
23
  deliveryTypeBtnClassSecondary = 'btn-secondary',
28
- deliveryTypeBtnClass = 'delivery-type__action-btn-primary';
24
+ deliveryBtnClass = 'delivery-btn';
29
25
 
30
26
  function init() {
31
27
  var count = 0;
@@ -50,9 +46,9 @@ Wick.DateSelection = function () {
50
46
  }
51
47
 
52
48
  componentDateSelection.on('click', deliveryTypesBtn, function () {
53
- $(this).parent(deliveryTypesWrap).find(deliveryTypesBtn).removeClass(deliveryTypeBtnClass);
54
- $(this).parent(deliveryTypesWrap).find(deliveryTypesBtn).addClass(deliveryTypeBtnClassSecondary);
55
- $(this).addClass(deliveryTypeBtnClass);
49
+ $(this).parent(deliveryContainer).find(deliveryTypesBtn).removeClass(deliveryBtnClass);
50
+ $(this).parent(deliveryContainer).find(deliveryTypesBtn).addClass(deliveryTypeBtnClassSecondary);
51
+ $(this).addClass(deliveryBtnClass);
56
52
  $(this).removeClass(deliveryTypeBtnClassSecondary);
57
53
  });
58
54
 
@@ -79,9 +75,7 @@ Wick.DateSelection = function () {
79
75
  if ($(window).width() < 767) {
80
76
  var rowExtendedBlock = $(this).closest(calendarRowExtended);
81
77
  rowExtendedBlock.slideUp();
82
- deliverySelectionMobile.show();
83
78
  } else {
84
- deliverySelection.addClass(deliverySelectionShow);
85
79
  $deliveryTypes.addClass(deliveryTypesHide);
86
80
  }
87
81
  } else {
@@ -112,7 +106,6 @@ Wick.DateSelection = function () {
112
106
 
113
107
  calendarCell.on("click", function () {
114
108
  $deliveryTypes.removeClass(deliveryTypesHide);
115
- deliverySelection.removeClass(deliverySelectionShow);
116
109
 
117
110
  $(deliveryTypesInnerStr).find('input').each(function () {
118
111
  if ($(this).attr('checked')) {
@@ -148,12 +141,6 @@ Wick.DateSelection = function () {
148
141
  }
149
142
  }
150
143
  });
151
-
152
- $(changeDateLinks).on("click", function () {
153
- $(this).closest(dateSelection).removeClass(dateSelectionTimeVisible);
154
- deliverySelection.removeClass(deliverySelectionShow);
155
- calendarCell.removeClass(calendarCellSelected);
156
- });
157
144
  }
158
145
 
159
146
  if (!componentDateSelection.length) {
@@ -166,8 +153,7 @@ Wick.DateSelection = function () {
166
153
  closeIcon.unbind('click');
167
154
  componentDateSelection.unbind('click');
168
155
  calendarCell.unbind('click');
169
- $(changeDateLinks).unbind('click');
170
- deliveryTypesWrap.unbind('click');
156
+ deliveryContainer.unbind('click');
171
157
  }
172
158
 
173
159
  $(window).on('resize', _.debounce(function () {
File without changes
@@ -8,7 +8,7 @@ Wick.LeaveEvent = {
8
8
  },
9
9
  proceedBrowserLeave: true,
10
10
  initialFormState: {},
11
- makeLeaveByAction(e, form) {
11
+ makeLeaveByAction(e, form, callback) {
12
12
  const currentState = Wick.LeaveEvent.getState(form);
13
13
  const isDifferent = !_.isEqual(currentState, Wick.LeaveEvent.initialFormState);
14
14
 
@@ -17,6 +17,10 @@ Wick.LeaveEvent = {
17
17
  Wick.LeaveEvent.showCustomModal();
18
18
  Wick.LeaveEvent.proceedBrowserLeave = false;
19
19
  }
20
+
21
+ if (callback && !isDifferent) {
22
+ callback();
23
+ }
20
24
  },
21
25
  makeLeaveByBrowser(form) {
22
26
  const currentState = Wick.LeaveEvent.getState(form);
@@ -40,12 +44,12 @@ Wick.LeaveEvent = {
40
44
  removeLeaveEvent() {
41
45
  $(window).off('beforeunload', Wick.LeaveEvent.checkLeavePopup);
42
46
  },
43
- bindEvent(form = 'form', leaveBtn, submitBtn) {
47
+ bindEvent(form = 'form', leaveBtn, submitBtn, callback) {
44
48
  Wick.LeaveEvent.initialFormState = Wick.LeaveEvent.getState(form);
45
49
  Wick.LeaveEvent.el.form = form;
46
50
 
47
51
  $(leaveBtn).on('click', (e) => {
48
- Wick.LeaveEvent.makeLeaveByAction(e, form);
52
+ Wick.LeaveEvent.makeLeaveByAction(e, form, callback);
49
53
  });
50
54
 
51
55
  if ($(Wick.LeaveEvent.el.leavePopup).length) {
@@ -57,6 +61,9 @@ Wick.LeaveEvent = {
57
61
  if ($(submitBtn).length) {
58
62
  $(submitBtn).on('click', (e) => {
59
63
  Wick.LeaveEvent.removeLeaveEvent();
64
+ if (callback) {
65
+ callback();
66
+ }
60
67
  });
61
68
  }
62
69
 
@@ -4,7 +4,6 @@ Wick.DateSelection = (function(){
4
4
  cell = '.calendar__cell_cnt',
5
5
  selectedCell = 'calendar__cell_selected',
6
6
  isSelected = 'date-selection_selected',
7
- backToCalendar = '.delivery-time__show-calendar-link',
8
7
  isDateSelected = false;
9
8
 
10
9
  var selectTimeSlot = function(e){
@@ -15,32 +14,12 @@ Wick.DateSelection = (function(){
15
14
  isDateSelected = true;
16
15
  };
17
16
 
18
- var mobileView = function(){
19
- var isTimeSlotsVisible = 'date-selection_time-visible';
20
-
21
- $self
22
- .off('.time')
23
- .removeClass(isTimeSlotsVisible)
24
- .on('click.time', cell, function(){
25
- $self.addClass(isTimeSlotsVisible);
26
- })
27
- .on('click.time', backToCalendar, function(){
28
- $self.removeClass(isTimeSlotsVisible);
29
- });
30
- };
31
-
32
17
  var init = function () {
33
18
  if (!$self.length) {
34
19
  return;
35
20
  }
36
21
 
37
22
  $self.on('click', cell, selectTimeSlot);
38
- new SimpleBar($self.find('.delivery-types__inner')[0]);
39
-
40
- if (Wick.Responsive.getCurrentBreakpoint() === 'down-sm') {
41
- mobileView();
42
- }
43
- Wick.Responsive.onBreakpoint(mobileView, 'down-sm');
44
23
  }
45
24
 
46
25
  init();
@@ -0,0 +1,73 @@
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
+ });
@@ -0,0 +1,51 @@
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
+ });