@phonghq/go-chat 1.0.34 → 1.0.36

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.
@@ -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);
@@ -202,66 +202,55 @@ const __VLS_5 = ({ search: {} },
202
202
  // @ts-ignore
203
203
  [responsive, keyword, handleSearch,];
204
204
  var __VLS_2;
205
- __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
206
- ...{ class: "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
205
  if (__VLS_ctx.dataProfile?.user_type == 'tenant') {
217
206
  // @ts-ignore
218
207
  [dataProfile,];
219
208
  /** @type {[typeof TabBase, ]} */ ;
220
209
  // @ts-ignore
221
- const __VLS_11 = __VLS_asFunctionalComponent(TabBase, new TabBase({
210
+ const __VLS_7 = __VLS_asFunctionalComponent(TabBase, new TabBase({
222
211
  ...{ 'onChange': {} },
223
212
  ...{ class: "shrink-0 px-6" },
224
213
  tabs: (__VLS_ctx.tabs),
225
214
  active: (__VLS_ctx.activeTabs),
226
215
  }));
227
- const __VLS_12 = __VLS_11({
216
+ const __VLS_8 = __VLS_7({
228
217
  ...{ 'onChange': {} },
229
218
  ...{ class: "shrink-0 px-6" },
230
219
  tabs: (__VLS_ctx.tabs),
231
220
  active: (__VLS_ctx.activeTabs),
232
- }, ...__VLS_functionalComponentArgsRest(__VLS_11));
233
- let __VLS_14;
234
- let __VLS_15;
235
- const __VLS_16 = ({ change: {} },
221
+ }, ...__VLS_functionalComponentArgsRest(__VLS_7));
222
+ let __VLS_10;
223
+ let __VLS_11;
224
+ const __VLS_12 = ({ change: {} },
236
225
  { onChange: (__VLS_ctx.handleTabChange) });
237
226
  // @ts-ignore
238
227
  [tabs, activeTabs, handleTabChange,];
239
- var __VLS_13;
228
+ var __VLS_9;
240
229
  }
241
230
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
242
231
  ...{ class: "grow relative overflow-hidden" },
243
232
  });
244
233
  /** @type {[typeof ScrollEvent, typeof ScrollEvent, ]} */ ;
245
234
  // @ts-ignore
246
- const __VLS_18 = __VLS_asFunctionalComponent(ScrollEvent, new ScrollEvent({
235
+ const __VLS_14 = __VLS_asFunctionalComponent(ScrollEvent, new ScrollEvent({
247
236
  ...{ 'onGetDataBottom': {} },
248
237
  ref: "scrollEventRef",
249
238
  ...{ class: "h-full overflow-auto" },
250
239
  bottom: true,
251
240
  }));
252
- const __VLS_19 = __VLS_18({
241
+ const __VLS_15 = __VLS_14({
253
242
  ...{ 'onGetDataBottom': {} },
254
243
  ref: "scrollEventRef",
255
244
  ...{ class: "h-full overflow-auto" },
256
245
  bottom: true,
257
- }, ...__VLS_functionalComponentArgsRest(__VLS_18));
258
- let __VLS_21;
259
- let __VLS_22;
260
- const __VLS_23 = ({ getDataBottom: {} },
246
+ }, ...__VLS_functionalComponentArgsRest(__VLS_14));
247
+ let __VLS_17;
248
+ let __VLS_18;
249
+ const __VLS_19 = ({ getDataBottom: {} },
261
250
  { onGetDataBottom: (__VLS_ctx.handleScroll) });
262
251
  /** @type {typeof __VLS_ctx.scrollEventRef} */ ;
263
- var __VLS_24 = {};
264
- const { default: __VLS_26 } = __VLS_20.slots;
252
+ var __VLS_20 = {};
253
+ const { default: __VLS_22 } = __VLS_16.slots;
265
254
  // @ts-ignore
266
255
  [handleScroll, scrollEventRef,];
267
256
  for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
@@ -284,20 +273,20 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
284
273
  [responsive, receiver_id,];
285
274
  /** @type {[typeof Avatar, ]} */ ;
286
275
  // @ts-ignore
287
- const __VLS_27 = __VLS_asFunctionalComponent(Avatar, new Avatar({
276
+ const __VLS_23 = __VLS_asFunctionalComponent(Avatar, new Avatar({
288
277
  id: (user.id),
289
278
  ...{ class: "shrink-0" },
290
279
  src: (user.avatar ?? ''),
291
280
  color: (user.color),
292
281
  name: (user.username ?? ''),
293
282
  }));
294
- const __VLS_28 = __VLS_27({
283
+ const __VLS_24 = __VLS_23({
295
284
  id: (user.id),
296
285
  ...{ class: "shrink-0" },
297
286
  src: (user.avatar ?? ''),
298
287
  color: (user.color),
299
288
  name: (user.username ?? ''),
300
- }, ...__VLS_functionalComponentArgsRest(__VLS_27));
289
+ }, ...__VLS_functionalComponentArgsRest(__VLS_23));
301
290
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
302
291
  ...{ class: "grow ml-3 overflow-hidden" },
303
292
  });
@@ -313,18 +302,20 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
313
302
  __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
314
303
  ...{ class: "truncate font-semibold" },
315
304
  });
316
- (user.username);
305
+ (user.username || __VLS_ctx.phoneNumberFormat(user.phone) || 'n/a');
306
+ // @ts-ignore
307
+ [phoneNumberFormat,];
317
308
  if (user.id == __VLS_ctx.digibotId) {
318
309
  // @ts-ignore
319
310
  [digibotId,];
320
311
  /** @type {[typeof IconAiCheck, ]} */ ;
321
312
  // @ts-ignore
322
- const __VLS_31 = __VLS_asFunctionalComponent(IconAiCheck, new IconAiCheck({
313
+ const __VLS_27 = __VLS_asFunctionalComponent(IconAiCheck, new IconAiCheck({
323
314
  ...{ class: "ml-2" },
324
315
  }));
325
- const __VLS_32 = __VLS_31({
316
+ const __VLS_28 = __VLS_27({
326
317
  ...{ class: "ml-2" },
327
- }, ...__VLS_functionalComponentArgsRest(__VLS_31));
318
+ }, ...__VLS_functionalComponentArgsRest(__VLS_27));
328
319
  }
329
320
  if (user.unread_count) {
330
321
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
@@ -341,13 +332,13 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
341
332
  });
342
333
  (user.last_message ?? 'No messages');
343
334
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
344
- ...{ class: "shrink-0 text-sm text-right text-chat-gray-4 w-[130px]" },
335
+ ...{ class: "shrink-0 text-sm text-right text-chat-gray-4 w-[80px] md:w-[130px]" },
345
336
  });
346
337
  (__VLS_ctx.getTimeFromNow(user.last_message_time ?? ''));
347
338
  // @ts-ignore
348
339
  [getTimeFromNow,];
349
340
  }
350
- var __VLS_20;
341
+ var __VLS_16;
351
342
  /** @type {__VLS_StyleScopedClasses['']} */ ;
352
343
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
353
344
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
@@ -362,12 +353,6 @@ var __VLS_20;
362
353
  /** @type {__VLS_StyleScopedClasses['mb-4']} */ ;
363
354
  /** @type {__VLS_StyleScopedClasses['h-11']} */ ;
364
355
  /** @type {__VLS_StyleScopedClasses['grow']} */ ;
365
- /** @type {__VLS_StyleScopedClasses['h-11']} */ ;
366
- /** @type {__VLS_StyleScopedClasses['w-11']} */ ;
367
- /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
368
- /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
369
- /** @type {__VLS_StyleScopedClasses['bg-[#C7DEFF]']} */ ;
370
- /** @type {__VLS_StyleScopedClasses['text-[#004AB3]']} */ ;
371
356
  /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
372
357
  /** @type {__VLS_StyleScopedClasses['px-6']} */ ;
373
358
  /** @type {__VLS_StyleScopedClasses['grow']} */ ;
@@ -417,9 +402,10 @@ var __VLS_20;
417
402
  /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
418
403
  /** @type {__VLS_StyleScopedClasses['text-right']} */ ;
419
404
  /** @type {__VLS_StyleScopedClasses['text-chat-gray-4']} */ ;
420
- /** @type {__VLS_StyleScopedClasses['w-[130px]']} */ ;
405
+ /** @type {__VLS_StyleScopedClasses['w-[80px]']} */ ;
406
+ /** @type {__VLS_StyleScopedClasses['md:w-[130px]']} */ ;
421
407
  // @ts-ignore
422
- var __VLS_25 = __VLS_24;
408
+ var __VLS_21 = __VLS_20;
423
409
  const __VLS_export = (await import('vue')).defineComponent({
424
410
  setup: () => (__VLS_exposed),
425
411
  __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;
@@ -35,6 +35,7 @@ const handleConnectMqtt = async () => {
35
35
  // console.log(topic)
36
36
  // console.log(topic_plivo_chat)
37
37
  addHandleMqttMessage('chat-home', topic, mqttMessageHandler);
38
+ addHandleMqttMessage('chat-home-1', topic_plivo_chat, mqttMessageHandler);
38
39
  }
39
40
  catch (error) {
40
41
  console.error(error);
@@ -44,9 +45,9 @@ const handleDisconnectMqtt = async () => {
44
45
  unsubscribeFromTopic(topic);
45
46
  unsubscribeFromTopic(topic_plivo_chat);
46
47
  removeHandleMqttMessage('chat-home');
48
+ removeHandleMqttMessage('chat-home-1');
47
49
  };
48
50
  const mqttMessageHandler = (topic, message) => {
49
- console.log(message);
50
51
  if ((infoUser.value?.id && message?.sender_id?.toString() == infoUser.value?.id?.toString())) {
51
52
  const index = listMessage.value.findIndex((item) => item.id === message?.id);
52
53
  if (index < 0) {
@@ -132,6 +133,7 @@ const handleSendMessage = async (data) => {
132
133
  try {
133
134
  // listMessage.value.push({ ...data, state: MessageState.Sending })
134
135
  listMessage.value.unshift({ ...data, state: MessageState.Sending });
136
+ await nextTick();
135
137
  publishMessage(topic, {
136
138
  ...data,
137
139
  state: MessageState.Sending
@@ -7,8 +7,14 @@ 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 IconSms from '../../../assets/icons/IconSms.vue';
11
+ import { activePlivoMode } from '../../..//utils/chat/message';
12
+ import { ref } from 'vue';
13
+ import ButtonBase from '../../../components/common/button/ButtonBase.vue';
10
14
  const props = withDefaults(defineProps(), {});
11
15
  const emit = defineEmits();
16
+ const activePlivoSms = ref(dataProfile.value?.is_sms_active == 1);
17
+ const loading = ref(false);
12
18
  const goToViewUser = () => {
13
19
  if (props.data?.id == digibotId.toString())
14
20
  return;
@@ -17,6 +23,21 @@ const goToViewUser = () => {
17
23
  routerPush(PAGE.CUSTOMER_DETAIL);
18
24
  }
19
25
  };
26
+ const handleActivePlivoSmsChange = async (is_active) => {
27
+ return;
28
+ try {
29
+ loading.value = true;
30
+ await activePlivoMode({ id: dataProfile.value?.id, is_sms: is_active ? 1 : 0 });
31
+ if (dataProfile.value != null)
32
+ dataProfile.value.is_sms_active = (is_active ? 1 : 0);
33
+ activePlivoSms.value = is_active;
34
+ }
35
+ catch (e) {
36
+ activePlivoSms.value = !is_active;
37
+ console.log(e);
38
+ }
39
+ loading.value = false;
40
+ };
20
41
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
21
42
  const __VLS_defaults = {};
22
43
  const __VLS_ctx = {
@@ -102,6 +123,46 @@ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
102
123
  (__VLS_ctx.data?.username ?? 'n/a');
103
124
  // @ts-ignore
104
125
  [data,];
126
+ if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant') {
127
+ // @ts-ignore
128
+ [dataProfile, data, data, digibotId,];
129
+ /** @type {[typeof ButtonBase, typeof ButtonBase, ]} */ ;
130
+ // @ts-ignore
131
+ const __VLS_11 = __VLS_asFunctionalComponent(ButtonBase, new ButtonBase({
132
+ ...{ 'onClick': {} },
133
+ type: (__VLS_ctx.activePlivoSms ? 'success' : 'danger'),
134
+ loading: (__VLS_ctx.loading),
135
+ ...{ class: "shrink-0 px-1 flex-center gap-2 text-white font-semibold w-9 md:w-[140px] h-9" },
136
+ }));
137
+ const __VLS_12 = __VLS_11({
138
+ ...{ 'onClick': {} },
139
+ type: (__VLS_ctx.activePlivoSms ? 'success' : 'danger'),
140
+ loading: (__VLS_ctx.loading),
141
+ ...{ class: "shrink-0 px-1 flex-center gap-2 text-white font-semibold w-9 md:w-[140px] h-9" },
142
+ }, ...__VLS_functionalComponentArgsRest(__VLS_11));
143
+ let __VLS_14;
144
+ let __VLS_15;
145
+ const __VLS_16 = ({ click: {} },
146
+ { onClick: (...[$event]) => {
147
+ if (!(__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant'))
148
+ return;
149
+ __VLS_ctx.handleActivePlivoSmsChange(!__VLS_ctx.activePlivoSms);
150
+ // @ts-ignore
151
+ [activePlivoSms, activePlivoSms, loading, handleActivePlivoSmsChange,];
152
+ } });
153
+ const { default: __VLS_17 } = __VLS_13.slots;
154
+ /** @type {[typeof IconSms, ]} */ ;
155
+ // @ts-ignore
156
+ const __VLS_18 = __VLS_asFunctionalComponent(IconSms, new IconSms({}));
157
+ const __VLS_19 = __VLS_18({}, ...__VLS_functionalComponentArgsRest(__VLS_18));
158
+ __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
159
+ ...{ class: "hidden md:block" },
160
+ });
161
+ (__VLS_ctx.activePlivoSms ? 'ON' : 'OFF');
162
+ // @ts-ignore
163
+ [activePlivoSms,];
164
+ var __VLS_13;
165
+ }
105
166
  if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() && __VLS_ctx.dataProfile?.user_type == 'tenant') {
106
167
  // @ts-ignore
107
168
  [dataProfile, data, data, digibotId,];
@@ -117,8 +178,8 @@ if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() &
117
178
  });
118
179
  /** @type {[typeof IconPhone, ]} */ ;
119
180
  // @ts-ignore
120
- const __VLS_11 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({}));
121
- const __VLS_12 = __VLS_11({}, ...__VLS_functionalComponentArgsRest(__VLS_11));
181
+ const __VLS_22 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({}));
182
+ const __VLS_23 = __VLS_22({}, ...__VLS_functionalComponentArgsRest(__VLS_22));
122
183
  }
123
184
  /** @type {__VLS_StyleScopedClasses['px-8']} */ ;
124
185
  /** @type {__VLS_StyleScopedClasses['pb-4']} */ ;
@@ -147,6 +208,17 @@ if (__VLS_ctx.data?.id && __VLS_ctx.data?.id != __VLS_ctx.digibotId.toString() &
147
208
  /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
148
209
  /** @type {__VLS_StyleScopedClasses['truncate']} */ ;
149
210
  /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
211
+ /** @type {__VLS_StyleScopedClasses['px-1']} */ ;
212
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
213
+ /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
214
+ /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
215
+ /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
216
+ /** @type {__VLS_StyleScopedClasses['w-9']} */ ;
217
+ /** @type {__VLS_StyleScopedClasses['md:w-[140px]']} */ ;
218
+ /** @type {__VLS_StyleScopedClasses['h-9']} */ ;
219
+ /** @type {__VLS_StyleScopedClasses['hidden']} */ ;
220
+ /** @type {__VLS_StyleScopedClasses['md:block']} */ ;
221
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
150
222
  /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
151
223
  /** @type {__VLS_StyleScopedClasses['text-[#0051E6]']} */ ;
152
224
  /** @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 = [
@@ -45,17 +43,19 @@ const handleSendMessage = async (type) => {
45
43
  attachments = [{ file_name: String(tempId), file_path, file_local: file }];
46
44
  }
47
45
  keyword.value = '';
46
+ // chatInputRef.value.style.height = 'auto'
48
47
  chatId++;
49
48
  const id = props.data?.id.toString() + '-' + chatId;
50
49
  const data = {
51
- conversation_id: 135,
50
+ conversation_id: props.data?.conversation_id,
52
51
  created_at: dayjs().tz(TIME_ZONE_UTC).format(DATE_FORMATS['DATE_FORMAT_FULL']),
53
52
  id,
54
53
  message: messageContent,
55
54
  receiver_id: props.data?.id || 0,
56
55
  sender_id: dataProfile.value?.id,
57
56
  status: 'read',
58
- attachments: attachments
57
+ attachments: attachments,
58
+ is_sms: dataProfile.value?.is_sms_active,
59
59
  };
60
60
  emit('sendMessage', data);
61
61
  };
@@ -86,14 +86,20 @@ const handleActivePlivoSmsChange = async (is_active) => {
86
86
  }
87
87
  loading.value = false;
88
88
  };
89
- const setInputHeight = () => {
89
+ const setInputHeight = (e) => {
90
90
  const el = chatInputRef.value;
91
91
  el.style.height = 'auto';
92
- el.style.height = el.scrollHeight + 'px';
92
+ if (keyword.value?.replace(/\s+/g, "") == '') {
93
+ el.style.height = 42 + 'px';
94
+ keyword.value = '';
95
+ }
96
+ else {
97
+ el.style.height = el.scrollHeight + 'px';
98
+ }
93
99
  };
94
- const handleSetInputHeight = useDebounce(() => {
95
- setInputHeight();
96
- }, 50);
100
+ const handleSetInputHeight = useDebounce((e) => {
101
+ setInputHeight(e);
102
+ }, 200);
97
103
  const handleInput = () => {
98
104
  emit('focus');
99
105
  };
@@ -119,46 +125,6 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
119
125
  ...{ class: "z-10" },
120
126
  ...{ style: {} },
121
127
  });
122
- if (__VLS_ctx.dataProfile?.user_type == 'tenant') {
123
- // @ts-ignore
124
- [dataProfile,];
125
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
126
- ...{ class: "flex gap-2 mb-2" },
127
- });
128
- /** @type {[typeof SwitchBase, ]} */ ;
129
- // @ts-ignore
130
- const __VLS_0 = __VLS_asFunctionalComponent(SwitchBase, new SwitchBase({
131
- ...{ 'onChange': {} },
132
- modelValue: (__VLS_ctx.activePlivoSms),
133
- label: "Active sms",
134
- }));
135
- const __VLS_1 = __VLS_0({
136
- ...{ 'onChange': {} },
137
- modelValue: (__VLS_ctx.activePlivoSms),
138
- label: "Active sms",
139
- }, ...__VLS_functionalComponentArgsRest(__VLS_0));
140
- let __VLS_3;
141
- let __VLS_4;
142
- const __VLS_5 = ({ change: {} },
143
- { onChange: (__VLS_ctx.handleActivePlivoSmsChange) });
144
- // @ts-ignore
145
- [activePlivoSms, handleActivePlivoSmsChange,];
146
- var __VLS_2;
147
- if (__VLS_ctx.loading) {
148
- // @ts-ignore
149
- [loading,];
150
- /** @type {[typeof BaseSpin, ]} */ ;
151
- // @ts-ignore
152
- const __VLS_7 = __VLS_asFunctionalComponent(BaseSpin, new BaseSpin({
153
- size: (24),
154
- border: (3),
155
- }));
156
- const __VLS_8 = __VLS_7({
157
- size: (24),
158
- border: (3),
159
- }, ...__VLS_functionalComponentArgsRest(__VLS_7));
160
- }
161
- }
162
128
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
163
129
  ...{ class: "flex gap-2 items-end h-max" },
164
130
  });
@@ -177,14 +143,14 @@ __VLS_asFunctionalElement(__VLS_elements.textarea)({
177
143
  [handleInput,];
178
144
  } },
179
145
  ...{ onInput: (...[$event]) => {
180
- __VLS_ctx.setInputHeight();
146
+ __VLS_ctx.setInputHeight($event);
181
147
  // @ts-ignore
182
148
  [setInputHeight,];
183
149
  } },
184
- ...{ class: "w-full min-h-11 resize-none overflow-hidden chat-input !rounded-xl pl-4 py-2 pr-[96px] border border-chat-haze-200" },
150
+ ...{ class: "w-full min-h-11 overflow-hidden chat-input !rounded-xl pl-4 py-2 pr-[96px] border border-chat-haze-200" },
185
151
  ref: "chatInputRef",
186
- placeholder: "Send Message",
187
152
  rows: "1",
153
+ placeholder: "Send Message",
188
154
  value: (__VLS_ctx.keyword),
189
155
  });
190
156
  /** @type {typeof __VLS_ctx.chatInputRef} */ ;
@@ -195,17 +161,17 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
195
161
  });
196
162
  /** @type {[typeof PopoverBase, typeof PopoverBase, ]} */ ;
197
163
  // @ts-ignore
198
- const __VLS_11 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
164
+ const __VLS_0 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
199
165
  open: (__VLS_ctx.emojiOpen),
200
166
  align: "end",
201
167
  side: "top",
202
168
  }));
203
- const __VLS_12 = __VLS_11({
169
+ const __VLS_1 = __VLS_0({
204
170
  open: (__VLS_ctx.emojiOpen),
205
171
  align: "end",
206
172
  side: "top",
207
- }, ...__VLS_functionalComponentArgsRest(__VLS_11));
208
- const { default: __VLS_14 } = __VLS_13.slots;
173
+ }, ...__VLS_functionalComponentArgsRest(__VLS_0));
174
+ const { default: __VLS_3 } = __VLS_2.slots;
209
175
  // @ts-ignore
210
176
  [emojiOpen,];
211
177
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
@@ -217,35 +183,35 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
217
183
  ...{ class: "h-11 w-10" },
218
184
  });
