favesalon-embed 0.0.4 → 0.1.0

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 (241) hide show
  1. package/LICENSE +21 -0
  2. package/{cjs → dist/cjs}/_commonjsHelpers-5cfcba41.js +0 -0
  3. package/dist/cjs/colors-38421769.js +69 -0
  4. package/dist/cjs/favesalon-embed.cjs.js +20 -0
  5. package/{cjs → dist/cjs}/global-9073d10e.js +0 -0
  6. package/dist/cjs/google-map_5.cjs.entry.js +291 -0
  7. package/{cjs/index-48ac68d0.js → dist/cjs/index-7f190886.js} +1924 -0
  8. package/{cjs/index-d5de0b9d.js → dist/cjs/index-e6bea8f5.js} +10 -0
  9. package/{cjs → dist/cjs}/index.cjs.js +0 -0
  10. package/dist/cjs/loader.cjs.js +22 -0
  11. package/{cjs → dist/cjs}/salon-booking-modal.cjs.entry.js +5 -5
  12. package/{cjs → dist/cjs}/salon-booking.cjs.entry.js +6 -7
  13. package/dist/cjs/salon-gift-card-modal.cjs.entry.js +28 -0
  14. package/{cjs → dist/cjs}/salon-gift-card.cjs.entry.js +7 -7
  15. package/dist/cjs/salon-latest-reviews.cjs.entry.js +95 -0
  16. package/{cjs/salon-lookbook_2.cjs.entry.js → dist/cjs/salon-lookbook.cjs.entry.js} +23 -57
  17. package/{cjs → dist/cjs}/salon-ranking.cjs.entry.js +7 -7
  18. package/dist/cjs/salon-reviews.cjs.entry.js +186 -0
  19. package/dist/cjs/salon-services.cjs.entry.js +78 -0
  20. package/dist/cjs/salon-stylists.cjs.entry.js +112 -0
  21. package/{cjs/services-f1102d4a.js → dist/cjs/services-eee8f251.js} +265 -393
  22. package/dist/cjs/style-detail.cjs.entry.js +310 -0
  23. package/dist/cjs/user-avatar.cjs.entry.js +41 -0
  24. package/{cjs → dist/cjs}/utils-c5a33b3c.js +0 -0
  25. package/{collection → dist/collection}/collection-manifest.json +2 -3
  26. package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
  27. package/{collection → dist/collection}/components/google-map/index.css +0 -1
  28. package/dist/collection/components/google-map/index.js +86 -0
  29. package/{collection → dist/collection}/components/salon-booking/index.css +10 -24
  30. package/{collection → dist/collection}/components/salon-booking/index.js +3 -3
  31. package/{collection → dist/collection}/components/salon-booking/salon-booking-modal.js +4 -4
  32. package/dist/collection/components/salon-gift-card/index.css +25 -0
  33. package/{collection → dist/collection}/components/salon-gift-card/index.js +4 -3
  34. package/{collection → dist/collection}/components/salon-gift-card/salon-gift-card-modal.js +24 -3
  35. package/{collection/components/salon-locations → dist/collection/components/salon-info}/index.css +0 -0
  36. package/{collection → dist/collection}/components/salon-info/index.js +6 -32
  37. package/{collection → dist/collection}/components/salon-latest-reviews/index.css +0 -3
  38. package/dist/collection/components/salon-latest-reviews/index.js +176 -0
  39. package/dist/collection/components/salon-latest-styles/index.css +10 -0
  40. package/dist/collection/components/salon-latest-styles/index.js +178 -0
  41. package/{collection/components/salon-contact → dist/collection/components/salon-locations}/index.css +6 -6
  42. package/dist/collection/components/salon-locations/index.js +151 -0
  43. package/{collection → dist/collection}/components/salon-lookbook/index.css +0 -9
  44. package/{collection → dist/collection}/components/salon-lookbook/index.js +19 -19
  45. package/{collection → dist/collection}/components/salon-ranking/index.css +0 -0
  46. package/{collection → dist/collection}/components/salon-ranking/index.js +5 -5
  47. package/{collection → dist/collection}/components/salon-reviews/index.css +0 -0
  48. package/dist/collection/components/salon-reviews/index.js +286 -0
  49. package/dist/collection/components/salon-schedules/index.css +15 -0
  50. package/dist/collection/components/salon-schedules/index.js +189 -0
  51. package/{collection → dist/collection}/components/salon-services/index.css +0 -0
  52. package/{collection → dist/collection}/components/salon-services/index.js +51 -8
  53. package/{collection → dist/collection}/components/salon-stylists/index.css +0 -8
  54. package/dist/collection/components/salon-stylists/index.js +183 -0
  55. package/dist/collection/components/style-detail/index.css +62 -0
  56. package/dist/collection/components/style-detail/index.js +461 -0
  57. package/{collection → dist/collection}/components/user-avatar/index.css +0 -0
  58. package/{collection → dist/collection}/components/user-avatar/index.js +2 -2
  59. package/dist/collection/constants/colors.js +65 -0
  60. package/{collection → dist/collection}/global/global.js +0 -0
  61. package/{collection → dist/collection}/index.js +0 -0
  62. package/dist/collection/services/services.js +174 -0
  63. package/dist/collection/types/common.js +11 -0
  64. package/{collection → dist/collection}/types/review.js +9 -5
  65. package/dist/collection/types/salon.js +58 -0
  66. package/{collection → dist/collection}/types/service.js +0 -0
  67. package/dist/collection/types/style.js +128 -0
  68. package/{collection → dist/collection}/types/stylist.js +12 -9
  69. package/{favesalon-embed/index.esm.js → dist/collection/types/tmp.js} +0 -0
  70. package/{collection → dist/collection}/types/user.js +2 -2
  71. package/{collection → dist/collection}/utils/utils.js +0 -0
  72. package/{custom-elements → dist/custom-elements}/index.d.ts +12 -18
  73. package/{custom-elements → dist/custom-elements}/index.js +1227 -1035
  74. package/{esm → dist/esm}/_commonjsHelpers-098d5b27.js +0 -0
  75. package/dist/esm/colors-ea36347a.js +67 -0
  76. package/dist/esm/favesalon-embed.js +18 -0
  77. package/{esm → dist/esm}/global-e1089ffd.js +0 -0
  78. package/dist/esm/google-map_5.entry.js +283 -0
  79. package/{esm/index-0f8eed73.js → dist/esm/index-6af0a03d.js} +10 -1
  80. package/{esm/index-67d677ba.js → dist/esm/index-80523fec.js} +1924 -1
  81. package/{esm → dist/esm}/index.js +0 -0
  82. package/dist/esm/loader.js +18 -0
  83. package/{esm → dist/esm}/polyfills/core-js.js +0 -0
  84. package/{esm → dist/esm}/polyfills/css-shim.js +0 -0
  85. package/{esm → dist/esm}/polyfills/dom.js +0 -0
  86. package/{esm → dist/esm}/polyfills/es5-html-element.js +0 -0
  87. package/{esm → dist/esm}/polyfills/index.js +0 -0
  88. package/{esm → dist/esm}/polyfills/system.js +0 -0
  89. package/{esm → dist/esm}/salon-booking-modal.entry.js +5 -5
  90. package/{esm → dist/esm}/salon-booking.entry.js +5 -6
  91. package/dist/esm/salon-gift-card-modal.entry.js +24 -0
  92. package/{esm → dist/esm}/salon-gift-card.entry.js +6 -6
  93. package/dist/esm/salon-latest-reviews.entry.js +91 -0
  94. package/{esm/salon-lookbook_2.entry.js → dist/esm/salon-lookbook.entry.js} +24 -57
  95. package/{esm → dist/esm}/salon-ranking.entry.js +7 -7
  96. package/dist/esm/salon-reviews.entry.js +182 -0
  97. package/dist/esm/salon-services.entry.js +74 -0
  98. package/dist/esm/salon-stylists.entry.js +108 -0
  99. package/{esm/services-74d84ca9.js → dist/esm/services-295247b1.js} +263 -392
  100. package/dist/esm/style-detail.entry.js +306 -0
  101. package/dist/esm/user-avatar.entry.js +37 -0
  102. package/{esm → dist/esm}/utils-e97485e0.js +0 -0
  103. package/dist/favesalon-embed/assets/map--placeholder.jpeg +0 -0
  104. package/{favesalon-embed → dist/favesalon-embed}/favesalon-embed.css +1 -1
  105. package/dist/favesalon-embed/favesalon-embed.esm.js +1 -0
  106. package/dist/favesalon-embed/index.esm.js +0 -0
  107. package/dist/favesalon-embed/p-292b97ba.entry.js +1 -0
  108. package/{favesalon-embed → dist/favesalon-embed}/p-47e646f8.js +0 -0
  109. package/dist/favesalon-embed/p-4869dfed.entry.js +1 -0
  110. package/{favesalon-embed → dist/favesalon-embed}/p-4a5eca9a.js +0 -0
  111. package/dist/favesalon-embed/p-4aee4fd9.entry.js +1 -0
  112. package/dist/favesalon-embed/p-5528c705.entry.js +1 -0
  113. package/dist/favesalon-embed/p-612ad685.entry.js +1 -0
  114. package/dist/favesalon-embed/p-75aef7e0.entry.js +1 -0
  115. package/dist/favesalon-embed/p-8c780874.entry.js +1 -0
  116. package/dist/favesalon-embed/p-8dbf04c5.js +1 -0
  117. package/dist/favesalon-embed/p-9f31061a.entry.js +1 -0
  118. package/dist/favesalon-embed/p-a33331cc.js +1 -0
  119. package/dist/favesalon-embed/p-a60d78e9.entry.js +1 -0
  120. package/dist/favesalon-embed/p-a6debdae.entry.js +1 -0
  121. package/dist/favesalon-embed/p-bad1e9a7.entry.js +1 -0
  122. package/dist/favesalon-embed/p-c2ecb365.js +1 -0
  123. package/dist/favesalon-embed/p-c7dea70c.entry.js +1 -0
  124. package/{favesalon-embed → dist/favesalon-embed}/p-d6083940.js +0 -0
  125. package/dist/favesalon-embed/p-f0e14641.entry.js +1 -0
  126. package/dist/favesalon-embed/p-fc9a5551.js +6 -0
  127. package/{index.cjs.js → dist/index.cjs.js} +0 -0
  128. package/{index.js → dist/index.js} +0 -0
  129. package/dist/types/components/google-map/index.d.ts +5 -0
  130. package/{types → dist/types}/components/salon-booking/index.d.ts +0 -0
  131. package/{types → dist/types}/components/salon-booking/salon-booking-modal.d.ts +0 -0
  132. package/{types → dist/types}/components/salon-gift-card/index.d.ts +0 -0
  133. package/{types → dist/types}/components/salon-gift-card/salon-gift-card-modal.d.ts +1 -0
  134. package/{types → dist/types}/components/salon-info/index.d.ts +0 -1
  135. package/{types → dist/types}/components/salon-latest-reviews/index.d.ts +2 -0
  136. package/dist/types/components/salon-latest-styles/index.d.ts +12 -0
  137. package/{types → dist/types}/components/salon-locations/index.d.ts +2 -0
  138. package/{types → dist/types}/components/salon-lookbook/index.d.ts +3 -3
  139. package/{types → dist/types}/components/salon-ranking/index.d.ts +0 -0
  140. package/dist/types/components/salon-reviews/index.d.ts +24 -0
  141. package/{types → dist/types}/components/salon-schedules/index.d.ts +2 -0
  142. package/{types → dist/types}/components/salon-services/index.d.ts +1 -0
  143. package/{types → dist/types}/components/salon-stylists/index.d.ts +6 -0
  144. package/dist/types/components/style-detail/index.d.ts +24 -0
  145. package/{types → dist/types}/components/user-avatar/index.d.ts +0 -0
  146. package/{types → dist/types}/components.d.ts +54 -59
  147. package/dist/types/constants/colors.d.ts +65 -0
  148. package/{types → dist/types}/index.d.ts +0 -0
  149. package/dist/types/services/services.d.ts +60 -0
  150. package/{types → dist/types}/stencil-public-runtime.d.ts +0 -0
  151. package/dist/types/types/common.d.ts +11 -0
  152. package/{types → dist/types}/types/review.d.ts +4 -0
  153. package/{types → dist/types}/types/salon.d.ts +3 -1
  154. package/{types → dist/types}/types/service.d.ts +0 -0
  155. package/dist/types/types/style.d.ts +88 -0
  156. package/{types → dist/types}/types/stylist.d.ts +1 -1
  157. package/dist/types/types/tmp.d.ts +0 -0
  158. package/{types → dist/types}/types/user.d.ts +2 -2
  159. package/{types → dist/types}/utils/utils.d.ts +0 -0
  160. package/loader/cdn.js +3 -0
  161. package/loader/index.cjs.js +3 -0
  162. package/loader/index.d.ts +12 -0
  163. package/loader/index.es2017.js +3 -0
  164. package/loader/index.js +4 -0
  165. package/loader/package.json +10 -0
  166. package/package.json +18 -13
  167. package/readme.md +24 -7
  168. package/cjs/colors-7f354880.js +0 -95
  169. package/cjs/favesalon-embed.cjs.js +0 -20
  170. package/cjs/google-map.cjs.entry.js +0 -47
  171. package/cjs/index-95daad08.js +0 -1928
  172. package/cjs/loader.cjs.js +0 -22
  173. package/cjs/salon-contact_4.cjs.entry.js +0 -155
  174. package/cjs/salon-gift-card-modal.cjs.entry.js +0 -25
  175. package/cjs/salon-info.cjs.entry.js +0 -35
  176. package/cjs/salon-latest-reviews.cjs.entry.js +0 -58
  177. package/cjs/salon-lookbook-modal.cjs.entry.js +0 -141
  178. package/cjs/salon-reviews.cjs.entry.js +0 -205
  179. package/cjs/salon-services.cjs.entry.js +0 -47
  180. package/cjs/salon-stylists.cjs.entry.js +0 -54
  181. package/collection/components/google-map/index.js +0 -97
  182. package/collection/components/salon-contact/index.js +0 -88
  183. package/collection/components/salon-gift-card/index.css +0 -25
  184. package/collection/components/salon-info/index.css +0 -3
  185. package/collection/components/salon-latest-reviews/index.js +0 -108
  186. package/collection/components/salon-locations/index.js +0 -80
  187. package/collection/components/salon-lookbook/lookbook-modal.css +0 -72
  188. package/collection/components/salon-lookbook/salon-lookbook-modal.js +0 -248
  189. package/collection/components/salon-reviews/index.js +0 -317
  190. package/collection/components/salon-schedules/index.css +0 -14
  191. package/collection/components/salon-schedules/index.js +0 -103
  192. package/collection/components/salon-styles/index.css +0 -23
  193. package/collection/components/salon-styles/index.js +0 -100
  194. package/collection/components/salon-stylists/index.js +0 -96
  195. package/collection/constants/colors.js +0 -91
  196. package/collection/services/services.js +0 -225
  197. package/collection/types/common.js +0 -2
  198. package/collection/types/salon.js +0 -52
  199. package/collection/types/style.js +0 -103
  200. package/esm/colors-1ec90c5f.js +0 -93
  201. package/esm/favesalon-embed.js +0 -18
  202. package/esm/google-map.entry.js +0 -43
  203. package/esm/index-09d43e3e.js +0 -1926
  204. package/esm/loader.js +0 -18
  205. package/esm/salon-contact_4.entry.js +0 -148
  206. package/esm/salon-gift-card-modal.entry.js +0 -21
  207. package/esm/salon-info.entry.js +0 -31
  208. package/esm/salon-latest-reviews.entry.js +0 -54
  209. package/esm/salon-lookbook-modal.entry.js +0 -137
  210. package/esm/salon-reviews.entry.js +0 -201
  211. package/esm/salon-services.entry.js +0 -43
  212. package/esm/salon-stylists.entry.js +0 -50
  213. package/favesalon-embed/favesalon-embed.esm.js +0 -1
  214. package/favesalon-embed/p-0188d4dc.entry.js +0 -1
  215. package/favesalon-embed/p-0318501e.js +0 -1
  216. package/favesalon-embed/p-078f242d.entry.js +0 -1
  217. package/favesalon-embed/p-13e23c61.entry.js +0 -1
  218. package/favesalon-embed/p-17df13ad.js +0 -1
  219. package/favesalon-embed/p-1a3179c8.entry.js +0 -1
  220. package/favesalon-embed/p-20aa75de.js +0 -6
  221. package/favesalon-embed/p-2901a6d6.entry.js +0 -1
  222. package/favesalon-embed/p-2b861430.entry.js +0 -1
  223. package/favesalon-embed/p-44d810a0.js +0 -1
  224. package/favesalon-embed/p-4c68700f.entry.js +0 -1
  225. package/favesalon-embed/p-4e2d7b29.js +0 -1
  226. package/favesalon-embed/p-6b845bf1.entry.js +0 -1
  227. package/favesalon-embed/p-7350f6b5.entry.js +0 -1
  228. package/favesalon-embed/p-897c2b1c.entry.js +0 -1
  229. package/favesalon-embed/p-8e60f56f.entry.js +0 -1
  230. package/favesalon-embed/p-a49afdc1.entry.js +0 -1
  231. package/favesalon-embed/p-c93867c4.entry.js +0 -1
  232. package/favesalon-embed/p-ea6a097f.entry.js +0 -1
  233. package/types/components/google-map/index.d.ts +0 -10
  234. package/types/components/salon-contact/index.d.ts +0 -9
  235. package/types/components/salon-lookbook/salon-lookbook-modal.d.ts +0 -13
  236. package/types/components/salon-reviews/index.d.ts +0 -24
  237. package/types/components/salon-styles/index.d.ts +0 -9
  238. package/types/constants/colors.d.ts +0 -88
  239. package/types/services/services.d.ts +0 -26
  240. package/types/types/common.d.ts +0 -2
  241. package/types/types/style.d.ts +0 -59
