@phonghq/go-chat 1.0.11 → 1.0.14

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 (65) hide show
  1. package/dist/assets/icons/IconAiCheck.vue.d.ts +2 -0
  2. package/dist/assets/icons/call/IconClose.vue.d.ts +2 -0
  3. package/dist/assets/icons/call/IconSoundDownload.vue.d.ts +2 -0
  4. package/dist/chat/App.vue.d.ts +7 -2
  5. package/dist/chat/page/customer-detail/CustomerDetail.vue.d.ts +1 -1
  6. package/dist/chat/page/home/ChatList.vue.d.ts +29 -1
  7. package/dist/chat/page/home/ChatMessage.vue.d.ts +2 -1
  8. package/dist/chat/page/home/Home.vue.d.ts +1 -1
  9. package/dist/components/chat/ScrollEvent/ScrollEvent.vue.d.ts +1 -0
  10. package/dist/components/chat/call/Calling.vue.d.ts +8 -2
  11. package/dist/components/chat/common/input/InputSearch.vue.d.ts +1 -1
  12. package/dist/components/chat/select/SelectBase.vue.d.ts +22 -0
  13. package/dist/components/common/drawer/DrawerBase.vue.d.ts +1 -1
  14. package/dist/components/common/modal/ModalBase.vue.d.ts +1 -1
  15. package/dist/composable/useCallHelper.d.ts +7 -2
  16. package/dist/composable/useInitData.d.ts +2 -4
  17. package/dist/composable/usePlivo.d.ts +9 -0
  18. package/dist/go-chat.es.js +14676 -12322
  19. package/dist/go-chat.umd.js +44 -14
  20. package/dist/plugins/websocket.d.ts +12 -2
  21. package/dist/router/index.d.ts +2 -0
  22. package/dist/style.css +1 -1
  23. package/dist/test/assets/icons/IconAiCheck.vue.js +28 -0
  24. package/dist/test/assets/icons/call/IconClose.vue.js +26 -0
  25. package/dist/test/assets/icons/call/IconMic.vue.js +9 -9
  26. package/dist/test/assets/icons/call/IconSoundDownload.vue.js +50 -0
  27. package/dist/test/chat/App.vue.js +144 -90
  28. package/dist/test/chat/page/customer-detail/CustomerDetail.vue.js +6 -5
  29. package/dist/test/chat/page/home/ChatList.vue.js +30 -9
  30. package/dist/test/chat/page/home/ChatMessage.vue.js +23 -12
  31. package/dist/test/chat/page/home/Home.vue.js +4 -3
  32. package/dist/test/chat/page/home/NewCustomer.vue.js +0 -12
  33. package/dist/test/components/chat/ScrollEvent/ScrollEvent.vue.js +7 -1
  34. package/dist/test/components/chat/call/Calling.vue.js +277 -111
  35. package/dist/test/components/chat/common/input/InputSearch.vue.js +2 -2
  36. package/dist/test/components/chat/select/SelectBase.vue.js +98 -0
  37. package/dist/test/components/common/drawer/DrawerBaseCustom.vue.js +0 -1
  38. package/dist/test/composable/data.json +32 -0
  39. package/dist/test/composable/useCallHelper.js +146 -33
  40. package/dist/test/composable/useDigibot.js +1 -1
  41. package/dist/test/composable/useInitData.js +17 -12
  42. package/dist/test/composable/usePlivo.js +138 -0
  43. package/dist/test/constant/color.js +1 -1
  44. package/dist/test/plugins/axios.js +2 -1
  45. package/dist/test/plugins/mqtt.js +11 -8
  46. package/dist/test/plugins/websocket.js +108 -19
  47. package/dist/test/router/index.js +39 -0
  48. package/dist/test/types/call.js +10 -1
  49. package/dist/test/utils/chat/auth.js +10 -2
  50. package/dist/test/utils/chat/call.js +48 -8
  51. package/dist/test/utils/chat/phone-string.js +4 -0
  52. package/dist/test/utils/chat/user.js +7 -2
  53. package/dist/test/views/NotFound.vue.js +47 -0
  54. package/dist/test/views/TenantPhone.vue.js +270 -0
  55. package/dist/types/call.d.ts +9 -0
  56. package/dist/types/chat/global.d.ts +4 -0
  57. package/dist/utils/chat/auth.d.ts +5 -1
  58. package/dist/utils/chat/call.d.ts +6 -2
  59. package/dist/utils/chat/phone-string.d.ts +1 -0
  60. package/dist/utils/chat/user.d.ts +4 -0
  61. package/dist/views/NotFound.vue.d.ts +2 -0
  62. package/dist/views/TenantPhone.vue.d.ts +2 -0
  63. package/package.json +2 -1
  64. package/dist/composable/TestSound.d.ts +0 -64
  65. package/dist/test/composable/TestSound.js +0 -196
