@phonghq/go-chat 1.0.51 → 1.0.53

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 (197) hide show
  1. package/dist/{test/chat → chat}/App.vue.js +0 -2
  2. package/dist/chat/page/home/ChatList.vue.d.ts +4 -0
  3. package/dist/{test/chat → chat}/page/home/ChatList.vue.js +4 -4
  4. package/dist/{test/chat → chat}/page/home/Home.vue.js +11 -11
  5. package/dist/{test/chat → chat}/page/home/PhoneNumpad.vue.js +19 -20
  6. package/dist/composable/useListConversations.d.ts +2 -0
  7. package/dist/{test/composable → composable}/useListConversations.js +35 -22
  8. package/dist/{test/constant → constant}/mqtt.js +4 -3
  9. package/dist/go-chat.es.js +8198 -8205
  10. package/dist/go-chat.umd.js +15 -15
  11. package/dist/{test/plugins → plugins}/mqtt.js +37 -21
  12. package/dist/style.css +1 -1
  13. package/dist/types/conversation.d.ts +1 -0
  14. package/dist/utils/chat/page-error.d.ts +1 -1
  15. package/dist/{test/utils → utils}/chat/store/conversation.js +6 -8
  16. package/package.json +1 -1
  17. /package/dist/{test/assets → assets}/icons/call/IconClose.vue.js +0 -0
  18. /package/dist/{test/assets → assets}/icons/call/IconMic.vue.js +0 -0
  19. /package/dist/{test/assets → assets}/icons/call/IconPhone.vue.js +0 -0
  20. /package/dist/{test/assets → assets}/icons/call/IconPhoneBase.vue.js +0 -0
  21. /package/dist/{test/assets → assets}/icons/call/IconPhoneCancel.vue.js +0 -0
  22. /package/dist/{test/assets → assets}/icons/call/IconSoundDownload.vue.js +0 -0
  23. /package/dist/{test/assets → assets}/icons/call/IconSpeaker.vue.js +0 -0
  24. /package/dist/{test/assets → assets}/icons/customer-appointment/IconFilter.vue.js +0 -0
  25. /package/dist/{test/assets → assets}/icons/customer-detail/IconArrow.vue.js +0 -0
  26. /package/dist/{test/assets → assets}/icons/customer-detail/IconCheck.vue.js +0 -0
  27. /package/dist/{test/assets → assets}/icons/customer-detail/IconDate.vue.js +0 -0
  28. /package/dist/{test/assets → assets}/icons/customer-detail/IconGroup.vue.js +0 -0
  29. /package/dist/{test/assets → assets}/icons/customer-detail/IconMessage.vue.js +0 -0
  30. /package/dist/{test/assets → assets}/icons/customer-detail/IconNote.vue.js +0 -0
  31. /package/dist/{test/assets → assets}/icons/customer-detail/IconPhone.vue.js +0 -0
  32. /package/dist/{test/assets → assets}/icons/customer-detail/IconPin.vue.js +0 -0
  33. /package/dist/{test/assets → assets}/icons/customer-detail/IconSearch.vue.js +0 -0
  34. /package/dist/{test/assets → assets}/icons/global/IconAiCheck.vue.js +0 -0
  35. /package/dist/{test/assets → assets}/icons/global/IconArrowLeft.vue.js +0 -0
  36. /package/dist/{test/assets → assets}/icons/global/IconBackspace.vue.js +0 -0
  37. /package/dist/{test/assets → assets}/icons/global/IconCloseCircle.vue.js +0 -0
  38. /package/dist/{test/assets → assets}/icons/global/IconPhone.vue.js +0 -0
  39. /package/dist/{test/assets → assets}/icons/global/IconPlan.vue.js +0 -0
  40. /package/dist/{test/assets → assets}/icons/global/IconPlus.vue.js +0 -0
  41. /package/dist/{test/assets → assets}/icons/global/IconSearch.vue.js +0 -0
  42. /package/dist/{test/assets → assets}/icons/global/IconSms.vue.js +0 -0
  43. /package/dist/{test/assets → assets}/icons/global/IconUser.vue.js +0 -0
  44. /package/dist/{test/chat → chat}/main.js +0 -0
  45. /package/dist/{test/chat → chat}/page/customer-appointment/CustomerAppointment.vue.js +0 -0
  46. /package/dist/{test/chat → chat}/page/customer-check-in/CollapseCheckIn.vue.js +0 -0
  47. /package/dist/{test/chat → chat}/page/customer-check-in/CustomerCheckIn.vue.js +0 -0
  48. /package/dist/{test/chat → chat}/page/customer-detail/CustomerDetail.vue.js +0 -0
  49. /package/dist/{test/chat → chat}/page/customer-detail/SubInformation.vue.js +0 -0
  50. /package/dist/{test/chat → chat}/page/error/Error.vue.js +0 -0
  51. /package/dist/{test/chat → chat}/page/home/ChatMessage.vue.js +0 -0
  52. /package/dist/{test/chat → chat}/page/home/ChatMessageItem.vue.js +0 -0
  53. /package/dist/{test/chat → chat}/page/home/ChatMessageItem2.vue.js +0 -0
  54. /package/dist/{test/chat → chat}/page/home/HomeHeader.vue.js +0 -0
  55. /package/dist/{test/chat → chat}/page/home/InputChat.vue.js +0 -0
  56. /package/dist/{test/chat → chat}/page/home/NewCustomer.vue.js +0 -0
  57. /package/dist/{test/chat → chat}/page/setting/Setting.vue.js +0 -0
  58. /package/dist/{test/chat → chat}/page/setting/SettingSuccess.vue.js +0 -0
  59. /package/dist/{test/components → components}/chat/ScrollEvent/ScrollEvent.vue.js +0 -0
  60. /package/dist/{test/components → components}/chat/call/Calling.vue.js +0 -0
  61. /package/dist/{test/components → components}/chat/card/CardCustomerDetail.vue.js +0 -0
  62. /package/dist/{test/components → components}/chat/common/collapse/CollapseBase.vue.js +0 -0
  63. /package/dist/{test/components → components}/chat/common/input/InputSearch.vue.js +0 -0
  64. /package/dist/{test/components → components}/chat/common/modal/Modal.vue.js +0 -0
  65. /package/dist/{test/components → components}/chat/common/popover/PopoverBase.vue.js +0 -0
  66. /package/dist/{test/components → components}/chat/common/spin/BaseSpin.vue.js +0 -0
  67. /package/dist/{test/components → components}/chat/common/switch/SwitchBase.vue.js +0 -0
  68. /package/dist/{test/components → components}/chat/common/tab/TabBase.vue.js +0 -0
  69. /package/dist/{test/components → components}/chat/common/tabs/TabBase.vue.js +0 -0
  70. /package/dist/{test/components → components}/chat/customer/Avatar.vue.js +0 -0
  71. /package/dist/{test/components → components}/chat/layout/mobile/Footer.vue.js +0 -0
  72. /package/dist/{test/components → components}/chat/select/SelectBase.vue.js +0 -0
  73. /package/dist/{test/components → components}/common/CustomLoading.vue.js +0 -0
  74. /package/dist/{test/components → components}/common/Notification/NotificationDescription.vue.js +0 -0
  75. /package/dist/{test/components → components}/common/button/ButtonBase.vue.js +0 -0
  76. /package/dist/{test/components → components}/common/button/ButtonToggle.vue.js +0 -0
  77. /package/dist/{test/components → components}/common/checkbox/CCheckboxNumber.vue.js +0 -0
  78. /package/dist/{test/components → components}/common/collapse/BaseCollapse.vue.js +0 -0
  79. /package/dist/{test/components → components}/common/collapse/BaseCollapseItem.vue.js +0 -0
  80. /package/dist/{test/components → components}/common/drawer/DrawerBase.vue.js +0 -0
  81. /package/dist/{test/components → components}/common/drawer/DrawerBaseCustom.vue.js +0 -0
  82. /package/dist/{test/components → components}/common/dropdown/DropdownBase.vue.js +0 -0
  83. /package/dist/{test/components → components}/common/input/CInputSearch.vue.js +0 -0
  84. /package/dist/{test/components → components}/common/modal/ModalBase.vue.js +0 -0
  85. /package/dist/{test/components → components}/common/popover/PopoverBase.vue.js +0 -0
  86. /package/dist/{test/components → components}/common/select/SelectBase.vue.js +0 -0
  87. /package/dist/{test/components → components}/common/slider/BaseSlider.vue.js +0 -0
  88. /package/dist/{test/components → components}/common/spin/CSpin.vue.js +0 -0
  89. /package/dist/{test/components → components}/common/tooltip/TooltipBase.vue.js +0 -0
  90. /package/dist/{test/components → components}/layout/PageError.vue.js +0 -0
  91. /package/dist/{test/components → components}/ui/button/CButton.vue.js +0 -0
  92. /package/dist/{test/components → components}/ui/button/c-button.js +0 -0
  93. /package/dist/{test/components → components}/ui/checkbox/Checkbox.vue.js +0 -0
  94. /package/dist/{test/components → components}/ui/checkbox/index.js +0 -0
  95. /package/dist/{test/components → components}/ui/collapsible/Collapsible.vue.js +0 -0
  96. /package/dist/{test/components → components}/ui/collapsible/CollapsibleContent.vue.js +0 -0
  97. /package/dist/{test/components → components}/ui/collapsible/CollapsibleTrigger.vue.js +0 -0
  98. /package/dist/{test/components → components}/ui/collapsible/index.js +0 -0
  99. /package/dist/{test/components → components}/ui/dialog/Dialog.vue.js +0 -0
  100. /package/dist/{test/components → components}/ui/dialog/DialogClose.vue.js +0 -0
  101. /package/dist/{test/components → components}/ui/dialog/DialogContent.vue.js +0 -0
  102. /package/dist/{test/components → components}/ui/dialog/DialogDescription.vue.js +0 -0
  103. /package/dist/{test/components → components}/ui/dialog/DialogFooter.vue.js +0 -0
  104. /package/dist/{test/components → components}/ui/dialog/DialogHeader.vue.js +0 -0
  105. /package/dist/{test/components → components}/ui/dialog/DialogScrollContent.vue.js +0 -0
  106. /package/dist/{test/components → components}/ui/dialog/DialogTitle.vue.js +0 -0
  107. /package/dist/{test/components → components}/ui/dialog/DialogTrigger.vue.js +0 -0
  108. /package/dist/{test/components → components}/ui/dialog/index.js +0 -0
  109. /package/dist/{test/components → components}/ui/drawer/Drawer.vue.js +0 -0
  110. /package/dist/{test/components → components}/ui/drawer/DrawerContent.vue.js +0 -0
  111. /package/dist/{test/components → components}/ui/drawer/DrawerDescription.vue.js +0 -0
  112. /package/dist/{test/components → components}/ui/drawer/DrawerFooter.vue.js +0 -0
  113. /package/dist/{test/components → components}/ui/drawer/DrawerHeader.vue.js +0 -0
  114. /package/dist/{test/components → components}/ui/drawer/DrawerOverlay.vue.js +0 -0
  115. /package/dist/{test/components → components}/ui/drawer/DrawerTitle.vue.js +0 -0
  116. /package/dist/{test/components → components}/ui/drawer/index.js +0 -0
  117. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenu.vue.js +0 -0
  118. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.js +0 -0
  119. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuContent.vue.js +0 -0
  120. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuGroup.vue.js +0 -0
  121. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuItem.vue.js +0 -0
  122. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuLabel.vue.js +0 -0
  123. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuRadioGroup.vue.js +0 -0
  124. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuRadioItem.vue.js +0 -0
  125. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuSeparator.vue.js +0 -0
  126. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuShortcut.vue.js +0 -0
  127. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuSub.vue.js +0 -0
  128. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuSubContent.vue.js +0 -0
  129. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuSubTrigger.vue.js +0 -0
  130. /package/dist/{test/components → components}/ui/dropdown-menu/DropdownMenuTrigger.vue.js +0 -0
  131. /package/dist/{test/components → components}/ui/dropdown-menu/index.js +0 -0
  132. /package/dist/{test/components → components}/ui/popover/Popover.vue.js +0 -0
  133. /package/dist/{test/components → components}/ui/popover/PopoverContent.vue.js +0 -0
  134. /package/dist/{test/components → components}/ui/popover/PopoverTrigger.vue.js +0 -0
  135. /package/dist/{test/components → components}/ui/popover/index.js +0 -0
  136. /package/dist/{test/components → components}/ui/radio-group/RadioGroup.vue.js +0 -0
  137. /package/dist/{test/components → components}/ui/radio-group/RadioGroupItem.vue.js +0 -0
  138. /package/dist/{test/components → components}/ui/radio-group/index.js +0 -0
  139. /package/dist/{test/components → components}/ui/select/Select.vue.js +0 -0
  140. /package/dist/{test/components → components}/ui/select/SelectContent.vue.js +0 -0
  141. /package/dist/{test/components → components}/ui/select/SelectGroup.vue.js +0 -0
  142. /package/dist/{test/components → components}/ui/select/SelectItem.vue.js +0 -0
  143. /package/dist/{test/components → components}/ui/select/SelectItemText.vue.js +0 -0
  144. /package/dist/{test/components → components}/ui/select/SelectLabel.vue.js +0 -0
  145. /package/dist/{test/components → components}/ui/select/SelectScrollDownButton.vue.js +0 -0
  146. /package/dist/{test/components → components}/ui/select/SelectScrollUpButton.vue.js +0 -0
  147. /package/dist/{test/components → components}/ui/select/SelectSeparator.vue.js +0 -0
  148. /package/dist/{test/components → components}/ui/select/SelectTrigger.vue.js +0 -0
  149. /package/dist/{test/components → components}/ui/select/SelectValue.vue.js +0 -0
  150. /package/dist/{test/components → components}/ui/select/index.js +0 -0
  151. /package/dist/{test/components → components}/ui/slider/Slider.vue.js +0 -0
  152. /package/dist/{test/components → components}/ui/slider/index.js +0 -0
  153. /package/dist/{test/components → components}/ui/switch/Switch.vue.js +0 -0
  154. /package/dist/{test/components → components}/ui/switch/index.js +0 -0
  155. /package/dist/{test/components → components}/ui/tabs/Tabs.vue.js +0 -0
  156. /package/dist/{test/components → components}/ui/tabs/TabsContent.vue.js +0 -0
  157. /package/dist/{test/components → components}/ui/tabs/TabsList.vue.js +0 -0
  158. /package/dist/{test/components → components}/ui/tabs/TabsTrigger.vue.js +0 -0
  159. /package/dist/{test/components → components}/ui/tabs/index.js +0 -0
  160. /package/dist/{test/composable → composable}/useDigibot.js +0 -0
  161. /package/dist/{test/composable → composable}/useInitData.js +0 -0
  162. /package/dist/{test/composable → composable}/useListentEvent.js +0 -0
  163. /package/dist/{test/composable → composable}/usePlivo.js +0 -0
  164. /package/dist/{test/constant → constant}/color.js +0 -0
  165. /package/dist/{test/constant → constant}/datetime.js +0 -0
  166. /package/dist/{test/constant → constant}/general.js +0 -0
  167. /package/dist/{test/constant → constant}/message.js +0 -0
  168. /package/dist/{test/constant → constant}/user.js +0 -0
  169. /package/dist/{test/lib → lib}/utils.js +0 -0
  170. /package/dist/{test/plugins → plugins}/axios-gci.js +0 -0
  171. /package/dist/{test/plugins → plugins}/axios.js +0 -0
  172. /package/dist/{test/plugins → plugins}/pocketbase.js +0 -0
  173. /package/dist/{test/plugins → plugins}/sdk.js +0 -0
  174. /package/dist/{test/plugins → plugins}/websocket.js +0 -0
  175. /package/dist/{test/types → types}/chat/auth.js +0 -0
  176. /package/dist/{test/types → types}/chat/call.js +0 -0
  177. /package/dist/{test/types → types}/chat/global.js +0 -0
  178. /package/dist/{test/types → types}/chat/promise.js +0 -0
  179. /package/dist/{test/types → types}/chat/user.js +0 -0
  180. /package/dist/{test/types → types}/conversation.js +0 -0
  181. /package/dist/{test/types → types}/global.js +0 -0
  182. /package/dist/{test/types → types}/message.js +0 -0
  183. /package/dist/{test/utils → utils}/chat/cache.js +0 -0
  184. /package/dist/{test/utils → utils}/chat/chat-router.js +0 -0
  185. /package/dist/{test/utils → utils}/chat/page-error.js +0 -0
  186. /package/dist/{test/utils → utils}/chat/phone-string.js +0 -0
  187. /package/dist/{test/utils → utils}/chat/store/auth.js +0 -0
  188. /package/dist/{test/utils → utils}/chat/store/call.js +0 -0
  189. /package/dist/{test/utils → utils}/chat/store/message.js +0 -0
  190. /package/dist/{test/utils → utils}/chat/store/user.js +0 -0
  191. /package/dist/{test/utils → utils}/debounce.js +0 -0
  192. /package/dist/{test/utils → utils}/json.js +0 -0
  193. /package/dist/{test/utils → utils}/logger.js +0 -0
  194. /package/dist/{test/utils → utils}/string-helper.js +0 -0
  195. /package/dist/{test/views → views}/NotTenantPhone.vue.js +0 -0
  196. /package/dist/{test/views → views}/home/phone-numpad/ConvercationList.vue.js +0 -0
  197. /package/dist/{test/views → views}/home/phone-numpad/PhoneNumpad.vue.js +0 -0
