@phonghq/go-chat 1.0.42 → 1.0.44

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 (114) hide show
  1. package/dist/assets/icons/IconPlan.vue.d.ts +13 -1
  2. package/dist/assets/icons/call/IconPhoneCancel.vue.d.ts +13 -1
  3. package/dist/assets/icons/customer-detail/IconPhone.vue.d.ts +13 -1
  4. package/dist/chat/App.vue.d.ts +13 -2
  5. package/dist/chat/page/home/ChatList.vue.d.ts +10 -0
  6. package/dist/chat/page/home/ChatMessageItem.vue.d.ts +1 -0
  7. package/dist/chat/page/home/ChatMessageItem2.vue.d.ts +19 -0
  8. package/dist/chat/page/home/Home.vue.d.ts +2 -0
  9. package/dist/chat/page/home/InputChat.vue.d.ts +2 -0
  10. package/dist/components/chat/call/Calling.vue.d.ts +4 -2
  11. package/dist/components/chat/common/tabs/TabBase.vue.d.ts +18 -0
  12. package/dist/components/common/drawer/DrawerBaseCustom.vue.d.ts +1 -1
  13. package/dist/components/ui/select/Select.vue.d.ts +20 -0
  14. package/dist/components/ui/select/SelectContent.vue.d.ts +24 -0
  15. package/dist/components/ui/select/SelectGroup.vue.d.ts +10 -0
  16. package/dist/components/ui/select/SelectItem.vue.d.ts +18 -0
  17. package/dist/components/ui/select/SelectItemText.vue.d.ts +10 -0
  18. package/dist/components/ui/select/SelectLabel.vue.d.ts +14 -0
  19. package/dist/components/ui/select/SelectScrollDownButton.vue.d.ts +14 -0
  20. package/dist/components/ui/select/SelectScrollUpButton.vue.d.ts +14 -0
  21. package/dist/components/ui/select/SelectSeparator.vue.d.ts +7 -0
  22. package/dist/components/ui/select/SelectTrigger.vue.d.ts +17 -0
  23. package/dist/components/ui/select/SelectValue.vue.d.ts +10 -0
  24. package/dist/components/ui/select/index.d.ts +11 -0
  25. package/dist/components/ui/tabs/Tabs.vue.d.ts +20 -0
  26. package/dist/components/ui/tabs/TabsContent.vue.d.ts +14 -0
  27. package/dist/components/ui/tabs/TabsList.vue.d.ts +14 -0
  28. package/dist/components/ui/tabs/TabsTrigger.vue.d.ts +14 -0
  29. package/dist/components/ui/tabs/index.d.ts +4 -0
  30. package/dist/composable/useDigibot.d.ts +1 -1
  31. package/dist/composable/useInitData.d.ts +5 -2
  32. package/dist/composable/useListConversations.d.ts +4 -1
  33. package/dist/composable/useListentEvent.d.ts +5 -0
  34. package/dist/composable/usePlivo.d.ts +1 -0
  35. package/dist/constant/color.d.ts +2 -2
  36. package/dist/go-chat.es.js +14663 -14004
  37. package/dist/go-chat.umd.js +15 -15
  38. package/dist/style.css +1 -1
  39. package/dist/test/assets/icons/IconPlan.vue.js +23 -3
  40. package/dist/test/assets/icons/IconUser.vue.js +25 -0
  41. package/dist/test/assets/icons/call/IconPhone.vue.js +6 -19
  42. package/dist/test/assets/icons/call/IconPhoneCancel.vue.js +32 -21
  43. package/dist/test/assets/icons/customer-detail/IconPhone.vue.js +23 -3
  44. package/dist/test/chat/App.vue.js +303 -282
  45. package/dist/test/chat/page/customer-check-in/CustomerCheckIn.vue.js +3 -1
  46. package/dist/test/chat/page/customer-detail/CustomerDetail.vue.js +4 -4
  47. package/dist/test/chat/page/home/ChatList.vue.js +113 -43
  48. package/dist/test/chat/page/home/ChatMessage.vue.js +10 -1
  49. package/dist/test/chat/page/home/ChatMessageItem.vue.js +75 -83
  50. package/dist/test/chat/page/home/ChatMessageItem2.vue.js +351 -0
  51. package/dist/test/chat/page/home/Home.vue.js +29 -9
  52. package/dist/test/chat/page/home/HomeHeader.vue.js +8 -4
  53. package/dist/test/chat/page/home/InputChat.vue.js +58 -37
  54. package/dist/test/components/chat/call/Calling.vue.js +117 -71
  55. package/dist/test/components/chat/common/tab/TabBase.vue.js +1 -0
  56. package/dist/test/components/chat/common/tabs/TabBase.vue.js +92 -0
  57. package/dist/test/components/chat/customer/Avatar.vue.js +23 -4
  58. package/dist/test/components/chat/layout/mobile/Footer.vue.js +6 -1
  59. package/dist/test/components/common/drawer/DrawerBaseCustom.vue.js +1 -0
  60. package/dist/test/components/common/select/SelectBase.vue.js +139 -0
  61. package/dist/test/components/ui/select/Select.vue.js +49 -0
  62. package/dist/test/components/ui/select/SelectContent.vue.js +98 -0
  63. package/dist/test/components/ui/select/SelectGroup.vue.js +37 -0
  64. package/dist/test/components/ui/select/SelectItem.vue.js +86 -0
  65. package/dist/test/components/ui/select/SelectItemText.vue.js +37 -0
  66. package/dist/test/components/ui/select/SelectLabel.vue.js +40 -0
  67. package/dist/test/components/ui/select/SelectScrollDownButton.vue.js +58 -0
  68. package/dist/test/components/ui/select/SelectScrollUpButton.vue.js +58 -0
  69. package/dist/test/components/ui/select/SelectSeparator.vue.js +39 -0
  70. package/dist/test/components/ui/select/SelectTrigger.vue.js +76 -0
  71. package/dist/test/components/ui/select/SelectValue.vue.js +37 -0
  72. package/dist/test/components/ui/select/index.js +11 -0
  73. package/dist/test/components/ui/tabs/Tabs.vue.js +54 -0
  74. package/dist/test/components/ui/tabs/TabsContent.vue.js +44 -0
  75. package/dist/test/components/ui/tabs/TabsList.vue.js +44 -0
  76. package/dist/test/components/ui/tabs/TabsTrigger.vue.js +45 -0
  77. package/dist/test/components/ui/tabs/index.js +4 -0
  78. package/dist/test/composable/useDigibot.js +3 -3
  79. package/dist/test/composable/useInitData.js +23 -14
  80. package/dist/test/composable/useListConversations.js +51 -33
  81. package/dist/test/composable/useListentEvent.js +45 -0
  82. package/dist/test/composable/usePlivo.js +6 -1
  83. package/dist/test/constant/color.js +4 -2
  84. package/dist/test/plugins/axios-gci.js +1 -1
  85. package/dist/test/utils/chat/auth.js +1 -1
  86. package/dist/test/utils/chat/cache.js +63 -0
  87. package/dist/test/utils/chat/call.js +2 -3
  88. package/dist/test/utils/chat/conversation.js +9 -2
  89. package/dist/test/utils/chat/page-error.js +25 -0
  90. package/dist/test/utils/chat/user.js +7 -2
  91. package/dist/test/utils/string-helper.js +13 -0
  92. package/dist/test/views/NotTenantPhone.vue.js +99 -0
  93. package/dist/types/chat/global.d.ts +6 -5
  94. package/dist/types/conversation.d.ts +2 -0
  95. package/dist/utils/chat/auth.d.ts +1 -1
  96. package/dist/utils/chat/cache.d.ts +7 -0
  97. package/dist/utils/chat/conversation.d.ts +2 -0
  98. package/dist/utils/chat/page-error.d.ts +4 -0
  99. package/dist/utils/chat/user.d.ts +3 -0
  100. package/dist/utils/string-helper.d.ts +1 -0
  101. package/dist/views/NotTenantPhone.vue.d.ts +9 -0
  102. package/package.json +3 -2
  103. package/dist/components/layout/Blank.vue.d.ts +0 -9
  104. package/dist/components/layout/Default.vue.d.ts +0 -9
  105. package/dist/composable/useError.d.ts +0 -4
  106. package/dist/composable/useModalConfirm.d.ts +0 -5
  107. package/dist/test/components/ListenEvent.vue.js +0 -45
  108. package/dist/test/components/layout/Blank.vue.js +0 -19
  109. package/dist/test/components/layout/Default.vue.js +0 -21
  110. package/dist/test/components/modal/Confirm.vue.js +0 -164
  111. package/dist/test/composable/useError.js +0 -10
  112. package/dist/test/composable/useModalConfirm.js +0 -39
  113. /package/dist/{components/ListenEvent.vue.d.ts → assets/icons/IconUser.vue.d.ts} +0 -0
  114. /package/dist/components/{modal/Confirm.vue.d.ts → common/select/SelectBase.vue.d.ts} +0 -0
