favesalon-embed 1.0.2 → 1.0.4

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 (167) hide show
  1. package/dist/{favesalon-embed/_commonjsHelpers-a4f66ccd.js → cjs/_commonjsHelpers-5cfcba41.js} +6 -14
  2. package/dist/cjs/chat-box_5.cjs.entry.js +17439 -0
  3. package/dist/cjs/chat-button.cjs.entry.js +55 -0
  4. package/dist/cjs/colors-38421769.js +69 -0
  5. package/dist/cjs/favesalon-embed.cjs.js +23 -0
  6. package/dist/cjs/google-map.cjs.entry.js +52 -0
  7. package/dist/cjs/index-7f190886.js +4396 -0
  8. package/dist/cjs/index-dd8176c4.js +1531 -0
  9. package/dist/cjs/index.cjs.js +2 -0
  10. package/dist/cjs/loader.cjs.js +22 -0
  11. package/dist/cjs/relativeTime-3721080d.js +9 -0
  12. package/dist/cjs/salon-booking-modal.cjs.entry.js +30 -0
  13. package/dist/cjs/salon-booking.cjs.entry.js +51 -0
  14. package/dist/cjs/salon-gift-card-modal.cjs.entry.js +29 -0
  15. package/dist/cjs/salon-gift-card.cjs.entry.js +51 -0
  16. package/dist/cjs/salon-info.cjs.entry.js +33 -0
  17. package/dist/cjs/salon-latest-reviews.cjs.entry.js +97 -0
  18. package/dist/cjs/salon-latest-styles_3.cjs.entry.js +241 -0
  19. package/dist/cjs/salon-lookbook.cjs.entry.js +222 -0
  20. package/dist/cjs/salon-ranking.cjs.entry.js +60 -0
  21. package/dist/cjs/salon-reviews.cjs.entry.js +193 -0
  22. package/dist/cjs/salon-services.cjs.entry.js +81 -0
  23. package/dist/cjs/salon-stylists.cjs.entry.js +118 -0
  24. package/dist/cjs/services-d1bdf299.js +21494 -0
  25. package/dist/cjs/style-detail.cjs.entry.js +312 -0
  26. package/dist/cjs/utils-c5a33b3c.js +23 -0
  27. package/dist/collection/collection-manifest.json +33 -0
  28. package/dist/collection/components/chat-box/index.css +105 -0
  29. package/dist/collection/components/chat-box/index.js +138 -0
  30. package/dist/collection/components/chat-button/index.css +101 -0
  31. package/dist/collection/components/chat-button/index.js +155 -0
  32. package/dist/collection/components/chat-form/index.css +40 -0
  33. package/dist/collection/components/chat-form/index.js +79 -0
  34. package/dist/collection/components/chat-messages/index.css +48 -0
  35. package/dist/collection/components/chat-messages/index.js +142 -0
  36. package/dist/collection/components/chat-rooms/index.css +102 -0
  37. package/dist/collection/components/chat-rooms/index.js +157 -0
  38. package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
  39. package/dist/collection/components/google-map/index.css +5 -0
  40. package/dist/collection/components/google-map/index.js +90 -0
  41. package/dist/collection/components/salon-booking/index.css +30 -0
  42. package/dist/collection/components/salon-booking/index.js +126 -0
  43. package/dist/collection/components/salon-booking/salon-booking-modal.js +92 -0
  44. package/dist/collection/components/salon-gift-card/index.css +30 -0
  45. package/dist/collection/components/salon-gift-card/index.js +126 -0
  46. package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +73 -0
  47. package/dist/collection/components/salon-info/index.css +1 -0
  48. package/dist/collection/components/salon-info/index.js +77 -0
  49. package/dist/collection/components/salon-latest-reviews/index.css +11 -0
  50. package/dist/collection/components/salon-latest-reviews/index.js +163 -0
  51. package/dist/collection/components/salon-latest-styles/index.css +12 -0
  52. package/dist/{favesalon-embed/salon-latest-styles.entry.js → collection/components/salon-latest-styles/index.js} +99 -14
  53. package/dist/collection/components/salon-locations/index.css +24 -0
  54. package/dist/{favesalon-embed/salon-locations.entry.js → collection/components/salon-locations/index.js} +95 -15
  55. package/dist/collection/components/salon-lookbook/index.css +15 -0
  56. package/dist/collection/components/salon-lookbook/index.js +368 -0
  57. package/dist/collection/components/salon-ranking/index.css +3 -0
  58. package/dist/collection/components/salon-ranking/index.js +117 -0
  59. package/dist/collection/components/salon-reviews/index.css +18 -0
  60. package/dist/collection/components/salon-reviews/index.js +249 -0
  61. package/dist/collection/components/salon-schedules/index.css +18 -0
  62. package/dist/{favesalon-embed/salon-schedules.entry.js → collection/components/salon-schedules/index.js} +95 -14
  63. package/dist/collection/components/salon-services/index.css +1 -0
  64. package/dist/collection/components/salon-services/index.js +146 -0
  65. package/dist/collection/components/salon-stylists/index.css +43 -0
  66. package/dist/collection/components/salon-stylists/index.js +184 -0
  67. package/dist/collection/components/style-detail/index.css +76 -0
  68. package/dist/collection/components/style-detail/index.js +386 -0
  69. package/dist/collection/components/user-avatar/index.css +0 -0
  70. package/dist/collection/components/user-avatar/index.js +159 -0
  71. package/dist/collection/constants/colors.js +65 -0
  72. package/dist/collection/global/global.js +0 -0
  73. package/dist/collection/index.js +1 -0
  74. package/dist/collection/mocks/users.js +10 -0
  75. package/dist/collection/services/services.js +295 -0
  76. package/dist/collection/types/chat.js +23 -0
  77. package/dist/collection/types/common.js +11 -0
  78. package/dist/collection/types/review.js +39 -0
  79. package/dist/collection/types/salon.js +58 -0
  80. package/dist/collection/types/service.js +24 -0
  81. package/dist/collection/types/style.js +128 -0
  82. package/dist/collection/types/stylist.js +30 -0
  83. package/dist/collection/types/user.js +10 -0
  84. package/dist/collection/utils/utils.js +23 -0
  85. package/dist/custom-elements/index.d.ts +12 -0
  86. package/dist/custom-elements/index.js +44974 -0
  87. package/dist/esm/_commonjsHelpers-66ac50f5.js +32 -0
  88. package/dist/esm/chat-box_5.entry.js +17431 -0
  89. package/dist/{favesalon-embed → esm}/chat-button.entry.js +5 -10
  90. package/dist/esm/favesalon-embed.js +18 -0
  91. package/dist/{favesalon-embed → esm}/google-map.entry.js +1 -1
  92. package/dist/esm/index-0494771f.js +1504 -0
  93. package/dist/{favesalon-embed/index-00b83e1c.js → esm/index-a1c7583c.js} +15 -425
  94. package/dist/esm/index.js +1 -0
  95. package/dist/esm/loader.js +18 -0
  96. package/dist/esm/polyfills/core-js.js +11 -0
  97. package/dist/esm/polyfills/css-shim.js +1 -0
  98. package/dist/esm/polyfills/dom.js +79 -0
  99. package/dist/esm/polyfills/es5-html-element.js +1 -0
  100. package/dist/esm/polyfills/index.js +34 -0
  101. package/dist/esm/polyfills/system.js +6 -0
  102. package/dist/esm/relativeTime-baa50aa2.js +7 -0
  103. package/dist/{favesalon-embed → esm}/salon-booking-modal.entry.js +1 -1
  104. package/dist/{favesalon-embed → esm}/salon-booking.entry.js +3 -3
  105. package/dist/{favesalon-embed → esm}/salon-gift-card-modal.entry.js +1 -1
  106. package/dist/{favesalon-embed → esm}/salon-gift-card.entry.js +3 -3
  107. package/dist/{favesalon-embed → esm}/salon-info.entry.js +3 -3
  108. package/dist/{favesalon-embed → esm}/salon-latest-reviews.entry.js +4 -4
  109. package/dist/esm/salon-latest-styles_3.entry.js +235 -0
  110. package/dist/{favesalon-embed → esm}/salon-lookbook.entry.js +3 -3
  111. package/dist/{favesalon-embed → esm}/salon-ranking.entry.js +1 -1
  112. package/dist/{favesalon-embed → esm}/salon-reviews.entry.js +3 -3
  113. package/dist/{favesalon-embed → esm}/salon-services.entry.js +3 -3
  114. package/dist/{favesalon-embed → esm}/salon-stylists.entry.js +3 -3
  115. package/dist/{favesalon-embed/services-7cb8f2a6.js → esm/services-257442e2.js} +99 -2467
  116. package/dist/{favesalon-embed → esm}/style-detail.entry.js +4 -4
  117. package/dist/{favesalon-embed/utils-7de9628a.js → esm/utils-e97485e0.js} +0 -3
  118. package/dist/favesalon-embed/favesalon-embed.css +1 -2439
  119. package/dist/favesalon-embed/favesalon-embed.esm.js +1 -148
  120. package/dist/favesalon-embed/index.esm.js +0 -1
  121. package/dist/favesalon-embed/p-05a1c88a.entry.js +1 -0
  122. package/dist/favesalon-embed/p-0acf0447.entry.js +1 -0
  123. package/dist/favesalon-embed/p-0bc4f624.js +1 -0
  124. package/dist/favesalon-embed/p-1af1515f.entry.js +1 -0
  125. package/dist/favesalon-embed/p-1cba5fc9.entry.js +1 -0
  126. package/dist/favesalon-embed/p-39a4ef15.entry.js +1 -0
  127. package/dist/favesalon-embed/p-3e2cb05b.entry.js +1 -0
  128. package/dist/favesalon-embed/p-47e646f8.js +1 -0
  129. package/dist/favesalon-embed/p-487b311f.entry.js +1 -0
  130. package/dist/favesalon-embed/p-55387c2f.entry.js +1 -0
  131. package/dist/favesalon-embed/p-566f05b4.entry.js +1 -0
  132. package/dist/favesalon-embed/p-862a0de0.entry.js +1 -0
  133. package/dist/favesalon-embed/p-9fe0cbeb.js +2 -0
  134. package/dist/favesalon-embed/p-a33331cc.js +1 -0
  135. package/dist/favesalon-embed/p-aeeb7b5f.entry.js +1 -0
  136. package/dist/favesalon-embed/p-b08e5b54.js +6 -0
  137. package/dist/favesalon-embed/p-b5cca5fc.entry.js +1 -0
  138. package/dist/favesalon-embed/p-c7fb7af5.js +1580 -0
  139. package/dist/favesalon-embed/p-ccab56d8.js +1 -0
  140. package/dist/favesalon-embed/p-d6e13053.entry.js +1 -0
  141. package/dist/favesalon-embed/p-dee42d34.entry.js +1 -0
  142. package/dist/favesalon-embed/p-e661ca1d.entry.js +1 -0
  143. package/dist/favesalon-embed/p-eeceab9c.entry.js +1 -0
  144. package/dist/index.cjs.js +1 -0
  145. package/dist/index.js +1 -0
  146. package/dist/types/components/chat-box/index.d.ts +12 -0
  147. package/dist/types/components/chat-rooms/index.d.ts +12 -0
  148. package/dist/types/components/user-avatar/index.d.ts +2 -1
  149. package/dist/types/components.d.ts +45 -2
  150. package/dist/types/utils/utils.d.ts +1 -0
  151. package/package.json +1 -1
  152. package/dist/favesalon-embed/app-globals-15861a7f.js +0 -712
  153. package/dist/favesalon-embed/app-globals-270fe240.js +0 -712
  154. package/dist/favesalon-embed/app-globals-437cc3f3.js +0 -712
  155. package/dist/favesalon-embed/app-globals-b8b0fc7a.js +0 -712
  156. package/dist/favesalon-embed/chat-form.entry.js +0 -39
  157. package/dist/favesalon-embed/chat-messages.entry.js +0 -51
  158. package/dist/favesalon-embed/css-shim-b7d3d95f.js +0 -4
  159. package/dist/favesalon-embed/dom-64053c71.js +0 -73
  160. package/dist/favesalon-embed/index-888e99e3.js +0 -3371
  161. package/dist/favesalon-embed/index-9ad82b12.js +0 -3371
  162. package/dist/favesalon-embed/index-aa906326.js +0 -3371
  163. package/dist/favesalon-embed/index-b97af793.js +0 -3371
  164. package/dist/favesalon-embed/relativeTime-268e64b0.js +0 -7
  165. package/dist/favesalon-embed/shadow-css-98135883.js +0 -387
  166. package/dist/favesalon-embed/user-avatar.entry.js +0 -42
  167. /package/dist/{favesalon-embed → esm}/colors-ea36347a.js +0 -0
