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