@phonghq/go-chat 1.0.30 β 1.0.31
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/chat/page/setting/SettingSuccess.vue.d.ts +2 -0
- package/dist/components/chat/common/spin/BaseSpin.vue.d.ts +1 -0
- package/dist/constant/general.d.ts +3 -1
- package/dist/go-chat.es.js +8687 -7534
- package/dist/go-chat.umd.js +13 -13
- package/dist/plugins/pocketbase.d.ts +5 -0
- package/dist/style.css +1 -1
- package/dist/test/chat/App.vue.js +130 -148
- package/dist/test/chat/page/setting/Setting.vue.js +148 -7
- package/dist/test/chat/page/setting/SettingSuccess.vue.js +33 -0
- package/dist/test/components/chat/common/spin/BaseSpin.vue.js +4 -0
- package/dist/test/components/chat/select/SelectBase.vue.js +1 -2
- package/dist/test/components/common/button/ButtonBase.vue.js +3 -3
- package/dist/test/composable/useInitData.js +4 -1
- package/dist/test/composable/usePlivo.js +2 -2
- package/dist/test/constant/general.js +2 -0
- package/dist/test/plugins/pocketbase.js +16 -0
- package/dist/test/utils/chat/auth.js +2 -1
- package/dist/types/chat/auth.d.ts +1 -0
- package/dist/utils/chat/auth.d.ts +2 -0
- package/package.json +2 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import SelectBase from '../../../components/chat/select/SelectBase.vue';
|
|
4
|
+
import { dataProfile } from '../../../utils/chat/auth';
|
|
5
|
+
import { createBusinessTenantPhone } from '../../../plugins/pocketbase';
|
|
6
|
+
import { routerPush } from '../../../utils/chat/chat-router';
|
|
7
|
+
import { PAGE } from '../../../constant/general';
|
|
8
|
+
import ButtonBase from '@/components/common/button/ButtonBase.vue';
|
|
4
9
|
const open = ref(false);
|
|
5
10
|
const phoneValue = ref('');
|
|
11
|
+
const nameValue = ref('');
|
|
6
12
|
const countries = [
|
|
7
13
|
// { value: 'VN', label: 'Vietnam', dial: 84, flag: 'π»π³' },
|
|
8
14
|
{ value: 'US', label: '+1 US', dial: 1, flag: 'πΊπΈ' }
|
|
@@ -16,6 +22,7 @@ const select = (c) => {
|
|
|
16
22
|
selected.value = c;
|
|
17
23
|
open.value = false;
|
|
18
24
|
};
|
|
25
|
+
const loading = ref(false);
|
|
19
26
|
const handleInput = () => {
|
|
20
27
|
error.value = '';
|
|
21
28
|
phoneValue.value = keepOnlyNumbers(phoneValue.value);
|
|
@@ -23,7 +30,41 @@ const handleInput = () => {
|
|
|
23
30
|
const keepOnlyNumbers = (str) => {
|
|
24
31
|
return str.replace(/\D/g, '');
|
|
25
32
|
};
|
|
26
|
-
const
|
|
33
|
+
const isPhoneMatchDial = (countryDial, phone) => {
|
|
34
|
+
const dial = phone.replace('+', '');
|
|
35
|
+
return phone.startsWith(countryDial.toString());
|
|
36
|
+
};
|
|
37
|
+
const onSubmit = async () => {
|
|
38
|
+
try {
|
|
39
|
+
console.log(isPhoneMatchDial(selected.value.dial, phoneValue.value));
|
|
40
|
+
if (!nameValue.value) {
|
|
41
|
+
error.value = `Business name is required.`;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (!phoneValue.value || keepOnlyNumbers(phoneValue.value).length > 10) {
|
|
45
|
+
error.value = `Phone number must contain 10 digits`;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (isPhoneMatchDial(selected.value.dial, phoneValue.value)) {
|
|
49
|
+
error.value = `Phone number does not match country code ${selected.value.value}`;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
loading.value = true;
|
|
53
|
+
const param = {
|
|
54
|
+
tenant_id: dataProfile.value?.tenant_id,
|
|
55
|
+
phone_forward: selected.value.dial + phoneValue.value,
|
|
56
|
+
tenant_name: nameValue.value
|
|
57
|
+
};
|
|
58
|
+
await createBusinessTenantPhone(param);
|
|
59
|
+
routerPush(PAGE.REGISTER_SUCCESS);
|
|
60
|
+
// router.push({ name: 'home' })
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
console.log(e);
|
|
64
|
+
error.value = e?.message || 'Something error!';
|
|
65
|
+
}
|
|
66
|
+
loading.value = false;
|
|
67
|
+
};
|
|
27
68
|
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
28
69
|
const __VLS_ctx = {
|
|
29
70
|
...{},
|
|
@@ -32,9 +73,32 @@ const __VLS_ctx = {
|
|
|
32
73
|
let __VLS_elements;
|
|
33
74
|
let __VLS_components;
|
|
34
75
|
let __VLS_directives;
|
|
76
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
77
|
+
...{ class: "mx-auto w-full h-full max-w-[700px] flex flex-col gap-4 justify-center px-5" },
|
|
78
|
+
});
|
|
79
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
80
|
+
...{ class: "flex gap-4" },
|
|
81
|
+
});
|
|
82
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
83
|
+
...{ class: "text-3xl md:text-3xl text-chat-haze-800 font-bold text-center mb-2" },
|
|
84
|
+
});
|
|
35
85
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
|
|
36
86
|
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
37
|
-
...{ class: "text-xl font-semibold text-chat-haze-600 mb-
|
|
87
|
+
...{ class: "text-xl font-semibold text-chat-haze-600 mb-2" },
|
|
88
|
+
});
|
|
89
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
90
|
+
...{ class: "chat-input border border-chat-haze-200 p-2 bg-white shadow-md" },
|
|
91
|
+
});
|
|
92
|
+
__VLS_asFunctionalElement(__VLS_elements.input)({
|
|
93
|
+
...{ class: "!outline-none h-8 px-2 w-full" },
|
|
94
|
+
placeholder: "Enter business name",
|
|
95
|
+
});
|
|
96
|
+
(__VLS_ctx.nameValue);
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
[nameValue,];
|
|
99
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
|
|
100
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
101
|
+
...{ class: "text-xl font-semibold text-chat-haze-600 mb-2" },
|
|
38
102
|
});
|
|
39
103
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
40
104
|
...{ class: "flex items-center gap-2 chat-input border border-chat-haze-200 p-2 bg-white shadow-md" },
|
|
@@ -47,12 +111,10 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
|
47
111
|
const __VLS_0 = __VLS_asFunctionalComponent(SelectBase, new SelectBase({
|
|
48
112
|
options: (__VLS_ctx.countries),
|
|
49
113
|
placement: "bottom",
|
|
50
|
-
disabled: true,
|
|
51
114
|
}));
|
|
52
115
|
const __VLS_1 = __VLS_0({
|
|
53
116
|
options: (__VLS_ctx.countries),
|
|
54
117
|
placement: "bottom",
|
|
55
|
-
disabled: true,
|
|
56
118
|
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
57
119
|
const { default: __VLS_3 } = __VLS_2.slots;
|
|
58
120
|
// @ts-ignore
|
|
@@ -85,7 +147,6 @@ __VLS_asFunctionalElement(__VLS_elements.path)({
|
|
|
85
147
|
var __VLS_2;
|
|
86
148
|
__VLS_asFunctionalElement(__VLS_elements.input)({
|
|
87
149
|
...{ onInput: (__VLS_ctx.handleInput) },
|
|
88
|
-
...{ onKeyup: (__VLS_ctx.onSubmit) },
|
|
89
150
|
...{ class: "!outline-none" },
|
|
90
151
|
type: "tel",
|
|
91
152
|
maxlength: (10),
|
|
@@ -93,11 +154,81 @@ __VLS_asFunctionalElement(__VLS_elements.input)({
|
|
|
93
154
|
});
|
|
94
155
|
(__VLS_ctx.phoneValue);
|
|
95
156
|
// @ts-ignore
|
|
96
|
-
[handleInput,
|
|
157
|
+
[handleInput, phoneValue,];
|
|
158
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
159
|
+
...{ class: "relative" },
|
|
160
|
+
});
|
|
161
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
162
|
+
...{ class: "text-chat-error absolute -top-4 left-4" },
|
|
163
|
+
});
|
|
164
|
+
__VLS_asFunctionalDirective(__VLS_directives.vShow)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.error) }, null, null);
|
|
165
|
+
// @ts-ignore
|
|
166
|
+
[error,];
|
|
167
|
+
(__VLS_ctx.error);
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
[error,];
|
|
170
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
171
|
+
...{ class: "flex-center mt-2" },
|
|
172
|
+
});
|
|
173
|
+
/** @type {[typeof ButtonBase, typeof ButtonBase, ]} */ ;
|
|
174
|
+
// @ts-ignore
|
|
175
|
+
const __VLS_4 = __VLS_asFunctionalComponent(ButtonBase, new ButtonBase({
|
|
176
|
+
...{ 'onClick': {} },
|
|
177
|
+
loading: (__VLS_ctx.loading),
|
|
178
|
+
type: "primary",
|
|
179
|
+
...{ class: "w-[150px] h-12 font-medium" },
|
|
180
|
+
}));
|
|
181
|
+
const __VLS_5 = __VLS_4({
|
|
182
|
+
...{ 'onClick': {} },
|
|
183
|
+
loading: (__VLS_ctx.loading),
|
|
184
|
+
type: "primary",
|
|
185
|
+
...{ class: "w-[150px] h-12 font-medium" },
|
|
186
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_4));
|
|
187
|
+
let __VLS_7;
|
|
188
|
+
let __VLS_8;
|
|
189
|
+
const __VLS_9 = ({ click: {} },
|
|
190
|
+
{ onClick: (...[$event]) => {
|
|
191
|
+
__VLS_ctx.onSubmit();
|
|
192
|
+
// @ts-ignore
|
|
193
|
+
[loading, onSubmit,];
|
|
194
|
+
} });
|
|
195
|
+
const { default: __VLS_10 } = __VLS_6.slots;
|
|
196
|
+
var __VLS_6;
|
|
197
|
+
/** @type {__VLS_StyleScopedClasses['mx-auto']} */ ;
|
|
198
|
+
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
199
|
+
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
200
|
+
/** @type {__VLS_StyleScopedClasses['max-w-[700px]']} */ ;
|
|
201
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
202
|
+
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
203
|
+
/** @type {__VLS_StyleScopedClasses['gap-4']} */ ;
|
|
204
|
+
/** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
|
|
205
|
+
/** @type {__VLS_StyleScopedClasses['px-5']} */ ;
|
|
206
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
207
|
+
/** @type {__VLS_StyleScopedClasses['gap-4']} */ ;
|
|
208
|
+
/** @type {__VLS_StyleScopedClasses['text-3xl']} */ ;
|
|
209
|
+
/** @type {__VLS_StyleScopedClasses['md:text-3xl']} */ ;
|
|
210
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-haze-800']} */ ;
|
|
211
|
+
/** @type {__VLS_StyleScopedClasses['font-bold']} */ ;
|
|
212
|
+
/** @type {__VLS_StyleScopedClasses['text-center']} */ ;
|
|
213
|
+
/** @type {__VLS_StyleScopedClasses['mb-2']} */ ;
|
|
214
|
+
/** @type {__VLS_StyleScopedClasses['text-xl']} */ ;
|
|
215
|
+
/** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
|
|
216
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
|
|
217
|
+
/** @type {__VLS_StyleScopedClasses['mb-2']} */ ;
|
|
218
|
+
/** @type {__VLS_StyleScopedClasses['chat-input']} */ ;
|
|
219
|
+
/** @type {__VLS_StyleScopedClasses['border']} */ ;
|
|
220
|
+
/** @type {__VLS_StyleScopedClasses['border-chat-haze-200']} */ ;
|
|
221
|
+
/** @type {__VLS_StyleScopedClasses['p-2']} */ ;
|
|
222
|
+
/** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
|
|
223
|
+
/** @type {__VLS_StyleScopedClasses['shadow-md']} */ ;
|
|
224
|
+
/** @type {__VLS_StyleScopedClasses['!outline-none']} */ ;
|
|
225
|
+
/** @type {__VLS_StyleScopedClasses['h-8']} */ ;
|
|
226
|
+
/** @type {__VLS_StyleScopedClasses['px-2']} */ ;
|
|
227
|
+
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
97
228
|
/** @type {__VLS_StyleScopedClasses['text-xl']} */ ;
|
|
98
229
|
/** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
|
|
99
230
|
/** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
|
|
100
|
-
/** @type {__VLS_StyleScopedClasses['mb-
|
|
231
|
+
/** @type {__VLS_StyleScopedClasses['mb-2']} */ ;
|
|
101
232
|
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
102
233
|
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
103
234
|
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
@@ -121,5 +252,15 @@ __VLS_asFunctionalElement(__VLS_elements.input)({
|
|
|
121
252
|
/** @type {__VLS_StyleScopedClasses['h-4']} */ ;
|
|
122
253
|
/** @type {__VLS_StyleScopedClasses['text-chat-haze-500']} */ ;
|
|
123
254
|
/** @type {__VLS_StyleScopedClasses['!outline-none']} */ ;
|
|
255
|
+
/** @type {__VLS_StyleScopedClasses['relative']} */ ;
|
|
256
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-error']} */ ;
|
|
257
|
+
/** @type {__VLS_StyleScopedClasses['absolute']} */ ;
|
|
258
|
+
/** @type {__VLS_StyleScopedClasses['-top-4']} */ ;
|
|
259
|
+
/** @type {__VLS_StyleScopedClasses['left-4']} */ ;
|
|
260
|
+
/** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
|
|
261
|
+
/** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
|
|
262
|
+
/** @type {__VLS_StyleScopedClasses['w-[150px]']} */ ;
|
|
263
|
+
/** @type {__VLS_StyleScopedClasses['h-12']} */ ;
|
|
264
|
+
/** @type {__VLS_StyleScopedClasses['font-medium']} */ ;
|
|
124
265
|
const __VLS_export = (await import('vue')).defineComponent({});
|
|
125
266
|
export default {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
3
|
+
const __VLS_ctx = {};
|
|
4
|
+
let __VLS_elements;
|
|
5
|
+
let __VLS_components;
|
|
6
|
+
let __VLS_directives;
|
|
7
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
8
|
+
...{ class: "mx-auto w-full h-full max-w-[700px] flex flex-col gap-4 justify-center items-center px-5" },
|
|
9
|
+
});
|
|
10
|
+
__VLS_asFunctionalElement(__VLS_elements.img)({
|
|
11
|
+
...{ class: "w-[130px] h-auto" },
|
|
12
|
+
src: "../../../assets/images/success.png",
|
|
13
|
+
});
|
|
14
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
15
|
+
...{ class: "font-semibold text-center text-2xl" },
|
|
16
|
+
});
|
|
17
|
+
/** @type {__VLS_StyleScopedClasses['mx-auto']} */ ;
|
|
18
|
+
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
19
|
+
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
20
|
+
/** @type {__VLS_StyleScopedClasses['max-w-[700px]']} */ ;
|
|
21
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
22
|
+
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
23
|
+
/** @type {__VLS_StyleScopedClasses['gap-4']} */ ;
|
|
24
|
+
/** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
|
|
25
|
+
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
26
|
+
/** @type {__VLS_StyleScopedClasses['px-5']} */ ;
|
|
27
|
+
/** @type {__VLS_StyleScopedClasses['w-[130px]']} */ ;
|
|
28
|
+
/** @type {__VLS_StyleScopedClasses['h-auto']} */ ;
|
|
29
|
+
/** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
|
|
30
|
+
/** @type {__VLS_StyleScopedClasses['text-center']} */ ;
|
|
31
|
+
/** @type {__VLS_StyleScopedClasses['text-2xl']} */ ;
|
|
32
|
+
const __VLS_export = (await import('vue')).defineComponent({});
|
|
33
|
+
export default {};
|
|
@@ -9,6 +9,10 @@ const style = computed(() => {
|
|
|
9
9
|
result.width = props.size + 'px';
|
|
10
10
|
result.height = props.size + 'px';
|
|
11
11
|
result.borderWidth = props.border + 'px';
|
|
12
|
+
if (props.color) {
|
|
13
|
+
result.borderColor = props.color;
|
|
14
|
+
}
|
|
15
|
+
result.borderBottomColor = 'transparent';
|
|
12
16
|
return result;
|
|
13
17
|
});
|
|
14
18
|
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
@@ -69,7 +69,7 @@ for (const [option, idx] of __VLS_getVForSourceType((__VLS_ctx.options))) {
|
|
|
69
69
|
(option.label);
|
|
70
70
|
}
|
|
71
71
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
72
|
-
...{ class: "cursor-pointer
|
|
72
|
+
...{ class: "cursor-pointer" },
|
|
73
73
|
});
|
|
74
74
|
var __VLS_0 = {};
|
|
75
75
|
/** @type {__VLS_StyleScopedClasses['relative']} */ ;
|
|
@@ -95,7 +95,6 @@ var __VLS_0 = {};
|
|
|
95
95
|
/** @type {__VLS_StyleScopedClasses['border-b']} */ ;
|
|
96
96
|
/** @type {__VLS_StyleScopedClasses['border-chat-haze-200']} */ ;
|
|
97
97
|
/** @type {__VLS_StyleScopedClasses['cursor-pointer']} */ ;
|
|
98
|
-
/** @type {__VLS_StyleScopedClasses['pointer-events-none']} */ ;
|
|
99
98
|
// @ts-ignore
|
|
100
99
|
var __VLS_1 = __VLS_0;
|
|
101
100
|
const __VLS_base = (await import('vue')).defineComponent({
|
|
@@ -39,16 +39,16 @@ let __VLS_directives;
|
|
|
39
39
|
// @ts-ignore
|
|
40
40
|
const __VLS_0 = __VLS_asFunctionalComponent(CButton, new CButton({
|
|
41
41
|
variant: (__VLS_ctx.variant),
|
|
42
|
-
disabled: (__VLS_ctx.
|
|
42
|
+
disabled: (__VLS_ctx.disabled),
|
|
43
43
|
}));
|
|
44
44
|
const __VLS_1 = __VLS_0({
|
|
45
45
|
variant: (__VLS_ctx.variant),
|
|
46
|
-
disabled: (__VLS_ctx.
|
|
46
|
+
disabled: (__VLS_ctx.disabled),
|
|
47
47
|
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
48
48
|
var __VLS_3 = {};
|
|
49
49
|
const { default: __VLS_4 } = __VLS_2.slots;
|
|
50
50
|
// @ts-ignore
|
|
51
|
-
[variant,
|
|
51
|
+
[variant, disabled,];
|
|
52
52
|
if (__VLS_ctx.loading) {
|
|
53
53
|
// @ts-ignore
|
|
54
54
|
[loading,];
|
|
@@ -5,6 +5,7 @@ import { routerPush } from '../utils/chat/chat-router';
|
|
|
5
5
|
import { PAGE } from '../constant/general';
|
|
6
6
|
import { connectMqtt, subscribeToTopic, unsubscribeFromTopic } from '../plugins/mqtt';
|
|
7
7
|
import { TOPIC_DETAIL_CALL } from '../constant/mqtt';
|
|
8
|
+
import { checkHasBusinessTenantPhone } from '../plugins/pocketbase';
|
|
8
9
|
// import router from '../router'
|
|
9
10
|
//PINIA
|
|
10
11
|
export const isRouterReady = ref(false);
|
|
@@ -22,8 +23,8 @@ export function useInitData() {
|
|
|
22
23
|
// }
|
|
23
24
|
}
|
|
24
25
|
// connectMqtt()
|
|
25
|
-
await connectMqtt();
|
|
26
26
|
await initData(data.props, data.response);
|
|
27
|
+
await connectMqtt();
|
|
27
28
|
}
|
|
28
29
|
catch (error) {
|
|
29
30
|
console.log(error);
|
|
@@ -36,6 +37,8 @@ export function useInitData() {
|
|
|
36
37
|
const res = await getProfile();
|
|
37
38
|
if (dataProfile.value?.user_type == 'tenant') {
|
|
38
39
|
await checkTenantPhone();
|
|
40
|
+
if (dataProfile.value)
|
|
41
|
+
dataProfile.value.has_business_tenant_phone = await checkHasBusinessTenantPhone(dataProfile.value?.tenant_id);
|
|
39
42
|
}
|
|
40
43
|
unsubscribeFromTopic(TOPIC_DETAIL_CALL + dataProfile.value?.id);
|
|
41
44
|
subscribeToTopic(TOPIC_DETAIL_CALL + dataProfile.value?.id);
|
|
@@ -38,8 +38,8 @@ export function usePlivo(callback) {
|
|
|
38
38
|
// plivoBrowserSdk?.client?.on?.('remoteAudioStatus', () => console.log('remoteAudioStatus'))
|
|
39
39
|
const payload = JSON.parse(atob(token.split('.')[1]));
|
|
40
40
|
// await plivoBrowserSdk?.client?.tokenLogin(username, token)
|
|
41
|
-
await plivoBrowserSdk?.client?.login('webcall003079673454891827', '123456abcA!')
|
|
42
|
-
|
|
41
|
+
// await plivoBrowserSdk?.client?.login('webcall003079673454891827', '123456abcA!')
|
|
42
|
+
await plivoBrowserSdk?.client?.loginWithAccessToken(token);
|
|
43
43
|
// console.log('Registered with token')
|
|
44
44
|
}
|
|
45
45
|
catch (err) {
|
|
@@ -6,4 +6,6 @@ export var PAGE;
|
|
|
6
6
|
PAGE["CUSTOMER_APPOINTMENT"] = "customer_appointment";
|
|
7
7
|
PAGE["TENANT_ERROR"] = "tenant_error";
|
|
8
8
|
PAGE["CHAT_LIST"] = "chat_list";
|
|
9
|
+
PAGE["REGISTER_TENANT"] = "register_tenant";
|
|
10
|
+
PAGE["REGISTER_SUCCESS"] = "register_success";
|
|
9
11
|
})(PAGE || (PAGE = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import PocketBase from 'pocketbase';
|
|
2
|
+
// const instance = new PocketBase("https://gap-calendar-data.srv01.dtsmart.dev");
|
|
3
|
+
const instance = new PocketBase("https://gap-calendar-log.gci-app.dtsmart.dev/");
|
|
4
|
+
export const createBusinessTenantPhone = async (data) => {
|
|
5
|
+
await instance.collection('go_chat_service').create(data);
|
|
6
|
+
};
|
|
7
|
+
export const checkHasBusinessTenantPhone = async (id) => {
|
|
8
|
+
try {
|
|
9
|
+
const res = await instance.collection('go_chat_service').getFirstListItem(`tenant_id="${id}"`);
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export default instance;
|
|
@@ -43,8 +43,9 @@ export const checkTenantPhone = async () => {
|
|
|
43
43
|
const res = await axios.get(`/api/v1/message/tenant/get-info?tenant_name=${id}`);
|
|
44
44
|
if (res.error || !res?.data)
|
|
45
45
|
throw new Error(res.error);
|
|
46
|
+
// if(dataProfile.value) dataProfile.value.tenant_phone = res?.data?.go_chat_phone ?? ''
|
|
46
47
|
if (dataProfile.value)
|
|
47
|
-
dataProfile.value.tenant_phone =
|
|
48
|
+
dataProfile.value.tenant_phone = '';
|
|
48
49
|
if (dataProfile.value)
|
|
49
50
|
dataProfile.value.tenant_phone_limit = Number(res?.data?.go_chat_phone_limit ?? 0);
|
|
50
51
|
return res;
|
|
@@ -18,6 +18,7 @@ export declare const dataProfile: import("vue").Ref<{
|
|
|
18
18
|
tenant_phone_limit: number;
|
|
19
19
|
avatar: string | null;
|
|
20
20
|
user_type: "customer" | "tenant";
|
|
21
|
+
has_business_tenant_phone?: boolean | undefined;
|
|
21
22
|
color: string;
|
|
22
23
|
} | null, IResProfile | {
|
|
23
24
|
id: number;
|
|
@@ -28,6 +29,7 @@ export declare const dataProfile: import("vue").Ref<{
|
|
|
28
29
|
tenant_phone_limit: number;
|
|
29
30
|
avatar: string | null;
|
|
30
31
|
user_type: "customer" | "tenant";
|
|
32
|
+
has_business_tenant_phone?: boolean | undefined;
|
|
31
33
|
color: string;
|
|
32
34
|
} | null>;
|
|
33
35
|
export declare const dataLoginLink: import("vue").Ref<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phonghq/go-chat",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"mqtt": "^4.3.7",
|
|
36
36
|
"pinia": "^2.1.7",
|
|
37
37
|
"plivo-browser-sdk": "^2.2.21",
|
|
38
|
+
"pocketbase": "^0.26.5",
|
|
38
39
|
"prettier": "3.3.3",
|
|
39
40
|
"reka-ui": "^2.6.0",
|
|
40
41
|
"tailwind-merge": "^3.3.1",
|