favesalon-embed 0.0.4 → 1.0.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.
- package/LICENSE +21 -0
- package/dist/cjs/chat-button.cjs.entry.js +118 -0
- package/dist/cjs/colors-38421769.js +69 -0
- package/dist/cjs/favesalon-embed.cjs.js +24 -0
- package/dist/cjs/google-map_5.cjs.entry.js +310 -0
- package/{cjs/index-d5de0b9d.js → dist/cjs/index-47c2a5f6.js} +513 -199
- package/{cjs/index-48ac68d0.js → dist/cjs/index-7f190886.js} +1924 -0
- package/dist/cjs/loader.cjs.js +23 -0
- package/dist/cjs/relativeTime-3721080d.js +9 -0
- package/{cjs → dist/cjs}/salon-booking-modal.cjs.entry.js +7 -6
- package/{cjs → dist/cjs}/salon-booking.cjs.entry.js +8 -8
- package/dist/cjs/salon-gift-card-modal.cjs.entry.js +29 -0
- package/{cjs → dist/cjs}/salon-gift-card.cjs.entry.js +9 -8
- package/dist/cjs/salon-latest-reviews.cjs.entry.js +97 -0
- package/{cjs/salon-lookbook_2.cjs.entry.js → dist/cjs/salon-lookbook.cjs.entry.js} +28 -58
- package/{cjs → dist/cjs}/salon-ranking.cjs.entry.js +9 -8
- package/dist/cjs/salon-reviews.cjs.entry.js +193 -0
- package/dist/cjs/salon-services.cjs.entry.js +81 -0
- package/dist/cjs/salon-stylists.cjs.entry.js +118 -0
- package/dist/cjs/services-125c82d8.js +21492 -0
- package/dist/cjs/style-detail.cjs.entry.js +312 -0
- package/dist/cjs/user-avatar.cjs.entry.js +45 -0
- package/{collection → dist/collection}/collection-manifest.json +5 -5
- package/dist/collection/components/chat-button/index.css +122 -0
- package/dist/collection/components/chat-button/index.js +218 -0
- package/dist/collection/components/chat-conversation/index.js +103 -0
- package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
- package/{collection → dist/collection}/components/google-map/index.css +0 -1
- package/dist/collection/components/google-map/index.js +90 -0
- package/{collection → dist/collection}/components/salon-booking/index.css +11 -20
- package/dist/collection/components/salon-booking/index.js +126 -0
- package/dist/collection/components/salon-booking/salon-booking-modal.js +92 -0
- package/dist/collection/components/salon-gift-card/index.css +30 -0
- package/dist/collection/components/salon-gift-card/index.js +126 -0
- package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +73 -0
- package/dist/collection/components/salon-info/index.js +77 -0
- package/dist/collection/components/salon-latest-reviews/index.js +163 -0
- package/dist/collection/components/salon-latest-styles/index.css +12 -0
- package/dist/collection/components/salon-latest-styles/index.js +183 -0
- package/{collection/components/salon-contact → dist/collection/components/salon-locations}/index.css +7 -4
- package/dist/collection/components/salon-locations/index.js +143 -0
- package/{collection → dist/collection}/components/salon-lookbook/index.css +3 -9
- package/dist/collection/components/salon-lookbook/index.js +368 -0
- package/dist/collection/components/salon-ranking/index.js +117 -0
- package/{collection → dist/collection}/components/salon-reviews/index.css +3 -0
- package/dist/collection/components/salon-reviews/index.js +249 -0
- package/dist/collection/components/salon-schedules/index.css +18 -0
- package/dist/collection/components/salon-schedules/index.js +167 -0
- package/dist/collection/components/salon-services/index.css +1 -0
- package/dist/collection/components/salon-services/index.js +146 -0
- package/dist/collection/components/salon-stylists/index.js +184 -0
- package/dist/collection/components/style-detail/index.css +76 -0
- package/dist/collection/components/style-detail/index.js +386 -0
- package/dist/collection/components/user-avatar/index.js +134 -0
- package/dist/collection/constants/colors.js +65 -0
- package/dist/collection/mocks/users.js +10 -0
- package/dist/collection/services/services.js +295 -0
- package/dist/collection/types/chat.js +23 -0
- package/dist/collection/types/common.js +11 -0
- package/{collection → dist/collection}/types/review.js +9 -5
- package/dist/collection/types/salon.js +58 -0
- package/dist/collection/types/style.js +128 -0
- package/{collection → dist/collection}/types/stylist.js +12 -9
- package/dist/collection/types/user.js +10 -0
- package/{custom-elements → dist/custom-elements}/index.d.ts +18 -18
- package/dist/custom-elements/index.js +28340 -0
- package/dist/esm/chat-button.entry.js +114 -0
- package/dist/esm/colors-ea36347a.js +67 -0
- package/dist/esm/favesalon-embed.js +19 -0
- package/dist/esm/google-map_5.entry.js +302 -0
- package/{esm/index-0f8eed73.js → dist/esm/index-3fae868e.js} +512 -200
- package/{esm/index-67d677ba.js → dist/esm/index-80523fec.js} +1924 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +19 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/relativeTime-cd452e6d.js +7 -0
- package/{esm → dist/esm}/salon-booking-modal.entry.js +7 -6
- package/{esm → dist/esm}/salon-booking.entry.js +7 -7
- package/dist/esm/salon-gift-card-modal.entry.js +25 -0
- package/{esm → dist/esm}/salon-gift-card.entry.js +8 -7
- package/dist/esm/salon-latest-reviews.entry.js +93 -0
- package/{esm/salon-lookbook_2.entry.js → dist/esm/salon-lookbook.entry.js} +29 -58
- package/{esm → dist/esm}/salon-ranking.entry.js +9 -8
- package/dist/esm/salon-reviews.entry.js +189 -0
- package/dist/esm/salon-services.entry.js +77 -0
- package/dist/esm/salon-stylists.entry.js +114 -0
- package/dist/esm/services-40a3e622.js +21485 -0
- package/dist/esm/style-detail.entry.js +308 -0
- package/dist/esm/user-avatar.entry.js +41 -0
- package/dist/favesalon-embed/assets/map--placeholder.jpeg +0 -0
- package/{favesalon-embed → dist/favesalon-embed}/favesalon-embed.css +1 -1
- package/dist/favesalon-embed/favesalon-embed.esm.js +1 -0
- package/dist/favesalon-embed/p-019c5ccd.entry.js +1 -0
- package/dist/favesalon-embed/p-083a8821.entry.js +1 -0
- package/dist/favesalon-embed/p-0d0ed9ea.entry.js +1 -0
- package/dist/favesalon-embed/p-119db8de.entry.js +1 -0
- package/dist/favesalon-embed/p-1432c51b.entry.js +1 -0
- package/dist/favesalon-embed/p-22093506.entry.js +1 -0
- package/dist/favesalon-embed/p-32b314e9.js +2 -0
- package/dist/favesalon-embed/p-4a5eca9a.js +6 -0
- package/dist/favesalon-embed/p-58d2e9be.js +1 -0
- package/dist/favesalon-embed/p-71404b6a.entry.js +1 -0
- package/dist/favesalon-embed/p-857c3a61.entry.js +1 -0
- package/dist/favesalon-embed/p-99ec77f7.entry.js +1 -0
- package/dist/favesalon-embed/p-a33331cc.js +1 -0
- package/dist/favesalon-embed/p-b0c3673a.entry.js +1 -0
- package/dist/favesalon-embed/p-b287b1ea.entry.js +1 -0
- package/dist/favesalon-embed/p-b3af7842.entry.js +1 -0
- package/dist/favesalon-embed/p-b630ae68.js +1580 -0
- package/dist/favesalon-embed/p-ce2c1c9a.entry.js +1 -0
- package/dist/favesalon-embed/p-d9b7ad58.entry.js +1 -0
- package/dist/favesalon-embed/p-fc9a5551.js +6 -0
- package/dist/types/components/chat-button/index.d.ts +24 -0
- package/dist/types/components/google-map/index.d.ts +5 -0
- package/{types → dist/types}/components/salon-gift-card/salon-gift-card-modal.d.ts +1 -0
- package/{types → dist/types}/components/salon-info/index.d.ts +0 -1
- package/{types → dist/types}/components/salon-latest-reviews/index.d.ts +2 -0
- package/dist/types/components/salon-latest-styles/index.d.ts +12 -0
- package/{types → dist/types}/components/salon-locations/index.d.ts +2 -0
- package/{types → dist/types}/components/salon-lookbook/index.d.ts +3 -3
- package/dist/types/components/salon-reviews/index.d.ts +24 -0
- package/{types → dist/types}/components/salon-schedules/index.d.ts +2 -0
- package/{types → dist/types}/components/salon-services/index.d.ts +1 -0
- package/{types → dist/types}/components/salon-stylists/index.d.ts +6 -0
- package/dist/types/components/style-detail/index.d.ts +24 -0
- package/{types → dist/types}/components.d.ts +76 -59
- package/dist/types/constants/colors.d.ts +65 -0
- package/dist/types/mocks/users.d.ts +10 -0
- package/dist/types/services/services.d.ts +75 -0
- package/{types → dist/types}/stencil-public-runtime.d.ts +85 -11
- package/dist/types/types/chat.d.ts +17 -0
- package/dist/types/types/common.d.ts +11 -0
- package/{types → dist/types}/types/review.d.ts +4 -0
- package/{types → dist/types}/types/salon.d.ts +3 -1
- package/dist/types/types/style.d.ts +88 -0
- package/{types → dist/types}/types/stylist.d.ts +1 -1
- package/{types → dist/types}/types/user.d.ts +2 -2
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +21 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +19 -14
- package/readme.md +24 -7
- package/cjs/colors-7f354880.js +0 -95
- package/cjs/favesalon-embed.cjs.js +0 -20
- package/cjs/google-map.cjs.entry.js +0 -47
- package/cjs/index-95daad08.js +0 -1928
- package/cjs/loader.cjs.js +0 -22
- package/cjs/salon-contact_4.cjs.entry.js +0 -155
- package/cjs/salon-gift-card-modal.cjs.entry.js +0 -25
- package/cjs/salon-info.cjs.entry.js +0 -35
- package/cjs/salon-latest-reviews.cjs.entry.js +0 -58
- package/cjs/salon-lookbook-modal.cjs.entry.js +0 -141
- package/cjs/salon-reviews.cjs.entry.js +0 -205
- package/cjs/salon-services.cjs.entry.js +0 -47
- package/cjs/salon-stylists.cjs.entry.js +0 -54
- package/cjs/services-f1102d4a.js +0 -5762
- package/collection/components/google-map/index.js +0 -97
- package/collection/components/salon-booking/index.js +0 -121
- package/collection/components/salon-booking/salon-booking-modal.js +0 -88
- package/collection/components/salon-contact/index.js +0 -88
- package/collection/components/salon-gift-card/index.css +0 -25
- package/collection/components/salon-gift-card/index.js +0 -120
- package/collection/components/salon-gift-card/salon-gift-card-modal.js +0 -48
- package/collection/components/salon-info/index.css +0 -3
- package/collection/components/salon-info/index.js +0 -97
- package/collection/components/salon-latest-reviews/index.js +0 -108
- package/collection/components/salon-locations/index.js +0 -80
- package/collection/components/salon-lookbook/index.js +0 -376
- package/collection/components/salon-lookbook/lookbook-modal.css +0 -72
- package/collection/components/salon-lookbook/salon-lookbook-modal.js +0 -248
- package/collection/components/salon-ranking/index.js +0 -114
- package/collection/components/salon-reviews/index.js +0 -317
- package/collection/components/salon-schedules/index.css +0 -14
- package/collection/components/salon-schedules/index.js +0 -103
- package/collection/components/salon-services/index.js +0 -113
- package/collection/components/salon-styles/index.css +0 -23
- package/collection/components/salon-styles/index.js +0 -100
- package/collection/components/salon-stylists/index.js +0 -96
- package/collection/components/user-avatar/index.css +0 -0
- package/collection/components/user-avatar/index.js +0 -127
- package/collection/constants/colors.js +0 -91
- package/collection/services/services.js +0 -225
- package/collection/types/common.js +0 -2
- package/collection/types/salon.js +0 -52
- package/collection/types/style.js +0 -103
- package/collection/types/user.js +0 -10
- package/custom-elements/index.js +0 -12125
- package/esm/colors-1ec90c5f.js +0 -93
- package/esm/favesalon-embed.js +0 -18
- package/esm/google-map.entry.js +0 -43
- package/esm/index-09d43e3e.js +0 -1926
- package/esm/loader.js +0 -18
- package/esm/polyfills/css-shim.js +0 -1
- package/esm/salon-contact_4.entry.js +0 -148
- package/esm/salon-gift-card-modal.entry.js +0 -21
- package/esm/salon-info.entry.js +0 -31
- package/esm/salon-latest-reviews.entry.js +0 -54
- package/esm/salon-lookbook-modal.entry.js +0 -137
- package/esm/salon-reviews.entry.js +0 -201
- package/esm/salon-services.entry.js +0 -43
- package/esm/salon-stylists.entry.js +0 -50
- package/esm/services-74d84ca9.js +0 -5756
- package/favesalon-embed/favesalon-embed.esm.js +0 -1
- package/favesalon-embed/p-0188d4dc.entry.js +0 -1
- package/favesalon-embed/p-0318501e.js +0 -1
- package/favesalon-embed/p-078f242d.entry.js +0 -1
- package/favesalon-embed/p-13e23c61.entry.js +0 -1
- package/favesalon-embed/p-17df13ad.js +0 -1
- package/favesalon-embed/p-1a3179c8.entry.js +0 -1
- package/favesalon-embed/p-20aa75de.js +0 -6
- package/favesalon-embed/p-2901a6d6.entry.js +0 -1
- package/favesalon-embed/p-2b861430.entry.js +0 -1
- package/favesalon-embed/p-44d810a0.js +0 -1
- package/favesalon-embed/p-4a5eca9a.js +0 -6
- package/favesalon-embed/p-4c68700f.entry.js +0 -1
- package/favesalon-embed/p-4e2d7b29.js +0 -1
- package/favesalon-embed/p-6b845bf1.entry.js +0 -1
- package/favesalon-embed/p-7350f6b5.entry.js +0 -1
- package/favesalon-embed/p-897c2b1c.entry.js +0 -1
- package/favesalon-embed/p-8e60f56f.entry.js +0 -1
- package/favesalon-embed/p-a49afdc1.entry.js +0 -1
- package/favesalon-embed/p-c93867c4.entry.js +0 -1
- package/favesalon-embed/p-ea6a097f.entry.js +0 -1
- package/types/components/google-map/index.d.ts +0 -10
- package/types/components/salon-contact/index.d.ts +0 -9
- package/types/components/salon-lookbook/salon-lookbook-modal.d.ts +0 -13
- package/types/components/salon-reviews/index.d.ts +0 -24
- package/types/components/salon-styles/index.d.ts +0 -9
- package/types/constants/colors.d.ts +0 -88
- package/types/services/services.d.ts +0 -26
- package/types/types/common.d.ts +0 -2
- package/types/types/style.d.ts +0 -59
- /package/{cjs → dist/cjs}/_commonjsHelpers-5cfcba41.js +0 -0
- /package/{cjs → dist/cjs}/global-9073d10e.js +0 -0
- /package/{cjs → dist/cjs}/index.cjs.js +0 -0
- /package/{cjs → dist/cjs}/utils-c5a33b3c.js +0 -0
- /package/{esm/index.js → dist/collection/components/salon-info/index.css} +0 -0
- /package/{collection → dist/collection}/components/salon-latest-reviews/index.css +0 -0
- /package/{collection → dist/collection}/components/salon-ranking/index.css +0 -0
- /package/{collection → dist/collection}/components/salon-stylists/index.css +0 -0
- /package/{collection/components/salon-locations → dist/collection/components/user-avatar}/index.css +0 -0
- /package/{collection → dist/collection}/global/global.js +0 -0
- /package/{collection → dist/collection}/index.js +0 -0
- /package/{collection → dist/collection}/types/service.js +0 -0
- /package/{collection → dist/collection}/utils/utils.js +0 -0
- /package/{esm → dist/esm}/_commonjsHelpers-098d5b27.js +0 -0
- /package/{esm → dist/esm}/global-e1089ffd.js +0 -0
- /package/{esm → dist/esm}/polyfills/core-js.js +0 -0
- /package/{esm → dist/esm}/polyfills/dom.js +0 -0
- /package/{esm → dist/esm}/polyfills/es5-html-element.js +0 -0
- /package/{esm → dist/esm}/polyfills/index.js +0 -0
- /package/{esm → dist/esm}/polyfills/system.js +0 -0
- /package/{esm → dist/esm}/utils-e97485e0.js +0 -0
- /package/{favesalon-embed → dist/favesalon-embed}/index.esm.js +0 -0
- /package/{favesalon-embed → dist/favesalon-embed}/p-47e646f8.js +0 -0
- /package/{favesalon-embed → dist/favesalon-embed}/p-d6083940.js +0 -0
- /package/{index.cjs.js → dist/index.cjs.js} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{collection/components/salon-services/index.css → dist/types/components/chat-conversation/index.d.ts} +0 -0
- /package/{types → dist/types}/components/salon-booking/index.d.ts +0 -0
- /package/{types → dist/types}/components/salon-booking/salon-booking-modal.d.ts +0 -0
- /package/{types → dist/types}/components/salon-gift-card/index.d.ts +0 -0
- /package/{types → dist/types}/components/salon-ranking/index.d.ts +0 -0
- /package/{types → dist/types}/components/user-avatar/index.d.ts +0 -0
- /package/{types → dist/types}/index.d.ts +0 -0
- /package/{types → dist/types}/types/service.d.ts +0 -0
- /package/{types → dist/types}/utils/utils.d.ts +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { Colors } from '../../constants/colors';
|
|
3
|
+
export class UserAvatar {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.size = 24;
|
|
6
|
+
this.name = undefined;
|
|
7
|
+
this.nameStyle = undefined;
|
|
8
|
+
this.shortName = undefined;
|
|
9
|
+
this.avatar = undefined;
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
return (h("div", { style: { display: "flex", alignItems: "center" } }, this.avatar && (h("div", { style: {
|
|
13
|
+
backgroundImage: `url("${this.avatar}")`,
|
|
14
|
+
backgroundColor: Colors.Gray01,
|
|
15
|
+
backgroundPosition: 'center center',
|
|
16
|
+
backgroundSize: 'cover',
|
|
17
|
+
borderRadius: '50%',
|
|
18
|
+
height: `${this.size}px`,
|
|
19
|
+
width: `${this.size}px`,
|
|
20
|
+
minWidth: `${this.size}px`,
|
|
21
|
+
} })), !this.avatar && (h("div", { style: {
|
|
22
|
+
backgroundColor: Colors.Gray01,
|
|
23
|
+
backgroundPosition: 'center center',
|
|
24
|
+
backgroundSize: 'cover',
|
|
25
|
+
borderRadius: '50%',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
height: `${this.size}px`,
|
|
30
|
+
width: `${this.size}px`,
|
|
31
|
+
minWidth: `${this.size}px`,
|
|
32
|
+
} }, this.shortName)), this.name && (h("div", { style: Object.assign({ flexShrink: '1', flexGrow: '1', marginLeft: '12px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }, this.nameStyle) }, this.name))));
|
|
33
|
+
}
|
|
34
|
+
static get is() { return "user-avatar"; }
|
|
35
|
+
static get originalStyleUrls() {
|
|
36
|
+
return {
|
|
37
|
+
"$": ["index.css"]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
static get styleUrls() {
|
|
41
|
+
return {
|
|
42
|
+
"$": ["index.css"]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
static get properties() {
|
|
46
|
+
return {
|
|
47
|
+
"size": {
|
|
48
|
+
"type": "number",
|
|
49
|
+
"mutable": false,
|
|
50
|
+
"complexType": {
|
|
51
|
+
"original": "number",
|
|
52
|
+
"resolved": "number",
|
|
53
|
+
"references": {}
|
|
54
|
+
},
|
|
55
|
+
"required": false,
|
|
56
|
+
"optional": false,
|
|
57
|
+
"docs": {
|
|
58
|
+
"tags": [],
|
|
59
|
+
"text": ""
|
|
60
|
+
},
|
|
61
|
+
"attribute": "size",
|
|
62
|
+
"reflect": false,
|
|
63
|
+
"defaultValue": "24"
|
|
64
|
+
},
|
|
65
|
+
"name": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"mutable": false,
|
|
68
|
+
"complexType": {
|
|
69
|
+
"original": "string",
|
|
70
|
+
"resolved": "string",
|
|
71
|
+
"references": {}
|
|
72
|
+
},
|
|
73
|
+
"required": false,
|
|
74
|
+
"optional": false,
|
|
75
|
+
"docs": {
|
|
76
|
+
"tags": [],
|
|
77
|
+
"text": ""
|
|
78
|
+
},
|
|
79
|
+
"attribute": "name",
|
|
80
|
+
"reflect": false
|
|
81
|
+
},
|
|
82
|
+
"nameStyle": {
|
|
83
|
+
"type": "unknown",
|
|
84
|
+
"mutable": false,
|
|
85
|
+
"complexType": {
|
|
86
|
+
"original": "object",
|
|
87
|
+
"resolved": "object",
|
|
88
|
+
"references": {}
|
|
89
|
+
},
|
|
90
|
+
"required": false,
|
|
91
|
+
"optional": true,
|
|
92
|
+
"docs": {
|
|
93
|
+
"tags": [],
|
|
94
|
+
"text": ""
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"shortName": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"mutable": false,
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "string",
|
|
102
|
+
"resolved": "string",
|
|
103
|
+
"references": {}
|
|
104
|
+
},
|
|
105
|
+
"required": false,
|
|
106
|
+
"optional": false,
|
|
107
|
+
"docs": {
|
|
108
|
+
"tags": [],
|
|
109
|
+
"text": ""
|
|
110
|
+
},
|
|
111
|
+
"attribute": "short-name",
|
|
112
|
+
"reflect": false
|
|
113
|
+
},
|
|
114
|
+
"avatar": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"mutable": false,
|
|
117
|
+
"complexType": {
|
|
118
|
+
"original": "string",
|
|
119
|
+
"resolved": "string",
|
|
120
|
+
"references": {}
|
|
121
|
+
},
|
|
122
|
+
"required": false,
|
|
123
|
+
"optional": false,
|
|
124
|
+
"docs": {
|
|
125
|
+
"tags": [],
|
|
126
|
+
"text": ""
|
|
127
|
+
},
|
|
128
|
+
"attribute": "avatar",
|
|
129
|
+
"reflect": false
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const Colors = {
|
|
2
|
+
TextColor: '#141414',
|
|
3
|
+
Black: '#000000',
|
|
4
|
+
White: '#ffffff',
|
|
5
|
+
Primary: '#F05A61',
|
|
6
|
+
Secondary: '#001529',
|
|
7
|
+
Black01: '#262626',
|
|
8
|
+
Black02: '#1f1f1f',
|
|
9
|
+
Black03: '#141414',
|
|
10
|
+
Gray01: '#F5F5F5',
|
|
11
|
+
Gray02: '#EFEFEF',
|
|
12
|
+
Gray03: '#DBDBDB',
|
|
13
|
+
Gray04: '#999999',
|
|
14
|
+
Gray05: '#666666',
|
|
15
|
+
Red01: '#FEEFEF',
|
|
16
|
+
Red02: '#F9BDC0',
|
|
17
|
+
Red03: '#F05A61',
|
|
18
|
+
Red04: '#C0484E',
|
|
19
|
+
Red05: '#90363A',
|
|
20
|
+
Orange01: '#FFF4F0',
|
|
21
|
+
Orange02: '#FFD1C3',
|
|
22
|
+
Orange03: '#FF8D69',
|
|
23
|
+
Orange04: '#CC7154',
|
|
24
|
+
Orange05: '#99553F',
|
|
25
|
+
Yellow01: '#FDFBF4',
|
|
26
|
+
Yellow02: '#F8EDD3',
|
|
27
|
+
Yellow03: '#EED291',
|
|
28
|
+
Yellow04: '#BEA874',
|
|
29
|
+
Yellow05: '#8F7E57',
|
|
30
|
+
Lilac01: '#F3F0F4',
|
|
31
|
+
Lilac02: '#CFC1D4',
|
|
32
|
+
Lilac03: '#886594',
|
|
33
|
+
Lilac04: '#6D5176',
|
|
34
|
+
Lilac05: '#523D59',
|
|
35
|
+
Blue01: '#EAECEE',
|
|
36
|
+
Blue02: '#AAB1BD',
|
|
37
|
+
Blue03: '#2B3C59',
|
|
38
|
+
Blue04: '#223047',
|
|
39
|
+
Blue05: '#1A2435',
|
|
40
|
+
Green01: '#ECF7ED',
|
|
41
|
+
Green02: '#B2E1B9',
|
|
42
|
+
Green03: '#3FB34F',
|
|
43
|
+
Green04: '#328F3F',
|
|
44
|
+
Green05: '#266B2F',
|
|
45
|
+
Success01: '#EEF9E8',
|
|
46
|
+
Success02: '#BAE7A3',
|
|
47
|
+
Success03: '#52C41A',
|
|
48
|
+
Success04: '#429D15',
|
|
49
|
+
Success05: '#317610',
|
|
50
|
+
Error01: '#FFEDED',
|
|
51
|
+
Error02: '#FFB8B9',
|
|
52
|
+
Error03: '#FF4D4F',
|
|
53
|
+
Error04: '#CC3E3F',
|
|
54
|
+
Error05: '#992E2F',
|
|
55
|
+
Warning01: '#FFF7E8',
|
|
56
|
+
Warning02: '#FDDEA1',
|
|
57
|
+
Warning03: '#FAAD14',
|
|
58
|
+
Warning04: '#C88A10',
|
|
59
|
+
Warning05: '#96680C',
|
|
60
|
+
Info01: '#E8F4FF',
|
|
61
|
+
Info02: '#A3D3FF',
|
|
62
|
+
Info03: '#1890FF',
|
|
63
|
+
Info04: '#1373CC',
|
|
64
|
+
Info05: '#0E5699',
|
|
65
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const consumerUser = {
|
|
2
|
+
"id": 442558,
|
|
3
|
+
"name": "Trung Luu",
|
|
4
|
+
"avatar": "https://favesalon.s3.amazonaws.com/public/media/uploads/photos/-1/2022-08-23-a982011a-4d49-488b-8a28-343631avatar1.jpg",
|
|
5
|
+
};
|
|
6
|
+
export const salonOwner = {
|
|
7
|
+
"id": 373905,
|
|
8
|
+
"name": "Nick Test",
|
|
9
|
+
"avatar": "https://d3m4d8z2xvy8tb.cloudfront.net/public/media/uploads/salon/profile/2018-11-13-575a6133-724f-4d63-8595-f545396ad96d.png",
|
|
10
|
+
};
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import get from 'lodash/get';
|
|
14
|
+
import each from 'lodash/each';
|
|
15
|
+
import sortBy from 'lodash/sortBy';
|
|
16
|
+
import axios from 'axios';
|
|
17
|
+
import { createSalon } from '../types/salon';
|
|
18
|
+
import { initializeApp } from 'firebase/app';
|
|
19
|
+
import { child, getDatabase, ref, onValue, push, update } from 'firebase/database';
|
|
20
|
+
import { createFaveStyle, createFaveStyleComment } from '../types/style';
|
|
21
|
+
import { createService } from '../types/service';
|
|
22
|
+
import { createStylist } from '../types/stylist';
|
|
23
|
+
import { createReview } from '../types/review';
|
|
24
|
+
import { apiV1Prefix } from '../types/common';
|
|
25
|
+
import { createChatMessage, createChatRoom } from '../types/chat';
|
|
26
|
+
import dayjs from 'dayjs';
|
|
27
|
+
const apiV2Prefix = 'api-ver2';
|
|
28
|
+
const firebaseMessagesNode = 'favesalon--messages';
|
|
29
|
+
class HttpService {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.http = null;
|
|
32
|
+
this.http = axios.create({
|
|
33
|
+
baseURL: 'https://favesalon.com',
|
|
34
|
+
// baseURL: 'http://13.57.216.170',
|
|
35
|
+
headers: {},
|
|
36
|
+
});
|
|
37
|
+
try {
|
|
38
|
+
if (!this.firebaseApp) {
|
|
39
|
+
this.firebaseApp = initializeApp({
|
|
40
|
+
apiKey: "AIzaSyD5IdiIA9QUZeguRbi8DEZ25TrNXPU3-uI",
|
|
41
|
+
authDomain: "favestyle-b57d4.firebaseapp.com",
|
|
42
|
+
databaseURL: "https://favestyle-b57d4.firebaseio.com",
|
|
43
|
+
projectId: "favestyle-b57d4",
|
|
44
|
+
storageBucket: "favestyle-b57d4.appspot.com",
|
|
45
|
+
messagingSenderId: "105638847842",
|
|
46
|
+
appId: "1:105638847842:web:35f50dfe0e8eb52f46783b",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
this.firebaseDatabase = getDatabase(this.firebaseApp);
|
|
50
|
+
}
|
|
51
|
+
catch (error) { }
|
|
52
|
+
}
|
|
53
|
+
fetchStyleDetail(styleId) {
|
|
54
|
+
return this.http.get(`${apiV2Prefix}/style/${styleId}/detail`)
|
|
55
|
+
.then((response) => {
|
|
56
|
+
const { status, data } = response.data;
|
|
57
|
+
if (status) {
|
|
58
|
+
let styleInfo = null, similarStyles = [];
|
|
59
|
+
try {
|
|
60
|
+
styleInfo = createFaveStyle(data);
|
|
61
|
+
similarStyles = (data.style_similars || []).map(createFaveStyle);
|
|
62
|
+
}
|
|
63
|
+
catch (e) { }
|
|
64
|
+
return { styleInfo, similarStyles };
|
|
65
|
+
}
|
|
66
|
+
return { styleInfo: null, similarStyles: [] };
|
|
67
|
+
})
|
|
68
|
+
.catch(() => {
|
|
69
|
+
return { styleInfo: null, similarStyles: [] };
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
fetchSalonInfo(salonId) {
|
|
73
|
+
const url = `${apiV2Prefix}/salon/${salonId}/detail`;
|
|
74
|
+
return this.http.get(url)
|
|
75
|
+
.then((response) => {
|
|
76
|
+
const { status, data } = response.data;
|
|
77
|
+
return status && data ? createSalon(data) : null;
|
|
78
|
+
})
|
|
79
|
+
.catch(() => (null));
|
|
80
|
+
}
|
|
81
|
+
fetchSalonLatestStyles(salonId, options) {
|
|
82
|
+
const url = `${apiV2Prefix}/salon/${salonId}/styles`;
|
|
83
|
+
return this.http.post(url, Object.assign(Object.assign({}, options), { sort: 'newest' }))
|
|
84
|
+
.then(response => {
|
|
85
|
+
const { data } = response.data;
|
|
86
|
+
return (data || []).slice(0, options.limit).map(createFaveStyle);
|
|
87
|
+
})
|
|
88
|
+
.catch(() => ([]));
|
|
89
|
+
}
|
|
90
|
+
decorateServiceGroups(groups) {
|
|
91
|
+
return groups.map((cate, index) => {
|
|
92
|
+
const cateName = cate.name;
|
|
93
|
+
const categoryId = `${cate.service_id}-${String(cateName).toLowerCase().split(' ').join('-')}-${cate.order}-index-${index}`;
|
|
94
|
+
const sortedSubCates = sortBy(cate.service_groups, [subCate => subCate.order]);
|
|
95
|
+
return {
|
|
96
|
+
id: categoryId,
|
|
97
|
+
name: cateName,
|
|
98
|
+
type: 'category',
|
|
99
|
+
data: sortedSubCates.map((subCate, subCateIndex) => {
|
|
100
|
+
const subCateId = `${categoryId}-${String(subCate.name).toLowerCase().split(' ').join('-')}-${subCate.order}-index-${subCateIndex}`;
|
|
101
|
+
return {
|
|
102
|
+
key: subCateId,
|
|
103
|
+
name: subCate.category,
|
|
104
|
+
type: 'sub-category',
|
|
105
|
+
data: (subCate.services || []).map(rawService => {
|
|
106
|
+
const serviceObj = createService(rawService);
|
|
107
|
+
return Object.assign(Object.assign({}, serviceObj), { type: 'service' });
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
110
|
+
}),
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
fetchSalonServices(salonId) {
|
|
115
|
+
const url = `${apiV1Prefix}/salon/services?v=2&id=${salonId}`;
|
|
116
|
+
return this.http.get(url)
|
|
117
|
+
.then(response => {
|
|
118
|
+
const { status, data } = response.data;
|
|
119
|
+
if (status) {
|
|
120
|
+
return this.decorateServiceGroups(data || []);
|
|
121
|
+
}
|
|
122
|
+
return [];
|
|
123
|
+
})
|
|
124
|
+
.catch(() => ([]));
|
|
125
|
+
}
|
|
126
|
+
fetchSalonStylists(salonId, options = { page: 1, limit: 12 }) {
|
|
127
|
+
const url = `${apiV2Prefix}/salon/${salonId}/stylists?page=${options.page}&limit=${options.limit}`;
|
|
128
|
+
return this.http.get(url)
|
|
129
|
+
.then(response => {
|
|
130
|
+
const { paging, data } = response.data;
|
|
131
|
+
return {
|
|
132
|
+
total: paging.total_item || data.length,
|
|
133
|
+
data: data.map(createStylist),
|
|
134
|
+
};
|
|
135
|
+
})
|
|
136
|
+
.catch(() => ({ total: 0, data: [] }));
|
|
137
|
+
}
|
|
138
|
+
fetchSalonReviews(salonId, options) {
|
|
139
|
+
const url = `${apiV2Prefix}/salon/${salonId}/reviews`;
|
|
140
|
+
return this.http.post(url, Object.assign({ avg_point_greater_than: 0 }, options))
|
|
141
|
+
.then(response => {
|
|
142
|
+
const { data, paging } = response.data || {};
|
|
143
|
+
const { total_1star: onestar, total_2star: twoStar, total_3star: threeStar, total_4star: fourStar, total_5star: fiveStar, total_review: totalReviews, avg_point: reviewPoint, } = paging.review_detail || {};
|
|
144
|
+
return {
|
|
145
|
+
total: paging.total_item || 0,
|
|
146
|
+
stats: {
|
|
147
|
+
totalReviews,
|
|
148
|
+
reviewPoint: reviewPoint ? Math.ceil(reviewPoint) : 0,
|
|
149
|
+
'1': onestar ? Math.ceil(onestar) : 0,
|
|
150
|
+
'2': twoStar ? Math.ceil(twoStar) : 0,
|
|
151
|
+
'3': threeStar ? Math.ceil(threeStar) : 0,
|
|
152
|
+
'4': fourStar ? Math.ceil(fourStar) : 0,
|
|
153
|
+
'5': fiveStar ? Math.ceil(fiveStar) : 0,
|
|
154
|
+
},
|
|
155
|
+
data: data.map(createReview),
|
|
156
|
+
};
|
|
157
|
+
})
|
|
158
|
+
.catch(() => ({ total: 0, stats: {}, data: [] }));
|
|
159
|
+
}
|
|
160
|
+
fetchSalonCategories() {
|
|
161
|
+
return this.http.post(`${apiV2Prefix}/search/get-services`, { limit: 50 })
|
|
162
|
+
.then((response) => {
|
|
163
|
+
const { status, data } = response.data;
|
|
164
|
+
if (status) {
|
|
165
|
+
return (data || []).map(blob => {
|
|
166
|
+
return {
|
|
167
|
+
id: blob.id,
|
|
168
|
+
name: blob.name,
|
|
169
|
+
image: blob.full_image,
|
|
170
|
+
imageThumb: blob.full_thumb_image,
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return [];
|
|
175
|
+
})
|
|
176
|
+
.catch(() => ([]));
|
|
177
|
+
}
|
|
178
|
+
fetchSalonLookbooks(salonId, options) {
|
|
179
|
+
const noResult = { total: 0, allLookbooks: [] };
|
|
180
|
+
const url = `${apiV2Prefix}/salon/${salonId}/styles`;
|
|
181
|
+
const postData = Object.assign({ page: 1, limit: 20 }, options);
|
|
182
|
+
return this.http.post(url, postData)
|
|
183
|
+
.then(response => {
|
|
184
|
+
const { status, data, paging } = response.data;
|
|
185
|
+
if (status) {
|
|
186
|
+
return {
|
|
187
|
+
total: paging.total_item || 0,
|
|
188
|
+
allLookbooks: (data || []).map(createFaveStyle),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return noResult;
|
|
192
|
+
})
|
|
193
|
+
.catch(() => (noResult));
|
|
194
|
+
}
|
|
195
|
+
fetchStyleComments(styleId) {
|
|
196
|
+
const url = `${apiV2Prefix}/style/comment?photo_id=${styleId}`;
|
|
197
|
+
return this.http.get(url)
|
|
198
|
+
.then(response => {
|
|
199
|
+
const { paging, data } = response.data;
|
|
200
|
+
return {
|
|
201
|
+
total: paging.total_item || 0,
|
|
202
|
+
data: data.map(createFaveStyleComment),
|
|
203
|
+
};
|
|
204
|
+
})
|
|
205
|
+
.catch(() => ({ total: 0, data: [] }));
|
|
206
|
+
}
|
|
207
|
+
createChatRoom(receiverId, accessToken) {
|
|
208
|
+
const url = `${apiV2Prefix}/chatroom/create/${receiverId}?access_token=${accessToken}`;
|
|
209
|
+
return this.http.get(url)
|
|
210
|
+
.then(response => {
|
|
211
|
+
const blob = get(response, 'data.data', {});
|
|
212
|
+
return createChatRoom(blob);
|
|
213
|
+
})
|
|
214
|
+
.catch(() => (null));
|
|
215
|
+
}
|
|
216
|
+
fetchRooms(accessToken, page, allRooms = []) {
|
|
217
|
+
const url = `${apiV2Prefix}/chatroom/get?page=${page}&limit=20&access_token=${accessToken}`;
|
|
218
|
+
return this.http.get(url)
|
|
219
|
+
.then(response => {
|
|
220
|
+
const blobs = get(response, 'data.data', []);
|
|
221
|
+
const chatRooms = blobs.map(createChatRoom);
|
|
222
|
+
// fetch next page's styles
|
|
223
|
+
if (chatRooms.length >= 20) {
|
|
224
|
+
return this.fetchRooms(accessToken, page + 1, allRooms.concat(chatRooms));
|
|
225
|
+
}
|
|
226
|
+
return page === 1 ? chatRooms : allRooms.concat(chatRooms);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
fetchChatRooms(accessToken) {
|
|
230
|
+
return this.fetchRooms(accessToken, 1)
|
|
231
|
+
.catch(() => ([]));
|
|
232
|
+
}
|
|
233
|
+
fetchChatMessages(roomId, onDone) {
|
|
234
|
+
if (this.firebaseDatabase) {
|
|
235
|
+
try {
|
|
236
|
+
const roomMessagesRef = ref(this.firebaseDatabase, `${firebaseMessagesNode}/${roomId}`);
|
|
237
|
+
onValue(roomMessagesRef, (snapshot) => {
|
|
238
|
+
const conversations = [];
|
|
239
|
+
each(snapshot.val(), (message, key) => {
|
|
240
|
+
const chatMessage = createChatMessage(Object.assign(Object.assign({}, message), { uid: key }));
|
|
241
|
+
conversations.push(chatMessage);
|
|
242
|
+
});
|
|
243
|
+
onDone(sortBy(conversations, 'timestamp'));
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
onDone([]);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return Promise.resolve({});
|
|
251
|
+
}
|
|
252
|
+
markMessagesAsRead(roomId, roomMessages) {
|
|
253
|
+
if (this.firebaseDatabase) {
|
|
254
|
+
try {
|
|
255
|
+
const roomMessagesRef = ref(this.firebaseDatabase, `${firebaseMessagesNode}/${roomId}`);
|
|
256
|
+
const updates = {};
|
|
257
|
+
roomMessages.forEach(message => {
|
|
258
|
+
const { uid } = message, nestedMessage = __rest(message, ["uid"]);
|
|
259
|
+
updates[`${message.uid}`] = Object.assign(Object.assign({}, nestedMessage), { unRead: 0 });
|
|
260
|
+
});
|
|
261
|
+
return update(roomMessagesRef, updates);
|
|
262
|
+
}
|
|
263
|
+
catch (error) { }
|
|
264
|
+
}
|
|
265
|
+
return Promise.reject();
|
|
266
|
+
}
|
|
267
|
+
sendChatMessage(options) {
|
|
268
|
+
if (this.firebaseDatabase) {
|
|
269
|
+
try {
|
|
270
|
+
const { message, senderId, chatRoomId } = options;
|
|
271
|
+
// Get a key for a new message.
|
|
272
|
+
const roomMessagesRef = ref(this.firebaseDatabase, `${firebaseMessagesNode}`);
|
|
273
|
+
const newMessageKey = push(child(roomMessagesRef, chatRoomId)).key;
|
|
274
|
+
const newMessageKeyPath = `/${chatRoomId}/${newMessageKey}`;
|
|
275
|
+
const newMessage = {
|
|
276
|
+
message,
|
|
277
|
+
unRead: 1,
|
|
278
|
+
senderId,
|
|
279
|
+
timestamp: dayjs().valueOf(),
|
|
280
|
+
};
|
|
281
|
+
// Store new message in Firebase
|
|
282
|
+
const updates = {
|
|
283
|
+
[newMessageKeyPath]: newMessage,
|
|
284
|
+
};
|
|
285
|
+
return update(roomMessagesRef, updates)
|
|
286
|
+
.then(() => {
|
|
287
|
+
return Object.assign(Object.assign({}, newMessage), { uid: newMessageKey });
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
catch (error) { }
|
|
291
|
+
}
|
|
292
|
+
return Promise.reject();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
export default () => new HttpService();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createUser } from './user';
|
|
2
|
+
export function createChatMessage(blob) {
|
|
3
|
+
return {
|
|
4
|
+
uid: blob.uid,
|
|
5
|
+
message: blob.message,
|
|
6
|
+
timestamp: blob.timestamp,
|
|
7
|
+
unRead: blob.unRead,
|
|
8
|
+
senderId: blob.senderId,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export class ChatRoom {
|
|
12
|
+
constructor(fields) {
|
|
13
|
+
Object.assign(this, fields);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function createChatRoom(blob) {
|
|
17
|
+
return new ChatRoom({
|
|
18
|
+
id: blob.id,
|
|
19
|
+
uid: blob.firebase_room_id,
|
|
20
|
+
members: blob.from_user && blob.to_user ? [createUser(blob.from_user), createUser(blob.to_user)] : [],
|
|
21
|
+
messages: [],
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const timeFormat = 'HH:mm:ss';
|
|
2
|
+
export const timeFormatAmPm = 'hh:mm A';
|
|
3
|
+
export const dateName = 'dddd';
|
|
4
|
+
export const dateFormat = 'YYYY-MM-DD';
|
|
5
|
+
export const dateTimeFormat = 'YYYY-MM-DD HH:mm:ss';
|
|
6
|
+
export const dateTimeFormatAmPm = 'YYYY-MM-DD hh:mm A';
|
|
7
|
+
export const shortDateFormat = 'ddd, MMM DD';
|
|
8
|
+
export const shortDateYearFormat = 'ddd, MMM DD YYYY';
|
|
9
|
+
export const apiV1Prefix = 'api';
|
|
10
|
+
export const apiV2Prefix = 'api-ver2';
|
|
11
|
+
export const defaultImage = 'https://res.cloudinary.com/reckon-mini-sites/image/upload/v1636477599/FaveSalon%20Social%20Website/default/default--picture_w3jvfh.png';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
|
-
import {
|
|
2
|
+
import { dateTimeFormat } from "./common";
|
|
3
|
+
import { createSalon } from "./salon";
|
|
4
|
+
import { createStylist } from "./stylist";
|
|
3
5
|
import { createUser } from "./user";
|
|
4
6
|
function createReviewPhoto(blob) {
|
|
5
7
|
return {
|
|
@@ -12,15 +14,15 @@ function createReviewPhoto(blob) {
|
|
|
12
14
|
export class Review {
|
|
13
15
|
}
|
|
14
16
|
export function createReview(blob) {
|
|
15
|
-
const reviewPhotos = blob.
|
|
17
|
+
const reviewPhotos = blob.review_photo || [];
|
|
16
18
|
const [createdDay, createdTime] = String(blob.create_date).split(' ');
|
|
17
19
|
const [updatedDay, updatedTime] = String(blob.update_date).split(' ');
|
|
18
20
|
return {
|
|
19
21
|
title: blob.title,
|
|
20
|
-
point: Math.ceil(Number(blob.avg_point)),
|
|
21
22
|
description: blob.comment,
|
|
22
|
-
createdDate: dayjs(`${createdDay} ${createdTime}`,
|
|
23
|
-
updatedDate: dayjs(`${updatedDay} ${updatedTime}`,
|
|
23
|
+
createdDate: dayjs(`${createdDay} ${createdTime}`, dateTimeFormat).valueOf(),
|
|
24
|
+
updatedDate: dayjs(`${updatedDay} ${updatedTime}`, dateTimeFormat).valueOf(),
|
|
25
|
+
point: Math.ceil(Number(blob.avg_point)),
|
|
24
26
|
pointView: blob.view_point,
|
|
25
27
|
pointPrice: blob.price_point,
|
|
26
28
|
pointProduct: blob.product_point,
|
|
@@ -30,6 +32,8 @@ export function createReview(blob) {
|
|
|
30
32
|
helpful: blob.helpful,
|
|
31
33
|
recommend: blob.recommend,
|
|
32
34
|
user: blob.user ? createUser(blob.user) : null,
|
|
35
|
+
salon: blob.salon ? createSalon(blob.salon) : null,
|
|
36
|
+
stylist: blob.stylist && blob.stylist.user ? createStylist(blob.stylist) : null,
|
|
33
37
|
photos: reviewPhotos.map(createReviewPhoto),
|
|
34
38
|
};
|
|
35
39
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Colors } from '../constants/colors';
|
|
2
|
+
import { defaultImage } from './common';
|
|
3
|
+
export var BusinessHourStatus;
|
|
4
|
+
(function (BusinessHourStatus) {
|
|
5
|
+
BusinessHourStatus[BusinessHourStatus["Open"] = 0] = "Open";
|
|
6
|
+
BusinessHourStatus[BusinessHourStatus["Close"] = 1] = "Close";
|
|
7
|
+
BusinessHourStatus[BusinessHourStatus["ByAppointment"] = 2] = "ByAppointment";
|
|
8
|
+
})(BusinessHourStatus || (BusinessHourStatus = {}));
|
|
9
|
+
export function createSalon(blob) {
|
|
10
|
+
const geoLocations = blob.salon_geolocation || [];
|
|
11
|
+
let salonImages = [];
|
|
12
|
+
if (blob.salon_miniwebsite) {
|
|
13
|
+
const activeSite = Array.isArray(blob.salon_miniwebsite) ? blob.salon_miniwebsite[0] : (blob.salon_miniwebsite || {});
|
|
14
|
+
salonImages = [
|
|
15
|
+
activeSite.full_small_slider_img1,
|
|
16
|
+
activeSite.full_small_slider_img2,
|
|
17
|
+
activeSite.full_small_slider_img3,
|
|
18
|
+
].filter(image => !!image);
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
id: blob.id,
|
|
22
|
+
about: blob.about,
|
|
23
|
+
email: blob.email,
|
|
24
|
+
ownerName: blob.owner_name,
|
|
25
|
+
fullProfileImage: blob.full_profile_image,
|
|
26
|
+
fullCoverImage: blob.full_cover_image,
|
|
27
|
+
subdomain: blob.subdomain,
|
|
28
|
+
website: blob.website,
|
|
29
|
+
businessName: blob.business_name,
|
|
30
|
+
businessPhone: blob.business_phone,
|
|
31
|
+
businessAddress: blob.business_address,
|
|
32
|
+
businessLocationLat: geoLocations.length > 0 ? geoLocations[0].location_lat : null,
|
|
33
|
+
businessLocationLng: geoLocations.length > 0 ? geoLocations[0].location_lng : null,
|
|
34
|
+
city: blob.city,
|
|
35
|
+
state: blob.state,
|
|
36
|
+
zipcode: blob.zipcode ? Number(blob.zipcode) : null,
|
|
37
|
+
businessHours: (blob.business_hours || blob.salon_working_time || []).map(bh => {
|
|
38
|
+
return {
|
|
39
|
+
dayName: bh.day_name,
|
|
40
|
+
openTime: bh.open_time,
|
|
41
|
+
closeTime: bh.close_time,
|
|
42
|
+
status: bh.status,
|
|
43
|
+
};
|
|
44
|
+
}),
|
|
45
|
+
rating: Number(blob.rating_point),
|
|
46
|
+
primaryColor: blob.primary_color || Colors.Primary,
|
|
47
|
+
salonImages,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function getSalonImage({ salonImages, fullProfileImage }) {
|
|
51
|
+
if (salonImages && salonImages.length > 0) {
|
|
52
|
+
return salonImages[0];
|
|
53
|
+
}
|
|
54
|
+
if (fullProfileImage) {
|
|
55
|
+
return fullProfileImage;
|
|
56
|
+
}
|
|
57
|
+
return defaultImage;
|
|
58
|
+
}
|