@phonghq/go-chat 1.0.26 → 1.0.27

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.
Files changed (29) hide show
  1. package/README.md +1 -1
  2. package/dist/chat/page/home/Home.vue.d.ts +2 -0
  3. package/dist/chat/page/home/InputChat.vue.d.ts +2 -0
  4. package/dist/components/chat/common/spin/BaseSpin.vue.d.ts +8 -1
  5. package/dist/components/chat/common/switch/SwitchBase.vue.d.ts +3 -0
  6. package/dist/components/common/drawer/DrawerBase.vue.d.ts +1 -1
  7. package/dist/constant/mqtt.d.ts +1 -0
  8. package/dist/go-chat.es.js +7213 -7176
  9. package/dist/go-chat.umd.js +12 -12
  10. package/dist/style.css +1 -1
  11. package/dist/test/chat/App.vue.js +77 -66
  12. package/dist/test/chat/page/customer-appointment/CustomerAppointment.vue.js +3 -3
  13. package/dist/test/chat/page/home/ChatList.vue.js +8 -112
  14. package/dist/test/chat/page/home/ChatMessage.vue.js +1 -3
  15. package/dist/test/chat/page/home/Home.vue.js +24 -11
  16. package/dist/test/chat/page/home/InputChat.vue.js +78 -28
  17. package/dist/test/components/chat/call/Calling.vue.js +3 -2
  18. package/dist/test/components/chat/common/spin/BaseSpin.vue.js +29 -2
  19. package/dist/test/components/chat/common/switch/SwitchBase.vue.js +7 -2
  20. package/dist/test/composable/useListConversations.js +2 -1
  21. package/dist/test/composable/usePlivo.js +5 -2
  22. package/dist/test/constant/mqtt.js +1 -0
  23. package/dist/test/utils/chat/call.js +4 -3
  24. package/dist/test/utils/chat/conversation.js +1 -1
  25. package/dist/test/utils/chat/message.js +4 -0
  26. package/dist/utils/chat/message.d.ts +4 -0
  27. package/package.json +1 -1
  28. package/dist/assets/icons/IconSetting.vue.d.ts +0 -2
  29. package/dist/test/assets/icons/IconSetting.vue.js +0 -33
@@ -55,111 +55,14 @@ const listConversations = computed(() => {
55
55
  return listConversationsAll.value;
56
56
  return listConversationsUnknown.value;
57
57
  });
58
- const isOpen = ref(false);
59
58
  const keyword = ref('');
60
59
  const activeTabs = ref(TAB_VALUE.ALL);
61
60
  const scrollEventRef = ref(null);
62
- // const listConversations = ref<IConversation[]>([])
63
- // const params = ref({
64
- // page: 1,
65
- // search: ''
66
- // })
67
- // let pageCount = 0
68
61
  const isLoadingSearch = ref(false);