@@ -31,6 +31,8 @@ const handleScrollTop = () => {
31
31
  };
32
32
  const hideScrollEvent = () => {
33
33
  scrollEventRef.value?.hideLoading();
34
+ };
35
+ const fixedScroll = () => {
34
36
  scrollEventRef.value?.fixedScroll();
35
37
  };
36
38
  const getMessageStateText = (item) => {
@@ -50,7 +52,7 @@ const getMessageStateText = (item) => {
50
52
  return '';
51
53
  }
52
54
  };
53
- const __VLS_exposed = { scrollBottom, hideScrollEvent };
55
+ const __VLS_exposed = { scrollBottom, hideScrollEvent, fixedScroll };
54
56
  defineExpose(__VLS_exposed);
55
57
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
56
58
  const __VLS_defaults = {};
@@ -136,31 +138,34 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
136
138
  /** @type {[typeof Avatar, ]} */ ;
137
139
  // @ts-ignore
138
140
  const __VLS_13 = __VLS_asFunctionalComponent(Avatar, new Avatar({
141
+ ...{ class: "shrink-0" },
139
142
  src: (__VLS_ctx.data?.avatar ?? ''),
140
143
  color: (__VLS_ctx.data?.color),
141
144
  name: (__VLS_ctx.data?.username),
142
- size: (__VLS_ctx.response == 'mobile' ? 'sm' : 'md'),
143
- ...{ class: (__VLS_ctx.response == 'mobile' ? 'translate-y-[-2px]' : '') },
145
+ size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
146
+ ...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
144
147
  }));
145
148
  const __VLS_14 = __VLS_13({
149
+ ...{ class: "shrink-0" },
146
150
  src: (__VLS_ctx.data?.avatar ?? ''),
147
151
  color: (__VLS_ctx.data?.color),
148
152
  name: (__VLS_ctx.data?.username),
149
- size: (__VLS_ctx.response == 'mobile' ? 'sm' : 'md'),
150
- ...{ class: (__VLS_ctx.response == 'mobile' ? 'translate-y-[-2px]' : '') },
153
+ size: (__VLS_ctx.responsive == 'mobile' ? 'sm' : 'md'),
154
+ ...{ class: (__VLS_ctx.responsive == 'mobile' ? 'translate-y-[-2px]' : '') },
151
155
  }, ...__VLS_functionalComponentArgsRest(__VLS_13));
152
156
  // @ts-ignore
153
- [data, data, data, response, response,];
157
+ [data, data, data, responsive, responsive,];
154
158
  }
155
159
  else {
156
160
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
157
- ...{ class: (__VLS_ctx.response == 'mobile' ? 'w-8' : 'w-12') },
161
+ ...{ class: "shrink-0" },
162
+ ...{ class: (__VLS_ctx.responsive == 'mobile' ? 'w-8' : 'w-12') },
158
163
  });
159
164
  // @ts-ignore
160
- [response,];
165
+ [responsive,];
161
166
  }