@@ -1,7 +1,3 @@
1
- .salon-loobooks--grid-item {
2
- float: left;
3
- max-width: 150px;
4
- }
5
1
  @media (max-width: 768px) {
6
2
  salon-lookbook .view-header {
7
3
  display: block !important;
@@ -14,8 +10,3 @@
14
10
  display: none !important;
15
11
  }
16
12
  }
17
- @media (min-width: 768px) {
18
- .salon-loobooks--grid-item {
19
- max-width: 200px;
20
- }
21
- }
@@ -49,19 +49,13 @@ export class SalonLookbook {
49
49
  var masonry = new Macy({
50
50
  container: '#salon-loobooks--grid',
51
51
  useContainerForBreakpoints: true,
52
- margin: 12,
53
- columns: 7,
52
+ margin: 16,
53
+ columns: 5,
54
54
  breakAt: {
55
- 1200: {
56
- margin: 16,
57
- columns: 6,
58
- },
59
- 992: {
60
- margin: 16,
61
- columns: 5,
55
+ 1024: {
56
+ columns: 4,
62
57
  },
63
58
  768: {
64
- margin: 16,
65
59
  columns: 3,
66
60
  },
67
61
  576: {
@@ -113,7 +107,7 @@ export class SalonLookbook {
113
107
  this.salonLookbooks = [];
114
108
  this.hideLoadMore = true;
115
109
  this.filterBy = filterBy;
116
- await this.fetchLookbooks(Object.assign({ page: this.currentPage, sort: this.sortBy }, this.filterBy !== 'all' ? { services: [this.filterBy] } : {}));
110
+ await this.fetchLookbooks(Object.assign({ page: this.currentPage, sort: this.sortBy }, this.filterBy !== 'all' ? { services: [Number(this.filterBy)] } : {}));
117
111
  if (window.masonry) {
118
112
  this.isLayoutSetup = false;
119
113
  }
@@ -153,10 +147,10 @@ export class SalonLookbook {
153
147
  onClickLookbook(style) {
154
148
  const elLookbookModal = document.createElement('div');
155
149
  elLookbookModal.innerHTML = `
156
- <salon-lookbook-modal
150
+ <style-detail
157
151
  salon-id=${this.salonId}
158
152
  salon-lookbook='${JSON.stringify(style)}'
159
- ></salon-lookbook-modal>
153
+ ></style-detail>
160
154
  `;
161
155
  document.body.appendChild(elLookbookModal);
162
156
  }
@@ -205,25 +199,31 @@ export class SalonLookbook {
205
199
  h("div", { class: "view-content" },
206
200
  this.renderHeader(),
207
201
  this.salonLookbooks.length > 0 && (h("div", { class: "salon-loobooks--grid", id: "salon-loobooks--grid" }, this.salonLookbooks.map(style => {
208
- const { caption, fullImageUrlThumb, owner } = style;
202
+ const { caption, imageThumbMedium, owner } = style;
209
203
  return (h("div", { class: "salon-lookbook salon-loobooks--grid-item", onClick: () => this.onClickLookbook(style) },
210
204
  h("div", { class: "card", style: {
211
205
  background: 'none',
212
206
  border: 'none',
213
- maxWidth: '200px',
207
+ // maxWidth: '200px',
214
208
  } },
215
209
  h("div", { class: "salon-lookbook--image", style: {
216
210
  borderRadius: '8px',
217
211
  overflow: 'hidden',
218
212
  minHeight: '80px',
219
- background: Colors.Gray06,
213
+ background: Colors.Gray01,
220
214
  } },
221
- h("img", { src: fullImageUrlThumb, alt: caption })),
215
+ h("img", { src: imageThumbMedium, alt: caption, style: { maxWidth: '100%' } })),
222
216
  owner && (h("div", { class: "card-body", style: { paddingLeft: '0' } },
223
- h("user-avatar", { name: owner.name, shortName: `${(owner.firstName || '').charAt(0)}${(owner.lastName || '').charAt(0)}`, avatar: owner.avatar }))))));
217
+ h("user-avatar", { name: owner.fullName, shortName: `${(owner.firstName || '').charAt(0)}${(owner.lastName || '').charAt(0)}`, avatar: owner.avatar }))))));
224
218
  })))),
225
219
  this.salonLookbooks.length > 0 && !this.hideLoadMore && (h("div", { class: "view-footer", style: { paddingTop: '16px', textAlign: 'center' } },
226
- h("button", { type: "button", class: "btn btn-light", onClick: () => this.onLoadMore() }, this.isLoadingMore ? 'Loading' : 'Load more'))))));
220
+ h("button", { type: "button", class: "btn btn-light btn-lg", onClick: () => this.onLoadMore(), style: {
221
+ background: Colors.White,
222
+ border: `1px solid ${Colors.Gray02}`,
223
+ borderRadius: '4px',
224
+ paddingLeft: '24px',
225
+ paddingRight: '24px',
226
+ } }, this.isLoadingMore ? 'Loading' : 'Load more'))))));
227
227
  }
