@phonghq/go-chat 1.0.73 → 1.0.75
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/chat/IconCalendar.vue.d.ts +14 -0
- package/dist/assets/icons/chat/IconCalendar.vue.js +42 -0
- package/dist/assets/icons/chat/IconCheck.vue.d.ts +2 -0
- package/dist/assets/icons/chat/IconCheck.vue.js +22 -0
- package/dist/assets/icons/chat/IconCopy.vue.d.ts +2 -0
- package/dist/assets/icons/chat/IconCopy.vue.js +22 -0
- package/dist/assets/icons/chat/IconInfo.vue.d.ts +2 -0
- package/dist/assets/icons/chat/IconInfo.vue.js +20 -0
- package/dist/assets/icons/chat/IconLink.vue.d.ts +14 -0
- package/dist/assets/icons/chat/IconLink.vue.js +42 -0
- package/dist/assets/icons/chat/IconMenuDot.vue.js +2 -2
- package/dist/assets/icons/chat/IconResend.vue.d.ts +2 -0
- package/dist/assets/icons/chat/IconResend.vue.js +48 -0
- package/dist/chat/App.vue.js +58 -46
- package/dist/chat/page/customer-detail/CustomerDetail.vue.js +7 -6
- package/dist/chat/page/home/ChatMessage.vue.d.ts +2 -0
- package/dist/chat/page/home/ChatMessage.vue.js +12 -6
- package/dist/chat/page/home/ChatMessageItem.vue.d.ts +2 -0
- package/dist/chat/page/home/ChatMessageItem.vue.js +145 -18
- package/dist/chat/page/home/Home.vue.d.ts +4 -1
- package/dist/chat/page/home/Home.vue.js +104 -58
- package/dist/chat/page/home/InputChat.vue.d.ts +3 -0
- package/dist/chat/page/home/InputChat.vue.js +6 -6
- package/dist/chat/page/home/header/DropdownInfo.vue.d.ts +6 -0
- package/dist/chat/page/home/header/DropdownInfo.vue.js +137 -0
- package/dist/chat/page/home/{HomeHeader.vue.d.ts → header/HomeHeader.vue.d.ts} +6 -2
- package/dist/chat/page/home/{HomeHeader.vue.js → header/HomeHeader.vue.js} +147 -86
- package/dist/components/chat/ScrollEvent/ScrollEvent.vue.js +4 -2
- package/dist/components/chat/common/popover/PopoverBase.vue.d.ts +2 -0
- package/dist/components/chat/common/popover/PopoverBase.vue.js +5 -1
- package/dist/components/ui/dropdown-menu/DropdownMenuSeparator.vue.js +2 -2
- package/dist/components/ui/popover/PopoverContent.vue.js +6 -2
- package/dist/constant/datetime.d.ts +1 -0
- package/dist/constant/datetime.js +2 -1
- package/dist/go-chat.es.js +11569 -11266
- package/dist/go-chat.umd.js +20 -20
- package/dist/plugins/axios.js +2 -2
- package/dist/style.css +1 -1
- package/dist/types/chat/global.d.ts +2 -1
- package/dist/utils/chat/chat-router.d.ts +2 -0
- package/dist/utils/chat/chat-router.js +9 -3
- package/dist/utils/chat/store/user.d.ts +1 -1
- package/dist/utils/chat/store/user.js +2 -1
- package/dist/utils/dayjs-helper.d.ts +3 -0
- package/dist/utils/dayjs-helper.js +8 -0
- package/package.json +1 -1
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
2
|
import Avatar from '../../../components/chat/customer/Avatar.vue';
|
|
3
|
-
import { computed, nextTick } from 'vue';
|
|
3
|
+
import { computed, nextTick, ref } from 'vue';
|
|
4
4
|
import { MessageState } from '../../../constant/message';
|
|
5
5
|
import IconPhoneCancel from '../../../assets/icons/call/IconPhoneCancel.vue';
|
|
6
6
|
import { PLIVO_CALL_STATUS } from '../../../types/chat/call';
|
|
7
7
|
import IconPhone from '../../../assets/icons/customer-detail/IconPhone.vue';
|
|
8
8
|
import dayjs from 'dayjs';
|
|
9
|
-
import { DATE_FORMATS
|
|
9
|
+
import { DATE_FORMATS } from '../../../constant/datetime';
|
|
10
10
|
import utc from 'dayjs/plugin/utc';
|
|
11
11
|
import timezone from 'dayjs/plugin/timezone';
|
|
12
|
-
|
|
12
|
+
import { getTimeLocal } from '../../../utils/dayjs-helper';
|
|
13
|
+
import IconMenuDot from '../../../assets/icons/chat/IconMenuDot.vue';
|
|
14
|
+
import IconResend from '../../../assets/icons/chat/IconResend.vue';
|
|
15
|
+
import IconCopy from '../../../assets/icons/chat/IconCopy.vue';
|
|
16
|
+
import PopoverBase from '../../../components/chat/common/popover/PopoverBase.vue';
|
|
17
|
+
import { userHistory } from '../../../utils/chat/store/user';
|
|
13
18
|
dayjs.extend(utc);
|
|
14
19
|
dayjs.extend(timezone);
|
|
15
20
|
const props = withDefaults(defineProps(), {});
|
|
@@ -42,6 +47,33 @@ const callTitle = computed(() => {
|
|
|
42
47
|
}
|
|
43
48
|
return '';
|
|
44
49
|
});
|
|
50
|
+
const popoverContent = computed(() => {
|
|
51
|
+
let result = [];
|
|
52
|
+
if (props.message?.is_call != 1) {
|
|
53
|
+
result.unshift({
|
|
54
|
+
icon: IconCopy,
|
|
55
|
+
title: 'Copy',
|
|
56
|
+
disabled: !userHistory.value?.appointment?.length,
|
|
57
|
+
click: () => {
|
|
58
|
+
copyToClipboard(props.message.message ?? '');
|
|
59
|
+
popoverOpen.value = false;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
if (props.isMyMessage) {
|
|
63
|
+
result.unshift({
|
|
64
|
+
icon: IconResend,
|
|
65
|
+
title: 'Resend',
|
|
66
|
+
disabled: false,
|
|
67
|
+
click: () => {
|
|
68
|
+
emit('resend');
|
|
69
|
+
popoverOpen.value = false;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
});
|
|
76
|
+
const popoverOpen = ref(false);
|
|
45
77
|
const scrollBottom = () => {
|
|
46
78
|
nextTick(() => {
|
|
47
79
|
const eleIdContentChat = document.getElementById('content-chat');
|
|
@@ -74,14 +106,23 @@ const getMessageStateText = (item) => {
|
|
|
74
106
|
}
|
|
75
107
|
};
|
|
76
108
|
const getFinishTime = (time) => {
|
|
77
|
-
|
|
78
|
-
return '';
|
|
79
|
-
return dayjs.tz(time, TIME_ZONE_UTC).local().format(DATE_FORMATS.TIME_12_FORMAT);
|
|
109
|
+
return getTimeLocal(time)?.format(DATE_FORMATS.TIME_12_FORMAT) ?? '';
|
|
80
110
|
};
|
|
81
111
|
const getStartDate = (time) => {
|
|
82
|
-
if (
|
|
83
|
-
return '';
|
|
84
|
-
|
|
112
|
+
if (getTimeLocal(time)?.date() == dayjs().date()) {
|
|
113
|
+
return 'Today';
|
|
114
|
+
}
|
|
115
|
+
return getTimeLocal(time)?.format(DATE_FORMATS['DATE_FORMAT_MEDIUM']) ?? '';
|
|
116
|
+
};
|
|
117
|
+
const copyToClipboard = async (text) => {
|
|
118
|
+
try {
|
|
119
|
+
await navigator.clipboard.writeText(text);
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
console.error('Copy failed:', error);
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
85
126
|
};
|
|
86
127
|
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
87
128
|
const __VLS_defaults = {};
|
|
@@ -112,7 +153,7 @@ if (__VLS_ctx.isStartNewDate) {
|
|
|
112
153
|
[getStartDate, message,];
|
|
113
154
|
}
|
|
114
155
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
115
|
-
...{ class: "flex items-end mt-1 relative" },
|
|
156
|
+
...{ class: "flex items-end mt-1 relative group" },
|
|
116
157
|
...{ class: ({
|
|
117
158
|
'mt-2': __VLS_ctx.shouldShowAvatar,
|
|
118
159
|
'flex-col justify-end pl-[60px]': __VLS_ctx.isMyMessage,
|
|
@@ -172,7 +213,7 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
|
|
|
172
213
|
}
|
|
173
214
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
|
|
174
215
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
175
|
-
...{ class: "px-3 py-2 rounded-2xl text-left w-max relative
|
|
216
|
+
...{ class: "px-3 py-2 rounded-2xl text-left w-max relative" },
|
|
176
217
|
...{ class: ({
|
|
177
218
|
'rounded-tl-[6px]': !__VLS_ctx.isChatStart && !__VLS_ctx.isMyMessage,
|
|
178
219
|
'rounded-bl-[6px]': !__VLS_ctx.isChatFinished && !__VLS_ctx.isMyMessage,
|
|
@@ -189,6 +230,72 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
|
|
|
189
230
|
});
|
|
190
231
|
// @ts-ignore
|
|
191
232
|
[message, message, message, message, message, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, responsive, responsive, isChatStart, isChatStart, isChatFinished, isChatFinished,];
|
|
233
|
+
if (__VLS_ctx.popoverContent.length) {
|
|
234
|
+
// @ts-ignore
|
|
235
|
+
[popoverContent,];
|
|
236
|
+
/** @type {[typeof PopoverBase, typeof PopoverBase, ]} */ ;
|
|
237
|
+
// @ts-ignore
|
|
238
|
+
const __VLS_4 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
|
|
239
|
+
open: (__VLS_ctx.popoverOpen),
|
|
240
|
+
trigger: "click",
|
|
241
|
+
side: "top",
|
|
242
|
+
align: (__VLS_ctx.isMyMessage ? 'end' : 'start'),
|
|
243
|
+
...{ class: "" },
|
|
244
|
+
triggerClass: (`absolute w-6 opacity-0 group-hover:opacity-[1] ${__VLS_ctx.isMyMessage ? '-left-6 ' : '-right-6'}`),
|
|
245
|
+
contentClass: "min-w-0 -translate-y-4 shadow-none",
|
|
246
|
+
}));
|
|
247
|
+
const __VLS_5 = __VLS_4({
|
|
248
|
+
open: (__VLS_ctx.popoverOpen),
|
|
249
|
+
trigger: "click",
|
|
250
|
+
side: "top",
|
|
251
|
+
align: (__VLS_ctx.isMyMessage ? 'end' : 'start'),
|
|
252
|
+
...{ class: "" },
|
|
253
|
+
triggerClass: (`absolute w-6 opacity-0 group-hover:opacity-[1] ${__VLS_ctx.isMyMessage ? '-left-6 ' : '-right-6'}`),
|
|
254
|
+
contentClass: "min-w-0 -translate-y-4 shadow-none",
|
|
255
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_4));
|
|
256
|
+
const { default: __VLS_7 } = __VLS_6.slots;
|
|
257
|
+
// @ts-ignore
|
|
258
|
+
[isMyMessage, isMyMessage, popoverOpen,];
|
|
259
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
260
|
+
...{ class: "" },
|
|
261
|
+
});
|
|
262
|
+
/** @type {[typeof IconMenuDot, ]} */ ;
|
|
263
|
+
// @ts-ignore
|
|
264
|
+
const __VLS_8 = __VLS_asFunctionalComponent(IconMenuDot, new IconMenuDot({}));
|
|
265
|
+
const __VLS_9 = __VLS_8({}, ...__VLS_functionalComponentArgsRest(__VLS_8));
|
|
266
|
+
{
|
|
267
|
+
const { content: __VLS_12 } = __VLS_6.slots;
|
|
268
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
269
|
+
...{ class: "flex bg-chat-primary-dark text-chat-text rounded-xl py-2" },
|
|
270
|
+
});
|
|
271
|
+
for (const [item, i] of __VLS_getVForSourceType((__VLS_ctx.popoverContent))) {
|
|
272
|
+
// @ts-ignore
|
|
273
|
+
[popoverContent,];
|
|
274
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
275
|
+
...{ onClick: (...[$event]) => {
|
|
276
|
+
if (!(__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyMessage))
|
|
277
|
+
return;
|
|
278
|
+
if (!(__VLS_ctx.popoverContent.length))
|
|
279
|
+
return;
|
|
280
|
+
item.click?.();
|
|
281
|
+
} },
|
|
282
|
+
...{ class: "flex items-center flex-col w-[70px] text-white duration-200 cursor-pointer border-r last:border-none" },
|
|
283
|
+
key: (i),
|
|
284
|
+
...{ class: ({ 'opacity-[0.3] pointer-events-none': item.disabled }) },
|
|
285
|
+
});
|
|
286
|
+
const __VLS_13 = ((item.icon));
|
|
287
|
+
// @ts-ignore
|
|
288
|
+
const __VLS_14 = __VLS_asFunctionalComponent(__VLS_13, new __VLS_13({
|
|
289
|
+
...{ class: "w-5 h-5" },
|
|
290
|
+
}));
|
|
291
|
+
const __VLS_15 = __VLS_14({
|
|
292
|
+
...{ class: "w-5 h-5" },
|
|
293
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_14));
|
|
294
|
+
(item.title);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
var __VLS_6;
|
|
298
|
+
}
|
|
192
299
|
if (__VLS_ctx.message.is_call == 1) {
|
|
193
300
|
// @ts-ignore
|
|
194
301
|
[message,];
|
|
@@ -203,26 +310,26 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
|
|
|
203
310
|
[message, PLIVO_CALL_STATUS,];
|
|
204
311
|
/** @type {[typeof IconPhone, ]} */ ;
|
|
205
312
|
// @ts-ignore
|
|
206
|
-
const
|
|
313
|
+
const __VLS_18 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({
|
|
207
314
|
weight: (2),
|
|
208
315
|
...{ class: "w-5 h-5 text-chat-success" },
|
|
209
316
|
}));
|
|
210
|
-
const
|
|
317
|
+
const __VLS_19 = __VLS_18({
|
|
211
318
|
weight: (2),
|
|
212
319
|
...{ class: "w-5 h-5 text-chat-success" },
|
|
213
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
320
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_18));
|
|
214
321
|
}
|
|
215
322
|
else {
|
|
216
323
|
/** @type {[typeof IconPhoneCancel, ]} */ ;
|
|
217
324
|
// @ts-ignore
|
|
218
|
-
const
|
|
325
|
+
const __VLS_22 = __VLS_asFunctionalComponent(IconPhoneCancel, new IconPhoneCancel({
|
|
219
326
|
weight: (2),
|
|
220
327
|
...{ class: "w-5 h-5 text-chat-error" },
|
|
221
328
|
}));
|
|
222
|
-
const
|
|
329
|
+
const __VLS_23 = __VLS_22({
|
|
223
330
|
weight: (2),
|
|
224
331
|
...{ class: "w-5 h-5 text-chat-error" },
|
|
225
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
332
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_22));
|
|
226
333
|
}
|
|
227
334
|
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
228
335
|
...{ class: "font-semibold" },
|
|
@@ -310,6 +417,8 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
|
|
|
310
417
|
}
|
|
311
418
|
}
|
|
312
419
|
/** @type {__VLS_StyleScopedClasses['']} */ ;
|
|
420
|
+
/** @type {__VLS_StyleScopedClasses['']} */ ;
|
|
421
|
+
/** @type {__VLS_StyleScopedClasses['']} */ ;
|
|
313
422
|
/** @type {__VLS_StyleScopedClasses['relative']} */ ;
|
|
314
423
|
/** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
|
|
315
424
|
/** @type {__VLS_StyleScopedClasses['text-chat-haze-200']} */ ;
|
|
@@ -329,6 +438,7 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
|
|
|
329
438
|
/** @type {__VLS_StyleScopedClasses['items-end']} */ ;
|
|
330
439
|
/** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
|
|
331
440
|
/** @type {__VLS_StyleScopedClasses['relative']} */ ;
|
|
441
|
+
/** @type {__VLS_StyleScopedClasses['group']} */ ;
|
|
332
442
|
/** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
|
|
333
443
|
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
334
444
|
/** @type {__VLS_StyleScopedClasses['justify-end']} */ ;
|
|
@@ -345,7 +455,6 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
|
|
|
345
455
|
/** @type {__VLS_StyleScopedClasses['text-left']} */ ;
|
|
346
456
|
/** @type {__VLS_StyleScopedClasses['w-max']} */ ;
|
|
347
457
|
/** @type {__VLS_StyleScopedClasses['relative']} */ ;
|
|
348
|
-
/** @type {__VLS_StyleScopedClasses['group']} */ ;
|
|
349
458
|
/** @type {__VLS_StyleScopedClasses['rounded-tl-[6px]']} */ ;
|
|
350
459
|
/** @type {__VLS_StyleScopedClasses['rounded-bl-[6px]']} */ ;
|
|
351
460
|
/** @type {__VLS_StyleScopedClasses['rounded-tr-[6px]']} */ ;
|
|
@@ -361,6 +470,24 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
|
|
|
361
470
|
/** @type {__VLS_StyleScopedClasses['max-w-[280px]']} */ ;
|
|
362
471
|
/** @type {__VLS_StyleScopedClasses['max-w-[480px]']} */ ;
|
|
363
472
|
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
473
|
+
/** @type {__VLS_StyleScopedClasses['bg-chat-primary-dark']} */ ;
|
|
474
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-text']} */ ;
|
|
475
|
+
/** @type {__VLS_StyleScopedClasses['rounded-xl']} */ ;
|
|
476
|
+
/** @type {__VLS_StyleScopedClasses['py-2']} */ ;
|
|
477
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
478
|
+
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
479
|
+
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
480
|
+
/** @type {__VLS_StyleScopedClasses['w-[70px]']} */ ;
|
|
481
|
+
/** @type {__VLS_StyleScopedClasses['text-white']} */ ;
|
|
482
|
+
/** @type {__VLS_StyleScopedClasses['duration-200']} */ ;
|
|
483
|
+
/** @type {__VLS_StyleScopedClasses['cursor-pointer']} */ ;
|
|
484
|
+
/** @type {__VLS_StyleScopedClasses['border-r']} */ ;
|
|
485
|
+
/** @type {__VLS_StyleScopedClasses['last:border-none']} */ ;
|
|
486
|
+
/** @type {__VLS_StyleScopedClasses['opacity-[0.3]']} */ ;
|
|
487
|
+
/** @type {__VLS_StyleScopedClasses['pointer-events-none']} */ ;
|
|
488
|
+
/** @type {__VLS_StyleScopedClasses['w-5']} */ ;
|
|
489
|
+
/** @type {__VLS_StyleScopedClasses['h-5']} */ ;
|
|
490
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
364
491
|
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
365
492
|
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
366
493
|
/** @type {__VLS_StyleScopedClasses['w-[210px]']} */ ;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { IResUser } from '../../../types/message';
|
|
2
|
-
import type { PAGE_RESPONSIVE } from '../../../types/chat/global';
|
|
2
|
+
import type { PAGE_RESPONSIVE, PARENT_PAGE_NAME } from '../../../types/chat/global';
|
|
3
3
|
import type { IConversation } from '../../../types/conversation';
|
|
4
4
|
type Props = {
|
|
5
5
|
receiverId: any;
|
|
6
6
|
responsive: PAGE_RESPONSIVE;
|
|
7
7
|
conversation: IConversation | null;
|
|
8
|
+
parentPageName: PARENT_PAGE_NAME;
|
|
8
9
|
};
|
|
9
10
|
declare const _default: import("vue").DefineComponent<Props, {
|
|
10
11
|
getData: (data?: any) => Promise<void>;
|
|
@@ -17,10 +18,12 @@ declare const _default: import("vue").DefineComponent<Props, {
|
|
|
17
18
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
18
19
|
call: (value: IResUser) => any;
|
|
19
20
|
back: () => any;
|
|
21
|
+
viewAppointment: (id: any) => any;
|
|
20
22
|
inputFocus: () => any;
|
|
21
23
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
22
24
|
onCall?: ((value: IResUser) => any) | undefined;
|
|
23
25
|
onBack?: (() => any) | undefined;
|
|
26
|
+
onViewAppointment?: ((id: any) => any) | undefined;
|
|
24
27
|
onInputFocus?: (() => any) | undefined;
|
|
25
28
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
29
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
-
import HomeHeader from '
|
|
2
|
+
import HomeHeader from './header/HomeHeader.vue';
|
|
3
3
|
import NewCustomer from '../../../chat/page/home/NewCustomer.vue';
|
|
4
4
|
import InputChat from '../../../chat/page/home/InputChat.vue';
|
|
5
|
-
import {
|
|
5
|
+
import { getMessage, sendMessage, upLoadImage } from '../../../utils/chat/store/message';
|
|
6
6
|
import { computed, nextTick, onMounted, onUnmounted, ref, shallowRef } from 'vue';
|
|
7
7
|
import ChatMessage from '../../../chat/page/home/ChatMessage.vue';
|
|
8
8
|
import { addHandleMqttMessage, connectMqtt, publishMessage, removeHandleMqttMessage, subscribeToTopic, unsubscribeFromTopic } from '../../../plugins/mqtt';
|
|
@@ -13,6 +13,7 @@ import { getCache, removeOldestCache, setCache } from '../../../utils/chat/cache
|
|
|
13
13
|
import { digibotId } from '../../../composable/useDigibot';
|
|
14
14
|
import dayjs from 'dayjs';
|
|
15
15
|
import { useDebounce } from '../../../utils/debounce';
|
|
16
|
+
import { getUserHistory, userHistory } from '../../../utils/chat/store/user';
|
|
16
17
|
const props = withDefaults(defineProps(), {});
|
|
17
18
|
const emit = defineEmits();
|
|
18
19
|
const MESSAGE_STORAGE_KEY = 'chat-message-';
|
|
@@ -26,6 +27,7 @@ const infoUser = shallowRef(null);
|
|
|
26
27
|
const listMessage = ref([]);
|
|
27
28
|
const chatMessageRef = ref(null);
|
|
28
29
|
const inputChatRef = ref(null);
|
|
30
|
+
const customerLoading = ref(false);
|
|
29
31
|
onMounted(() => {
|
|
30
32
|
document.addEventListener('visibilitychange', handleVisibilitychange);
|
|
31
33
|
});
|
|
@@ -134,15 +136,30 @@ const handleGetDetailReceiverQuickly = (data) => {
|
|
|
134
136
|
};
|
|
135
137
|
const handleGetDetailReceiver = async (data) => {
|
|
136
138
|
const id = props.receiverId;
|
|
137
|
-
if (data)
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
if (!data)
|
|
140
|
+
return;
|
|
141
|
+
infoUser.value = { ...data, conversation_id: data.id, id: data.receiver_id };
|
|
142
|
+
// const res = (await getDetailReceiver(props.receiverId)) ?? null
|
|
143
|
+
userHistory.value = null;
|
|
144
|
+
customerLoading.value = true;
|
|
145
|
+
handleGetUserHistoryDebounce(infoUser.value?.phone?.slice(1) ?? '');
|
|
140
146
|
if (id == props.receiverId) {
|
|
141
|
-
infoUser.value = res
|
|
147
|
+
// infoUser.value = res
|
|
142
148
|
await handleDisconnectMqtt();
|
|
143
149
|
await handleConnectMqtt();
|
|
144
150
|
}
|
|
145
151
|
};
|
|
152
|
+
const handleGetUserHistory = async (phone) => {
|
|
153
|
+
try {
|
|
154
|
+
// customerLoading.value = true
|
|
155
|
+
await getUserHistory(phone);
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
console.log(e);
|
|
159
|
+
}
|
|
160
|
+
customerLoading.value = false;
|
|
161
|
+
};
|
|
162
|
+
const handleGetUserHistoryDebounce = useDebounce((phone) => handleGetUserHistory(phone), 500);
|
|
146
163
|
const getData = async (data) => {
|
|
147
164
|
try {
|
|
148
165
|
isLoading.value = true;
|
|
@@ -192,34 +209,42 @@ const handleSendMessage = async (data) => {
|
|
|
192
209
|
formData.append('url', file_upload[0]?.url ?? '');
|
|
193
210
|
}
|
|
194
211
|
const res = await sendMessage(formData);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
212
|
+
if (res?.message?.id) {
|
|
213
|
+
publishMessage(topic_plivo_chat, {
|
|
214
|
+
...data,
|
|
215
|
+
state: MessageState.Sent,
|
|
216
|
+
attachments: file_upload
|
|
217
|
+
? [
|
|
218
|
+
{
|
|
219
|
+
file_name: data.attachments[0]?.file_name ?? '',
|
|
220
|
+
file_path: file_upload[0]?.url ?? ''
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
: [],
|
|
224
|
+
id: res?.message?.id,
|
|
225
|
+
is_sms: res?.message?.is_sms,
|
|
226
|
+
local_id: data?.id
|
|
227
|
+
});
|
|
228
|
+
updateMessageItem(data.id, {
|
|
229
|
+
state: MessageState.Sent,
|
|
230
|
+
id: res?.message?.id,
|
|
231
|
+
is_sms: res?.message?.is_sms
|
|
232
|
+
});
|
|
233
|
+
chatMessageRef.value?.scrollBottom();
|
|
234
|
+
publicTopicConversationUpdate({
|
|
235
|
+
message: data?.message ?? '',
|
|
236
|
+
isSendImg: !!file_upload?.length,
|
|
237
|
+
infoUser: infoUser.value,
|
|
238
|
+
is_known: props.conversation?.is_known ?? 0,
|
|
239
|
+
conversation_id: props.conversation?.id ?? 0
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
updateMessageItem(data.id, {
|
|
244
|
+
state: MessageState.Failed,
|
|
245
|
+
error: res?.messages ?? ''
|
|
246
|
+
});
|
|
247
|
+
}
|
|
223
248
|
}
|
|
224
249
|
catch (error) {
|
|
225
250
|
console.log(error);
|
|
@@ -264,6 +289,9 @@ const reconcileAndSortMessages = (serverMessages) => {
|
|
|
264
289
|
});
|
|
265
290
|
listMessage.value = currentMessages.sort((a, b) => dayjs(b.created_at).valueOf() - dayjs(a.created_at).valueOf());
|
|
266
291
|
};
|
|
292
|
+
const handleResent = (message) => {
|
|
293
|
+
inputChatRef.value?.handleSendMessage('message', { message: message.message ?? '' });
|
|
294
|
+
};
|
|
267
295
|
const handleGetListMqtt = useDebounce(() => handleGetMessage({ is_mqtt: true }), 5000);
|
|
268
296
|
const __VLS_exposed = { getData, handleGetMessage, infoUser, handleGetDetailReceiverQuickly };
|
|
269
297
|
defineExpose(__VLS_exposed);
|
|
@@ -289,29 +317,43 @@ if (__VLS_ctx.infoUser) {
|
|
|
289
317
|
// @ts-ignore
|
|
290
318
|
const __VLS_0 = __VLS_asFunctionalComponent(HomeHeader, new HomeHeader({
|
|
291
319
|
...{ 'onCall': {} },
|
|
320
|
+
...{ 'onViewAppointment': {} },
|
|
292
321
|
...{ 'onBack': {} },
|
|
293
322
|
...{ class: "shrink-0" },
|
|
294
323
|
data: (__VLS_ctx.infoUser),
|
|
295
324
|
responsive: (__VLS_ctx.responsive),
|
|
325
|
+
parentPageName: (__VLS_ctx.parentPageName),
|
|
326
|
+
customerLoading: (__VLS_ctx.customerLoading),
|
|
296
327
|
}));
|
|
297
328
|
const __VLS_1 = __VLS_0({
|
|
298
329
|
...{ 'onCall': {} },
|
|
330
|
+
...{ 'onViewAppointment': {} },
|
|
299
331
|
...{ 'onBack': {} },
|
|
300
332
|
...{ class: "shrink-0" },
|
|
301
333
|
data: (__VLS_ctx.infoUser),
|
|
302
334
|
responsive: (__VLS_ctx.responsive),
|
|
335
|
+
parentPageName: (__VLS_ctx.parentPageName),
|
|
336
|
+
customerLoading: (__VLS_ctx.customerLoading),
|
|
303
337
|
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
304
338
|
let __VLS_3;
|
|
305
339
|
let __VLS_4;
|
|
306
340
|
const __VLS_5 = ({ call: {} },
|
|
307
341
|
{ onCall: (__VLS_ctx.call) });
|
|
308
|
-
const __VLS_6 = ({
|
|
342
|
+
const __VLS_6 = ({ viewAppointment: {} },
|
|
343
|
+
{ onViewAppointment: (...[$event]) => {
|
|
344
|
+
if (!(__VLS_ctx.infoUser))
|
|
345
|
+
return;
|
|
346
|
+
__VLS_ctx.emit('viewAppointment', $event);
|
|
347
|
+
// @ts-ignore
|
|
348
|
+
[infoUser, responsive, parentPageName, customerLoading, call, emit,];
|
|
349
|
+
} });
|
|
350
|
+
const __VLS_7 = ({ back: {} },
|
|
309
351
|
{ onBack: (...[$event]) => {
|
|
310
352
|
if (!(__VLS_ctx.infoUser))
|
|
311
353
|
return;
|
|
312
354
|
__VLS_ctx.emit('back');
|
|
313
355
|
// @ts-ignore
|
|
314
|
-
[
|
|
356
|
+
[emit,];
|
|
315
357
|
} });
|
|
316
358
|
var __VLS_2;
|
|
317
359
|
if (__VLS_ctx.listMessage?.length) {
|
|
@@ -319,9 +361,10 @@ if (__VLS_ctx.infoUser) {
|
|
|
319
361
|
[listMessage,];
|
|
320
362
|
/** @type {[typeof ChatMessage, ]} */ ;
|
|
321
363
|
// @ts-ignore
|
|
322
|
-
const
|
|
364
|
+
const __VLS_9 = __VLS_asFunctionalComponent(ChatMessage, new ChatMessage({
|
|
323
365
|
...{ 'onScrollTop': {} },
|
|
324
366
|
...{ 'onCallBack': {} },
|
|
367
|
+
...{ 'onResend': {} },
|
|
325
368
|
ref: "chatMessageRef",
|
|
326
369
|
data: (__VLS_ctx.infoUser),
|
|
327
370
|
message: (__VLS_ctx.reversedList),
|
|
@@ -330,9 +373,10 @@ if (__VLS_ctx.infoUser) {
|
|
|
330
373
|
showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
|
|
331
374
|
isLoading: (__VLS_ctx.isLoading),
|
|
332
375
|
}));
|
|
333
|
-
const
|
|
376
|
+
const __VLS_10 = __VLS_9({
|
|
334
377
|
...{ 'onScrollTop': {} },
|
|
335
378
|
...{ 'onCallBack': {} },
|
|
379
|
+
...{ 'onResend': {} },
|
|
336
380
|
ref: "chatMessageRef",
|
|
337
381
|
data: (__VLS_ctx.infoUser),
|
|
338
382
|
message: (__VLS_ctx.reversedList),
|
|
@@ -340,34 +384,36 @@ if (__VLS_ctx.infoUser) {
|
|
|
340
384
|
responsive: (__VLS_ctx.responsive),
|
|
341
385
|
showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
|
|
342
386
|
isLoading: (__VLS_ctx.isLoading),
|
|
343
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
344
|
-
let __VLS_11;
|
|
387
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_9));
|
|
345
388
|
let __VLS_12;
|
|
346
|
-
|
|
389
|
+
let __VLS_13;
|
|
390
|
+
const __VLS_14 = ({ scrollTop: {} },
|
|
347
391
|
{ onScrollTop: (__VLS_ctx.handleScrollTop) });
|
|
348
|
-
const
|
|
392
|
+
const __VLS_15 = ({ callBack: {} },
|
|
349
393
|
{ onCallBack: (__VLS_ctx.call) });
|
|
394
|
+
const __VLS_16 = ({ resend: {} },
|
|
395
|
+
{ onResend: (__VLS_ctx.handleResent) });
|
|
350
396
|
/** @type {typeof __VLS_ctx.chatMessageRef} */ ;
|
|
351
|
-
var
|
|
397
|
+
var __VLS_17 = {};
|
|
352
398
|
// @ts-ignore
|
|
353
|
-
[infoUser, responsive, call, reversedList, page, pageCount, isLoading, handleScrollTop, chatMessageRef,];
|
|
354
|
-
var
|
|
399
|
+
[infoUser, responsive, call, reversedList, page, pageCount, isLoading, handleScrollTop, handleResent, chatMessageRef,];
|
|
400
|
+
var __VLS_11;
|
|
355
401
|
}
|
|
356
402
|
else if (!__VLS_ctx.isLoading) {
|
|
357
403
|
// @ts-ignore
|
|
358
404
|
[isLoading,];
|
|
359
405
|
/** @type {[typeof NewCustomer, ]} */ ;
|
|
360
406
|
// @ts-ignore
|
|
361
|
-
const
|
|
407
|
+
const __VLS_20 = __VLS_asFunctionalComponent(NewCustomer, new NewCustomer({
|
|
362
408
|
data: (__VLS_ctx.infoUser),
|
|
363
409
|
...{ class: "grow" },
|
|
364
410
|
isNew: (!__VLS_ctx.listMessage.length),
|
|
365
411
|
}));
|
|
366
|
-
const
|
|
412
|
+
const __VLS_21 = __VLS_20({
|
|
367
413
|
data: (__VLS_ctx.infoUser),
|
|
368
414
|
...{ class: "grow" },
|
|
369
415
|
isNew: (!__VLS_ctx.listMessage.length),
|
|
370
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
416
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_20));
|
|
371
417
|
// @ts-ignore
|
|
372
418
|
[infoUser, listMessage,];
|
|
373
419
|
}
|
|
@@ -381,7 +427,7 @@ if (__VLS_ctx.infoUser) {
|
|
|
381
427
|
[receiverId, digibotId,];
|
|
382
428
|
/** @type {[typeof InputChat, ]} */ ;
|
|
383
429
|
// @ts-ignore
|
|
384
|
-
const
|
|
430
|
+
const __VLS_24 = __VLS_asFunctionalComponent(InputChat, new InputChat({
|
|
385
431
|
...{ 'onSendMessage': {} },
|
|
386
432
|
...{ 'onFocus': {} },
|
|
387
433
|
data: (__VLS_ctx.infoUser),
|
|
@@ -390,7 +436,7 @@ if (__VLS_ctx.infoUser) {
|
|
|
390
436
|
ref: "inputChatRef",
|
|
391
437
|
...{ class: "p-2 sm:p-6" },
|
|
392
438
|
}));
|
|
393
|
-
const
|
|
439
|
+
const __VLS_25 = __VLS_24({
|
|
394
440
|
...{ 'onSendMessage': {} },
|
|
395
441
|
...{ 'onFocus': {} },
|
|
396
442
|
data: (__VLS_ctx.infoUser),
|
|
@@ -398,12 +444,12 @@ if (__VLS_ctx.infoUser) {
|
|
|
398
444
|
conversation: (__VLS_ctx.conversation),
|
|
399
445
|
ref: "inputChatRef",
|
|
400
446
|
...{ class: "p-2 sm:p-6" },
|
|
401
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
402
|
-
let
|
|
403
|
-
let
|
|
404
|
-
const
|
|
447
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_24));
|
|
448
|
+
let __VLS_27;
|
|
449
|
+
let __VLS_28;
|
|
450
|
+
const __VLS_29 = ({ sendMessage: {} },
|
|
405
451
|
{ onSendMessage: (__VLS_ctx.handleSendMessage) });
|
|
406
|
-
const
|
|
452
|
+
const __VLS_30 = ({ focus: {} },
|
|
407
453
|
{ onFocus: (...[$event]) => {
|
|
408
454
|
if (!(__VLS_ctx.infoUser))
|
|
409
455
|
return;
|
|
@@ -414,10 +460,10 @@ if (__VLS_ctx.infoUser) {
|
|
|
414
460
|
[infoUser, responsive, emit, conversation, handleSendMessage,];
|
|
415
461
|
} });
|
|
416
462
|
/** @type {typeof __VLS_ctx.inputChatRef} */ ;
|
|
417
|
-
var
|
|
463
|
+
var __VLS_31 = {};
|
|
418
464
|
// @ts-ignore
|
|
419
465
|
[inputChatRef,];
|
|
420
|
-
var
|
|
466
|
+
var __VLS_26;
|
|
421
467
|
}
|
|
422
468
|
}
|
|
423
469
|
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
@@ -431,7 +477,7 @@ if (__VLS_ctx.infoUser) {
|
|
|
431
477
|
/** @type {__VLS_StyleScopedClasses['p-2']} */ ;
|
|
432
478
|
/** @type {__VLS_StyleScopedClasses['sm:p-6']} */ ;
|
|
433
479
|
// @ts-ignore
|
|
434
|
-
var
|
|
480
|
+
var __VLS_18 = __VLS_17, __VLS_32 = __VLS_31;
|
|
435
481
|
const __VLS_export = (await import('vue')).defineComponent({
|
|
436
482
|
setup: () => (__VLS_exposed),
|
|
437
483
|
__typeEmits: {},
|
|
@@ -14,6 +14,9 @@ type __VLS_ModelProps = {
|
|
|
14
14
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
15
15
|
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
16
16
|
clearInput: () => void;
|
|
17
|
+
handleSendMessage: (type: "message" | "file", option?: {
|
|
18
|
+
message?: string | undefined;
|
|
19
|
+
} | undefined) => Promise<void>;
|
|
17
20
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
21
|
"update:modelValue": (value: string | undefined) => any;
|
|
19
22
|
} & {
|
|
@@ -35,9 +35,9 @@ const removeDropFile = () => {
|
|
|
35
35
|
dropFileLink.value = '';
|
|
36
36
|
dropFile.value = null;
|
|
37
37
|
};
|
|
38
|
-
const handleSendMessage = async (type) => {
|
|
38
|
+
const handleSendMessage = async (type, option) => {
|
|
39
39
|
const tempId = Date.now();
|
|
40
|
-
let messageContent =
|
|
40
|
+
let messageContent = option?.message ?? keyword.value;
|
|
41
41
|
let attachments = [];
|
|
42
42
|
if (dropFile.value) {
|
|
43
43
|
attachments = [
|
|
@@ -45,10 +45,10 @@ const handleSendMessage = async (type) => {
|
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
47
|
else if (type == 'message') {
|
|
48
|
-
if (!
|
|
48
|
+
if (!messageContent)
|
|
49
49
|
return;
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if (!option?.message)
|
|
51
|
+
keyword.value = '';
|
|
52
52
|
setInputHeight(chatInputRef.value);
|
|
53
53
|
}
|
|
54
54
|
else if (type == 'file') {
|
|
@@ -115,7 +115,7 @@ const clearInput = () => {
|
|
|
115
115
|
removeDropFile();
|
|
116
116
|
};
|
|
117
117
|
const newline = () => { };
|
|
118
|
-
const __VLS_exposed = { clearInput };
|
|
118
|
+
const __VLS_exposed = { clearInput, handleSendMessage };
|
|
119
119
|
defineExpose(__VLS_exposed);
|
|
120
120
|
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
121
121
|
const __VLS_modelEmit = defineEmits();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PAGE } from '../../../../constant/general';
|
|
2
|
+
type Props = {
|
|
3
|
+
goToPage: (page: PAGE) => void;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
export default _default;
|