@phonghq/go-chat 1.0.8 → 1.0.10

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 (121) hide show
  1. package/README.md +1 -1
  2. package/dist/chat/App.vue.d.ts +3 -2
  3. package/dist/components/chat/call/Calling.vue.d.ts +6 -2
  4. package/dist/components/common/drawer/DrawerBaseCustom.vue.d.ts +30 -0
  5. package/dist/composable/TestSound.d.ts +64 -0
  6. package/dist/composable/useCallHelper.d.ts +26 -8
  7. package/dist/constant/datetime.d.ts +1 -0
  8. package/dist/go-chat.es.js +143 -143
  9. package/dist/go-chat.umd.js +6 -6
  10. package/dist/plugins/websocket.d.ts +1 -0
  11. package/dist/style.css +1 -1
  12. package/dist/test/assets/icons/IconArrowLeft.vue.js +1 -1
  13. package/dist/test/assets/icons/IconPhone.vue.js +1 -1
  14. package/dist/test/assets/icons/IconPlan.vue.js +1 -1
  15. package/dist/test/assets/icons/IconPlus.vue.js +1 -1
  16. package/dist/test/assets/icons/IconSearch.vue.js +1 -1
  17. package/dist/test/assets/icons/call/IconMic.vue.js +1 -1
  18. package/dist/test/assets/icons/call/IconPhone.vue.js +1 -1
  19. package/dist/test/assets/icons/call/IconPhoneCancel.vue.js +1 -1
  20. package/dist/test/assets/icons/call/IconSpeaker.vue.js +1 -1
  21. package/dist/test/assets/icons/customer-appointment/IconFilter.vue.js +1 -1
  22. package/dist/test/assets/icons/customer-detail/IconArrow.vue.js +1 -1
  23. package/dist/test/assets/icons/customer-detail/IconCheck.vue.js +1 -1
  24. package/dist/test/assets/icons/customer-detail/IconDate.vue.js +1 -1
  25. package/dist/test/assets/icons/customer-detail/IconGroup.vue.js +1 -1
  26. package/dist/test/assets/icons/customer-detail/IconMessage.vue.js +1 -1
  27. package/dist/test/assets/icons/customer-detail/IconNote.vue.js +1 -1
  28. package/dist/test/assets/icons/customer-detail/IconPhone.vue.js +1 -1
  29. package/dist/test/assets/icons/customer-detail/IconPin.vue.js +1 -1
  30. package/dist/test/assets/icons/customer-detail/IconSearch.vue.js +1 -1
  31. package/dist/test/chat/App.vue.js +174 -108
  32. package/dist/test/chat/page/customer-appointment/CustomerAppointment.vue.js +1 -1
  33. package/dist/test/chat/page/customer-check-in/CollapseCheckIn.vue.js +1 -1
  34. package/dist/test/chat/page/customer-check-in/CustomerCheckIn.vue.js +1 -1
  35. package/dist/test/chat/page/customer-detail/CustomerDetail.vue.js +1 -1
  36. package/dist/test/chat/page/customer-detail/SubInformation.vue.js +1 -1
  37. package/dist/test/chat/page/error/Error.vue.js +1 -1
  38. package/dist/test/chat/page/home/ChatList.vue.js +40 -6
  39. package/dist/test/chat/page/home/ChatMessage.vue.js +1 -1
  40. package/dist/test/chat/page/home/Home.vue.js +9 -3
  41. package/dist/test/chat/page/home/InputChat.vue.js +3 -2
  42. package/dist/test/chat/page/home/NewCustomer.vue.js +1 -1
  43. package/dist/test/components/ListenEvent.vue.js +1 -1
  44. package/dist/test/components/chat/ScrollEvent/ScrollEvent.vue.js +1 -1
  45. package/dist/test/components/chat/call/Calling.vue.js +102 -70
  46. package/dist/test/components/chat/card/CardCustomerDetail.vue.js +1 -1
  47. package/dist/test/components/chat/common/collapse/CollapseBase.vue.js +1 -1
  48. package/dist/test/components/chat/common/input/InputSearch.vue.js +1 -1
  49. package/dist/test/components/chat/common/popover/PopoverBase.vue.js +1 -1
  50. package/dist/test/components/chat/common/spin/BaseSpin.vue.js +1 -1
  51. package/dist/test/components/chat/customer/Avatar.vue.js +1 -1
  52. package/dist/test/components/chat/layout/mobile/Footer.vue.js +1 -1
  53. package/dist/test/components/common/CustomLoading.vue.js +1 -1
  54. package/dist/test/components/common/Notification/NotificationDescription.vue.js +1 -1
  55. package/dist/test/components/common/button/ButtonBase.vue.js +1 -1
  56. package/dist/test/components/common/button/ButtonToggle.vue.js +1 -1
  57. package/dist/test/components/common/checkbox/CCheckboxNumber.vue.js +1 -1
  58. package/dist/test/components/common/collapse/BaseCollapse.vue.js +1 -1
  59. package/dist/test/components/common/collapse/BaseCollapseItem.vue.js +1 -1
  60. package/dist/test/components/common/drawer/DrawerBase.vue.js +1 -1
  61. package/dist/test/components/common/drawer/DrawerBaseCustom.vue.js +128 -0
  62. package/dist/test/components/common/dropdown/DropdownBase.vue.js +1 -1
  63. package/dist/test/components/common/input/CInputSearch.vue.js +1 -1
  64. package/dist/test/components/common/modal/ModalBase.vue.js +1 -1
  65. package/dist/test/components/common/popover/PopoverBase.vue.js +1 -1
  66. package/dist/test/components/common/slider/BaseSlider.vue.js +1 -1
  67. package/dist/test/components/common/spin/CSpin.vue.js +1 -1
  68. package/dist/test/components/common/tooltip/TooltipBase.vue.js +1 -1
  69. package/dist/test/components/layout/Blank.vue.js +1 -1
  70. package/dist/test/components/layout/Default.vue.js +1 -1
  71. package/dist/test/components/modal/Confirm.vue.js +1 -1
  72. package/dist/test/components/ui/button/CButton.vue.js +1 -1
  73. package/dist/test/components/ui/checkbox/Checkbox.vue.js +1 -1
  74. package/dist/test/components/ui/collapsible/Collapsible.vue.js +1 -1
  75. package/dist/test/components/ui/collapsible/CollapsibleContent.vue.js +1 -1
  76. package/dist/test/components/ui/collapsible/CollapsibleTrigger.vue.js +1 -1
  77. package/dist/test/components/ui/dialog/Dialog.vue.js +1 -1
  78. package/dist/test/components/ui/dialog/DialogClose.vue.js +1 -1
  79. package/dist/test/components/ui/dialog/DialogContent.vue.js +1 -1
  80. package/dist/test/components/ui/dialog/DialogDescription.vue.js +1 -1
  81. package/dist/test/components/ui/dialog/DialogFooter.vue.js +1 -1
  82. package/dist/test/components/ui/dialog/DialogHeader.vue.js +1 -1
  83. package/dist/test/components/ui/dialog/DialogScrollContent.vue.js +1 -1
  84. package/dist/test/components/ui/dialog/DialogTitle.vue.js +1 -1
  85. package/dist/test/components/ui/dialog/DialogTrigger.vue.js +1 -1
  86. package/dist/test/components/ui/drawer/Drawer.vue.js +1 -1
  87. package/dist/test/components/ui/drawer/DrawerContent.vue.js +1 -1
  88. package/dist/test/components/ui/drawer/DrawerDescription.vue.js +1 -1
  89. package/dist/test/components/ui/drawer/DrawerFooter.vue.js +1 -1
  90. package/dist/test/components/ui/drawer/DrawerHeader.vue.js +1 -1
  91. package/dist/test/components/ui/drawer/DrawerOverlay.vue.js +3 -3
  92. package/dist/test/components/ui/drawer/DrawerTitle.vue.js +1 -1
  93. package/dist/test/components/ui/dropdown-menu/DropdownMenu.vue.js +1 -1
  94. package/dist/test/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.js +1 -1
  95. package/dist/test/components/ui/dropdown-menu/DropdownMenuContent.vue.js +1 -1
  96. package/dist/test/components/ui/dropdown-menu/DropdownMenuGroup.vue.js +1 -1
  97. package/dist/test/components/ui/dropdown-menu/DropdownMenuItem.vue.js +1 -1
  98. package/dist/test/components/ui/dropdown-menu/DropdownMenuLabel.vue.js +1 -1
  99. package/dist/test/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.js +1 -1
  100. package/dist/test/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.js +1 -1
  101. package/dist/test/components/ui/dropdown-menu/DropdownMenuSeparator.vue.js +1 -1
  102. package/dist/test/components/ui/dropdown-menu/DropdownMenuShortcut.vue.js +1 -1
  103. package/dist/test/components/ui/dropdown-menu/DropdownMenuSub.vue.js +1 -1
  104. package/dist/test/components/ui/dropdown-menu/DropdownMenuSubContent.vue.js +1 -1
  105. package/dist/test/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.js +1 -1
  106. package/dist/test/components/ui/dropdown-menu/DropdownMenuTrigger.vue.js +1 -1
  107. package/dist/test/components/ui/popover/Popover.vue.js +1 -1
  108. package/dist/test/components/ui/popover/PopoverContent.vue.js +1 -1
  109. package/dist/test/components/ui/popover/PopoverTrigger.vue.js +1 -1
  110. package/dist/test/components/ui/radio-group/RadioGroup.vue.js +1 -1
  111. package/dist/test/components/ui/radio-group/RadioGroupItem.vue.js +1 -1
  112. package/dist/test/components/ui/slider/Slider.vue.js +1 -1
  113. package/dist/test/components/ui/switch/Switch.vue.js +1 -1
  114. package/dist/test/composable/TestSound.js +196 -0
  115. package/dist/test/composable/useCallHelper.js +198 -142
  116. package/dist/test/constant/datetime.js +1 -0
  117. package/dist/test/plugins/websocket.js +10 -13
  118. package/dist/test/utils/chat/call.js +37 -0
  119. package/dist/types/chat/global.d.ts +1 -0
  120. package/dist/utils/chat/call.d.ts +2 -0
  121. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