@@ -819,7 +819,6 @@ else {
819
819
  hideNumpad: (__VLS_ctx.isLib),
820
820
  responsive: (__VLS_ctx.responsiveRender),
821
821
  ...{ class: "bg-white shrink-0 border-l layout-border" },
822
- modelValue: "",
823
822
  }));
824
823
  const __VLS_119 = __VLS_118({
825
824
  ...{ 'onCall': {} },
@@ -827,7 +826,6 @@ else {
827
826
  hideNumpad: (__VLS_ctx.isLib),
828
827
  responsive: (__VLS_ctx.responsiveRender),
829
828
  ...{ class: "bg-white shrink-0 border-l layout-border" },
830
- modelValue: "",
831
829
  }, ...__VLS_functionalComponentArgsRest(__VLS_118));
832
830
  let __VLS_121;
833
831
  let __VLS_122;
@@ -25,6 +25,7 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
25
25
  color: string;
26
26
  is_unknown: number;
27
27
  customer_id?: number | undefined;
28
+ tenant_id?: number | undefined;
28
29
  }[], IConversation[] | {
29
30
  id: number;
30
31
  receiver_id: number;
@@ -40,6 +41,7 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
40
41
  color: string;
41
42
  is_unknown: number;
42
43
  customer_id?: number | undefined;
44
+ tenant_id?: number | undefined;
43
45
  }[]>;
