@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
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
import HomeHeader from '../../../chat/page/home/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 { getDetailReceiver, getMessage, sendMessage, upLoadImage } from '../../../utils/chat/message';
|
|
6
6
|
import { 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';
|
|
9
|
-
import { TOPIC_DETAIL_CHAT
|
|
10
|
-
import { dataProfile } from '../../../utils/chat/auth';
|
|
11
|
-
import dayjs from 'dayjs';
|
|
12
|
-
import { DATE_FORMATS, TIME_ZONE_UTC } from '../../../constant/datetime';
|
|
9
|
+
import { TOPIC_DETAIL_CHAT } from '../../../constant/mqtt';
|
|
13
10
|
import { MessageState } from '../../../constant/message';
|
|
11
|
+
import { publicTopicConversationUpdate } from '../../../utils/chat/conversation';
|
|
14
12
|
const props = withDefaults(defineProps(), {});
|
|
15
13
|
const emit = defineEmits();
|
|
16
14
|
let page = 1;
|
|
@@ -20,8 +18,7 @@ const isLoading = ref(false);
|
|
|
20
18
|
const infoUser = shallowRef(null);
|
|
21
19
|
const listMessage = ref([]);
|
|
22
20
|
const chatMessageRef = ref(null);
|
|
23
|
-
onMounted(() => {
|
|
24
|
-
});
|
|
21
|
+
onMounted(() => { });
|
|
25
22
|
onUnmounted(() => {
|
|
26
23
|
handleDisconnectMqtt();
|
|
27
24
|
});
|
|
@@ -43,7 +40,8 @@ const handleDisconnectMqtt = async () => {
|
|
|
43
40
|
removeHandleMqttMessage('chat-home');
|
|
44
41
|
};
|
|
45
42
|
const mqttMessageHandler = (topic, message) => {
|
|
46
|
-
|
|
43
|
+
console.log(message);
|
|
44
|
+
if ((infoUser.value?.id && message?.sender_id?.toString() == infoUser.value?.id?.toString())) {
|
|
47
45
|
const index = listMessage.value.findIndex((item) => item.id === message?.id);
|
|
48
46
|
if (index < 0) {
|
|
49
47
|
listMessage.value.push(message);
|
|
@@ -53,8 +51,9 @@ const mqttMessageHandler = (topic, message) => {
|
|
|
53
51
|
}
|
|
54
52
|
chatMessageRef.value?.scrollBottom();
|
|
55
53
|
}
|
|
54
|
+
console.log(listMessage.value);
|
|
56
55
|
};
|
|
57
|
-
const handleGetMessage = async () => {
|
|
56
|
+
const handleGetMessage = async (option) => {
|
|
58
57
|
try {
|
|
59
58
|
const id = props.receiverId;
|
|
60
59
|
const params = { page: page, receiver_id: props.receiverId };
|
|
@@ -62,8 +61,15 @@ const handleGetMessage = async () => {
|
|
|
62
61
|
res.items = res.items.reverse();
|
|
63
62
|
page = res._meta?.currentPage || 1;
|
|
64
63
|
pageCount = res._meta?.pageCount || 1;
|
|
65
|
-
if (id == props.receiverId)
|
|
66
|
-
|
|
64
|
+
if (id == props.receiverId) {
|
|
65
|
+
if (option?.resetList) {
|
|
66
|
+
listMessage.value = res.items;
|
|
67
|
+
chatMessageRef.value?.scrollBottom();
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
listMessage.value.unshift(...res.items);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
67
73
|
}
|
|
68
74
|
catch (error) {
|
|
69
75
|
console.error(error);
|
|
@@ -82,7 +88,7 @@ const handleScrollTop = async () => {
|
|
|
82
88
|
const handleGetDetailReceiver = async (data) => {
|
|
83
89
|
const id = props.receiverId;
|
|
84
90
|
if (data)
|
|
85
|
-
infoUser.value = data;
|
|
91
|
+
infoUser.value = { ...data, conversation_id: data.id };
|
|
86
92
|
const res = (await getDetailReceiver(props.receiverId)) ?? null;
|
|
87
93
|
if (id == props.receiverId) {
|
|
88
94
|
infoUser.value = res;
|
|
@@ -93,7 +99,8 @@ const getData = async (data) => {
|
|
|
93
99
|
try {
|
|
94
100
|
isLoading.value = true;
|
|
95
101
|
listMessage.value = [];
|
|
96
|
-
|
|
102
|
+
handleGetDetailReceiver(data);
|
|
103
|
+
await Promise.allSettled([handleGetMessage()]);
|
|
97
104
|
// readMessages(infoUser.value?.conversation_id)
|
|
98
105
|
await nextTick();
|
|
99
106
|
chatMessageRef.value?.scrollBottom();
|
|
@@ -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) => {
|
|
@@ -147,7 +153,7 @@ const handleSendMessage = async (data) => {
|
|
|
147
153
|
: []
|
|
148
154
|
});
|
|
149
155
|
updateMessageItem(data.id, { state: MessageState.Sent });
|
|
150
|
-
publicTopicConversationUpdate(
|
|
156
|
+
publicTopicConversationUpdate({ message: data?.message ?? '', isSendImg: !!file_upload?.length, infoUser: infoUser.value });
|
|
151
157
|
}
|
|
152
158
|
catch (error) {
|
|
153
159
|
updateMessageItem(data.id, {
|
|
@@ -168,49 +174,12 @@ const handleUploadImage = async (file) => {
|
|
|
168
174
|
const res = await upLoadImage(formData);
|
|
169
175
|
return res;
|
|
170
176
|
};
|
|
171
|
-
const publicTopicConversationUpdate = async (isSendImg, message) => {
|
|
172
|
-
const res = await getCountUnread({
|
|
173
|
-
conversation_id: infoUser.value?.conversation_id ?? 0,
|
|
174
|
-
receiver_id: Number(infoUser.value?.id)
|
|
175
|
-
});
|
|
176
|
-
const current = dayjs().tz(TIME_ZONE_UTC).format(DATE_FORMATS['DATE_FORMAT_FULL']);
|
|
177
|
-
const dataMessageForReceiver = {
|
|
178
|
-
id: infoUser.value?.conversation_id ?? 0,
|
|
179
|
-
receiver_id: Number(dataProfile.value?.id ?? 0),
|
|
180
|
-
username: dataProfile.value?.username ?? '',
|
|
181
|
-
customer_phone: dataProfile.value?.phone ?? '',
|
|
182
|
-
avatar: dataProfile.value?.avatar ?? '',
|
|
183
|
-
last_message: isSendImg ? `${infoUser.value?.username} sent images` : message,
|
|
184
|
-
last_message_time: current,
|
|
185
|
-
created_at: current,
|
|
186
|
-
updated_at: current,
|
|
187
|
-
unread_count: (res?.unread_count ?? 0) + 1,
|
|
188
|
-
status: 1,
|
|
189
|
-
color: dataProfile.value?.color ?? ''
|
|
190
|
-
};
|
|
191
|
-
publishMessage(`${TOPIC_HOME[0] + Number(infoUser.value?.id)}`, JSON.stringify(dataMessageForReceiver));
|
|
192
|
-
const dataMessageMyself = {
|
|
193
|
-
id: infoUser.value?.conversation_id ?? 0,
|
|
194
|
-
receiver_id: Number(dataProfile.value?.id ?? 0),
|
|
195
|
-
username: infoUser.value?.username ?? '',
|
|
196
|
-
customer_phone: infoUser.value?.phone ?? '',
|
|
197
|
-
avatar: infoUser.value?.avatar ?? '',
|
|
198
|
-
last_message: isSendImg ? `${infoUser.value?.username} sent images` : message,
|
|
199
|
-
last_message_time: current,
|
|
200
|
-
created_at: current,
|
|
201
|
-
updated_at: current,
|
|
202
|
-
unread_count: 0,
|
|
203
|
-
status: 1,
|
|
204
|
-
color: infoUser.value?.color
|
|
205
|
-
};
|
|
206
|
-
publishMessage(`${TOPIC_HOME[0] + Number(dataProfile.value?.id)}`, JSON.stringify(dataMessageMyself));
|
|
207
|
-
};
|
|
208
177
|
const call = () => {
|
|
209
178
|
if (infoUser.value) {
|
|
210
179
|
emit('call', infoUser.value);
|
|
211
180
|
}
|
|
212
181
|
};
|
|
213
|
-
const __VLS_exposed = { getData };
|
|
182
|
+
const __VLS_exposed = { getData, handleGetMessage, infoUser };
|
|
214
183
|
defineExpose(__VLS_exposed);
|
|
215
184
|
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
216
185
|
const __VLS_defaults = {};
|
|
@@ -253,6 +222,7 @@ if (__VLS_ctx.listMessage?.length) {
|
|
|
253
222
|
// @ts-ignore
|
|
254
223
|
const __VLS_7 = __VLS_asFunctionalComponent(ChatMessage, new ChatMessage({
|
|
255
224
|
...{ 'onScrollTop': {} },
|
|
225
|
+
...{ 'onCallBack': {} },
|
|
256
226
|
ref: "chatMessageRef",
|
|
257
227
|
data: (__VLS_ctx.infoUser),
|
|
258
228
|
message: (__VLS_ctx.listMessage),
|
|
@@ -262,6 +232,7 @@ if (__VLS_ctx.listMessage?.length) {
|
|
|
262
232
|
}));
|
|
263
233
|
const __VLS_8 = __VLS_7({
|
|
264
234
|
...{ 'onScrollTop': {} },
|
|
235
|
+
...{ 'onCallBack': {} },
|
|
265
236
|
ref: "chatMessageRef",
|
|
266
237
|
data: (__VLS_ctx.infoUser),
|
|
267
238
|
message: (__VLS_ctx.listMessage),
|
|
@@ -273,10 +244,12 @@ if (__VLS_ctx.listMessage?.length) {
|
|
|
273
244
|
let __VLS_11;
|
|
274
245
|
const __VLS_12 = ({ scrollTop: {} },
|
|
275
246
|
{ onScrollTop: (__VLS_ctx.handleScrollTop) });
|
|
247
|
+
const __VLS_13 = ({ callBack: {} },
|
|
248
|
+
{ onCallBack: (__VLS_ctx.call) });
|
|
276
249
|
/** @type {typeof __VLS_ctx.chatMessageRef} */ ;
|
|
277
|
-
var
|
|
250
|
+
var __VLS_14 = {};
|
|
278
251
|
// @ts-ignore
|
|
279
|
-
[infoUser, listMessage, responsive, page, pageCount, handleScrollTop, chatMessageRef,];
|
|
252
|
+
[infoUser, call, listMessage, responsive, page, pageCount, handleScrollTop, chatMessageRef,];
|
|
280
253
|
var __VLS_9;
|
|
281
254
|
}
|
|
282
255
|
else if (!__VLS_ctx.isLoading) {
|
|
@@ -284,14 +257,14 @@ else if (!__VLS_ctx.isLoading) {
|
|
|
284
257
|
[isLoading,];
|
|
285
258
|
/** @type {[typeof NewCustomer, ]} */ ;
|
|
286
259
|
// @ts-ignore
|
|
287
|
-
const
|
|
260
|
+
const __VLS_17 = __VLS_asFunctionalComponent(NewCustomer, new NewCustomer({
|
|
288
261
|
data: (__VLS_ctx.infoUser),
|
|
289
262
|
...{ class: "grow" },
|
|
290
263
|
}));
|
|
291
|
-
const
|
|
264
|
+
const __VLS_18 = __VLS_17({
|
|
292
265
|
data: (__VLS_ctx.infoUser),
|
|
293
266
|
...{ class: "grow" },
|
|
294
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
267
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_17));
|
|
295
268
|
// @ts-ignore
|
|
296
269
|
[infoUser,];
|
|
297
270
|
}
|
|
@@ -302,23 +275,23 @@ else {
|
|
|
302
275
|
}
|
|
303
276
|
/** @type {[typeof InputChat, ]} */ ;
|
|
304
277
|
// @ts-ignore
|
|
305
|
-
const
|
|
278
|
+
const __VLS_21 = __VLS_asFunctionalComponent(InputChat, new InputChat({
|
|
306
279
|
...{ 'onSendMessage': {} },
|
|
307
280
|
data: (__VLS_ctx.infoUser),
|
|
308
281
|
...{ class: "p-6" },
|
|
309
282
|
}));
|
|
310
|
-
const
|
|
283
|
+
const __VLS_22 = __VLS_21({
|
|
311
284
|
...{ 'onSendMessage': {} },
|
|
312
285
|
data: (__VLS_ctx.infoUser),
|
|
313
286
|
...{ class: "p-6" },
|
|
314
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
315
|
-
let __VLS_23;
|
|
287
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_21));
|
|
316
288
|
let __VLS_24;
|
|
317
|
-
|
|
289
|
+
let __VLS_25;
|
|
290
|
+
const __VLS_26 = ({ sendMessage: {} },
|
|
318
291
|
{ onSendMessage: (__VLS_ctx.handleSendMessage) });
|
|
319
292
|
// @ts-ignore
|
|
320
293
|
[infoUser, handleSendMessage,];
|
|
321
|
-
var
|
|
294
|
+
var __VLS_23;
|
|
322
295
|
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
323
296
|
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
324
297
|
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
@@ -329,7 +302,7 @@ var __VLS_22;
|
|
|
329
302
|
/** @type {__VLS_StyleScopedClasses['grow']} */ ;
|
|
330
303
|
/** @type {__VLS_StyleScopedClasses['p-6']} */ ;
|
|
331
304
|
// @ts-ignore
|
|
332
|
-
var
|
|
305
|
+
var __VLS_15 = __VLS_14;
|
|
333
306
|
const __VLS_export = (await import('vue')).defineComponent({
|
|
334
307
|
setup: () => (__VLS_exposed),
|
|
335
308
|
__typeEmits: {},
|
|
@@ -79,21 +79,24 @@ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
|
79
79
|
(__VLS_ctx.data?.username ?? 'n/a');
|
|
80
80
|
// @ts-ignore
|
|
81
81
|
[data,];
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
82
|
+
if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant') {
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
[dataProfile, data, data, digibotId,];
|
|
85
|
+
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
86
|
+
...{ onClick: (...[$event]) => {
|
|
87
|
+
if (!(__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant'))
|
|
88
|
+
return;
|
|
89
|
+
__VLS_ctx.emit('call');
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
[emit,];
|
|
92
|
+
} },
|
|
93
|
+
...{ class: "flex-center text-[#0051E6] bg-chat-haze-200 w-9 h-9 rounded-lg" },
|
|
94
|
+
});
|
|
95
|
+
/** @type {[typeof IconPhone, ]} */ ;
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
const __VLS_7 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({}));
|
|
98
|
+
const __VLS_8 = __VLS_7({}, ...__VLS_functionalComponentArgsRest(__VLS_7));
|
|
99
|
+
}
|
|
97
100
|
/** @type {__VLS_StyleScopedClasses['px-8']} */ ;
|
|
98
101
|
/** @type {__VLS_StyleScopedClasses['pb-4']} */ ;
|
|
99
102
|
/** @type {__VLS_StyleScopedClasses['border-b']} */ ;
|
|
@@ -110,9 +113,6 @@ const __VLS_8 = __VLS_7({}, ...__VLS_functionalComponentArgsRest(__VLS_7));
|
|
|
110
113
|
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
111
114
|
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
112
115
|
/** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
|
|
113
|
-
/** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
|
|
114
|
-
/** @type {__VLS_StyleScopedClasses['text-chat-gray-3']} */ ;
|
|
115
|
-
/** @type {__VLS_StyleScopedClasses['truncate']} */ ;
|
|
116
116
|
/** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
|
|
117
117
|
/** @type {__VLS_StyleScopedClasses['text-[#0051E6]']} */ ;
|
|
118
118
|
/** @type {__VLS_StyleScopedClasses['bg-chat-haze-200']} */ ;
|
|
@@ -5,16 +5,23 @@ import 'vue3-emoji-picker/css';
|
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import { DATE_FORMATS, TIME_ZONE_UTC } from '../../../constant/datetime';
|
|
7
7
|
import { dataProfile } from '../../../utils/chat/auth';
|
|
8
|
-
import { ref } from 'vue';
|
|
8
|
+
import { computed, ref } from 'vue';
|
|
9
9
|
import PopoverBase from '../../../components/chat/common/popover/PopoverBase.vue';
|
|
10
|
+
import SwitchBase from '../../../components/chat/common/switch/SwitchBase.vue';
|
|
10
11
|
const props = withDefaults(defineProps(), {});
|
|
11
12
|
const emit = defineEmits();
|
|
13
|
+
const ChatModeOptions = [
|
|
14
|
+
{ value: '0', label: 'Go Chat' },
|
|
15
|
+
{ value: '1', label: 'Go sms' }
|
|
16
|
+
];
|
|
17
|
+
const modeLabel = computed(() => ChatModeOptions.find((v) => v.value === mode.value)?.label ?? '');
|
|
12
18
|
const keyword = defineModel();
|
|
13
19
|
let chatId = 1;
|
|
14
20
|
const refInputImage = ref(null);
|
|
15
21
|
const isLoadingImage = ref([]);
|
|
16
22
|
const chatInputRef = ref(null);
|
|
17
23
|
const emojiOpen = ref(false);
|
|
24
|
+
const mode = ref('0');
|
|
18
25
|
const handleSendMessage = async (type) => {
|
|
19
26
|
const tempId = Date.now();
|
|
20
27
|
let messageContent = '';
|
|
@@ -35,7 +42,6 @@ const handleSendMessage = async (type) => {
|
|
|
35
42
|
keyword.value = '';
|
|
36
43
|
chatId++;
|
|
37
44
|
const id = props.data?.id.toString() + '-' + chatId;
|
|
38
|
-
console.log(dayjs().tz(TIME_ZONE_UTC).format(DATE_FORMATS['DATE_FORMAT_FULL']));
|
|
39
45
|
const data = {
|
|
40
46
|
conversation_id: 135,
|
|
41
47
|
created_at: dayjs().tz(TIME_ZONE_UTC).format(DATE_FORMATS['DATE_FORMAT_FULL']),
|
|
@@ -77,11 +83,30 @@ const __VLS_ctx = {
|
|
|
77
83
|
let __VLS_elements;
|
|
78
84
|
let __VLS_components;
|
|
79
85
|
let __VLS_directives;
|
|
86
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
87
|
+
...{ class: "z-10" },
|
|
88
|
+
...{ style: {} },
|
|
89
|
+
});
|
|
90
|
+
if (__VLS_ctx.dataProfile?.user_type == 'tenant') {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
[dataProfile,];
|
|
93
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
94
|
+
...{ class: "mb-2" },
|
|
95
|
+
});
|
|
96
|
+
/** @type {[typeof SwitchBase, ]} */ ;
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
const __VLS_0 = __VLS_asFunctionalComponent(SwitchBase, new SwitchBase({
|
|
99
|
+
label: "Active sms",
|
|
100
|
+
}));
|
|
101
|
+
const __VLS_1 = __VLS_0({
|
|
102
|
+
label: "Active sms",
|
|
103
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
104
|
+
}
|
|
80
105
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
81
106
|
...{ class: "flex gap-2" },
|
|
82
107
|
});
|
|
83
108
|
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
84
|
-
...{ class: "
|
|
109
|
+
...{ class: "relative grow" },
|
|
85
110
|
});
|
|
86
111
|
__VLS_asFunctionalElement(__VLS_elements.input)({
|
|
87
112
|
...{ onKeydown: (...[$event]) => {
|
|
@@ -89,7 +114,7 @@ __VLS_asFunctionalElement(__VLS_elements.input)({
|
|
|
89
114
|
// @ts-ignore
|
|
90
115
|
[handleSendMessage,];
|
|
91
116
|
} },
|
|
92
|
-
...{ class: "w-full chat-input h-11 px-4 border border-chat-haze-200" },
|
|
117
|
+
...{ class: "w-full chat-input !rounded-xl h-11 px-4 border border-chat-haze-200" },
|
|
93
118
|
ref: "chatInputRef",
|
|
94
119
|
placeholder: "Send Message",
|
|
95
120
|
});
|
|
@@ -102,17 +127,17 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
|
102
127
|
});
|
|
103
128
|
/** @type {[typeof PopoverBase, typeof PopoverBase, ]} */ ;
|
|
104
129
|
// @ts-ignore
|
|
105
|
-
const
|
|
130
|
+
const __VLS_4 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
|
|
106
131
|
open: (__VLS_ctx.emojiOpen),
|
|
107
132
|
align: "end",
|
|
108
133
|
side: "top",
|
|
109
134
|
}));
|
|
110
|
-
const
|
|
135
|
+
const __VLS_5 = __VLS_4({
|
|
111
136
|
open: (__VLS_ctx.emojiOpen),
|
|
112
137
|
align: "end",
|
|
113
138
|
side: "top",
|
|
114
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
115
|
-
const { default:
|
|
139
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_4));
|
|
140
|
+
const { default: __VLS_7 } = __VLS_6.slots;
|
|
116
141
|
// @ts-ignore
|
|
117
142
|
[emojiOpen,];
|
|
118
143
|
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
@@ -121,64 +146,64 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
|
121
146
|
// @ts-ignore
|
|
122
147
|
[emojiOpen, emojiOpen,];
|
|
123
148
|
} },
|
|
124
|
-
...{ class: "" },
|
|
149
|
+
...{ class: "h-11 w-10" },
|
|
125
150
|
});
|
|
126
151
|
{
|
|
127
|
-
const { content:
|
|
128
|
-
const
|
|
152
|
+
const { content: __VLS_8 } = __VLS_6.slots;
|
|
153
|
+
const __VLS_9 = {}.EmojiPicker;
|
|
129
154
|
/** @type {[typeof __VLS_components.EmojiPicker, typeof __VLS_components.emojiPicker, ]} */ ;
|
|
130
155
|
// @ts-ignore
|
|
131
156
|
EmojiPicker;
|
|
132
157
|
// @ts-ignore
|
|
133
|
-
const
|
|
158
|
+
const __VLS_10 = __VLS_asFunctionalComponent(__VLS_9, new __VLS_9({
|
|
134
159
|
...{ 'onSelect': {} },
|
|
135
160
|
...{ class: "!w-[300px]" },
|
|
136
161
|
native: (true),
|
|
137
162
|
offset: (2),
|
|
138
163
|
hideSearch: true,
|
|
139
164
|
}));
|
|
140
|
-
const
|
|
165
|
+
const __VLS_11 = __VLS_10({
|
|
141
166
|
...{ 'onSelect': {} },
|
|
142
167
|
...{ class: "!w-[300px]" },
|
|
143
168
|
native: (true),
|
|
144
169
|
offset: (2),
|
|
145
170
|
hideSearch: true,
|
|
146
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
147
|
-
let
|
|
148
|
-
let
|
|
149
|
-
const
|
|
171
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_10));
|
|
172
|
+
let __VLS_13;
|
|
173
|
+
let __VLS_14;
|
|
174
|
+
const __VLS_15 = ({ select: {} },
|
|
150
175
|
{ onSelect: (__VLS_ctx.onSelectEmoji) });
|
|
151
176
|
// @ts-ignore
|
|
152
177
|
[onSelectEmoji,];
|
|
153
|
-
var
|
|
178
|
+
var __VLS_12;
|
|
154
179
|
}
|
|
155
|
-
var
|
|
156
|
-
const
|
|
180
|
+
var __VLS_6;
|
|
181
|
+
const __VLS_17 = {}.EmojiPicker;
|
|
157
182
|
/** @type {[typeof __VLS_components.EmojiPicker, typeof __VLS_components.emojiPicker, ]} */ ;
|
|
158
183
|
// @ts-ignore
|
|
159
184
|
EmojiPicker;
|
|
160
185
|
// @ts-ignore
|
|
161
|
-
const
|
|
186
|
+
const __VLS_18 = __VLS_asFunctionalComponent(__VLS_17, new __VLS_17({
|
|
162
187
|
...{ 'onSelect': {} },
|
|
163
188
|
...{ class: "opacity-0 pointer-events-none absolute" },
|
|
164
189
|
native: (true),
|
|
165
190
|
offset: (2),
|
|
166
191
|
hideSearch: true,
|
|
167
192
|
}));
|
|
168
|
-
const
|
|
193
|
+
const __VLS_19 = __VLS_18({
|
|
169
194
|
...{ 'onSelect': {} },
|
|
170
195
|
...{ class: "opacity-0 pointer-events-none absolute" },
|
|
171
196
|
native: (true),
|
|
172
197
|
offset: (2),
|
|
173
198
|
hideSearch: true,
|
|
174
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
175
|
-
let
|
|
176
|
-
let
|
|
177
|
-
const
|
|
199
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_18));
|
|
200
|
+
let __VLS_21;
|
|
201
|
+
let __VLS_22;
|
|
202
|
+
const __VLS_23 = ({ select: {} },
|
|
178
203
|
{ onSelect: (__VLS_ctx.onSelectEmoji) });
|
|
179
204
|
// @ts-ignore
|
|
180
205
|
[onSelectEmoji,];
|
|
181
|
-
var
|
|
206
|
+
var __VLS_20;
|
|
182
207
|
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
183
208
|
...{ onClick: (...[$event]) => {
|
|
184
209
|
__VLS_ctx.handleSendMessage('message');
|
|
@@ -189,8 +214,8 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
|
189
214
|
});
|
|
190
215
|
/** @type {[typeof IconPlan, ]} */ ;
|
|
191
216
|
// @ts-ignore
|
|
192
|
-
const
|
|
193
|
-
const
|
|
217
|
+
const __VLS_25 = __VLS_asFunctionalComponent(IconPlan, new IconPlan({}));
|
|
218
|
+
const __VLS_26 = __VLS_25({}, ...__VLS_functionalComponentArgsRest(__VLS_25));
|
|
194
219
|
__VLS_asFunctionalElement(__VLS_elements.label, __VLS_elements.label)({
|
|
195
220
|
...{ class: "shrink-0 cursor-pointer relative" },
|
|
196
221
|
});
|
|
@@ -209,20 +234,21 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
|
209
234
|
});
|
|
210
235
|
/** @type {[typeof IconPlus, ]} */ ;
|
|
211
236
|
// @ts-ignore
|
|
212
|
-
const
|
|
237
|
+
const __VLS_29 = __VLS_asFunctionalComponent(IconPlus, new IconPlus({
|
|
213
238
|
...{ class: "text-white" },
|
|
214
239
|
}));
|
|
215
|
-
const
|
|
240
|
+
const __VLS_30 = __VLS_29({
|
|
216
241
|
...{ class: "text-white" },
|
|
217
|
-
}, ...__VLS_functionalComponentArgsRest(
|
|
218
|
-
/** @type {__VLS_StyleScopedClasses['']} */ ;
|
|
242
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_29));
|
|
243
|
+
/** @type {__VLS_StyleScopedClasses['z-10']} */ ;
|
|
244
|
+
/** @type {__VLS_StyleScopedClasses['mb-2']} */ ;
|
|
219
245
|
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
220
246
|
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
221
|
-
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
222
247
|
/** @type {__VLS_StyleScopedClasses['relative']} */ ;
|
|
223
248
|
/** @type {__VLS_StyleScopedClasses['grow']} */ ;
|
|
224
249
|
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
225
250
|
/** @type {__VLS_StyleScopedClasses['chat-input']} */ ;
|
|
251
|
+
/** @type {__VLS_StyleScopedClasses['!rounded-xl']} */ ;
|
|
226
252
|
/** @type {__VLS_StyleScopedClasses['h-11']} */ ;
|
|
227
253
|
/** @type {__VLS_StyleScopedClasses['px-4']} */ ;
|
|
228
254
|
/** @type {__VLS_StyleScopedClasses['border']} */ ;
|
|
@@ -232,6 +258,8 @@ const __VLS_26 = __VLS_25({
|
|
|
232
258
|
/** @type {__VLS_StyleScopedClasses['absolute']} */ ;
|
|
233
259
|
/** @type {__VLS_StyleScopedClasses['right-0']} */ ;
|
|
234
260
|
/** @type {__VLS_StyleScopedClasses['bottom-0']} */ ;
|
|
261
|
+
/** @type {__VLS_StyleScopedClasses['h-11']} */ ;
|
|
262
|
+
/** @type {__VLS_StyleScopedClasses['w-10']} */ ;
|
|
235
263
|
/** @type {__VLS_StyleScopedClasses['!w-[300px]']} */ ;
|
|
236
264
|
/** @type {__VLS_StyleScopedClasses['opacity-0']} */ ;
|
|
237
265
|
/** @type {__VLS_StyleScopedClasses['pointer-events-none']} */ ;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import SelectBase from '../../../components/chat/select/SelectBase.vue';
|
|
4
|
+
const open = ref(false);
|
|
5
|
+
const phoneValue = ref('');
|
|
6
|
+
const countries = [
|
|
7
|
+
// { value: 'VN', label: 'Vietnam', dial: 84, flag: 'π»π³' },
|
|
8
|
+
{ value: 'US', label: '+1 US', dial: 1, flag: 'πΊπΈ' }
|
|
9
|
+
// { value: 'KR', label: 'Korea', dial: 82, flag: 'π°π·' },
|
|
10
|
+
// { value: 'JP', label: 'Japan', dial: 81, flag: 'π―π΅' },
|
|
11
|
+
// { value: 'TH', label: 'Thailand', dial: 66, flag: 'πΉπ' },
|
|
12
|
+
];
|
|
13
|
+
const selected = ref(countries[0]);
|
|
14
|
+
const error = ref('');
|
|
15
|
+
const select = (c) => {
|
|
16
|
+
selected.value = c;
|
|
17
|
+
open.value = false;
|
|
18
|
+
};
|
|
19
|
+
const handleInput = () => {
|
|
20
|
+
error.value = '';
|
|
21
|
+
phoneValue.value = keepOnlyNumbers(phoneValue.value);
|
|
22
|
+
};
|
|
23
|
+
const keepOnlyNumbers = (str) => {
|
|
24
|
+
return str.replace(/\D/g, '');
|
|
25
|
+
};
|
|
26
|
+
const onSubmit = () => { };
|
|
27
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
28
|
+
const __VLS_ctx = {
|
|
29
|
+
...{},
|
|
30
|
+
...{},
|
|
31
|
+
};
|
|
32
|
+
let __VLS_elements;
|
|
33
|
+
let __VLS_components;
|
|
34
|
+
let __VLS_directives;
|
|
35
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
|
|
36
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
37
|
+
...{ class: "text-xl font-semibold text-chat-haze-600 mb-4" },
|
|
38
|
+
});
|
|
39
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
40
|
+
...{ class: "flex items-center gap-2 chat-input border border-chat-haze-200 p-2 bg-white shadow-md" },
|
|
41
|
+
});
|
|
42
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
43
|
+
...{ class: "relative" },
|
|
44
|
+
});
|
|
45
|
+
/** @type {[typeof SelectBase, typeof SelectBase, ]} */ ;
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
const __VLS_0 = __VLS_asFunctionalComponent(SelectBase, new SelectBase({
|
|
48
|
+
options: (__VLS_ctx.countries),
|
|
49
|
+
placement: "bottom",
|
|
50
|
+
disabled: true,
|
|
51
|
+
}));
|
|
52
|
+
const __VLS_1 = __VLS_0({
|
|
53
|
+
options: (__VLS_ctx.countries),
|
|
54
|
+
placement: "bottom",
|
|
55
|
+
disabled: true,
|
|
56
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
57
|
+
const { default: __VLS_3 } = __VLS_2.slots;
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
[countries,];
|
|
60
|
+
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
61
|
+
...{ class: "flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-gray-100" },
|
|
62
|
+
});
|
|
63
|
+
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
|
|
64
|
+
(__VLS_ctx.selected.flag);
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
[selected,];
|
|
67
|
+
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
|
|
68
|
+
...{ class: "text-sm text-chat-haze-700" },
|
|
69
|
+
});
|
|
70
|
+
(__VLS_ctx.selected.dial);
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
[selected,];
|
|
73
|
+
__VLS_asFunctionalElement(__VLS_elements.svg, __VLS_elements.svg)({
|
|
74
|
+
...{ class: "w-4 h-4 text-chat-haze-500" },
|
|
75
|
+
fill: "none",
|
|
76
|
+
stroke: "currentColor",
|
|
77
|
+
viewBox: "0 0 20 20",
|
|
78
|
+
});
|
|
79
|
+
__VLS_asFunctionalElement(__VLS_elements.path)({
|
|
80
|
+
'stroke-linecap': "round",
|
|
81
|
+
'stroke-linejoin': "round",
|
|
82
|
+
'stroke-width': "2",
|
|
83
|
+
d: "M5 7l5 5 5-5",
|
|
84
|
+
});
|
|
85
|
+
var __VLS_2;
|
|
86
|
+
__VLS_asFunctionalElement(__VLS_elements.input)({
|
|
87
|
+
...{ onInput: (__VLS_ctx.handleInput) },
|
|
88
|
+
...{ onKeyup: (__VLS_ctx.onSubmit) },
|
|
89
|
+
...{ class: "!outline-none" },
|
|
90
|
+
type: "tel",
|
|
91
|
+
maxlength: (10),
|
|
92
|
+
placeholder: "Enter phone number",
|
|
93
|
+
});
|
|
94
|
+
(__VLS_ctx.phoneValue);
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
[handleInput, onSubmit, phoneValue,];
|
|
97
|
+
/** @type {__VLS_StyleScopedClasses['text-xl']} */ ;
|
|
98
|
+
/** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
|
|
99
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
|
|
100
|
+
/** @type {__VLS_StyleScopedClasses['mb-4']} */ ;
|
|
101
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
102
|
+
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
103
|
+
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
104
|
+
/** @type {__VLS_StyleScopedClasses['chat-input']} */ ;
|
|
105
|
+
/** @type {__VLS_StyleScopedClasses['border']} */ ;
|
|
106
|
+
/** @type {__VLS_StyleScopedClasses['border-chat-haze-200']} */ ;
|
|
107
|
+
/** @type {__VLS_StyleScopedClasses['p-2']} */ ;
|
|
108
|
+
/** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
|
|
109
|
+
/** @type {__VLS_StyleScopedClasses['shadow-md']} */ ;
|
|
110
|
+
/** @type {__VLS_StyleScopedClasses['relative']} */ ;
|
|
111
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
112
|
+
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
113
|
+
/** @type {__VLS_StyleScopedClasses['gap-1']} */ ;
|
|
114
|
+
/** @type {__VLS_StyleScopedClasses['px-2']} */ ;
|
|
115
|
+
/** @type {__VLS_StyleScopedClasses['py-1']} */ ;
|
|
116
|
+
/** @type {__VLS_StyleScopedClasses['rounded-lg']} */ ;
|
|
117
|
+
/** @type {__VLS_StyleScopedClasses['hover:bg-gray-100']} */ ;
|
|
118
|
+
/** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
|
|
119
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-haze-700']} */ ;
|
|
120
|
+
/** @type {__VLS_StyleScopedClasses['w-4']} */ ;
|
|
121
|
+
/** @type {__VLS_StyleScopedClasses['h-4']} */ ;
|
|
122
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-haze-500']} */ ;
|
|
123
|
+
/** @type {__VLS_StyleScopedClasses['!outline-none']} */ ;
|
|
124
|
+
const __VLS_export = (await import('vue')).defineComponent({});
|
|
125
|
+
export default {};
|