69
- //
70
- // onMounted(() => {
71
- // handleConnectMqtt()
72
- // })
73
- //
74
- // onUnmounted(() => {
75
- // handleDisconnectMqtt
76
- // })
77
- //
78
- // const handleDisconnectMqtt = () => {
79
- // TOPIC_HOME.forEach((item: string) => {
80
- // unsubscribeFromTopic(item + dataProfile.value?.id)
81
- // removeHandleMqttMessage('chat-list-' + item)
82
- // })
83
- // if (dataProfile.value?.user_type == 'tenant') {
84
- // subscribeToTopic(TOPIC_STATUS_USER + dataProfile.value?.id)
85
- // removeHandleMqttMessage('chat-list-' + TOPIC_STATUS_USER)
86
- // }
87
- // }
88
- //
89
- // const handleConnectMqtt = async () => {
90
- // try {
91
- // if (dataProfile.value) {
92
- // await connectMqtt()
93
- // TOPIC_HOME.forEach((item: string) => {
94
- // subscribeToTopic(item + dataProfile.value?.id)
95
- // addHandleMqttMessage('chat-list-' + item, item + dataProfile.value?.id, mqttMessageHandler)
96
- // })
97
- // subscribeToTopic(TOPIC_STATUS_USER + dataProfile.value?.id)
98
- // addHandleMqttMessage(
99
- // 'chat-list-' + TOPIC_STATUS_USER,
100
- // TOPIC_STATUS_USER + dataProfile.value?.id,
101
- // mqttMessageHandler
102
- // )
103
- // }
104
- // } catch (error) {
105
- // console.error(error)
106
- // }
107
- // }
108
- //
109
- // const mqttMessageHandler = (topic: string, data: any) => {
110
- // getDataMqtt()
111
- // if (topic === TOPIC_HOME[0] + dataProfile.value?.id) {
112
- // const index = listConversations.value.findIndex((item: any) => item.id === data.id)
113
- // const hasChatBox = listConversations.value.findIndex((item: any) => item.id === digibotId)
114
- // if (index != -1) {
115
- // listConversations.value.splice(index, 1)
116
- // }
117
- // if (hasChatBox > -1) {
118
- // listConversations.value.splice(1, 0, data)
119
- // } else {
120
- // listConversations.value.unshift(data)
121
- // }
122
- // }
123
- //
124
- // if (topic === TOPIC_HOME[1] + dataProfile.value?.id) {
125
- // const index = listConversations.value.findIndex((item: any) => item.id === data.id)
126
- // if (index != -1) {
127
- // listConversations.value[index].unread_count = 0
128
- // }
129
- // }
130
- //
131
- // if (topic === TOPIC_HOME[2] + dataProfile.value?.id) {
132
- // listConversations.value.unshift(data?.conversations)
133
- // }
134
- //
135
- // if (topic === TOPIC_STATUS_USER + dataProfile.value?.id) {
136
- // const index = listConversations.value.findIndex(
137
- // (e) => e.receiver_id == Number(data?.customer_id)
138
- // )
139
- // if (index != -1) {
140
- // listConversations.value[index].status = data.is_online ? 1 : 0
141
- // }
142
- // }
143
- // }
144
- //
145
- // const getDataMqtt = useDebounce(() => {
146
- // getData(undefined, { hideLoading: true, reset: true })
147
- // }, 5000)
148
- //
149
62
  const getData = async (data, option) => {
150
63
  try {
151
64
  if (!option?.hideLoading)
152
65
  isLoadingSearch.value = true;
153
- // params.value = { ...params.value, ...(data ?? {}) }
154
- // const res = await getConversation({ ...params.value, is_unknown: activeTabs.value })
155
- // if (option?.reset) {
156
- // listConversations.value = []
157
- // listConversations.value.push(digibotData)
158
- // await nextTick()
159
- // }
160
- // listConversations.value.push(...(res?.items ?? []))
161
- // params.value.page = res?._meta?.currentPage || 1
162
- // pageCount = res?._meta?.pageCount || 1
163
66
  if (activeTabs.value == TAB_VALUE.ALL) {
164
67
  await getDataAll(data, option);
165
68
  }
@@ -236,15 +139,7 @@ const handleReadMessage = () => {
236
139
  else if (activeTabs.value == TAB_VALUE.UNKNOWN) {
237
140
  handleReadMessageUnknown(receiver_id.value);
238
141
  }
239
- // const index = listConversations.value.findIndex((e) => e.receiver_id == receiver_id.value)
240
- // if (index > -1) {
241
- // if (listConversations.value[index].unread_count) {
242
- // readMessages(listConversations.value[index].id)
243
- // listConversations.value[index].unread_count = 0
244
- // }
245
- // }
246
142
  };
247
- //
248
143
  const getTimeFromNow = (data) => {
249
144
  if (data && dayjs(data).isValid()) {
250
145
  return dayjs.tz(data, TIME_ZONE_UTC).local().fromNow();
@@ -290,13 +185,13 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
290
185
  // @ts-ignore
291
186
  const __VLS_0 = __VLS_asFunctionalComponent(InputSearch, new InputSearch({
292
187
  ...{ 'onSearch': {} },
293
- ...{ class: "h-[45px] grow" },
188
+ ...{ class: "h-11 grow" },
294
189
  responsive: (__VLS_ctx.responsive),
295
190
  modelValue: (__VLS_ctx.keyword),
296
191
  }));
297
192
  const __VLS_1 = __VLS_0({
298
193
  ...{ 'onSearch': {} },
299
- ...{ class: "h-[45px] grow" },
194
+ ...{ class: "h-11 grow" },
300
195
  responsive: (__VLS_ctx.responsive),
301
196
  modelValue: (__VLS_ctx.keyword),
302
197
  }, ...__VLS_functionalComponentArgsRest(__VLS_0));
@@ -308,7 +203,7 @@ const __VLS_5 = ({ search: {} },
308
203
  [responsive, keyword, handleSearch,];
309
204
  var __VLS_2;
310
205
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
311
- ...{ class: "h-[45px] w-[45px] rounded-full flex-center bg-[#C7DEFF]" },
206
+ ...{ class: "h-11 w-11 rounded-full flex-center bg-[#C7DEFF]" },
312
207
  });
313
208
  /** @type {[typeof IconPlus, ]} */ ;
314
209
  // @ts-ignore
@@ -413,7 +308,7 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
413
308
  ...{ class: "truncate" },
414
309
  });
415
310
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
416
- ...{ class: "flex items-center" },
311
+ ...{ class: "flex items-center text-left" },
417
312
  });