228
228
  static get is() { return "salon-lookbook"; }
229
229
  static get originalStyleUrls() { return {
@@ -8,30 +8,30 @@ export class SalonRanking {
8
8
  getRankingData(ranking) {
9
9
  if (ranking === 5) {
10
10
  return {
11
- color: Colors.Danger,
11
+ color: Colors.Primary,
12
12
  text: 'Viral',
13
13
  };
14
14
  }
15
15
  if (ranking === 4) {
16
16
  return {
17
- color: Colors.Pink03,
17
+ color: Colors.Orange03,
18
18
  text: 'Advancing',
19
19
  };
20
20
  }
21
21
  if (ranking === 3) {
22
22
  return {
23
- color: Colors.Orange03,
23
+ color: Colors.Lilac03,
24
24
  text: 'Progressing',
25
25
  };
26
26
  }
27
27
  if (ranking === 2) {
28
28
  return {
29
- color: Colors.DarkBlue03,
29
+ color: Colors.Blue03,
30
30
  text: 'Building',
31
31
  };
32
32
  }
33
33
  return {
34
- color: Colors.Gray01,
34
+ color: Colors.Gray05,
35
35
  text: 'Starting',
36
36
  };
37
37
  }
@@ -0,0 +1,286 @@
1
+ import { Component, Prop, h, State } from '@stencil/core';
2
+ import dayjs from 'dayjs';
3
+ import { Colors } from '../../constants/colors';
4
+ import { shortDateYearFormat } from '../../types/common';
5
+ import HttpService from '../../services/services';
6
+ const pageLimited = 10;
7
+ const sortOptions = [{
8
+ value: 'newest',
9
+ label: 'Newest first',
10
+ }, {
11
+ value: 'oldest',
12
+ label: 'Oldest first',
13
+ }, {
14
+ value: 'rating_desc',
15
+ label: 'High rating first',
16
+ }, {
17
+ value: 'rating_asc',
18
+ label: 'Low rating first',
19
+ }];
20
+ export class SalonReviews {
21
+ constructor() {
22
+ this.primaryColor = Colors.Primary;
23
+ this.stats = {};
24
+ this.totalReviews = 0;
25
+ this.allReviews = [];
26
+ this.page = 1;
27
+ this.filterBy = [];
28
+ this.sortBy = sortOptions[0].value;
29
+ }
30
+ componentWillLoad() {
31
+ this.fetchData();
32
+ }
33
+ fetchData() {
34
+ this.isLoading = true;
35
+ try {
36
+ HttpService().fetchSalonReviews(this.salonId, {
37
+ page: 1,
38
+ sort: this.sortBy,
39
+ limit: pageLimited,
40
+ }).then(response => {
41
+ const { total, stats, data: allReviews } = response;
42
+ this.stats = stats;
43
+ this.totalReviews = total;
44
+ this.allReviews = allReviews;
45
+ this.canLoadMore = total > pageLimited;
46
+ });
47
+ }
48
+ catch (e) { }
49
+ this.isLoading = false;
50
+ }
51
+ onLoadMore() {
52
+ this.isLoadingMore = true;
53
+ try {
54
+ HttpService().fetchSalonReviews(this.salonId, {
55
+ page: this.page + 1,
56
+ sort: this.sortBy,
57
+ limit: pageLimited,
58
+ }).then(response => {
59
+ const { total, data: allReviews } = response;
60
+ this.page = this.page + 1;
61
+ this.totalReviews = total;
62
+ this.allReviews = this.allReviews.concat(allReviews);
63
+ this.canLoadMore = (allReviews || []).length === pageLimited;
64
+ });
65
+ }
66
+ catch (e) { }
67
+ this.isLoadingMore = false;
68
+ }
69
+ onChangeFilter(filterBy) {
70
+ this.isFiltering = true;
71
+ try {
72
+ HttpService().fetchSalonReviews(this.salonId, Object.assign({ page: 1, sort: this.sortBy, limit: pageLimited }, filterBy.length > 0 ? { avg_point: filterBy } : {})).then(response => {
73
+ const { total, data: allReviews } = response;
74
+ this.page = 1;
75
+ this.totalReviews = total;
76
+ this.allReviews = allReviews;
77
+ this.canLoadMore = (allReviews || []).length === pageLimited;
78
+ });
79
+ }
80
+ catch (e) { }
81
+ this.isFiltering = false;
82
+ }
83
+ onChangeSorting(sortBy) {
84
+ this.isSorting = true;
85
+ try {
86
+ HttpService().fetchSalonReviews(this.salonId, Object.assign({ page: 1, sort: sortBy, limit: pageLimited }, this.filterBy.length > 0 ? { avg_point: this.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.isSorting = false;
96
+ }
97
+ render() {
98
+ const ratingTexts = ['', 'Poor', 'Sufficient', 'Average', 'Well', 'Very good'];
99
+ return (h("div", { class: "view view--salon-reviews" },
100
+ h("div", { class: "salon-reviews--filters" },
101
+ h("div", { class: "salon-reviews--score" },
102
+ h("div", { class: "salon-review--rating", style: { display: 'flex', flexDirection: 'row' } }, [1, 2, 3, 4, 5].map(score => {
103
+ return (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.Gray04 }) }));
104
+ })),
105
+ h("div", { class: "salon-review--rating--date", style: {
106
+ display: 'flex',
107
+ flexDirection: 'row',
108
+ alignItems: 'center',
109
+ marginTop: '-8px',
110
+ } },
111
+ h("span", { style: { fontSize: '24px' } },
112
+ this.stats.reviewPoint,
113
+ "/5"),
114
+ " ",
115
+ h("span", { style: { color: Colors.Gray04, marginLeft: '8px' } },
116
+ "(",
117
+ this.stats.totalReviews,
118
+ " reviews)"))),
119
+ h("div", { class: "salon-reviews--filters--options", style: { marginTop: '24px' } },
120
+ h("div", { style: {
121
+ background: Colors.Gray01,
122
+ display: 'flex',
123
+ alignItems: 'center',
124
+ borderRadius: '4px',
125
+ padding: '16px',
126
+ } },
127
+ h("div", null,
128
+ h("input", { type: "checkbox", checked: this.filterBy.length === 0, onChange: () => {
129
+ this.filterBy = [];
130
+ this.onChangeFilter([]);
131
+ } }),
132
+ " ",
133
+ h("span", { style: { marginLeft: '4px' } }, "All reviews")),
134
+ [5, 4, 3, 2, 1].map(score => {
135
+ const isChecked = this.filterBy.indexOf(score) > -1;
136
+ return (h("div", { key: `salon-reviews--filters-score--${score}`, style: { display: 'flex', alignItems: 'center', marginLeft: '16px' } },
137
+ h("input", { type: "checkbox", checked: isChecked, onChange: () => {
138
+ const newFilter = isChecked ? this.filterBy.filter(fs => fs !== score) : this.filterBy.concat([score]);
139
+ this.filterBy = newFilter;
140
+ this.onChangeFilter(newFilter);
141
+ } }),
142
+ " ",
143
+ h("span", { style: { display: 'flex', alignItems: 'center', marginLeft: '4px' } },
144
+ score,
145
+ " ",
146
+ h("i", { class: "ri-heart-line", style: {
147
+ fontSize: '16px',
148
+ marginLeft: '4px',
149
+ marginRight: '4px',
150
+ lineHeight: '1',
151
+ } }),
152
+ " ",
153
+ h("span", { style: { color: Colors.Gray04, fontSize: '12px' } },
154
+ "(",
155
+ this.stats[String(score)] || 0,
156
+ ")"))));
157
+ })))),
158
+ h("div", { class: "salon-reviews--list-header", style: {
159
+ display: 'flex',
160
+ flexDirection: 'row',
161
+ justifyContent: 'space-between',
162
+ alignItems: 'center',
163
+ marginTop: '24px',
164
+ } },
165
+ h("div", { class: "view--salon-reviews--counter" },
166
+ this.totalReviews,
167
+ " ",
168
+ this.totalReviews === 1 ? `review` : `reviews`),
169
+ h("div", { style: { display: 'flex', alignItems: 'center' } },
170
+ h("label", { style: { marginRight: '8px', color: Colors.Gray04 } }, "Sort by"),
171
+ h("select", { class: "search-filter--select", "place-holder": "Most popular", disabled: this.isLoading, onChange: (evt) => {
172
+ this.sortBy = evt.target.value;
173
+ this.onChangeSorting(evt.target.value);
174
+ }, style: {
175
+ display: 'flex',
176
+ alignItems: 'center',
177
+ backgroundColor: Colors.Gray01,
178
+ borderColor: Colors.Gray01,
179
+ borderRadius: '4px',
180
+ height: '40px',
181
+ width: '130px',
182
+ } }, sortOptions.map(sortOption => (h("option", { value: sortOption.value, selected: sortOption.value === this.sortBy, key: `search-filter--select-option--${sortOption.value}` }, sortOption.label)))))),
183
+ h("div", { class: "salon-reviews--list-content", style: { marginTop: '24px' } }, this.allReviews.map((review, idx) => {
184
+ const user = review.user || {};
185
+ return (h("div", { class: "salon-review", key: `salon-review--${idx}`, style: {
186
+ borderBottom: `1px solid ${Colors.Gray02}`,
187
+ marginBottom: '24px',
188
+ paddingBottom: '24px',
189
+ } },
190
+ h("div", { class: "salon-review--user", style: { marginBottom: '16px', overflow: 'hidden' } },
191
+ h("user-avatar", { size: 48, avatar: user.avatar, name: h("span", { style: { fontSize: '18px', fontWeight: '600', color: Colors.TextColor } }, (user.firstName || user.lastName) ? `${user.firstName || ''} ${user.lastName || ''}` : ''), shortName: `${(user.firstName || '').charAt(0)}${(user.lastName || '').charAt(0)}`, nameStyle: { fontWeight: 'bold' } })),
192
+ h("div", { class: "salon-review--rating", style: { display: 'flex', flexDirection: 'row', marginBottom: '4px' } },
193
+ [1, 2, 3, 4, 5].map(score => (h("i", { key: `salon-review--rating--item--score--${score}`, class: score <= review.point ? 'ri-heart-fill' : 'ri-heart-line', style: {
194
+ color: score <= review.point ? this.primaryColor : Colors.Gray04,
195
+ fontSize: '16px',
196
+ marginRight: '4px',
197
+ } }))),
198
+ review.createdDate && (h("div", { class: "salon-review--rating--date", style: { fontSize: '14px', color: Colors.Gray04, marginLeft: '16px', position: 'relative', top: '2px' } }, dayjs(review.createdDate).format(shortDateYearFormat)))),
199
+ h("div", { class: "salon-review--rating-text", style: { fontSize: '16px', fontWeight: '600' } }, ratingTexts[review.point]),
200
+ (review.title || review.description) && (h("div", { class: "salon-review--detail", style: { marginTop: '16px' } },
201
+ h("div", { class: "salon-review--title", style: { fontSize: '18px', fontWeight: 'bold' }, innerHTML: review.title }),
202
+ h("div", { class: "salon-review--description", style: { fontSize: '16px' }, innerHTML: review.description }))),
203
+ review.photos.length > 0 && (h("div", { style: {
204
+ display: 'flex',
205
+ flexDirection: 'row',
206
+ overflowX: 'auto',
207
+ } }, review.photos.map(fileObj => (h("div", { key: `upload-file--${fileObj.id}`, class: "review--photo", style: {
208
+ position: 'relative',
209
+ cursor: 'pointer',
210
+ marginTop: '16px',
211
+ marginRight: '12px',
212
+ } },
213
+ h("img", { width: 72, src: fileObj.imageUrlThumb, style: { display: 'block' } }))))))));
214
+ })),
215
+ h("div", { class: "salon-reviews--list-footer", style: {
216
+ textAlign: 'center',
217
+ paddingTop: '16px',
218
+ paddingBottom: '16px',
219
+ } },
220
+ h("button", { class: "btn btn-light btn-lg", style: {
221
+ background: Colors.White,
222
+ border: `1px solid ${Colors.Gray02}`,
223
+ borderRadius: '4px',
224
+ paddingLeft: '24px',
225
+ paddingRight: '24px',
226
+ }, onClick: () => this.onLoadMore() }, "Load more"))));
227
+ }
228
+ static get is() { return "salon-reviews"; }
229
+ static get originalStyleUrls() { return {
230
+ "$": ["index.less"]
231
+ }; }
232
+ static get styleUrls() { return {
233
+ "$": ["index.css"]
234
+ }; }
235
+ static get properties() { return {
236
+ "salonId": {
237
+ "type": "number",
238
+ "mutable": false,
239
+ "complexType": {
240
+ "original": "number",
241
+ "resolved": "number",
242
+ "references": {}
243
+ },
244
+ "required": false,
245
+ "optional": false,
246
+ "docs": {
247
+ "tags": [],
248
+ "text": ""
249
+ },
250
+ "attribute": "salon-id",
251
+ "reflect": false
252
+ },
253
+ "primaryColor": {
254
+ "type": "string",
255
+ "mutable": false,
256
+ "complexType": {
257
+ "original": "string",
258
+ "resolved": "string",
259
+ "references": {}
260
+ },
261
+ "required": false,
262
+ "optional": false,
263
+ "docs": {
264
+ "tags": [],
265
+ "text": ""
266
+ },
267
+ "attribute": "primary-color",
268
+ "reflect": false,
269
+ "defaultValue": "Colors.Primary"
270
+ }
271
+ }; }
272
+ static get states() { return {
273
+ "salonInfo": {},
274
+ "stats": {},
275
+ "totalReviews": {},
276
+ "allReviews": {},
277
+ "isLoading": {},
278
+ "isSorting": {},
279
+ "isFiltering": {},
280
+ "isLoadingMore": {},
281
+ "canLoadMore": {},
282
+ "page": {},
283
+ "filterBy": {},
284
+ "sortBy": {}
285
+ }; }
286
+ }
@@ -0,0 +1,15 @@
1
+ salon-schedules .salon-schedules--day {
2
+ display: flex;
3
+ flex-direction: row;
4
+ min-width: 240px;
5
+ }
6
+ @media (min-width: 768px) {
7
+ salon-schedules .salon-schedules--dates {
8
+ overflow: hidden;
9
+ margin-left: -32px;
10
+ }
11
+ salon-schedules .salon-schedules--day {
12
+ float: left;
13
+ padding-left: 32px;
14
+ }
15
+ }
@@ -0,0 +1,189 @@
1
+ import { Component, Prop, h, State } from '@stencil/core';
2
+ import { BusinessHourStatus } from '../../types/salon';
3
+ import HttpService from '../../services/services';
4
+ import { Colors } from '../../constants/colors';
5
+ export class SalonSchedules {
6
+ componentWillLoad() {
7
+ if (this.salonInfo) {
8
+ this.salonInfoState = JSON.parse(this.salonInfo);
9
+ }
10
+ else {
11
+ this.fetchData();
12
+ }
13
+ }
14
+ fetchData() {
15
+ try {
16
+ HttpService().fetchSalonInfo(this.salonId)
17
+ .then(salonInfo => this.salonInfoState = salonInfo);
18
+ }
19
+ catch (e) { }
20
+ }
21
+ renderBusinessHour(businessHour) {
22
+ if (businessHour.status === BusinessHourStatus.ByAppointment) {
23
+ return 'By Appointment';
24
+ }
25
+ if (businessHour.status === BusinessHourStatus.Close) {
26
+ return 'Close';
27
+ }
28
+ return `${businessHour.openTime} - ${businessHour.closeTime}`;
29
+ }
30
+ render() {
31
+ if (this.isLoading) {
32
+ return (h("div", { class: "view view--salon-contact" },
33
+ h("div", { class: "view-content", style: this.withBorder ? { border: `1px solid ${Colors.Gray02}`, borderRadius: '4px' } : { padding: '0px' } },
34
+ h("div", { style: {
35
+ backgroundColor: Colors.Gray02,
36
+ height: '20px',
37
+ width: '120px',
38
+ } }),
39
+ h("div", { style: { marginTop: '24px' } },
40
+ h("div", { style: {
41
+ backgroundColor: Colors.Gray01,
42
+ height: '16px',
43
+ width: '30%',
44
+ } }),
45
+ h("div", { style: {
46
+ backgroundColor: Colors.Gray01,
47
+ height: '16px',
48
+ width: '40%',
49
+ marginTop: '8px',
50
+ } }),
51
+ h("div", { style: {
52
+ backgroundColor: Colors.Gray01,
53
+ height: '16px',
54
+ width: '75%',
55
+ marginTop: '12px',
56
+ } }),
57
+ h("div", { style: {
58
+ backgroundColor: Colors.Gray01,
59
+ height: '16px',
60
+ width: '75%',
61
+ marginTop: '8px',
62
+ } })),
63
+ h("div", { style: { marginTop: '24px' } },
64
+ h("div", { style: {
65
+ overflow: 'hidden',
66
+ marginLeft: '-16px',
67
+ marginBottom: '-16px',
68
+ } }, [1, 2, 3, 4, 5, 6, 7].map((fakeId, idx) => (h("div", { key: `style-listing--item-${fakeId}-${idx}`, style: {
69
+ float: 'left',
70
+ paddingLeft: '16px',
71
+ marginBottom: '16px',
72
+ } },
73
+ h("div", { style: {
74
+ backgroundColor: Colors.Gray01,
75
+ width: '120px',
76
+ height: '20px',
77
+ } })))))))));
78
+ }
79
+ const { about, businessHours, } = (this.salonInfoState || {});
80
+ return (h("div", { class: "view view--salon-contact" },
81
+ h("div", { class: "view-content", style: this.withBorder ? { border: `1px solid ${Colors.Gray02}`, borderRadius: '4px' } : { padding: '0px' } },
82
+ h("div", { style: { fontSize: '18px', fontWeight: 'bold' } }, "About"),
83
+ about && (h("div", { class: "salon-contact--info--desc", style: { fontSize: '16px', marginTop: '16px' }, innerHTML: about })),
84
+ businessHours && businessHours.length > 0 && (h("div", { class: "salon-schedules", style: { marginTop: '24px' } },
85
+ h("div", { class: "salon-schedules--title", style: { fontSize: '16px', fontWeight: 'bold' } }, "Working hours"),
86
+ h("div", { class: "salon-schedules--dates" },
87
+ h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
88
+ h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Mon"),
89
+ h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[0]))),
90
+ h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
91
+ h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Tue"),
92
+ h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[1]))),
93
+ h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
94
+ h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Wed"),
95
+ h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[2]))),
96
+ h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
97
+ h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Thur"),
98
+ h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[3]))),
99
+ h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
100
+ h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Fri"),
101
+ h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[4]))),
102
+ h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
103
+ h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Sat"),
104
+ h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[5]))),
105
+ h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
106
+ h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Sun"),
107
+ h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[6])))))))));
108
+ }
109
+ static get is() { return "salon-schedules"; }
110
+ static get originalStyleUrls() { return {
111
+ "$": ["index.less"]
112
+ }; }
113
+ static get styleUrls() { return {
114
+ "$": ["index.css"]
115
+ }; }
116
+ static get properties() { return {
117
+ "salonId": {
118
+ "type": "number",
119
+ "mutable": false,
120
+ "complexType": {
121
+ "original": "number",
122
+ "resolved": "number",
123
+ "references": {}
124
+ },
125
+ "required": false,
126
+ "optional": false,
127
+ "docs": {
128
+ "tags": [],
129
+ "text": ""
130
+ },
131
+ "attribute": "salon-id",
132
+ "reflect": false
133
+ },
134
+ "salonInfo": {
135
+ "type": "string",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "string",
139
+ "resolved": "string",
140
+ "references": {}
141
+ },
142
+ "required": false,
143
+ "optional": true,
144
+ "docs": {
145
+ "tags": [],
146
+ "text": ""
147
+ },
148
+ "attribute": "salon-info",
149
+ "reflect": false
150
+ },
151
+ "isLoading": {
152
+ "type": "boolean",
153
+ "mutable": false,
154
+ "complexType": {
155
+ "original": "boolean",
156
+ "resolved": "boolean",
157
+ "references": {}
158
+ },
159
+ "required": false,
160
+ "optional": true,
161
+ "docs": {
162
+ "tags": [],
163
+ "text": ""
164
+ },
165
+ "attribute": "is-loading",
166
+ "reflect": false
167
+ },
168
+ "withBorder": {
169
+ "type": "boolean",
170
+ "mutable": false,
171
+ "complexType": {
172
+ "original": "boolean",
173
+ "resolved": "boolean",
174
+ "references": {}
175
+ },
176
+ "required": false,
177
+ "optional": true,
178
+ "docs": {
179
+ "tags": [],
180
+ "text": ""
181
+ },
182
+ "attribute": "with-border",
183
+ "reflect": false
184
+ }
185
+ }; }
186
+ static get states() { return {
187
+ "salonInfoState": {}
188
+ }; }
189
+ }