@@ -0,0 +1,222 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-dd8176c4.js');
6
+ const colors = require('./colors-38421769.js');
7
+ const services = require('./services-d1bdf299.js');
8
+ require('./_commonjsHelpers-5cfcba41.js');
9
+
10
+ const indexCss = "@media (max-width: 768px){salon-lookbook .view-header{display:block !important}salon-lookbook .salon-loobook--serch-result{margin-bottom:16px}salon-lookbook .salon-loobook--filter-wrapper>label,salon-lookbook .salon-loobook--sort-wrapper>label{display:none !important}}";
11
+
12
+ const lookbookSortOptions = [{
13
+ value: 'like',
14
+ label: 'Most popular',
15
+ }, {
16
+ value: 'newest',
17
+ label: 'Newest first',
18
+ }, {
19
+ value: 'oldest',
20
+ label: 'Oldest first',
21
+ }];
22
+ const lookbookFilterOptions = [{
23
+ value: 'all',
24
+ label: 'All Category',
25
+ }];
26
+ const SalonLookbook = class {
27
+ constructor(hostRef) {
28
+ index.registerInstance(this, hostRef);
29
+ this.salonId = undefined;
30
+ this.isLoading = true;
31
+ this.isLoadingMore = undefined;
32
+ this.hideLoadMore = undefined;
33
+ this.currentPage = 1;
34
+ this.totalLookbooks = 0;
35
+ this.salonCategories = [];
36
+ this.salonLookbooks = [];
37
+ this.sortBy = lookbookSortOptions[1].value;
38
+ this.filterBy = lookbookFilterOptions[0].value;
39
+ this.isLayoutSetup = undefined;
40
+ }
41
+ componentWillLoad() {
42
+ this.fetchData();
43
+ this.injectSDK();
44
+ }
45
+ componentDidRender() {
46
+ this.setupGridLayout();
47
+ }
48
+ injectSDK() {
49
+ return new Promise((resolve) => {
50
+ const script = document.createElement('script');
51
+ script.type = 'text/javascript';
52
+ script.src = 'https://cdn.jsdelivr.net/npm/macy@2';
53
+ document.body.appendChild(script);
54
+ return resolve(true);
55
+ });
56
+ }
57
+ setupGridLayout() {
58
+ if (!this.isLayoutSetup && document.querySelector('#salon-loobooks--grid')) {
59
+ const script = document.createElement('script');
60
+ script.type = 'text/javascript';
61
+ script.innerHTML = `
62
+ var masonry = new Macy({
63
+ container: '#salon-loobooks--grid',
64
+ useContainerForBreakpoints: true,
65
+ margin: 16,
66
+ columns: 5,
67
+ breakAt: {
68
+ 1024: {
69
+ columns: 4,
70
+ },
71
+ 768: {
72
+ columns: 3,
73
+ },
74
+ 576: {
75
+ margin: 16,
76
+ columns: 2,
77
+ },
78
+ },
79
+ });
80
+ `;
81
+ document.body.appendChild(script);
82
+ this.isLayoutSetup = true;
83
+ }
84
+ }
85
+ async fetchData() {
86
+ try {
87
+ const promises = [
88
+ this.fetchLookbooks(Object.assign({ page: 1, sort: this.sortBy }, this.filterBy !== 'all' ? { services: [this.filterBy] } : {})),
89
+ this.fetchCategories(),
90
+ ];
91
+ return Promise.all(promises);
92
+ }
93
+ catch (e) { }
94
+ }
95
+ async fetchLookbooks(options, isLoadingMore) {
96
+ if (isLoadingMore) {
97
+ this.isLoadingMore = true;
98
+ }
99
+ else {
100
+ this.isLoading = true;
101
+ }
102
+ try {
103
+ const { total, allLookbooks } = await services.HttpService().fetchSalonLookbooks(this.salonId, options);
104
+ this.totalLookbooks = total;
105
+ this.salonLookbooks = this.salonLookbooks.concat(allLookbooks);
106
+ this.hideLoadMore = allLookbooks.length < 20;
107
+ }
108
+ catch (error) { }
109
+ if (isLoadingMore) {
110
+ this.isLoadingMore = false;
111
+ }
112
+ else {
113
+ this.isLoading = false;
114
+ }
115
+ }
116
+ async onChangeFiltering(filterBy) {
117
+ try {
118
+ this.currentPage = 1;
119
+ this.totalLookbooks = 0;
120
+ this.salonLookbooks = [];
121
+ this.hideLoadMore = true;
122
+ this.filterBy = filterBy;
123
+ await this.fetchLookbooks(Object.assign({ page: this.currentPage, sort: this.sortBy }, this.filterBy !== 'all' ? { services: [Number(this.filterBy)] } : {}));
124
+ if (window.masonry) {
125
+ this.isLayoutSetup = false;
126
+ }
127
+ }
128
+ catch (error) { }
129
+ }
130
+ async onChangeSorting(sortBy) {
131
+ try {
132
+ this.currentPage = 1;
133
+ this.totalLookbooks = 0;
134
+ this.salonLookbooks = [];
135
+ this.hideLoadMore = true;
136
+ this.sortBy = sortBy;
137
+ await this.fetchLookbooks(Object.assign({ page: this.currentPage, sort: this.sortBy }, this.filterBy !== 'all' ? { services: [this.filterBy] } : {}));
138
+ if (window.masonry) {
139
+ this.isLayoutSetup = false;
140
+ }
141
+ }
142
+ catch (error) { }
143
+ }
144
+ async onLoadMore() {
145
+ try {
146
+ this.currentPage += 1;
147
+ await this.fetchLookbooks({ page: this.currentPage }, true);
148
+ if (window.masonry) {
149
+ this.isLayoutSetup = false;
150
+ }
151
+ }
152
+ catch (error) { }
153
+ }
154
+ async fetchCategories() {
155
+ try {
156
+ this.salonCategories = await services.HttpService().fetchSalonCategories();
157
+ }
158
+ catch (error) { }
159
+ }
160
+ onClickLookbook(style) {
161
+ const elLookbookModal = document.createElement('div');
162
+ elLookbookModal.innerHTML = `
163
+ <style-detail
164
+ salon-id=${this.salonId}
165
+ salon-lookbook='${JSON.stringify(style)}'
166
+ ></style-detail>
167
+ `;
168
+ document.body.appendChild(elLookbookModal);
169
+ }
170
+ renderHeader() {
171
+ const allFilterOptions = lookbookFilterOptions.concat(([...this.salonCategories]).map(category => {
172
+ return {
173
+ value: category.id,
174
+ label: category.name,
175
+ };
176
+ }));
177
+ return (index.h("div", { class: "view-header", style: {
178
+ display: 'flex',
179
+ flexDirection: 'row',
180
+ justifyContent: 'space-between',
181
+ alignItems: 'center',
182
+ marginBottom: '24px',
183
+ } }, index.h("div", { class: "salon-loobook--serch-result" }, this.totalLookbooks, " ", this.totalLookbooks === 1 ? 'result' : 'results'), index.h("div", { style: {
184
+ display: 'flex',
185
+ flexDirection: 'row',
186
+ alignItems: 'center',
187
+ } }, index.h("div", { class: "salon-loobook--filter-wrapper", style: {
188
+ display: 'flex',
189
+ flexDirection: 'row',
190
+ alignItems: 'center',
191
+ marginRight: '16px',
192
+ } }, index.h("label", { style: { marginRight: '8px', marginBottom: '0' } }, "Filter by"), index.h("select", { class: "form-select", style: { width: '160px' }, onChange: (evt) => this.onChangeFiltering(evt.target.value) }, allFilterOptions.map(filterOption => (index.h("option", { value: filterOption.value, selected: String(filterOption.value) === String(this.filterBy) }, filterOption.label))))), index.h("div", { class: "salon-loobook--sort-wrapper", style: {
193
+ display: 'flex',
194
+ flexDirection: 'row',
195
+ alignItems: 'center',
196
+ } }, index.h("label", { style: { marginRight: '8px', marginBottom: '0' } }, "Sort by"), index.h("select", { class: "form-select", style: { width: '160px' }, onChange: (evt) => this.onChangeSorting(evt.target.value) }, lookbookSortOptions.map(sortOption => (index.h("option", { value: sortOption.value, selected: sortOption.value === this.sortBy }, sortOption.label))))))));
197
+ }
198
+ render() {
199
+ return (index.h("div", { class: "salon-loobooks" }, index.h("div", null, index.h("div", { class: "view-content" }, this.renderHeader(), this.salonLookbooks.length > 0 && (index.h("div", { class: "salon-loobooks--grid", id: "salon-loobooks--grid" }, this.salonLookbooks.map(style => {
200
+ const { caption, imageThumbMedium, owner } = style;
201
+ return (index.h("div", { class: "salon-lookbook salon-loobooks--grid-item", onClick: () => this.onClickLookbook(style) }, index.h("div", { class: "card", style: {
202
+ background: 'none',
203
+ border: 'none',
204
+ // maxWidth: '200px',
205
+ } }, index.h("div", { class: "salon-lookbook--image", style: {
206
+ borderRadius: '8px',
207
+ overflow: 'hidden',
208
+ minHeight: '80px',
209
+ background: colors.Colors.Gray01,
210
+ } }, index.h("img", { src: imageThumbMedium, alt: caption, style: { maxWidth: '100%' } })), owner && (index.h("div", { class: "card-body", style: { paddingLeft: '0' } }, index.h("user-avatar", { name: owner.fullName, shortName: `${(owner.firstName || '').charAt(0)}${(owner.lastName || '').charAt(0)}`, avatar: owner.avatar }))))));
211
+ })))), this.salonLookbooks.length > 0 && !this.hideLoadMore && (index.h("div", { class: "view-footer", style: { paddingTop: '16px', textAlign: 'center' } }, index.h("button", { type: "button", class: "btn btn-light btn-lg", onClick: () => this.onLoadMore(), style: {
212
+ background: colors.Colors.White,
213
+ border: `1px solid ${colors.Colors.Gray02}`,
214
+ borderRadius: '4px',
215
+ paddingLeft: '24px',
216
+ paddingRight: '24px',
217
+ } }, this.isLoadingMore ? 'Loading' : 'Load more'))))));
218
+ }
219
+ };
220
+ SalonLookbook.style = indexCss;
221
+
222
+ exports.salon_lookbook = SalonLookbook;
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-dd8176c4.js');
6
+ const colors = require('./colors-38421769.js');
7
+
8
+ const indexCss = "salon-ranking{display:block}";
9
+
10
+ const SalonRanking = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.ranking = undefined;
14
+ this.height = 16;
15
+ this.width = 16;
16
+ }
17
+ getRankingData(ranking) {
18
+ if (ranking === 5) {
19
+ return {
20
+ color: colors.Colors.Primary,
21
+ text: 'Viral',
22
+ };
23
+ }
24
+ if (ranking === 4) {
25
+ return {
26
+ color: colors.Colors.Orange03,
27
+ text: 'Advancing',
28
+ };
29
+ }
30
+ if (ranking === 3) {
31
+ return {
32
+ color: colors.Colors.Lilac03,
33
+ text: 'Progressing',
34
+ };
35
+ }
36
+ if (ranking === 2) {
37
+ return {
38
+ color: colors.Colors.Blue03,
39
+ text: 'Building',
40
+ };
41
+ }
42
+ return {
43
+ color: colors.Colors.Gray05,
44
+ text: 'Starting',
45
+ };
46
+ }
47
+ render() {
48
+ const rankingData = this.getRankingData(this.ranking);
49
+ return (index.h("div", { style: {
50
+ display: 'flex',
51
+ alignItems: 'center',
52
+ justifyContent: 'center',
53
+ width: '100%',
54
+ color: rankingData.color,
55
+ } }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", width: this.width, height: this.height, viewBox: `0 0 ${this.width} ${this.height}`, style: { maxWidth: `${this.width}px`, height: 'auto', marginRight: '8px' } }, index.h("path", { d: "M14.9984 14.1273C15.0188 14.2658 14.8369 14.3204 14.7415 14.2251L8.11345 7.6028C6.41272 5.90355 6.42184 3.19468 8.23887 1.76037C9.63972 0.678363 11.7259 0.753791 13.1793 1.96961C14.1899 2.80207 14.706 3.93808 14.7471 5.07223L14.9984 14.1273Z", fill: "currentColor" }), index.h("path", { d: "M1.74847 8.24513C3.18403 6.42967 5.91004 6.40579 7.61078 8.10504L14.2548 14.7432C14.3501 14.8385 14.2795 15.0043 14.1568 14.9999L5.078 14.7329C3.94287 14.6918 2.78997 14.1604 1.97268 13.1665C0.755801 11.7144 0.680308 9.62998 1.74847 8.24513Z", fill: "currentColor" })), rankingData.text));
56
+ }
57
+ };
58
+ SalonRanking.style = indexCss;
59
+
60
+ exports.salon_ranking = SalonRanking;
@@ -0,0 +1,193 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-dd8176c4.js');
6
+ const services = require('./services-d1bdf299.js');
7
+ const colors = require('./colors-38421769.js');
8
+ require('./_commonjsHelpers-5cfcba41.js');
9
+
10
+ const indexCss = "@media (max-width: 768px){salon-reviews .salon-reviews{flex-direction:column !important}salon-reviews .salon-reviews--filters--options{display:none !important}salon-reviews .salon-reviews--list{padding-top:32px !important;padding-left:0px !important}salon-reviews .reviews-list--sorting>label{display:none !important}}";
11
+
12
+ const pageLimited = 10;
13
+ const sortOptions = [{
14
+ value: 'newest',
15
+ label: 'Newest first',
16
+ }, {
17
+ value: 'oldest',
18
+ label: 'Oldest first',
19
+ }, {
20
+ value: 'rating_desc',
21
+ label: 'High rating first',
22
+ }, {
23
+ value: 'rating_asc',
24
+ label: 'Low rating first',
25
+ }];
26
+ const SalonReviews = class {
27
+ constructor(hostRef) {
28
+ index.registerInstance(this, hostRef);
29
+ this.salonId = undefined;
30
+ this.primaryColor = colors.Colors.Primary;
31
+ this.salonInfo = undefined;
32
+ this.stats = {};
33
+ this.totalReviews = 0;
34
+ this.allReviews = [];
35
+ this.isLoading = undefined;
36
+ this.isSorting = undefined;
37
+ this.isFiltering = undefined;
38
+ this.isLoadingMore = undefined;
39
+ this.canLoadMore = undefined;
40
+ this.page = 1;
41
+ this.filterBy = [];
42
+ this.sortBy = sortOptions[0].value;
43
+ }
44
+ componentWillLoad() {
45
+ this.fetchData();
46
+ }
47
+ fetchData() {
48
+ this.isLoading = true;
49
+ try {
50
+ services.HttpService().fetchSalonReviews(this.salonId, {
51
+ page: 1,
52
+ sort: this.sortBy,
53
+ limit: pageLimited,
54
+ }).then(response => {
55
+ const { total, stats, data: allReviews } = response;
56
+ this.stats = stats;
57
+ this.totalReviews = total;
58
+ this.allReviews = allReviews;
59
+ this.canLoadMore = total > pageLimited;
60
+ });
61
+ }
62
+ catch (e) { }
63
+ this.isLoading = false;
64
+ }
65
+ onLoadMore() {
66
+ this.isLoadingMore = true;
67
+ try {
68
+ services.HttpService().fetchSalonReviews(this.salonId, {
69
+ page: this.page + 1,
70
+ sort: this.sortBy,
71
+ limit: pageLimited,
72
+ }).then(response => {
73
+ const { total, data: allReviews } = response;
74
+ this.page = this.page + 1;
75
+ this.totalReviews = total;
76
+ this.allReviews = this.allReviews.concat(allReviews);
77
+ this.canLoadMore = (allReviews || []).length === pageLimited;
78
+ });
79
+ }
80
+ catch (e) { }
81
+ this.isLoadingMore = false;
82
+ }
83
+ onChangeFilter(filterBy) {
84
+ this.isFiltering = true;
85
+ try {
86
+ services.HttpService().fetchSalonReviews(this.salonId, Object.assign({ page: 1, sort: this.sortBy, limit: pageLimited }, filterBy.length > 0 ? { avg_point: filterBy } : {})).then(response => {
87
+ const { total, data: allReviews } = response;
88
+ this.page = 1;
89
+ this.totalReviews = total;
90
+ this.allReviews = allReviews;
91
+ this.canLoadMore = (allReviews || []).length === pageLimited;
92
+ });
93
+ }
94
+ catch (e) { }
95
+ this.isFiltering = false;
96
+ }
97
+ onChangeSorting(sortBy) {
98
+ this.isSorting = true;
99
+ try {
100
+ services.HttpService().fetchSalonReviews(this.salonId, Object.assign({ page: 1, sort: sortBy, limit: pageLimited }, this.filterBy.length > 0 ? { avg_point: this.filterBy } : {})).then(response => {
101
+ const { total, data: allReviews } = response;
102
+ this.page = 1;
103
+ this.totalReviews = total;
104
+ this.allReviews = allReviews;
105
+ this.canLoadMore = (allReviews || []).length === pageLimited;
106
+ });
107
+ }
108
+ catch (e) { }
109
+ this.isSorting = false;
110
+ }
111
+ render() {
112
+ const ratingTexts = ['', 'Poor', 'Sufficient', 'Average', 'Well', 'Very good'];
113
+ return (index.h("div", { class: "view view--salon-reviews" }, index.h("div", { class: "salon-reviews--filters" }, index.h("div", { class: "salon-reviews--score" }, index.h("div", { class: "salon-review--rating", style: { display: 'flex', flexDirection: 'row' } }, [1, 2, 3, 4, 5].map(score => {
114
+ return (index.h("i", { class: score <= this.stats.reviewPoint ? 'ri-heart-fill' : 'ri-heart-line', style: Object.assign({ fontSize: '32px', marginRight: '4px' }, score <= this.stats.reviewPoint ? { color: this.primaryColor } : { color: colors.Colors.Gray04 }) }));
115
+ })), index.h("div", { class: "salon-review--rating--date", style: {
116
+ display: 'flex',
117
+ flexDirection: 'row',
118
+ alignItems: 'center',
119
+ marginTop: '-8px',
120
+ } }, index.h("span", { style: { fontSize: '24px' } }, this.stats.reviewPoint, "/5"), " ", index.h("span", { style: { color: colors.Colors.Gray04, marginLeft: '8px' } }, "(", this.stats.totalReviews, " reviews)"))), index.h("div", { class: "salon-reviews--filters--options", style: { marginTop: '24px' } }, index.h("div", { style: {
121
+ background: colors.Colors.Gray01,
122
+ display: 'flex',
123
+ alignItems: 'center',
124
+ borderRadius: '4px',
125
+ padding: '16px',
126
+ } }, index.h("div", null, index.h("input", { type: "checkbox", checked: this.filterBy.length === 0, onChange: () => {
127
+ this.filterBy = [];
128
+ this.onChangeFilter([]);
129
+ } }), " ", index.h("span", { style: { marginLeft: '4px' } }, "All reviews")), [5, 4, 3, 2, 1].map(score => {
130
+ const isChecked = this.filterBy.indexOf(score) > -1;
131
+ return (index.h("div", { key: `salon-reviews--filters-score--${score}`, style: { display: 'flex', alignItems: 'center', marginLeft: '16px' } }, index.h("input", { type: "checkbox", checked: isChecked, onChange: () => {
132
+ const newFilter = isChecked ? this.filterBy.filter(fs => fs !== score) : this.filterBy.concat([score]);
133
+ this.filterBy = newFilter;
134
+ this.onChangeFilter(newFilter);
135
+ } }), " ", index.h("span", { style: { display: 'flex', alignItems: 'center', marginLeft: '4px' } }, score, " ", index.h("i", { class: "ri-heart-line", style: {
136
+ fontSize: '16px',
137
+ marginLeft: '4px',
138
+ marginRight: '4px',
139
+ lineHeight: '1',
140
+ } }), " ", index.h("span", { style: { color: colors.Colors.Gray04, fontSize: '12px' } }, "(", this.stats[String(score)] || 0, ")"))));
141
+ })))), index.h("div", { class: "salon-reviews--list-header", style: {
142
+ display: 'flex',
143
+ flexDirection: 'row',
144
+ justifyContent: 'space-between',
145
+ alignItems: 'center',
146
+ marginTop: '24px',
147
+ } }, index.h("div", { class: "view--salon-reviews--counter" }, this.totalReviews, " ", this.totalReviews === 1 ? `review` : `reviews`), index.h("div", { style: { display: 'flex', alignItems: 'center' } }, index.h("label", { style: { marginRight: '8px', color: colors.Colors.Gray04 } }, "Sort by"), index.h("select", { class: "search-filter--select", "place-holder": "Most popular", disabled: this.isLoading, onChange: (evt) => {
148
+ this.sortBy = evt.target.value;
149
+ this.onChangeSorting(evt.target.value);
150
+ }, style: {
151
+ display: 'flex',
152
+ alignItems: 'center',
153
+ backgroundColor: colors.Colors.Gray01,
154
+ borderColor: colors.Colors.Gray01,
155
+ borderRadius: '4px',
156
+ height: '40px',
157
+ width: '130px',
158
+ } }, sortOptions.map(sortOption => (index.h("option", { value: sortOption.value, selected: sortOption.value === this.sortBy, key: `search-filter--select-option--${sortOption.value}` }, sortOption.label)))))), index.h("div", { class: "salon-reviews--list-content", style: { marginTop: '24px' } }, this.allReviews.map((review, idx) => {
159
+ const user = review.user || {};
160
+ return (index.h("div", { class: "salon-review", key: `salon-review--${idx}`, style: {
161
+ borderBottom: `1px solid ${colors.Colors.Gray02}`,
162
+ marginBottom: '24px',
163
+ paddingBottom: '24px',
164
+ } }, index.h("div", { class: "salon-review--user", style: { marginBottom: '16px', overflow: 'hidden' } }, index.h("user-avatar", { size: 48, avatar: user.avatar, name: index.h("span", { style: { fontSize: '18px', fontWeight: '600', color: colors.Colors.TextColor } }, (user.firstName || user.lastName) ? `${user.firstName || ''} ${user.lastName || ''}` : ''), shortName: `${(user.firstName || '').charAt(0)}${(user.lastName || '').charAt(0)}`, nameStyle: { fontWeight: 'bold' } })), index.h("div", { class: "salon-review--rating", style: { display: 'flex', flexDirection: 'row', marginBottom: '4px' } }, [1, 2, 3, 4, 5].map(score => (index.h("i", { key: `salon-review--rating--item--score--${score}`, class: score <= review.point ? 'ri-heart-fill' : 'ri-heart-line', style: {
165
+ color: score <= review.point ? this.primaryColor : colors.Colors.Gray04,
166
+ fontSize: '16px',
167
+ marginRight: '4px',
168
+ } }))), review.createdDate && (index.h("div", { class: "salon-review--rating--date", style: { fontSize: '14px', color: colors.Colors.Gray04, marginLeft: '16px', position: 'relative', top: '2px' } }, services.dayjs_min(review.createdDate).format(services.shortDateYearFormat)))), index.h("div", { class: "salon-review--rating-text", style: { fontSize: '16px', fontWeight: '600' } }, ratingTexts[review.point]), (review.title || review.description) && (index.h("div", { class: "salon-review--detail", style: { marginTop: '16px' } }, index.h("div", { class: "salon-review--title", style: { fontSize: '18px', fontWeight: 'bold' }, innerHTML: review.title }), index.h("div", { class: "salon-review--description", style: { fontSize: '16px' }, innerHTML: review.description }))), review.photos.length > 0 && (index.h("div", { style: {
169
+ display: 'flex',
170
+ flexDirection: 'row',
171
+ overflowX: 'auto',
172
+ } }, review.photos.map(fileObj => (index.h("div", { key: `upload-file--${fileObj.id}`, class: "review--photo", style: {
173
+ position: 'relative',
174
+ cursor: 'pointer',
175
+ marginTop: '16px',
176
+ marginRight: '12px',
177
+ } }, index.h("img", { width: 72, src: fileObj.imageUrlThumb, style: { display: 'block' } }))))))));
178
+ })), index.h("div", { class: "salon-reviews--list-footer", style: {
179
+ textAlign: 'center',
180
+ paddingTop: '16px',
181
+ paddingBottom: '16px',
182
+ } }, index.h("button", { class: "btn btn-light btn-lg", style: {
183
+ background: colors.Colors.White,
184
+ border: `1px solid ${colors.Colors.Gray02}`,
185
+ borderRadius: '4px',
186
+ paddingLeft: '24px',
187
+ paddingRight: '24px',
188
+ }, onClick: () => this.onLoadMore() }, "Load more"))));
189
+ }
190
+ };
191
+ SalonReviews.style = indexCss;
192
+
193
+ exports.salon_reviews = SalonReviews;
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-dd8176c4.js');
6
+ const services = require('./services-d1bdf299.js');
7
+ const colors = require('./colors-38421769.js');
8
+ require('./_commonjsHelpers-5cfcba41.js');
9
+
10
+ const indexCss = "";
11
+
12
+ const SalonServices = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ this.salonId = undefined;
16
+ this.buttonClass = 'btn btn-light';
17
+ this.salonServices = undefined;
18
+ this.isLoading = undefined;
19
+ }
20
+ componentWillLoad() {
21
+ this.fetchData();
22
+ }
23
+ async fetchData() {
24
+ this.isLoading = true;
25
+ try {
26
+ this.salonServices = await services.HttpService().fetchSalonServices(this.salonId);
27
+ }
28
+ catch (e) {
29
+ this.salonServices = [];
30
+ }
31
+ this.isLoading = false;
32
+ }
33
+ render() {
34
+ if (this.isLoading) {
35
+ return (index.h("div", { class: "salon-services--container" }, index.h("div", { class: "view view--salon-services--header", style: { border: `1px solid ${colors.Colors.Gray01}` } }, index.h("div", { class: "view-content", style: { overflowX: 'auto' } }, index.h("div", { style: { whiteSpace: 'nowrap', overflow: 'hidden' } }, [1, 2, 3, 4, 5, 6].map((fakeId, index$1) => (index.h("div", { key: `service-group--${fakeId}--${index$1}`, style: {
36
+ backgroundColor: colors.Colors.Gray02,
37
+ float: 'left',
38
+ marginRight: '12px',
39
+ height: '30px',
40
+ width: '120px',
41
+ } })))))), [1, 2, 3, 4, 5, 6].map((fakeId, index$1) => {
42
+ return (index.h("div", { id: `service-group--${fakeId}`, style: { marginTop: '32px' } }, index.h("div", { key: `service-group--${fakeId}--${index$1}`, style: {
43
+ backgroundColor: colors.Colors.Gray03,
44
+ height: '20px',
45
+ width: '120px',
46
+ } }), index.h("div", { class: "view view--salon-service-type", style: { border: `1px solid ${colors.Colors.Gray01}`, marginTop: '12px' } }, index.h("div", { class: "view-content" }, [1, 2, 3].map((fakeGroupId, fakeGroupIndex) => (index.h("div", { key: `service-group--${fakeId}--service-${fakeGroupId}--${fakeGroupIndex}`, class: "salon-service" }, index.h("div", { class: "salon-service--name", style: Object.assign({}, fakeGroupIndex > 0 ? {
47
+ marginTop: '12px',
48
+ paddingTop: '12px',
49
+ borderTop: `1px solid ${colors.Colors.Gray01}`,
50
+ } : {}) }, index.h("div", { key: `service-group--${fakeId}--${index$1}`, style: {
51
+ backgroundColor: colors.Colors.Gray01,
52
+ height: '16px',
53
+ width: '120px',
54
+ } })), index.h("div", { style: { marginTop: '4px' } }, index.h("div", { style: {
55
+ backgroundColor: colors.Colors.Gray01,
56
+ height: '16px',
57
+ width: '240px',
58
+ } })))))))));
59
+ })));
60
+ }
61
+ return (index.h("div", { class: "salon-services--container" }, index.h("div", { class: "view view--salon-services--header", style: { border: `1px solid ${colors.Colors.Gray02}` } }, index.h("div", { class: "view-content", style: { overflowX: 'auto' } }, index.h("div", { style: { whiteSpace: 'nowrap' } }, services.sortBy_1(this.salonServices || [], (['order', 'name'])).map((serviceGroup, index$1) => (index.h("a", { href: `#service-group--${serviceGroup.id}` }, index.h("button", { type: "button", class: this.buttonClass, style: index$1 > 0 ? { marginLeft: '12px' } : {} }, serviceGroup.name))))))), services.sortBy_1(this.salonServices || [], (['order', 'name'])).map(serviceGroup => {
62
+ const hasMultipleCates = (serviceGroup.data || []).length > 1;
63
+ return (index.h("div", { id: `service-group--${serviceGroup.id}`, style: { marginTop: '32px' } }, index.h("h3", { style: { fontSize: '24px', marginBottom: '12px' } }, serviceGroup.name), index.h("div", { class: "view view--salon-service-type", style: { border: `1px solid ${colors.Colors.Gray02}` } }, index.h("div", { class: "view-content" }, (serviceGroup.data || []).map((subGroup, subGroupIndex) => (index.h("div", { class: "salon-service-category" }, hasMultipleCates && (index.h("h4", { style: Object.assign({ fontSize: '20px', marginBottom: '12px', paddingBottom: '12px', borderBottom: `1px solid ${colors.Colors.Gray02}` }, subGroupIndex > 0 ? { marginTop: '32px' } : {}) }, subGroup.name)), (subGroup.data || []).map((service, serviceIndex) => (index.h("div", { class: "salon-service" }, index.h("div", { class: "salon-service--name", style: Object.assign({ fontSize: '16px', fontWeight: '500' }, serviceIndex > 0 ? {
64
+ marginTop: '12px',
65
+ paddingTop: '12px',
66
+ borderTop: `1px solid ${colors.Colors.Gray01}`,
67
+ } : {}) }, service.name), (!service.hideDuration || !service.hidePrice) && (index.h("div", { style: {
68
+ display: 'block',
69
+ marginTop: '4px',
70
+ fontSize: '90%',
71
+ color: colors.Colors.Gray05,
72
+ } }, [
73
+ !service.hideDuration ? `${service.duration} mins` : '',
74
+ !service.hidePrice ? `$${service.price}` : '',
75
+ ].filter(field => !!field).join(' · ')))))))))))));
76
+ })));
77
+ }
78
+ };
79
+ SalonServices.style = indexCss;
80
+
81
+ exports.salon_services = SalonServices;