favesalon-embed 0.0.3 → 0.0.5

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 (237) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/_commonjsHelpers-5cfcba41.js +36 -0
  3. package/dist/cjs/chat-button.cjs.entry.js +118 -0
  4. package/dist/cjs/colors-38421769.js +69 -0
  5. package/dist/cjs/favesalon-embed.cjs.js +24 -0
  6. package/dist/cjs/google-map_5.cjs.entry.js +310 -0
  7. package/{cjs/index-7d179a70.js → dist/cjs/index-47c2a5f6.js} +587 -199
  8. package/dist/cjs/index-7f190886.js +4396 -0
  9. package/dist/cjs/loader.cjs.js +23 -0
  10. package/dist/cjs/relativeTime-3721080d.js +9 -0
  11. package/dist/cjs/salon-booking-modal.cjs.entry.js +30 -0
  12. package/dist/cjs/salon-booking.cjs.entry.js +51 -0
  13. package/dist/cjs/salon-gift-card-modal.cjs.entry.js +29 -0
  14. package/dist/cjs/salon-gift-card.cjs.entry.js +51 -0
  15. package/dist/cjs/salon-latest-reviews.cjs.entry.js +97 -0
  16. package/dist/cjs/salon-lookbook.cjs.entry.js +222 -0
  17. package/dist/cjs/salon-ranking.cjs.entry.js +60 -0
  18. package/dist/cjs/salon-reviews.cjs.entry.js +193 -0
  19. package/dist/cjs/salon-services.cjs.entry.js +81 -0
  20. package/dist/cjs/salon-stylists.cjs.entry.js +118 -0
  21. package/dist/cjs/services-125c82d8.js +21492 -0
  22. package/dist/cjs/style-detail.cjs.entry.js +312 -0
  23. package/dist/cjs/user-avatar.cjs.entry.js +45 -0
  24. package/dist/cjs/utils-c5a33b3c.js +23 -0
  25. package/{collection → dist/collection}/collection-manifest.json +5 -4
  26. package/dist/collection/components/chat-button/index.css +122 -0
  27. package/dist/collection/components/chat-button/index.js +218 -0
  28. package/dist/collection/components/chat-conversation/index.js +103 -0
  29. package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
  30. package/{collection → dist/collection}/components/google-map/index.css +0 -1
  31. package/dist/collection/components/google-map/index.js +90 -0
  32. package/{collection → dist/collection}/components/salon-booking/index.css +11 -20
  33. package/dist/collection/components/salon-booking/index.js +126 -0
  34. package/dist/collection/components/salon-booking/salon-booking-modal.js +92 -0
  35. package/dist/collection/components/salon-gift-card/index.css +30 -0
  36. package/dist/collection/components/salon-gift-card/index.js +126 -0
  37. package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +73 -0
  38. package/dist/collection/components/salon-info/index.js +77 -0
  39. package/dist/collection/components/salon-latest-reviews/index.js +163 -0
  40. package/dist/collection/components/salon-latest-styles/index.css +12 -0
  41. package/dist/collection/components/salon-latest-styles/index.js +183 -0
  42. package/{collection/components/salon-contact → dist/collection/components/salon-locations}/index.css +7 -4
  43. package/dist/collection/components/salon-locations/index.js +143 -0
  44. package/dist/collection/components/salon-lookbook/index.css +15 -0
  45. package/dist/collection/components/salon-lookbook/index.js +368 -0
  46. package/dist/collection/components/salon-ranking/index.js +117 -0
  47. package/dist/collection/components/salon-reviews/index.css +18 -0
  48. package/dist/collection/components/salon-reviews/index.js +249 -0
  49. package/dist/collection/components/salon-schedules/index.css +18 -0
  50. package/dist/collection/components/salon-schedules/index.js +167 -0
  51. package/dist/collection/components/salon-services/index.css +1 -0
  52. package/dist/collection/components/salon-services/index.js +146 -0
  53. package/dist/collection/components/salon-stylists/index.js +184 -0
  54. package/dist/collection/components/style-detail/index.css +76 -0
  55. package/dist/collection/components/style-detail/index.js +386 -0
  56. package/dist/collection/components/user-avatar/index.js +134 -0
  57. package/dist/collection/constants/colors.js +65 -0
  58. package/dist/collection/mocks/users.js +10 -0
  59. package/dist/collection/services/services.js +295 -0
  60. package/dist/collection/types/chat.js +23 -0
  61. package/dist/collection/types/common.js +11 -0
  62. package/{collection → dist/collection}/types/review.js +9 -5
  63. package/dist/collection/types/salon.js +58 -0
  64. package/dist/collection/types/style.js +128 -0
  65. package/dist/collection/types/stylist.js +30 -0
  66. package/dist/collection/types/user.js +10 -0
  67. package/{custom-elements → dist/custom-elements}/index.d.ts +18 -12
  68. package/dist/custom-elements/index.js +28340 -0
  69. package/dist/esm/_commonjsHelpers-098d5b27.js +32 -0
  70. package/dist/esm/chat-button.entry.js +114 -0
  71. package/dist/esm/colors-ea36347a.js +67 -0
  72. package/dist/esm/favesalon-embed.js +19 -0
  73. package/dist/esm/google-map_5.entry.js +302 -0
  74. package/{esm/index-2160b80b.js → dist/esm/index-3fae868e.js} +586 -200
  75. package/dist/esm/index-80523fec.js +4393 -0
  76. package/dist/esm/index.js +1 -0
  77. package/dist/esm/loader.js +19 -0
  78. package/dist/esm/polyfills/css-shim.js +1 -0
  79. package/dist/esm/relativeTime-cd452e6d.js +7 -0
  80. package/dist/esm/salon-booking-modal.entry.js +26 -0
  81. package/dist/esm/salon-booking.entry.js +47 -0
  82. package/dist/esm/salon-gift-card-modal.entry.js +25 -0
  83. package/dist/esm/salon-gift-card.entry.js +47 -0
  84. package/dist/esm/salon-latest-reviews.entry.js +93 -0
  85. package/dist/esm/salon-lookbook.entry.js +218 -0
  86. package/dist/esm/salon-ranking.entry.js +56 -0
  87. package/dist/esm/salon-reviews.entry.js +189 -0
  88. package/dist/esm/salon-services.entry.js +77 -0
  89. package/dist/esm/salon-stylists.entry.js +114 -0
  90. package/dist/esm/services-40a3e622.js +21485 -0
  91. package/dist/esm/style-detail.entry.js +308 -0
  92. package/dist/esm/user-avatar.entry.js +41 -0
  93. package/dist/esm/utils-e97485e0.js +19 -0
  94. package/dist/favesalon-embed/assets/map--placeholder.jpeg +0 -0
  95. package/{favesalon-embed → dist/favesalon-embed}/favesalon-embed.css +1 -1
  96. package/dist/favesalon-embed/favesalon-embed.esm.js +1 -0
  97. package/dist/favesalon-embed/p-019c5ccd.entry.js +1 -0
  98. package/dist/favesalon-embed/p-083a8821.entry.js +1 -0
  99. package/dist/favesalon-embed/p-0d0ed9ea.entry.js +1 -0
  100. package/dist/favesalon-embed/p-119db8de.entry.js +1 -0
  101. package/dist/favesalon-embed/p-1432c51b.entry.js +1 -0
  102. package/dist/favesalon-embed/p-22093506.entry.js +1 -0
  103. package/dist/favesalon-embed/p-32b314e9.js +2 -0
  104. package/dist/favesalon-embed/p-47e646f8.js +1 -0
  105. package/dist/favesalon-embed/p-4a5eca9a.js +6 -0
  106. package/dist/favesalon-embed/p-58d2e9be.js +1 -0
  107. package/dist/favesalon-embed/p-71404b6a.entry.js +1 -0
  108. package/dist/favesalon-embed/p-857c3a61.entry.js +1 -0
  109. package/dist/favesalon-embed/p-99ec77f7.entry.js +1 -0
  110. package/dist/favesalon-embed/p-a33331cc.js +1 -0
  111. package/dist/favesalon-embed/p-b0c3673a.entry.js +1 -0
  112. package/dist/favesalon-embed/p-b287b1ea.entry.js +1 -0
  113. package/dist/favesalon-embed/p-b3af7842.entry.js +1 -0
  114. package/dist/favesalon-embed/p-b630ae68.js +1580 -0
  115. package/dist/favesalon-embed/p-ce2c1c9a.entry.js +1 -0
  116. package/dist/favesalon-embed/p-d6083940.js +1 -0
  117. package/dist/favesalon-embed/p-d9b7ad58.entry.js +1 -0
  118. package/dist/favesalon-embed/p-fc9a5551.js +6 -0
  119. package/dist/types/components/chat-button/index.d.ts +24 -0
  120. package/dist/types/components/google-map/index.d.ts +5 -0
  121. package/{types → dist/types}/components/salon-booking/salon-booking-modal.d.ts +1 -0
  122. package/{types → dist/types}/components/salon-gift-card/index.d.ts +2 -1
  123. package/{types → dist/types}/components/salon-gift-card/salon-gift-card-modal.d.ts +2 -0
  124. package/{types → dist/types}/components/salon-info/index.d.ts +0 -1
  125. package/{types → dist/types}/components/salon-latest-reviews/index.d.ts +2 -0
  126. package/dist/types/components/salon-latest-styles/index.d.ts +12 -0
  127. package/{types → dist/types}/components/salon-locations/index.d.ts +2 -0
  128. package/{types → dist/types}/components/salon-lookbook/index.d.ts +7 -2
  129. package/dist/types/components/salon-reviews/index.d.ts +24 -0
  130. package/{types → dist/types}/components/salon-schedules/index.d.ts +2 -0
  131. package/{types → dist/types}/components/salon-services/index.d.ts +1 -0
  132. package/{types → dist/types}/components/salon-stylists/index.d.ts +6 -0
  133. package/dist/types/components/style-detail/index.d.ts +24 -0
  134. package/{types → dist/types}/components.d.ts +82 -41
  135. package/dist/types/constants/colors.d.ts +65 -0
  136. package/dist/types/mocks/users.d.ts +10 -0
  137. package/dist/types/services/services.d.ts +75 -0
  138. package/{types → dist/types}/stencil-public-runtime.d.ts +85 -11
  139. package/dist/types/types/chat.d.ts +17 -0
  140. package/dist/types/types/common.d.ts +11 -0
  141. package/{types → dist/types}/types/review.d.ts +4 -0
  142. package/{types → dist/types}/types/salon.d.ts +3 -1
  143. package/dist/types/types/style.d.ts +88 -0
  144. package/{types → dist/types}/types/stylist.d.ts +2 -1
  145. package/{types → dist/types}/types/user.d.ts +2 -2
  146. package/loader/cdn.js +3 -0
  147. package/loader/index.cjs.js +3 -0
  148. package/loader/index.d.ts +21 -0
  149. package/loader/index.es2017.js +3 -0
  150. package/loader/index.js +4 -0
  151. package/loader/package.json +11 -0
  152. package/package.json +19 -14
  153. package/readme.md +25 -2
  154. package/cjs/favesalon-embed.cjs.js +0 -20
  155. package/cjs/google-map_15.cjs.entry.js +0 -6632
  156. package/cjs/loader.cjs.js +0 -22
  157. package/cjs/salon-booking-modal.cjs.entry.js +0 -23
  158. package/cjs/salon-gift-card-modal.cjs.entry.js +0 -20
  159. package/collection/components/google-map/index.js +0 -97
  160. package/collection/components/salon-booking/index.js +0 -103
  161. package/collection/components/salon-booking/salon-booking-modal.js +0 -82
  162. package/collection/components/salon-contact/index.js +0 -88
  163. package/collection/components/salon-gift-card/index.css +0 -25
  164. package/collection/components/salon-gift-card/index.js +0 -83
  165. package/collection/components/salon-gift-card/salon-gift-card-modal.js +0 -43
  166. package/collection/components/salon-info/index.css +0 -3
  167. package/collection/components/salon-info/index.js +0 -97
  168. package/collection/components/salon-latest-reviews/index.js +0 -108
  169. package/collection/components/salon-locations/index.js +0 -80
  170. package/collection/components/salon-lookbook/index.css +0 -12
  171. package/collection/components/salon-lookbook/index.js +0 -303
  172. package/collection/components/salon-ranking/index.js +0 -114
  173. package/collection/components/salon-reviews/index.js +0 -291
  174. package/collection/components/salon-schedules/index.css +0 -14
  175. package/collection/components/salon-schedules/index.js +0 -103
  176. package/collection/components/salon-services/index.css +0 -0
  177. package/collection/components/salon-services/index.js +0 -113
  178. package/collection/components/salon-styles/index.css +0 -23
  179. package/collection/components/salon-styles/index.js +0 -100
  180. package/collection/components/salon-stylists/index.js +0 -96
  181. package/collection/components/user-avatar/index.css +0 -0
  182. package/collection/components/user-avatar/index.js +0 -127
  183. package/collection/constants/colors.js +0 -91
  184. package/collection/services/services.js +0 -203
  185. package/collection/types/common.js +0 -2
  186. package/collection/types/salon.js +0 -52
  187. package/collection/types/style.js +0 -28
  188. package/collection/types/stylist.js +0 -13
  189. package/collection/types/user.js +0 -10
  190. package/custom-elements/index.js +0 -7410
  191. package/esm/favesalon-embed.js +0 -18
  192. package/esm/google-map_15.entry.js +0 -6614
  193. package/esm/loader.js +0 -18
  194. package/esm/polyfills/css-shim.js +0 -1
  195. package/esm/salon-booking-modal.entry.js +0 -19
  196. package/esm/salon-gift-card-modal.entry.js +0 -16
  197. package/favesalon-embed/favesalon-embed.esm.js +0 -1
  198. package/favesalon-embed/p-1432ab16.entry.js +0 -1
  199. package/favesalon-embed/p-2da2ed75.js +0 -1
  200. package/favesalon-embed/p-4a5eca9a.js +0 -6
  201. package/favesalon-embed/p-94a0991e.entry.js +0 -1
  202. package/favesalon-embed/p-f15bcb43.entry.js +0 -1
  203. package/types/components/google-map/index.d.ts +0 -10
  204. package/types/components/salon-contact/index.d.ts +0 -9
  205. package/types/components/salon-reviews/index.d.ts +0 -23
  206. package/types/components/salon-styles/index.d.ts +0 -9
  207. package/types/constants/colors.d.ts +0 -88
  208. package/types/services/services.d.ts +0 -24
  209. package/types/types/common.d.ts +0 -2
  210. package/types/types/style.d.ts +0 -49
  211. package/{cjs → dist/cjs}/global-9073d10e.js +0 -0
  212. package/{cjs → dist/cjs}/index.cjs.js +0 -0
  213. package/{esm/index.js → dist/collection/components/salon-info/index.css} +0 -0
  214. package/{collection → dist/collection}/components/salon-latest-reviews/index.css +0 -0
  215. package/{collection → dist/collection}/components/salon-ranking/index.css +0 -0
  216. package/{collection → dist/collection}/components/salon-stylists/index.css +0 -0
  217. package/{collection/components/salon-locations → dist/collection/components/user-avatar}/index.css +0 -0
  218. package/{collection → dist/collection}/global/global.js +0 -0
  219. package/{collection → dist/collection}/index.js +0 -0
  220. package/{collection → dist/collection}/types/service.js +0 -0
  221. package/{collection → dist/collection}/utils/utils.js +0 -0
  222. package/{esm → dist/esm}/global-e1089ffd.js +0 -0
  223. package/{esm → dist/esm}/polyfills/core-js.js +0 -0
  224. package/{esm → dist/esm}/polyfills/dom.js +0 -0
  225. package/{esm → dist/esm}/polyfills/es5-html-element.js +0 -0
  226. package/{esm → dist/esm}/polyfills/index.js +0 -0
  227. package/{esm → dist/esm}/polyfills/system.js +0 -0
  228. package/{favesalon-embed → dist/favesalon-embed}/index.esm.js +0 -0
  229. package/{index.cjs.js → dist/index.cjs.js} +0 -0
  230. package/{index.js → dist/index.js} +0 -0
  231. package/{collection/components/salon-reviews/index.css → dist/types/components/chat-conversation/index.d.ts} +0 -0
  232. package/{types → dist/types}/components/salon-booking/index.d.ts +1 -1
  233. /package/{types → dist/types}/components/salon-ranking/index.d.ts +0 -0
  234. /package/{types → dist/types}/components/user-avatar/index.d.ts +0 -0
  235. /package/{types → dist/types}/index.d.ts +0 -0
  236. /package/{types → dist/types}/types/service.d.ts +0 -0
  237. /package/{types → dist/types}/utils/utils.d.ts +0 -0