1
+ /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import ChatList from '../chat/page/home/ChatList.vue';
3
3
  import HomeComponent from '../chat/page/home/Home.vue';
4
4
  import IconArrowLeft from '../assets/icons/IconArrowLeft.vue';
5
- import { computed, nextTick, ref } from 'vue';
5
+ import { computed, nextTick, onMounted, onUnmounted, ref } from 'vue';
6
6
  import { PAGE } from '../constant/general';
7
7
  import CustomerDetail from '../chat/page/customer-detail/CustomerDetail.vue';
8
8
  import CustomerCheckIn from '../chat/page/customer-check-in/CustomerCheckIn.vue';
@@ -15,6 +15,8 @@ import Calling from '../components/chat/call/Calling.vue';
15
15
  import { logout } from '../utils/chat/auth';
16
16
  import MobileFooter from '../components/chat/layout/mobile/Footer.vue';
17
17
  import { initWebSocket } from '../plugins/websocket';
18
+ import '../style/index.scss';
19
+ import { useDebounce } from '../utils/debounce';
18
20
  const routerConfig = [
19
21
  { id: PAGE.HOME, backFunc: null, backTitle: '' },
20
22
  {
@@ -32,8 +34,16 @@ const routerConfig = [
32
34
  backTitle: 'Appointments'
33
35
  }
34
36
  ];
35
- const routerMobileConfig = [
36
- { id: PAGE.CHAT_LIST, backFunc: logout, backTitle: 'ChatBiz' },
37
+ const routerMobileConfig = computed(() => [
38
+ {
39
+ id: PAGE.CHAT_LIST,
40
+ backFunc: props.isLib
41
+ ? undefined
42
+ : () => {
43
+ logout();
44
+ },
45
+ backTitle: 'ChatBiz'
46
+ },
37
47
  {
38
48
  id: PAGE.HOME,
39
49
  backFunc: () => {
@@ -55,17 +65,29 @@ const routerMobileConfig = [
55
65
  },
56
66
  backTitle: 'Appointments'
57
67
  }
58
- ];
68
+ ]);
59
69
  const props = withDefaults(defineProps(), {
60
70
  response: 'tablet'
61
71
  });
62
72
  const { initPage } = useInitData();
73
+ onMounted(() => {
74
+ getResponsiveObserver();
75
+ window.addEventListener('resize', getResponsiveObserver);
76
+ });
77
+ onUnmounted(() => {
78
+ window.removeEventListener('resize', getResponsiveObserver);
79
+ });
63
80
  const currentPageConfig = computed(() => {
64
- if (props.response === 'mobile') {
65
- return routerMobileConfig.find((e) => e.id == currentPage.value);
81
+ if (responsiveRender.value === 'mobile') {
82
+ return routerMobileConfig.value.find((e) => e.id == currentPage.value);
66
83
  }
67
84
  return routerConfig.find((e) => e.id == currentPage.value);
68
85
  });
86
+ const responsiveRender = computed(() => {
87
+ return props.response == 'mobile' ? props.response : responsiveObserver.value;
88
+ });
89
+ const responsiveObserver = ref('tablet');
90
+ const appChatRef = ref();
69
91
  const callingRef = ref(null);
70
92
  const receiverId = ref(null);
71
93
  const customerDetailRef = ref(null);
@@ -85,6 +107,25 @@ const selectReceiver = async (data) => {
85
107
  const handleCall = (user) => {
86
108
  callingRef.value?.startCall(user);
87
109
  };
110
+ const getResponsiveObserver = useDebounce(() => {
111
+ // const div = document.getElementById('appChatMain')
112
+ if (!appChatRef.value)
113
+ return;
114
+ const width = appChatRef.value?.offsetWidth ?? 0;
115
+ if (width >= 640) {
116
+ if (responsiveObserver.value != 'tablet') {
117
+ responsiveObserver.value = 'tablet';
118
+ }
119
+ }
120
+ else {
121
+ if (responsiveObserver.value != 'mobile') {
122
+ if (currentPage.value == PAGE.HOME) {
123
+ currentPage.value = PAGE.CHAT_LIST;
124
+ }
125
+ responsiveObserver.value = 'mobile';
126
+ }
127
+ }
128
+ }, 50);
88
129
  initWebSocket('https://web-socket.dev01.dtsmart.dev');
89
130
  initPage({ id: props.id, domain: props.domain, token: props.token, response: props.response });
90
131
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
@@ -101,8 +142,13 @@ let __VLS_elements;
101
142
  let __VLS_components;
102
143
  let __VLS_directives;
103
144
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
104
- ...{ class: "go-chat-main p-8" },
145
+ ...{ class: "go-chat-main max-w-full p-8" },
146
+ id: "appChatMain",
147
+ ref: "appChatRef",
105
148
  });
149
+ /** @type {typeof __VLS_ctx.appChatRef} */ ;
150
+ // @ts-ignore
151
+ [appChatRef,];
106
152
  if (!__VLS_ctx.isRouterReady) {
107
153
  // @ts-ignore
108
154
  [isRouterReady,];
@@ -122,12 +168,27 @@ else if (__VLS_ctx.currentPage == __VLS_ctx.PAGE.TENANT_ERROR) {
122
168
  const __VLS_4 = __VLS_asFunctionalComponent(Error, new Error({}));
123
169
  const __VLS_5 = __VLS_4({}, ...__VLS_functionalComponentArgsRest(__VLS_4));
124
170
  }
125
- else if (__VLS_ctx.response == 'mobile') {
171
+ else if (__VLS_ctx.responsiveRender == 'mobile') {
126
172
  // @ts-ignore
127
- [response,];
173
+ [responsiveRender,];
128
174
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
129
175
  ...{ class: "relative flex flex-col mx-auto w-max max-w-[350px] h-full bg-[#F9FAFC] overflow-hidden chat-mobile pt-4" },
130
176
  });
177
+ /** @type {[typeof Calling, ]} */ ;
178
+ // @ts-ignore
179
+ const __VLS_8 = __VLS_asFunctionalComponent(Calling, new Calling({
180
+ ref: "callingRef",
181
+ responsive: (__VLS_ctx.responsiveRender),
182
+ }));
183
+ const __VLS_9 = __VLS_8({
184
+ ref: "callingRef",
185
+ responsive: (__VLS_ctx.responsiveRender),
186
+ }, ...__VLS_functionalComponentArgsRest(__VLS_8));
187
+ /** @type {typeof __VLS_ctx.callingRef} */ ;
188
+ var __VLS_11 = {};
189
+ // @ts-ignore
190
+ [responsiveRender, callingRef,];
191
+ var __VLS_10;
131
192
  if (__VLS_ctx.currentPageConfig?.backFunc) {
132
193
  // @ts-ignore
133
194
  [currentPageConfig,];
@@ -140,7 +201,7 @@ else if (__VLS_ctx.response == 'mobile') {
140
201
  return;
141
202
  if (!!(__VLS_ctx.currentPage == __VLS_ctx.PAGE.TENANT_ERROR))
142
203
  return;
143
- if (!(__VLS_ctx.response == 'mobile'))
204
+ if (!(__VLS_ctx.responsiveRender == 'mobile'))
144
205
  return;
145
206
  if (!(__VLS_ctx.currentPageConfig?.backFunc))
146
207
  return;
@@ -152,8 +213,8 @@ else if (__VLS_ctx.response == 'mobile') {
152
213
  });
153
214
  /** @type {[typeof IconArrowLeft, ]} */ ;
154
215
  // @ts-ignore
155
- const __VLS_8 = __VLS_asFunctionalComponent(IconArrowLeft, new IconArrowLeft({}));
156
- const __VLS_9 = __VLS_8({}, ...__VLS_functionalComponentArgsRest(__VLS_8));
216
+ const __VLS_14 = __VLS_asFunctionalComponent(IconArrowLeft, new IconArrowLeft({}));
217
+ const __VLS_15 = __VLS_14({}, ...__VLS_functionalComponentArgsRest(__VLS_14));
157
218
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
158
219
  ...{ class: "text-xl font-semibold text-chat-haze-900 ml-3" },
159
220
  });
@@ -166,145 +227,145 @@ else if (__VLS_ctx.response == 'mobile') {
166
227
  });
167
228
  /** @type {[typeof ChatList, ]} */ ;
168
229
  // @ts-ignore
169
- const __VLS_12 = __VLS_asFunctionalComponent(ChatList, new ChatList({
230
+ const __VLS_18 = __VLS_asFunctionalComponent(ChatList, new ChatList({
170
231
  ...{ 'onSelectReceiver': {} },
171
232
  ref: "chatListRef",
172
233
  ...{ class: "w-full max-w-[500px] !bg-[#F9FAFC]" },
173
- response: (__VLS_ctx.response),
234
+ response: (__VLS_ctx.responsiveRender),
174
235
  receiverId: (__VLS_ctx.receiverId),
175
236
  }));
176
- const __VLS_13 = __VLS_12({
237
+ const __VLS_19 = __VLS_18({
177
238
  ...{ 'onSelectReceiver': {} },
178
239
  ref: "chatListRef",
179
240
  ...{ class: "w-full max-w-[500px] !bg-[#F9FAFC]" },
180
- response: (__VLS_ctx.response),
241
+ response: (__VLS_ctx.responsiveRender),
181
242
  receiverId: (__VLS_ctx.receiverId),
182
- }, ...__VLS_functionalComponentArgsRest(__VLS_12));
183
- let __VLS_15;
184
- let __VLS_16;
185
- const __VLS_17 = ({ selectReceiver: {} },
243
+ }, ...__VLS_functionalComponentArgsRest(__VLS_18));
244
+ let __VLS_21;
245
+ let __VLS_22;
246
+ const __VLS_23 = ({ selectReceiver: {} },
186
247
  { onSelectReceiver: (__VLS_ctx.selectReceiver) });
187
248
  __VLS_asFunctionalDirective(__VLS_directives.vShow)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.currentPage == __VLS_ctx.PAGE.CHAT_LIST) }, null, null);
188
249
  /** @type {typeof __VLS_ctx.chatListRef} */ ;
189
- var __VLS_18 = {};
250
+ var __VLS_24 = {};
190
251
  // @ts-ignore
191
- [currentPage, PAGE, response, receiverId, selectReceiver, chatListRef,];
192
- var __VLS_14;
252
+ [currentPage, PAGE, responsiveRender, receiverId, selectReceiver, chatListRef,];
253
+ var __VLS_20;
193
254
  /** @type {[typeof HomeComponent, ]} */ ;
194
255
  // @ts-ignore
195
- const __VLS_21 = __VLS_asFunctionalComponent(HomeComponent, new HomeComponent({
256
+ const __VLS_27 = __VLS_asFunctionalComponent(HomeComponent, new HomeComponent({
196
257
  ...{ 'onCall': {} },
197
258
  ref: "homeComponentRef",
198
259
  receiverId: (__VLS_ctx.receiverId),
199
260
  ...{ class: "h-full pt-4" },
200
- response: (__VLS_ctx.response),
261
+ response: (__VLS_ctx.responsiveRender),
201
262
  }));
202
- const __VLS_22 = __VLS_21({
263
+ const __VLS_28 = __VLS_27({
203
264
  ...{ 'onCall': {} },
204
265
  ref: "homeComponentRef",
205
266
  receiverId: (__VLS_ctx.receiverId),
206
267
  ...{ class: "h-full pt-4" },
207
- response: (__VLS_ctx.response),
208
- }, ...__VLS_functionalComponentArgsRest(__VLS_21));
209
- let __VLS_24;
210
- let __VLS_25;
211
- const __VLS_26 = ({ call: {} },
268
+ response: (__VLS_ctx.responsiveRender),
269
+ }, ...__VLS_functionalComponentArgsRest(__VLS_27));
270
+ let __VLS_30;
271
+ let __VLS_31;
272
+ const __VLS_32 = ({ call: {} },
212
273
  { onCall: (__VLS_ctx.handleCall) });
213
274
  __VLS_asFunctionalDirective(__VLS_directives.vShow)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.currentPage == __VLS_ctx.PAGE.HOME) }, null, null);
214
275
  /** @type {typeof __VLS_ctx.homeComponentRef} */ ;
215
- var __VLS_27 = {};
276
+ var __VLS_33 = {};
216
277
  // @ts-ignore
217
- [currentPage, PAGE, response, receiverId, handleCall, homeComponentRef,];
218
- var __VLS_23;
278
+ [currentPage, PAGE, responsiveRender, receiverId, handleCall, homeComponentRef,];
279
+ var __VLS_29;
219
280
  if (__VLS_ctx.currentPage == __VLS_ctx.PAGE.CUSTOMER_DETAIL) {
220
281
  // @ts-ignore
221
282
  [currentPage, PAGE,];
222
283
  /** @type {[typeof CustomerDetail, ]} */ ;
223
284
  // @ts-ignore
224
- const __VLS_30 = __VLS_asFunctionalComponent(CustomerDetail, new CustomerDetail({
285
+ const __VLS_36 = __VLS_asFunctionalComponent(CustomerDetail, new CustomerDetail({
225
286
  ref: "customerDetailRef",
226
287
  receiverId: (__VLS_ctx.receiverId),
227
288
  ...{ class: "h-full" },
228
- response: (__VLS_ctx.response),
289
+ response: (__VLS_ctx.responsiveRender),
229
290
  }));
230
- const __VLS_31 = __VLS_30({
291
+ const __VLS_37 = __VLS_36({
231
292
  ref: "customerDetailRef",
232
293
  receiverId: (__VLS_ctx.receiverId),
233
294
  ...{ class: "h-full" },
234
- response: (__VLS_ctx.response),
235
- }, ...__VLS_functionalComponentArgsRest(__VLS_30));
295
+ response: (__VLS_ctx.responsiveRender),
296
+ }, ...__VLS_functionalComponentArgsRest(__VLS_36));
236
297
  /** @type {typeof __VLS_ctx.customerDetailRef} */ ;
237
- var __VLS_33 = {};
298
+ var __VLS_39 = {};
238
299
  // @ts-ignore
239
- [response, receiverId, customerDetailRef,];
240
- var __VLS_32;
300
+ [responsiveRender, receiverId, customerDetailRef,];
301
+ var __VLS_38;
241
302
  }
242
303
  if (__VLS_ctx.currentPage == __VLS_ctx.PAGE.CUSTOMER_CHECK_IN) {
243
304
  // @ts-ignore
244
305
  [currentPage, PAGE,];
245
306
  /** @type {[typeof CustomerCheckIn, ]} */ ;
246
307
  // @ts-ignore
247
- const __VLS_36 = __VLS_asFunctionalComponent(CustomerCheckIn, new CustomerCheckIn({
308
+ const __VLS_42 = __VLS_asFunctionalComponent(CustomerCheckIn, new CustomerCheckIn({
248
309
  ...{ class: "h-full" },
249
310
  }));
250
- const __VLS_37 = __VLS_36({
311
+ const __VLS_43 = __VLS_42({
251
312
  ...{ class: "h-full" },
252
- }, ...__VLS_functionalComponentArgsRest(__VLS_36));
313
+ }, ...__VLS_functionalComponentArgsRest(__VLS_42));
253
314
  }
254
315
  if (__VLS_ctx.currentPage == __VLS_ctx.PAGE.CUSTOMER_APPOINTMENT) {
255
316
  // @ts-ignore
256
317
  [currentPage, PAGE,];
257
318
  /** @type {[typeof CustomerAppointment, ]} */ ;
258
319
  // @ts-ignore
259
- const __VLS_40 = __VLS_asFunctionalComponent(CustomerAppointment, new CustomerAppointment({
320
+ const __VLS_46 = __VLS_asFunctionalComponent(CustomerAppointment, new CustomerAppointment({
260
321
  ...{ class: "h-full" },
261
322
  }));
262
- const __VLS_41 = __VLS_40({
323
+ const __VLS_47 = __VLS_46({
263
324
  ...{ class: "h-full" },
264
- }, ...__VLS_functionalComponentArgsRest(__VLS_40));
325
+ }, ...__VLS_functionalComponentArgsRest(__VLS_46));
265
326
  }
266
327
  if (__VLS_ctx.currentPage != __VLS_ctx.PAGE.HOME) {
267
328
  // @ts-ignore
268
329
  [currentPage, PAGE,];
269
330
  /** @type {[typeof MobileFooter, ]} */ ;
270
331
  // @ts-ignore
271
- const __VLS_44 = __VLS_asFunctionalComponent(MobileFooter, new MobileFooter({
332
+ const __VLS_50 = __VLS_asFunctionalComponent(MobileFooter, new MobileFooter({
272
333
  ...{ class: "shrink-0" },
273
334
  }));
274
- const __VLS_45 = __VLS_44({
335
+ const __VLS_51 = __VLS_50({
275
336
  ...{ class: "shrink-0" },
276
- }, ...__VLS_functionalComponentArgsRest(__VLS_44));
337
+ }, ...__VLS_functionalComponentArgsRest(__VLS_50));
277
338
  }
278
339
  }
279
340
  else {
280
341
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
281
- ...{ class: "flex gap-4 h-full" },
342
+ ...{ class: "flex gap-4 h-full relative" },
282
343
  });
283
344
  /** @type {[typeof ChatList, ]} */ ;
284
345
  // @ts-ignore
285
- const __VLS_48 = __VLS_asFunctionalComponent(ChatList, new ChatList({
346
+ const __VLS_54 = __VLS_asFunctionalComponent(ChatList, new ChatList({
286
347
  ...{ 'onSelectReceiver': {} },
287
348
  ref: "chatListRef",
288
- ...{ class: "w-[38%] max-w-[500px]" },
289
- response: (__VLS_ctx.response),
349
+ ...{ class: "w-[38%] max-w-[500px] min-w-[450px]" },
350
+ response: (__VLS_ctx.responsiveRender),
290
351
  receiverId: (__VLS_ctx.receiverId),
291
352
  }));
292
- const __VLS_49 = __VLS_48({
353
+ const __VLS_55 = __VLS_54({
293
354
  ...{ 'onSelectReceiver': {} },
294
355
  ref: "chatListRef",
295
- ...{ class: "w-[38%] max-w-[500px]" },
296
- response: (__VLS_ctx.response),
356
+ ...{ class: "w-[38%] max-w-[500px] min-w-[450px]" },
357
+ response: (__VLS_ctx.responsiveRender),
297
358
  receiverId: (__VLS_ctx.receiverId),
298
- }, ...__VLS_functionalComponentArgsRest(__VLS_48));
299
- let __VLS_51;
300
- let __VLS_52;
301
- const __VLS_53 = ({ selectReceiver: {} },
359
+ }, ...__VLS_functionalComponentArgsRest(__VLS_54));
360
+ let __VLS_57;
361
+ let __VLS_58;
362
+ const __VLS_59 = ({ selectReceiver: {} },
302
363
  { onSelectReceiver: (__VLS_ctx.selectReceiver) });
303
364
  /** @type {typeof __VLS_ctx.chatListRef} */ ;
304
- var __VLS_54 = {};
365
+ var __VLS_60 = {};
305
366
  // @ts-ignore
306
- [response, receiverId, selectReceiver, chatListRef,];
307
- var __VLS_50;
367
+ [responsiveRender, receiverId, selectReceiver, chatListRef,];
368
+ var __VLS_56;
308
369
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
309
370
  ...{ class: "chat-box-white grow flex flex-col h-full pt-6 overflow-hidden" },
310
371
  });
@@ -320,7 +381,7 @@ else {
320
381
  return;
321
382
  if (!!(__VLS_ctx.currentPage == __VLS_ctx.PAGE.TENANT_ERROR))
322
383
  return;
323
- if (!!(__VLS_ctx.response == 'mobile'))
384
+ if (!!(__VLS_ctx.responsiveRender == 'mobile'))
324
385
  return;
325
386
  if (!(__VLS_ctx.currentPageConfig?.backFunc))
326
387
  return;
@@ -332,8 +393,8 @@ else {
332
393
  });
333
394
  /** @type {[typeof IconArrowLeft, ]} */ ;
334
395
  // @ts-ignore
335
- const __VLS_57 = __VLS_asFunctionalComponent(IconArrowLeft, new IconArrowLeft({}));
336
- const __VLS_58 = __VLS_57({}, ...__VLS_functionalComponentArgsRest(__VLS_57));
396
+ const __VLS_63 = __VLS_asFunctionalComponent(IconArrowLeft, new IconArrowLeft({}));
397
+ const __VLS_64 = __VLS_63({}, ...__VLS_functionalComponentArgsRest(__VLS_63));
337
398
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
338
399
  ...{ class: "text-xl font-semibold text-chat-haze-900 ml-3" },
339
400
  });
@@ -346,92 +407,95 @@ else {
346
407
  });
347
408
  /** @type {[typeof HomeComponent, ]} */ ;
348
409
  // @ts-ignore
349
- const __VLS_61 = __VLS_asFunctionalComponent(HomeComponent, new HomeComponent({
410
+ const __VLS_67 = __VLS_asFunctionalComponent(HomeComponent, new HomeComponent({
350
411
  ...{ 'onCall': {} },
351
412
  ref: "homeComponentRef",
352
413
  receiverId: (__VLS_ctx.receiverId),
353
414
  ...{ class: "h-full" },
354
- response: (__VLS_ctx.response),
415
+ response: (__VLS_ctx.responsiveRender),
355
416
  }));
356
- const __VLS_62 = __VLS_61({
417
+ const __VLS_68 = __VLS_67({
357
418
  ...{ 'onCall': {} },
358
419
  ref: "homeComponentRef",
359
420
  receiverId: (__VLS_ctx.receiverId),
360
421
  ...{ class: "h-full" },
361
- response: (__VLS_ctx.response),
362
- }, ...__VLS_functionalComponentArgsRest(__VLS_61));
363
- let __VLS_64;
364
- let __VLS_65;
365
- const __VLS_66 = ({ call: {} },
422
+ response: (__VLS_ctx.responsiveRender),
423
+ }, ...__VLS_functionalComponentArgsRest(__VLS_67));
424
+ let __VLS_70;
425
+ let __VLS_71;
426
+ const __VLS_72 = ({ call: {} },
366
427
  { onCall: (__VLS_ctx.handleCall) });
367
428
  __VLS_asFunctionalDirective(__VLS_directives.vShow)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.currentPage == __VLS_ctx.PAGE.HOME) }, null, null);
368
429
  /** @type {typeof __VLS_ctx.homeComponentRef} */ ;
369
- var __VLS_67 = {};
430
+ var __VLS_73 = {};
370
431
  // @ts-ignore
371
- [currentPage, PAGE, response, receiverId, handleCall, homeComponentRef,];
372
- var __VLS_63;
432
+ [currentPage, PAGE, responsiveRender, receiverId, handleCall, homeComponentRef,];
433
+ var __VLS_69;
373
434
  if (__VLS_ctx.currentPage == __VLS_ctx.PAGE.CUSTOMER_DETAIL) {
374
435
  // @ts-ignore
375
436
  [currentPage, PAGE,];
376
437
  /** @type {[typeof CustomerDetail, ]} */ ;
377
438
  // @ts-ignore
378
- const __VLS_70 = __VLS_asFunctionalComponent(CustomerDetail, new CustomerDetail({
439
+ const __VLS_76 = __VLS_asFunctionalComponent(CustomerDetail, new CustomerDetail({
379
440
  ref: "customerDetailRef",
380
441
  receiverId: (__VLS_ctx.receiverId),
381
442
  ...{ class: "h-full" },
382
- response: (__VLS_ctx.response),
443
+ response: (__VLS_ctx.responsiveRender),
383
444
  }));
384
- const __VLS_71 = __VLS_70({
445
+ const __VLS_77 = __VLS_76({
385
446
  ref: "customerDetailRef",
386
447
  receiverId: (__VLS_ctx.receiverId),
387
448
  ...{ class: "h-full" },
388
- response: (__VLS_ctx.response),
389
- }, ...__VLS_functionalComponentArgsRest(__VLS_70));
449
+ response: (__VLS_ctx.responsiveRender),
450
+ }, ...__VLS_functionalComponentArgsRest(__VLS_76));
390
451
  /** @type {typeof __VLS_ctx.customerDetailRef} */ ;
391
- var __VLS_73 = {};
452
+ var __VLS_79 = {};
392
453
  // @ts-ignore
393
- [response, receiverId, customerDetailRef,];
394
- var __VLS_72;
454
+ [responsiveRender, receiverId, customerDetailRef,];
455
+ var __VLS_78;
395
456
  }
396
457
  if (__VLS_ctx.currentPage == __VLS_ctx.PAGE.CUSTOMER_CHECK_IN) {
397
458
  // @ts-ignore
398
459
  [currentPage, PAGE,];
399
460
  /** @type {[typeof CustomerCheckIn, ]} */ ;
400
461
  // @ts-ignore
401
- const __VLS_76 = __VLS_asFunctionalComponent(CustomerCheckIn, new CustomerCheckIn({
462
+ const __VLS_82 = __VLS_asFunctionalComponent(CustomerCheckIn, new CustomerCheckIn({
402
463
  ...{ class: "h-full" },
403
464
  }));
404
- const __VLS_77 = __VLS_76({
465
+ const __VLS_83 = __VLS_82({
405
466
  ...{ class: "h-full" },
406
- }, ...__VLS_functionalComponentArgsRest(__VLS_76));
467
+ }, ...__VLS_functionalComponentArgsRest(__VLS_82));
407
468
  }
408
469
  if (__VLS_ctx.currentPage == __VLS_ctx.PAGE.CUSTOMER_APPOINTMENT) {
409
470
  // @ts-ignore
410
471
  [currentPage, PAGE,];
411
472
  /** @type {[typeof CustomerAppointment, ]} */ ;
412
473
  // @ts-ignore
413
- const __VLS_80 = __VLS_asFunctionalComponent(CustomerAppointment, new CustomerAppointment({
474
+ const __VLS_86 = __VLS_asFunctionalComponent(CustomerAppointment, new CustomerAppointment({
414
475
  ...{ class: "h-full" },
415
476
  }));
416
- const __VLS_81 = __VLS_80({
477
+ const __VLS_87 = __VLS_86({
417
478
  ...{ class: "h-full" },
418
- }, ...__VLS_functionalComponentArgsRest(__VLS_80));
479
+ }, ...__VLS_functionalComponentArgsRest(__VLS_86));
419
480
  }
481
+ /** @type {[typeof Calling, ]} */ ;
482
+ // @ts-ignore
483
+ const __VLS_90 = __VLS_asFunctionalComponent(Calling, new Calling({
484
+ ref: "callingRef",
485
+ responsive: (__VLS_ctx.responsiveRender),
486
+ }));
487
+ const __VLS_91 = __VLS_90({
488
+ ref: "callingRef",
489
+ responsive: (__VLS_ctx.responsiveRender),
490
+ }, ...__VLS_functionalComponentArgsRest(__VLS_90));
491
+ /** @type {typeof __VLS_ctx.callingRef} */ ;
492
+ var __VLS_93 = {};
493
+ // @ts-ignore
494
+ [responsiveRender, callingRef,];
495
+ var __VLS_92;
420
496
  }
421
- /** @type {[typeof Calling, ]} */ ;
422
- // @ts-ignore
423
- const __VLS_84 = __VLS_asFunctionalComponent(Calling, new Calling({
424
- ref: "callingRef",
425
- }));
426
- const __VLS_85 = __VLS_84({
427
- ref: "callingRef",
428
- }, ...__VLS_functionalComponentArgsRest(__VLS_84));
429
- /** @type {typeof __VLS_ctx.callingRef} */ ;
430
- var __VLS_87 = {};
431
- // @ts-ignore
432
- [callingRef,];
433
- var __VLS_86;
434
497
  /** @type {__VLS_StyleScopedClasses['go-chat-main']} */ ;
498
+ /** @type {__VLS_StyleScopedClasses['max-w-full']} */ ;
435
499
  /** @type {__VLS_StyleScopedClasses['p-8']} */ ;
436
500
  /** @type {__VLS_StyleScopedClasses['m-auto']} */ ;
437
501
  /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
@@ -470,8 +534,10 @@ var __VLS_86;
470
534
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
471
535
  /** @type {__VLS_StyleScopedClasses['gap-4']} */ ;
472
536
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
537
+ /** @type {__VLS_StyleScopedClasses['relative']} */ ;
473
538
  /** @type {__VLS_StyleScopedClasses['w-[38%]']} */ ;
474
539
  /** @type {__VLS_StyleScopedClasses['max-w-[500px]']} */ ;
540
+ /** @type {__VLS_StyleScopedClasses['min-w-[450px]']} */ ;
475
541
  /** @type {__VLS_StyleScopedClasses['chat-box-white']} */ ;
476
542
  /** @type {__VLS_StyleScopedClasses['grow']} */ ;
477
543
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
@@ -494,7 +560,7 @@ var __VLS_86;
494
560
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
495
561
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
496
562
  // @ts-ignore
497
- var __VLS_19 = __VLS_18, __VLS_28 = __VLS_27, __VLS_34 = __VLS_33, __VLS_55 = __VLS_54, __VLS_68 = __VLS_67, __VLS_74 = __VLS_73, __VLS_88 = __VLS_87;
563
+ var __VLS_12 = __VLS_11, __VLS_25 = __VLS_24, __VLS_34 = __VLS_33, __VLS_40 = __VLS_39, __VLS_61 = __VLS_60, __VLS_74 = __VLS_73, __VLS_80 = __VLS_79, __VLS_94 = __VLS_93;
498
564
  const __VLS_export = (await import('vue')).defineComponent({
499
565
  __typeProps: {},
500
566
  props: {},
@@ -1,4 +1,4 @@
1
- /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
1
+ /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import CardCustomerDetail from '../../../components/chat/card/CardCustomerDetail.vue';
3
3
  import IconFilter from '../../../assets/icons/customer-appointment/IconFilter.vue';
4
4
  import { computed } from 'vue';
@@ -1,4 +1,4 @@
1
- /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
1
+ /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import IconArrow from '../../../assets/icons/customer-detail/IconArrow.vue';
3
3
  import CollapseBase from '../../../components/chat/common/collapse/CollapseBase.vue';
4
4
  import { ref } from 'vue';
@@ -1,4 +1,4 @@
1
- /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
1
+ /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import CardCustomerDetail from '../../../components/chat/card/CardCustomerDetail.vue';
3
3
  import { Status_Color } from '../../../constant/color';
4
4
  import { computed, ref } from 'vue';
@@ -1,4 +1,4 @@
1
- /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
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
3
  import { PAGE } from '../../../constant/general';
4
4
  import SubInformation from '../../../chat/page/customer-detail/SubInformation.vue';
@@ -1,4 +1,4 @@
1
- /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
1
+ /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import IconArrow from '../../../assets/icons/customer-detail/IconArrow.vue';
3
3
  const props = withDefaults(defineProps(), {
4
4
  information: [],
@@ -1,4 +1,4 @@
1
- /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
1
+ /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { logout } from '../../../utils/chat/auth.js';
3
3
  const reload = () => window.location.reload();
4
4
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
@@ -12,8 +12,32 @@ import { dataProfile } from '../../../utils/chat/auth';
12
12
  import { readMessages } from '../../../utils/chat/message';
13
13
  import dayjs from 'dayjs';
14
14
  import relativeTime from 'dayjs/plugin/relativeTime';
15
+ import updateLocale from 'dayjs/plugin/updateLocale';
16
+ import utc from 'dayjs/plugin/utc';
17
+ import timezone from 'dayjs/plugin/timezone';
15
18
  import { useDigibot } from '../../../composable/useDigibot';
19
+ import { TIME_ZONE_UTC } from '../../../constant/datetime';
20
+ dayjs.extend(updateLocale);
16
21
  dayjs.extend(relativeTime);
22
+ dayjs.extend(utc);
23
+ dayjs.extend(timezone);
24
+ dayjs.updateLocale('en', {
25
+ relativeTime: {
26
+ future: '%s',
27
+ past: '%s',
28
+ s: 'a few seconds',
29
+ m: 'a minute',
30
+ mm: '%d minutes',
31
+ h: 'an hour',
32
+ hh: '%d hours',
33
+ d: 'a day',
34
+ dd: '%d days',
35
+ M: 'a month',
36
+ MM: '%d months',
37
+ y: 'a year',
38
+ yy: '%d years'
39
+ }
40
+ });
17
41
  const props = withDefaults(defineProps(), {});
18
42
  const emit = defineEmits();
19
43
  const { digibotData, digibotId } = useDigibot();
@@ -64,10 +88,17 @@ const mqttMessageHandler = (topic, data) => {
64
88
  getDataMqtt();
65
89
  if (topic === TOPIC_HOME[0] + dataProfile.value?.id) {
66
90
  const index = listConversations.value.findIndex((item) => item.id === data.id);
91
+ const hasChatBox = listConversations.value.findIndex((item) => item.id === digibotId);
67
92
  if (index != -1) {
68
93
  listConversations.value.splice(index, 1);
69
94
  }
70
- listConversations.value.unshift(data);
95
+ console.log(hasChatBox);
96
+ if (hasChatBox > -1) {
97
+ listConversations.value.splice(1, 0, data);
98
+ }
99
+ else {
100
+ listConversations.value.unshift(data);
101
+ }
71
102
  }
72
103
  if (topic === TOPIC_HOME[1] + dataProfile.value?.id) {
73
104
  const index = listConversations.value.findIndex((item) => item.id === data.id);
@@ -96,7 +127,6 @@ const getData = async (data, option) => {
96
127
  const res = await getConversation(params.value);
97
128
  if (option?.reset) {
98
129
  listConversations.value = [];
99
- console.log(digibotData);
100
130
  listConversations.value.push(digibotData);
101
131
  await nextTick();
102
132
  }
@@ -145,6 +175,12 @@ const handleReadMessage = () => {
145
175
  }
146
176
  }
147
177
  };
178
+ const getTimeFromNow = (data) => {
179
+ if (data && dayjs(data).isValid()) {
180
+ return dayjs.tz(data, TIME_ZONE_UTC).local().fromNow();
181
+ }
182
+ return data ?? '';
183
+ };
148
184
  getData({}, { reset: true });
149
185
  const __VLS_exposed = { handleReadMessage };
150
186
  defineExpose(__VLS_exposed);
@@ -302,11 +338,9 @@ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
302
338
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
303
339
  ...{ class: "text-sm text-right text-chat-gray-4 w-[130px]" },
304
340
  });
305
- (__VLS_ctx.dayjs(user.last_message_time).isValid()
306
- ? __VLS_ctx.dayjs(user.last_message_time).fromNow()
307
- : (user.last_message_time ?? ''));
341
+ (__VLS_ctx.getTimeFromNow(user.last_message_time ?? ''));
308
342
  // @ts-ignore
309
- [dayjs, dayjs,];
343
+ [getTimeFromNow,];
310
344
  }
311
345
  var __VLS_17;
312
346
  /** @type {__VLS_StyleScopedClasses['']} */ ;