418
313
  __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
419
314
  ...{ class: "font-semibold" },
@@ -465,10 +360,10 @@ var __VLS_20;
465
360
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
466
361
  /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
467
362
  /** @type {__VLS_StyleScopedClasses['mb-4']} */ ;
468
- /** @type {__VLS_StyleScopedClasses['h-[45px]']} */ ;
363
+ /** @type {__VLS_StyleScopedClasses['h-11']} */ ;
469
364
  /** @type {__VLS_StyleScopedClasses['grow']} */ ;
470
- /** @type {__VLS_StyleScopedClasses['h-[45px]']} */ ;
471
- /** @type {__VLS_StyleScopedClasses['w-[45px]']} */ ;
365
+ /** @type {__VLS_StyleScopedClasses['h-11']} */ ;
366
+ /** @type {__VLS_StyleScopedClasses['w-11']} */ ;
472
367
  /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
473
368
  /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
474
369
  /** @type {__VLS_StyleScopedClasses['bg-[#C7DEFF]']} */ ;
@@ -500,6 +395,7 @@ var __VLS_20;
500
395
  /** @type {__VLS_StyleScopedClasses['truncate']} */ ;
501
396
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
502
397
  /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
398
+ /** @type {__VLS_StyleScopedClasses['text-left']} */ ;
503
399
  /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
504
400
  /** @type {__VLS_StyleScopedClasses['ml-2']} */ ;
505
401
  /** @type {__VLS_StyleScopedClasses['ml-2']} */ ;
@@ -115,7 +115,6 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
115
115
  ...{ 'onCallAgain': {} },
116
116
  message: (item),
117
117
  index: (index),
118
- listMessage: (__VLS_ctx.message),
119
118
  responsive: (__VLS_ctx.responsive),
120
119
  isMyMessage: (item.sender_id == __VLS_ctx.dataProfile?.id),
121
120
  data: (__VLS_ctx.data),
@@ -128,7 +127,6 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
128
127
  ...{ 'onCallAgain': {} },
129
128
  message: (item),
130
129
  index: (index),
131
- listMessage: (__VLS_ctx.message),
132
130
  responsive: (__VLS_ctx.responsive),
133
131
  isMyMessage: (item.sender_id == __VLS_ctx.dataProfile?.id),
134
132
  data: (__VLS_ctx.data),
@@ -143,7 +141,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
143
141
  { onCallAgain: (...[$event]) => {
144
142
  __VLS_ctx.emit('callBack');
145
143
  // @ts-ignore
146
- [data, message, message, responsive, dataProfile, shouldShowAvatar, isEndMessage, isChatFinished, emit,];
144
+ [data, message, responsive, dataProfile, shouldShowAvatar, isEndMessage, isChatFinished, emit,];
147
145
  } });
148
146
  var __VLS_15;
149
147
  }
@@ -3,17 +3,19 @@ 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
5
  import { getDetailReceiver, getMessage, sendMessage, upLoadImage } from '../../../utils/chat/message';
6
- import { nextTick, onMounted, onUnmounted, ref, shallowRef } from 'vue';
6
+ import { computed, nextTick, onMounted, onUnmounted, ref, shallowRef } from 'vue';
7
7
  import ChatMessage from '../../../chat/page/home/ChatMessage.vue';
8
8
  import { addHandleMqttMessage, connectMqtt, publishMessage, removeHandleMqttMessage, subscribeToTopic, unsubscribeFromTopic } from '../../../plugins/mqtt';
9
- import { TOPIC_DETAIL_CHAT } from '../../../constant/mqtt';
9
+ import { TOPIC_DETAIL_CHAT, TOPIC_PLIVO_SMS } from '../../../constant/mqtt';
10
10
  import { MessageState } from '../../../constant/message';