@@ -1,13 +1,16 @@
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 { dataProfile } from '../../../utils/chat/auth';
4
3
  import { computed, nextTick } from 'vue';
5
4
  import { MessageState } from '../../../constant/message';
6
5
  import IconPhoneCancel from '../../../assets/icons/call/IconPhoneCancel.vue';
7
6
  import { PLIVO_CALL_STATUS } from '../../../types/chat/call';
8
7
  import IconPhone from '../../../assets/icons/customer-detail/IconPhone.vue';
9
8
  import dayjs from 'dayjs';
10
- import { DATE_FORMATS } from '../../../constant/datetime';
9
+ import { DATE_FORMATS, TIME_ZONE_UTC } from '../../../constant/datetime';
10
+ import utc from 'dayjs/plugin/utc';
11
+ import timezone from 'dayjs/plugin/timezone';
12
+ dayjs.extend(utc);
13
+ dayjs.extend(timezone);
11
14
  const props = withDefaults(defineProps(), {});
12
15
  const emit = defineEmits();
13
16
  const callTitle = computed(() => {
@@ -47,7 +50,8 @@ const scrollBottom = () => {
47
50
  const getCallDuration = (seconds) => {
48
51
  const min = Math.floor(seconds / 60);
49
52
  const secs = seconds % 60;
50
- return `${min} min${min > 1 ? 's' : ''} ${secs} sec`;
53
+ // return `${min} min${min > 1 ? 's' : ''} ${secs} sec`
54
+ return `${String(min).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
51
55
  };
52
56
  const getMessageStateText = (item) => {
53
57
  const state = item.state;
@@ -66,6 +70,11 @@ const getMessageStateText = (item) => {
66
70
  return '';
67
71
  }
68
72
  };
73
+ const getFinishTime = (time) => {
74
+ if (!dayjs(time).isValid())
75
+ return '';
76
+ return dayjs.tz(time, TIME_ZONE_UTC).local().format(DATE_FORMATS.TIME_12_FORMAT);
77
+ };
69
78
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
70
79
  const __VLS_defaults = {};
71
80
  const __VLS_ctx = {
@@ -79,9 +88,9 @@ let __VLS_elements;
79
88
  let __VLS_components;
80
89
  let __VLS_directives;
81
90
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
82
- ...{ class: "flex items-end mt-2" },
91
+ ...{ class: "flex items-end mt-1" },
83
92
  ...{ class: ({
84
- 'mt-4': __VLS_ctx.shouldShowAvatar,
93
+ 'mt-2': __VLS_ctx.shouldShowAvatar,
85
94
  'flex-col justify-end pl-[60px]': __VLS_ctx.isMyMessage,
86
95
  'gap-2': !__VLS_ctx.isMyMessage
87
96
  }) },
@@ -127,92 +136,82 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
127
136
  [responsive,];
128
137
  }
129
138
  }
139
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
130
140
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
131
141
  ...{ class: "px-3 py-2 rounded-2xl max-w-xs text-left" },
132
142
  ...{ class: ({
133
- 'rounded-tl-none': !__VLS_ctx.shouldShowAvatar && !__VLS_ctx.isMyMessage,
134
- 'rounded-bl-none': !__VLS_ctx.isEndMessage && !__VLS_ctx.isMyMessage,
135
- 'rounded-tr-none': !__VLS_ctx.shouldShowAvatar && __VLS_ctx.isMyMessage,
136
- 'rounded-br-none': !__VLS_ctx.isEndMessage && __VLS_ctx.isMyMessage,
137
- '!text-[#14532D] !bg-[#d4f8d4]': (__VLS_ctx.message.message_uuid && !__VLS_ctx.message.is_call) || __VLS_ctx.message.is_sms,
138
- 'bg-[#D0DFEC] text-[#266699]': __VLS_ctx.isMyMessage,
139
- 'bg-[#E4E4E4D4] text-chat-haze-600 w-max ': !__VLS_ctx.isMyMessage
143
+ 'rounded-tl-none': !__VLS_ctx.isChatStart && !__VLS_ctx.isMyMessage,
144
+ 'rounded-bl-none': !__VLS_ctx.isChatFinished && !__VLS_ctx.isMyMessage,
145
+ 'rounded-tr-none': !__VLS_ctx.isChatStart && __VLS_ctx.isMyMessage,
146
+ 'rounded-br-none': !__VLS_ctx.isChatFinished && __VLS_ctx.isMyMessage,
147
+ '!text-white !bg-chat-success': (__VLS_ctx.message.message_uuid && !__VLS_ctx.message.is_call) || __VLS_ctx.message.is_sms,
148
+ 'bg-chat-primary text-white': __VLS_ctx.isMyMessage && !__VLS_ctx.message.is_call,
149
+ 'bg-[#E4E4E4D4] text-chat-haze-600 w-max ': !__VLS_ctx.isMyMessage || __VLS_ctx.message.is_call
140
150
  }) },
141
151
  });
142
152
  // @ts-ignore
143
- [shouldShowAvatar, shouldShowAvatar, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, message, message, message, isEndMessage, isEndMessage,];
153
+ [isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, message, message, message, message, message, isChatStart, isChatStart, isChatFinished, isChatFinished,];
144
154
  if (__VLS_ctx.message.is_call == 1) {
145
155
  // @ts-ignore
146
156
  [message,];
147
157
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
148
- ...{ class: "flex flex-col gap-2 w-[200px]" },
149
- });
150
- __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
151
- ...{ class: "font-medium" },
152
- ...{ class: ({ 'text-chat-error': __VLS_ctx.message.call_status !== __VLS_ctx.PLIVO_CALL_STATUS.CALL_END }) },
158
+ ...{ class: "flex flex-col gap-2 w-[210px]" },
153
159
  });
154
- // @ts-ignore
155
- [message, PLIVO_CALL_STATUS,];
156
- (__VLS_ctx.callTitle);
157
- // @ts-ignore
158
- [callTitle,];
159
160
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
160
- ...{ class: "flex items-center gap-2 shrink-0" },
161
- });
162
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
163
- ...{ class: "overflow-hidden w-8 h-8 rounded-full text-white" },
161
+ ...{ class: "flex items-center gap-1" },
164
162
  });
165
163
  if (__VLS_ctx.message.call_status == __VLS_ctx.PLIVO_CALL_STATUS.CALL_END) {
166
164
  // @ts-ignore
167
165
  [message, PLIVO_CALL_STATUS,];
168
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
169
- ...{ class: "bg-chat-success flex-center w-full h-full" },
170
- });
171
166
  /** @type {[typeof IconPhone, ]} */ ;
172
167
  // @ts-ignore
173
168
  const __VLS_4 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({
174
- ...{ class: "w-5 h-5" },
169
+ weight: (2),
170
+ ...{ class: "w-5 h-5 text-chat-success" },
175
171
  }));
176
172
  const __VLS_5 = __VLS_4({
177
- ...{ class: "w-5 h-5" },
173
+ weight: (2),
174
+ ...{ class: "w-5 h-5 text-chat-success" },
178
175
  }, ...__VLS_functionalComponentArgsRest(__VLS_4));
179
176
  }
180
177
  else {
181
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
182
- ...{ class: "bg-chat-error flex-center w-full h-full" },
183
- });
184
178
  /** @type {[typeof IconPhoneCancel, ]} */ ;
185
179
  // @ts-ignore
186
180
  const __VLS_8 = __VLS_asFunctionalComponent(IconPhoneCancel, new IconPhoneCancel({
187
- ...{ class: "w-5 h-5" },
181
+ weight: (2),
182
+ ...{ class: "w-5 h-5 text-chat-error" },
188
183
  }));
189
184
  const __VLS_9 = __VLS_8({
190
- ...{ class: "w-5 h-5" },
185
+ weight: (2),
186
+ ...{ class: "w-5 h-5 text-chat-error" },
191
187
  }, ...__VLS_functionalComponentArgsRest(__VLS_8));
192
188
  }
189
+ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
190
+ ...{ class: "font-semibold" },
191
+ });
192
+ (__VLS_ctx.callTitle);
193
+ // @ts-ignore
194
+ [callTitle,];
195
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
196
+ ...{ class: "flex items-center gap-2 shrink-0" },
197
+ });
193
198
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
194
199
  (__VLS_ctx.getCallDuration(__VLS_ctx.message?.duration ?? 0));
195
200
  // @ts-ignore
196
201
  [message, getCallDuration,];
197
- if (__VLS_ctx.dataProfile?.user_type == 'tenant') {
198
- // @ts-ignore
199
- [dataProfile,];
200
- __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
201
- ...{ onClick: (...[$event]) => {
202
- if (!(__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyMessage))
203
- return;
204
- if (!(__VLS_ctx.message.is_call == 1))
205
- return;
206
- if (!(__VLS_ctx.dataProfile?.user_type == 'tenant'))
207
- return;
208
- __VLS_ctx.emit('callAgain');
209
- // @ts-ignore
210
- [emit,];
211
- } },
212
- ...{ class: "flex-center h-10 rounded-xl bg-chat-haze-200 font-semibold" },
213
- });
214
- __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({});
215
- }
202
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
203
+ ...{ onClick: (...[$event]) => {
204
+ if (!(__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyMessage))
205
+ return;
206
+ if (!(__VLS_ctx.message.is_call == 1))
207
+ return;
208
+ __VLS_ctx.emit('callAgain');
209
+ // @ts-ignore
210
+ [emit,];
211
+ } },
212
+ ...{ class: "flex-center h-10 rounded-xl bg-chat-haze-200 font-semibold" },
213
+ });
214
+ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({});
216
215
  }
217
216
  else if (__VLS_ctx.message.message) {
218
217
  // @ts-ignore
@@ -246,16 +245,18 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
246
245
  [isChatFinished,];
247
246
  __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
248
247
  ...{ class: "text-sm mt-1" },
248
+ ...{ class: (__VLS_ctx.isMyMessage ? 'text-right' : 'text-left') },
249
249
  });
250
- (__VLS_ctx.dayjs(__VLS_ctx.message?.created_at).format(__VLS_ctx.DATE_FORMATS.TIME_12_FORMAT));
251
250
  // @ts-ignore
252
- [message, dayjs, DATE_FORMATS,];
251
+ [isMyMessage,];
252
+ (__VLS_ctx.getFinishTime(__VLS_ctx.message?.created_at));
253
+ // @ts-ignore
254
+ [message, getFinishTime,];
253
255
  }
254
256
  if (__VLS_ctx.isMyMessage) {
255
257
  // @ts-ignore
256
258
  [isMyMessage,];
257
- if ((__VLS_ctx.isLastMessage && __VLS_ctx.getMessageStateText(__VLS_ctx.message)) ||
258
- __VLS_ctx.message.state == __VLS_ctx.MessageState.Failed) {
259
+ if ((__VLS_ctx.isLastMessage && __VLS_ctx.getMessageStateText(__VLS_ctx.message)) || __VLS_ctx.message.state == __VLS_ctx.MessageState.Failed) {
259
260
  // @ts-ignore
260
261
  [message, message, MessageState, isLastMessage, getMessageStateText,];
261
262
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
@@ -272,8 +273,8 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
272
273
  }
273
274
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
274
275
  /** @type {__VLS_StyleScopedClasses['items-end']} */ ;
276
+ /** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
275
277
  /** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
276
- /** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
277
278
  /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
278
279
  /** @type {__VLS_StyleScopedClasses['justify-end']} */ ;
279
280
  /** @type {__VLS_StyleScopedClasses['pl-[60px]']} */ ;
@@ -289,40 +290,31 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
289
290
  /** @type {__VLS_StyleScopedClasses['rounded-bl-none']} */ ;
290
291
  /** @type {__VLS_StyleScopedClasses['rounded-tr-none']} */ ;
291
292
  /** @type {__VLS_StyleScopedClasses['rounded-br-none']} */ ;
292
- /** @type {__VLS_StyleScopedClasses['!text-[#14532D]']} */ ;
293
- /** @type {__VLS_StyleScopedClasses['!bg-[#d4f8d4]']} */ ;
294
- /** @type {__VLS_StyleScopedClasses['bg-[#D0DFEC]']} */ ;
295
- /** @type {__VLS_StyleScopedClasses['text-[#266699]']} */ ;
293
+ /** @type {__VLS_StyleScopedClasses['!text-white']} */ ;
294
+ /** @type {__VLS_StyleScopedClasses['!bg-chat-success']} */ ;
295
+ /** @type {__VLS_StyleScopedClasses['bg-chat-primary']} */ ;
296
+ /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
296
297
  /** @type {__VLS_StyleScopedClasses['bg-[#E4E4E4D4]']} */ ;
297
298
  /** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
298
299
  /** @type {__VLS_StyleScopedClasses['w-max']} */ ;
299
300
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
300
301
  /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
301
302
  /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
302
- /** @type {__VLS_StyleScopedClasses['w-[200px]']} */ ;
303
- /** @type {__VLS_StyleScopedClasses['font-medium']} */ ;
304
- /** @type {__VLS_StyleScopedClasses['text-chat-error']} */ ;
303
+ /** @type {__VLS_StyleScopedClasses['w-[210px]']} */ ;
305
304
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
306
305
  /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
307
- /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
308
- /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
309
- /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
310
- /** @type {__VLS_StyleScopedClasses['w-8']} */ ;
311
- /** @type {__VLS_StyleScopedClasses['h-8']} */ ;
312
- /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
313
- /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
314
- /** @type {__VLS_StyleScopedClasses['bg-chat-success']} */ ;
315
- /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
316
- /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
317
- /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
306
+ /** @type {__VLS_StyleScopedClasses['gap-1']} */ ;
318
307
  /** @type {__VLS_StyleScopedClasses['w-5']} */ ;
319
308
  /** @type {__VLS_StyleScopedClasses['h-5']} */ ;
320
- /** @type {__VLS_StyleScopedClasses['bg-chat-error']} */ ;
321
- /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
322
- /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
323
- /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
309
+ /** @type {__VLS_StyleScopedClasses['text-chat-success']} */ ;
324
310
  /** @type {__VLS_StyleScopedClasses['w-5']} */ ;
325
311
  /** @type {__VLS_StyleScopedClasses['h-5']} */ ;
312
+ /** @type {__VLS_StyleScopedClasses['text-chat-error']} */ ;
313
+ /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
314
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
315
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
316
+ /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
317
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
326
318
  /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
327
319
  /** @type {__VLS_StyleScopedClasses['h-10']} */ ;
328
320
  /** @type {__VLS_StyleScopedClasses['rounded-xl']} */ ;
@@ -0,0 +1,351 @@
1
+ /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
+ import Avatar from '../../../components/chat/customer/Avatar.vue';
3
+ import { dataProfile } from '../../../utils/chat/auth';
4
+ import { computed, nextTick } from 'vue';
5
+ import { MessageState } from '../../../constant/message';
6
+ import IconPhoneCancel from '../../../assets/icons/call/IconPhoneCancel.vue';
7
+ import { PLIVO_CALL_STATUS } from '../../../types/chat/call';
8
+ import IconPhone from '../../../assets/icons/customer-detail/IconPhone.vue';
9
+ import dayjs from 'dayjs';
10
+ import { DATE_FORMATS, TIME_ZONE_UTC } from '../../../constant/datetime';
11
+ import utc from 'dayjs/plugin/utc';
12
+ import timezone from 'dayjs/plugin/timezone';
13
+ dayjs.extend(utc);
14
+ dayjs.extend(timezone);
15
+ const props = withDefaults(defineProps(), {});
16
+ const emit = defineEmits();
17
+ const callTitle = computed(() => {
18
+ if (props.isMyMessage) {
19
+ if (props.message?.call_status == PLIVO_CALL_STATUS.CONNECT_FAILED) {
20
+ return 'Call canceled';
21
+ }
22
+ else if (props.message?.call_status == PLIVO_CALL_STATUS.CALL_END) {
23
+ return 'Outgoing audio call';
24
+ }
25
+ else if (props.message?.call_status == PLIVO_CALL_STATUS.CANCEL) {
26
+ return 'Call canceled';
27
+ }
28
+ }
29
+ else {
30
+ if (props.message?.call_status == PLIVO_CALL_STATUS.CONNECT_FAILED ||
31
+ props.message?.call_status == PLIVO_CALL_STATUS.TIME_OUT ||
32
+ props.message?.call_status == PLIVO_CALL_STATUS.CANCEL ||
33
+ props.message?.call_status == PLIVO_CALL_STATUS.NO_ANSWER ||
34
+ props.message?.call_status == PLIVO_CALL_STATUS.BUSY) {
35
+ return 'Call missed';
36
+ }
37
+ else if (props.message?.call_status == PLIVO_CALL_STATUS.CALL_END) {
38
+ return 'Incomming audio call';
39
+ }
40
+ }
41
+ return '';
42
+ });
43
+ const scrollBottom = () => {
44
+ nextTick(() => {
45
+ const eleIdContentChat = document.getElementById('content-chat');
46
+ if (eleIdContentChat) {
47
+ eleIdContentChat.scrollTop = eleIdContentChat.scrollHeight;
48
+ }
49
+ });
50
+ };
51
+ const getCallDuration = (seconds) => {
52
+ const min = Math.floor(seconds / 60);
53
+ const secs = seconds % 60;
54
+ return `${min} min${min > 1 ? 's' : ''} ${secs} sec`;
55
+ };
56
+ const getMessageStateText = (item) => {
57
+ const state = item.state;
58
+ switch (state) {
59
+ case MessageState.Sending:
60
+ return 'Sending...';
61
+ case MessageState.Uploading:
62
+ return 'Uploading...';
63
+ case MessageState.Sent:
64
+ return '';
65
+ case MessageState.Read:
66
+ return 'Seen';
67
+ case MessageState.Failed:
68
+ return item.error || 'Message failed';
69
+ default:
70
+ return '';
71
+ }
72
+ };
73
+ const getFinishTime = (time) => {
74
+ if (!dayjs(time).isValid())
75
+ return '';
76
+ return dayjs.tz(time, TIME_ZONE_UTC).local().format(DATE_FORMATS.TIME_12_FORMAT);
77
+ };
78
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
79
+ const __VLS_defaults = {};
80
+ const __VLS_ctx = {
81
+ ...{},
82
+ ...{},
83
+ ...{},
84
+ ...{},
85
+ ...{},
86
+ };
87
+ let __VLS_elements;
88
+ let __VLS_components;
89
+ let __VLS_directives;
90
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
91
+ ...{ class: "flex items-end mt-1" },
92
+ ...{ class: ({
93
+ 'mt-2': __VLS_ctx.shouldShowAvatar,
94
+ 'flex-col justify-end pl-[60px]': __VLS_ctx.isMyMessage,
95
+ 'gap-2': !__VLS_ctx.isMyMessage
96
+ }) },
97
+ });
98
+ // @ts-ignore
99
+ [shouldShowAvatar, isMyMessage, isMyMessage,];
100
+ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyMessage) {
101
+ // @ts-ignore
102
+ [isMyMessage, message, MessageState,];
103
+ if (!__VLS_ctx.isMyMessage) {
104
+ // @ts-ignore
105
+ [isMyMessage,];
106
+ if (__VLS_ctx.shouldShowAvatar) {
107
+ // @ts-ignore
108
+ [shouldShowAvatar,];
109
+ /** @type {[typeof Avatar, ]} */ ;
110
+ // @ts-ignore
111
+ const __VLS_0 = __VLS_asFunctionalComponent(Avatar, new Avatar({
112
+ ...{ class: "shrink-0" },
113
+ src: (__VLS_ctx.data?.avatar ?? ''),
114
+ color: (__VLS_ctx.data?.color),
115
+ name: (__VLS_ctx.data?.username),
116
+ size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
117
+ ...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
118
+ }));
119
+ const __VLS_1 = __VLS_0({
120
+ ...{ class: "shrink-0" },
121
+ src: (__VLS_ctx.data?.avatar ?? ''),
122
+ color: (__VLS_ctx.data?.color),
123
+ name: (__VLS_ctx.data?.username),
124
+ size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
125
+ ...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
126
+ }, ...__VLS_functionalComponentArgsRest(__VLS_0));
127
+ // @ts-ignore
128
+ [data, data, data, responsive, responsive,];
129
+ }
130
+ else {
131
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
132
+ ...{ class: "shrink-0" },
133
+ ...{ class: (__VLS_ctx.responsive == 'mobile' ? 'w-8' : 'w-12') },
134
+ });
135
+ // @ts-ignore
136
+ [responsive,];
137
+ }
138
+ }
139
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
140
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
141
+ ...{ class: "px-3 py-2 rounded-2xl max-w-xs text-left" },
142
+ ...{ class: ({
143
+ 'rounded-tl-none': !__VLS_ctx.isChatStart && !__VLS_ctx.isMyMessage,
144
+ 'rounded-bl-none': !__VLS_ctx.isChatFinished && !__VLS_ctx.isMyMessage,
145
+ 'rounded-tr-none': !__VLS_ctx.isChatStart && __VLS_ctx.isMyMessage,
146
+ 'rounded-br-none': !__VLS_ctx.isChatFinished && __VLS_ctx.isMyMessage,
147
+ '!text-white !bg-chat-success': (__VLS_ctx.message.message_uuid && !__VLS_ctx.message.is_call) || __VLS_ctx.message.is_sms,
148
+ 'bg-chat-primary text-white': __VLS_ctx.isMyMessage,
149
+ 'bg-[#E4E4E4D4] text-chat-haze-600 w-max ': !__VLS_ctx.isMyMessage
150
+ }) },
151
+ });
152
+ // @ts-ignore
153
+ [isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, message, message, message, isChatStart, isChatStart, isChatFinished, isChatFinished,];
154
+ if (__VLS_ctx.message.is_call == 1) {
155
+ // @ts-ignore
156
+ [message,];
157
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
158
+ ...{ class: "flex flex-col gap-2 w-[200px]" },
159
+ });
160
+ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
161
+ ...{ class: "font-medium" },
162
+ ...{ class: ({ 'text-chat-error': __VLS_ctx.message.call_status !== __VLS_ctx.PLIVO_CALL_STATUS.CALL_END }) },
163
+ });
164
+ // @ts-ignore
165
+ [message, PLIVO_CALL_STATUS,];
166
+ (__VLS_ctx.callTitle);
167
+ // @ts-ignore
168
+ [callTitle,];
169
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
170
+ ...{ class: "flex items-center gap-2 shrink-0" },
171
+ });
172
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
173
+ ...{ class: "overflow-hidden w-8 h-8 rounded-full text-white" },
174
+ });
175
+ if (__VLS_ctx.message.call_status == __VLS_ctx.PLIVO_CALL_STATUS.CALL_END) {
176
+ // @ts-ignore
177
+ [message, PLIVO_CALL_STATUS,];
178
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
179
+ ...{ class: "bg-chat-success flex-center w-full h-full" },
180
+ });
181
+ /** @type {[typeof IconPhone, ]} */ ;
182
+ // @ts-ignore
183
+ const __VLS_4 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({
184
+ ...{ class: "w-5 h-5" },
185
+ }));
186
+ const __VLS_5 = __VLS_4({
187
+ ...{ class: "w-5 h-5" },
188
+ }, ...__VLS_functionalComponentArgsRest(__VLS_4));
189
+ }
190
+ else {
191
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
192
+ ...{ class: "bg-chat-error flex-center w-full h-full" },
193
+ });
194
+ /** @type {[typeof IconPhoneCancel, ]} */ ;
195
+ // @ts-ignore
196
+ const __VLS_8 = __VLS_asFunctionalComponent(IconPhoneCancel, new IconPhoneCancel({
197
+ ...{ class: "w-5 h-5" },
198
+ }));
199
+ const __VLS_9 = __VLS_8({
200
+ ...{ class: "w-5 h-5" },
201
+ }, ...__VLS_functionalComponentArgsRest(__VLS_8));
202
+ }
203
+ __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
204
+ (__VLS_ctx.getCallDuration(__VLS_ctx.message?.duration ?? 0));
205
+ // @ts-ignore
206
+ [message, getCallDuration,];
207
+ if (__VLS_ctx.dataProfile?.user_type == 'tenant') {
208
+ // @ts-ignore
209
+ [dataProfile,];
210
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
211
+ ...{ onClick: (...[$event]) => {
212
+ if (!(__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyMessage))
213
+ return;
214
+ if (!(__VLS_ctx.message.is_call == 1))
215
+ return;
216
+ if (!(__VLS_ctx.dataProfile?.user_type == 'tenant'))
217
+ return;
218
+ __VLS_ctx.emit('callAgain');
219
+ // @ts-ignore
220
+ [emit,];
221
+ } },
222
+ ...{ class: "flex-center h-10 rounded-xl bg-chat-haze-200 font-semibold" },
223
+ });
224
+ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({});
225
+ }
226
+ }
227
+ else if (__VLS_ctx.message.message) {
228
+ // @ts-ignore
229
+ [message,];
230
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
231
+ __VLS_asFunctionalElement(__VLS_elements.div)({
232
+ ...{ style: ({ wordBreak: 'break-word' }) },
233
+ });
234
+ __VLS_asFunctionalDirective(__VLS_directives.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.message.message) }, null, null);
235
+ // @ts-ignore
236
+ [message,];
237
+ }
238
+ else if (__VLS_ctx.message?.attachments?.length) {
239
+ // @ts-ignore
240
+ [message,];
241
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
242
+ __VLS_asFunctionalElement(__VLS_elements.img)({
243
+ ...{ onLoad: (() => {
244
+ if (__VLS_ctx.isLastMessage) {
245
+ __VLS_ctx.scrollBottom();
246
+ }
247
+ }) },
248
+ src: (__VLS_ctx.message.attachments[0]?.file_path),
249
+ alt: "avatar",
250
+ });
251
+ // @ts-ignore
252
+ [message, isLastMessage, scrollBottom,];
253
+ }
254
+ if (__VLS_ctx.isChatFinished) {
255
+ // @ts-ignore
256
+ [isChatFinished,];
257
+ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
258
+ ...{ class: "text-sm mt-1" },
259
+ });
260
+ (__VLS_ctx.getFinishTime(__VLS_ctx.message?.created_at));
261
+ // @ts-ignore
262
+ [message, getFinishTime,];
263
+ }
264
+ if (__VLS_ctx.isMyMessage) {
265
+ // @ts-ignore
266
+ [isMyMessage,];
267
+ if ((__VLS_ctx.isLastMessage && __VLS_ctx.getMessageStateText(__VLS_ctx.message)) || __VLS_ctx.message.state == __VLS_ctx.MessageState.Failed) {
268
+ // @ts-ignore
269
+ [message, message, MessageState, isLastMessage, getMessageStateText,];
270
+ __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
271
+ ...{ class: "text-chat-haze-200 text-xs mt-1" },
272
+ ...{ class: ({ '!text-chat-error': __VLS_ctx.message.state == __VLS_ctx.MessageState.Failed }) },
273
+ });
274
+ // @ts-ignore
275
+ [message, MessageState,];
276
+ (__VLS_ctx.getMessageStateText(__VLS_ctx.message));
277
+ // @ts-ignore
278
+ [message, getMessageStateText,];
279
+ }
280
+ }
281
+ }
282
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
283
+ /** @type {__VLS_StyleScopedClasses['items-end']} */ ;
284
+ /** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
285
+ /** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
286
+ /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
287
+ /** @type {__VLS_StyleScopedClasses['justify-end']} */ ;
288
+ /** @type {__VLS_StyleScopedClasses['pl-[60px]']} */ ;
289
+ /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
290
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
291
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
292
+ /** @type {__VLS_StyleScopedClasses['px-3']} */ ;
293
+ /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
294
+ /** @type {__VLS_StyleScopedClasses['rounded-2xl']} */ ;
295
+ /** @type {__VLS_StyleScopedClasses['max-w-xs']} */ ;
296
+ /** @type {__VLS_StyleScopedClasses['text-left']} */ ;
297
+ /** @type {__VLS_StyleScopedClasses['rounded-tl-none']} */ ;
298
+ /** @type {__VLS_StyleScopedClasses['rounded-bl-none']} */ ;
299
+ /** @type {__VLS_StyleScopedClasses['rounded-tr-none']} */ ;
300
+ /** @type {__VLS_StyleScopedClasses['rounded-br-none']} */ ;
301
+ /** @type {__VLS_StyleScopedClasses['!text-white']} */ ;
302
+ /** @type {__VLS_StyleScopedClasses['!bg-chat-success']} */ ;
303
+ /** @type {__VLS_StyleScopedClasses['bg-chat-primary']} */ ;
304
+ /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
305
+ /** @type {__VLS_StyleScopedClasses['bg-[#E4E4E4D4]']} */ ;
306
+ /** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
307
+ /** @type {__VLS_StyleScopedClasses['w-max']} */ ;
308
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
309
+ /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
310
+ /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
311
+ /** @type {__VLS_StyleScopedClasses['w-[200px]']} */ ;
312
+ /** @type {__VLS_StyleScopedClasses['font-medium']} */ ;
313
+ /** @type {__VLS_StyleScopedClasses['text-chat-error']} */ ;
314
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
315
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
316
+ /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
317
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
318
+ /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
319
+ /** @type {__VLS_StyleScopedClasses['w-8']} */ ;
320
+ /** @type {__VLS_StyleScopedClasses['h-8']} */ ;
321
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
322
+ /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
323
+ /** @type {__VLS_StyleScopedClasses['bg-chat-success']} */ ;
324
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
325
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
326
+ /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
327
+ /** @type {__VLS_StyleScopedClasses['w-5']} */ ;
328
+ /** @type {__VLS_StyleScopedClasses['h-5']} */ ;
329
+ /** @type {__VLS_StyleScopedClasses['bg-chat-error']} */ ;
330
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
331
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
332
+ /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
333
+ /** @type {__VLS_StyleScopedClasses['w-5']} */ ;
334
+ /** @type {__VLS_StyleScopedClasses['h-5']} */ ;
335
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
336
+ /** @type {__VLS_StyleScopedClasses['h-10']} */ ;
337
+ /** @type {__VLS_StyleScopedClasses['rounded-xl']} */ ;
338
+ /** @type {__VLS_StyleScopedClasses['bg-chat-haze-200']} */ ;
339
+ /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
340
+ /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
341
+ /** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
342
+ /** @type {__VLS_StyleScopedClasses['text-chat-haze-200']} */ ;
343
+ /** @type {__VLS_StyleScopedClasses['text-xs']} */ ;
344
+ /** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
345
+ /** @type {__VLS_StyleScopedClasses['!text-chat-error']} */ ;
346
+ const __VLS_export = (await import('vue')).defineComponent({
347
+ __typeEmits: {},
348
+ __typeProps: {},
349
+ props: {},
350
+ });
351
+ export default {};