44
46
  listConversationsUnknown: import("vue").Ref<{
45
47
  id: number;
@@ -56,6 +58,7 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
56
58
  color: string;
57
59
  is_unknown: number;
58
60
  customer_id?: number | undefined;
61
+ tenant_id?: number | undefined;
59
62
  }[], IConversation[] | {
60
63
  id: number;
61
64
  receiver_id: number;
@@ -71,6 +74,7 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
71
74
  color: string;
72
75
  is_unknown: number;
73
76
  customer_id?: number | undefined;
77
+ tenant_id?: number | undefined;
74
78
  }[]>;
75
79
  getCurrentConversation: () => IConversation | undefined;
76
80
  initData: (option?: {
@@ -193,10 +193,10 @@ const initData = async (option) => {
193
193
  selectUser(conversation);
194
194
  }
195
195
  }
196
- handleTabChange(TAB_VALUE.ALL, { hideCheckHasReceiveId: activeTabs.value != TAB_VALUE.UNKNOWN });
197
- handleTabChange(TAB_VALUE.UNKNOWN, {
198
- hideCheckHasReceiveId,
199
- hideLoading: activeTabs.value != TAB_VALUE.UNKNOWN
196
+ handleTabChange(activeTabs.value, { hideCheckHasReceiveId: hideCheckHasReceiveId });
197
+ handleTabChange(activeTabs.value == 1 ? 0 : 1, {
198
+ hideCheckHasReceiveId: true,
199
+ hideLoading: true
200
200
  });
201
201
  };
202
202
  const __VLS_exposed = {
@@ -6,7 +6,7 @@ import { getDetailReceiver, getMessage, sendMessage, upLoadImage } from '../../.
6
6
  import { computed, nextTick, onMounted, onUnmounted, ref, shallowRef } from 'vue';
7
7
  import ChatMessage from '../../../chat/page/home/ChatMessage.vue';
8
8
  import { addHandleMqttMessage, connectMqtt, publishMessage, removeHandleMqttMessage, subscribeToTopic, unsubscribeFromTopic } from '../../../plugins/mqtt';
9
- import { TOPIC_DETAIL_CHAT, TOPIC_PLIVO_SMS } from '../../../constant/mqtt';
9
+ import { TOPIC_PLIVO_SMS } from '../../../constant/mqtt';
10
10
  import { MessageState } from '../../../constant/message';
11
11
  import { publicTopicConversationUpdate } from '../../../utils/chat/store/conversation';
12
12
  import { getCache, removeOldestCache, setCache } from '../../../utils/chat/cache';
@@ -31,11 +31,11 @@ onUnmounted(() => {
31
31
  const handleConnectMqtt = async () => {
32
32
  try {
33
33
  await connectMqtt();
34
- topic = TOPIC_DETAIL_CHAT + infoUser.value?.conversation_id;
34
+ // topic = TOPIC_DETAIL_CHAT + infoUser.value?.conversation_id
35
35
  topic_plivo_chat = TOPIC_PLIVO_SMS + infoUser.value?.conversation_id;
36
- subscribeToTopic(topic);
36
+ // subscribeToTopic(topic)
37
37
  subscribeToTopic(topic_plivo_chat);
38
- addHandleMqttMessage('chat-home', topic, mqttMessageHandler);
38
+ // addHandleMqttMessage('chat-home', topic, mqttMessageHandler)
39
39
  addHandleMqttMessage('chat-home-1', topic_plivo_chat, mqttMessageHandler);
40
40
  }
41
41
  catch (error) {
@@ -43,9 +43,9 @@ const handleConnectMqtt = async () => {
43
43
  }
44
44
  };
45
45
  const handleDisconnectMqtt = async () => {
46
- unsubscribeFromTopic(topic);
46
+ // unsubscribeFromTopic(topic)
47
47
  unsubscribeFromTopic(topic_plivo_chat);
48
- removeHandleMqttMessage('chat-home');
48
+ // removeHandleMqttMessage('chat-home')
49
49
  removeHandleMqttMessage('chat-home-1');
50
50
  };
51
51
  const mqttMessageHandler = (topic, message) => {
@@ -146,10 +146,10 @@ const handleSendMessage = async (data) => {
146
146
  // listMessage.value.push({ ...data, state: MessageState.Sending })
147
147
  listMessage.value.unshift({ ...data, state: MessageState.Sending });
148
148
  await nextTick();
149
- publishMessage(topic, {
150
- ...data,
151
- state: MessageState.Sending
152
- });
149
+ // publishMessage(topic, {
150
+ // ...data,
151
+ // state: MessageState.Sending
152
+ // })
153
153
  let file_upload = [];
154
154
  if (data?.attachments?.length) {
155
155
  updateMessageItem(data.id, { state: MessageState.Uploading });
@@ -164,7 +164,7 @@ const handleSendMessage = async (data) => {
164
164
  formData.append('url', file_upload[0]?.url ?? '');
165
165
  }
166
166
  await sendMessage(formData);
167
- publishMessage(topic, {
167
+ publishMessage(topic_plivo_chat, {
168
168
  ...data,
169
169
  state: MessageState.Sent,
170
170
  attachments: file_upload
@@ -50,36 +50,35 @@ if (__VLS_ctx.responsive == 'window') {
50
50
  let __VLS_4;
51
51
  const __VLS_5 = ({ call: {} },
52
52
  { onCall: (__VLS_ctx.handleCall) });
53
+ var __VLS_6 = {};
53
54
  // @ts-ignore
54
55
  [responsive, hideNumpad, handleCall,];
55
56
  var __VLS_2;
56
57
  }
57
- if (__VLS_ctx.responsive != 'window') {
58
- // @ts-ignore
59
- [responsive,];
58
+ else {
60
59
  /** @type {[typeof DrawerBaseCustom, typeof DrawerBaseCustom, ]} */ ;
61
60
  // @ts-ignore
62
- const __VLS_7 = __VLS_asFunctionalComponent(DrawerBaseCustom, new DrawerBaseCustom({
61
+ const __VLS_8 = __VLS_asFunctionalComponent(DrawerBaseCustom, new DrawerBaseCustom({
63
62
  ref: "drawerVisibleRef",
64
63
  responsive: (__VLS_ctx.responsive),
65
64
  }));
66
- const __VLS_8 = __VLS_7({
65
+ const __VLS_9 = __VLS_8({
67
66
  ref: "drawerVisibleRef",
68
67
  responsive: (__VLS_ctx.responsive),
69
- }, ...__VLS_functionalComponentArgsRest(__VLS_7));
68
+ }, ...__VLS_functionalComponentArgsRest(__VLS_8));
70
69
  /** @type {typeof __VLS_ctx.drawerVisibleRef} */ ;
71
- var __VLS_10 = {};
72
- const { default: __VLS_12 } = __VLS_9.slots;
70
+ var __VLS_11 = {};
71
+ const { default: __VLS_13 } = __VLS_10.slots;
73
72
  // @ts-ignore
74
73
  [responsive, drawerVisibleRef,];
75
74
  {
76
- const { content: __VLS_13 } = __VLS_9.slots;
75
+ const { content: __VLS_14 } = __VLS_10.slots;
77
76
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
78
77
  ...{ class: "h-full flex flex-col" },
79
78
  });
80
79
  /** @type {[typeof PhoneNumpad, ]} */ ;
81
80
  // @ts-ignore
82
- const __VLS_14 = __VLS_asFunctionalComponent(PhoneNumpad, new PhoneNumpad({
81
+ const __VLS_15 = __VLS_asFunctionalComponent(PhoneNumpad, new PhoneNumpad({
83
82
  ...{ 'onCall': {} },
84
83
  ...{ 'onBack': {} },
85
84
  ref: "phoneNumpadRef",
@@ -87,33 +86,33 @@ if (__VLS_ctx.responsive != 'window') {
87
86
  hideNumpad: (__VLS_ctx.hideNumpad),
88
87
  responsive: (__VLS_ctx.responsive),
89
88
  }));
90
- const __VLS_15 = __VLS_14({
89
+ const __VLS_16 = __VLS_15({
91
90
  ...{ 'onCall': {} },
92
91
  ...{ 'onBack': {} },
93
92
  ref: "phoneNumpadRef",
94
93
  ...{ class: "bg-white grow border-l layout-border w-full" },
95
94
  hideNumpad: (__VLS_ctx.hideNumpad),
96
95
  responsive: (__VLS_ctx.responsive),
97
- }, ...__VLS_functionalComponentArgsRest(__VLS_14));
98
- let __VLS_17;
96
+ }, ...__VLS_functionalComponentArgsRest(__VLS_15));
99
97
  let __VLS_18;
100
- const __VLS_19 = ({ call: {} },
98
+ let __VLS_19;
99
+ const __VLS_20 = ({ call: {} },
101
100
  { onCall: (__VLS_ctx.handleCall) });
102
- const __VLS_20 = ({ back: {} },
101
+ const __VLS_21 = ({ back: {} },
103
102
  { onBack: (...[$event]) => {
104
- if (!(__VLS_ctx.responsive != 'window'))
103
+ if (!!(__VLS_ctx.responsive == 'window'))
105
104
  return;
106
105
  __VLS_ctx.drawerVisibleRef?.close();
107
106
  // @ts-ignore
108
107
  [responsive, hideNumpad, handleCall, drawerVisibleRef,];
109
108
  } });
110
109
  /** @type {typeof __VLS_ctx.phoneNumpadRef} */ ;
111
- var __VLS_21 = {};
110
+ var __VLS_22 = {};
112
111
  // @ts-ignore
113
112
  [phoneNumpadRef,];
114
- var __VLS_16;
113
+ var __VLS_17;
115
114
  }
116
- var __VLS_9;
115
+ var __VLS_10;
117
116
  }
118
117
  /** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
119
118
  /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
@@ -128,7 +127,7 @@ if (__VLS_ctx.responsive != 'window') {
128
127
  /** @type {__VLS_StyleScopedClasses['layout-border']} */ ;
129
128
  /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
130
129
  // @ts-ignore
131
- var __VLS_11 = __VLS_10, __VLS_22 = __VLS_21;
130
+ var __VLS_12 = __VLS_11, __VLS_23 = __VLS_22;
132
131
  const __VLS_export = (await import('vue')).defineComponent({
133
132
  setup: () => (__VLS_exposed),
134
133
  __typeEmits: {},
@@ -15,6 +15,7 @@ export declare const useListConversations: (is_unknown: number, is_tenant: boole
15
15
  color: string;
16
16
  is_unknown: number;
17
17
  customer_id?: number | undefined;
18
+ tenant_id?: number | undefined;
18
19
  }[], IConversation[] | {
19
20
  id: number;
20
21
  receiver_id: number;
@@ -30,6 +31,7 @@ export declare const useListConversations: (is_unknown: number, is_tenant: boole
30
31
  color: string;
31
32
  is_unknown: number;
32
33
  customer_id?: number | undefined;
34
+ tenant_id?: number | undefined;
33
35
  }[]>;
34
36
  params: import("vue").Ref<{
35
37
  page: number;
@@ -1,6 +1,6 @@
1
1
  import { nextTick, onMounted, onUnmounted, ref } from 'vue';
2
- import { TOPIC_HOME, TOPIC_STATUS_USER } from '../constant/mqtt';
3
- import { addHandleMqttMessage, connectMqtt, removeHandleMqttMessage, subscribeToTopic, unsubscribeFromTopic } from '../plugins/mqtt';
2
+ import { TOPIC_HOME } from '../constant/mqtt';
3
+ import { addHandleMqttMessage, connectMqtt, publishMessage, removeHandleMqttMessage, subscribeToTopic, unsubscribeFromTopic } from '../plugins/mqtt';
4
4
  import { dataProfile } from '../utils/chat/store/auth';
5
5
  import { useDebounce } from '../utils/debounce';
6
6
  import { getConversation } from '../utils/chat/store/conversation';
@@ -29,8 +29,8 @@ export const useListConversations = (is_unknown, is_tenant) => {
29
29
  removeHandleMqttMessage('chat-list-' + item + '-' + is_unknown);
30
30
  });
31
31
  if (dataProfile.value?.user_type == 'tenant') {
32
- subscribeToTopic(TOPIC_STATUS_USER + dataProfile.value?.id);
33
- removeHandleMqttMessage('chat-list-' + TOPIC_STATUS_USER + '-' + is_unknown);
32
+ // unsubscribeFromTopic(TOPIC_STATUS_USER + dataProfile.value?.id)
33
+ // removeHandleMqttMessage('chat-list-' + TOPIC_STATUS_USER + '-' + is_unknown)
34
34
  }
35
35
  };
36
36
  const handleConnectMqtt = async () => {
@@ -38,12 +38,17 @@ export const useListConversations = (is_unknown, is_tenant) => {
38
38
  if (dataProfile.value) {
39
39
  await connectMqtt();
40
40
  TOPIC_HOME.forEach((item) => {
41
- console.log(item + dataProfile.value?.id);
42
- subscribeToTopic(item + dataProfile.value?.id);
41
+ if (is_unknown == 0) {
42
+ subscribeToTopic(item + dataProfile.value?.id);
43
+ }
43
44
  addHandleMqttMessage('chat-list-' + item + '-' + is_unknown, item + dataProfile.value?.id, mqttMessageHandler);
44
45
  });
45
- subscribeToTopic(TOPIC_STATUS_USER + dataProfile.value?.id);
46
- addHandleMqttMessage('chat-list-' + TOPIC_STATUS_USER + '-' + is_unknown, TOPIC_STATUS_USER + dataProfile.value?.id, mqttMessageHandler);
46
+ // subscribeToTopic(TOPIC_STATUS_USER + dataProfile.value?.id)
47
+ // addHandleMqttMessage(
48
+ // 'chat-list-' + TOPIC_STATUS_USER + '-' + is_unknown,
49
+ // TOPIC_STATUS_USER + dataProfile.value?.id,
50
+ // mqttMessageHandler
51
+ // )
47
52
  }
48
53
  }
49
54
  catch (error) {
@@ -53,11 +58,14 @@ export const useListConversations = (is_unknown, is_tenant) => {
53
58
  const mqttMessageHandler = (topic, data) => {
54
59
  if ((data.is_unknown ?? 0) == is_unknown || (!is_tenant && is_unknown == 0)) {
55
60
  getDataMqtt();
56
- if (topic === TOPIC_HOME[0] + dataProfile.value?.id ||
57
- topic === TOPIC_HOME[3] + dataProfile.value?.id) {
61
+ if (topic ===
62
+ TOPIC_HOME[0] + dataProfile.value?.id
63
+ // ||topic === TOPIC_HOME[3] + dataProfile.value?.id
64
+ ) {
58
65
  const index = listConversations.value.findIndex((item) => item.id === data.id);
59
66
  const hasChatBox = listConversations.value.findIndex((item) => item.id === digibotId);
60
67
  if (index != -1) {
68
+ data.username = listConversations.value[index].username ?? '';
61
69
  listConversations.value.splice(index, 1);
62
70
  }
63
71
  if (hasChatBox > -1) {
@@ -68,20 +76,24 @@ export const useListConversations = (is_unknown, is_tenant) => {
68
76
  }
69
77
  }
70
78
  if (topic === TOPIC_HOME[1] + dataProfile.value?.id) {
71
- const index = listConversations.value.findIndex((item) => item.id === data.id);
72
- if (index != -1) {
73
- listConversations.value[index].unread_count = 0;
74
- }
75
- }
76
- if (topic === TOPIC_HOME[2] + dataProfile.value?.id) {
77
- listConversations.value.unshift(data?.conversations);
78
- }
79
- if (topic === TOPIC_STATUS_USER + dataProfile.value?.id) {
80
- const index = listConversations.value.findIndex((e) => e.receiver_id == Number(data?.customer_id));
81
- if (index != -1) {
82
- listConversations.value[index].status = data.is_online ? 1 : 0;
79
+ if (data.is_unknown == is_unknown) {
80
+ const index = listConversations.value.findIndex((item) => item.id === data.id);
81
+ if (index != -1) {
82
+ listConversations.value[index].unread_count = 0;
83
+ }
83
84
  }
84
85
  }
86
+ // if (topic === TOPIC_HOME[2] + dataProfile.value?.id) {
87
+ // listConversations.value.unshift(data?.conversations)
88
+ // }
89
+ // if (topic === TOPIC_STATUS_USER + dataProfile.value?.id) {
90
+ // const index = listConversations.value.findIndex(
91
+ // (e) => e.receiver_id == Number(data?.customer_id)
92
+ // )
93
+ // if (index != -1) {
94
+ // listConversations.value[index].status = data.is_online ? 1 : 0
95
+ // }
96
+ // }
85
97
  }
86
98
  };
87
99
  const getDataMqtt = useDebounce(() => {
@@ -131,6 +143,7 @@ export const useListConversations = (is_unknown, is_tenant) => {
131
143
  if (listConversations.value[index].unread_count) {
132
144
  readMessages(listConversations.value[index].id);
133
145
  listConversations.value[index].unread_count = 0;
146
+ publishMessage(TOPIC_HOME[1] + dataProfile.value?.id, listConversations.value[index]);
134
147
  }
135
148
  }
136
149
  };
@@ -3,10 +3,11 @@ export const TOPIC_DETAIL_CALL = 'call/message/';
3
3
  export const TOPIC_PLIVO_SMS = 'sms-inbound/';
4
4
  export const TOPIC_STATUS_USER = 'user/status/';
5
5
  export const TOPIC_HOME = [
6
- 'chat/conversation/update/',
6
+ // 'chat/conversation/update/',
7
+ // 'chat/conversation/read_message/',
8
+ // 'chat/conversation/update_list/',
9
+ 'chat/conversation/update/sms-inbound/',
7
10
  'chat/conversation/read_message/',
8
- 'chat/conversation/update_list/',
9
- 'chat/conversation/update/sms-inbound/'
10
11
  ];
11
12
  // export CALL_STATE = {
12
13
  // Offer: 'offer',