@phonghq/go-chat 1.0.25 → 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 (31) 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/ScrollEvent/ScrollEvent.vue.d.ts +1 -0
  5. package/dist/components/chat/common/spin/BaseSpin.vue.d.ts +8 -1
  6. package/dist/components/chat/common/switch/SwitchBase.vue.d.ts +3 -0
  7. package/dist/components/common/button/ButtonBase.vue.d.ts +1 -1
  8. package/dist/components/common/drawer/DrawerBase.vue.d.ts +1 -1
  9. package/dist/constant/mqtt.d.ts +1 -0
  10. package/dist/go-chat.es.js +7244 -7206
  11. package/dist/go-chat.umd.js +12 -12
  12. package/dist/style.css +1 -1
  13. package/dist/test/chat/App.vue.js +79 -67
  14. package/dist/test/chat/page/customer-appointment/CustomerAppointment.vue.js +3 -3
  15. package/dist/test/chat/page/home/ChatList.vue.js +8 -112
  16. package/dist/test/chat/page/home/ChatMessage.vue.js +3 -4
  17. package/dist/test/chat/page/home/Home.vue.js +26 -15
  18. package/dist/test/chat/page/home/InputChat.vue.js +78 -28
  19. package/dist/test/components/chat/call/Calling.vue.js +3 -1
  20. package/dist/test/components/chat/common/spin/BaseSpin.vue.js +29 -2
  21. package/dist/test/components/chat/common/switch/SwitchBase.vue.js +7 -2
  22. package/dist/test/composable/useListConversations.js +2 -1
  23. package/dist/test/composable/usePlivo.js +5 -2
  24. package/dist/test/constant/mqtt.js +1 -0
  25. package/dist/test/utils/chat/call.js +4 -3
  26. package/dist/test/utils/chat/conversation.js +1 -1
  27. package/dist/test/utils/chat/message.js +4 -0
  28. package/dist/utils/chat/message.d.ts +4 -0
  29. package/package.json +1 -1
  30. package/dist/assets/icons/IconSetting.vue.d.ts +0 -2
  31. 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']} */ ;
@@ -88,7 +88,7 @@ if (__VLS_ctx.showNewCustomer) {
88
88
  // @ts-ignore
89
89
  [showNewCustomer,];
90
90
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
91
- ...{ class: "shrink-0 h-[500px]" },
91
+ ...{ class: "shrink-0 h-[500px] chat-padding-page" },
92
92
  });
93
93
  /** @type {[typeof NewCustomer, ]} */ ;
94
94
  // @ts-ignore
@@ -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
  }
@@ -157,6 +155,7 @@ var __VLS_2;
157
155
  /** @type {__VLS_StyleScopedClasses['overflow-auto']} */ ;
158
156
  /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
159
157
  /** @type {__VLS_StyleScopedClasses['h-[500px]']} */ ;
158
+ /** @type {__VLS_StyleScopedClasses['chat-padding-page']} */ ;
160
159
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
161
160
  /** @type {__VLS_StyleScopedClasses['chat-padding-page']} */ ;
162
161
  // @ts-ignore
@@ -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,15 +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
- console.log(message);
44
46
  if ((infoUser.value?.id && message?.sender_id?.toString() == infoUser.value?.id?.toString())) {
45
47
  const index = listMessage.value.findIndex((item) => item.id === message?.id);
46
48
  if (index < 0) {
49
+ // listMessage.value.unshift(message)
47
50
  listMessage.value.push(message);
48
51
  }
49
52
  else {
@@ -51,12 +54,11 @@ const mqttMessageHandler = (topic, message) => {
51
54
  }
52
55
  chatMessageRef.value?.scrollBottom();
53
56
  }
54
- console.log(listMessage.value);
55
57
  };
56
58
  const handleGetMessage = async (option) => {
57
59
  try {
58
60
  const id = props.receiverId;
59
- const params = { page: page, receiver_id: props.receiverId };
61
+ const params = { page: option?.resetList ? 1 : page, receiver_id: props.receiverId };
60
62
  let res = await getMessage(params);
61
63
  res.items = res.items.reverse();
62
64
  page = res._meta?.currentPage || 1;
@@ -67,7 +69,8 @@ const handleGetMessage = async (option) => {
67
69
  chatMessageRef.value?.scrollBottom();
68
70
  }
69
71
  else {
70
- listMessage.value.unshift(...res.items);
72
+ listMessage.value.push(...res.items);
73
+ // listMessage.value.unshift(...res.items)
71
74
  }
72
75
  }
73
76
  }