11
11
  import { publicTopicConversationUpdate } from '../../../utils/chat/conversation';
12
12
  const props = withDefaults(defineProps(), {});
13
13
  const emit = defineEmits();
14
+ const reversedList = computed(() => listMessage.value.slice().reverse());
14
15
  let page = 1;
15
16
  let pageCount = 1;
16
17
  let topic = '';
18
+ let topic_plivo_chat = '';
17
19
  const isLoading = ref(false);
18
20
  const infoUser = shallowRef(null);
19
21
  const listMessage = ref([]);
@@ -22,12 +24,13 @@ onMounted(() => { });
22
24
  onUnmounted(() => {
23
25
  handleDisconnectMqtt();
24
26
  });
25
- const showNewCustomer = ref(false);
26
27
  const handleConnectMqtt = async () => {
27
28
  try {
28
29
  await connectMqtt();
29
30
  topic = TOPIC_DETAIL_CHAT + infoUser.value?.conversation_id;
31
+ topic_plivo_chat = TOPIC_PLIVO_SMS + infoUser.value?.conversation_id;
30
32
  subscribeToTopic(topic);
33
+ subscribeToTopic(topic_plivo_chat);
31
34
  addHandleMqttMessage('chat-home', topic, mqttMessageHandler);
32
35
  }
33
36
  catch (error) {
@@ -35,14 +38,15 @@ const handleConnectMqtt = async () => {
35
38
  }
36
39
  };
37
40
  const handleDisconnectMqtt = async () => {
38
- const topic = TOPIC_DETAIL_CHAT + infoUser.value?.conversation_id;
39
41
  unsubscribeFromTopic(topic);
42
+ unsubscribeFromTopic(topic_plivo_chat);
40
43
  removeHandleMqttMessage('chat-home');
41
44
  };
42
45
  const mqttMessageHandler = (topic, message) => {
43
46
  if ((infoUser.value?.id && message?.sender_id?.toString() == infoUser.value?.id?.toString())) {
44
47
  const index = listMessage.value.findIndex((item) => item.id === message?.id);
45
48
  if (index < 0) {
49
+ // listMessage.value.unshift(message)
46
50
  listMessage.value.push(message);
47
51
  }
48
52
  else {
@@ -65,7 +69,8 @@ const handleGetMessage = async (option) => {
65
69
  chatMessageRef.value?.scrollBottom();
66
70
  }
67
71
  else {
68
- listMessage.value.unshift(...res.items);
72
+ listMessage.value.push(...res.items);
73
+ // listMessage.value.unshift(...res.items)
69
74
  }
70
75
  }
71
76
  }
@@ -119,7 +124,8 @@ const updateMessageItem = (id, data) => {
119
124
  };
120
125
  const handleSendMessage = async (data) => {
121
126
  try {
122
- listMessage.value.push({ ...data, state: MessageState.Sending });
127
+ // listMessage.value.push({ ...data, state: MessageState.Sending })
128
+ listMessage.value.unshift({ ...data, state: MessageState.Sending });
123
129
  publishMessage(topic, {
124
130
  ...data,
125
131
  state: MessageState.Sending
@@ -151,6 +157,7 @@ const handleSendMessage = async (data) => {
151
157
  : []
152
158
  });
153
159
  updateMessageItem(data.id, { state: MessageState.Sent });
160
+ chatMessageRef.value?.scrollBottom();
154
161
  publicTopicConversationUpdate({ message: data?.message ?? '', isSendImg: !!file_upload?.length, infoUser: infoUser.value });
155
162
  }
156
163
  catch (error) {
@@ -223,7 +230,7 @@ if (__VLS_ctx.listMessage?.length) {
223
230
  ...{ 'onCallBack': {} },
224
231
  ref: "chatMessageRef",
225
232
  data: (__VLS_ctx.infoUser),
226
- message: (__VLS_ctx.listMessage),
233
+ message: (__VLS_ctx.reversedList),
227
234
  ...{ class: "grow" },
228
235
  responsive: (__VLS_ctx.responsive),
229
236
  showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
@@ -233,7 +240,7 @@ if (__VLS_ctx.listMessage?.length) {
233
240
  ...{ 'onCallBack': {} },
234
241
  ref: "chatMessageRef",
235
242
  data: (__VLS_ctx.infoUser),
236
- message: (__VLS_ctx.listMessage),
243
+ message: (__VLS_ctx.reversedList),
237
244
  ...{ class: "grow" },
238
245
  responsive: (__VLS_ctx.responsive),
239
246
  showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
@@ -247,7 +254,7 @@ if (__VLS_ctx.listMessage?.length) {
247
254
  /** @type {typeof __VLS_ctx.chatMessageRef} */ ;
248
255
  var __VLS_14 = {};
249
256
  // @ts-ignore
250
- [infoUser, call, listMessage, responsive, page, pageCount, handleScrollTop, chatMessageRef,];
257
+ [infoUser, call, reversedList, responsive, page, pageCount, handleScrollTop, chatMessageRef,];
251
258
  var __VLS_9;
252
259
  }
253
260
  else if (!__VLS_ctx.isLoading) {
@@ -275,11 +282,13 @@ else {
275
282
  // @ts-ignore
276
283
  const __VLS_21 = __VLS_asFunctionalComponent(InputChat, new InputChat({
277
284
  ...{ 'onSendMessage': {} },
285
+ ...{ 'onFocus': {} },
278
286
  data: (__VLS_ctx.infoUser),
279
287
  ...{ class: "p-6" },
280
288
  }));
281
289
  const __VLS_22 = __VLS_21({
282
290
  ...{ 'onSendMessage': {} },
291
+ ...{ 'onFocus': {} },
283
292
  data: (__VLS_ctx.infoUser),
284
293
  ...{ class: "p-6" },
285
294
  }, ...__VLS_functionalComponentArgsRest(__VLS_21));
@@ -287,8 +296,12 @@ let __VLS_24;
287
296
  let __VLS_25;
288
297
  const __VLS_26 = ({ sendMessage: {} },
289
298
  { onSendMessage: (__VLS_ctx.handleSendMessage) });
290
- // @ts-ignore
291
- [infoUser, handleSendMessage,];
299
+ const __VLS_27 = ({ focus: {} },
300
+ { onFocus: (...[$event]) => {
301
+ __VLS_ctx.emit('inputFocus');
302
+ // @ts-ignore
303
+ [infoUser, handleSendMessage, emit,];
304
+ } });
292
305
  var __VLS_23;
293
306
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
294
307
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
@@ -8,6 +8,8 @@ import { dataProfile } from '../../../utils/chat/auth';
8
8
  import { computed, ref } from 'vue';
9
9
  import PopoverBase from '../../../components/chat/common/popover/PopoverBase.vue';
10
10
  import SwitchBase from '../../../components/chat/common/switch/SwitchBase.vue';
11
+ import { activePlivoMode } from '../../../utils/chat/message';
12
+ import BaseSpin from '../../../components/chat/common/spin/BaseSpin.vue';
11
13
  const props = withDefaults(defineProps(), {});
12
14
  const emit = defineEmits();
13
15
  const ChatModeOptions = [
@@ -19,6 +21,8 @@ const keyword = defineModel();
19
21
  let chatId = 1;
20
22
  const refInputImage = ref(null);
21
23
  const isLoadingImage = ref([]);
24
+ const activePlivoSms = ref(false);
25
+ const loading = ref(false);
22
26
  const chatInputRef = ref(null);
23
27
  const emojiOpen = ref(false);
24
28
  const mode = ref('0');
@@ -70,6 +74,20 @@ const onSelectEmoji = (value) => {
70
74
  emojiOpen.value = false;
71
75
  chatInputRef.value?.focus?.();
72
76
  };
77
+ const handleActivePlivoSmsChange = async (is_active) => {
78
+ try {
79
+ loading.value = true;
80
+ await activePlivoMode({ id: dataProfile.value?.id, is_sms: is_active ? 1 : 0 });
81
+ }
82
+ catch (e) {
83
+ activePlivoSms.value = !is_active;
84
+ console.log(e);
85
+ }
86
+ loading.value = false;
87
+ };
88
+ const handleInput = () => {
89
+ emit('focus');
90
+ };
73
91
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
74
92
  const __VLS_modelEmit = defineEmits();
75
93
  const __VLS_defaults = {};
@@ -91,16 +109,41 @@ if (__VLS_ctx.dataProfile?.user_type == 'tenant') {
91
109
  // @ts-ignore
92
110
  [dataProfile,];
93
111
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
94
- ...{ class: "mb-2" },
112
+ ...{ class: "flex gap-2 mb-2" },
95
113
  });
96
114
  /** @type {[typeof SwitchBase, ]} */ ;
97
115
  // @ts-ignore
98
116
  const __VLS_0 = __VLS_asFunctionalComponent(SwitchBase, new SwitchBase({
117
+ ...{ 'onChange': {} },
118
+ modelValue: (__VLS_ctx.activePlivoSms),
99
119
  label: "Active sms",
100
120
  }));
101
121
  const __VLS_1 = __VLS_0({
122
+ ...{ 'onChange': {} },
123
+ modelValue: (__VLS_ctx.activePlivoSms),
102
124
  label: "Active sms",
103
125
  }, ...__VLS_functionalComponentArgsRest(__VLS_0));
126
+ let __VLS_3;
127
+ let __VLS_4;
128
+ const __VLS_5 = ({ change: {} },
129
+ { onChange: (__VLS_ctx.handleActivePlivoSmsChange) });
130
+ // @ts-ignore
131
+ [activePlivoSms, handleActivePlivoSmsChange,];
132
+ var __VLS_2;
133
+ if (__VLS_ctx.loading) {
134
+ // @ts-ignore
135
+ [loading,];
136
+ /** @type {[typeof BaseSpin, ]} */ ;
137
+ // @ts-ignore
138
+ const __VLS_7 = __VLS_asFunctionalComponent(BaseSpin, new BaseSpin({
139
+ size: (24),
140
+ border: (3),
141
+ }));
142
+ const __VLS_8 = __VLS_7({
143
+ size: (24),
144
+ border: (3),
145
+ }, ...__VLS_functionalComponentArgsRest(__VLS_7));
146
+ }
104
147
  }
105
148
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
106
149
  ...{ class: "flex gap-2" },
@@ -114,6 +157,11 @@ __VLS_asFunctionalElement(__VLS_elements.input)({
114
157
  // @ts-ignore
115
158
  [handleSendMessage,];
116
159
  } },
160
+ ...{ onFocus: (...[$event]) => {
161
+ __VLS_ctx.handleInput();
162
+ // @ts-ignore
163
+ [handleInput,];
164
+ } },
117
165
  ...{ class: "w-full chat-input !rounded-xl h-11 px-4 border border-chat-haze-200" },
118
166
  ref: "chatInputRef",
119
167
  placeholder: "Send Message",
@@ -127,17 +175,17 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
127
175
  });
128
176
  /** @type {[typeof PopoverBase, typeof PopoverBase, ]} */ ;
129
177
  // @ts-ignore
130
- const __VLS_4 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
178
+ const __VLS_11 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
131
179
  open: (__VLS_ctx.emojiOpen),
132
180
  align: "end",
133
181
  side: "top",
134
182
  }));
135
- const __VLS_5 = __VLS_4({
183
+ const __VLS_12 = __VLS_11({
136
184
  open: (__VLS_ctx.emojiOpen),
137
185
  align: "end",
138
186
  side: "top",
139
- }, ...__VLS_functionalComponentArgsRest(__VLS_4));
140
- const { default: __VLS_7 } = __VLS_6.slots;
187
+ }, ...__VLS_functionalComponentArgsRest(__VLS_11));
188
+ const { default: __VLS_14 } = __VLS_13.slots;
141
189
  // @ts-ignore
142
190
  [emojiOpen,];
143
191
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
@@ -149,61 +197,61 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
149
197
  ...{ class: "h-11 w-10" },
150
198
  });
151
199
  {
152
- const { content: __VLS_8 } = __VLS_6.slots;
153
- const __VLS_9 = {}.EmojiPicker;
200
+ const { content: __VLS_15 } = __VLS_13.slots;
201
+ const __VLS_16 = {}.EmojiPicker;
154
202
  /** @type {[typeof __VLS_components.EmojiPicker, typeof __VLS_components.emojiPicker, ]} */ ;
155
203
  // @ts-ignore
156
204
  EmojiPicker;
157
205
  // @ts-ignore
158
- const __VLS_10 = __VLS_asFunctionalComponent(__VLS_9, new __VLS_9({
206
+ const __VLS_17 = __VLS_asFunctionalComponent(__VLS_16, new __VLS_16({
159
207
  ...{ 'onSelect': {} },
160
208
  ...{ class: "!w-[300px]" },
161
209
  native: (true),
162
210
  offset: (2),
163
211
  hideSearch: true,
164
212
  }));
165
- const __VLS_11 = __VLS_10({
213
+ const __VLS_18 = __VLS_17({
166
214
  ...{ 'onSelect': {} },
167
215
  ...{ class: "!w-[300px]" },
168
216
  native: (true),
169
217
  offset: (2),
170
218
  hideSearch: true,
171
- }, ...__VLS_functionalComponentArgsRest(__VLS_10));
172
- let __VLS_13;
173
- let __VLS_14;
174
- const __VLS_15 = ({ select: {} },
219
+ }, ...__VLS_functionalComponentArgsRest(__VLS_17));
220
+ let __VLS_20;
221
+ let __VLS_21;
222
+ const __VLS_22 = ({ select: {} },
175
223
  { onSelect: (__VLS_ctx.onSelectEmoji) });
176
224
  // @ts-ignore
177
225
  [onSelectEmoji,];
178
- var __VLS_12;
226
+ var __VLS_19;
179
227
  }
180
- var __VLS_6;
181
- const __VLS_17 = {}.EmojiPicker;
228
+ var __VLS_13;
229
+ const __VLS_24 = {}.EmojiPicker;
182
230
  /** @type {[typeof __VLS_components.EmojiPicker, typeof __VLS_components.emojiPicker, ]} */ ;
183
231
  // @ts-ignore
184
232
  EmojiPicker;
185
233
  // @ts-ignore
186
- const __VLS_18 = __VLS_asFunctionalComponent(__VLS_17, new __VLS_17({
234
+ const __VLS_25 = __VLS_asFunctionalComponent(__VLS_24, new __VLS_24({
187
235
  ...{ 'onSelect': {} },
188
236
  ...{ class: "opacity-0 pointer-events-none absolute" },
189
237
  native: (true),
190
238
  offset: (2),
191
239
  hideSearch: true,
192
240
  }));
193
- const __VLS_19 = __VLS_18({
241
+ const __VLS_26 = __VLS_25({
194
242
  ...{ 'onSelect': {} },
195
243
  ...{ class: "opacity-0 pointer-events-none absolute" },
196
244
  native: (true),
197
245
  offset: (2),
198
246
  hideSearch: true,
199
- }, ...__VLS_functionalComponentArgsRest(__VLS_18));
200
- let __VLS_21;
201
- let __VLS_22;
202
- const __VLS_23 = ({ select: {} },
247
+ }, ...__VLS_functionalComponentArgsRest(__VLS_25));
248
+ let __VLS_28;
249
+ let __VLS_29;
250
+ const __VLS_30 = ({ select: {} },
203
251
  { onSelect: (__VLS_ctx.onSelectEmoji) });
204
252
  // @ts-ignore
205
253
  [onSelectEmoji,];
206
- var __VLS_20;
254
+ var __VLS_27;
207
255
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
208
256
  ...{ onClick: (...[$event]) => {
209
257
  __VLS_ctx.handleSendMessage('message');
@@ -214,8 +262,8 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
214
262
  });
215
263
  /** @type {[typeof IconPlan, ]} */ ;
216
264
  // @ts-ignore
217
- const __VLS_25 = __VLS_asFunctionalComponent(IconPlan, new IconPlan({}));
218
- const __VLS_26 = __VLS_25({}, ...__VLS_functionalComponentArgsRest(__VLS_25));
265
+ const __VLS_32 = __VLS_asFunctionalComponent(IconPlan, new IconPlan({}));
266
+ const __VLS_33 = __VLS_32({}, ...__VLS_functionalComponentArgsRest(__VLS_32));
219
267
  __VLS_asFunctionalElement(__VLS_elements.label, __VLS_elements.label)({
220
268
  ...{ class: "shrink-0 cursor-pointer relative" },
221
269
  });
@@ -234,13 +282,15 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
234
282
  });
235
283
  /** @type {[typeof IconPlus, ]} */ ;
236
284
  // @ts-ignore
237
- const __VLS_29 = __VLS_asFunctionalComponent(IconPlus, new IconPlus({
285
+ const __VLS_36 = __VLS_asFunctionalComponent(IconPlus, new IconPlus({
238
286
  ...{ class: "text-white" },
239
287
  }));
240
- const __VLS_30 = __VLS_29({
288
+ const __VLS_37 = __VLS_36({
241
289
  ...{ class: "text-white" },
242
- }, ...__VLS_functionalComponentArgsRest(__VLS_29));
290
+ }, ...__VLS_functionalComponentArgsRest(__VLS_36));
243
291
  /** @type {__VLS_StyleScopedClasses['z-10']} */ ;
292
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
293
+ /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
244
294
  /** @type {__VLS_StyleScopedClasses['mb-2']} */ ;
245
295
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
246
296
  /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
@@ -75,9 +75,10 @@ let timeOut = null;
75
75
  let callType = 'call';
76
76
  let uuidEnd = '';
77
77
  onMounted(async () => {
78
- console.log(dataProfile.value);
79
78
  if (dataProfile.value?.tenant_phone) {
80
- await plivoLogin('');
79
+ // const token = await getPlivoAccessToken()
80
+ const token = '';
81
+ await plivoLogin(token);
81
82
  }
82
83
  });
83
84
  onUnmounted(() => {
@@ -1,12 +1,39 @@
1
1
  /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
+ import { computed } from 'vue';
3
+ const props = withDefaults(defineProps(), {
4
+ size: 48,
5
+ border: 5,
6
+ });
7
+ const style = computed(() => {
8
+ let result = {};
9
+ result.width = props.size + 'px';
10
+ result.height = props.size + 'px';
11
+ result.borderWidth = props.border + 'px';
12
+ return result;
13
+ });
2
14
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
3
- const __VLS_ctx = {};
15
+ const __VLS_defaults = {
16
+ size: 48,
17
+ border: 5,
18
+ };
19
+ const __VLS_ctx = {
20
+ ...{},
21
+ ...{},
22
+ ...{},
23
+ ...{},
24
+ };
4
25
  let __VLS_elements;
5
26
  let __VLS_components;
6
27
  let __VLS_directives;
7
28
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
8
29
  ...{ class: "loader" },
30
+ ...{ style: (__VLS_ctx.style) },
9
31
  });
32
+ // @ts-ignore
33
+ [style,];
10
34
  /** @type {__VLS_StyleScopedClasses['loader']} */ ;
11
- const __VLS_export = (await import('vue')).defineComponent({});
35
+ const __VLS_export = (await import('vue')).defineComponent({
36
+ __typeProps: {},
37
+ props: {},
38
+ });
12
39
  export default {};
@@ -1,6 +1,11 @@
1
1
  /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  const props = withDefaults(defineProps(), {});
3
+ const emit = defineEmits();
3
4
  const result = defineModel();
5
+ const handleClick = () => {
6
+ result.value = !result.value;
7
+ emit('change', result.value);
8
+ };
4
9
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
5
10
  const __VLS_modelEmit = defineEmits();
6
11
  const __VLS_defaults = {};
@@ -16,9 +21,9 @@ let __VLS_components;
16
21
  let __VLS_directives;
17
22
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
18
23
  ...{ onClick: (...[$event]) => {
19
- __VLS_ctx.result = !__VLS_ctx.result;
24
+ __VLS_ctx.handleClick();
20
25
  // @ts-ignore
21
- [result, result,];
26
+ [handleClick,];
22
27
  } },
23
28
  ...{ class: "flex items-center gap-2 cursor-pointer w-max" },
24
29
  });
@@ -51,6 +51,7 @@ export const useListConversations = (is_unknown) => {
51
51
  if ((data.is_unknown ?? 0) != is_unknown)
52
52
  return;
53
53
  getDataMqtt();
54
+ console.log(topic, data);
54
55
  if (topic === TOPIC_HOME[0] + dataProfile.value?.id) {
55
56
  const index = listConversations.value.findIndex((item) => item.id === data.id);
56
57
  const hasChatBox = listConversations.value.findIndex((item) => item.id === digibotId);
@@ -90,7 +91,7 @@ export const useListConversations = (is_unknown) => {
90
91
  const res = await getConversation({ ...params.value, is_unknown });
91
92
  if (option?.reset) {
92
93
  listConversations.value = [];
93
- if (is_unknown == 0)
94
+ if (is_unknown == 0 && dataProfile.value?.user_type == 'tenant')
94
95
  listConversations.value.push(digibotData);
95
96
  await nextTick();
96
97
  }