219
185
  {
220
- const { content: __VLS_15 } = __VLS_13.slots;
221
- const __VLS_16 = {}.EmojiPicker;
186
+ const { content: __VLS_4 } = __VLS_2.slots;
187
+ const __VLS_5 = {}.EmojiPicker;
222
188
  /** @type {[typeof __VLS_components.EmojiPicker, typeof __VLS_components.emojiPicker, ]} */ ;
223
189
  // @ts-ignore
224
190
  EmojiPicker;
225
191
  // @ts-ignore
226
- const __VLS_17 = __VLS_asFunctionalComponent(__VLS_16, new __VLS_16({
192
+ const __VLS_6 = __VLS_asFunctionalComponent(__VLS_5, new __VLS_5({
227
193
  ...{ 'onSelect': {} },
228
194
  ...{ class: "!w-[300px]" },
229
195
  native: (true),
230
196
  offset: (2),
231
197
  hideSearch: true,
232
198
  }));
233
- const __VLS_18 = __VLS_17({
199
+ const __VLS_7 = __VLS_6({
234
200
  ...{ 'onSelect': {} },
235
201
  ...{ class: "!w-[300px]" },
236
202
  native: (true),
237
203
  offset: (2),
238
204
  hideSearch: true,
239
- }, ...__VLS_functionalComponentArgsRest(__VLS_17));
240
- let __VLS_20;
241
- let __VLS_21;
242
- const __VLS_22 = ({ select: {} },
205
+ }, ...__VLS_functionalComponentArgsRest(__VLS_6));
206
+ let __VLS_9;
207
+ let __VLS_10;
208
+ const __VLS_11 = ({ select: {} },
243
209
  { onSelect: (__VLS_ctx.onSelectEmoji) });
244
210
  // @ts-ignore
245
211
  [onSelectEmoji,];
246
- var __VLS_19;
212
+ var __VLS_8;
247
213
  }
248
- var __VLS_13;
214
+ var __VLS_2;
249
215
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
250
216
  ...{ onClick: (...[$event]) => {
251
217
  __VLS_ctx.handleSendMessage('message');
@@ -256,8 +222,8 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
256
222
  });
257
223
  /** @type {[typeof IconPlan, ]} */ ;
258
224
  // @ts-ignore
259
- const __VLS_24 = __VLS_asFunctionalComponent(IconPlan, new IconPlan({}));
260
- 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));
261
227
  __VLS_asFunctionalElement(__VLS_elements.label, __VLS_elements.label)({
262
228
  ...{ class: "shrink-0 cursor-pointer relative -translate-y-1" },
263
229
  });
@@ -276,25 +242,21 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
276
242
  });
