favesalon-embed 1.0.5 → 1.0.6
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/dist/custom-elements/index.d.ts +36 -0
- package/dist/favesalon-embed/activate-form.entry.js +70 -0
- package/dist/favesalon-embed/app-globals-f954a22f.js +7 -0
- package/dist/favesalon-embed/change-password-form.entry.js +81 -0
- package/dist/favesalon-embed/chat-box.entry.js +1 -1
- package/dist/favesalon-embed/chat-button.entry.js +34 -11
- package/dist/favesalon-embed/chat-form.entry.js +1 -1
- package/dist/favesalon-embed/chat-messages.entry.js +1 -1
- package/dist/favesalon-embed/chat-rooms.entry.js +1 -1
- package/dist/favesalon-embed/favesalon-embed.esm.js +1 -1
- package/dist/favesalon-embed/index-a229b3b5.js +3371 -0
- package/dist/favesalon-embed/login-form.entry.js +67 -0
- package/dist/favesalon-embed/register-form.entry.js +88 -0
- package/dist/favesalon-embed/reset-password-form.entry.js +47 -0
- package/dist/favesalon-embed/salon-booking.entry.js +1 -1
- package/dist/favesalon-embed/salon-gift-card.entry.js +1 -1
- package/dist/favesalon-embed/salon-info.entry.js +1 -1
- package/dist/favesalon-embed/salon-latest-reviews.entry.js +19 -3
- package/dist/favesalon-embed/salon-latest-styles.entry.js +14 -7
- package/dist/favesalon-embed/salon-locations.entry.js +1 -1
- package/dist/favesalon-embed/salon-lookbook.entry.js +16 -4
- package/dist/favesalon-embed/salon-reviews.entry.js +18 -4
- package/dist/favesalon-embed/salon-schedules.entry.js +1 -1
- package/dist/favesalon-embed/salon-services.entry.js +23 -11
- package/dist/favesalon-embed/salon-stylists.entry.js +1 -1
- package/dist/favesalon-embed/{services-260ea6eb.js → services-5a4c43a6.js} +23 -0
- package/dist/favesalon-embed/{services-65a8cf4a.js → services-d71be591.js} +51 -19
- package/dist/favesalon-embed/style-detail.entry.js +26 -8
- package/dist/favesalon-embed/user-avatar.entry.js +3 -1
- package/dist/favesalon-embed/user-form.entry.js +44 -0
- package/dist/types/components/activate-form/activate-form.d.ts +12 -0
- package/dist/types/components/activate-form/test/activate-form.e2e.d.ts +1 -0
- package/dist/types/components/activate-form/test/activate-form.spec.d.ts +1 -0
- package/dist/types/components/change-password-form/change-password-form.d.ts +12 -0
- package/dist/types/components/chat-button/index.d.ts +6 -2
- package/dist/types/components/login-form/login-form.d.ts +10 -0
- package/dist/types/components/register-form/register-form.d.ts +13 -0
- package/dist/types/components/reset-password-form/reset-password-form.d.ts +9 -0
- package/dist/types/components/user-form/user-form.d.ts +7 -0
- package/dist/types/components.d.ts +106 -2
- package/dist/types/services/services.d.ts +16 -0
- package/dist/types/types/user.d.ts +6 -0
- package/dist/types/utils/utils.spec.d.ts +1 -0
- package/package.json +1 -1
- package/dist/favesalon-embed/services-122dcf73.js +0 -23886
- package/dist/favesalon-embed/services-23eda072.js +0 -23877
- package/dist/favesalon-embed/services-243eef47.js +0 -23880
- package/dist/favesalon-embed/services-27607998.js +0 -23886
- package/dist/favesalon-embed/services-46b2f0aa.js +0 -23867
- package/dist/favesalon-embed/services-8f52210f.js +0 -23880
- package/dist/favesalon-embed/services-de32365e.js +0 -23880
- package/dist/favesalon-embed/services-e9cfcd2b.js +0 -23885
- package/dist/favesalon-embed/services-f7278483.js +0 -23880
- package/dist/favesalon-embed/services-f9872bea.js +0 -23880
- package/dist/favesalon-embed/utils-2c19db45.js +0 -25
- package/dist/favesalon-embed/utils-89c2cff2.js +0 -32
- package/dist/favesalon-embed/utils-e226fa04.js +0 -32
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import type { Components, JSX } from "../types/components";
|
|
4
4
|
|
|
5
|
+
interface ActivateForm extends Components.ActivateForm, HTMLElement {}
|
|
6
|
+
export const ActivateForm: {
|
|
7
|
+
prototype: ActivateForm;
|
|
8
|
+
new (): ActivateForm;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
interface ChangePasswordForm extends Components.ChangePasswordForm, HTMLElement {}
|
|
12
|
+
export const ChangePasswordForm: {
|
|
13
|
+
prototype: ChangePasswordForm;
|
|
14
|
+
new (): ChangePasswordForm;
|
|
15
|
+
};
|
|
16
|
+
|
|
5
17
|
interface ChatBox extends Components.ChatBox, HTMLElement {}
|
|
6
18
|
export const ChatBox: {
|
|
7
19
|
prototype: ChatBox;
|
|
@@ -38,12 +50,30 @@ export const GoogleMap: {
|
|
|
38
50
|
new (): GoogleMap;
|
|
39
51
|
};
|
|
40
52
|
|
|
53
|
+
interface LoginForm extends Components.LoginForm, HTMLElement {}
|
|
54
|
+
export const LoginForm: {
|
|
55
|
+
prototype: LoginForm;
|
|
56
|
+
new (): LoginForm;
|
|
57
|
+
};
|
|
58
|
+
|
|
41
59
|
interface NotifySounds extends Components.NotifySounds, HTMLElement {}
|
|
42
60
|
export const NotifySounds: {
|
|
43
61
|
prototype: NotifySounds;
|
|
44
62
|
new (): NotifySounds;
|
|
45
63
|
};
|
|
46
64
|
|
|
65
|
+
interface RegisterForm extends Components.RegisterForm, HTMLElement {}
|
|
66
|
+
export const RegisterForm: {
|
|
67
|
+
prototype: RegisterForm;
|
|
68
|
+
new (): RegisterForm;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
interface ResetPasswordForm extends Components.ResetPasswordForm, HTMLElement {}
|
|
72
|
+
export const ResetPasswordForm: {
|
|
73
|
+
prototype: ResetPasswordForm;
|
|
74
|
+
new (): ResetPasswordForm;
|
|
75
|
+
};
|
|
76
|
+
|
|
47
77
|
interface SalonBooking extends Components.SalonBooking, HTMLElement {}
|
|
48
78
|
export const SalonBooking: {
|
|
49
79
|
prototype: SalonBooking;
|
|
@@ -140,6 +170,12 @@ export const UserAvatar: {
|
|
|
140
170
|
new (): UserAvatar;
|
|
141
171
|
};
|
|
142
172
|
|
|
173
|
+
interface UserForm extends Components.UserForm, HTMLElement {}
|
|
174
|
+
export const UserForm: {
|
|
175
|
+
prototype: UserForm;
|
|
176
|
+
new (): UserForm;
|
|
177
|
+
};
|
|
178
|
+
|
|
143
179
|
/**
|
|
144
180
|
* Utility to define all custom elements within this package using the tag name provided in the component's source.
|
|
145
181
|
* When defining each custom element, it will also check it's safe to define by:
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { r as registerInstance, h } from './index-888e99e3.js';
|
|
2
|
+
import { C as Colors } from './colors-ea36347a.js';
|
|
3
|
+
import { H as HttpService } from './services-d71be591.js';
|
|
4
|
+
import './_commonjsHelpers-a4f66ccd.js';
|
|
5
|
+
|
|
6
|
+
const activateFormCss = ".form--user-activate-account .form--login-label{cursor:pointer;display:block;margin-bottom:6px}.form--user-activate-account input,.form--user-activate-account button{border:1px solid #cecece;box-sizing:border-box;display:inline-block;width:100%;padding:4px 11px;min-height:40px;-moz-transition:all 0.3s;-webkit-transition:all 0.3s;transition:all 0.3s;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px}.form--user-activate-account button{background-color:#001529;border:1px solid #001529;color:#fff;cursor:pointer}.form--user-activate-account button.btn--default{background-color:#fff;border:1px solid #F5F5F5;color:#141414}.form--user-activate-account button:disabled{background-color:#cecece;border:1px solid #cecece;color:#212121}";
|
|
7
|
+
|
|
8
|
+
const ActivateForm = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.username = undefined;
|
|
12
|
+
this.password = undefined;
|
|
13
|
+
this.onSuccess = undefined;
|
|
14
|
+
this.isSubmitting = undefined;
|
|
15
|
+
this.error = undefined;
|
|
16
|
+
this.confirmCode = undefined;
|
|
17
|
+
}
|
|
18
|
+
async onSubmit(evt) {
|
|
19
|
+
evt.preventDefault();
|
|
20
|
+
this.error = null;
|
|
21
|
+
this.isSubmitting = true;
|
|
22
|
+
if (this.username && this.confirmCode && this.password) {
|
|
23
|
+
try {
|
|
24
|
+
await HttpService().activateAccount(this.username, this.confirmCode);
|
|
25
|
+
const apiUrl = window.location.origin.indexOf('localhost') > -1 || window.location.origin.indexOf('favesalon.com')
|
|
26
|
+
? 'https://favesalon.com'
|
|
27
|
+
: window.location.origin;
|
|
28
|
+
const userInfo = await HttpService().login(apiUrl, {
|
|
29
|
+
email: this.username,
|
|
30
|
+
password: this.password,
|
|
31
|
+
});
|
|
32
|
+
this.onSuccess(userInfo);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
this.error = e.message || `Something went wrong when changing your new password`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.error = 'Please enter your received code or password to change your password';
|
|
40
|
+
}
|
|
41
|
+
this.isSubmitting = false;
|
|
42
|
+
}
|
|
43
|
+
async resendCode(evt) {
|
|
44
|
+
evt.preventDefault();
|
|
45
|
+
this.error = null;
|
|
46
|
+
try {
|
|
47
|
+
await HttpService().resendActivateCode(this.username);
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
this.error = e.message || `Something went wrong when sending the confirm code`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
render() {
|
|
54
|
+
return (h("form", { class: "form--user-activate-account", onSubmit: (evt) => this.onSubmit(evt) }, this.error && (h("div", { style: {
|
|
55
|
+
backgroundColor: Colors.Red01,
|
|
56
|
+
border: `1px solid ${Colors.Red02}`,
|
|
57
|
+
marginBottom: '24px',
|
|
58
|
+
padding: '12px',
|
|
59
|
+
} }, this.error)), h("div", { style: { marginBottom: '24px' } }, h("label", { ...{ for: "form--login-username" }, class: "form--login-label" }, "Confirmation code"), h("input", { id: "form--login-username", type: "text", onInput: (evt) => {
|
|
60
|
+
this.confirmCode = evt.target.value;
|
|
61
|
+
} })), h("div", { style: { marginBottom: '24px' } }, h("button", { type: "submit", disabled: this.isSubmitting }, "SUBMIT")), h("div", { style: { marginTop: '32px', marginBottom: '24px', textAlign: 'center' } }, "I didn\u2019t receive my confirmation code yet?"), h("div", { style: { marginBottom: '24px' } }, h("button", { class: "btn--default", style: {
|
|
62
|
+
backgrourColor: `${Colors.Gray02} !important`,
|
|
63
|
+
border: `1px solid ${Colors.Gray02} !important`,
|
|
64
|
+
color: `${Colors.TextColor} !important`,
|
|
65
|
+
}, onClick: (evt) => this.resendCode(evt) }, "Resend"))));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
ActivateForm.style = activateFormCss;
|
|
69
|
+
|
|
70
|
+
export { ActivateForm as activate_form };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { r as registerInstance, h } from './index-888e99e3.js';
|
|
2
|
+
import { C as Colors } from './colors-ea36347a.js';
|
|
3
|
+
import { H as HttpService } from './services-d71be591.js';
|
|
4
|
+
import './_commonjsHelpers-a4f66ccd.js';
|
|
5
|
+
|
|
6
|
+
const changePasswordFormCss = ".form--user-change-password .form--login-label{cursor:pointer;display:block;margin-bottom:6px}.form--user-change-password input,.form--user-change-password button{border:1px solid #cecece;box-sizing:border-box;display:inline-block;width:100%;padding:4px 11px;min-height:40px;-moz-transition:all 0.3s;-webkit-transition:all 0.3s;transition:all 0.3s;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px}.form--user-change-password button{background-color:#001529;border:1px solid #001529;color:#fff;cursor:pointer}.form--user-change-password button.btn--default{background-color:#fff;border:1px solid #F5F5F5;color:#141414}.form--user-change-password button:disabled{background-color:#cecece;border:1px solid #cecece;color:#212121}";
|
|
7
|
+
|
|
8
|
+
const ChangePasswordForm = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.username = undefined;
|
|
12
|
+
this.onSuccess = undefined;
|
|
13
|
+
this.isSubmitting = undefined;
|
|
14
|
+
this.error = undefined;
|
|
15
|
+
this.confirmCode = undefined;
|
|
16
|
+
this.password = undefined;
|
|
17
|
+
}
|
|
18
|
+
async onSubmit(evt) {
|
|
19
|
+
evt.preventDefault();
|
|
20
|
+
this.error = null;
|
|
21
|
+
this.isSubmitting = true;
|
|
22
|
+
if (this.username && this.confirmCode && this.password) {
|
|
23
|
+
try {
|
|
24
|
+
await HttpService().onChangePassword({
|
|
25
|
+
email: this.username,
|
|
26
|
+
password: this.password,
|
|
27
|
+
code: this.confirmCode,
|
|
28
|
+
});
|
|
29
|
+
const apiUrl = window.location.origin.indexOf('localhost') > -1 || window.location.origin.indexOf('favesalon.com')
|
|
30
|
+
? 'https://favesalon.com'
|
|
31
|
+
: window.location.origin;
|
|
32
|
+
const userInfo = await HttpService().login(apiUrl, {
|
|
33
|
+
email: this.username,
|
|
34
|
+
password: this.password,
|
|
35
|
+
});
|
|
36
|
+
this.onSuccess(userInfo);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
this.error = e.message || `Something went wrong when changing your new password`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.error = 'Please enter your received code or password to change your password';
|
|
44
|
+
}
|
|
45
|
+
this.isSubmitting = false;
|
|
46
|
+
}
|
|
47
|
+
async resendCode(evt) {
|
|
48
|
+
evt.preventDefault();
|
|
49
|
+
this.error = null;
|
|
50
|
+
if (this.username) {
|
|
51
|
+
try {
|
|
52
|
+
await HttpService().resetPassword(this.username);
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
this.error = e.message || `Something went wrong when sending the confirm code`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.error = 'Please enter your phone or email to reset your password';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
return (h("form", { class: "form--user-change-password", onSubmit: (evt) => this.onSubmit(evt) }, this.error && (h("div", { style: {
|
|
64
|
+
backgroundColor: Colors.Red01,
|
|
65
|
+
border: `1px solid ${Colors.Red02}`,
|
|
66
|
+
marginBottom: '24px',
|
|
67
|
+
padding: '12px',
|
|
68
|
+
} }, this.error)), h("div", { style: { marginBottom: '24px' } }, h("label", { ...{ for: "form--login-username" }, class: "form--login-label" }, "Confirmation code"), h("input", { id: "form--login-username", type: "text", onInput: (evt) => {
|
|
69
|
+
this.confirmCode = evt.target.value;
|
|
70
|
+
} })), h("div", { style: { marginBottom: '24px' } }, h("label", { ...{ for: "form--login-password" }, class: "form--login-label" }, "Password"), h("input", { id: "form--login-password", type: "password", onInput: (evt) => {
|
|
71
|
+
this.password = evt.target.value;
|
|
72
|
+
} })), h("div", { style: { marginBottom: '24px' } }, h("button", { type: "submit", disabled: this.isSubmitting }, "SAVE")), h("div", { style: { marginTop: '32px', marginBottom: '24px', textAlign: 'center' } }, "I didn\u2019t receive my confirmation code yet?"), h("div", { style: { marginBottom: '24px' } }, h("button", { class: "btn--default", style: {
|
|
73
|
+
backgrourColor: `${Colors.Gray02} !important`,
|
|
74
|
+
border: `1px solid ${Colors.Gray02} !important`,
|
|
75
|
+
color: `${Colors.TextColor} !important`,
|
|
76
|
+
}, onClick: (evt) => this.resendCode(evt) }, "Resend"))));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
ChangePasswordForm.style = changePasswordFormCss;
|
|
80
|
+
|
|
81
|
+
export { ChangePasswordForm as change_password_form };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h } from './index-888e99e3.js';
|
|
2
2
|
import { C as Colors } from './colors-ea36347a.js';
|
|
3
|
-
import { H as HttpService } from './services-
|
|
3
|
+
import { H as HttpService } from './services-d71be591.js';
|
|
4
4
|
import './_commonjsHelpers-a4f66ccd.js';
|
|
5
5
|
|
|
6
6
|
const indexCss = ".chat-widget,.chat-widget--sidebar,.chat-widget--content{display:flex;height:100%;width:100%}.chat-widget{font-size:16px;position:relative;font-family:'Roboto', sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.chat-widget--sidebar,.chat-widget--content{background-color:#fff;border:1px solid #EFEFEF;position:absolute;inset:0;flex-direction:column}.chat-widget .chat-widget--sidebar{z-index:10}.chat-widget .chat-widget--content{z-index:5}.chat-widget.has-chat-room .chat-widget--content{z-index:10}.chat-widget--content-header{background-color:#001529;border-bottom:1px solid #EFEFEF;display:flex;align-items:center;justify-content:space-between;padding:16px}.chat-widget--content-title{font-size:20px;font-weight:600;line-height:1;margin:0}.chat-widget--content-close{border:1px solid #fff;cursor:pointer;display:block;position:absolute;z-index:1000;top:50%;right:0;width:30px;height:30px;transform:translate(0, -50%);-moz-border-radius:30px;-webkit-border-radius:30px;border-radius:30px;background-size:contain;background-repeat:no-repeat;background-position:center center;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAA3hJREFUaAXlm8+K00Acx7MiCIJH/yw+gA9g25O49SL4AO3Bp1jw5NvktC+wF88qevK4BU97EmzxUBCEolK/n5gp3W6TTJPfpNPNF37MNsl85/vN/DaTmU6PknC4K+pniqeKJ3k8UnkvDxXJzzy+q/yaxxeVHxW/FNHjgRSeKt4rFoplzaAuHHDBGR2eS9G54reirsmienDCTRt7xwsp+KAoEmt9nLaGitZxrBbPFNaGfPloGw2t4JVamSt8xYW6Dg1oCYo3Yv+rCGViV160oMkcd8SYKnYV1Nb1aEOjCe6L5ZOiLfF120EjWhuBu3YIZt1NQmujnk5F4MgOpURzLfAwOBSTmzp3fpDxuI/pabxpqOoz2r2HLAb0GMbZKlNV5/Hg9XJypguryA7lPF5KMdTZQzHjqxNPhWhzIuAruOl1eNqKEx1tSh5rfbxdw7mOxCq4qS68ZTjKS1YVvilu559vWvFHhh4rZrdyZ69Vmpgdj8fJbDZLJpNJ0uv1cnr/gjrUhQMuI+ANjyuwftQ0bbL6Erp0mM/ny8Fg4M3LtdRxgMtKl3jwmIHVxYXChFy94/Rmpa/pTbNUhstKV+4Rr8lLQ9KlUvJKLyG8yvQ2s9SBy1Jb7jV5a0yapfF6apaZLjLLcWtd4sNrmJUMHyM+1xibTjH82Zh01TNlhsrOhdKTe00uAzZQmN6+KW+sDa/JD2PSVQ873m29yf+1Q9VDzfEYlHi1G5LKBBWZbtEsHbFwb1oYDwr1ZiF/2bnCSg1OBE/pfr9/bWx26UxJL3ONPISOLKUvQza0LZUxSKyjpdTGa/vDEr25rddbMM0Q3O6Lx3rqFvU+x6UrRKQY7tyrZecmD9FODy8uLizTmilwNj0kraNcAJhOp5aGVwsAGD5VmJBrWWbJSgWT9zrzWepQF47RaGSiKfeGx6Szi3gzmX/HHbihwBser4B9UJYpFBNX4R6vTn3VQnez0SymnrHQMsRYGTr1dSk34ljRqS/EMd2pLQ8YBp3a1PLfcqCpo8gtHkZFHKkTX6fs3MY0blKnth66rKCnU0VRGu37ONrQaA4eZDFtWAu2fXj9zjFkxTBOo8F7t926gTp/83Kyzzcy2kZD6xiqxTYnHLRFm3vHiRSwNSjkz3hoIzo8lCKWUlg/YtGs7tObunDAZfpDLbfEI15zsEIY3U/x/gHHc/G1zltnAgAAAABJRU5ErkJggg==')}@media (min-width: 992px){.chat-widget--sidebar,.chat-widget--content{position:static;width:auto;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.chat-widget--sidebar{min-width:320px;max-width:320px;margin-right:24px}.chat-widget--content{flex-grow:1;flex-shrink:1}.chat-rooms--search,.chat-widget--content-header{-moz-border-radius:8px 8px 0 0;-webkit-border-radius:8px 8px 0 0;border-radius:8px 8px 0 0}}";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h } from './index-888e99e3.js';
|
|
2
2
|
import { C as Colors } from './colors-ea36347a.js';
|
|
3
|
-
import { H as HttpService } from './services-
|
|
3
|
+
import { H as HttpService } from './services-d71be591.js';
|
|
4
4
|
import './_commonjsHelpers-a4f66ccd.js';
|
|
5
5
|
|
|
6
6
|
const indexCss = "@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap'); chat-button{position:relative}.chat-button--indicator{cursor:pointer;position:absolute;inset:0}.chat-button--counter{background-color:rgb(240, 90, 97);border:1px solid rgb(255, 255, 255);position:absolute;right:6px;top:0px;height:8px;width:8px;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.chat-box{font-family:'Roboto', sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#fff;display:flex;flex-direction:column;position:fixed;inset:0px;z-index:20000;font-size:16px;text-align:left;color:#141414}.chat-box--header{display:flex;justify-content:space-between;padding:16px;position:relative}.chat-box--title{color:#fff;font-size:20px;font-weight:600;line-height:1;display:flex;align-items:center;justify-content:space-between;margin:0}.chat-box--close{cursor:pointer;display:block;position:absolute;z-index:1000;top:50%;right:0;width:30px;height:30px;transform:translate(0, -50%);background-size:contain;background-repeat:no-repeat;background-position:center center;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAA3hJREFUaAXlm8+K00Acx7MiCIJH/yw+gA9g25O49SL4AO3Bp1jw5NvktC+wF88qevK4BU97EmzxUBCEolK/n5gp3W6TTJPfpNPNF37MNsl85/vN/DaTmU6PknC4K+pniqeKJ3k8UnkvDxXJzzy+q/yaxxeVHxW/FNHjgRSeKt4rFoplzaAuHHDBGR2eS9G54reirsmienDCTRt7xwsp+KAoEmt9nLaGitZxrBbPFNaGfPloGw2t4JVamSt8xYW6Dg1oCYo3Yv+rCGViV160oMkcd8SYKnYV1Nb1aEOjCe6L5ZOiLfF120EjWhuBu3YIZt1NQmujnk5F4MgOpURzLfAwOBSTmzp3fpDxuI/pabxpqOoz2r2HLAb0GMbZKlNV5/Hg9XJypguryA7lPF5KMdTZQzHjqxNPhWhzIuAruOl1eNqKEx1tSh5rfbxdw7mOxCq4qS68ZTjKS1YVvilu559vWvFHhh4rZrdyZ69Vmpgdj8fJbDZLJpNJ0uv1cnr/gjrUhQMuI+ANjyuwftQ0bbL6Erp0mM/ny8Fg4M3LtdRxgMtKl3jwmIHVxYXChFy94/Rmpa/pTbNUhstKV+4Rr8lLQ9KlUvJKLyG8yvQ2s9SBy1Jb7jV5a0yapfF6apaZLjLLcWtd4sNrmJUMHyM+1xibTjH82Zh01TNlhsrOhdKTe00uAzZQmN6+KW+sDa/JD2PSVQ873m29yf+1Q9VDzfEYlHi1G5LKBBWZbtEsHbFwb1oYDwr1ZiF/2bnCSg1OBE/pfr9/bWx26UxJL3ONPISOLKUvQza0LZUxSKyjpdTGa/vDEr25rddbMM0Q3O6Lx3rqFvU+x6UrRKQY7tyrZecmD9FODy8uLizTmilwNj0kraNcAJhOp5aGVwsAGD5VmJBrWWbJSgWT9zrzWepQF47RaGSiKfeGx6Szi3gzmX/HHbihwBser4B9UJYpFBNX4R6vTn3VQnez0SymnrHQMsRYGTr1dSk34ljRqS/EMd2pLQ8YBp3a1PLfcqCpo8gtHkZFHKkTX6fs3MY0blKnth66rKCnU0VRGu37ONrQaA4eZDFtWAu2fXj9zjFkxTBOo8F7t926gTp/83Kyzzcy2kZD6xiqxTYnHLRFm3vHiRSwNSjkz3hoIzo8lCKWUlg/YtGs7tObunDAZfpDLbfEI15zsEIY3U/x/gHHc/G1zltnAgAAAABJRU5ErkJggg==')}@media (min-width: 768px){.chat-box{border:1px solid #fff;left:unset;top:unset;right:1px;bottom:0px;height:420px;max-height:90vh;width:600px;-moz-border-radius:8px 8px 0px 0px;-webkit-border-radius:8px 8px 0px 0px;border-radius:8px 8px 0px 0px;-moz-box-shadow:rgba(0, 0, 0, 0.1) 0px 0px 24px;-webkit-box-shadow:rgba(0, 0, 0, 0.1) 0px 0px 24px;box-shadow:rgba(0, 0, 0, 0.1) 0px 0px 24px}.chat-box--header{-moz-border-radius:8px 8px 0px 0px;-webkit-border-radius:8px 8px 0px 0px;border-radius:8px 8px 0px 0px}}";
|
|
@@ -9,9 +9,12 @@ const ChatButton = class {
|
|
|
9
9
|
constructor(hostRef) {
|
|
10
10
|
registerInstance(this, hostRef);
|
|
11
11
|
this.primaryColor = undefined;
|
|
12
|
+
this.receiverId = undefined;
|
|
12
13
|
this.accessToken = undefined;
|
|
13
14
|
this.senderId = undefined;
|
|
14
|
-
this.
|
|
15
|
+
this.senderIdState = undefined;
|
|
16
|
+
this.accessTokenState = undefined;
|
|
17
|
+
this.isChatVerificationExpanded = undefined;
|
|
15
18
|
this.senderInfo = {};
|
|
16
19
|
this.receiverInfo = {};
|
|
17
20
|
this.chatRoom = {};
|
|
@@ -19,31 +22,51 @@ const ChatButton = class {
|
|
|
19
22
|
this.isChatExpanded = undefined;
|
|
20
23
|
}
|
|
21
24
|
componentWillLoad() {
|
|
22
|
-
this.
|
|
25
|
+
this.senderIdState = this.senderId;
|
|
26
|
+
this.accessTokenState = this.accessToken;
|
|
27
|
+
this.senderIdState && this.accessTokenState && this.fetchData();
|
|
23
28
|
}
|
|
24
29
|
async fetchData() {
|
|
25
30
|
try {
|
|
26
|
-
this.chatRoom = await HttpService().createChatRoom(this.receiverId, this.
|
|
31
|
+
this.chatRoom = await HttpService().createChatRoom(this.receiverId, this.accessTokenState);
|
|
27
32
|
if (this.chatRoom) {
|
|
28
33
|
HttpService().fetchChatMessages(this.chatRoom.uid, (messages) => this.chatMessages = messages);
|
|
29
|
-
this.senderInfo = this.chatRoom.members.find(user => user.id === Number(this.
|
|
34
|
+
this.senderInfo = this.chatRoom.members.find(user => user.id === Number(this.senderIdState));
|
|
30
35
|
this.receiverInfo = this.chatRoom.members.find(user => user.id === Number(this.receiverId));
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
catch (e) { }
|
|
34
39
|
}
|
|
40
|
+
onVerificationSuccess(user) {
|
|
41
|
+
if (user.id && user.accessToken) {
|
|
42
|
+
this.isChatExpanded = true;
|
|
43
|
+
this.senderIdState = String(user.id);
|
|
44
|
+
this.accessTokenState = user.accessToken;
|
|
45
|
+
setTimeout(() => this.fetchData(), 350);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
35
48
|
render() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
if (this.senderIdState && this.accessTokenState) {
|
|
50
|
+
const unreadMessages = (this.chatMessages || []).filter(message => {
|
|
51
|
+
return Boolean(message.unRead) && message.senderId !== this.senderInfo.id;
|
|
52
|
+
});
|
|
53
|
+
return (h("div", null, unreadMessages.length > 0 && h("notify-sounds", null), h("div", { class: "chat-button--indicator", onClick: () => this.isChatExpanded = true }, unreadMessages.length > 0 && h("span", { class: "chat-button--counter" })), h("div", { class: "chat-box", style: this.isChatExpanded ? {} : { display: 'none' } }, h("div", { class: "chat-box--header", style: {
|
|
54
|
+
backgroundColor: this.primaryColor || '#f05a61',
|
|
55
|
+
} }, h("h3", { class: "chat-box--title" }, "Chat"), h("div", { style: { position: 'relative' } }, h("div", { class: "chat-box--close", onClick: () => this.isChatExpanded = false }))), h("div", { style: {
|
|
56
|
+
flexShrink: '1',
|
|
57
|
+
flexGrow: '1',
|
|
58
|
+
overflowY: 'auto',
|
|
59
|
+
padding: '16px',
|
|
60
|
+
} }, h("chat-messages", { sender: this.senderInfo, receiver: this.receiverInfo, messages: this.chatMessages || [], "chat-room-id": this.chatRoom.uid })), h("div", { style: { borderTop: `1px solid ${Colors.Gray02}` } }, h("chat-form", { "sender-id": this.senderInfo.id ? Number(this.senderInfo.id) : null, "chat-room-id": this.chatRoom.uid })))));
|
|
61
|
+
}
|
|
62
|
+
return (h("div", null, h("div", { class: "chat-button--indicator", onClick: () => this.isChatVerificationExpanded = true }), h("div", { class: "chat-box", style: this.isChatVerificationExpanded ? {} : { display: 'none' } }, h("div", { class: "chat-box--header", style: {
|
|
40
63
|
backgroundColor: this.primaryColor || '#f05a61',
|
|
41
|
-
} }, h("h3", { class: "chat-box--title" }, "Chat"), h("div", { style: { position: 'relative' } }, h("div", { class: "chat-box--close", onClick: () => this.
|
|
64
|
+
} }, h("h3", { class: "chat-box--title" }, "Chat"), h("div", { style: { position: 'relative' } }, h("div", { class: "chat-box--close", onClick: () => this.isChatVerificationExpanded = false }))), h("div", { style: {
|
|
42
65
|
flexShrink: '1',
|
|
43
66
|
flexGrow: '1',
|
|
44
67
|
overflowY: 'auto',
|
|
45
68
|
padding: '16px',
|
|
46
|
-
} }, h("
|
|
69
|
+
} }, h("user-form", { onSuccess: user => this.onVerificationSuccess(user) })))));
|
|
47
70
|
}
|
|
48
71
|
};
|
|
49
72
|
ChatButton.style = indexCss;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h } from './index-888e99e3.js';
|
|
2
|
-
import { d as dayjs_min, H as HttpService, t as timeFormatAmPm } from './services-
|
|
2
|
+
import { d as dayjs_min, H as HttpService, t as timeFormatAmPm } from './services-d71be591.js';
|
|
3
3
|
import { l as lodash } from './lodash-d5526b38.js';
|
|
4
4
|
import { C as Colors } from './colors-ea36347a.js';
|
|
5
5
|
import { r as relativeTime } from './relativeTime-268e64b0.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, h } from './index-888e99e3.js';
|
|
2
2
|
import { l as lodash } from './lodash-d5526b38.js';
|
|
3
3
|
import { C as Colors } from './colors-ea36347a.js';
|
|
4
|
-
import { H as HttpService } from './services-
|
|
4
|
+
import { H as HttpService } from './services-d71be591.js';
|
|
5
5
|
import { f as formatPhoneNumber } from './utils-fd30fb29.js';
|
|
6
6
|
import './_commonjsHelpers-a4f66ccd.js';
|
|
7
7
|
|
|
@@ -144,5 +144,5 @@ const patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
|
144
144
|
|
|
145
145
|
patchBrowser().then(options => {
|
|
146
146
|
globalScripts();
|
|
147
|
-
return bootstrapLazy([["chat-
|
|
147
|
+
return bootstrapLazy([["chat-button",[[0,"chat-button",{"primaryColor":[1,"primary-color"],"receiverId":[1,"receiver-id"],"accessToken":[1,"access-token"],"senderId":[1,"sender-id"],"senderIdState":[32],"accessTokenState":[32],"isChatVerificationExpanded":[32],"senderInfo":[32],"receiverInfo":[32],"chatRoom":[32],"chatMessages":[32],"isChatExpanded":[32],"fetchData":[64],"onVerificationSuccess":[64]}]]],["chat-box",[[0,"chat-box",{"primaryColor":[1,"primary-color"],"accessToken":[1,"access-token"],"senderId":[1,"sender-id"],"salonId":[1,"salon-id"],"chatRooms":[32],"activeRoom":[32],"fetchData":[64]}]]],["salon-info",[[0,"salon-info",{"salonId":[2,"salon-id"],"salonInfo":[32],"fetchData":[64]}]]],["salon-latest-reviews",[[0,"salon-latest-reviews",{"salonId":[2,"salon-id"],"primaryColor":[1,"primary-color"],"salonReviews":[32],"isLoading":[32],"fetchData":[64]}]]],["salon-lookbook",[[0,"salon-lookbook",{"salonId":[2,"salon-id"],"isLoading":[32],"isLoadingMore":[32],"hideLoadMore":[32],"currentPage":[32],"totalLookbooks":[32],"salonCategories":[32],"salonLookbooks":[32],"sortBy":[32],"filterBy":[32],"isLayoutSetup":[32],"fetchData":[64],"fetchLookbooks":[64],"onChangeFiltering":[64],"onChangeSorting":[64],"onLoadMore":[64],"fetchCategories":[64]}]]],["salon-reviews",[[0,"salon-reviews",{"salonId":[2,"salon-id"],"primaryColor":[1,"primary-color"],"salonInfo":[32],"stats":[32],"totalReviews":[32],"allReviews":[32],"isLoading":[32],"isSorting":[32],"isFiltering":[32],"isLoadingMore":[32],"canLoadMore":[32],"page":[32],"filterBy":[32],"sortBy":[32]}]]],["style-detail",[[0,"style-detail",{"salonId":[2,"salon-id"],"salonLookbook":[1,"salon-lookbook"],"lookbookInfo":[32],"isModalOpen":[32],"currentMediaIdx":[32],"currentMedia":[32],"albumMedias":[32],"similarStyles":[32],"totalComments":[32],"lookbookComments":[32],"isLayoutSetup":[32],"fetchData":[64]}]]],["salon-booking",[[0,"salon-booking",{"salonId":[2,"salon-id"],"buttonClass":[1,"button-class"],"buttonText":[1,"button-text"],"primaryColor":[1,"primary-color"]}]]],["salon-booking-modal",[[0,"salon-booking-modal",{"salonId":[2,"salon-id"],"primaryColor":[1,"primary-color"],"redirectUrl":[1,"redirect-url"],"isModalOpen":[32]}]]],["salon-gift-card",[[0,"salon-gift-card",{"salonId":[2,"salon-id"],"buttonClass":[1,"button-class"],"buttonText":[1,"button-text"],"primaryColor":[1,"primary-color"]}]]],["salon-gift-card-modal",[[0,"salon-gift-card-modal",{"salonId":[2,"salon-id"],"primaryColor":[1,"primary-color"],"isModalOpen":[32]}]]],["salon-ranking",[[0,"salon-ranking",{"ranking":[2],"height":[2],"width":[2]}]]],["salon-services",[[0,"salon-services",{"salonId":[2,"salon-id"],"buttonClass":[1,"button-class"],"salonServices":[32],"isLoading":[32],"fetchData":[64]}]]],["salon-stylists",[[0,"salon-stylists",{"salonId":[2,"salon-id"],"salonStylists":[32],"totalStylists":[32],"page":[32],"isLoading":[32],"isLoadingMore":[32],"canLoadMore":[32],"fetchData":[64],"onLoadMore":[64]}]]],["user-form",[[0,"user-form",{"onSuccess":[16],"type":[32],"currentUser":[32]}]]],["chat-rooms",[[0,"chat-rooms",{"senderId":[2,"sender-id"],"salonId":[2,"salon-id"],"chatRooms":[16],"clients":[16],"activeRoom":[16],"accessToken":[1,"access-token"],"onClickRoom":[16],"keyword":[32]}]]],["salon-locations",[[0,"salon-locations",{"salonId":[2,"salon-id"],"salonInfo":[1,"salon-info"],"isLoading":[4,"is-loading"],"withBorder":[4,"with-border"],"salonInfoState":[32]}]]],["notify-sounds",[[0,"notify-sounds"]]],["salon-latest-styles",[[0,"salon-latest-styles",{"salonId":[2,"salon-id"],"isLoading":[4,"is-loading"],"withBorder":[4,"with-border"],"isLoadingState":[32],"latestStyles":[32],"fetchData":[64]}]]],["salon-schedules",[[0,"salon-schedules",{"salonId":[2,"salon-id"],"salonInfo":[1,"salon-info"],"isLoading":[4,"is-loading"],"withBorder":[4,"with-border"],"salonInfoState":[32]}]]],["chat-messages",[[0,"chat-messages",{"sender":[16],"receiver":[16],"messages":[16],"chatRoomId":[1,"chat-room-id"]}]]],["activate-form",[[0,"activate-form",{"username":[1],"password":[1],"onSuccess":[16],"isSubmitting":[32],"error":[32],"confirmCode":[32],"onSubmit":[64],"resendCode":[64]}]]],["change-password-form",[[0,"change-password-form",{"username":[1],"onSuccess":[16],"isSubmitting":[32],"error":[32],"confirmCode":[32],"password":[32],"onSubmit":[64],"resendCode":[64]}]]],["chat-form",[[0,"chat-form",{"senderId":[2,"sender-id"],"chatRoomId":[1,"chat-room-id"]}]]],["google-map",[[0,"google-map",{"locationName":[1,"location-name"],"locationAddress":[1,"location-address"]}]]],["login-form",[[0,"login-form",{"onSuccess":[16],"isSubmitting":[32],"error":[32],"username":[32],"password":[32],"onSubmit":[64]}]]],["register-form",[[0,"register-form",{"onSuccess":[16],"isSubmitting":[32],"error":[32],"firstName":[32],"lastName":[32],"email":[32],"phone":[32],"password":[32],"onSubmit":[64]}]]],["reset-password-form",[[0,"reset-password-form",{"onSuccess":[16],"isSubmitting":[32],"error":[32],"username":[32],"onSubmit":[64]}]]],["user-avatar",[[0,"user-avatar",{"size":[2],"name":[1],"description":[1],"nameStyle":[16],"shortName":[1,"short-name"],"avatar":[1]}]]]], options);
|
|
148
148
|
});
|