@phonghq/go-chat 1.0.35 → 1.0.38

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/dist/assets/icons/IconSms.vue.d.ts +2 -0
  2. package/dist/chat/page/home/ChatList.vue.d.ts +29 -0
  3. package/dist/composable/useError.d.ts +4 -0
  4. package/dist/composable/usePlivo.d.ts +4 -1
  5. package/dist/constant/mqtt.d.ts +2 -2
  6. package/dist/go-chat.es.js +23215 -23193
  7. package/dist/go-chat.umd.js +14 -13
  8. package/dist/style.css +1 -1
  9. package/dist/test/assets/icons/IconSms.vue.js +22 -0
  10. package/dist/test/chat/App.vue.js +111 -60
  11. package/dist/test/chat/page/home/ChatList.vue.js +34 -49
  12. package/dist/test/chat/page/home/ChatMessageItem.vue.js +5 -5
  13. package/dist/test/chat/page/home/Home.vue.js +5 -4
  14. package/dist/test/chat/page/home/HomeHeader.vue.js +81 -4
  15. package/dist/test/chat/page/home/InputChat.vue.js +22 -66
  16. package/dist/test/chat/page/home/NewCustomer.vue.js +3 -2
  17. package/dist/test/components/chat/ScrollEvent/ScrollEvent.vue.js +2 -0
  18. package/dist/test/components/chat/call/Calling.vue.js +46 -6
  19. package/dist/test/composable/useError.js +10 -0
  20. package/dist/test/composable/useListConversations.js +4 -1
  21. package/dist/test/composable/usePlivo.js +30 -23
  22. package/dist/test/constant/mqtt.js +4 -3
  23. package/dist/test/utils/chat/auth.js +11 -0
  24. package/dist/test/utils/chat/call.js +16 -0
  25. package/dist/test/utils/chat/conversation.js +3 -3
  26. package/dist/test/utils/string-helper.js +1 -1
  27. package/dist/types/chat/auth.d.ts +1 -0
  28. package/dist/types/message.d.ts +1 -0
  29. package/dist/utils/chat/auth.d.ts +5 -0
  30. package/dist/utils/chat/call.d.ts +4 -0
  31. package/package.json +1 -1
@@ -1,5 +1,4 @@
1
1
  import InputSearch from '../../../components/chat/common/input/InputSearch.vue';
2
- import IconPlus from '../../../assets/icons/IconPlus.vue';
3
2
  import { computed, ref } from 'vue';
4
3
  import Avatar from '../../../components/chat/customer/Avatar.vue';
5
4
  import ScrollEvent from '../../../components/chat/ScrollEvent/ScrollEvent.vue';
@@ -15,6 +14,7 @@ import { TIME_ZONE_UTC } from '../../../constant/datetime';
15
14
  import IconAiCheck from '../../../assets/icons/IconAiCheck.vue';
16
15
  import TabBase from '../../../components/chat/common/tab/TabBase.vue';
17
16
  import { useListConversations } from '../../../composable/useListConversations';
17
+ import { phoneNumberFormat } from '../../../utils/string-helper';
18
18
  dayjs.extend(updateLocale);
19
19
  dayjs.extend(relativeTime);
20
20
  dayjs.extend(utc);
@@ -61,12 +61,13 @@ const scrollEventRef = ref(null);
61
61
  const isLoadingSearch = ref(false);