277
243
  /** @type {[typeof IconPlus, ]} */ ;
278
244
  // @ts-ignore
279
- const __VLS_28 = __VLS_asFunctionalComponent(IconPlus, new IconPlus({
245
+ const __VLS_17 = __VLS_asFunctionalComponent(IconPlus, new IconPlus({
280
246
  ...{ class: "text-white" },
281
247
  }));
282
- const __VLS_29 = __VLS_28({
248
+ const __VLS_18 = __VLS_17({
283
249
  ...{ class: "text-white" },
284
- }, ...__VLS_functionalComponentArgsRest(__VLS_28));
250
+ }, ...__VLS_functionalComponentArgsRest(__VLS_17));
285
251
  /** @type {__VLS_StyleScopedClasses['z-10']} */ ;
286
252
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
287
253
  /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
288
- /** @type {__VLS_StyleScopedClasses['mb-2']} */ ;
289
- /** @type {__VLS_StyleScopedClasses['flex']} */ ;
290
- /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
291
254
  /** @type {__VLS_StyleScopedClasses['items-end']} */ ;
292
255
  /** @type {__VLS_StyleScopedClasses['h-max']} */ ;
293
256
  /** @type {__VLS_StyleScopedClasses['relative']} */ ;
294
257
  /** @type {__VLS_StyleScopedClasses['grow']} */ ;
295
258
  /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
296
259
  /** @type {__VLS_StyleScopedClasses['min-h-11']} */ ;
297
- /** @type {__VLS_StyleScopedClasses['resize-none']} */ ;
298
260
  /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
299
261
  /** @type {__VLS_StyleScopedClasses['chat-input']} */ ;
300
262
  /** @type {__VLS_StyleScopedClasses['!rounded-xl']} */ ;
@@ -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;