162
167
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
163
- ...{ class: "bg-[#E4E4E4D4] text-chat-haze-600 px-3 py-2 rounded-2xl max-w-xs" },
168
+ ...{ class: "bg-[#E4E4E4D4] text-left text-chat-haze-600 px-3 py-2 rounded-2xl max-w-xs w-max" },
164
169
  ...{ class: ({
165
170
  'rounded-tl-none': !__VLS_ctx.shouldShowAvatar(index),
166
171
  'rounded-bl-none': !__VLS_ctx.isEndMessage(index)
@@ -192,7 +197,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
192
197
  }
193
198
  else {
194
199
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
195
- ...{ class: "flex flex-col items-end mt-2" },
200
+ ...{ class: "flex flex-col items-end justify-end mt-2 pl-[60px]" },
196
201
  ...{ class: ({ 'mt-4': __VLS_ctx.shouldShowAvatar(index) }) },
197
202
  });
198
203
  // @ts-ignore
@@ -232,7 +237,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
232
237
  [message, MessageState, getMessageStateText,];
233
238
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
234
239
  ...{ class: "text-chat-haze-200 text-xs mt-1" },
235
- ...{ class: ({ 'text-danger': item.state == __VLS_ctx.MessageState.Failed }) },
240
+ ...{ class: ({ '!text-chat-error': item.state == __VLS_ctx.MessageState.Failed }) },
236
241
  });
237
242
  // @ts-ignore
238
243
  [MessageState,];
@@ -259,18 +264,24 @@ var __VLS_2;
259
264
  /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
260
265
  /** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
261
266
  /** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
267
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
268
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
262
269
  /** @type {__VLS_StyleScopedClasses['bg-[#E4E4E4D4]']} */ ;
270
+ /** @type {__VLS_StyleScopedClasses['text-left']} */ ;
263
271
  /** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
264
272
  /** @type {__VLS_StyleScopedClasses['px-3']} */ ;
265
273
  /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
266
274
  /** @type {__VLS_StyleScopedClasses['rounded-2xl']} */ ;
267
275
  /** @type {__VLS_StyleScopedClasses['max-w-xs']} */ ;
276
+ /** @type {__VLS_StyleScopedClasses['w-max']} */ ;
268
277
  /** @type {__VLS_StyleScopedClasses['rounded-tl-none']} */ ;
269
278
  /** @type {__VLS_StyleScopedClasses['rounded-bl-none']} */ ;
270
279
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
271
280
  /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
272
281
  /** @type {__VLS_StyleScopedClasses['items-end']} */ ;
282
+ /** @type {__VLS_StyleScopedClasses['justify-end']} */ ;
273
283
  /** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
284
+ /** @type {__VLS_StyleScopedClasses['pl-[60px]']} */ ;
274
285
  /** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
275
286
  /** @type {__VLS_StyleScopedClasses['bg-[#D0DFEC]']} */ ;
276
287
  /** @type {__VLS_StyleScopedClasses['text-[#266699]']} */ ;
@@ -283,7 +294,7 @@ var __VLS_2;
283
294
  /** @type {__VLS_StyleScopedClasses['text-chat-haze-200']} */ ;
284
295
  /** @type {__VLS_StyleScopedClasses['text-xs']} */ ;
285
296
  /** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
286
- /** @type {__VLS_StyleScopedClasses['text-danger']} */ ;
297
+ /** @type {__VLS_StyleScopedClasses['!text-chat-error']} */ ;
287
298
  // @ts-ignore
288
299
  var __VLS_7 = __VLS_6;
