@phonghq/go-chat 1.0.22 → 1.0.24
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/README.md +1 -1
- package/dist/assets/icons/IconSetting.vue.d.ts +2 -0
- package/dist/chat/App.vue.d.ts +2 -0
- package/dist/chat/page/home/ChatList.vue.d.ts +1 -1
- package/dist/chat/page/home/ChatMessageItem.vue.d.ts +11 -0
- package/dist/chat/page/home/Home.vue.d.ts +3 -0
- package/dist/components/chat/call/Calling.vue.d.ts +2 -0
- package/dist/components/chat/common/switch/SwitchBase.vue.d.ts +14 -0
- package/dist/components/chat/common/tab/TabBase.vue.d.ts +30 -0
- package/dist/composable/useListConversations.d.ts +46 -0
- package/dist/constant/color.d.ts +2 -2
- package/dist/go-chat.es.js +28483 -28311
- package/dist/go-chat.umd.js +13 -13
- package/dist/style.css +1 -1
- package/dist/test/assets/icons/IconSetting.vue.js +33 -0
- package/dist/test/chat/App.vue.js +105 -77
- package/dist/test/chat/page/home/ChatList.vue.js +226 -124
- package/dist/test/chat/page/home/ChatMessage.vue.js +19 -164
- package/dist/test/chat/page/home/ChatMessageItem.vue.js +321 -0
- package/dist/test/chat/page/home/Home.vue.js +14 -8
- package/dist/test/chat/page/home/HomeHeader.vue.js +18 -12
- package/dist/test/chat/page/home/InputChat.vue.js +62 -33
- package/dist/test/components/chat/call/Calling.vue.js +19 -22
- package/dist/test/components/chat/common/switch/SwitchBase.vue.js +70 -0
- package/dist/test/components/chat/common/tab/TabBase.vue.js +85 -0
- package/dist/test/components/chat/select/SelectBase.vue.js +15 -17
- package/dist/test/composable/useInitData.js +7 -4
- package/dist/test/composable/useListConversations.js +122 -0
- package/dist/test/composable/usePlivo.js +9 -3
- package/dist/test/constant/color.js +4 -2
- package/dist/test/types/chat/call.js +2 -1
- package/dist/test/utils/chat/auth.js +14 -0
- package/dist/test/utils/chat/phone-string.js +1 -1
- package/dist/types/chat/auth.d.ts +2 -0
- package/dist/types/chat/call.d.ts +1 -0
- package/dist/types/chat/global.d.ts +2 -1
- package/dist/types/conversation.d.ts +1 -0
- package/dist/types/message.d.ts +5 -0
- package/dist/utils/chat/auth.d.ts +5 -0
- package/dist/utils/chat/phone-string.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
-
import Avatar from '../../../components/chat/customer/Avatar.vue';
|
|
3
|
-
import { dataProfile } from '../../../utils/chat/auth';
|
|
4
2
|
import { nextTick, ref } from 'vue';
|
|
5
3
|
import ScrollEvent from '../../../components/chat/ScrollEvent/ScrollEvent.vue';
|
|
6
4
|
import { MessageState } from '../../../constant/message';
|
|
7
5
|
import NewCustomer from '../../../chat/page/home/NewCustomer.vue';
|
|
6
|
+
import ChatMessageItem from '../../../chat/page/home/ChatMessageItem.vue';
|
|
8
7
|
const props = withDefaults(defineProps(), {});
|
|
9
8
|
const emit = defineEmits();
|
|
10
9
|
const scrollEventRef = ref(null);
|
|
@@ -120,132 +119,24 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
|
|
|
120
119
|
(item.id);
|
|
121
120
|
// @ts-ignore
|
|
122
121
|
[message,];
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
...{ class: "shrink-0" },
|
|
142
|
-
src: (__VLS_ctx.data?.avatar ?? ''),
|
|
143
|
-
color: (__VLS_ctx.data?.color),
|
|
144
|
-
name: (__VLS_ctx.data?.username),
|
|
145
|
-
size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
|
|
146
|
-
...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
|
|
147
|
-
}));
|
|
148
|
-
const __VLS_14 = __VLS_13({
|
|
149
|
-
...{ class: "shrink-0" },
|
|
150
|
-
src: (__VLS_ctx.data?.avatar ?? ''),
|
|
151
|
-
color: (__VLS_ctx.data?.color),
|
|
152
|
-
name: (__VLS_ctx.data?.username),
|
|
153
|
-
size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
|
|
154
|
-
...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
|
|
155
|
-
}, ...__VLS_functionalComponentArgsRest(__VLS_13));
|
|
156
|
-
// @ts-ignore
|
|
157
|
-
[data, data, data, responsive, responsive,];
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
161
|
-
...{ class: "shrink-0" },
|
|
162
|
-
...{ class: (__VLS_ctx.responsive == 'mobile' ? 'w-8' : 'w-12') },
|
|
163
|
-
});
|
|
164
|
-
// @ts-ignore
|
|
165
|
-
[responsive,];
|
|
166
|
-
}
|
|
167
|
-
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
168
|
-
...{ class: "bg-[#E4E4E4D4] text-left text-chat-haze-600 px-3 py-2 rounded-2xl max-w-xs w-max" },
|
|
169
|
-
...{ class: ({
|
|
170
|
-
'rounded-tl-none': !__VLS_ctx.shouldShowAvatar(index),
|
|
171
|
-
'rounded-bl-none': !__VLS_ctx.isEndMessage(index)
|
|
172
|
-
}) },
|
|
173
|
-
});
|
|
174
|
-
// @ts-ignore
|
|
175
|
-
[shouldShowAvatar, isEndMessage,];
|
|
176
|
-
if (item.message) {
|
|
177
|
-
__VLS_asFunctionalElement(__VLS_elements.div)({
|
|
178
|
-
...{ style: ({ wordBreak: 'break-word' }) },
|
|
179
|
-
});
|
|
180
|
-
__VLS_asFunctionalDirective(__VLS_directives.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (item.message) }, null, null);
|
|
181
|
-
}
|
|
182
|
-
else if (item.attachments.length) {
|
|
183
|
-
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
|
|
184
|
-
__VLS_asFunctionalElement(__VLS_elements.img)({
|
|
185
|
-
...{ onLoad: (() => {
|
|
186
|
-
if (index == __VLS_ctx.message.length - 1) {
|
|
187
|
-
__VLS_ctx.scrollBottom();
|
|
188
|
-
}
|
|
189
|
-
}) },
|
|
190
|
-
src: (item.attachments[0]?.file_path),
|
|
191
|
-
alt: "avatar",
|
|
192
|
-
});
|
|
193
|
-
// @ts-ignore
|
|
194
|
-
[message, scrollBottom,];
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
200
|
-
...{ class: "flex flex-col items-end justify-end mt-2 pl-[60px]" },
|
|
201
|
-
...{ class: ({ 'mt-4': __VLS_ctx.shouldShowAvatar(index) }) },
|
|
202
|
-
});
|
|
203
|
-
// @ts-ignore
|
|
204
|
-
[shouldShowAvatar,];
|
|
205
|
-
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
206
|
-
...{ class: "bg-[#D0DFEC] text-[#266699] px-3 py-2 rounded-2xl max-w-xs" },
|
|
207
|
-
...{ class: ({
|
|
208
|
-
'rounded-tr-none': !__VLS_ctx.shouldShowAvatar(index),
|
|
209
|
-
'rounded-br-none': !__VLS_ctx.isEndMessage(index)
|
|
210
|
-
}) },
|
|
211
|
-
});
|
|
212
|
-
// @ts-ignore
|
|
213
|
-
[shouldShowAvatar, isEndMessage,];
|
|
214
|
-
if (item.message) {
|
|
215
|
-
__VLS_asFunctionalElement(__VLS_elements.div)({
|
|
216
|
-
...{ style: ({ wordBreak: 'break-word' }) },
|
|
217
|
-
});
|
|
218
|
-
__VLS_asFunctionalDirective(__VLS_directives.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (item.message) }, null, null);
|
|
219
|
-
}
|
|
220
|
-
else if (item?.attachments?.length) {
|
|
221
|
-
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
|
|
222
|
-
__VLS_asFunctionalElement(__VLS_elements.img)({
|
|
223
|
-
...{ onLoad: (() => {
|
|
224
|
-
if (index == __VLS_ctx.message.length - 1) {
|
|
225
|
-
__VLS_ctx.scrollBottom();
|
|
226
|
-
}
|
|
227
|
-
}) },
|
|
228
|
-
src: (item.attachments[0]?.file_path),
|
|
229
|
-
alt: "avatar",
|
|
230
|
-
});
|
|
231
|
-
// @ts-ignore
|
|
232
|
-
[message, scrollBottom,];
|
|
233
|
-
}
|
|
234
|
-
if ((index == __VLS_ctx.message.length - 1 && __VLS_ctx.getMessageStateText(item)) ||
|
|
235
|
-
item.state == __VLS_ctx.MessageState.Failed) {
|
|
236
|
-
// @ts-ignore
|
|
237
|
-
[message, MessageState, getMessageStateText,];
|
|
238
|
-
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
|
|
239
|
-
...{ class: "text-chat-haze-200 text-xs mt-1" },
|
|
240
|
-
...{ class: ({ '!text-chat-error': item.state == __VLS_ctx.MessageState.Failed }) },
|
|
241
|
-
});
|
|
242
|
-
// @ts-ignore
|
|
243
|
-
[MessageState,];
|
|
244
|
-
(__VLS_ctx.getMessageStateText(item));
|
|
245
|
-
// @ts-ignore
|
|
246
|
-
[getMessageStateText,];
|
|
247
|
-
}
|
|
248
|
-
}
|
|
122
|
+
/** @type {[typeof ChatMessageItem, ]} */ ;
|
|
123
|
+
// @ts-ignore
|
|
124
|
+
const __VLS_13 = __VLS_asFunctionalComponent(ChatMessageItem, new ChatMessageItem({
|
|
125
|
+
message: (item),
|
|
126
|
+
index: (index),
|
|
127
|
+
listMessage: (__VLS_ctx.message),
|
|
128
|
+
responsive: (__VLS_ctx.responsive),
|
|
129
|
+
data: (__VLS_ctx.data),
|
|
130
|
+
}));
|
|
131
|
+
const __VLS_14 = __VLS_13({
|
|
132
|
+
message: (item),
|
|
133
|
+
index: (index),
|
|
134
|
+
listMessage: (__VLS_ctx.message),
|
|
135
|
+
responsive: (__VLS_ctx.responsive),
|
|
136
|
+
data: (__VLS_ctx.data),
|
|
137
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_13));
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
[data, message, responsive,];
|
|
249
140
|
}
|
|
250
141
|
var __VLS_2;
|
|
251
142
|
/** @type {__VLS_StyleScopedClasses['relative']} */ ;
|
|
@@ -259,42 +150,6 @@ var __VLS_2;
|
|
|
259
150
|
/** @type {__VLS_StyleScopedClasses['h-[500px]']} */ ;
|
|
260
151
|
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
261
152
|
/** @type {__VLS_StyleScopedClasses['chat-padding-page']} */ ;
|
|
262
|
-
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
263
|
-
/** @type {__VLS_StyleScopedClasses['items-end']} */ ;
|
|
264
|
-
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
265
|
-
/** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
|
|
266
|
-
/** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
|
|
267
|
-
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
268
|
-
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
269
|
-
/** @type {__VLS_StyleScopedClasses['bg-[#E4E4E4D4]']} */ ;
|
|
270
|
-
/** @type {__VLS_StyleScopedClasses['text-left']} */ ;
|
|
271
|
-
/** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
|
|
272
|
-
/** @type {__VLS_StyleScopedClasses['px-3']} */ ;
|
|
273
|
-
/** @type {__VLS_StyleScopedClasses['py-2']} */ ;
|
|
274
|
-
/** @type {__VLS_StyleScopedClasses['rounded-2xl']} */ ;
|
|
275
|
-
/** @type {__VLS_StyleScopedClasses['max-w-xs']} */ ;
|
|
276
|
-
/** @type {__VLS_StyleScopedClasses['w-max']} */ ;
|
|
277
|
-
/** @type {__VLS_StyleScopedClasses['rounded-tl-none']} */ ;
|
|
278
|
-
/** @type {__VLS_StyleScopedClasses['rounded-bl-none']} */ ;
|
|
279
|
-
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
280
|
-
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
281
|
-
/** @type {__VLS_StyleScopedClasses['items-end']} */ ;
|
|
282
|
-
/** @type {__VLS_StyleScopedClasses['justify-end']} */ ;
|
|
283
|
-
/** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
|
|
284
|
-
/** @type {__VLS_StyleScopedClasses['pl-[60px]']} */ ;
|
|
285
|
-
/** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
|
|
286
|
-
/** @type {__VLS_StyleScopedClasses['bg-[#D0DFEC]']} */ ;
|
|
287
|
-
/** @type {__VLS_StyleScopedClasses['text-[#266699]']} */ ;
|
|
288
|
-
/** @type {__VLS_StyleScopedClasses['px-3']} */ ;
|
|
289
|
-
/** @type {__VLS_StyleScopedClasses['py-2']} */ ;
|
|
290
|
-
/** @type {__VLS_StyleScopedClasses['rounded-2xl']} */ ;
|
|
291
|
-
/** @type {__VLS_StyleScopedClasses['max-w-xs']} */ ;
|
|
292
|
-
/** @type {__VLS_StyleScopedClasses['rounded-tr-none']} */ ;
|
|
293
|
-
/** @type {__VLS_StyleScopedClasses['rounded-br-none']} */ ;
|
|
294
|
-
/** @type {__VLS_StyleScopedClasses['text-chat-haze-200']} */ ;
|
|
295
|
-
/** @type {__VLS_StyleScopedClasses['text-xs']} */ ;
|
|
296
|
-
/** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
|
|
297
|
-
/** @type {__VLS_StyleScopedClasses['!text-chat-error']} */ ;
|
|
298
153
|
// @ts-ignore
|
|
299
154
|
var __VLS_7 = __VLS_6;
|
|
300
155
|
const __VLS_export = (await import('vue')).defineComponent({
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import Avatar from '../../../components/chat/customer/Avatar.vue';
|
|
3
|
+
import { dataProfile } from '../../../utils/chat/auth';
|
|
4
|
+
import { computed, nextTick } from 'vue';
|
|
5
|
+
import { MessageState } from '../../../constant/message';
|
|
6
|
+
import IconPhoneCancel from '../../../assets/icons/call/IconPhoneCancel.vue';
|
|
7
|
+
import { PLIVO_CALL_STATUS } from '../../../types/chat/call';
|
|
8
|
+
import IconPhone from '../../../assets/icons/customer-detail/IconPhone.vue';
|
|
9
|
+
const props = withDefaults(defineProps(), {});
|
|
10
|
+
const isMyMessage = computed(() => props.message.sender_id == dataProfile.value?.id);
|
|
11
|
+
const callTitle = computed(() => {
|
|
12
|
+
if (isMyMessage.value) {
|
|
13
|
+
if (props.message?.call_status == PLIVO_CALL_STATUS.CONNECT_FAILED) {
|
|
14
|
+
return 'Call canceled';
|
|
15
|
+
}
|
|
16
|
+
else if (props.message?.call_status == PLIVO_CALL_STATUS.CALL_END) {
|
|
17
|
+
return 'Outgoing audio call';
|
|
18
|
+
}
|
|
19
|
+
else if (props.message?.call_status == PLIVO_CALL_STATUS.CANCEL) {
|
|
20
|
+
return 'Call canceled';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
if (props.message?.call_status == PLIVO_CALL_STATUS.CONNECT_FAILED) {
|
|
25
|
+
return 'Call missed';
|
|
26
|
+
}
|
|
27
|
+
else if (props.message?.call_status == PLIVO_CALL_STATUS.CALL_END) {
|
|
28
|
+
return 'Incomming audio call';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return '';
|
|
32
|
+
});
|
|
33
|
+
const scrollBottom = () => {
|
|
34
|
+
nextTick(() => {
|
|
35
|
+
const eleIdContentChat = document.getElementById('content-chat');
|
|
36
|
+
if (eleIdContentChat) {
|
|
37
|
+
eleIdContentChat.scrollTop = eleIdContentChat.scrollHeight;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const getCallDuration = (seconds) => {
|
|
42
|
+
const min = Math.floor(seconds / 60);
|
|
43
|
+
const secs = seconds % 60;
|
|
44
|
+
return `${min} min${min > 1 ? 's' : ''} ${secs} sec`;
|
|
45
|
+
};
|
|
46
|
+
const shouldShowAvatar = (index) => {
|
|
47
|
+
if (index === 0)
|
|
48
|
+
return true;
|
|
49
|
+
return props.listMessage[index - 1].sender_id !== props.listMessage[index].sender_id;
|
|
50
|
+
};
|
|
51
|
+
const isEndMessage = (index) => {
|
|
52
|
+
if (props.listMessage?.length == index + 1)
|
|
53
|
+
return true;
|
|
54
|
+
return props.listMessage[index + 1].sender_id !== props.listMessage[index].sender_id;
|
|
55
|
+
};
|
|
56
|
+
const getMessageStateText = (item) => {
|
|
57
|
+
const state = item.state;
|
|
58
|
+
switch (state) {
|
|
59
|
+
case MessageState.Sending:
|
|
60
|
+
return 'Sending...';
|
|
61
|
+
case MessageState.Uploading:
|
|
62
|
+
return 'Uploading...';
|
|
63
|
+
case MessageState.Sent:
|
|
64
|
+
return '';
|
|
65
|
+
case MessageState.Read:
|
|
66
|
+
return 'Seen';
|
|
67
|
+
case MessageState.Failed:
|
|
68
|
+
return item.error || 'Message failed';
|
|
69
|
+
default:
|
|
70
|
+
return '';
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
74
|
+
const __VLS_defaults = {};
|
|
75
|
+
const __VLS_ctx = {
|
|
76
|
+
...{},
|
|
77
|
+
...{},
|
|
78
|
+
...{},
|
|
79
|
+
...{},
|
|
80
|
+
};
|
|
81
|
+
let __VLS_elements;
|
|
82
|
+
let __VLS_components;
|
|
83
|
+
let __VLS_directives;
|
|
84
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
85
|
+
...{ class: "flex items-end mt-2" },
|
|
86
|
+
...{ class: ({
|
|
87
|
+
'mt-4': __VLS_ctx.shouldShowAvatar(__VLS_ctx.index),
|
|
88
|
+
'flex-col justify-end pl-[60px]': __VLS_ctx.isMyMessage,
|
|
89
|
+
'gap-2': !__VLS_ctx.isMyMessage
|
|
90
|
+
}) },
|
|
91
|
+
});
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
[shouldShowAvatar, index, isMyMessage, isMyMessage,];
|
|
94
|
+
if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending) {
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
[message, MessageState,];
|
|
97
|
+
if (!__VLS_ctx.isMyMessage) {
|
|
98
|
+
// @ts-ignore
|
|
99
|
+
[isMyMessage,];
|
|
100
|
+
if (__VLS_ctx.shouldShowAvatar(__VLS_ctx.index)) {
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
[shouldShowAvatar, index,];
|
|
103
|
+
/** @type {[typeof Avatar, ]} */ ;
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
const __VLS_0 = __VLS_asFunctionalComponent(Avatar, new Avatar({
|
|
106
|
+
...{ class: "shrink-0" },
|
|
107
|
+
src: (__VLS_ctx.data?.avatar ?? ''),
|
|
108
|
+
color: (__VLS_ctx.data?.color),
|
|
109
|
+
name: (__VLS_ctx.data?.username),
|
|
110
|
+
size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
|
|
111
|
+
...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
|
|
112
|
+
}));
|
|
113
|
+
const __VLS_1 = __VLS_0({
|
|
114
|
+
...{ class: "shrink-0" },
|
|
115
|
+
src: (__VLS_ctx.data?.avatar ?? ''),
|
|
116
|
+
color: (__VLS_ctx.data?.color),
|
|
117
|
+
name: (__VLS_ctx.data?.username),
|
|
118
|
+
size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
|
|
119
|
+
...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
|
|
120
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
[data, data, data, responsive, responsive,];
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
126
|
+
...{ class: "shrink-0" },
|
|
127
|
+
...{ class: (__VLS_ctx.responsive == 'mobile' ? 'w-8' : 'w-12') },
|
|
128
|
+
});
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
[responsive,];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
134
|
+
...{ class: "px-3 py-2 rounded-2xl max-w-xs" },
|
|
135
|
+
...{ class: ({
|
|
136
|
+
'rounded-tl-none': !__VLS_ctx.shouldShowAvatar(__VLS_ctx.index) && !__VLS_ctx.isMyMessage,
|
|
137
|
+
'rounded-bl-none': !__VLS_ctx.isEndMessage(__VLS_ctx.index) && !__VLS_ctx.isMyMessage,
|
|
138
|
+
'rounded-tr-none': !__VLS_ctx.shouldShowAvatar(__VLS_ctx.index) && __VLS_ctx.isMyMessage,
|
|
139
|
+
'rounded-br-none': !__VLS_ctx.isEndMessage(__VLS_ctx.index) && __VLS_ctx.isMyMessage,
|
|
140
|
+
'!text-[#14532D] !bg-[#d4f8d4]': __VLS_ctx.message.message_uuid && !__VLS_ctx.message.is_call,
|
|
141
|
+
'bg-[#D0DFEC] text-[#266699]': __VLS_ctx.isMyMessage,
|
|
142
|
+
'bg-[#E4E4E4D4] text-chat-haze-600 text-left w-max ': !__VLS_ctx.isMyMessage
|
|
143
|
+
}) },
|
|
144
|
+
});
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
[shouldShowAvatar, shouldShowAvatar, index, index, index, index, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, message, message, isEndMessage, isEndMessage,];
|
|
147
|
+
if (__VLS_ctx.message.is_call == 1) {
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
[message,];
|
|
150
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
151
|
+
...{ class: "flex flex-col gap-2 w-[200px]" },
|
|
152
|
+
});
|
|
153
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
154
|
+
...{ class: "font-medium " },
|
|
155
|
+
...{ class: ({ 'text-chat-error': __VLS_ctx.message.call_status !== __VLS_ctx.PLIVO_CALL_STATUS.CALL_END }) },
|
|
156
|
+
});
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
[message, PLIVO_CALL_STATUS,];
|
|
159
|
+
(__VLS_ctx.callTitle);
|
|
160
|
+
// @ts-ignore
|
|
161
|
+
[callTitle,];
|
|
162
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
163
|
+
...{ class: "flex items-center gap-2 shrink-0" },
|
|
164
|
+
});
|
|
165
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
166
|
+
...{ class: "overflow-hidden w-8 h-8 rounded-full text-white" },
|
|
167
|
+
});
|
|
168
|
+
if (__VLS_ctx.message.call_status == __VLS_ctx.PLIVO_CALL_STATUS.CALL_END) {
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
[message, PLIVO_CALL_STATUS,];
|
|
171
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
172
|
+
...{ class: "bg-chat-success flex-center w-full h-full" },
|
|
173
|
+
});
|
|
174
|
+
/** @type {[typeof IconPhone, ]} */ ;
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
const __VLS_4 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({
|
|
177
|
+
...{ class: "w-5 h-5" },
|
|
178
|
+
}));
|
|
179
|
+
const __VLS_5 = __VLS_4({
|
|
180
|
+
...{ class: "w-5 h-5" },
|
|
181
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_4));
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
185
|
+
...{ class: "bg-chat-error flex-center w-full h-full" },
|
|
186
|
+
});
|
|
187
|
+
/** @type {[typeof IconPhoneCancel, ]} */ ;
|
|
188
|
+
// @ts-ignore
|
|
189
|
+
const __VLS_8 = __VLS_asFunctionalComponent(IconPhoneCancel, new IconPhoneCancel({
|
|
190
|
+
...{ class: "w-5 h-5" },
|
|
191
|
+
}));
|
|
192
|
+
const __VLS_9 = __VLS_8({
|
|
193
|
+
...{ class: "w-5 h-5" },
|
|
194
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_8));
|
|
195
|
+
}
|
|
196
|
+
(__VLS_ctx.getCallDuration(__VLS_ctx.message?.duration ?? 0));
|
|
197
|
+
// @ts-ignore
|
|
198
|
+
[message, getCallDuration,];
|
|
199
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
200
|
+
...{ class: "text-sm text-red-600 mt-1" },
|
|
201
|
+
});
|
|
202
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
203
|
+
...{ class: "flex-center h-10 rounded-xl bg-chat-haze-200 font-semibold" },
|
|
204
|
+
});
|
|
205
|
+
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({});
|
|
206
|
+
}
|
|
207
|
+
else if (__VLS_ctx.message.message) {
|
|
208
|
+
// @ts-ignore
|
|
209
|
+
[message,];
|
|
210
|
+
__VLS_asFunctionalElement(__VLS_elements.div)({
|
|
211
|
+
...{ style: ({ wordBreak: 'break-word' }) },
|
|
212
|
+
});
|
|
213
|
+
__VLS_asFunctionalDirective(__VLS_directives.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.message.message) }, null, null);
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
[message,];
|
|
216
|
+
}
|
|
217
|
+
else if (__VLS_ctx.message.attachments.length) {
|
|
218
|
+
// @ts-ignore
|
|
219
|
+
[message,];
|
|
220
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
|
|
221
|
+
__VLS_asFunctionalElement(__VLS_elements.img)({
|
|
222
|
+
...{ onLoad: (() => {
|
|
223
|
+
if (__VLS_ctx.index == __VLS_ctx.listMessage.length - 1) {
|
|
224
|
+
__VLS_ctx.scrollBottom();
|
|
225
|
+
}
|
|
226
|
+
}) },
|
|
227
|
+
src: (__VLS_ctx.message.attachments[0]?.file_path),
|
|
228
|
+
alt: "avatar",
|
|
229
|
+
});
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
[index, message, listMessage, scrollBottom,];
|
|
232
|
+
}
|
|
233
|
+
if (__VLS_ctx.isMyMessage) {
|
|
234
|
+
// @ts-ignore
|
|
235
|
+
[isMyMessage,];
|
|
236
|
+
if ((__VLS_ctx.index == __VLS_ctx.listMessage.length - 1 && __VLS_ctx.getMessageStateText(__VLS_ctx.message)) ||
|
|
237
|
+
__VLS_ctx.message.state == __VLS_ctx.MessageState.Failed) {
|
|
238
|
+
// @ts-ignore
|
|
239
|
+
[index, message, message, MessageState, listMessage, getMessageStateText,];
|
|
240
|
+
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
|
|
241
|
+
...{ class: "text-chat-haze-200 text-xs mt-1" },
|
|
242
|
+
...{ class: ({ '!text-chat-error': __VLS_ctx.message.state == __VLS_ctx.MessageState.Failed }) },
|
|
243
|
+
});
|
|
244
|
+
// @ts-ignore
|
|
245
|
+
[message, MessageState,];
|
|
246
|
+
(__VLS_ctx.getMessageStateText(__VLS_ctx.message));
|
|
247
|
+
// @ts-ignore
|
|
248
|
+
[message, getMessageStateText,];
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
253
|
+
/** @type {__VLS_StyleScopedClasses['items-end']} */ ;
|
|
254
|
+
/** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
|
|
255
|
+
/** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
|
|
256
|
+
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
257
|
+
/** @type {__VLS_StyleScopedClasses['justify-end']} */ ;
|
|
258
|
+
/** @type {__VLS_StyleScopedClasses['pl-[60px]']} */ ;
|
|
259
|
+
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
260
|
+
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
261
|
+
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
262
|
+
/** @type {__VLS_StyleScopedClasses['px-3']} */ ;
|
|
263
|
+
/** @type {__VLS_StyleScopedClasses['py-2']} */ ;
|
|
264
|
+
/** @type {__VLS_StyleScopedClasses['rounded-2xl']} */ ;
|
|
265
|
+
/** @type {__VLS_StyleScopedClasses['max-w-xs']} */ ;
|
|
266
|
+
/** @type {__VLS_StyleScopedClasses['rounded-tl-none']} */ ;
|
|
267
|
+
/** @type {__VLS_StyleScopedClasses['rounded-bl-none']} */ ;
|
|
268
|
+
/** @type {__VLS_StyleScopedClasses['rounded-tr-none']} */ ;
|
|
269
|
+
/** @type {__VLS_StyleScopedClasses['rounded-br-none']} */ ;
|
|
270
|
+
/** @type {__VLS_StyleScopedClasses['!text-[#14532D]']} */ ;
|
|
271
|
+
/** @type {__VLS_StyleScopedClasses['!bg-[#d4f8d4]']} */ ;
|
|
272
|
+
/** @type {__VLS_StyleScopedClasses['bg-[#D0DFEC]']} */ ;
|
|
273
|
+
/** @type {__VLS_StyleScopedClasses['text-[#266699]']} */ ;
|
|
274
|
+
/** @type {__VLS_StyleScopedClasses['bg-[#E4E4E4D4]']} */ ;
|
|
275
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
|
|
276
|
+
/** @type {__VLS_StyleScopedClasses['text-left']} */ ;
|
|
277
|
+
/** @type {__VLS_StyleScopedClasses['w-max']} */ ;
|
|
278
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
279
|
+
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
280
|
+
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
281
|
+
/** @type {__VLS_StyleScopedClasses['w-[200px]']} */ ;
|
|
282
|
+
/** @type {__VLS_StyleScopedClasses['font-medium']} */ ;
|
|
283
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-error']} */ ;
|
|
284
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
285
|
+
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
286
|
+
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
287
|
+
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
288
|
+
/** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
|
|
289
|
+
/** @type {__VLS_StyleScopedClasses['w-8']} */ ;
|
|
290
|
+
/** @type {__VLS_StyleScopedClasses['h-8']} */ ;
|
|
291
|
+
/** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
|
|
292
|
+
/** @type {__VLS_StyleScopedClasses['text-white']} */ ;
|
|
293
|
+
/** @type {__VLS_StyleScopedClasses['bg-chat-success']} */ ;
|
|
294
|
+
/** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
|
|
295
|
+
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
296
|
+
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
297
|
+
/** @type {__VLS_StyleScopedClasses['w-5']} */ ;
|
|
298
|
+
/** @type {__VLS_StyleScopedClasses['h-5']} */ ;
|
|
299
|
+
/** @type {__VLS_StyleScopedClasses['bg-chat-error']} */ ;
|
|
300
|
+
/** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
|
|
301
|
+
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
302
|
+
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
303
|
+
/** @type {__VLS_StyleScopedClasses['w-5']} */ ;
|
|
304
|
+
/** @type {__VLS_StyleScopedClasses['h-5']} */ ;
|
|
305
|
+
/** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
|
|
306
|
+
/** @type {__VLS_StyleScopedClasses['text-red-600']} */ ;
|
|
307
|
+
/** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
|
|
308
|
+
/** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
|
|
309
|
+
/** @type {__VLS_StyleScopedClasses['h-10']} */ ;
|
|
310
|
+
/** @type {__VLS_StyleScopedClasses['rounded-xl']} */ ;
|
|
311
|
+
/** @type {__VLS_StyleScopedClasses['bg-chat-haze-200']} */ ;
|
|
312
|
+
/** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
|
|
313
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-haze-200']} */ ;
|
|
314
|
+
/** @type {__VLS_StyleScopedClasses['text-xs']} */ ;
|
|
315
|
+
/** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
|
|
316
|
+
/** @type {__VLS_StyleScopedClasses['!text-chat-error']} */ ;
|
|
317
|
+
const __VLS_export = (await import('vue')).defineComponent({
|
|
318
|
+
__typeProps: {},
|
|
319
|
+
props: {},
|
|
320
|
+
});
|
|
321
|
+
export default {};
|
|
@@ -20,8 +20,7 @@ const isLoading = ref(false);
|
|
|
20
20
|
const infoUser = shallowRef(null);
|
|
21
21
|
const listMessage = ref([]);
|
|
22
22
|
const chatMessageRef = ref(null);
|
|
23
|
-
onMounted(() => {
|
|
24
|
-
});
|
|
23
|
+
onMounted(() => { });
|
|
25
24
|
onUnmounted(() => {
|
|
26
25
|
handleDisconnectMqtt();
|
|
27
26
|
});
|
|
@@ -43,7 +42,8 @@ const handleDisconnectMqtt = async () => {
|
|
|
43
42
|
removeHandleMqttMessage('chat-home');
|
|
44
43
|
};
|
|
45
44
|
const mqttMessageHandler = (topic, message) => {
|
|
46
|
-
if (infoUser.value?.id && message?.sender_id?.toString() == infoUser.value?.id?.toString() ||
|
|
45
|
+
if ((infoUser.value?.id && message?.sender_id?.toString() == infoUser.value?.id?.toString()) ||
|
|
46
|
+
true) {
|
|
47
47
|
const index = listMessage.value.findIndex((item) => item.id === message?.id);
|
|
48
48
|
if (index < 0) {
|
|
49
49
|
listMessage.value.push(message);
|
|
@@ -54,7 +54,7 @@ const mqttMessageHandler = (topic, message) => {
|
|
|
54
54
|
chatMessageRef.value?.scrollBottom();
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
const handleGetMessage = async () => {
|
|
57
|
+
const handleGetMessage = async (option) => {
|
|
58
58
|
try {
|
|
59
59
|
const id = props.receiverId;
|
|
60
60
|
const params = { page: page, receiver_id: props.receiverId };
|
|
@@ -62,8 +62,15 @@ const handleGetMessage = async () => {
|
|
|
62
62
|
res.items = res.items.reverse();
|
|
63
63
|
page = res._meta?.currentPage || 1;
|
|
64
64
|
pageCount = res._meta?.pageCount || 1;
|
|
65
|
-
if (id == props.receiverId)
|
|
66
|
-
|
|
65
|
+
if (id == props.receiverId) {
|
|
66
|
+
if (option?.resetList) {
|
|
67
|
+
listMessage.value = res.items;
|
|
68
|
+
chatMessageRef.value?.scrollBottom();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
listMessage.value.unshift(...res.items);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
67
74
|
}
|
|
68
75
|
catch (error) {
|
|
69
76
|
console.error(error);
|
|
@@ -110,7 +117,6 @@ const updateMessageItem = (id, data) => {
|
|
|
110
117
|
if (index > -1) {
|
|
111
118
|
const item = listMessage.value[index];
|
|
112
119
|
listMessage.value[index] = { ...item, ...data };
|
|
113
|
-
console.log({ ...item, ...data });
|
|
114
120
|
}
|
|
115
121
|
};
|
|
116
122
|
const handleSendMessage = async (data) => {
|
|
@@ -210,7 +216,7 @@ const call = () => {
|
|
|
210
216
|
emit('call', infoUser.value);
|
|
211
217
|
}
|
|
212
218
|
};
|
|
213
|
-
const __VLS_exposed = { getData };
|
|
219
|
+
const __VLS_exposed = { getData, handleGetMessage };
|
|
214
220
|
defineExpose(__VLS_exposed);
|
|
215
221
|
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
216
222
|
const __VLS_defaults = {};
|
|
@@ -82,18 +82,24 @@ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
|
82
82
|
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
83
83
|
...{ class: "text-sm text-chat-gray-3 truncate" },
|
|
84
84
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
85
|
+
if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant') {
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
[dataProfile, data, data, digibotId,];
|
|
88
|
+
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
89
|
+
...{ onClick: (...[$event]) => {
|
|
90
|
+
if (!(__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant'))
|
|
91
|
+
return;
|
|
92
|
+
__VLS_ctx.emit('call');
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
[emit,];
|
|
95
|
+
} },
|
|
96
|
+
...{ class: "flex-center text-[#0051E6] bg-chat-haze-200 w-9 h-9 rounded-lg" },
|
|
97
|
+
});
|
|
98
|
+
/** @type {[typeof IconPhone, ]} */ ;
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
const __VLS_7 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({}));
|
|
101
|
+
const __VLS_8 = __VLS_7({}, ...__VLS_functionalComponentArgsRest(__VLS_7));
|
|
102
|
+
}
|
|
97
103
|
/** @type {__VLS_StyleScopedClasses['px-8']} */ ;
|
|
98
104
|
/** @type {__VLS_StyleScopedClasses['pb-4']} */ ;
|
|
99
105
|
/** @type {__VLS_StyleScopedClasses['border-b']} */ ;
|