@phonghq/go-chat 1.0.10 → 1.0.13
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/assets/icons/IconAiCheck.vue.d.ts +2 -0
- package/dist/assets/icons/call/IconClose.vue.d.ts +2 -0
- package/dist/assets/icons/call/IconSoundDownload.vue.d.ts +2 -0
- package/dist/chat/App.vue.d.ts +7 -2
- package/dist/chat/page/customer-detail/CustomerDetail.vue.d.ts +1 -1
- package/dist/chat/page/home/ChatList.vue.d.ts +29 -1
- package/dist/chat/page/home/ChatMessage.vue.d.ts +1 -1
- package/dist/chat/page/home/Home.vue.d.ts +1 -1
- package/dist/components/chat/ScrollEvent/ScrollEvent.vue.d.ts +1 -0
- package/dist/components/chat/call/Calling.vue.d.ts +8 -2
- package/dist/components/chat/common/input/InputSearch.vue.d.ts +1 -1
- package/dist/components/chat/select/SelectBase.vue.d.ts +22 -0
- package/dist/composable/useCallHelper.d.ts +6 -2
- package/dist/composable/useInitData.d.ts +2 -4
- package/dist/go-chat.es.js +24960 -23685
- package/dist/go-chat.umd.js +42 -16
- package/dist/plugins/websocket.d.ts +12 -2
- package/dist/router/index.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/test/assets/icons/IconAiCheck.vue.js +28 -0
- package/dist/test/assets/icons/call/IconClose.vue.js +26 -0
- package/dist/test/assets/icons/call/IconSoundDownload.vue.js +50 -0
- package/dist/test/chat/App.vue.js +145 -90
- package/dist/test/chat/page/customer-detail/CustomerDetail.vue.js +6 -5
- package/dist/test/chat/page/home/ChatList.vue.js +30 -9
- package/dist/test/chat/page/home/ChatMessage.vue.js +17 -9
- package/dist/test/chat/page/home/Home.vue.js +3 -3
- package/dist/test/chat/page/home/NewCustomer.vue.js +0 -12
- package/dist/test/components/chat/ScrollEvent/ScrollEvent.vue.js +7 -1
- package/dist/test/components/chat/call/Calling.vue.js +198 -76
- package/dist/test/components/chat/common/input/InputSearch.vue.js +2 -2
- package/dist/test/components/chat/select/SelectBase.vue.js +98 -0
- package/dist/test/components/common/drawer/DrawerBaseCustom.vue.js +0 -1
- package/dist/test/composable/data.json +32 -0
- package/dist/test/composable/useCallHelper.js +143 -33
- package/dist/test/composable/useDigibot.js +1 -1
- package/dist/test/composable/useInitData.js +17 -12
- package/dist/test/constant/color.js +1 -1
- package/dist/test/plugins/axios.js +2 -1
- package/dist/test/plugins/mqtt.js +11 -5
- package/dist/test/plugins/websocket.js +84 -4
- package/dist/test/router/index.js +39 -0
- package/dist/test/utils/chat/auth.js +10 -2
- package/dist/test/utils/chat/call.js +32 -5
- package/dist/test/utils/chat/phone-string.js +4 -0
- package/dist/test/utils/chat/user.js +7 -2
- package/dist/test/views/NotFound.vue.js +47 -0
- package/dist/test/views/TenantPhone.vue.js +270 -0
- package/dist/types/chat/global.d.ts +4 -0
- package/dist/utils/chat/auth.d.ts +5 -1
- package/dist/utils/chat/call.d.ts +5 -2
- package/dist/utils/chat/phone-string.d.ts +1 -0
- package/dist/utils/chat/user.d.ts +4 -0
- package/dist/views/NotFound.vue.d.ts +2 -0
- package/dist/views/TenantPhone.vue.d.ts +2 -0
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ import utc from 'dayjs/plugin/utc';
|
|
|
17
17
|
import timezone from 'dayjs/plugin/timezone';
|
|
18
18
|
import { useDigibot } from '../../../composable/useDigibot';
|
|
19
19
|
import { TIME_ZONE_UTC } from '../../../constant/datetime';
|
|
20
|
+
import IconAiCheck from '../../../assets/icons/IconAiCheck.vue';
|
|
20
21
|
dayjs.extend(updateLocale);
|
|
21
22
|
dayjs.extend(relativeTime);
|
|
22
23
|
dayjs.extend(utc);
|
|
@@ -92,7 +93,6 @@ const mqttMessageHandler = (topic, data) => {
|
|
|
92
93
|
if (index != -1) {
|
|
93
94
|
listConversations.value.splice(index, 1);
|
|
94
95
|
}
|
|
95
|
-
console.log(hasChatBox);
|
|
96
96
|
if (hasChatBox > -1) {
|
|
97
97
|
listConversations.value.splice(1, 0, data);
|
|
98
98
|
}
|
|
@@ -131,10 +131,12 @@ const getData = async (data, option) => {
|
|
|
131
131
|
await nextTick();
|
|
132
132
|
}
|
|
133
133
|
listConversations.value.push(...(res?.items ?? []));
|
|
134
|
-
console.log(listConversations.value);
|
|
135
134
|
checkHasReceiveId();
|
|
136
135
|
params.value.page = res?._meta?.currentPage || 1;
|
|
137
136
|
pageCount = res?._meta?.pageCount || 1;
|
|
137
|
+
if (option?.reset) {
|
|
138
|
+
getAllList();
|
|
139
|
+
}
|
|
138
140
|
}
|
|
139
141
|
catch (error) {
|
|
140
142
|
console.error(error);
|
|
@@ -143,9 +145,15 @@ const getData = async (data, option) => {
|
|
|
143
145
|
isLoadingSearch.value = false;
|
|
144
146
|
}
|
|
145
147
|
};
|
|
148
|
+
const getAllList = async () => {
|
|
149
|
+
while (params.value.page < pageCount && !scrollEventRef.value?.canScroll()) {
|
|
150
|
+
let page = params.value.page + 1;
|
|
151
|
+
await getData({ page });
|
|
152
|
+
}
|
|
153
|
+
};
|
|
146
154
|
const checkHasReceiveId = () => {
|
|
147
155
|
const hasReceiveId = listConversations.value?.some((e) => e.receiver_id === receiver_id.value && receiver_id.value);
|
|
148
|
-
if (props.
|
|
156
|
+
if (props.responsive == 'tablet') {
|
|
149
157
|
if (!hasReceiveId && listConversations.value?.length)
|
|
150
158
|
emit('selectReceiver', listConversations.value[0]);
|
|
151
159
|
}
|
|
@@ -182,7 +190,7 @@ const getTimeFromNow = (data) => {
|
|
|
182
190
|
return data ?? '';
|
|
183
191
|
};
|
|
184
192
|
getData({}, { reset: true });
|
|
185
|
-
const __VLS_exposed = { handleReadMessage };
|
|
193
|
+
const __VLS_exposed = { handleReadMessage, listConversations };
|
|
186
194
|
defineExpose(__VLS_exposed);
|
|
187
195
|
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
188
196
|
const __VLS_modelEmit = defineEmits();
|
|
@@ -208,13 +216,13 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
|
208
216
|
const __VLS_0 = __VLS_asFunctionalComponent(InputSearch, new InputSearch({
|
|
209
217
|
...{ 'onSearch': {} },
|
|
210
218
|
...{ class: "h-[45px] grow" },
|
|
211
|
-
|
|
219
|
+
responsive: (__VLS_ctx.responsive),
|
|
212
220
|
modelValue: (__VLS_ctx.keyword),
|
|
213
221
|
}));
|
|
214
222
|
const __VLS_1 = __VLS_0({
|
|
215
223
|
...{ 'onSearch': {} },
|
|
216
224
|
...{ class: "h-[45px] grow" },
|
|
217
|
-
|
|
225
|
+
responsive: (__VLS_ctx.responsive),
|
|
218
226
|
modelValue: (__VLS_ctx.keyword),
|
|
219
227
|
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
220
228
|
let __VLS_3;
|
|
@@ -222,7 +230,7 @@ let __VLS_4;
|
|
|
222
230
|
const __VLS_5 = ({ search: {} },
|
|
223
231
|
{ onSearch: (__VLS_ctx.handleSearch) });
|
|
224
232
|
// @ts-ignore
|
|
225
|
-
[
|
|
233
|
+
[responsive, keyword, handleSearch,];
|
|
226
234
|
var __VLS_2;
|
|
227
235
|
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
228
236
|
...{ class: "h-[45px] w-[45px] rounded-full flex-center bg-[#C7DEFF]" },
|
|
@@ -285,10 +293,10 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
|
|
|
285
293
|
});
|
|
286
294
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
287
295
|
...{ class: "w-full overflow-hidden flex items-center hover:bg-[#EDF5FF] cursor-pointer px-6 py-2" },
|
|
288
|
-
...{ class: ({ 'bg-[#EDF5FF]': __VLS_ctx.receiver_id == user.receiver_id && __VLS_ctx.
|
|
296
|
+
...{ class: ({ 'bg-[#EDF5FF]': __VLS_ctx.receiver_id == user.receiver_id && __VLS_ctx.responsive == 'tablet' }) },
|
|
289
297
|
});
|
|
290
298
|
// @ts-ignore
|
|
291
|
-
[
|
|
299
|
+
[responsive, receiver_id,];
|
|
292
300
|
/** @type {[typeof Avatar, ]} */ ;
|
|
293
301
|
// @ts-ignore
|
|
294
302
|
const __VLS_24 = __VLS_asFunctionalComponent(Avatar, new Avatar({
|
|
@@ -321,6 +329,18 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
|
|
|
321
329
|
...{ class: "font-semibold" },
|
|
322
330
|
});
|
|
323
331
|
(user.username);
|
|
332
|
+
if (user.id == __VLS_ctx.digibotId) {
|
|
333
|
+
// @ts-ignore
|
|
334
|
+
[digibotId,];
|
|
335
|
+
/** @type {[typeof IconAiCheck, ]} */ ;
|
|
336
|
+
// @ts-ignore
|
|
337
|
+
const __VLS_28 = __VLS_asFunctionalComponent(IconAiCheck, new IconAiCheck({
|
|
338
|
+
...{ class: "ml-2" },
|
|
339
|
+
}));
|
|
340
|
+
const __VLS_29 = __VLS_28({
|
|
341
|
+
...{ class: "ml-2" },
|
|
342
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_28));
|
|
343
|
+
}
|
|
324
344
|
if (user.unread_count) {
|
|
325
345
|
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
|
|
326
346
|
...{ class: "ml-2 bg-[#E60000] text-white text-xs font-bold px-2 py-[1px] flex-center rounded-full" },
|
|
@@ -394,6 +414,7 @@ var __VLS_17;
|
|
|
394
414
|
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
395
415
|
/** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
|
|
396
416
|
/** @type {__VLS_StyleScopedClasses['ml-2']} */ ;
|
|
417
|
+
/** @type {__VLS_StyleScopedClasses['ml-2']} */ ;
|
|
397
418
|
/** @type {__VLS_StyleScopedClasses['bg-[#E60000]']} */ ;
|
|
398
419
|
/** @type {__VLS_StyleScopedClasses['text-white']} */ ;
|
|
399
420
|
/** @type {__VLS_StyleScopedClasses['text-xs']} */ ;
|
|
@@ -136,31 +136,34 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
|
|
|
136
136
|
/** @type {[typeof Avatar, ]} */ ;
|
|
137
137
|
// @ts-ignore
|
|
138
138
|
const __VLS_13 = __VLS_asFunctionalComponent(Avatar, new Avatar({
|
|
139
|
+
...{ class: "shrink-0" },
|
|
139
140
|
src: (__VLS_ctx.data?.avatar ?? ''),
|
|
140
141
|
color: (__VLS_ctx.data?.color),
|
|
141
142
|
name: (__VLS_ctx.data?.username),
|
|
142
|
-
size: (__VLS_ctx.
|
|
143
|
-
...{ class: (__VLS_ctx.
|
|
143
|
+
size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
|
|
144
|
+
...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
|
|
144
145
|
}));
|
|
145
146
|
const __VLS_14 = __VLS_13({
|
|
147
|
+
...{ class: "shrink-0" },
|
|
146
148
|
src: (__VLS_ctx.data?.avatar ?? ''),
|
|
147
149
|
color: (__VLS_ctx.data?.color),
|
|
148
150
|
name: (__VLS_ctx.data?.username),
|
|
149
|
-
size: (__VLS_ctx.
|
|
150
|
-
...{ class: (__VLS_ctx.
|
|
151
|
+
size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
|
|
152
|
+
...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
|
|
151
153
|
}, ...__VLS_functionalComponentArgsRest(__VLS_13));
|
|
152
154
|
// @ts-ignore
|
|
153
|
-
[data, data, data,
|
|
155
|
+
[data, data, data, responsive, responsive,];
|
|
154
156
|
}
|
|
155
157
|
else {
|
|
156
158
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
157
|
-
...{ class:
|
|
159
|
+
...{ class: "shrink-0" },
|
|
160
|
+
...{ class: (__VLS_ctx.responsive == 'mobile' ? 'w-8' : 'w-12') },
|
|
158
161
|
});
|
|
159
162
|
// @ts-ignore
|
|
160
|
-
[
|
|
163
|
+
[responsive,];
|
|
161
164
|
}
|
|
162
165
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
163
|
-
...{ class: "bg-[#E4E4E4D4] text-chat-haze-600 px-3 py-2 rounded-2xl max-w-xs" },
|
|
166
|
+
...{ class: "bg-[#E4E4E4D4] text-chat-haze-600 px-3 py-2 rounded-2xl max-w-xs w-[75%]" },
|
|
164
167
|
...{ class: ({
|
|
165
168
|
'rounded-tl-none': !__VLS_ctx.shouldShowAvatar(index),
|
|
166
169
|
'rounded-bl-none': !__VLS_ctx.isEndMessage(index)
|
|
@@ -192,7 +195,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
|
|
|
192
195
|
}
|
|
193
196
|
else {
|
|
194
197
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
195
|
-
...{ class: "flex flex-col items-end mt-2" },
|
|
198
|
+
...{ class: "flex flex-col items-end justify-end mt-2 pl-[60px]" },
|
|
196
199
|
...{ class: ({ 'mt-4': __VLS_ctx.shouldShowAvatar(index) }) },
|
|
197
200
|
});
|
|
198
201
|
// @ts-ignore
|
|
@@ -259,18 +262,23 @@ var __VLS_2;
|
|
|
259
262
|
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
260
263
|
/** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
|
|
261
264
|
/** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
|
|
265
|
+
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
266
|
+
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
262
267
|
/** @type {__VLS_StyleScopedClasses['bg-[#E4E4E4D4]']} */ ;
|
|
263
268
|
/** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
|
|
264
269
|
/** @type {__VLS_StyleScopedClasses['px-3']} */ ;
|
|
265
270
|
/** @type {__VLS_StyleScopedClasses['py-2']} */ ;
|
|
266
271
|
/** @type {__VLS_StyleScopedClasses['rounded-2xl']} */ ;
|
|
267
272
|
/** @type {__VLS_StyleScopedClasses['max-w-xs']} */ ;
|
|
273
|
+
/** @type {__VLS_StyleScopedClasses['w-[75%]']} */ ;
|
|
268
274
|
/** @type {__VLS_StyleScopedClasses['rounded-tl-none']} */ ;
|
|
269
275
|
/** @type {__VLS_StyleScopedClasses['rounded-bl-none']} */ ;
|
|
270
276
|
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
271
277
|
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
272
278
|
/** @type {__VLS_StyleScopedClasses['items-end']} */ ;
|
|
279
|
+
/** @type {__VLS_StyleScopedClasses['justify-end']} */ ;
|
|
273
280
|
/** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
|
|
281
|
+
/** @type {__VLS_StyleScopedClasses['pl-[60px]']} */ ;
|
|
274
282
|
/** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
|
|
275
283
|
/** @type {__VLS_StyleScopedClasses['bg-[#D0DFEC]']} */ ;
|
|
276
284
|
/** @type {__VLS_StyleScopedClasses['text-[#266699]']} */ ;
|
|
@@ -256,7 +256,7 @@ if (__VLS_ctx.listMessage?.length) {
|
|
|
256
256
|
data: (__VLS_ctx.infoUser),
|
|
257
257
|
message: (__VLS_ctx.listMessage),
|
|
258
258
|
...{ class: "grow" },
|
|
259
|
-
|
|
259
|
+
responsive: (__VLS_ctx.responsive),
|
|
260
260
|
showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
|
|
261
261
|
}));
|
|
262
262
|
const __VLS_8 = __VLS_7({
|
|
@@ -265,7 +265,7 @@ if (__VLS_ctx.listMessage?.length) {
|
|
|
265
265
|
data: (__VLS_ctx.infoUser),
|
|
266
266
|
message: (__VLS_ctx.listMessage),
|
|
267
267
|
...{ class: "grow" },
|
|
268
|
-
|
|
268
|
+
responsive: (__VLS_ctx.responsive),
|
|
269
269
|
showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
|
|
270
270
|
}, ...__VLS_functionalComponentArgsRest(__VLS_7));
|
|
271
271
|
let __VLS_10;
|
|
@@ -275,7 +275,7 @@ if (__VLS_ctx.listMessage?.length) {
|
|
|
275
275
|
/** @type {typeof __VLS_ctx.chatMessageRef} */ ;
|
|
276
276
|
var __VLS_13 = {};
|
|
277
277
|
// @ts-ignore
|
|
278
|
-
[infoUser, listMessage,
|
|
278
|
+
[infoUser, listMessage, responsive, page, pageCount, handleScrollTop, chatMessageRef,];
|
|
279
279
|
var __VLS_9;
|
|
280
280
|
}
|
|
281
281
|
else if (!__VLS_ctx.isLoading) {
|
|
@@ -47,12 +47,6 @@ __VLS_asFunctionalElement(__VLS_elements.h2, __VLS_elements.h2)({
|
|
|
47
47
|
__VLS_asFunctionalElement(__VLS_elements.img)({
|
|
48
48
|
src: "../../../assets/images/icons/new-customer.png",
|
|
49
49
|
});
|
|
50
|
-
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
51
|
-
...{ class: "text-chat-haze-400 text-sm mt-1 flex items-center gap-1" },
|
|
52
|
-
});
|
|
53
|
-
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
|
|
54
|
-
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
|
|
55
|
-
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
|
|
56
50
|
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
57
51
|
...{ class: "text-chat-haze-400 text-sm mt-3 max-w-md" },
|
|
58
52
|
});
|
|
@@ -69,12 +63,6 @@ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
|
69
63
|
/** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
|
|
70
64
|
/** @type {__VLS_StyleScopedClasses['text-chat-haze-400']} */ ;
|
|
71
65
|
/** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
|
|
72
|
-
/** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
|
|
73
|
-
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
74
|
-
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
75
|
-
/** @type {__VLS_StyleScopedClasses['gap-1']} */ ;
|
|
76
|
-
/** @type {__VLS_StyleScopedClasses['text-chat-haze-400']} */ ;
|
|
77
|
-
/** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
|
|
78
66
|
/** @type {__VLS_StyleScopedClasses['mt-3']} */ ;
|
|
79
67
|
/** @type {__VLS_StyleScopedClasses['max-w-md']} */ ;
|
|
80
68
|
const __VLS_export = (await import('vue')).defineComponent({
|
|
@@ -133,7 +133,13 @@ const fixedScroll = () => {
|
|
|
133
133
|
const newHeight = scrollEvent.value?.scrollHeight ?? 0;
|
|
134
134
|
scrollEvent.value.scrollTop += newHeight - oldScrollHeight;
|
|
135
135
|
};
|
|
136
|
-
const
|
|
136
|
+
const canScroll = () => {
|
|
137
|
+
if (!scrollEvent.value)
|
|
138
|
+
return false;
|
|
139
|
+
const canScrollY = scrollEvent.value.scrollHeight > scrollEvent.value.clientHeight;
|
|
140
|
+
return canScrollY;
|
|
141
|
+
};
|
|
142
|
+
const __VLS_exposed = { hideLoading, fixedScroll, canScroll };
|
|
137
143
|
defineExpose(__VLS_exposed);
|
|
138
144
|
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
139
145
|
const __VLS_defaults = {};
|