62
62
  const getData = async (data, option) => {
63
63
  try {
64
+ const tab_value = option?.tab ?? activeTabs.value;
64
65
  if (!option?.hideLoading)
65
66
  isLoadingSearch.value = true;
66
- if (activeTabs.value == TAB_VALUE.ALL) {
67
+ if (tab_value == TAB_VALUE.ALL) {
67
68
  await getDataAll(data, option);
68
69
  }
69
- else if (activeTabs.value == TAB_VALUE.UNKNOWN) {
70
+ else if (tab_value == TAB_VALUE.UNKNOWN) {
70
71
  await getDataUnknown(data, option);
71
72
  }
72
73
  checkHasReceiveId();
@@ -148,19 +149,19 @@ const getTimeFromNow = (data) => {
148
149
  };
149
150
  const handleTabChange = async (tab) => {
150
151
  if (tab == TAB_VALUE.ALL && !listConversationsAll.value?.length) {
151
- await getData({}, { reset: true });
152
+ await getData({}, { reset: true, tab });
152
153
  }
153
154
  else if (tab == TAB_VALUE.UNKNOWN && !listConversationsUnknown.value?.length) {
154
- await getData({}, { reset: true });
155
+ await getData({}, { reset: true, tab });
155
156
  }
156
157
  checkHasReceiveId();
157
158
  };
158
159
  const getCurrentConversation = () => {
159
160
  return listConversations.value?.find(user => user.receiver_id == receiver_id.value);
160
161
  };
161
- // getData({}, { reset: true })
162
162
  handleTabChange(TAB_VALUE.ALL);
163
- const __VLS_exposed = { handleReadMessage, listConversationsAll, getCurrentConversation };
163
+ handleTabChange(TAB_VALUE.UNKNOWN);
164
+ const __VLS_exposed = { handleReadMessage, listConversationsAll, listConversationsUnknown, getCurrentConversation };
164
165
  defineExpose(__VLS_exposed);
165
166
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
166
167
  const __VLS_modelEmit = defineEmits();
@@ -202,66 +203,55 @@ const __VLS_5 = ({ search: {} },
202
203
  // @ts-ignore
203
204
  [responsive, keyword, handleSearch,];
204
205
  var __VLS_2;
205
- __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
206
- ...{ class: "shrink-0 h-11 w-11 rounded-full flex-center bg-[#C7DEFF]" },
207
- });
208
- /** @type {[typeof IconPlus, ]} */ ;
209
- // @ts-ignore
210
- const __VLS_7 = __VLS_asFunctionalComponent(IconPlus, new IconPlus({
211
- ...{ class: "text-[#004AB3]" },
212
- }));
213
- const __VLS_8 = __VLS_7({
214
- ...{ class: "text-[#004AB3]" },
215
- }, ...__VLS_functionalComponentArgsRest(__VLS_7));
216
206
  if (__VLS_ctx.dataProfile?.user_type == 'tenant') {
217
207
  // @ts-ignore
218
208
  [dataProfile,];
219
209
  /** @type {[typeof TabBase, ]} */ ;
220
210
  // @ts-ignore
221
- const __VLS_11 = __VLS_asFunctionalComponent(TabBase, new TabBase({
211
+ const __VLS_7 = __VLS_asFunctionalComponent(TabBase, new TabBase({
222
212
  ...{ 'onChange': {} },
223
213
  ...{ class: "shrink-0 px-6" },
224
214
  tabs: (__VLS_ctx.tabs),
225
215
  active: (__VLS_ctx.activeTabs),
226
216
  }));
227
- const __VLS_12 = __VLS_11({
217
+ const __VLS_8 = __VLS_7({
228
218
  ...{ 'onChange': {} },
229
219
  ...{ class: "shrink-0 px-6" },
230
220
  tabs: (__VLS_ctx.tabs),
231
221
  active: (__VLS_ctx.activeTabs),
232
- }, ...__VLS_functionalComponentArgsRest(__VLS_11));
233
- let __VLS_14;
234
- let __VLS_15;
235
- const __VLS_16 = ({ change: {} },
222
+ }, ...__VLS_functionalComponentArgsRest(__VLS_7));
223
+ let __VLS_10;
224
+ let __VLS_11;
225
+ const __VLS_12 = ({ change: {} },
236
226
  { onChange: (__VLS_ctx.handleTabChange) });
237
227
  // @ts-ignore
238
228
  [tabs, activeTabs, handleTabChange,];
239
- var __VLS_13;
229
+ var __VLS_9;
240
230
  }
241
231
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
242
232
  ...{ class: "grow relative overflow-hidden" },
243
233
  });
244
234
  /** @type {[typeof ScrollEvent, typeof ScrollEvent, ]} */ ;
245
235
  // @ts-ignore
246
- const __VLS_18 = __VLS_asFunctionalComponent(ScrollEvent, new ScrollEvent({
236
+ const __VLS_14 = __VLS_asFunctionalComponent(ScrollEvent, new ScrollEvent({
247
237
  ...{ 'onGetDataBottom': {} },
248
238
  ref: "scrollEventRef",
249
239
  ...{ class: "h-full overflow-auto" },
250
240
  bottom: true,
251
241
  }));
252
- const __VLS_19 = __VLS_18({
242
+ const __VLS_15 = __VLS_14({
253
243
  ...{ 'onGetDataBottom': {} },
254
244
  ref: "scrollEventRef",
255
245
  ...{ class: "h-full overflow-auto" },
256
246
  bottom: true,
257
- }, ...__VLS_functionalComponentArgsRest(__VLS_18));
258
- let __VLS_21;
259
- let __VLS_22;
260
- const __VLS_23 = ({ getDataBottom: {} },
247
+ }, ...__VLS_functionalComponentArgsRest(__VLS_14));
248
+ let __VLS_17;
249
+ let __VLS_18;
250
+ const __VLS_19 = ({ getDataBottom: {} },
261
251
  { onGetDataBottom: (__VLS_ctx.handleScroll) });
262
252
  /** @type {typeof __VLS_ctx.scrollEventRef} */ ;
263
- var __VLS_24 = {};
264
- const { default: __VLS_26 } = __VLS_20.slots;
253
+ var __VLS_20 = {};
254
+ const { default: __VLS_22 } = __VLS_16.slots;
265
255
  // @ts-ignore
266
256
  [handleScroll, scrollEventRef,];
267
257
  for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
@@ -284,20 +274,20 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
284
274
  [responsive, receiver_id,];
285
275
  /** @type {[typeof Avatar, ]} */ ;
286
276
  // @ts-ignore
287
- const __VLS_27 = __VLS_asFunctionalComponent(Avatar, new Avatar({
277
+ const __VLS_23 = __VLS_asFunctionalComponent(Avatar, new Avatar({
288
278
  id: (user.id),
289
279
  ...{ class: "shrink-0" },
290
280
  src: (user.avatar ?? ''),
291
281
  color: (user.color),
292
282
  name: (user.username ?? ''),
293
283
  }));
294
- const __VLS_28 = __VLS_27({
284
+ const __VLS_24 = __VLS_23({
295
285
  id: (user.id),
296
286
  ...{ class: "shrink-0" },
297
287
  src: (user.avatar ?? ''),
298
288
  color: (user.color),
299
289
  name: (user.username ?? ''),
300
- }, ...__VLS_functionalComponentArgsRest(__VLS_27));
290
+ }, ...__VLS_functionalComponentArgsRest(__VLS_23));
301
291
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
302
292
  ...{ class: "grow ml-3 overflow-hidden" },
303
293
  });
@@ -313,18 +303,20 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
313
303
  __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
314
304
  ...{ class: "truncate font-semibold" },
315
305
  });
316
- (user.username);
306
+ (user.username || __VLS_ctx.phoneNumberFormat(user.phone) || 'n/a');
307
+ // @ts-ignore
308
+ [phoneNumberFormat,];
317
309
  if (user.id == __VLS_ctx.digibotId) {
318
310
  // @ts-ignore
319
311
  [digibotId,];
320
312
  /** @type {[typeof IconAiCheck, ]} */ ;
321
313
  // @ts-ignore
322
- const __VLS_31 = __VLS_asFunctionalComponent(IconAiCheck, new IconAiCheck({
314
+ const __VLS_27 = __VLS_asFunctionalComponent(IconAiCheck, new IconAiCheck({
323
315
  ...{ class: "ml-2" },
324
316
  }));
325
- const __VLS_32 = __VLS_31({
317
+ const __VLS_28 = __VLS_27({
326
318
  ...{ class: "ml-2" },
327
- }, ...__VLS_functionalComponentArgsRest(__VLS_31));
319
+ }, ...__VLS_functionalComponentArgsRest(__VLS_27));
328
320
  }
329
321
  if (user.unread_count) {
330
322
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
@@ -347,7 +339,7 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
347
339
  // @ts-ignore
348
340
  [getTimeFromNow,];
349
341
  }
350
- var __VLS_20;
342
+ var __VLS_16;
351
343
  /** @type {__VLS_StyleScopedClasses['']} */ ;
352
344
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
353
345
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
@@ -363,13 +355,6 @@ var __VLS_20;
363
355
  /** @type {__VLS_StyleScopedClasses['h-11']} */ ;
364
356
  /** @type {__VLS_StyleScopedClasses['grow']} */ ;
365
357
  /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
366
- /** @type {__VLS_StyleScopedClasses['h-11']} */ ;
367
- /** @type {__VLS_StyleScopedClasses['w-11']} */ ;
368
- /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
369
- /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
370
- /** @type {__VLS_StyleScopedClasses['bg-[#C7DEFF]']} */ ;
371
- /** @type {__VLS_StyleScopedClasses['text-[#004AB3]']} */ ;
372
- /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
373
358
  /** @type {__VLS_StyleScopedClasses['px-6']} */ ;
374
359
  /** @type {__VLS_StyleScopedClasses['grow']} */ ;
375
360
  /** @type {__VLS_StyleScopedClasses['relative']} */ ;
@@ -421,7 +406,7 @@ var __VLS_20;
421
406
  /** @type {__VLS_StyleScopedClasses['w-[80px]']} */ ;
422
407
  /** @type {__VLS_StyleScopedClasses['md:w-[130px]']} */ ;
423
408
  // @ts-ignore
424
- var __VLS_25 = __VLS_24;
409
+ var __VLS_21 = __VLS_20;
425
410
  const __VLS_export = (await import('vue')).defineComponent({
426
411
  setup: () => (__VLS_exposed),
427
412
  __typeEmits: {},
@@ -87,9 +87,9 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
87
87
  });
88
88
  // @ts-ignore
89
89
  [shouldShowAvatar, isMyMessage, isMyMessage,];
90
- if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending) {
90
+ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyMessage) {
91
91
  // @ts-ignore
92
- [message, MessageState,];
92
+ [isMyMessage, message, MessageState,];
93
93
  if (!__VLS_ctx.isMyMessage) {
94
94
  // @ts-ignore
95
95
  [isMyMessage,];
@@ -133,13 +133,13 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending) {
133
133
  'rounded-bl-none': !__VLS_ctx.isEndMessage && !__VLS_ctx.isMyMessage,
134
134
  'rounded-tr-none': !__VLS_ctx.shouldShowAvatar && __VLS_ctx.isMyMessage,
135
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,
136
+ '!text-[#14532D] !bg-[#d4f8d4]': (__VLS_ctx.message.message_uuid && !__VLS_ctx.message.is_call) || __VLS_ctx.message.is_sms,
137
137
  'bg-[#D0DFEC] text-[#266699]': __VLS_ctx.isMyMessage,
138
138
  'bg-[#E4E4E4D4] text-chat-haze-600 w-max ': !__VLS_ctx.isMyMessage
139
139
  }) },
140
140
  });
141
141
  // @ts-ignore
142
- [shouldShowAvatar, shouldShowAvatar, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, message, message, isEndMessage, isEndMessage,];
142
+ [shouldShowAvatar, shouldShowAvatar, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, message, message, message, isEndMessage, isEndMessage,];
143
143
  if (__VLS_ctx.message.is_call == 1) {
144
144
  // @ts-ignore
145
145
  [message,];
@@ -195,7 +195,7 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending) {
195
195
  [message, getCallDuration,];
196
196
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
197
197
  ...{ onClick: (...[$event]) => {
198
- if (!(__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending))
198
+ if (!(__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyMessage))
199
199
  return;
200
200
  if (!(__VLS_ctx.message.is_call == 1))
201
201
  return;
@@ -32,9 +32,8 @@ const handleConnectMqtt = async () => {
32
32
  topic_plivo_chat = TOPIC_PLIVO_SMS + infoUser.value?.conversation_id;
33
33
  subscribeToTopic(topic);
34
34
  subscribeToTopic(topic_plivo_chat);
35
- // console.log(topic)
36
- // console.log(topic_plivo_chat)
37
35
  addHandleMqttMessage('chat-home', topic, mqttMessageHandler);
36
+ addHandleMqttMessage('chat-home-1', topic_plivo_chat, mqttMessageHandler);
38
37
  }
39
38
  catch (error) {
40
39
  console.error(error);
@@ -44,10 +43,11 @@ const handleDisconnectMqtt = async () => {
44
43
  unsubscribeFromTopic(topic);
45
44
  unsubscribeFromTopic(topic_plivo_chat);
46
45
  removeHandleMqttMessage('chat-home');
46
+ removeHandleMqttMessage('chat-home-1');
47
47
  };
48
48
  const mqttMessageHandler = (topic, message) => {
49
- console.log(message);
50
- if ((infoUser.value?.id && message?.sender_id?.toString() == infoUser.value?.id?.toString())) {
49
+ if ((infoUser.value?.id && message?.sender_id?.toString() == infoUser.value?.id?.toString())
50
+ || (infoUser.value?.id && message?.receiver_id?.toString() == infoUser.value?.id?.toString())) {
51
51
  const index = listMessage.value.findIndex((item) => item.id === message?.id);
52
52
  if (index < 0) {
53
53
  listMessage.value.unshift(message);
@@ -132,6 +132,7 @@ const handleSendMessage = async (data) => {
132
132
  try {
133
133
  // listMessage.value.push({ ...data, state: MessageState.Sending })
134
134
  listMessage.value.unshift({ ...data, state: MessageState.Sending });
135
+ await nextTick();
135
136
  publishMessage(topic, {
136
137
  ...data,
137
138
  state: MessageState.Sending
@@ -7,8 +7,15 @@ import { user } from '../../../utils/chat/user';
7
7
  import { dataProfile } from '../../../utils/chat/auth';
8
8
  import { digibotId } from '../../../composable/useDigibot';
9
9
  import IconArrowLeft from '../../../assets/icons/IconArrowLeft.vue';
10
+ import { phoneNumberFormat } from '../../../utils/string-helper';
11
+ import IconSms from '../../../assets/icons/IconSms.vue';
12
+ import { activePlivoMode } from '../../..//utils/chat/message';
13
+ import { ref } from 'vue';
14
+ import ButtonBase from '../../../components/common/button/ButtonBase.vue';
10
15
  const props = withDefaults(defineProps(), {});
11
16
  const emit = defineEmits();
17
+ const activePlivoSms = ref(dataProfile.value?.is_sms_active == 1);
18
+ const loading = ref(false);
12
19
  const goToViewUser = () => {
13
20
  if (props.data?.id == digibotId.toString())
14
21
  return;
@@ -17,6 +24,21 @@ const goToViewUser = () => {
17
24
  routerPush(PAGE.CUSTOMER_DETAIL);
18
25
  }
19
26
  };
27
+ const handleActivePlivoSmsChange = async (is_active) => {
28
+ return;
29
+ try {
30
+ loading.value = true;
31
+ await activePlivoMode({ id: dataProfile.value?.id, is_sms: is_active ? 1 : 0 });
32
+ if (dataProfile.value != null)
33
+ dataProfile.value.is_sms_active = (is_active ? 1 : 0);
34
+ activePlivoSms.value = is_active;
35
+ }
36
+ catch (e) {
37
+ activePlivoSms.value = !is_active;
38
+ console.log(e);
39
+ }
40
+ loading.value = false;
41
+ };
20
42
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
21
43
  const __VLS_defaults = {};
22
44
  const __VLS_ctx = {
@@ -99,9 +121,53 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
99
121
  __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
100
122
  ...{ class: "font-semibold truncate" },
101
123
  });
102
- (__VLS_ctx.data?.username ?? 'n/a');
124
+ (__VLS_ctx.data?.username || __VLS_ctx.phoneNumberFormat(__VLS_ctx.data?.phone ?? '') || 'n/a');
103
125
  // @ts-ignore
104
- [data,];
126
+ [data, data, phoneNumberFormat,];
127
+ if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant') {
128
+ // @ts-ignore
129
+ [dataProfile, data, data, digibotId,];
130
+ /** @type {[typeof ButtonBase, typeof ButtonBase, ]} */ ;
131
+ // @ts-ignore
132
+ const __VLS_11 = __VLS_asFunctionalComponent(ButtonBase, new ButtonBase({
133
+ ...{ 'onClick': {} },
134
+ type: (__VLS_ctx.activePlivoSms ? 'success' : 'danger'),
135
+ loading: (__VLS_ctx.loading),
136
+ ...{ class: "shrink-0 px-1 flex-center gap-2 text-white font-semibold w-9 md:w-[140px] h-9" },
137
+ }));
138
+ const __VLS_12 = __VLS_11({
139
+ ...{ 'onClick': {} },
140
+ type: (__VLS_ctx.activePlivoSms ? 'success' : 'danger'),
141
+ loading: (__VLS_ctx.loading),
142
+ ...{ class: "shrink-0 px-1 flex-center gap-2 text-white font-semibold w-9 md:w-[140px] h-9" },
143
+ }, ...__VLS_functionalComponentArgsRest(__VLS_11));
144
+ let __VLS_14;
145
+ let __VLS_15;
146
+ const __VLS_16 = ({ click: {} },
147
+ { onClick: (...[$event]) => {
148
+ if (!(__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant'))
149
+ return;
150
+ __VLS_ctx.handleActivePlivoSmsChange(!__VLS_ctx.activePlivoSms);
151
+ // @ts-ignore
152
+ [activePlivoSms, activePlivoSms, loading, handleActivePlivoSmsChange,];
153
+ } });
154
+ const { default: __VLS_17 } = __VLS_13.slots;
155
+ /** @type {[typeof IconSms, ]} */ ;
156
+ // @ts-ignore
157
+ const __VLS_18 = __VLS_asFunctionalComponent(IconSms, new IconSms({}));
158
+ const __VLS_19 = __VLS_18({}, ...__VLS_functionalComponentArgsRest(__VLS_18));
159
+ if (__VLS_ctx.responsive != 'mobile') {
160
+ // @ts-ignore
161
+ [responsive,];
162
+ __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
163
+ ...{ class: "hidden md:block" },
164
+ });
165
+ (__VLS_ctx.activePlivoSms ? 'ON' : 'OFF');
166
+ // @ts-ignore
167
+ [activePlivoSms,];
168
+ }
169
+ var __VLS_13;
170
+ }
105
171
  if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant') {
106
172
  // @ts-ignore
107
173
  [dataProfile, data, data, digibotId,];
@@ -117,8 +183,8 @@ if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() &
117
183
  });
118
184
  /** @type {[typeof IconPhone, ]} */ ;
119
185
  // @ts-ignore
120
- const __VLS_11 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({}));
121
- const __VLS_12 = __VLS_11({}, ...__VLS_functionalComponentArgsRest(__VLS_11));
186
+ const __VLS_22 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({}));
187
+ const __VLS_23 = __VLS_22({}, ...__VLS_functionalComponentArgsRest(__VLS_22));
122
188
  }
123
189
  /** @type {__VLS_StyleScopedClasses['px-8']} */ ;
124
190
  /** @type {__VLS_StyleScopedClasses['pb-4']} */ ;
@@ -147,6 +213,17 @@ if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() &
147
213
  /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
148
214
  /** @type {__VLS_StyleScopedClasses['truncate']} */ ;
149
215
  /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
216
+ /** @type {__VLS_StyleScopedClasses['px-1']} */ ;
217
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
218
+ /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
219
+ /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
220
+ /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
221
+ /** @type {__VLS_StyleScopedClasses['w-9']} */ ;
222
+ /** @type {__VLS_StyleScopedClasses['md:w-[140px]']} */ ;
223
+ /** @type {__VLS_StyleScopedClasses['h-9']} */ ;
224
+ /** @type {__VLS_StyleScopedClasses['hidden']} */ ;
225
+ /** @type {__VLS_StyleScopedClasses['md:block']} */ ;
226
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
150
227
  /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
151
228
  /** @type {__VLS_StyleScopedClasses['text-[#0051E6]']} */ ;
152
229
  /** @type {__VLS_StyleScopedClasses['bg-chat-haze-200']} */ ;
@@ -8,9 +8,7 @@ import { DATE_FORMATS, TIME_ZONE_UTC } from '../../../constant/datetime';
8
8
  import { dataProfile } from '../../../utils/chat/auth';
9
9
  import { computed, ref } from 'vue';
10
10
  import PopoverBase from '../../../components/chat/common/popover/PopoverBase.vue';
11
- import SwitchBase from '../../../components/chat/common/switch/SwitchBase.vue';
12
11
  import { activePlivoMode } from '../../../utils/chat/message';
13
- import BaseSpin from '../../../components/chat/common/spin/BaseSpin.vue';
14
12
  const props = withDefaults(defineProps(), {});
15
13
  const emit = defineEmits();
16
14
  const ChatModeOptions = [
@@ -49,14 +47,15 @@ const handleSendMessage = async (type) => {
49
47
  chatId++;
50
48
  const id = props.data?.id.toString() + '-' + chatId;
51
49
  const data = {
52
- conversation_id: 135,
50
+ conversation_id: props.data?.conversation_id,
53
51
  created_at: dayjs().tz(TIME_ZONE_UTC).format(DATE_FORMATS['DATE_FORMAT_FULL']),
54
52
  id,
55
53
  message: messageContent,
56
54
  receiver_id: props.data?.id || 0,
57
55
  sender_id: dataProfile.value?.id,
58
56
  status: 'read',
59
- attachments: attachments
57
+ attachments: attachments,
58
+ is_sms: dataProfile.value?.is_sms_active,
60
59
  };
61
60
  emit('sendMessage', data);
62
61
  };
@@ -126,46 +125,6 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
126
125
  ...{ class: "z-10" },
127
126
  ...{ style: {} },
128
127
  });
129
- if (__VLS_ctx.dataProfile?.user_type == 'tenant') {
130
- // @ts-ignore
131
- [dataProfile,];
132
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
133
- ...{ class: "flex gap-2 mb-2" },
134
- });
135
- /** @type {[typeof SwitchBase, ]} */ ;
136
- // @ts-ignore
137
- const __VLS_0 = __VLS_asFunctionalComponent(SwitchBase, new SwitchBase({
138
- ...{ 'onChange': {} },
139
- modelValue: (__VLS_ctx.activePlivoSms),
140
- label: "Active sms",
141
- }));
142
- const __VLS_1 = __VLS_0({
143
- ...{ 'onChange': {} },
144
- modelValue: (__VLS_ctx.activePlivoSms),
145
- label: "Active sms",
146
- }, ...__VLS_functionalComponentArgsRest(__VLS_0));
147
- let __VLS_3;
148
- let __VLS_4;
149
- const __VLS_5 = ({ change: {} },
150
- { onChange: (__VLS_ctx.handleActivePlivoSmsChange) });
151
- // @ts-ignore
152
- [activePlivoSms, handleActivePlivoSmsChange,];
153
- var __VLS_2;
154
- if (__VLS_ctx.loading) {
155
- // @ts-ignore
156
- [loading,];
157
- /** @type {[typeof BaseSpin, ]} */ ;
158
- // @ts-ignore
159
- const __VLS_7 = __VLS_asFunctionalComponent(BaseSpin, new BaseSpin({
160
- size: (24),
161
- border: (3),
162
- }));
163
- const __VLS_8 = __VLS_7({
164
- size: (24),
165
- border: (3),
166
- }, ...__VLS_functionalComponentArgsRest(__VLS_7));
167
- }
168
- }
169
128
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
170
129
  ...{ class: "flex gap-2 items-end h-max" },
171
130
  });
@@ -202,17 +161,17 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
202
161
  });
203
162
  /** @type {[typeof PopoverBase, typeof PopoverBase, ]} */ ;
204
163
  // @ts-ignore
205
- const __VLS_11 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
164
+ const __VLS_0 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
206
165
  open: (__VLS_ctx.emojiOpen),
207
166
  align: "end",
208
167
  side: "top",
209
168
  }));
210
- const __VLS_12 = __VLS_11({
169
+ const __VLS_1 = __VLS_0({
211
170
  open: (__VLS_ctx.emojiOpen),
212
171
  align: "end",
213
172
  side: "top",
214
- }, ...__VLS_functionalComponentArgsRest(__VLS_11));
215
- const { default: __VLS_14 } = __VLS_13.slots;
173
+ }, ...__VLS_functionalComponentArgsRest(__VLS_0));
174
+ const { default: __VLS_3 } = __VLS_2.slots;
216
175
  // @ts-ignore
217
176
  [emojiOpen,];
218
177
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
@@ -224,35 +183,35 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
224
183
  ...{ class: "h-11 w-10" },
225
184
  });