@@ -1,97 +0,0 @@
1
- import { Component, Prop, h, Method, State } from '@stencil/core';
2
- import HttpService from '../../services/services';
3
- import { Colors } from '../../constants/colors';
4
- export class SalonInfo {
5
- constructor() {
6
- this.backgroundColor = Colors.Gray06;
7
- }
8
- componentWillLoad() {
9
- this.fetchData();
10
- }
11
- async fetchData() {
12
- try {
13
- this.salonInfo = await HttpService().fetchSalonInfo(this.salonId);
14
- }
15
- catch (e) { }
16
- }
17
- render() {
18
- if (this.salonInfo) {
19
- return (h("div", { class: "salon-info", style: { background: this.backgroundColor } },
20
- h("div", { class: "row" },
21
- h("div", { class: "col-md-5", style: { marginBottom: '24px' } },
22
- h("salon-locations", { "salon-id": 49989, "salon-info": JSON.stringify(this.salonInfo) })),
23
- h("div", { class: "col-md-7", style: { marginBottom: '24px' } },
24
- h("salon-styles", { "salon-id": 49989, "salon-info": JSON.stringify(this.salonInfo) }))),
25
- h("div", { class: "salon-info--schedules", style: { marginBottom: '24px' } },
26
- h("salon-schedules", { "salon-id": 49989, "salon-info": JSON.stringify(this.salonInfo) })),
27
- h("div", { class: "salon-info--contact" },
28
- h("salon-contact", { "salon-id": 49989, "salon-info": JSON.stringify(this.salonInfo) }))));
29
- }
30
- return (h("div", { class: "salon-info", style: { padding: '24px', textAlign: 'center' } }, "Loading..."));
31
- }
32
- static get is() { return "salon-info"; }
33
- static get originalStyleUrls() { return {
34
- "$": ["index.less"]
35
- }; }
36
- static get styleUrls() { return {
37
- "$": ["index.css"]
38
- }; }
39
- static get properties() { return {
40
- "salonId": {
41
- "type": "number",
42
- "mutable": false,
43
- "complexType": {
44
- "original": "number",
45
- "resolved": "number",
46
- "references": {}
47
- },
48
- "required": false,
49
- "optional": false,
50
- "docs": {
51
- "tags": [],
52
- "text": ""
53
- },
54
- "attribute": "salon-id",
55
- "reflect": false
56
- },
57
- "backgroundColor": {
58
- "type": "string",
59
- "mutable": false,
60
- "complexType": {
61
- "original": "string",
62
- "resolved": "string",
63
- "references": {}
64
- },
65
- "required": false,
66
- "optional": false,
67
- "docs": {
68
- "tags": [],
69
- "text": ""
70
- },
71
- "attribute": "background-color",
72
- "reflect": false,
73
- "defaultValue": "Colors.Gray06"
74
- }
75
- }; }
76
- static get states() { return {
77
- "salonInfo": {}
78
- }; }
79
- static get methods() { return {
80
- "fetchData": {
81
- "complexType": {
82
- "signature": "() => Promise<void>",
83
- "parameters": [],
84
- "references": {
85
- "Promise": {
86
- "location": "global"
87
- }
88
- },
89
- "return": "Promise<void>"
90
- },
91
- "docs": {
92
- "text": "",
93
- "tags": []
94
- }
95
- }
96
- }; }
97
- }
@@ -1,108 +0,0 @@
1
- import { Component, Prop, h, Method, State } from '@stencil/core';
2
- import dayjs from 'dayjs';
3
- import { Colors } from '../../constants/colors';
4
- import { getRatingText } from '../../utils/utils';
5
- import HttpService from '../../services/services';
6
- import { shortDate } from '../../types/common';
7
- export class SalonLatestReviews {
8
- constructor() {
9
- this.salonReviews = [];
10
- }
11
- componentWillLoad() {
12
- this.fetchData();
13
- }
14
- async fetchData() {
15
- try {
16
- const { allItems } = await HttpService().fetchSalonReviews(this.salonId, { noLoop: true });
17
- this.salonReviews = [...allItems];
18
- }
19
- catch (e) { }
20
- }
21
- render() {
22
- const ratingTexts = getRatingText();
23
- return (h("div", { class: "salon-latest-reviews", style: { overflowX: 'auto' } },
24
- h("div", { style: { display: 'flex', whiteSpace: 'nowrap' } }, (this.salonReviews || []).map((review, index) => {
25
- const { user } = review;
26
- return (h("div", { class: "salon-review", style: Object.assign({ border: `1px solid ${Colors.Gray05}`, background: Colors.White, borderRadius: '8px', overflow: 'hidden' }, index > 0 ? { marginLeft: '16px' } : {}) },
27
- h("div", { class: "card", style: { border: 'none' } },
28
- h("div", { class: "card-body" },
29
- h("div", { class: "salon-review--user", style: { marginBottom: '16px' } },
30
- h("user-avatar", { size: 48, name: user.name, shortName: `${(user.firstName || '').charAt(0)}${(user.lastName || '').charAt(0)}`, avatar: user.avatar, nameStyle: { fontWeight: 'bold' } })),
31
- h("div", { class: "salon-review--rating", style: { display: 'flex', flexDirection: 'row', marginBottom: '4px' } },
32
- [1, 2, 3, 4, 5].map(score => (h("i", { class: score <= review.point ? 'ri-heart-fill' : 'ri-heart-line', style: {
33
- fontSize: '16px',
34
- marginRight: '4px',
35
- } }))),
36
- h("div", { class: "salon-review--rating--date", style: { color: Colors.Gray03, marginLeft: '16px' } }, dayjs(review.createdDate).format(shortDate))),
37
- h("div", { class: "salon-review--rating-text", style: { fontSize: '16px', fontWeight: 'bold' } }, ratingTexts[review.point]),
38
- (review.title || review.description) && (h("div", { class: "salon-review--detail", style: { marginTop: '16px' } },
39
- h("div", { class: "salon-review--description", style: {
40
- fontSize: '16px',
41
- lineHeight: '26px',
42
- overflow: 'hidden',
43
- maxHeight: review.photos.length > 0 ? '52px' : '104px',
44
- } }, review.title || review.description))),
45
- review.photos.length > 0 && (h("div", { style: {
46
- display: 'flex',
47
- flexDirection: 'row',
48
- overflowX: 'auto',
49
- } }, review.photos.map(photo => (h("div", { style: {
50
- border: '1px solid #d9d9d9',
51
- position: 'relative',
52
- cursor: 'pointer',
53
- borderRadius: '2px',
54
- height: '66px',
55
- marginTop: '16px',
56
- marginRight: '16px',
57
- } },
58
- h("img", { alt: "", src: photo.imageUrlThumb, height: "64", style: { width: 'auto' } }))))))))));
59
- }))));
60
- }
61
- static get is() { return "salon-latest-reviews"; }
62
- static get originalStyleUrls() { return {
63
- "$": ["index.css"]
64
- }; }
65
- static get styleUrls() { return {
66
- "$": ["index.css"]
67
- }; }
68
- static get properties() { return {
69
- "salonId": {
70
- "type": "number",
71
- "mutable": false,
72
- "complexType": {
73
- "original": "number",
74
- "resolved": "number",
75
- "references": {}
76
- },
77
- "required": false,
78
- "optional": false,
79
- "docs": {
80
- "tags": [],
81
- "text": ""
82
- },
83
- "attribute": "salon-id",
84
- "reflect": false
85
- }
86
- }; }
87
- static get states() { return {
88
- "salonReviews": {}
89
- }; }
90
- static get methods() { return {
91
- "fetchData": {
92
- "complexType": {
93
- "signature": "() => Promise<void>",
94
- "parameters": [],
95
- "references": {
96
- "Promise": {
97
- "location": "global"
98
- }
99
- },
100
- "return": "Promise<void>"
101
- },
102
- "docs": {
103
- "text": "",
104
- "tags": []
105
- }
106
- }
107
- }; }
108
- }
@@ -1,80 +0,0 @@
1
- import { Component, Prop, h, State } from '@stencil/core';
2
- import { formatFullAddress } from '../../utils/utils';
3
- import HttpService from '../../services/services';
4
- export class SalonLocations {
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
- render() {
21
- const { businessLocationLat: lat, businessLocationLng: lng } = this.salonInfoState || {};
22
- return (h("div", { class: "view view--salon-locations" },
23
- h("div", { class: "view-content", style: { height: '380px' } },
24
- h("div", { style: {
25
- fontSize: '16px',
26
- lineHeight: '26px',
27
- maxHeight: '52px',
28
- marginBottom: '16px',
29
- overflow: 'hidden',
30
- textOverflow: 'ellipsis',
31
- } }, formatFullAddress(this.salonInfoState)),
32
- h("div", { class: "view--salon-info--map", style: { height: '264px' } }, lat && lng && h("google-map", { lat: lat, lng: lng })))));
33
- }
34
- static get is() { return "salon-locations"; }
35
- static get originalStyleUrls() { return {
36
- "$": ["index.css"]
37
- }; }
38
- static get styleUrls() { return {
39
- "$": ["index.css"]
40
- }; }
41
- static get properties() { return {
42
- "salonId": {
43
- "type": "number",
44
- "mutable": false,
45
- "complexType": {
46
- "original": "number",
47
- "resolved": "number",
48
- "references": {}
49
- },
50
- "required": false,
51
- "optional": false,
52
- "docs": {
53
- "tags": [],
54
- "text": ""
55
- },
56
- "attribute": "salon-id",
57
- "reflect": false
58
- },
59
- "salonInfo": {
60
- "type": "string",
61
- "mutable": false,
62
- "complexType": {
63
- "original": "string",
64
- "resolved": "string",
65
- "references": {}
66
- },
67
- "required": false,
68
- "optional": true,
69
- "docs": {
70
- "tags": [],
71
- "text": ""
72
- },
73
- "attribute": "salon-info",
74
- "reflect": false
75
- }
76
- }; }
77
- static get states() { return {
78
- "salonInfoState": {}
79
- }; }
80
- }
@@ -1,12 +0,0 @@
1
- .salon-loobooks--grid-item {
2
- float: left;
3
- max-width: 150px;
4
- }
5
-
6
-
7
- @media (min-width: 768px) {
8
- .salon-loobooks--grid-item {
9
- max-width: 200px;
10
- }
11
- }
12
-
@@ -1,303 +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
- const lookbookSortOptions = [{
5
- value: 'like',
6
- label: 'Most popular',
7
- }, {
8
- value: 'newest',
9
- label: 'Newest first',
10
- }, {
11
- value: 'oldest',
12
- label: 'Oldest first',
13
- }];
14
- const lookbookFilterOptions = [{
15
- value: 'all',
16
- label: 'All Category',
17
- }];
18
- export class SalonLookbook {
19
- constructor() {
20
- this.isLoading = true;
21
- this.currentPage = 1;
22
- this.totalLookbooks = 0;
23
- this.salonCategories = [];
24
- this.salonLookbooks = [];
25
- }
26
- componentWillLoad() {
27
- this.fetchData();
28
- this.injectSDK();
29
- }
30
- componentDidRender() {
31
- this.setupGridLayout();
32
- }
33
- injectSDK() {
34
- return new Promise((resolve) => {
35
- const script = document.createElement('script');
36
- script.type = 'text/javascript';
37
- script.src = 'https://cdn.jsdelivr.net/npm/macy@2';
38
- document.body.appendChild(script);
39
- return resolve(true);
40
- });
41
- }
42
- setupGridLayout() {
43
- if (!this.isLayoutSetup && document.querySelector('#salon-loobooks--grid')) {
44
- const script = document.createElement('script');
45
- script.type = 'text/javascript';
46
- script.innerHTML = `
47
- var masonry = new Macy({
48
- container: '#salon-loobooks--grid',
49
- useContainerForBreakpoints: true,
50
- margin: 12,
51
- columns: 7,
52
- breakAt: {
53
- 1200: {
54
- margin: 16,
55
- columns: 6,
56
- },
57
- 992: {
58
- margin: 16,
59
- columns: 5,
60
- },
61
- 768: {
62
- margin: 16,
63
- columns: 3,
64
- },
65
- 576: {
66
- margin: 16,
67
- columns: 2,
68
- },
69
- },
70
- });
71
- `;
72
- document.body.appendChild(script);
73
- this.isLayoutSetup = true;
74
- }
75
- }
76
- async fetchData() {
77
- try {
78
- const promises = [
79
- this.fetchLookbooks({ page: 1 }),
80
- this.fetchCategories(),
81
- ];
82
- return Promise.all(promises);
83
- }
84
- catch (e) { }
85
- }
86
- async fetchLookbooks(options, isLoadingMore) {
87
- if (isLoadingMore) {
88
- this.isLoadingMore = true;
89
- }
90
- else {
91
- this.isLoading = true;
92
- }
93
- try {
94
- const { total, allLookbooks } = await HttpService().fetchSalonLookbooks(this.salonId, options);
95
- this.totalLookbooks = total;
96
- this.salonLookbooks = this.salonLookbooks.concat(allLookbooks);
97
- this.hideLoadMore = allLookbooks.length < 20;
98
- }
99
- catch (error) { }
100
- if (isLoadingMore) {
101
- this.isLoadingMore = false;
102
- }
103
- else {
104
- this.isLoading = false;
105
- }
106
- }
107
- async onLoadMore() {
108
- try {
109
- this.currentPage += 1;
110
- await this.fetchLookbooks({ page: this.currentPage }, true);
111
- if (window.masonry) {
112
- this.isLayoutSetup = false;
113
- }
114
- }
115
- catch (error) { }
116
- }
117
- async fetchCategories() {
118
- try {
119
- this.salonCategories = await HttpService().fetchSalonCategories();
120
- }
121
- catch (error) { }
122
- }
123
- renderHeader() {
124
- const allFilterOptions = lookbookFilterOptions.concat(([...this.salonCategories]).map(category => {
125
- return {
126
- value: category.id,
127
- label: category.name,
128
- };
129
- }));
130
- return (h("div", { class: "view-header", style: {
131
- display: 'flex',
132
- flexDirection: 'row',
133
- justifyContent: 'space-between',
134
- alignItems: 'center',
135
- marginBottom: '24px',
136
- } },
137
- h("div", null,
138
- this.totalLookbooks,
139
- " ",
140
- this.totalLookbooks === 1 ? 'result' : 'results'),
141
- h("div", { style: {
142
- display: 'flex',
143
- flexDirection: 'row',
144
- alignItems: 'center',
145
- } },
146
- h("div", { style: {
147
- display: 'flex',
148
- flexDirection: 'row',
149
- alignItems: 'center',
150
- marginRight: '16px',
151
- } },
152
- h("label", { style: { marginRight: '8px', marginBottom: '0' } }, "Filter by"),
153
- h("select", {
154
- // placeholder="Filter by"
155
- // value={filterBy}
156
- // onChange={onChangeCategory}
157
- class: "form-select", style: { width: '160px' } }, allFilterOptions.map(filterOption => (h("option", { value: filterOption.value }, filterOption.label))))),
158
- h("div", { class: "search--header--sort-wrapper", style: {
159
- display: 'flex',
160
- flexDirection: 'row',
161
- alignItems: 'center',
162
- } },
163
- h("label", { style: { marginRight: '8px', marginBottom: '0' } }, "Sort by"),
164
- h("select", {
165
- // placeholder="Sort by"
166
- // value={sortBy}
167
- // onChange={onChangeSorting}
168
- class: "form-select", style: { width: '160px' } }, lookbookSortOptions.map(sortOption => (h("option", { value: sortOption.value }, sortOption.label))))))));
169
- }
170
- render() {
171
- return (h("div", { class: "salon-loobooks" }, this.salonLookbooks.length > 0 && (h("div", null,
172
- h("div", { class: "view-content" },
173
- this.renderHeader(),
174
- h("div", { class: "salon-loobooks--grid", id: "salon-loobooks--grid" }, this.salonLookbooks.map(style => {
175
- const { caption, fullImageUrlThumb, owner } = style;
176
- return (h("div", { class: "salon-lookbook salon-loobooks--grid-item" },
177
- h("div", { class: "card", style: {
178
- background: 'none',
179
- border: 'none',
180
- maxWidth: '200px',
181
- } },
182
- h("div", { class: "salon-lookbook--image", style: {
183
- borderRadius: '8px',
184
- overflow: 'hidden',
185
- minHeight: '80px',
186
- background: Colors.Gray06,
187
- } },
188
- h("img", { src: fullImageUrlThumb, alt: caption })),
189
- owner && (h("div", { class: "card-body", style: { paddingLeft: '0' } },
190
- h("user-avatar", { name: owner.name, shortName: `${(owner.firstName || '').charAt(0)}${(owner.lastName || '').charAt(0)}`, avatar: owner.avatar }))))));
191
- }))),
192
- !this.hideLoadMore && (h("div", { class: "view-footer", style: { paddingTop: '16px', textAlign: 'center' } },
193
- h("button", { type: "button", class: "btn btn-light", onClick: () => this.onLoadMore() }, this.isLoadingMore ? 'Loading' : 'Load more')))))));
194
- }
195
- static get is() { return "salon-lookbook"; }
196
- static get originalStyleUrls() { return {
197
- "$": ["index.css"]
198
- }; }
199
- static get styleUrls() { return {
200
- "$": ["index.css"]
201
- }; }
202
- static get properties() { return {
203
- "salonId": {
204
- "type": "number",
205
- "mutable": false,
206
- "complexType": {
207
- "original": "number",
208
- "resolved": "number",
209
- "references": {}
210
- },
211
- "required": false,
212
- "optional": false,
213
- "docs": {
214
- "tags": [],
215
- "text": ""
216
- },
217
- "attribute": "salon-id",
218
- "reflect": false
219
- }
220
- }; }
221
- static get states() { return {
222
- "isLoading": {},
223
- "isLoadingMore": {},
224
- "hideLoadMore": {},
225
- "currentPage": {},
226
- "totalLookbooks": {},
227
- "salonCategories": {},
228
- "salonLookbooks": {},
229
- "isLayoutSetup": {}
230
- }; }
231
- static get methods() { return {
232
- "fetchData": {
233
- "complexType": {
234
- "signature": "() => Promise<any[]>",
235
- "parameters": [],
236
- "references": {
237
- "Promise": {
238
- "location": "global"
239
- }
240
- },
241
- "return": "Promise<any[]>"
242
- },
243
- "docs": {
244
- "text": "",
245
- "tags": []
246
- }
247
- },
248
- "fetchLookbooks": {
249
- "complexType": {
250
- "signature": "(options: any, isLoadingMore?: boolean) => Promise<void>",
251
- "parameters": [{
252
- "tags": [],
253
- "text": ""
254
- }, {
255
- "tags": [],
256
- "text": ""
257
- }],
258
- "references": {
259
- "Promise": {
260
- "location": "global"
261
- }
262
- },
263
- "return": "Promise<void>"
264
- },
265
- "docs": {
266
- "text": "",
267
- "tags": []
268
- }
269
- },
270
- "onLoadMore": {
271
- "complexType": {
272
- "signature": "() => Promise<void>",
273
- "parameters": [],
274
- "references": {
275
- "Promise": {
276
- "location": "global"
277
- }
278
- },
279
- "return": "Promise<void>"
280
- },
281
- "docs": {
282
- "text": "",
283
- "tags": []
284
- }
285
- },
286
- "fetchCategories": {
287
- "complexType": {
288
- "signature": "() => Promise<void>",
289
- "parameters": [],
290
- "references": {
291
- "Promise": {
292
- "location": "global"
293
- }
294
- },
295
- "return": "Promise<void>"
296
- },
297
- "docs": {
298
- "text": "",
299
- "tags": []
300
- }
301
- }
302
- }; }
303
- }