@@ -100,7 +103,7 @@ const getData = async (data) => {
100
103
  isLoading.value = true;
101
104
  listMessage.value = [];
102
105
  handleGetDetailReceiver(data);
103
- await Promise.allSettled([handleGetMessage()]);
106
+ await Promise.allSettled([handleGetMessage({ resetList: true })]);
104
107
  // readMessages(infoUser.value?.conversation_id)
105
108
  await nextTick();
106
109
  chatMessageRef.value?.scrollBottom();
@@ -121,7 +124,8 @@ const updateMessageItem = (id, data) => {
121
124
  };
122
125
  const handleSendMessage = async (data) => {
123
126
  try {
124
- listMessage.value.push({ ...data, state: MessageState.Sending });
127
+ // listMessage.value.push({ ...data, state: MessageState.Sending })
128
+ listMessage.value.unshift({ ...data, state: MessageState.Sending });
125
129
  publishMessage(topic, {
126
130
  ...data,
127
131
  state: MessageState.Sending
@@ -153,6 +157,7 @@ const handleSendMessage = async (data) => {
153
157
  : []
154
158
  });
155
159
  updateMessageItem(data.id, { state: MessageState.Sent });
160
+ chatMessageRef.value?.scrollBottom();
156
161
  publicTopicConversationUpdate({ message: data?.message ?? '', isSendImg: !!file_upload?.length, infoUser: infoUser.value });
157
162
  }
158
163
  catch (error) {
@@ -225,7 +230,7 @@ if (__VLS_ctx.listMessage?.length) {
225
230
  ...{ 'onCallBack': {} },
226
231
  ref: "chatMessageRef",
227
232
  data: (__VLS_ctx.infoUser),
228
- message: (__VLS_ctx.listMessage),
233
+ message: (__VLS_ctx.reversedList),
229
234
  ...{ class: "grow" },
230
235
  responsive: (__VLS_ctx.responsive),
231
236
  showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
@@ -235,7 +240,7 @@ if (__VLS_ctx.listMessage?.length) {
235
240
  ...{ 'onCallBack': {} },
236
241
  ref: "chatMessageRef",
237
242
  data: (__VLS_ctx.infoUser),
238
- message: (__VLS_ctx.listMessage),
243
+ message: (__VLS_ctx.reversedList),
239
244
  ...{ class: "grow" },
240
245
  responsive: (__VLS_ctx.responsive),
241
246
  showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
@@ -249,7 +254,7 @@ if (__VLS_ctx.listMessage?.length) {
249
254
  /** @type {typeof __VLS_ctx.chatMessageRef} */ ;
250
255
  var __VLS_14 = {};
251
256
  // @ts-ignore
252
- [infoUser, call, listMessage, responsive, page, pageCount, handleScrollTop, chatMessageRef,];
257
+ [infoUser, call, reversedList, responsive, page, pageCount, handleScrollTop, chatMessageRef,];
253
258
  var __VLS_9;
254
259
  }
255
260
  else if (!__VLS_ctx.isLoading) {
@@ -277,11 +282,13 @@ else {
277
282
  // @ts-ignore
278
283
  const __VLS_21 = __VLS_asFunctionalComponent(InputChat, new InputChat({
279
284
  ...{ 'onSendMessage': {} },
285
+ ...{ 'onFocus': {} },
280
286
  data: (__VLS_ctx.infoUser),
281
287
  ...{ class: "p-6" },
282
288
  }));
283
289
  const __VLS_22 = __VLS_21({
284
290
  ...{ 'onSendMessage': {} },
291
+ ...{ 'onFocus': {} },
285
292
  data: (__VLS_ctx.infoUser),
286
293
  ...{ class: "p-6" },
287
294
  }, ...__VLS_functionalComponentArgsRest(__VLS_21));
@@ -289,8 +296,12 @@ let __VLS_24;
289
296
  let __VLS_25;
290
297
  const __VLS_26 = ({ sendMessage: {} },
291
298
  { onSendMessage: (__VLS_ctx.handleSendMessage) });
292
- // @ts-ignore
293
- [infoUser, handleSendMessage,];
299
+ const __VLS_27 = ({ focus: {} },
300
+ { onFocus: (...[$event]) => {
301
+ __VLS_ctx.emit('inputFocus');
302
+ // @ts-ignore
303
+ [infoUser, handleSendMessage, emit,];
304
+ } });
294
305
  var __VLS_23;
295
306
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
296
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']} */ ;
@@ -76,7 +76,9 @@ let callType = 'call';
76
76
  let uuidEnd = '';
77
77
  onMounted(async () => {
78
78
  if (dataProfile.value?.tenant_phone) {
79
- await plivoLogin('');
79
+ // const token = await getPlivoAccessToken()
80
+ const token = '';
81
+ await plivoLogin(token);
80
82
  }
81
83
  });
82
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 {};