289
300
  const __VLS_export = (await import('vue')).defineComponent({
@@ -77,6 +77,7 @@ const handleScrollTop = async () => {
77
77
  page = page + 1;
78
78
  await handleGetMessage();
79
79
  chatMessageRef.value?.hideScrollEvent();
80
+ chatMessageRef.value?.fixedScroll();
80
81
  };
81
82
  const handleGetDetailReceiver = async (data) => {
82
83
  const id = props.receiverId;
@@ -256,7 +257,7 @@ if (__VLS_ctx.listMessage?.length) {
256
257
  data: (__VLS_ctx.infoUser),
257
258
  message: (__VLS_ctx.listMessage),
258
259
  ...{ class: "grow" },
259
- response: (__VLS_ctx.response),
260
+ responsive: (__VLS_ctx.responsive),
260
261
  showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
261
262
  }));
262
263
  const __VLS_8 = __VLS_7({
@@ -265,7 +266,7 @@ if (__VLS_ctx.listMessage?.length) {
265
266
  data: (__VLS_ctx.infoUser),
266
267
  message: (__VLS_ctx.listMessage),
267
268
  ...{ class: "grow" },
268
- response: (__VLS_ctx.response),
269
+ responsive: (__VLS_ctx.responsive),
269
270
  showNewCustomer: (__VLS_ctx.page >= __VLS_ctx.pageCount),
270
271
  }, ...__VLS_functionalComponentArgsRest(__VLS_7));
271
272
  let __VLS_10;
@@ -275,7 +276,7 @@ if (__VLS_ctx.listMessage?.length) {
275
276
  /** @type {typeof __VLS_ctx.chatMessageRef} */ ;
276
277
  var __VLS_13 = {};
277
278
  // @ts-ignore
278
- [infoUser, listMessage, response, page, pageCount, handleScrollTop, chatMessageRef,];
279
+ [infoUser, listMessage, responsive, page, pageCount, handleScrollTop, chatMessageRef,];
279
280
  var __VLS_9;
280
281
  }
281
282
  else if (!__VLS_ctx.isLoading) {
@@ -47,12 +47,6 @@ __VLS_asFunctionalElement(__VLS_elements.h2, __VLS_elements.h2)({
47
47
  __VLS_asFunctionalElement(__VLS_elements.img)({
48
48
  src: "../../../assets/images/icons/new-customer.png",
49
49
  });
50
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
51
- ...{ class: "text-chat-haze-400 text-sm mt-1 flex items-center gap-1" },
52
- });
53
- __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
54
- __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
55
- __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
56
50
  __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
57
51
  ...{ class: "text-chat-haze-400 text-sm mt-3 max-w-md" },
58
52
  });
@@ -69,12 +63,6 @@ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
69
63
  /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
70
64
  /** @type {__VLS_StyleScopedClasses['text-chat-haze-400']} */ ;
71
65
  /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
72
- /** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
73
- /** @type {__VLS_StyleScopedClasses['flex']} */ ;
74
- /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
75
- /** @type {__VLS_StyleScopedClasses['gap-1']} */ ;
76
- /** @type {__VLS_StyleScopedClasses['text-chat-haze-400']} */ ;
77
- /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
78
66
  /** @type {__VLS_StyleScopedClasses['mt-3']} */ ;
79
67
  /** @type {__VLS_StyleScopedClasses['max-w-md']} */ ;
80
68
  const __VLS_export = (await import('vue')).defineComponent({
@@ -133,7 +133,13 @@ const fixedScroll = () => {
133
133
  const newHeight = scrollEvent.value?.scrollHeight ?? 0;
134
134
  scrollEvent.value.scrollTop += newHeight - oldScrollHeight;
135
135
  };
136
- const __VLS_exposed = { hideLoading, fixedScroll };
136
+ const canScroll = () => {
137
+ if (!scrollEvent.value)
138
+ return false;
139
+ const canScrollY = scrollEvent.value.scrollHeight > scrollEvent.value.clientHeight;
140
+ return canScrollY;
141
+ };
142
+ const __VLS_exposed = { hideLoading, fixedScroll, canScroll };
137
143
  defineExpose(__VLS_exposed);
138
144
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
139
145
  const __VLS_defaults = {};