favesalon-embed 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/{cjs → dist/cjs}/_commonjsHelpers-5cfcba41.js +0 -0
- package/dist/cjs/colors-38421769.js +69 -0
- package/dist/cjs/favesalon-embed.cjs.js +20 -0
- package/{cjs → dist/cjs}/global-9073d10e.js +0 -0
- package/dist/cjs/google-map_5.cjs.entry.js +291 -0
- package/{cjs/index-48ac68d0.js → dist/cjs/index-7f190886.js} +1924 -0
- package/{cjs/index-d5de0b9d.js → dist/cjs/index-e6bea8f5.js} +10 -0
- package/{cjs → dist/cjs}/index.cjs.js +0 -0
- package/dist/cjs/loader.cjs.js +22 -0
- package/{cjs → dist/cjs}/salon-booking-modal.cjs.entry.js +5 -5
- package/{cjs → dist/cjs}/salon-booking.cjs.entry.js +6 -7
- package/dist/cjs/salon-gift-card-modal.cjs.entry.js +28 -0
- package/{cjs → dist/cjs}/salon-gift-card.cjs.entry.js +7 -7
- package/dist/cjs/salon-latest-reviews.cjs.entry.js +95 -0
- package/{cjs/salon-lookbook_2.cjs.entry.js → dist/cjs/salon-lookbook.cjs.entry.js} +23 -57
- package/{cjs → dist/cjs}/salon-ranking.cjs.entry.js +7 -7
- package/dist/cjs/salon-reviews.cjs.entry.js +186 -0
- package/dist/cjs/salon-services.cjs.entry.js +78 -0
- package/dist/cjs/salon-stylists.cjs.entry.js +112 -0
- package/{cjs/services-f1102d4a.js → dist/cjs/services-eee8f251.js} +265 -393
- package/dist/cjs/style-detail.cjs.entry.js +310 -0
- package/dist/cjs/user-avatar.cjs.entry.js +41 -0
- package/{cjs → dist/cjs}/utils-c5a33b3c.js +0 -0
- package/{collection → dist/collection}/collection-manifest.json +2 -3
- 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 +86 -0
- package/{collection → dist/collection}/components/salon-booking/index.css +10 -24
- package/{collection → dist/collection}/components/salon-booking/index.js +3 -3
- package/{collection → dist/collection}/components/salon-booking/salon-booking-modal.js +4 -4
- package/dist/collection/components/salon-gift-card/index.css +25 -0
- package/{collection → dist/collection}/components/salon-gift-card/index.js +4 -3
- package/{collection → dist/collection}/components/salon-gift-card/salon-gift-card-modal.js +24 -3
- package/{collection/components/salon-locations → dist/collection/components/salon-info}/index.css +0 -0
- package/{collection → dist/collection}/components/salon-info/index.js +6 -32
- package/{collection → dist/collection}/components/salon-latest-reviews/index.css +0 -3
- package/dist/collection/components/salon-latest-reviews/index.js +176 -0
- package/dist/collection/components/salon-latest-styles/index.css +10 -0
- package/dist/collection/components/salon-latest-styles/index.js +178 -0
- package/{collection/components/salon-contact → dist/collection/components/salon-locations}/index.css +6 -6
- package/dist/collection/components/salon-locations/index.js +151 -0
- package/{collection → dist/collection}/components/salon-lookbook/index.css +0 -9
- package/{collection → dist/collection}/components/salon-lookbook/index.js +19 -19
- package/{collection → dist/collection}/components/salon-ranking/index.css +0 -0
- package/{collection → dist/collection}/components/salon-ranking/index.js +5 -5
- package/{collection → dist/collection}/components/salon-reviews/index.css +0 -0
- package/dist/collection/components/salon-reviews/index.js +286 -0
- package/dist/collection/components/salon-schedules/index.css +15 -0
- package/dist/collection/components/salon-schedules/index.js +189 -0
- package/{collection → dist/collection}/components/salon-services/index.css +0 -0
- package/{collection → dist/collection}/components/salon-services/index.js +51 -8
- package/{collection → dist/collection}/components/salon-stylists/index.css +0 -8
- package/dist/collection/components/salon-stylists/index.js +183 -0
- package/dist/collection/components/style-detail/index.css +62 -0
- package/dist/collection/components/style-detail/index.js +461 -0
- package/{collection → dist/collection}/components/user-avatar/index.css +0 -0
- package/{collection → dist/collection}/components/user-avatar/index.js +2 -2
- package/dist/collection/constants/colors.js +65 -0
- package/{collection → dist/collection}/global/global.js +0 -0
- package/{collection → dist/collection}/index.js +0 -0
- package/dist/collection/services/services.js +174 -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/{collection → dist/collection}/types/service.js +0 -0
- package/dist/collection/types/style.js +128 -0
- package/{collection → dist/collection}/types/stylist.js +12 -9
- package/{favesalon-embed/index.esm.js → dist/collection/types/tmp.js} +0 -0
- package/{collection → dist/collection}/types/user.js +2 -2
- package/{collection → dist/collection}/utils/utils.js +0 -0
- package/{custom-elements → dist/custom-elements}/index.d.ts +12 -18
- package/{custom-elements → dist/custom-elements}/index.js +1227 -1035
- package/{esm → dist/esm}/_commonjsHelpers-098d5b27.js +0 -0
- package/dist/esm/colors-ea36347a.js +67 -0
- package/dist/esm/favesalon-embed.js +18 -0
- package/{esm → dist/esm}/global-e1089ffd.js +0 -0
- package/dist/esm/google-map_5.entry.js +283 -0
- package/{esm/index-0f8eed73.js → dist/esm/index-6af0a03d.js} +10 -1
- package/{esm/index-67d677ba.js → dist/esm/index-80523fec.js} +1924 -1
- package/{esm → dist/esm}/index.js +0 -0
- package/dist/esm/loader.js +18 -0
- package/{esm → dist/esm}/polyfills/core-js.js +0 -0
- package/{esm → dist/esm}/polyfills/css-shim.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}/salon-booking-modal.entry.js +5 -5
- package/{esm → dist/esm}/salon-booking.entry.js +5 -6
- package/dist/esm/salon-gift-card-modal.entry.js +24 -0
- package/{esm → dist/esm}/salon-gift-card.entry.js +6 -6
- package/dist/esm/salon-latest-reviews.entry.js +91 -0
- package/{esm/salon-lookbook_2.entry.js → dist/esm/salon-lookbook.entry.js} +24 -57
- package/{esm → dist/esm}/salon-ranking.entry.js +7 -7
- package/dist/esm/salon-reviews.entry.js +182 -0
- package/dist/esm/salon-services.entry.js +74 -0
- package/dist/esm/salon-stylists.entry.js +108 -0
- package/{esm/services-74d84ca9.js → dist/esm/services-295247b1.js} +263 -392
- package/dist/esm/style-detail.entry.js +306 -0
- package/dist/esm/user-avatar.entry.js +37 -0
- package/{esm → dist/esm}/utils-e97485e0.js +0 -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/index.esm.js +0 -0
- package/dist/favesalon-embed/p-292b97ba.entry.js +1 -0
- package/{favesalon-embed → dist/favesalon-embed}/p-47e646f8.js +0 -0
- package/dist/favesalon-embed/p-4869dfed.entry.js +1 -0
- package/{favesalon-embed → dist/favesalon-embed}/p-4a5eca9a.js +0 -0
- package/dist/favesalon-embed/p-4aee4fd9.entry.js +1 -0
- package/dist/favesalon-embed/p-5528c705.entry.js +1 -0
- package/dist/favesalon-embed/p-612ad685.entry.js +1 -0
- package/dist/favesalon-embed/p-75aef7e0.entry.js +1 -0
- package/dist/favesalon-embed/p-8c780874.entry.js +1 -0
- package/dist/favesalon-embed/p-8dbf04c5.js +1 -0
- package/dist/favesalon-embed/p-9f31061a.entry.js +1 -0
- package/dist/favesalon-embed/p-a33331cc.js +1 -0
- package/dist/favesalon-embed/p-a60d78e9.entry.js +1 -0
- package/dist/favesalon-embed/p-a6debdae.entry.js +1 -0
- package/dist/favesalon-embed/p-bad1e9a7.entry.js +1 -0
- package/dist/favesalon-embed/p-c2ecb365.js +1 -0
- package/dist/favesalon-embed/p-c7dea70c.entry.js +1 -0
- package/{favesalon-embed → dist/favesalon-embed}/p-d6083940.js +0 -0
- package/dist/favesalon-embed/p-f0e14641.entry.js +1 -0
- package/dist/favesalon-embed/p-fc9a5551.js +6 -0
- package/{index.cjs.js → dist/index.cjs.js} +0 -0
- package/{index.js → dist/index.js} +0 -0
- package/dist/types/components/google-map/index.d.ts +5 -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-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/{types → dist/types}/components/salon-ranking/index.d.ts +0 -0
- 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/user-avatar/index.d.ts +0 -0
- package/{types → dist/types}/components.d.ts +54 -59
- package/dist/types/constants/colors.d.ts +65 -0
- package/{types → dist/types}/index.d.ts +0 -0
- package/dist/types/services/services.d.ts +60 -0
- package/{types → dist/types}/stencil-public-runtime.d.ts +0 -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/{types → dist/types}/types/service.d.ts +0 -0
- package/dist/types/types/style.d.ts +88 -0
- package/{types → dist/types}/types/stylist.d.ts +1 -1
- package/dist/types/types/tmp.d.ts +0 -0
- package/{types → dist/types}/types/user.d.ts +2 -2
- package/{types → dist/types}/utils/utils.d.ts +0 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +18 -13
- 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/collection/components/google-map/index.js +0 -97
- package/collection/components/salon-contact/index.js +0 -88
- package/collection/components/salon-gift-card/index.css +0 -25
- package/collection/components/salon-info/index.css +0 -3
- package/collection/components/salon-latest-reviews/index.js +0 -108
- package/collection/components/salon-locations/index.js +0 -80
- 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-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-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/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/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/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/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-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
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import sortBy from 'lodash/sortBy';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { createSalon } from '../types/salon';
|
|
4
|
+
import { createFaveStyle, createFaveStyleComment } from '../types/style';
|
|
5
|
+
import { createService } from '../types/service';
|
|
6
|
+
import { createStylist } from '../types/stylist';
|
|
7
|
+
import { createReview } from '../types/review';
|
|
8
|
+
import { apiV1Prefix } from '../types/common';
|
|
9
|
+
const apiV2Prefix = 'api-ver2';
|
|
10
|
+
class HttpService {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.http = null;
|
|
13
|
+
this.http = axios.create({
|
|
14
|
+
baseURL: 'https://favesalon.com',
|
|
15
|
+
// baseURL: 'http://13.57.216.170',
|
|
16
|
+
headers: {},
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
fetchStyleDetail(styleId) {
|
|
20
|
+
return this.http.get(`${apiV2Prefix}/style/${styleId}/detail`)
|
|
21
|
+
.then((response) => {
|
|
22
|
+
const { status, data } = response.data;
|
|
23
|
+
if (status) {
|
|
24
|
+
let styleInfo = null, similarStyles = [];
|
|
25
|
+
try {
|
|
26
|
+
styleInfo = createFaveStyle(data);
|
|
27
|
+
similarStyles = (data.style_similars || []).map(createFaveStyle);
|
|
28
|
+
}
|
|
29
|
+
catch (e) { }
|
|
30
|
+
return { styleInfo, similarStyles };
|
|
31
|
+
}
|
|
32
|
+
return { styleInfo: null, similarStyles: [] };
|
|
33
|
+
})
|
|
34
|
+
.catch(() => {
|
|
35
|
+
return { styleInfo: null, similarStyles: [] };
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
fetchSalonInfo(salonId) {
|
|
39
|
+
const url = `${apiV2Prefix}/salon/${salonId}/detail`;
|
|
40
|
+
return this.http.get(url)
|
|
41
|
+
.then((response) => {
|
|
42
|
+
const { status, data } = response.data;
|
|
43
|
+
return status && data ? createSalon(data) : null;
|
|
44
|
+
})
|
|
45
|
+
.catch(() => (null));
|
|
46
|
+
}
|
|
47
|
+
fetchSalonLatestStyles(salonId, options) {
|
|
48
|
+
const url = `${apiV2Prefix}/salon/${salonId}/styles`;
|
|
49
|
+
return this.http.post(url, Object.assign(Object.assign({}, options), { sort: 'newest' }))
|
|
50
|
+
.then(response => {
|
|
51
|
+
const { data } = response.data;
|
|
52
|
+
return (data || []).slice(0, options.limit).map(createFaveStyle);
|
|
53
|
+
})
|
|
54
|
+
.catch(() => ([]));
|
|
55
|
+
}
|
|
56
|
+
decorateServiceGroups(groups) {
|
|
57
|
+
return groups.map((cate, index) => {
|
|
58
|
+
const cateName = cate.name;
|
|
59
|
+
const categoryId = `${cate.service_id}-${String(cateName).toLowerCase().split(' ').join('-')}-${cate.order}-index-${index}`;
|
|
60
|
+
const sortedSubCates = sortBy(cate.service_groups, [subCate => subCate.order]);
|
|
61
|
+
return {
|
|
62
|
+
id: categoryId,
|
|
63
|
+
name: cateName,
|
|
64
|
+
type: 'category',
|
|
65
|
+
data: sortedSubCates.map((subCate, subCateIndex) => {
|
|
66
|
+
const subCateId = `${categoryId}-${String(subCate.name).toLowerCase().split(' ').join('-')}-${subCate.order}-index-${subCateIndex}`;
|
|
67
|
+
return {
|
|
68
|
+
key: subCateId,
|
|
69
|
+
name: subCate.category,
|
|
70
|
+
type: 'sub-category',
|
|
71
|
+
data: (subCate.services || []).map(rawService => {
|
|
72
|
+
const serviceObj = createService(rawService);
|
|
73
|
+
return Object.assign(Object.assign({}, serviceObj), { type: 'service' });
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
fetchSalonServices(salonId) {
|
|
81
|
+
const url = `${apiV1Prefix}/salon/services?v=2&id=${salonId}`;
|
|
82
|
+
return this.http.get(url)
|
|
83
|
+
.then(response => {
|
|
84
|
+
const { status, data } = response.data;
|
|
85
|
+
if (status) {
|
|
86
|
+
return this.decorateServiceGroups(data || []);
|
|
87
|
+
}
|
|
88
|
+
return [];
|
|
89
|
+
})
|
|
90
|
+
.catch(() => ([]));
|
|
91
|
+
}
|
|
92
|
+
fetchSalonStylists(salonId, options = { page: 1, limit: 12 }) {
|
|
93
|
+
const url = `${apiV2Prefix}/salon/${salonId}/stylists?page=${options.page}&limit=${options.limit}`;
|
|
94
|
+
return this.http.get(url)
|
|
95
|
+
.then(response => {
|
|
96
|
+
const { paging, data } = response.data;
|
|
97
|
+
return {
|
|
98
|
+
total: paging.total_item || data.length,
|
|
99
|
+
data: data.map(createStylist),
|
|
100
|
+
};
|
|
101
|
+
})
|
|
102
|
+
.catch(() => ({ total: 0, data: [] }));
|
|
103
|
+
}
|
|
104
|
+
fetchSalonReviews(salonId, options) {
|
|
105
|
+
const url = `${apiV2Prefix}/salon/${salonId}/reviews`;
|
|
106
|
+
return this.http.post(url, Object.assign({ avg_point_greater_than: 0 }, options))
|
|
107
|
+
.then(response => {
|
|
108
|
+
const { data, paging } = response.data || {};
|
|
109
|
+
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 || {};
|
|
110
|
+
return {
|
|
111
|
+
total: paging.total_item || 0,
|
|
112
|
+
stats: {
|
|
113
|
+
totalReviews,
|
|
114
|
+
reviewPoint: reviewPoint ? Math.ceil(reviewPoint) : 0,
|
|
115
|
+
'1': onestar ? Math.ceil(onestar) : 0,
|
|
116
|
+
'2': twoStar ? Math.ceil(twoStar) : 0,
|
|
117
|
+
'3': threeStar ? Math.ceil(threeStar) : 0,
|
|
118
|
+
'4': fourStar ? Math.ceil(fourStar) : 0,
|
|
119
|
+
'5': fiveStar ? Math.ceil(fiveStar) : 0,
|
|
120
|
+
},
|
|
121
|
+
data: data.map(createReview),
|
|
122
|
+
};
|
|
123
|
+
})
|
|
124
|
+
.catch(() => ({ total: 0, stats: {}, data: [] }));
|
|
125
|
+
}
|
|
126
|
+
fetchSalonCategories() {
|
|
127
|
+
return this.http.post(`${apiV2Prefix}/search/get-services`, { limit: 50 })
|
|
128
|
+
.then((response) => {
|
|
129
|
+
const { status, data } = response.data;
|
|
130
|
+
if (status) {
|
|
131
|
+
return (data || []).map(blob => {
|
|
132
|
+
return {
|
|
133
|
+
id: blob.id,
|
|
134
|
+
name: blob.name,
|
|
135
|
+
image: blob.full_image,
|
|
136
|
+
imageThumb: blob.full_thumb_image,
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return [];
|
|
141
|
+
})
|
|
142
|
+
.catch(() => ([]));
|
|
143
|
+
}
|
|
144
|
+
fetchSalonLookbooks(salonId, options) {
|
|
145
|
+
const noResult = { total: 0, allLookbooks: [] };
|
|
146
|
+
const url = `${apiV2Prefix}/salon/${salonId}/styles`;
|
|
147
|
+
const postData = Object.assign({ page: 1, limit: 20 }, options);
|
|
148
|
+
return this.http.post(url, postData)
|
|
149
|
+
.then(response => {
|
|
150
|
+
const { status, data, paging } = response.data;
|
|
151
|
+
if (status) {
|
|
152
|
+
return {
|
|
153
|
+
total: paging.total_item || 0,
|
|
154
|
+
allLookbooks: (data || []).map(createFaveStyle),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
return noResult;
|
|
158
|
+
})
|
|
159
|
+
.catch(() => (noResult));
|
|
160
|
+
}
|
|
161
|
+
fetchStyleComments(styleId) {
|
|
162
|
+
const url = `${apiV2Prefix}/style/comment?photo_id=${styleId}`;
|
|
163
|
+
return this.http.get(url)
|
|
164
|
+
.then(response => {
|
|
165
|
+
const { paging, data } = response.data;
|
|
166
|
+
return {
|
|
167
|
+
total: paging.total_item || 0,
|
|
168
|
+
data: data.map(createFaveStyleComment),
|
|
169
|
+
};
|
|
170
|
+
})
|
|
171
|
+
.catch(() => ({ total: 0, data: [] }));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export default () => new HttpService();
|
|
@@ -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
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { dateTimeFormat } from './common';
|
|
3
|
+
import { createSalon } from './salon';
|
|
4
|
+
import { createService } from './service';
|
|
5
|
+
import { createStylistFromLookbook } from './stylist';
|
|
6
|
+
import { createUser } from './user';
|
|
7
|
+
export var MediaType;
|
|
8
|
+
(function (MediaType) {
|
|
9
|
+
MediaType[MediaType["Photo"] = 0] = "Photo";
|
|
10
|
+
MediaType[MediaType["Video"] = 1] = "Video";
|
|
11
|
+
})(MediaType || (MediaType = {}));
|
|
12
|
+
export class AlbumMedia {
|
|
13
|
+
constructor(fields) {
|
|
14
|
+
Object.assign(this, fields);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function createAlbumMedia(blob) {
|
|
18
|
+
const [createdDay, createdTime] = blob.create_date ? String(blob.create_date).split(' ') : [];
|
|
19
|
+
const createdDateTime = createdDay && createdTime ? dayjs(`${createdDay} ${createdTime}`, dateTimeFormat).valueOf() : null;
|
|
20
|
+
const [updatedDay, updatedTime] = blob.update_date ? String(blob.update_date).split(' ') : [];
|
|
21
|
+
const updatedDateTime = updatedDay && updatedTime ? dayjs(`${updatedDay} ${updatedTime}`, dateTimeFormat).valueOf() : null;
|
|
22
|
+
const isVideo = blob.media_type === MediaType.Video || blob.full_image_url.indexOf('.mp4') > -1;
|
|
23
|
+
return new AlbumMedia({
|
|
24
|
+
id: blob.id,
|
|
25
|
+
caption: blob.caption,
|
|
26
|
+
description: blob.description,
|
|
27
|
+
createdDate: createdDateTime,
|
|
28
|
+
updatedDate: updatedDateTime,
|
|
29
|
+
mediaUrl: blob.full_image_url,
|
|
30
|
+
imageThumb: !isVideo ? blob.full_image_url_thumb : null,
|
|
31
|
+
imageThumbMedium: !isVideo ? blob.full_image_url_medium : null,
|
|
32
|
+
imageWidth: !isVideo ? blob.img_w : 400,
|
|
33
|
+
imageHeight: !isVideo ? blob.img_h : 300,
|
|
34
|
+
mediaType: isVideo ? MediaType.Video : blob.media_type,
|
|
35
|
+
totalLike: blob.total_like,
|
|
36
|
+
totalDislike: blob.total_dislike,
|
|
37
|
+
totalShare: blob.total_shared,
|
|
38
|
+
totalView: blob.view_count,
|
|
39
|
+
totalBooking: blob.total_booking,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export class Album {
|
|
43
|
+
constructor(fields) {
|
|
44
|
+
Object.assign(this, fields);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export function createAlbum(blob) {
|
|
48
|
+
return new Album({
|
|
49
|
+
id: blob.id,
|
|
50
|
+
name: blob.name,
|
|
51
|
+
caption: blob.caption,
|
|
52
|
+
description: blob.description,
|
|
53
|
+
tags: blob.tags ? blob.tags.filter(tag => !!tag) : [],
|
|
54
|
+
salonId: blob.salon_id,
|
|
55
|
+
stylistId: blob.stylist_id,
|
|
56
|
+
totalMedias: blob.total_medias || 0,
|
|
57
|
+
service: blob.service ? createService(blob.service) : null,
|
|
58
|
+
isPublic: (typeof blob.is_public !== 'undefined') ? Boolean(blob.is_public) : true,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export class FaveStyleComment {
|
|
62
|
+
constructor(fields) {
|
|
63
|
+
Object.assign(this, fields);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function createFaveStyleComment(blob) {
|
|
67
|
+
const [createdDay, createdTime] = blob.create_date ? String(blob.create_date).split(' ') : [];
|
|
68
|
+
const createdDateTime = createdDay && createdTime ? dayjs(`${createdDay} ${createdTime}`, dateTimeFormat).valueOf() : null;
|
|
69
|
+
const [updatedDay, updatedTime] = blob.update_date ? String(blob.update_date).split(' ') : [];
|
|
70
|
+
const updatedDateTime = updatedDay && updatedTime ? dayjs(`${updatedDay} ${updatedTime}`, dateTimeFormat).valueOf() : null;
|
|
71
|
+
return new FaveStyleComment({
|
|
72
|
+
id: blob.id,
|
|
73
|
+
type: blob.type,
|
|
74
|
+
title: blob.content,
|
|
75
|
+
description: blob.description,
|
|
76
|
+
createdDate: createdDateTime,
|
|
77
|
+
updatedDate: updatedDateTime,
|
|
78
|
+
parentCommentId: blob.parentCommentId,
|
|
79
|
+
childComments: blob.child_comment ? blob.child_comment.map(createFaveStyleComment) : [],
|
|
80
|
+
user: createUser(blob.user),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
export class FaveStyle {
|
|
84
|
+
constructor(fields) {
|
|
85
|
+
Object.assign(this, fields);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export function createFaveStyle(blob) {
|
|
89
|
+
const [createdDay, createdTime] = blob.create_date ? String(blob.create_date).split(' ') : [];
|
|
90
|
+
const createdDateTime = createdDay && createdTime ? dayjs(`${createdDay} ${createdTime}`, dateTimeFormat).valueOf() : null;
|
|
91
|
+
const [updatedDay, updatedTime] = blob.update_date ? String(blob.update_date).split(' ') : [];
|
|
92
|
+
const updatedDateTime = updatedDay && updatedTime ? dayjs(`${updatedDay} ${updatedTime}`, dateTimeFormat).valueOf() : null;
|
|
93
|
+
const albumMedias = [createAlbumMedia(blob)].concat(blob.album_medias ? blob.album_medias.map(createAlbumMedia).filter(ap => ap.id !== blob.id) : []);
|
|
94
|
+
const { total_booked: totalBooked, total_like: totalLike, total_share: totalShare, total_view: totalView, } = blob.style_activity || {};
|
|
95
|
+
return new FaveStyle({
|
|
96
|
+
id: blob.id,
|
|
97
|
+
caption: blob.caption,
|
|
98
|
+
description: blob.description,
|
|
99
|
+
createdDate: createdDateTime,
|
|
100
|
+
updatedDate: updatedDateTime,
|
|
101
|
+
imageUrl: blob.full_image_url,
|
|
102
|
+
imageThumb: blob.full_image_url_thumb,
|
|
103
|
+
imageThumbMedium: blob.full_image_url_medium,
|
|
104
|
+
imageWidth: blob.img_w,
|
|
105
|
+
imageHeight: blob.img_h,
|
|
106
|
+
mediaType: blob.media_type,
|
|
107
|
+
isPublic: (typeof blob.is_public !== 'undefined') ? Boolean(blob.is_public) : true,
|
|
108
|
+
totalBooking: totalBooked || 0,
|
|
109
|
+
totalLike: totalLike || 0,
|
|
110
|
+
totalDislike: blob.total_dislike || 0,
|
|
111
|
+
totalShare: totalShare || 0,
|
|
112
|
+
totalView: totalView || 0,
|
|
113
|
+
albumMedias,
|
|
114
|
+
album: blob.album ? createAlbum(blob.album) : null,
|
|
115
|
+
owner: blob.user ? createUser(blob.user) : null,
|
|
116
|
+
salonId: blob.salon_id ? Number(blob.salon_id) : null,
|
|
117
|
+
salon: blob.salon ? createSalon(blob.salon) : null,
|
|
118
|
+
stylistId: blob.stylist_id ? Number(blob.stylist_id) : null,
|
|
119
|
+
stylist: blob.stylist ? createStylistFromLookbook(blob.stylist) : null,
|
|
120
|
+
isLiked: blob.my_activity && blob.my_activity.liked,
|
|
121
|
+
serviceId: blob.service_id ? Number(blob.service_id) : null,
|
|
122
|
+
salonServiceId: blob.category_service_id ? Number(blob.category_service_id) : null,
|
|
123
|
+
productBrand: blob.product_brand_used || '',
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export function isVideoMedia({ mediaType }) {
|
|
127
|
+
return mediaType === MediaType.Video;
|
|
128
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export function createStylist(blob) {
|
|
2
2
|
const ratingPercentage = blob.rating_percent ? Number(blob.rating_percent) : 0;
|
|
3
|
+
const { first_name, last_name, mobile_phone, avatar, full_profile_image, } = blob.user || {};
|
|
4
|
+
const userNames = [first_name, last_name].filter(name => !!name);
|
|
3
5
|
return {
|
|
4
|
-
id: Number(blob.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
avatar:
|
|
9
|
-
phone:
|
|
6
|
+
id: Number(blob.id),
|
|
7
|
+
firstName: first_name,
|
|
8
|
+
lastName: last_name,
|
|
9
|
+
fullName: userNames.length > 0 ? userNames.join(' ') : blob.email,
|
|
10
|
+
avatar: avatar || full_profile_image,
|
|
11
|
+
phone: mobile_phone,
|
|
10
12
|
expertise: Boolean(blob.expertise),
|
|
11
13
|
rating: Math.ceil((ratingPercentage * 5) / 100),
|
|
12
14
|
};
|
|
@@ -14,14 +16,15 @@ export function createStylist(blob) {
|
|
|
14
16
|
export function createStylistFromLookbook(blob) {
|
|
15
17
|
const { user } = blob;
|
|
16
18
|
const ratingPercentage = blob.rating_percent ? Number(blob.rating_percent) : 0;
|
|
19
|
+
const userNames = [user.first_name, user.last_name].filter(name => !!name);
|
|
17
20
|
return {
|
|
18
21
|
id: Number(blob.id),
|
|
19
|
-
expertise: Boolean(blob.expertise),
|
|
20
|
-
rating: Math.ceil((ratingPercentage * 5) / 100),
|
|
21
|
-
name: [user.first_name, user.last_name].filter(field => !!field).join(' '),
|
|
22
22
|
firstName: user.first_name,
|
|
23
23
|
lastName: user.last_name,
|
|
24
|
+
fullName: userNames.length > 0 ? userNames.join(' ') : (blob.fullName || blob.name || blob.title),
|
|
24
25
|
avatar: user.full_avatar || user.full_profile_image_thumb,
|
|
25
26
|
phone: user.mobile_phone,
|
|
27
|
+
expertise: Boolean(blob.expertise),
|
|
28
|
+
rating: Math.ceil((ratingPercentage * 5) / 100),
|
|
26
29
|
};
|
|
27
30
|
}
|
|
File without changes
|
|
@@ -2,9 +2,9 @@ export function createUser(blob) {
|
|
|
2
2
|
const userNames = [blob.first_name, blob.last_name].filter(name => !!name);
|
|
3
3
|
return {
|
|
4
4
|
id: blob.user_id,
|
|
5
|
-
name: userNames.length > 0 ? userNames.join(' ') : blob.username,
|
|
6
5
|
firstName: blob.first_name,
|
|
7
6
|
lastName: blob.last_name,
|
|
8
|
-
|
|
7
|
+
fullName: userNames.length > 0 ? userNames.join(' ') : (blob.fullName || blob.name || blob.username),
|
|
8
|
+
avatar: blob.avatar || blob.full_profile_image_thumb,
|
|
9
9
|
};
|
|
10
10
|
}
|
|
File without changes
|
|
@@ -20,12 +20,6 @@ export const SalonBookingModal: {
|
|
|
20
20
|
new (): SalonBookingModal;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
interface SalonContact extends Components.SalonContact, HTMLElement {}
|
|
24
|
-
export const SalonContact: {
|
|
25
|
-
prototype: SalonContact;
|
|
26
|
-
new (): SalonContact;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
23
|
interface SalonGiftCard extends Components.SalonGiftCard, HTMLElement {}
|
|
30
24
|
export const SalonGiftCard: {
|
|
31
25
|
prototype: SalonGiftCard;
|
|
@@ -50,6 +44,12 @@ export const SalonLatestReviews: {
|
|
|
50
44
|
new (): SalonLatestReviews;
|
|
51
45
|
};
|
|
52
46
|
|
|
47
|
+
interface SalonLatestStyles extends Components.SalonLatestStyles, HTMLElement {}
|
|
48
|
+
export const SalonLatestStyles: {
|
|
49
|
+
prototype: SalonLatestStyles;
|
|
50
|
+
new (): SalonLatestStyles;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
53
|
interface SalonLocations extends Components.SalonLocations, HTMLElement {}
|
|
54
54
|
export const SalonLocations: {
|
|
55
55
|
prototype: SalonLocations;
|
|
@@ -62,12 +62,6 @@ export const SalonLookbook: {
|
|
|
62
62
|
new (): SalonLookbook;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
interface SalonLookbookModal extends Components.SalonLookbookModal, HTMLElement {}
|
|
66
|
-
export const SalonLookbookModal: {
|
|
67
|
-
prototype: SalonLookbookModal;
|
|
68
|
-
new (): SalonLookbookModal;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
65
|
interface SalonRanking extends Components.SalonRanking, HTMLElement {}
|
|
72
66
|
export const SalonRanking: {
|
|
73
67
|
prototype: SalonRanking;
|
|
@@ -92,18 +86,18 @@ export const SalonServices: {
|
|
|
92
86
|
new (): SalonServices;
|
|
93
87
|
};
|
|
94
88
|
|
|
95
|
-
interface SalonStyles extends Components.SalonStyles, HTMLElement {}
|
|
96
|
-
export const SalonStyles: {
|
|
97
|
-
prototype: SalonStyles;
|
|
98
|
-
new (): SalonStyles;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
89
|
interface SalonStylists extends Components.SalonStylists, HTMLElement {}
|
|
102
90
|
export const SalonStylists: {
|
|
103
91
|
prototype: SalonStylists;
|
|
104
92
|
new (): SalonStylists;
|
|
105
93
|
};
|
|
106
94
|
|
|
95
|
+
interface StyleDetail extends Components.StyleDetail, HTMLElement {}
|
|
96
|
+
export const StyleDetail: {
|
|
97
|
+
prototype: StyleDetail;
|
|
98
|
+
new (): StyleDetail;
|
|
99
|
+
};
|
|
100
|
+
|
|
107
101
|
interface UserAvatar extends Components.UserAvatar, HTMLElement {}
|
|
108
102
|
export const UserAvatar: {
|
|
109
103
|
prototype: UserAvatar;
|