favesalon-embed 0.0.2 → 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 (240) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/_commonjsHelpers-5cfcba41.js +36 -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/dist/cjs/index-7f190886.js +4396 -0
  8. package/{cjs/index-7d179a70.js → dist/cjs/index-e6bea8f5.js} +87 -3
  9. package/{cjs → dist/cjs}/index.cjs.js +0 -0
  10. package/dist/cjs/loader.cjs.js +22 -0
  11. package/dist/cjs/salon-booking-modal.cjs.entry.js +29 -0
  12. package/dist/cjs/salon-booking.cjs.entry.js +50 -0
  13. package/dist/cjs/salon-gift-card-modal.cjs.entry.js +28 -0
  14. package/dist/cjs/salon-gift-card.cjs.entry.js +50 -0
  15. package/dist/cjs/salon-latest-reviews.cjs.entry.js +95 -0
  16. package/dist/cjs/salon-lookbook.cjs.entry.js +218 -0
  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-d6f8214c.js → dist/cjs/services-eee8f251.js} +317 -361
  22. package/dist/cjs/style-detail.cjs.entry.js +310 -0
  23. package/{cjs → dist/cjs}/user-avatar.cjs.entry.js +4 -4
  24. package/{cjs → dist/cjs}/utils-c5a33b3c.js +0 -0
  25. package/{collection → dist/collection}/collection-manifest.json +2 -2
  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 +29 -11
  31. package/{collection → dist/collection}/components/salon-booking/salon-booking-modal.js +12 -6
  32. package/dist/collection/components/salon-gift-card/index.css +25 -0
  33. package/{collection → dist/collection}/components/salon-gift-card/index.js +44 -6
  34. package/{collection → dist/collection}/components/salon-gift-card/salon-gift-card-modal.js +30 -4
  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/dist/collection/components/salon-lookbook/index.css +12 -0
  44. package/{collection → dist/collection}/components/salon-lookbook/index.js +122 -49
  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/dist/collection/components/salon-reviews/index.css +15 -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/components/salon-reviews → dist/collection/components/salon-services}/index.css +0 -0
  52. package/dist/collection/components/salon-services/index.js +156 -0
  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/components/salon-services → 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/dist/collection/types/stylist.js +30 -0
  69. package/{collection/components/user-avatar/index.css → 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 -12
  73. package/{custom-elements → dist/custom-elements}/index.js +5783 -870
  74. package/dist/esm/_commonjsHelpers-098d5b27.js +32 -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-2160b80b.js → dist/esm/index-6af0a03d.js} +87 -4
  80. package/dist/esm/index-80523fec.js +4393 -0
  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/dist/esm/salon-booking-modal.entry.js +25 -0
  90. package/dist/esm/salon-booking.entry.js +46 -0
  91. package/dist/esm/salon-gift-card-modal.entry.js +24 -0
  92. package/dist/esm/salon-gift-card.entry.js +46 -0
  93. package/dist/esm/salon-latest-reviews.entry.js +91 -0
  94. package/dist/esm/salon-lookbook.entry.js +214 -0
  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-57fadd0a.js → dist/esm/services-295247b1.js} +310 -355
  100. package/dist/esm/style-detail.entry.js +306 -0
  101. package/{esm → dist/esm}/user-avatar.entry.js +4 -4
  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/{favesalon-embed → 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/dist/favesalon-embed/p-d6083940.js +1 -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 +1 -1
  131. package/{types → dist/types}/components/salon-booking/salon-booking-modal.d.ts +1 -0
  132. package/{types → dist/types}/components/salon-gift-card/index.d.ts +2 -1
  133. package/{types → dist/types}/components/salon-gift-card/salon-gift-card-modal.d.ts +2 -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 +7 -2
  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 +2 -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 +62 -41
  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 +2 -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 +23 -2
  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/loader.cjs.js +0 -22
  172. package/cjs/salon-booking-modal.cjs.entry.js +0 -23
  173. package/cjs/salon-booking_2.cjs.entry.js +0 -56
  174. package/cjs/salon-contact_4.cjs.entry.js +0 -154
  175. package/cjs/salon-gift-card-modal.cjs.entry.js +0 -20
  176. package/cjs/salon-info.cjs.entry.js +0 -34
  177. package/cjs/salon-latest-reviews.cjs.entry.js +0 -57
  178. package/cjs/salon-lookbook.cjs.entry.js +0 -187
  179. package/cjs/salon-reviews.cjs.entry.js +0 -196
  180. package/cjs/salon-services.cjs.entry.js +0 -40
  181. package/cjs/salon-stylists.cjs.entry.js +0 -53
  182. package/collection/components/google-map/index.js +0 -97
  183. package/collection/components/salon-contact/index.js +0 -88
  184. package/collection/components/salon-gift-card/index.css +0 -25
  185. package/collection/components/salon-info/index.css +0 -3
  186. package/collection/components/salon-latest-reviews/index.js +0 -108
  187. package/collection/components/salon-locations/index.js +0 -80
  188. package/collection/components/salon-lookbook/index.css +0 -12
  189. package/collection/components/salon-reviews/index.js +0 -291
  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-services/index.js +0 -86
  193. package/collection/components/salon-styles/index.css +0 -23
  194. package/collection/components/salon-styles/index.js +0 -100
  195. package/collection/components/salon-stylists/index.js +0 -96
  196. package/collection/constants/colors.js +0 -91
  197. package/collection/services/services.js +0 -203
  198. package/collection/types/common.js +0 -2
  199. package/collection/types/salon.js +0 -52
  200. package/collection/types/style.js +0 -28
  201. package/collection/types/stylist.js +0 -13
  202. package/esm/colors-1ec90c5f.js +0 -93
  203. package/esm/favesalon-embed.js +0 -18
  204. package/esm/google-map.entry.js +0 -43
  205. package/esm/loader.js +0 -18
  206. package/esm/salon-booking-modal.entry.js +0 -19
  207. package/esm/salon-booking_2.entry.js +0 -51
  208. package/esm/salon-contact_4.entry.js +0 -147
  209. package/esm/salon-gift-card-modal.entry.js +0 -16
  210. package/esm/salon-info.entry.js +0 -30
  211. package/esm/salon-latest-reviews.entry.js +0 -53
  212. package/esm/salon-lookbook.entry.js +0 -183
  213. package/esm/salon-reviews.entry.js +0 -192
  214. package/esm/salon-services.entry.js +0 -36
  215. package/esm/salon-stylists.entry.js +0 -49
  216. package/favesalon-embed/favesalon-embed.esm.js +0 -1
  217. package/favesalon-embed/p-14a46adf.entry.js +0 -1
  218. package/favesalon-embed/p-2da2ed75.js +0 -1
  219. package/favesalon-embed/p-3712d9ab.entry.js +0 -1
  220. package/favesalon-embed/p-38066f9f.entry.js +0 -1
  221. package/favesalon-embed/p-4e2d7b29.js +0 -1
  222. package/favesalon-embed/p-520c8ffb.entry.js +0 -1
  223. package/favesalon-embed/p-54a1c294.entry.js +0 -1
  224. package/favesalon-embed/p-762520f2.js +0 -1
  225. package/favesalon-embed/p-94a0991e.entry.js +0 -1
  226. package/favesalon-embed/p-94b179eb.entry.js +0 -1
  227. package/favesalon-embed/p-977bd8bc.entry.js +0 -1
  228. package/favesalon-embed/p-bc363938.entry.js +0 -1
  229. package/favesalon-embed/p-bf9c83a3.entry.js +0 -1
  230. package/favesalon-embed/p-c5ebd3c9.entry.js +0 -1
  231. package/favesalon-embed/p-d84b61b0.entry.js +0 -1
  232. package/favesalon-embed/p-f15bcb43.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-reviews/index.d.ts +0 -23
  236. package/types/components/salon-styles/index.d.ts +0 -9
  237. package/types/constants/colors.d.ts +0 -88
  238. package/types/services/services.d.ts +0 -24
  239. package/types/types/common.d.ts +0 -2
  240. package/types/types/style.d.ts +0 -49
@@ -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
+ }
@@ -0,0 +1,156 @@
1
+ import { Component, Prop, h, Method, State } from '@stencil/core';
2
+ import sortBy from 'lodash/sortBy';
3
+ import { Colors } from '../../constants/colors';
4
+ import HttpService from '../../services/services';
5
+ export class SalonServices {
6
+ constructor() {
7
+ this.buttonClass = 'btn btn-light';
8
+ }
9
+ componentWillLoad() {
10
+ this.fetchData();
11
+ }
12
+ async fetchData() {
13
+ this.isLoading = true;
14
+ try {
15
+ this.salonServices = await HttpService().fetchSalonServices(this.salonId);
16
+ }
17
+ catch (e) {
18
+ this.salonServices = [];
19
+ }
20
+ this.isLoading = false;
21
+ }
22
+ render() {
23
+ if (this.isLoading) {
24
+ return (h("div", { class: "salon-services--container" },
25
+ h("div", { class: "view view--salon-services--header", style: { border: `1px solid ${Colors.Gray01}` } },
26
+ h("div", { class: "view-content", style: { overflowX: 'auto' } },
27
+ h("div", { style: { whiteSpace: 'nowrap', overflow: 'hidden' } }, [1, 2, 3, 4, 5, 6].map((fakeId, index) => (h("div", { key: `service-group--${fakeId}--${index}`, style: {
28
+ backgroundColor: Colors.Gray02,
29
+ float: 'left',
30
+ marginRight: '12px',
31
+ height: '30px',
32
+ width: '120px',
33
+ } })))))),
34
+ [1, 2, 3, 4, 5, 6].map((fakeId, index) => {
35
+ return (h("div", { id: `service-group--${fakeId}`, style: { marginTop: '32px' } },
36
+ h("div", { key: `service-group--${fakeId}--${index}`, style: {
37
+ backgroundColor: Colors.Gray03,
38
+ height: '20px',
39
+ width: '120px',
40
+ } }),
41
+ h("div", { class: "view view--salon-service-type", style: { border: `1px solid ${Colors.Gray01}`, marginTop: '12px' } },
42
+ h("div", { class: "view-content" }, [1, 2, 3].map((fakeGroupId, fakeGroupIndex) => (h("div", { key: `service-group--${fakeId}--service-${fakeGroupId}--${fakeGroupIndex}`, class: "salon-service" },
43
+ h("div", { class: "salon-service--name", style: Object.assign({}, fakeGroupIndex > 0 ? {
44
+ marginTop: '12px',
45
+ paddingTop: '12px',
46
+ borderTop: `1px solid ${Colors.Gray01}`,
47
+ } : {}) },
48
+ h("div", { key: `service-group--${fakeId}--${index}`, style: {
49
+ backgroundColor: Colors.Gray01,
50
+ height: '16px',
51
+ width: '120px',
52
+ } })),
53
+ h("div", { style: { marginTop: '4px' } },
54
+ h("div", { style: {
55
+ backgroundColor: Colors.Gray01,
56
+ height: '16px',
57
+ width: '240px',
58
+ } })))))))));
59
+ })));
60
+ }
61
+ return (h("div", { class: "salon-services--container" },
62
+ h("div", { class: "view view--salon-services--header", style: { border: `1px solid ${Colors.Gray02}` } },
63
+ h("div", { class: "view-content", style: { overflowX: 'auto' } },
64
+ h("div", { style: { whiteSpace: 'nowrap' } }, sortBy(this.salonServices || [], (['order', 'name'])).map((serviceGroup, index) => (h("a", { href: `#service-group--${serviceGroup.id}` },
65
+ h("button", { type: "button", class: this.buttonClass, style: index > 0 ? { marginLeft: '12px' } : {} }, serviceGroup.name))))))),
66
+ sortBy(this.salonServices || [], (['order', 'name'])).map(serviceGroup => {
67
+ const hasMultipleCates = (serviceGroup.data || []).length > 1;
68
+ return (h("div", { id: `service-group--${serviceGroup.id}`, style: { marginTop: '32px' } },
69
+ h("h3", { style: { fontSize: '24px', marginBottom: '12px' } }, serviceGroup.name),
70
+ h("div", { class: "view view--salon-service-type", style: { border: `1px solid ${Colors.Gray02}` } },
71
+ h("div", { class: "view-content" }, (serviceGroup.data || []).map((subGroup, subGroupIndex) => (h("div", { class: "salon-service-category" },
72
+ hasMultipleCates && (h("h4", { style: Object.assign({ fontSize: '20px', marginBottom: '12px', paddingBottom: '12px', borderBottom: `1px solid ${Colors.Gray02}` }, subGroupIndex > 0 ? { marginTop: '32px' } : {}) }, subGroup.name)),
73
+ (subGroup.data || []).map((service, serviceIndex) => (h("div", { class: "salon-service" },
74
+ h("div", { class: "salon-service--name", style: Object.assign({ fontSize: '16px', fontWeight: '500' }, serviceIndex > 0 ? {
75
+ marginTop: '12px',
76
+ paddingTop: '12px',
77
+ borderTop: `1px solid ${Colors.Gray01}`,
78
+ } : {}) }, service.name),
79
+ (!service.hideDuration || !service.hidePrice) && (h("div", { style: {
80
+ display: 'block',
81
+ marginTop: '4px',
82
+ fontSize: '90%',
83
+ color: Colors.Gray05,
84
+ } }, [
85
+ !service.hideDuration ? `${service.duration} mins` : '',
86
+ !service.hidePrice ? `$${service.price}` : '',
87
+ ].filter(field => !!field).join(' · ')))))))))))));
88
+ })));
89
+ }
90
+ static get is() { return "salon-services"; }
91
+ static get originalStyleUrls() { return {
92
+ "$": ["index.less"]
93
+ }; }
94
+ static get styleUrls() { return {
95
+ "$": ["index.css"]
96
+ }; }
97
+ static get properties() { return {
98
+ "salonId": {
99
+ "type": "number",
100
+ "mutable": false,
101
+ "complexType": {
102
+ "original": "number",
103
+ "resolved": "number",
104
+ "references": {}
105
+ },
106
+ "required": false,
107
+ "optional": false,
108
+ "docs": {
109
+ "tags": [],
110
+ "text": ""
111
+ },
112
+ "attribute": "salon-id",
113
+ "reflect": false
114
+ },
115
+ "buttonClass": {
116
+ "type": "string",
117
+ "mutable": false,
118
+ "complexType": {
119
+ "original": "string",
120
+ "resolved": "string",
121
+ "references": {}
122
+ },
123
+ "required": false,
124
+ "optional": false,
125
+ "docs": {
126
+ "tags": [],
127
+ "text": ""
128
+ },
129
+ "attribute": "button-class",
130
+ "reflect": false,
131
+ "defaultValue": "'btn btn-light'"
132
+ }
133
+ }; }
134
+ static get states() { return {
135
+ "salonServices": {},
136
+ "isLoading": {}
137
+ }; }
138
+ static get methods() { return {
139
+ "fetchData": {
140
+ "complexType": {
141
+ "signature": "() => Promise<void>",
142
+ "parameters": [],
143
+ "references": {
144
+ "Promise": {
145
+ "location": "global"
146
+ }
147
+ },
148
+ "return": "Promise<void>"
149
+ },
150
+ "docs": {
151
+ "text": "",
152
+ "tags": []
153
+ }
154
+ }
155
+ }; }
156
+ }