226
185
  {
227
- const { content: __VLS_15 } = __VLS_13.slots;
228
- const __VLS_16 = {}.EmojiPicker;
186
+ const { content: __VLS_4 } = __VLS_2.slots;
187
+ const __VLS_5 = {}.EmojiPicker;
229
188
  /** @type {[typeof __VLS_components.EmojiPicker, typeof __VLS_components.emojiPicker, ]} */ ;
230
189
  // @ts-ignore
231
190
  EmojiPicker;
232
191
  // @ts-ignore
233
- const __VLS_17 = __VLS_asFunctionalComponent(__VLS_16, new __VLS_16({
192
+ const __VLS_6 = __VLS_asFunctionalComponent(__VLS_5, new __VLS_5({
234
193
  ...{ 'onSelect': {} },
235
194
  ...{ class: "!w-[300px]" },
236
195
  native: (true),
237
196
  offset: (2),
238
197
  hideSearch: true,
239
198
  }));
240
- const __VLS_18 = __VLS_17({
199
+ const __VLS_7 = __VLS_6({
241
200
  ...{ 'onSelect': {} },
242
201
  ...{ class: "!w-[300px]" },
243
202
  native: (true),
244
203
  offset: (2),
245
204
  hideSearch: true,
246
- }, ...__VLS_functionalComponentArgsRest(__VLS_17));
247
- let __VLS_20;
248
- let __VLS_21;
249
- const __VLS_22 = ({ select: {} },
205
+ }, ...__VLS_functionalComponentArgsRest(__VLS_6));
206
+ let __VLS_9;
207
+ let __VLS_10;
208
+ const __VLS_11 = ({ select: {} },
250
209
  { onSelect: (__VLS_ctx.onSelectEmoji) });
251
210
  // @ts-ignore
252
211
  [onSelectEmoji,];
253
- var __VLS_19;
212
+ var __VLS_8;
254
213
  }
255
- var __VLS_13;
214
+ var __VLS_2;
256
215
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
257
216
  ...{ onClick: (...[$event]) => {
258
217
  __VLS_ctx.handleSendMessage('message');
@@ -263,8 +222,8 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
263
222
  });
264
223
  /** @type {[typeof IconPlan, ]} */ ;
265
224
  // @ts-ignore
266
- const __VLS_24 = __VLS_asFunctionalComponent(IconPlan, new IconPlan({}));
267
- const __VLS_25 = __VLS_24({}, ...__VLS_functionalComponentArgsRest(__VLS_24));
225
+ const __VLS_13 = __VLS_asFunctionalComponent(IconPlan, new IconPlan({}));
226
+ const __VLS_14 = __VLS_13({}, ...__VLS_functionalComponentArgsRest(__VLS_13));
268
227
  __VLS_asFunctionalElement(__VLS_elements.label, __VLS_elements.label)({
269
228
  ...{ class: "shrink-0 cursor-pointer relative -translate-y-1" },
270
229
  });
@@ -283,18 +242,15 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
283
242
  });
284
243
  /** @type {[typeof IconPlus, ]} */ ;
285
244
  // @ts-ignore
286
- const __VLS_28 = __VLS_asFunctionalComponent(IconPlus, new IconPlus({
245
+ const __VLS_17 = __VLS_asFunctionalComponent(IconPlus, new IconPlus({
287
246
  ...{ class: "text-white" },
288
247
  }));
289
- const __VLS_29 = __VLS_28({
248
+ const __VLS_18 = __VLS_17({
290
249
  ...{ class: "text-white" },
291
- }, ...__VLS_functionalComponentArgsRest(__VLS_28));
250
+ }, ...__VLS_functionalComponentArgsRest(__VLS_17));
292
251
  /** @type {__VLS_StyleScopedClasses['z-10']} */ ;
293
252
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
294
253
  /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
295
- /** @type {__VLS_StyleScopedClasses['mb-2']} */ ;
296
- /** @type {__VLS_StyleScopedClasses['flex']} */ ;
297
- /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
298
254
  /** @type {__VLS_StyleScopedClasses['items-end']} */ ;
299
255
  /** @type {__VLS_StyleScopedClasses['h-max']} */ ;
300
256
  /** @type {__VLS_StyleScopedClasses['relative']} */ ;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import Avatar from '../../../components/chat/customer/Avatar.vue';
3
+ import { phoneNumberFormat } from '../../../utils/string-helper';
3
4
  const props = withDefaults(defineProps(), {});
4
5
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
5
6
  const __VLS_defaults = {};
@@ -41,9 +42,9 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
41
42
  __VLS_asFunctionalElement(__VLS_elements.h2, __VLS_elements.h2)({
42
43
  ...{ class: "text-2xl font-semibold" },
43
44
  });
44
- (__VLS_ctx.data?.username ?? 'n/a');
45
+ (__VLS_ctx.data?.username || __VLS_ctx.phoneNumberFormat(__VLS_ctx.data?.phone ?? '') || 'n/a');
45
46
  // @ts-ignore
46
- [data,];
47
+ [data, data, phoneNumberFormat,];
47
48
  __VLS_asFunctionalElement(__VLS_elements.img)({
48
49
  src: "../../../assets/images/icons/new-customer.png",
49
50
  });
@@ -107,6 +107,8 @@ const hideLoading = () => {
107
107
  loadingTop.value = false;
108
108
  };
109
109
  const handleScroll = (event, el) => {
110
+ if (props.disabled)
111
+ return;
110
112
  const scrollTop = el.scrollTop;
111
113
  const scrollHeight = el.scrollHeight;
112
114
  const clientHeight = el.clientHeight;