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
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import sortBy from 'lodash/sortBy';
|
|
13
|
-
import groupBy from 'lodash/groupBy';
|
|
14
|
-
import axios from 'axios';
|
|
15
|
-
import { createSalon } from '../types/salon';
|
|
16
|
-
import { createFavesalonLookbook, createFavesalonStyle, createFaveStyleComent } from '../types/style';
|
|
17
|
-
import { createService } from '../types/service';
|
|
18
|
-
import { createStylist } from '../types/stylist';
|
|
19
|
-
import { createReview } from '../types/review';
|
|
20
|
-
class HttpService {
|
|
21
|
-
constructor() {
|
|
22
|
-
this.http = null;
|
|
23
|
-
this.http = axios.create({
|
|
24
|
-
baseURL: 'https://favesalon.com',
|
|
25
|
-
headers: {},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
fetchSalonInfo(salonId) {
|
|
29
|
-
const url = 'api/salon/settings-public';
|
|
30
|
-
return this.http.post(url, { salon_id: salonId })
|
|
31
|
-
.then((response) => {
|
|
32
|
-
const { status, data } = response.data;
|
|
33
|
-
return status && data ? createSalon(data.Salon) : null;
|
|
34
|
-
})
|
|
35
|
-
.catch(() => (null));
|
|
36
|
-
}
|
|
37
|
-
fetchReviews(url, options, allReviews) {
|
|
38
|
-
const { noLoop } = options, restOptions = __rest(options, ["noLoop"]);
|
|
39
|
-
return this.http.post(url, restOptions)
|
|
40
|
-
.then((response) => {
|
|
41
|
-
const { status, data } = response.data;
|
|
42
|
-
if (status) {
|
|
43
|
-
const reviews = (data || []).filter(blob => Math.ceil(Number(blob.avg_point)) > 0).map(createReview);
|
|
44
|
-
// fetch next page's reviews
|
|
45
|
-
if (!noLoop && reviews.length >= options.limit) {
|
|
46
|
-
return this.fetchReviews(url, Object.assign(Object.assign({}, options), { page: options.page + 1 }), allReviews.concat(reviews));
|
|
47
|
-
}
|
|
48
|
-
const finalReviews = options.page === 1 ? reviews : allReviews.concat(reviews);
|
|
49
|
-
return {
|
|
50
|
-
totalReviews: finalReviews.length || 0,
|
|
51
|
-
allReviews: finalReviews,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
return { totalReviews: 0, allReviews: [] };
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
fetchSalonReviews(salonId, options) {
|
|
58
|
-
const url = '/api/salon/reviews';
|
|
59
|
-
return this.fetchReviews(url, Object.assign({ page: 1, limit: 5, salon_id: salonId, avg_point_greater_than: 0 }, options), [])
|
|
60
|
-
.then(response => {
|
|
61
|
-
const { totalReviews, allReviews } = response;
|
|
62
|
-
return {
|
|
63
|
-
total: totalReviews,
|
|
64
|
-
allItems: allReviews,
|
|
65
|
-
};
|
|
66
|
-
})
|
|
67
|
-
.catch(() => ({ total: 0, allItems: [] }));
|
|
68
|
-
}
|
|
69
|
-
decorateServiceGroups(groups) {
|
|
70
|
-
return groups.map((cate, index) => {
|
|
71
|
-
const cateName = cate.name;
|
|
72
|
-
const categoryId = `${cate.service_id}-${String(cateName).toLowerCase().split(' ').join('-')}-${cate.order}-index-${index}`;
|
|
73
|
-
const sortedSubCates = sortBy(cate.service_groups, [subCate => subCate.order]);
|
|
74
|
-
return {
|
|
75
|
-
id: categoryId,
|
|
76
|
-
name: cateName,
|
|
77
|
-
type: 'category',
|
|
78
|
-
data: sortedSubCates.map((subCate, subCateIndex) => {
|
|
79
|
-
const subCateId = `${categoryId}-${String(subCate.name).toLowerCase().split(' ').join('-')}-${subCate.order}-index-${subCateIndex}`;
|
|
80
|
-
return {
|
|
81
|
-
key: subCateId,
|
|
82
|
-
name: subCate.category,
|
|
83
|
-
type: 'sub-category',
|
|
84
|
-
data: (subCate.services || []).map(rawService => {
|
|
85
|
-
const serviceObj = createService(rawService);
|
|
86
|
-
return Object.assign(Object.assign({}, serviceObj), { type: 'service' });
|
|
87
|
-
}),
|
|
88
|
-
};
|
|
89
|
-
}),
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
fetchSalonServices(salonId) {
|
|
94
|
-
const url = `api/salon/services?v=2&id=${salonId}`;
|
|
95
|
-
return this.http.get(url)
|
|
96
|
-
.then(response => {
|
|
97
|
-
const { status, data } = response.data;
|
|
98
|
-
if (status) {
|
|
99
|
-
return this.decorateServiceGroups(data || []);
|
|
100
|
-
}
|
|
101
|
-
return [];
|
|
102
|
-
})
|
|
103
|
-
.catch(() => ([]));
|
|
104
|
-
}
|
|
105
|
-
fetchSalonStylists(salonId) {
|
|
106
|
-
const fetchStylistSchedules = this.http.get(`api/calendar/resource/stylists?salon_id=${salonId}`)
|
|
107
|
-
.then((response) => {
|
|
108
|
-
const { status, data } = response.data;
|
|
109
|
-
return status ? (data || []) : [];
|
|
110
|
-
})
|
|
111
|
-
.catch(() => ([]));
|
|
112
|
-
const fetchStylistSkills = this.http.get(`api/salon/skill-stylists/${salonId}`)
|
|
113
|
-
.then((response) => {
|
|
114
|
-
const { status, data } = response.data;
|
|
115
|
-
return status ? (data || []).map(blob => (Object.assign(Object.assign({}, blob), { id: blob.stylist_id }))) : [];
|
|
116
|
-
})
|
|
117
|
-
.catch(() => ([]));
|
|
118
|
-
return Promise.all([fetchStylistSchedules, fetchStylistSkills])
|
|
119
|
-
.then(results => {
|
|
120
|
-
const [stylistSchedules, stylistSkills] = results;
|
|
121
|
-
const allStylistGroups = groupBy(stylistSchedules.concat(stylistSkills), stylist => stylist.id);
|
|
122
|
-
return Object.keys(allStylistGroups)
|
|
123
|
-
.filter(stylistId => Number(stylistId) > 0)
|
|
124
|
-
.map(stylistId => {
|
|
125
|
-
const [schedule, skills] = allStylistGroups[stylistId];
|
|
126
|
-
return createStylist(Object.assign(Object.assign({}, schedule), skills));
|
|
127
|
-
});
|
|
128
|
-
})
|
|
129
|
-
.catch(() => []);
|
|
130
|
-
}
|
|
131
|
-
fetchSalonCategories() {
|
|
132
|
-
return this.http.post('api/home/get-service', { limit: 50 })
|
|
133
|
-
.then((response) => {
|
|
134
|
-
const { status, data } = response.data;
|
|
135
|
-
if (status) {
|
|
136
|
-
return (data || []).map(blob => {
|
|
137
|
-
return {
|
|
138
|
-
id: blob.id,
|
|
139
|
-
name: blob.name,
|
|
140
|
-
image: blob.full_image,
|
|
141
|
-
imageThumb: blob.full_thumb_image,
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
return [];
|
|
146
|
-
})
|
|
147
|
-
.catch(() => ([]));
|
|
148
|
-
}
|
|
149
|
-
fetchSalonLookbooks(salonId, options) {
|
|
150
|
-
const noResult = { total: 0, allLookbooks: [] };
|
|
151
|
-
return this.http.post('api/style/filter', Object.assign({ page: 1, limit: 20, salon_id: salonId }, options))
|
|
152
|
-
.then((response) => {
|
|
153
|
-
const { status, data, paging } = response.data;
|
|
154
|
-
if (status) {
|
|
155
|
-
return {
|
|
156
|
-
total: paging.total_item || 0,
|
|
157
|
-
allLookbooks: (data || []).map(createFavesalonStyle),
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
return noResult;
|
|
161
|
-
})
|
|
162
|
-
.catch(() => (noResult));
|
|
163
|
-
}
|
|
164
|
-
fetchSalonPhotos(salonId) {
|
|
165
|
-
return this.http
|
|
166
|
-
.post('api/style/filter', {
|
|
167
|
-
page: 1,
|
|
168
|
-
limit: 20,
|
|
169
|
-
salon_id: salonId,
|
|
170
|
-
})
|
|
171
|
-
.then((response) => {
|
|
172
|
-
const { status, data } = response.data;
|
|
173
|
-
if (status) {
|
|
174
|
-
return (data || []).map(createFavesalonStyle);
|
|
175
|
-
}
|
|
176
|
-
return [];
|
|
177
|
-
})
|
|
178
|
-
.catch(() => {
|
|
179
|
-
return [];
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
fetchAllStyles(url, options, allStyles) {
|
|
183
|
-
return this.http.post(url, options)
|
|
184
|
-
.then((response) => {
|
|
185
|
-
const { status, data } = response.data;
|
|
186
|
-
if (status) {
|
|
187
|
-
const styles = (data || []).map(createFavesalonStyle);
|
|
188
|
-
// fetch next page styles
|
|
189
|
-
if (styles.length >= options.limit) {
|
|
190
|
-
return this.fetchAllStyles(url, Object.assign(Object.assign({}, options), { page: options.page + 1 }), allStyles.concat(styles));
|
|
191
|
-
}
|
|
192
|
-
return options.page === 1 ? styles : allStyles;
|
|
193
|
-
}
|
|
194
|
-
return allStyles;
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
fetchAllSalonPhotos(salonId, options) {
|
|
198
|
-
return this.fetchAllStyles('api/style/filter', Object.assign({ page: 1, limit: 20, salon_id: salonId }, options), []).catch(() => {
|
|
199
|
-
return [];
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
fetchStyleDetail(styleId) {
|
|
203
|
-
return this.http.post('api/home/style-info', { photo_id: styleId })
|
|
204
|
-
.then((response) => {
|
|
205
|
-
const { status, data } = response.data;
|
|
206
|
-
if (status) {
|
|
207
|
-
return createFavesalonLookbook(data);
|
|
208
|
-
}
|
|
209
|
-
return null;
|
|
210
|
-
})
|
|
211
|
-
.catch(() => (null));
|
|
212
|
-
}
|
|
213
|
-
fetchStyleComments(options) {
|
|
214
|
-
return this.http.post('api/comment/filter', options)
|
|
215
|
-
.then(response => {
|
|
216
|
-
const { status, data } = response.data;
|
|
217
|
-
if (status) {
|
|
218
|
-
return (data || []).map(createFaveStyleComent);
|
|
219
|
-
}
|
|
220
|
-
return [];
|
|
221
|
-
})
|
|
222
|
-
.catch(() => ([]));
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
export default () => new HttpService();
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export var BusinessHourStatus;
|
|
2
|
-
(function (BusinessHourStatus) {
|
|
3
|
-
BusinessHourStatus[BusinessHourStatus["Open"] = 0] = "Open";
|
|
4
|
-
BusinessHourStatus[BusinessHourStatus["Close"] = 1] = "Close";
|
|
5
|
-
BusinessHourStatus[BusinessHourStatus["ByAppointment"] = 2] = "ByAppointment";
|
|
6
|
-
})(BusinessHourStatus || (BusinessHourStatus = {}));
|
|
7
|
-
export function createSalon(blob) {
|
|
8
|
-
const salonGeoLocations = blob.salon_geolocation || [];
|
|
9
|
-
const themeColors = {
|
|
10
|
-
'allure24-blue': '89c8d2',
|
|
11
|
-
'allure24-pink': 'ff7fa2',
|
|
12
|
-
'the-shave': 'af8c45',
|
|
13
|
-
'theme2-dark-green': '90c245',
|
|
14
|
-
'theme2-green': 'bed451',
|
|
15
|
-
'theme2-light-pink': 'd47b99',
|
|
16
|
-
'theme2-purple': 'ab345c',
|
|
17
|
-
'theme3-blue': '076dec',
|
|
18
|
-
'theme3-layout1': 'd59b76',
|
|
19
|
-
'theme3-layout2': 'b02858',
|
|
20
|
-
'theme4-green': '5da826',
|
|
21
|
-
'theme4': '08b89d',
|
|
22
|
-
'theme5': 'f64c4d',
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
id: blob.id,
|
|
26
|
-
about: blob.about,
|
|
27
|
-
email: blob.email,
|
|
28
|
-
fullProfileImage: blob.full_profile_image,
|
|
29
|
-
fullCoverImage: blob.full_cover_image,
|
|
30
|
-
ownerName: blob.owner_name,
|
|
31
|
-
subdomain: blob.subdomain,
|
|
32
|
-
website: blob.website,
|
|
33
|
-
businessName: blob.business_name,
|
|
34
|
-
businessPhone: blob.business_phone,
|
|
35
|
-
businessAddress: blob.business_address,
|
|
36
|
-
businessLocationLat: salonGeoLocations.length > 0 ? salonGeoLocations[0].location_lat : null,
|
|
37
|
-
businessLocationLng: salonGeoLocations.length > 0 ? salonGeoLocations[0].location_lng : null,
|
|
38
|
-
city: blob.city,
|
|
39
|
-
state: blob.state,
|
|
40
|
-
zipcode: blob.zipcode ? Number(blob.zipcode) : null,
|
|
41
|
-
businessHours: (blob.business_hours || blob.salon_workingtime || []).map(bh => {
|
|
42
|
-
return {
|
|
43
|
-
dayName: bh.day_name,
|
|
44
|
-
openTime: bh.open_time,
|
|
45
|
-
closeTime: bh.close_time,
|
|
46
|
-
status: bh.status,
|
|
47
|
-
};
|
|
48
|
-
}),
|
|
49
|
-
rating: Number(blob.rating_point),
|
|
50
|
-
primaryColor: themeColors[blob.default_mini_site_template] || themeColors['allure24-blue'],
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import { apiDateFormat } from './common';
|
|
3
|
-
import { createSalon } from './salon';
|
|
4
|
-
import { createService } from './service';
|
|
5
|
-
import { createStylistFromLookbook } from './stylist';
|
|
6
|
-
import { createUser } from './user';
|
|
7
|
-
export class FaveStyleComent {
|
|
8
|
-
constructor(fields) {
|
|
9
|
-
Object.assign(this, fields);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export function createFaveStyleComent(blob) {
|
|
13
|
-
const [createdDay, createdTime] = String(blob.create_date).split(' ');
|
|
14
|
-
const [updatedDay, updatedTime] = String(blob.update_date).split(' ');
|
|
15
|
-
return {
|
|
16
|
-
id: blob.id,
|
|
17
|
-
type: blob.type,
|
|
18
|
-
content: blob.content,
|
|
19
|
-
createdDate: dayjs(`${createdDay} ${createdTime}`, apiDateFormat).valueOf(),
|
|
20
|
-
updatedDate: dayjs(`${updatedDay} ${updatedTime}`, apiDateFormat).valueOf(),
|
|
21
|
-
parentCommentId: blob.parentCommentId,
|
|
22
|
-
childComments: blob.child_comment ? blob.child_comment.map(createFaveStyleComent) : [],
|
|
23
|
-
owner: createUser(blob.user),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export class FavesalonAlbum {
|
|
27
|
-
constructor(fields) {
|
|
28
|
-
Object.assign(this, fields);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export function createFavesalonAlbum(blob) {
|
|
32
|
-
return {
|
|
33
|
-
id: blob.id,
|
|
34
|
-
name: blob.name,
|
|
35
|
-
caption: blob.caption,
|
|
36
|
-
description: blob.description,
|
|
37
|
-
tags: blob.tags ? blob.tags.filter(tag => !!tag) : [],
|
|
38
|
-
salonId: blob.salon_id,
|
|
39
|
-
stylistId: blob.beautician_id,
|
|
40
|
-
totalMedias: blob.total_medias || 0,
|
|
41
|
-
service: blob.service ? createService(blob.service) : null,
|
|
42
|
-
isPublic: (typeof blob.is_public !== 'undefined') ? Boolean(blob.is_public) : true,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export function createFavesalonStyle(blob) {
|
|
46
|
-
const [createdDay, createdTime] = String(blob.create_date).split(' ');
|
|
47
|
-
const [updatedDay, updatedTime] = String(blob.update_date).split(' ');
|
|
48
|
-
return {
|
|
49
|
-
id: blob.id,
|
|
50
|
-
caption: blob.caption,
|
|
51
|
-
description: blob.description,
|
|
52
|
-
createdDate: dayjs(`${createdDay} ${createdTime}`, apiDateFormat).valueOf(),
|
|
53
|
-
updatedDate: dayjs(`${updatedDay} ${updatedTime}`, apiDateFormat).valueOf(),
|
|
54
|
-
mediaType: blob.media_type,
|
|
55
|
-
fullImageUrl: blob.full_image_url,
|
|
56
|
-
fullImageUrlThumb: blob.full_image_url_thumb,
|
|
57
|
-
fullImageUrlMedium: blob.full_image_url_medium,
|
|
58
|
-
imgWidth: blob.img_w,
|
|
59
|
-
imgHeight: blob.img_h,
|
|
60
|
-
s3ImgWidth: blob.s3_img_w,
|
|
61
|
-
s3ImgHeight: blob.s3_img_h,
|
|
62
|
-
totalLike: blob.total_like,
|
|
63
|
-
totalDislike: blob.total_dislike,
|
|
64
|
-
totalShare: blob.total_shared,
|
|
65
|
-
totalView: blob.view_count,
|
|
66
|
-
totalBooking: blob.total_booking,
|
|
67
|
-
owner: blob.user ? createUser(blob.user) : null,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export function createFavesalonLookbook(blob) {
|
|
71
|
-
const [createdDay, createdTime] = String(blob.create_date).split(' ');
|
|
72
|
-
const [updatedDay, updatedTime] = String(blob.update_date).split(' ');
|
|
73
|
-
let albumPhotos = blob.style_in_album ? blob.style_in_album.map(createFavesalonStyle) : [];
|
|
74
|
-
if (!albumPhotos.find(ap => ap.id === blob.id)) {
|
|
75
|
-
const currentPhoto = createFavesalonStyle(blob);
|
|
76
|
-
albumPhotos = [currentPhoto].concat(albumPhotos);
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
id: blob.id,
|
|
80
|
-
caption: blob.caption,
|
|
81
|
-
description: blob.description,
|
|
82
|
-
createdDate: dayjs(`${createdDay} ${createdTime}`, apiDateFormat).valueOf(),
|
|
83
|
-
updatedDate: dayjs(`${updatedDay} ${updatedTime}`, apiDateFormat).valueOf(),
|
|
84
|
-
mediaType: blob.media_type,
|
|
85
|
-
fullImageUrl: blob.full_image_url,
|
|
86
|
-
fullImageUrlThumb: blob.full_image_url_thumb,
|
|
87
|
-
fullImageUrlMedium: blob.full_image_url_medium,
|
|
88
|
-
imgWidth: blob.img_w,
|
|
89
|
-
imgHeight: blob.img_h,
|
|
90
|
-
s3ImgWidth: blob.s3_img_w,
|
|
91
|
-
s3ImgHeight: blob.s3_img_h,
|
|
92
|
-
totalLike: blob.total_like,
|
|
93
|
-
totalDislike: blob.total_dislike,
|
|
94
|
-
totalShare: blob.total_shared,
|
|
95
|
-
totalView: blob.view_count,
|
|
96
|
-
totalBooking: blob.total_booking,
|
|
97
|
-
owner: blob.user ? createUser(blob.user) : null,
|
|
98
|
-
salon: blob.salon ? createSalon(blob.salon) : null,
|
|
99
|
-
stylist: blob.beautician && blob.beautician.user ? createStylistFromLookbook(blob.beautician) : null,
|
|
100
|
-
album: blob.album ? createFavesalonAlbum(blob.album) : null,
|
|
101
|
-
albumPhotos,
|
|
102
|
-
};
|
|
103
|
-
}
|
package/collection/types/user.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function createUser(blob) {
|
|
2
|
-
const userNames = [blob.first_name, blob.last_name].filter(name => !!name);
|
|
3
|
-
return {
|
|
4
|
-
id: blob.user_id,
|
|
5
|
-
name: userNames.length > 0 ? userNames.join(' ') : blob.username,
|
|
6
|
-
firstName: blob.first_name,
|
|
7
|
-
lastName: blob.last_name,
|
|
8
|
-
avatar: blob.full_profile_image_thumb,
|
|
9
|
-
};
|
|
10
|
-
}
|