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,317 +0,0 @@
1
- import { Component, Prop, h, Method, State } from '@stencil/core';
2
- import dayjs from 'dayjs';
3
- import groupBy from 'lodash/groupBy';
4
- import sortBy from 'lodash/sortBy';
5
- import { css } from 'glamor';
6
- import { Colors } from '../../constants/colors';
7
- import { getRatingText } from '../../utils/utils';
8
- import { shortDate } from '../../types/common';
9
- import HttpService from '../../services/services';
10
- const pageLimited = 10;
11
- const sortOptions = [{
12
- value: 'newest',
13
- label: 'Newest first',
14
- }, {
15
- value: 'oldest',
16
- label: 'Oldest first',
17
- }, {
18
- value: 'rating_desc',
19
- label: 'High rating first',
20
- }, {
21
- value: 'rating_asc',
22
- label: 'Low rating first',
23
- }];
24
- const scoreValuesMapping = {
25
- all: 'all',
26
- star1: 1,
27
- star2: 2,
28
- star3: 3,
29
- star4: 4,
30
- star5: 5,
31
- };
32
- export class SalonReviews {
33
- constructor() {
34
- this.primaryColor = Colors.Coral03;
35
- this.totalReviews = 0;
36
- this.salonReviews = [];
37
- this.pageOffset = pageLimited;
38
- this.ratings = [scoreValuesMapping.all, 'star1', 'star2', 'star3', 'star4', 'star5'];
39
- this.sorting = sortOptions[0].value;
40
- this.renderReviewsList = () => {
41
- const ratingTexts = getRatingText();
42
- const filteredReviews = this.getFilteredReviews(this.pageOffset);
43
- const filteredReviewsCount = this.ratings.indexOf(scoreValuesMapping.all) > -1
44
- ? this.totalReviews : filteredReviews.length;
45
- return (h("div", { class: "reviews-list" },
46
- h("div", { class: "reviews-list--header", style: {
47
- display: 'flex',
48
- flexDirection: 'row',
49
- justifyContent: 'space-between',
50
- alignItems: 'center',
51
- marginBottom: '24px',
52
- } },
53
- h("div", { class: "reviews-list--couter", style: { fontWeight: 'bold' } },
54
- filteredReviewsCount,
55
- " ",
56
- filteredReviewsCount === 1 ? `review` : `reviews`),
57
- h("div", { class: "reviews-list--sorting", style: {
58
- display: 'flex',
59
- flexDirection: 'row',
60
- alignItems: 'center',
61
- } },
62
- h("label", { style: { marginRight: '8px', marginBottom: '0' } }, "Sort by"),
63
- h("select", { class: "form-select", style: { width: '160px' }, onChange: (evt) => this.onChangeSorting(evt.target.value) }, sortOptions.map(sortOption => (h("option", { value: sortOption.value, selected: sortOption.value === this.sorting }, sortOption.label)))))),
64
- h("div", { class: "view-content" }, filteredReviewsCount > 0 && filteredReviews.map(review => {
65
- const { user } = review;
66
- return (h("div", { class: "salon-review", style: {
67
- marginBottom: '24px',
68
- paddingBottom: '24px',
69
- borderBottom: `1px solid ${Colors.Gray05}`,
70
- } },
71
- h("div", { class: "salon-review--user", style: { marginBottom: '24px' } },
72
- h("user-avatar", { size: 48, avatar: user.avatar, name: user.name, shortName: `${(user.firstName || '').charAt(0)}${(user.lastName || '').charAt(0)}`, nameStyle: { fontWeight: 'bold' } })),
73
- h("div", { class: "salon-review--rating", style: { display: 'flex', flexDirection: 'row', marginBottom: '4px' } },
74
- [1, 2, 3, 4, 5].map(score => {
75
- const isHightlight = score <= review.point;
76
- return (h("i", { class: isHightlight ? 'ri-heart-fill' : 'ri-heart-line', style: Object.assign({ fontSize: '16px', marginRight: '4px' }, isHightlight ? { color: this.primaryColor } : { color: Colors.Gray03 }) }));
77
- }),
78
- review.createdDate && (h("div", { class: "salon-review--rating--date", style: { color: Colors.Gray03, marginLeft: '16px' } }, dayjs(review.createdDate).format(shortDate)))),
79
- h("div", { class: "salon-review--rating-text", style: { fontSize: '16px', fontWeight: 'bold' } }, ratingTexts[review.point]),
80
- (review.title || review.description) && (h("div", { class: "salon-review--detail", style: { marginTop: '24px' } },
81
- h("div", { class: "salon-review--title", style: { fontSize: '18px', fontWeight: 'bold' }, innerHTML: review.title }),
82
- h("div", { class: "salon-review--description", style: { fontSize: '16px' }, innerHTML: review.description }))),
83
- review.photos.length > 0 && (h("div", { style: {
84
- display: 'flex',
85
- flexDirection: 'row',
86
- overflowX: 'auto',
87
- } }, review.photos.map(fileObj => (h("div", { style: {
88
- border: '1px solid #d9d9d9',
89
- position: 'relative',
90
- cursor: 'pointer',
91
- borderRadius: '2px',
92
- height: '66px',
93
- marginTop: '16px',
94
- marginRight: '16px',
95
- } },
96
- h("img", { alt: "", src: fileObj.imageUrlThumb, height: "64", style: { width: 'auto' } }))))))));
97
- })),
98
- this.canLoadMore && (h("div", { class: "view-footer", style: { textAlign: 'center' } },
99
- h("button", { type: "button", class: "btn btn-light", onClick: () => this.onLoadMore() }, this.isLoadingMore ? 'Loading' : 'Load more')))));
100
- };
101
- }
102
- componentWillLoad() {
103
- this.fetchData();
104
- }
105
- fetchData() {
106
- try {
107
- const promises = [
108
- HttpService().fetchSalonInfo(this.salonId).then(salonInfo => this.salonInfo = salonInfo),
109
- HttpService().fetchSalonReviews(this.salonId, { limit: pageLimited }).then(response => {
110
- const { total, allItems } = response;
111
- this.totalReviews = total;
112
- this.salonReviews = allItems;
113
- if (total > pageLimited) {
114
- this.canLoadMore = true;
115
- }
116
- }),
117
- ];
118
- return Promise.all(promises);
119
- }
120
- catch (e) { }
121
- }
122
- sortReviews(filteredReviews) {
123
- return sortBy(filteredReviews, [review => {
124
- if (this.sorting === 'rating_desc') {
125
- return -review.point;
126
- }
127
- if (this.sorting === 'rating_asc') {
128
- return review.point;
129
- }
130
- const createdTime = dayjs(review.createdDate).unix();
131
- return this.sorting === 'oldest' ? createdTime : -createdTime;
132
- }]);
133
- }
134
- getFilteredReviews(pageOffset) {
135
- let filteredReviews = [...this.salonReviews];
136
- if (this.ratings.indexOf(scoreValuesMapping.all) === -1) {
137
- const reviewRatingScores = this.ratings.map(r => scoreValuesMapping[r]);
138
- filteredReviews = [...filteredReviews].filter(review => reviewRatingScores.indexOf(review.point) > -1);
139
- }
140
- const sortedReviews = this.sortReviews(filteredReviews);
141
- return pageOffset ? sortedReviews.slice(0, pageOffset) : sortedReviews;
142
- }
143
- onLoadMore() {
144
- this.isLoadingMore = true;
145
- try {
146
- this.pageOffset += pageLimited;
147
- const totalResults = this.getFilteredReviews(this.pageOffset).length;
148
- if (this.pageOffset > totalResults) {
149
- this.canLoadMore = false;
150
- }
151
- }
152
- catch (error) { }
153
- this.isLoadingMore = false;
154
- }
155
- onChangeSorting(sorting) {
156
- this.sorting = sorting;
157
- this.pageOffset = pageLimited;
158
- this.canLoadMore = this.getFilteredReviews(pageLimited).length >= pageLimited;
159
- }
160
- ;
161
- onChangeFilterRating(rating) {
162
- if (rating === scoreValuesMapping.all) {
163
- this.ratings = [scoreValuesMapping.all, 'star1', 'star2', 'star3', 'star4', 'star5'];
164
- }
165
- else if (this.ratings.indexOf(rating) > -1) {
166
- this.ratings = this.ratings.filter(r => r !== scoreValuesMapping.all && r !== rating);
167
- }
168
- else {
169
- const needFilterByAll = this.ratings.concat([rating]).filter(r => r !== scoreValuesMapping.all).length === 5;
170
- this.ratings = needFilterByAll
171
- ? [scoreValuesMapping.all, 'star1', 'star2', 'star3', 'star4', 'star5']
172
- : this.ratings.concat([rating]);
173
- }
174
- this.pageOffset = pageLimited;
175
- this.canLoadMore = this.getFilteredReviews(pageLimited).length >= pageLimited;
176
- }
177
- ;
178
- renderReviewsFilters() {
179
- const reviewsByScore = groupBy(this.salonReviews, review => review.point);
180
- const isAllChecked = this.ratings.indexOf(scoreValuesMapping.all) > -1;
181
- const inputCheckedStyle = css({
182
- outline: 'none !important',
183
- backgroundColor: `${this.primaryColor} !important`,
184
- borderColor: `${this.primaryColor} !important`,
185
- });
186
- return (h("div", { class: "salon-reviews--filters-by-ratings" },
187
- h("div", { style: {
188
- fontWeight: 'bold',
189
- marginBottom: '12px',
190
- marginTop: '32px',
191
- } }, "Filter by ratings"),
192
- h("div", { class: "salon-reviews--filters-by-ratings--options" },
193
- h("div", { class: "checkbox--wrapper", style: { marginBottom: '12px' } },
194
- h("div", { class: "checkbox--box" },
195
- h("div", { class: "form-check" },
196
- h("input", Object.assign({ type: "checkbox", class: "form-check-input", value: scoreValuesMapping.all, onChange: () => this.onChangeFilterRating(scoreValuesMapping.all), checked: isAllChecked }, isAllChecked ? inputCheckedStyle : {})),
197
- h("label", { class: "form-check-label" }, "All ratings")))),
198
- [5, 4, 3, 2, 1].filter(score => reviewsByScore[score]).map(score => {
199
- const scoreReviewCount = reviewsByScore[score].length;
200
- const isChecked = this.ratings.indexOf(scoreValuesMapping.all) > -1 || this.ratings.indexOf(`star${score}`) > -1;
201
- return (h("div", { style: {
202
- display: 'flex',
203
- flexDirection: 'row',
204
- justifyContent: 'space-between',
205
- marginBottom: '12px',
206
- } },
207
- h("div", { class: "form-check" },
208
- h("input", Object.assign({ value: "", type: "checkbox", class: "form-check-input", onChange: () => this.onChangeFilterRating(`star${score}`), checked: isChecked }, isChecked ? inputCheckedStyle : {})),
209
- h("label", { class: "form-check-label" }, [1, 2, 3, 4, 5].map(point => {
210
- const isHightlight = point <= score;
211
- return (h("i", { class: isHightlight ? 'ri-heart-fill' : 'ri-heart-line', style: { fontSize: '16px', marginRight: '4px' } }));
212
- }))),
213
- h("div", { style: { color: Colors.Gray01 } }, scoreReviewCount)));
214
- }))));
215
- }
216
- render() {
217
- const { rating } = this.salonInfo || {};
218
- return (h("div", { class: "salon-reviews", style: { display: 'flex', flexDirection: 'row' } },
219
- h("div", { class: "salon-reviews--filters", style: { width: '264px' } },
220
- h("div", { class: "salon-reviews--score" },
221
- h("div", { class: "salon-review--rating", style: { display: 'flex', flexDirection: 'row' } }, [1, 2, 3, 4, 5].map(score => {
222
- return (h("i", { class: score <= rating ? 'ri-heart-fill' : 'ri-heart-line', style: Object.assign({ fontSize: '32px', marginRight: '4px' }, score <= rating ? { color: this.primaryColor } : { color: Colors.Gray03 }) }));
223
- })),
224
- h("div", { class: "salon-review--rating--date", style: {
225
- display: 'flex',
226
- flexDirection: 'row',
227
- alignItems: 'center',
228
- marginTop: '-8px',
229
- } },
230
- h("span", { style: { fontSize: '24px' } },
231
- rating,
232
- "/5"),
233
- " ",
234
- h("span", { style: { color: Colors.Gray02, marginLeft: '8px' } },
235
- "(",
236
- this.totalReviews,
237
- " reviews)"))),
238
- h("div", { class: "salon-reviews--filters--options" }, this.renderReviewsFilters())),
239
- h("div", { class: "salon-reviews--list", style: {
240
- flexGrow: '1',
241
- flexShrink: '1',
242
- paddingLeft: '64px',
243
- } }, this.renderReviewsList())));
244
- }
245
- static get is() { return "salon-reviews"; }
246
- static get originalStyleUrls() { return {
247
- "$": ["index.less"]
248
- }; }
249
- static get styleUrls() { return {
250
- "$": ["index.css"]
251
- }; }
252
- static get properties() { return {
253
- "salonId": {
254
- "type": "number",
255
- "mutable": false,
256
- "complexType": {
257
- "original": "number",
258
- "resolved": "number",
259
- "references": {}
260
- },
261
- "required": false,
262
- "optional": false,
263
- "docs": {
264
- "tags": [],
265
- "text": ""
266
- },
267
- "attribute": "salon-id",
268
- "reflect": false
269
- },
270
- "primaryColor": {
271
- "type": "string",
272
- "mutable": false,
273
- "complexType": {
274
- "original": "string",
275
- "resolved": "string",
276
- "references": {}
277
- },
278
- "required": false,
279
- "optional": false,
280
- "docs": {
281
- "tags": [],
282
- "text": ""
283
- },
284
- "attribute": "primary-color",
285
- "reflect": false,
286
- "defaultValue": "Colors.Coral03"
287
- }
288
- }; }
289
- static get states() { return {
290
- "salonInfo": {},
291
- "totalReviews": {},
292
- "salonReviews": {},
293
- "canLoadMore": {},
294
- "isLoadingMore": {},
295
- "pageOffset": {},
296
- "ratings": {},
297
- "sorting": {}
298
- }; }
299
- static get methods() { return {
300
- "fetchData": {
301
- "complexType": {
302
- "signature": "() => Promise<any[]>",
303
- "parameters": [],
304
- "references": {
305
- "Promise": {
306
- "location": "global"
307
- }
308
- },
309
- "return": "Promise<any[]>"
310
- },
311
- "docs": {
312
- "text": "",
313
- "tags": []
314
- }
315
- }
316
- }; }
317
- }
@@ -1,14 +0,0 @@
1
- @media (min-width: 768px) {
2
- .salon-schedules--dates {
3
- overflow: hidden;
4
- margin-left: -32px;
5
- }
6
-
7
- .salon-schedules--dates .salon-schedules--day {
8
- float: left;
9
- display: flex;
10
- flex-direction: row;
11
- min-width: 240px;
12
- padding-left: 32px;
13
- }
14
- }
@@ -1,103 +0,0 @@
1
- import { Component, Prop, h, State } from '@stencil/core';
2
- import { BusinessHourStatus } from '../../types/salon';
3
- import HttpService from '../../services/services';
4
- export class SalonSchedules {
5
- componentWillLoad() {
6
- if (this.salonInfo) {
7
- this.salonInfoState = JSON.parse(this.salonInfo);
8
- }
9
- else {
10
- this.fetchData();
11
- }
12
- }
13
- fetchData() {
14
- try {
15
- HttpService().fetchSalonInfo(this.salonId)
16
- .then(salonInfo => this.salonInfoState = salonInfo);
17
- }
18
- catch (e) { }
19
- }
20
- renderBusinessHour(businessHour) {
21
- if (businessHour.status === BusinessHourStatus.ByAppointment) {
22
- return 'By Appointment';
23
- }
24
- if (businessHour.status === BusinessHourStatus.Close) {
25
- return 'Close';
26
- }
27
- return `${businessHour.openTime} - ${businessHour.closeTime}`;
28
- }
29
- render() {
30
- const businessHours = (this.salonInfoState && this.salonInfoState.businessHours) || [];
31
- return (h("div", { class: "view view--salon-schedules" },
32
- h("div", { class: "view-content" }, businessHours.length > 0 && (h("div", { class: "salon-schedules" },
33
- h("div", { class: "salon-schedules--title", style: { fontSize: '16px', fontWeight: 'bold' } }, "Working hours"),
34
- h("div", { class: "salon-schedules--dates" },
35
- h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
36
- h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Mon"),
37
- h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[0]))),
38
- h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
39
- h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Tue"),
40
- h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[1]))),
41
- h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
42
- h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Wed"),
43
- h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[2]))),
44
- h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
45
- h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Thur"),
46
- h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[3]))),
47
- h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
48
- h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Fri"),
49
- h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[4]))),
50
- h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
51
- h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Sat"),
52
- h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[5]))),
53
- h("div", { class: "salon-schedules--day", style: { marginTop: '8px' } },
54
- h("div", { class: "salon-schedules--day-name", style: { fontWeight: 'bold', minWidth: '40px' } }, "Sun"),
55
- h("div", { class: "salon-schedules--day-time" }, this.renderBusinessHour(businessHours[6])))))))));
56
- }
57
- static get is() { return "salon-schedules"; }
58
- static get originalStyleUrls() { return {
59
- "$": ["index.css"]
60
- }; }
61
- static get styleUrls() { return {
62
- "$": ["index.css"]
63
- }; }
64
- static get properties() { return {
65
- "salonId": {
66
- "type": "number",
67
- "mutable": false,
68
- "complexType": {
69
- "original": "number",
70
- "resolved": "number",
71
- "references": {}
72
- },
73
- "required": false,
74
- "optional": false,
75
- "docs": {
76
- "tags": [],
77
- "text": ""
78
- },
79
- "attribute": "salon-id",
80
- "reflect": false
81
- },
82
- "salonInfo": {
83
- "type": "string",
84
- "mutable": false,
85
- "complexType": {
86
- "original": "string",
87
- "resolved": "string",
88
- "references": {}
89
- },
90
- "required": false,
91
- "optional": true,
92
- "docs": {
93
- "tags": [],
94
- "text": ""
95
- },
96
- "attribute": "salon-info",
97
- "reflect": false
98
- }
99
- }; }
100
- static get states() { return {
101
- "salonInfoState": {}
102
- }; }
103
- }
@@ -1,23 +0,0 @@
1
- .salon-styles--item-background {
2
- -moz-filter: blur(32px);
3
- -webkit-filter: blur(32px);
4
- filter: blur(32px);
5
- }
6
-
7
- .salon-styles--item .salon-styles--item-background {
8
- z-index: 1;
9
- }
10
-
11
- .salon-styles--item .salon-styles--item-image {
12
- position: relative;
13
- z-index: 2;
14
- }
15
-
16
- .salon-styles--item .carousel-caption {
17
- padding-bottom: 0;
18
- z-index: 2;
19
- }
20
-
21
- .salon-styles--slides .carousel-control-prev {
22
- z-index: 2;
23
- }
@@ -1,100 +0,0 @@
1
- import { Component, Prop, h, Method, State } from '@stencil/core';
2
- import { Colors } from '../../constants/colors';
3
- import HttpService from '../../services/services';
4
- export class SalonStyles {
5
- componentDidLoad() {
6
- this.fetchData();
7
- }
8
- async fetchData() {
9
- try {
10
- const promises = [
11
- HttpService().fetchSalonPhotos(this.salonId).then(salonStyles => this.firstPageStyles = salonStyles),
12
- HttpService().fetchAllSalonPhotos(this.salonId, { page: 2 }).then(nestPageStyles => this.nestPageStyles = nestPageStyles),
13
- ];
14
- return Promise.all(promises);
15
- }
16
- catch (e) { }
17
- }
18
- render() {
19
- return (h("div", { class: "view view--salon-styles" },
20
- h("div", { class: "view-content" },
21
- h("div", { class: "salon-styles--slides" },
22
- h("div", { id: "salon-styles-carousel", class: "carousel slide", "data-bs-ride": "carousel" },
23
- h("div", { class: "carousel-inner" }, (this.firstPageStyles || []).concat(this.nestPageStyles || []).map((photo, index) => {
24
- const { caption, description,
25
- // mediaType,
26
- fullImageUrl, fullImageUrlThumb, fullImageUrlMedium, imgWidth, imgHeight, } = photo;
27
- const isLandscape = imgWidth >= imgHeight;
28
- return (h("div", { class: `carousel-item ${index === 0 ? 'active' : ''}` },
29
- h("div", { class: "salon-styles--item", style: {
30
- flexDirection: isLandscape ? 'column' : 'row',
31
- justifyContent: 'center',
32
- alignItems: 'center',
33
- overflow: 'hidden',
34
- position: 'relative',
35
- display: 'flex',
36
- height: '380px',
37
- borderRadius: '8px',
38
- } },
39
- h("div", { class: "salon-styles--item-background", style: Object.assign(Object.assign({}, fullImageUrlThumb ? { backgroundImage: `url(${fullImageUrlThumb})` } : {}), { backgroundColor: Colors.Gray06, backgroundPosition: 'center', backgroundRepeat: 'no-repeat', backgroundSize: 'cover', position: 'absolute', bottom: '0px', right: '0px', left: '0px', top: '0px' }) }),
40
- h("img", { alt: caption, class: "salon-styles--item-image", src: fullImageUrlMedium || fullImageUrl, style: Object.assign({ display: 'inline-block' }, isLandscape ? { width: '100%' } : { height: '100%' }) }),
41
- h("div", { class: "carousel-caption d-none d-md-block" },
42
- caption && h("h5", null, caption),
43
- description && h("p", null, description)))));
44
- })),
45
- h("button", { type: "button", "data-bs-slide": "prev", class: "carousel-control-prev", "data-bs-target": "#salon-styles-carousel" },
46
- h("span", { class: "carousel-control-prev-icon", "aria-hidden": "true" }),
47
- h("span", { class: "visually-hidden" }, "Previous")),
48
- h("button", { type: "button", "data-bs-slide": "next", class: "carousel-control-next", "data-bs-target": "#salon-styles-carousel" },
49
- h("span", { class: "carousel-control-next-icon", "aria-hidden": "true" }),
50
- h("span", { class: "visually-hidden" }, "Next")))))));
51
- }
52
- static get is() { return "salon-styles"; }
53
- static get originalStyleUrls() { return {
54
- "$": ["index.css"]
55
- }; }
56
- static get styleUrls() { return {
57
- "$": ["index.css"]
58
- }; }
59
- static get properties() { return {
60
- "salonId": {
61
- "type": "number",
62
- "mutable": false,
63
- "complexType": {
64
- "original": "number",
65
- "resolved": "number",
66
- "references": {}
67
- },
68
- "required": false,
69
- "optional": false,
70
- "docs": {
71
- "tags": [],
72
- "text": ""
73
- },
74
- "attribute": "salon-id",
75
- "reflect": false
76
- }
77
- }; }
78
- static get states() { return {
79
- "firstPageStyles": {},
80
- "nestPageStyles": {}
81
- }; }
82
- static get methods() { return {
83
- "fetchData": {
84
- "complexType": {
85
- "signature": "() => Promise<any[]>",
86
- "parameters": [],
87
- "references": {
88
- "Promise": {
89
- "location": "global"
90
- }
91
- },
92
- "return": "Promise<any[]>"
93
- },
94
- "docs": {
95
- "text": "",
96
- "tags": []
97
- }
98
- }
99
- }; }
100
- }
@@ -1,96 +0,0 @@
1
- import { Component, Prop, h, Method, State } from '@stencil/core';
2
- import { Colors } from '../../constants/colors';
3
- import HttpService from '../../services/services';
4
- export class SalonStylists {
5
- componentWillLoad() {
6
- this.fetchData();
7
- }
8
- async fetchData() {
9
- try {
10
- this.salonStylists = await HttpService().fetchSalonStylists(this.salonId);
11
- }
12
- catch (e) { }
13
- }
14
- render() {
15
- return (h("div", { class: "view--salon-stylists" }, (this.salonStylists || []).map(stylist => (h("div", { class: "salon-stylist" },
16
- h("div", { class: "card", style: {
17
- border: `1px solid ${Colors.Gray05}`,
18
- borderRadius: '8px',
19
- overflow: 'hidden',
20
- } },
21
- h("div", { class: "salon-stylist--avatar", style: {
22
- backgroundImage: `url("${stylist.avatar}")`,
23
- backgroundColor: Colors.Gray06,
24
- backgroundRepeat: 'no-repeat',
25
- backgroundPosition: 'center top',
26
- backgroundSize: 'cover',
27
- position: 'relative',
28
- display: 'flex',
29
- width: '100%',
30
- alignItems: 'center',
31
- justifyContent: 'center',
32
- } }, !stylist.avatar && (h("span", { style: {
33
- fontSize: '32px',
34
- fontWeight: 'bold',
35
- textTransform: 'uppercase',
36
- } },
37
- (stylist.firstName || '').charAt(0),
38
- " ",
39
- (stylist.lastName || '').charAt(0)))),
40
- h("div", { class: "card-body" },
41
- h("div", { style: {
42
- fontSize: '16px',
43
- fontWeight: 'bold',
44
- textAlign: 'center',
45
- } }, stylist.name),
46
- h("div", { style: { marginTop: '4px' } },
47
- h("salon-ranking", { ranking: stylist.rating })))))))));
48
- }
49
- static get is() { return "salon-stylists"; }
50
- static get originalStyleUrls() { return {
51
- "$": ["index.css"]
52
- }; }
53
- static get styleUrls() { return {
54
- "$": ["index.css"]
55
- }; }
56
- static get properties() { return {
57
- "salonId": {
58
- "type": "number",
59
- "mutable": false,
60
- "complexType": {
61
- "original": "number",
62
- "resolved": "number",
63
- "references": {}
64
- },
65
- "required": false,
66
- "optional": false,
67
- "docs": {
68
- "tags": [],
69
- "text": ""
70
- },
71
- "attribute": "salon-id",
72
- "reflect": false
73
- }
74
- }; }
75
- static get states() { return {
76
- "salonStylists": {}
77
- }; }
78
- static get methods() { return {
79
- "fetchData": {
80
- "complexType": {
81
- "signature": "() => Promise<void>",
82
- "parameters": [],
83
- "references": {
84
- "Promise": {
85
- "location": "global"
86
- }
87
- },
88
- "return": "Promise<void>"
89
- },
90
- "docs": {
91
- "text": "",
92
- "tags": []
93
- }
94
- }
95
- }; }
96
- }