@phonghq/go-chat 1.0.0 → 1.0.2

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 (285) hide show
  1. package/README.md +4 -0
  2. package/dist/assets/icons/IconArrowLeft.vue.d.ts +2 -0
  3. package/dist/assets/icons/IconArrowLeft.vue.js +29 -0
  4. package/dist/assets/icons/IconPhone.vue.d.ts +2 -0
  5. package/dist/assets/icons/IconPhone.vue.js +19 -0
  6. package/dist/assets/icons/IconPlan.vue.d.ts +2 -0
  7. package/dist/assets/icons/IconPlan.vue.js +19 -0
  8. package/dist/assets/icons/IconPlus.vue.d.ts +2 -0
  9. package/dist/assets/icons/IconPlus.vue.js +22 -0
  10. package/dist/assets/icons/IconSearch.vue.d.ts +32 -0
  11. package/dist/assets/icons/IconSearch.vue.js +68 -0
  12. package/dist/assets/icons/call/IconMic.vue.d.ts +14 -0
  13. package/dist/assets/icons/call/IconMic.vue.js +123 -0
  14. package/dist/assets/icons/call/IconPhone.vue.d.ts +2 -0
  15. package/dist/assets/icons/call/IconPhone.vue.js +35 -0
  16. package/dist/assets/icons/call/IconPhoneCancel.vue.d.ts +2 -0
  17. package/dist/assets/icons/call/IconPhoneCancel.vue.js +35 -0
  18. package/dist/assets/icons/call/IconSpeaker.vue.d.ts +14 -0
  19. package/dist/assets/icons/call/IconSpeaker.vue.js +62 -0
  20. package/dist/assets/icons/customer-appointment/IconFilter.vue.d.ts +2 -0
  21. package/dist/assets/icons/customer-appointment/IconFilter.vue.js +53 -0
  22. package/dist/assets/icons/customer-detail/IconArrow.vue.d.ts +2 -0
  23. package/dist/assets/icons/customer-detail/IconArrow.vue.js +22 -0
  24. package/dist/assets/icons/customer-detail/IconCheck.vue.d.ts +2 -0
  25. package/dist/assets/icons/customer-detail/IconCheck.vue.js +27 -0
  26. package/dist/assets/icons/customer-detail/IconDate.vue.d.ts +2 -0
  27. package/dist/assets/icons/customer-detail/IconDate.vue.js +43 -0
  28. package/dist/assets/icons/customer-detail/IconGroup.vue.d.ts +2 -0
  29. package/dist/assets/icons/customer-detail/IconGroup.vue.js +48 -0
  30. package/dist/assets/icons/customer-detail/IconMessage.vue.d.ts +2 -0
  31. package/dist/assets/icons/customer-detail/IconMessage.vue.js +28 -0
  32. package/dist/assets/icons/customer-detail/IconNote.vue.d.ts +2 -0
  33. package/dist/assets/icons/customer-detail/IconNote.vue.js +29 -0
  34. package/dist/assets/icons/customer-detail/IconPhone.vue.d.ts +2 -0
  35. package/dist/assets/icons/customer-detail/IconPhone.vue.js +21 -0
  36. package/dist/assets/icons/customer-detail/IconPin.vue.d.ts +2 -0
  37. package/dist/assets/icons/customer-detail/IconPin.vue.js +29 -0
  38. package/dist/assets/icons/customer-detail/IconSearch.vue.d.ts +2 -0
  39. package/dist/assets/icons/customer-detail/IconSearch.vue.js +29 -0
  40. package/dist/chat/App.vue.d.ts +5 -0
  41. package/dist/chat/App.vue.js +502 -0
  42. package/dist/chat/main.d.ts +3 -0
  43. package/dist/chat/main.js +2 -0
  44. package/dist/chat/page/customer-appointment/CustomerAppointment.vue.d.ts +2 -0
  45. package/dist/chat/page/customer-appointment/CustomerAppointment.vue.js +207 -0
  46. package/dist/chat/page/customer-check-in/CollapseCheckIn.vue.d.ts +12 -0
  47. package/dist/chat/page/customer-check-in/CollapseCheckIn.vue.js +80 -0
  48. package/dist/chat/page/customer-check-in/CustomerCheckIn.vue.d.ts +2 -0
  49. package/dist/chat/page/customer-check-in/CustomerCheckIn.vue.js +136 -0
  50. package/dist/chat/page/customer-detail/CustomerDetail.vue.d.ts +7 -0
  51. package/dist/chat/page/customer-detail/CustomerDetail.vue.js +235 -0
  52. package/dist/chat/page/customer-detail/SubInformation.vue.d.ts +16 -0
  53. package/dist/chat/page/customer-detail/SubInformation.vue.js +102 -0
  54. package/dist/chat/page/error/Error.vue.d.ts +2 -0
  55. package/dist/chat/page/error/Error.vue.js +64 -0
  56. package/dist/chat/page/home/ChatList.vue.d.ts +20 -0
  57. package/dist/chat/page/home/ChatList.vue.js +380 -0
  58. package/dist/chat/page/home/ChatMessage.vue.d.ts +16 -0
  59. package/dist/chat/page/home/ChatMessage.vue.js +271 -0
  60. package/dist/chat/page/home/Home.vue.d.ts +14 -0
  61. package/dist/chat/page/home/Home.vue.js +327 -0
  62. package/dist/chat/page/home/HomeHeader.vue.d.ts +10 -0
  63. package/dist/chat/page/home/HomeHeader.vue.js +122 -0
  64. package/dist/chat/page/home/InputChat.vue.d.ts +19 -0
  65. package/dist/chat/page/home/InputChat.vue.js +226 -0
  66. package/dist/chat/page/home/NewCustomer.vue.d.ts +6 -0
  67. package/dist/chat/page/home/NewCustomer.vue.js +82 -0
  68. package/dist/components/ListenEvent.vue.d.ts +2 -0
  69. package/dist/components/ListenEvent.vue.js +45 -0
  70. package/dist/components/chat/ScrollEvent/ScrollEvent.vue.d.ts +22 -0
  71. package/dist/components/chat/ScrollEvent/ScrollEvent.vue.js +197 -0
  72. package/dist/components/chat/call/Calling.vue.d.ts +7 -0
  73. package/dist/components/chat/call/Calling.vue.js +291 -0
  74. package/dist/components/chat/card/CardCustomerDetail.vue.d.ts +13 -0
  75. package/dist/components/chat/card/CardCustomerDetail.vue.js +28 -0
  76. package/dist/components/chat/common/collapse/CollapseBase.vue.d.ts +20 -0
  77. package/dist/components/chat/common/collapse/CollapseBase.vue.js +59 -0
  78. package/dist/components/chat/common/input/InputSearch.vue.d.ts +16 -0
  79. package/dist/components/chat/common/input/InputSearch.vue.js +71 -0
  80. package/dist/components/chat/common/popover/PopoverBase.vue.d.ts +35 -0
  81. package/dist/components/chat/common/popover/PopoverBase.vue.js +148 -0
  82. package/dist/components/chat/common/spin/BaseSpin.vue.d.ts +2 -0
  83. package/dist/components/chat/common/spin/BaseSpin.vue.js +12 -0
  84. package/dist/components/chat/customer/Avatar.vue.d.ts +11 -0
  85. package/dist/components/chat/customer/Avatar.vue.js +79 -0
  86. package/dist/components/chat/layout/mobile/Footer.vue.d.ts +2 -0
  87. package/dist/components/chat/layout/mobile/Footer.vue.js +109 -0
  88. package/dist/components/common/CustomLoading.vue.d.ts +2 -0
  89. package/dist/components/common/CustomLoading.vue.js +19 -0
  90. package/dist/components/common/Notification/NotificationDescription.vue.d.ts +7 -0
  91. package/dist/components/common/Notification/NotificationDescription.vue.js +38 -0
  92. package/dist/components/common/button/ButtonBase.vue.d.ts +22 -0
  93. package/dist/components/common/button/ButtonBase.vue.js +78 -0
  94. package/dist/components/common/button/ButtonToggle.vue.d.ts +20 -0
  95. package/dist/components/common/button/ButtonToggle.vue.js +70 -0
  96. package/dist/components/common/checkbox/CCheckboxNumber.vue.d.ts +16 -0
  97. package/dist/components/common/checkbox/CCheckboxNumber.vue.js +48 -0
  98. package/dist/components/common/collapse/BaseCollapse.vue.d.ts +12 -0
  99. package/dist/components/common/collapse/BaseCollapse.vue.js +36 -0
  100. package/dist/components/common/collapse/BaseCollapseItem.vue.d.ts +4 -0
  101. package/dist/components/common/collapse/BaseCollapseItem.vue.js +22 -0
  102. package/dist/components/common/drawer/DrawerBase.vue.d.ts +39 -0
  103. package/dist/components/common/drawer/DrawerBase.vue.js +126 -0
  104. package/dist/components/common/dropdown/DropdownBase.vue.d.ts +21 -0
  105. package/dist/components/common/dropdown/DropdownBase.vue.js +91 -0
  106. package/dist/components/common/input/CInputSearch.vue.d.ts +14 -0
  107. package/dist/components/common/input/CInputSearch.vue.js +62 -0
  108. package/dist/components/common/modal/ModalBase.vue.d.ts +35 -0
  109. package/dist/components/common/modal/ModalBase.vue.js +164 -0
  110. package/dist/components/common/popover/PopoverBase.vue.d.ts +3 -0
  111. package/dist/components/common/popover/PopoverBase.vue.js +36 -0
  112. package/dist/components/common/slider/BaseSlider.vue.d.ts +11 -0
  113. package/dist/components/common/slider/BaseSlider.vue.js +70 -0
  114. package/dist/components/common/spin/CSpin.vue.d.ts +9 -0
  115. package/dist/components/common/spin/CSpin.vue.js +41 -0
  116. package/dist/components/common/tooltip/TooltipBase.vue.d.ts +2 -0
  117. package/dist/components/common/tooltip/TooltipBase.vue.js +8 -0
  118. package/dist/components/layout/Blank.vue.d.ts +9 -0
  119. package/dist/components/layout/Blank.vue.js +19 -0
  120. package/dist/components/layout/Default.vue.d.ts +9 -0
  121. package/dist/components/layout/Default.vue.js +21 -0
  122. package/dist/components/modal/Confirm.vue.d.ts +2 -0
  123. package/dist/components/modal/Confirm.vue.js +164 -0
  124. package/dist/components/ui/button/CButton.vue.d.ts +19 -0
  125. package/dist/components/ui/button/CButton.vue.js +49 -0
  126. package/dist/components/ui/button/c-button.d.ts +7 -0
  127. package/dist/components/ui/button/c-button.js +26 -0
  128. package/dist/components/ui/checkbox/Checkbox.vue.d.ts +18 -0
  129. package/dist/components/ui/checkbox/Checkbox.vue.js +79 -0
  130. package/dist/components/ui/checkbox/index.d.ts +1 -0
  131. package/dist/components/ui/checkbox/index.js +1 -0
  132. package/dist/components/ui/collapsible/Collapsible.vue.d.ts +16 -0
  133. package/dist/components/ui/collapsible/Collapsible.vue.js +47 -0
  134. package/dist/components/ui/collapsible/CollapsibleContent.vue.d.ts +10 -0
  135. package/dist/components/ui/collapsible/CollapsibleContent.vue.js +41 -0
  136. package/dist/components/ui/collapsible/CollapsibleTrigger.vue.d.ts +10 -0
  137. package/dist/components/ui/collapsible/CollapsibleTrigger.vue.js +35 -0
  138. package/dist/components/ui/collapsible/index.d.ts +3 -0
  139. package/dist/components/ui/collapsible/index.js +3 -0
  140. package/dist/components/ui/dialog/Dialog.vue.d.ts +14 -0
  141. package/dist/components/ui/dialog/Dialog.vue.js +42 -0
  142. package/dist/components/ui/dialog/DialogClose.vue.d.ts +10 -0
  143. package/dist/components/ui/dialog/DialogClose.vue.js +35 -0
  144. package/dist/components/ui/dialog/DialogContent.vue.d.ts +29 -0
  145. package/dist/components/ui/dialog/DialogContent.vue.js +84 -0
  146. package/dist/components/ui/dialog/DialogDescription.vue.d.ts +14 -0
  147. package/dist/components/ui/dialog/DialogDescription.vue.js +43 -0
  148. package/dist/components/ui/dialog/DialogFooter.vue.d.ts +13 -0
  149. package/dist/components/ui/dialog/DialogFooter.vue.js +26 -0
  150. package/dist/components/ui/dialog/DialogHeader.vue.d.ts +13 -0
  151. package/dist/components/ui/dialog/DialogHeader.vue.js +26 -0
  152. package/dist/components/ui/dialog/DialogScrollContent.vue.d.ts +30 -0
  153. package/dist/components/ui/dialog/DialogScrollContent.vue.js +99 -0
  154. package/dist/components/ui/dialog/DialogTitle.vue.d.ts +14 -0
  155. package/dist/components/ui/dialog/DialogTitle.vue.js +43 -0
  156. package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +10 -0
  157. package/dist/components/ui/dialog/DialogTrigger.vue.js +35 -0
  158. package/dist/components/ui/dialog/index.d.ts +9 -0
  159. package/dist/components/ui/dialog/index.js +9 -0
  160. package/dist/components/ui/drawer/Drawer.vue.d.ts +26 -0
  161. package/dist/components/ui/drawer/Drawer.vue.js +48 -0
  162. package/dist/components/ui/drawer/DrawerContent.vue.d.ts +33 -0
  163. package/dist/components/ui/drawer/DrawerContent.vue.js +81 -0
  164. package/dist/components/ui/drawer/DrawerDescription.vue.d.ts +14 -0
  165. package/dist/components/ui/drawer/DrawerDescription.vue.js +42 -0
  166. package/dist/components/ui/drawer/DrawerFooter.vue.d.ts +13 -0
  167. package/dist/components/ui/drawer/DrawerFooter.vue.js +26 -0
  168. package/dist/components/ui/drawer/DrawerHeader.vue.d.ts +13 -0
  169. package/dist/components/ui/drawer/DrawerHeader.vue.js +26 -0
  170. package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts +7 -0
  171. package/dist/components/ui/drawer/DrawerOverlay.vue.js +37 -0
  172. package/dist/components/ui/drawer/DrawerTitle.vue.d.ts +14 -0
  173. package/dist/components/ui/drawer/DrawerTitle.vue.js +42 -0
  174. package/dist/components/ui/drawer/index.d.ts +8 -0
  175. package/dist/components/ui/drawer/index.js +8 -0
  176. package/dist/components/ui/dropdown-menu/DropdownMenu.vue.d.ts +14 -0
  177. package/dist/components/ui/dropdown-menu/DropdownMenu.vue.js +41 -0
  178. package/dist/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts +20 -0
  179. package/dist/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.js +79 -0
  180. package/dist/components/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +28 -0
  181. package/dist/components/ui/dropdown-menu/DropdownMenuContent.vue.js +61 -0
  182. package/dist/components/ui/dropdown-menu/DropdownMenuGroup.vue.d.ts +10 -0
  183. package/dist/components/ui/dropdown-menu/DropdownMenuGroup.vue.js +35 -0
  184. package/dist/components/ui/dropdown-menu/DropdownMenuItem.vue.d.ts +15 -0
  185. package/dist/components/ui/dropdown-menu/DropdownMenuItem.vue.js +43 -0
  186. package/dist/components/ui/dropdown-menu/DropdownMenuLabel.vue.d.ts +15 -0
  187. package/dist/components/ui/dropdown-menu/DropdownMenuLabel.vue.js +43 -0
  188. package/dist/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.d.ts +14 -0
  189. package/dist/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.js +41 -0
  190. package/dist/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.d.ts +18 -0
  191. package/dist/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.js +80 -0
  192. package/dist/components/ui/dropdown-menu/DropdownMenuSeparator.vue.d.ts +7 -0
  193. package/dist/components/ui/dropdown-menu/DropdownMenuSeparator.vue.js +37 -0
  194. package/dist/components/ui/dropdown-menu/DropdownMenuShortcut.vue.d.ts +13 -0
  195. package/dist/components/ui/dropdown-menu/DropdownMenuShortcut.vue.js +26 -0
  196. package/dist/components/ui/dropdown-menu/DropdownMenuSub.vue.d.ts +14 -0
  197. package/dist/components/ui/dropdown-menu/DropdownMenuSub.vue.js +41 -0
  198. package/dist/components/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +30 -0
  199. package/dist/components/ui/dropdown-menu/DropdownMenuSubContent.vue.js +46 -0
  200. package/dist/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +14 -0
  201. package/dist/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.js +58 -0
  202. package/dist/components/ui/dropdown-menu/DropdownMenuTrigger.vue.d.ts +10 -0
  203. package/dist/components/ui/dropdown-menu/DropdownMenuTrigger.vue.js +41 -0
  204. package/dist/components/ui/dropdown-menu/index.d.ts +15 -0
  205. package/dist/components/ui/dropdown-menu/index.js +15 -0
  206. package/dist/components/ui/popover/Popover.vue.d.ts +14 -0
  207. package/dist/components/ui/popover/Popover.vue.js +41 -0
  208. package/dist/components/ui/popover/PopoverContent.vue.d.ts +28 -0
  209. package/dist/components/ui/popover/PopoverContent.vue.js +60 -0
  210. package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +10 -0
  211. package/dist/components/ui/popover/PopoverTrigger.vue.js +35 -0
  212. package/dist/components/ui/popover/index.d.ts +3 -0
  213. package/dist/components/ui/popover/index.js +3 -0
  214. package/dist/components/ui/radio-group/RadioGroup.vue.d.ts +18 -0
  215. package/dist/components/ui/radio-group/RadioGroup.vue.js +46 -0
  216. package/dist/components/ui/radio-group/RadioGroupItem.vue.d.ts +7 -0
  217. package/dist/components/ui/radio-group/RadioGroupItem.vue.js +71 -0
  218. package/dist/components/ui/radio-group/index.d.ts +2 -0
  219. package/dist/components/ui/radio-group/index.js +2 -0
  220. package/dist/components/ui/slider/Slider.vue.d.ts +13 -0
  221. package/dist/components/ui/slider/Slider.vue.js +155 -0
  222. package/dist/components/ui/slider/index.d.ts +1 -0
  223. package/dist/components/ui/slider/index.js +1 -0
  224. package/dist/components/ui/switch/Switch.vue.d.ts +18 -0
  225. package/dist/components/ui/switch/Switch.vue.js +61 -0
  226. package/dist/components/ui/switch/index.d.ts +1 -0
  227. package/dist/components/ui/switch/index.js +1 -0
  228. package/dist/composable/useCallHelper.d.ts +23 -0
  229. package/dist/composable/useCallHelper.js +170 -0
  230. package/dist/composable/useInitData.d.ts +11 -0
  231. package/dist/composable/useInitData.js +84 -0
  232. package/dist/composable/useModalConfirm.d.ts +5 -0
  233. package/dist/composable/useModalConfirm.js +39 -0
  234. package/dist/constant/color.d.ts +22 -0
  235. package/dist/constant/color.js +43 -0
  236. package/dist/constant/datetime.d.ts +5 -0
  237. package/dist/constant/datetime.js +5 -0
  238. package/dist/constant/general.d.ts +8 -0
  239. package/dist/constant/general.js +9 -0
  240. package/dist/constant/message.d.ts +8 -0
  241. package/dist/constant/message.js +8 -0
  242. package/dist/constant/mqtt.d.ts +4 -0
  243. package/dist/constant/mqtt.js +11 -0
  244. package/dist/constant/user.d.ts +8 -0
  245. package/dist/constant/user.js +9 -0
  246. package/dist/go-chat.es.js +64024 -2699
  247. package/dist/go-chat.umd.js +15 -3
  248. package/dist/lib/utils.d.ts +2 -0
  249. package/dist/lib/utils.js +5 -0
  250. package/dist/plugins/axios-gci.d.ts +3 -0
  251. package/dist/plugins/axios-gci.js +25 -0
  252. package/dist/plugins/axios.d.ts +3 -0
  253. package/dist/plugins/axios.js +85 -0
  254. package/dist/plugins/mqtt.d.ts +10 -0
  255. package/dist/plugins/mqtt.js +128 -0
  256. package/dist/plugins/sdk.d.ts +19 -0
  257. package/dist/plugins/sdk.js +83 -0
  258. package/dist/plugins/websocket.d.ts +4 -0
  259. package/dist/plugins/websocket.js +65 -0
  260. package/dist/style.css +1 -1
  261. package/dist/types/chat/user.d.ts +88 -0
  262. package/dist/types/chat/user.js +1 -0
  263. package/dist/types/conversation.d.ts +18 -0
  264. package/dist/types/conversation.js +1 -0
  265. package/dist/utils/chat/auth.d.ts +45 -0
  266. package/dist/utils/chat/auth.js +51 -0
  267. package/dist/utils/chat/call.d.ts +5 -0
  268. package/dist/utils/chat/call.js +61 -0
  269. package/dist/utils/chat/chat-router.d.ts +3 -0
  270. package/dist/utils/chat/chat-router.js +9 -0
  271. package/dist/utils/chat/conversation.d.ts +3 -0
  272. package/dist/utils/chat/conversation.js +7 -0
  273. package/dist/utils/chat/message.d.ts +17 -0
  274. package/dist/utils/chat/message.js +42 -0
  275. package/dist/utils/chat/user.d.ts +193 -0
  276. package/dist/utils/chat/user.js +33 -0
  277. package/dist/utils/debounce.d.ts +1 -0
  278. package/dist/utils/debounce.js +9 -0
  279. package/dist/utils/json.d.ts +2 -0
  280. package/dist/utils/json.js +18 -0
  281. package/dist/utils/logger.d.ts +3 -0
  282. package/dist/utils/logger.js +5 -0
  283. package/dist/utils/string-helper.d.ts +1 -0
  284. package/dist/utils/string-helper.js +27 -0
  285. package/package.json +8 -7
@@ -0,0 +1,380 @@
1
+ import InputSearch from '../../../components/chat/common/input/InputSearch.vue';
2
+ import IconPlus from '../../../assets/icons/IconPlus.vue';
3
+ import { nextTick, onMounted, onUnmounted, ref } from 'vue';
4
+ import Avatar from '../../../components/chat/customer/Avatar.vue';
5
+ import { getConversation } from '../../../utils/chat/conversation';
6
+ import BaseSpin from '../../../components/chat/common/spin/BaseSpin.vue';
7
+ import ScrollEvent from '../../../components/chat/ScrollEvent/ScrollEvent.vue';
8
+ import { useDebounce } from '../../../utils/debounce';
9
+ import { addHandleMqttMessage, connectMqtt, removeHandleMqttMessage, subscribeToTopic, unsubscribeFromTopic } from '../../../plugins/mqtt';
10
+ import { TOPIC_HOME, TOPIC_STATUS_USER } from '../../../constant/mqtt';
11
+ import { dataProfile } from '../../../utils/chat/auth';
12
+ import { readMessages } from '../../../utils/chat/message';
13
+ import dayjs from 'dayjs';
14
+ import relativeTime from 'dayjs/plugin/relativeTime';
15
+ dayjs.extend(relativeTime);
16
+ const props = withDefaults(defineProps(), {});
17
+ const emit = defineEmits();
18
+ const receiver_id = defineModel('receiverId');
19
+ const isOpen = ref(false);
20
+ const keyword = ref('');
21
+ const scrollEventRef = ref(null);
22
+ const listConversations = ref([]);
23
+ const params = ref({
24
+ page: 1,
25
+ search: ''
26
+ });
27
+ let pageCount = 0;
28
+ const isLoadingSearch = ref(false);
29
+ onMounted(() => {
30
+ handleConnectMqtt();
31
+ });
32
+ onUnmounted(() => {
33
+ handleDisconnectMqtt;
34
+ });
35
+ const handleDisconnectMqtt = () => {
36
+ TOPIC_HOME.forEach((item) => {
37
+ unsubscribeFromTopic(item + dataProfile.value?.id);
38
+ removeHandleMqttMessage('chat-list-' + item);
39
+ });
40
+ if (dataProfile.value?.user_type == 'tenant') {
41
+ subscribeToTopic(TOPIC_STATUS_USER + dataProfile.value?.id);
42
+ removeHandleMqttMessage('chat-list-' + TOPIC_STATUS_USER);
43
+ }
44
+ };
45
+ const handleConnectMqtt = async () => {
46
+ try {
47
+ if (dataProfile.value) {
48
+ await connectMqtt();
49
+ TOPIC_HOME.forEach((item) => {
50
+ subscribeToTopic(item + dataProfile.value?.id);
51
+ addHandleMqttMessage('chat-list-' + item, item + dataProfile.value?.id, mqttMessageHandler);
52
+ });
53
+ subscribeToTopic(TOPIC_STATUS_USER + dataProfile.value?.id);
54
+ addHandleMqttMessage('chat-list-' + TOPIC_STATUS_USER, TOPIC_STATUS_USER + dataProfile.value?.id, mqttMessageHandler);
55
+ }
56
+ }
57
+ catch (error) {
58
+ console.error(error);
59
+ }
60
+ };
61
+ const mqttMessageHandler = (topic, data) => {
62
+ getDataMqtt();
63
+ if (topic === TOPIC_HOME[0] + dataProfile.value?.id) {
64
+ const index = listConversations.value.findIndex((item) => item.id === data.id);
65
+ if (index != -1) {
66
+ listConversations.value.splice(index, 1);
67
+ }
68
+ listConversations.value.unshift(data);
69
+ }
70
+ 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;
83
+ }
84
+ }
85
+ };
86
+ const getDataMqtt = useDebounce(() => {
87
+ getData(undefined, { hideLoading: true, reset: true });
88
+ }, 5000);
89
+ const getData = async (data, option) => {
90
+ try {
91
+ if (!option?.hideLoading)
92
+ isLoadingSearch.value = true;
93
+ params.value = { ...params.value, ...(data ?? {}) };
94
+ const res = await getConversation(params.value);
95
+ if (option?.reset) {
96
+ listConversations.value = [];
97
+ await nextTick();
98
+ }
99
+ listConversations.value.push(...(res?.items ?? []));
100
+ checkHasReceiveId();
101
+ params.value.page = res?._meta?.currentPage || 1;
102
+ pageCount = res?._meta?.pageCount || 1;
103
+ }
104
+ catch (error) {
105
+ console.error(error);
106
+ }
107
+ finally {
108
+ isLoadingSearch.value = false;
109
+ }
110
+ };
111
+ const checkHasReceiveId = () => {
112
+ const hasReceiveId = listConversations.value?.some((e) => e.receiver_id === receiver_id.value);
113
+ if (props.response == 'tablet') {
114
+ if (!hasReceiveId && listConversations.value?.length)
115
+ emit('selectReceiver', listConversations.value[0]);
116
+ }
117
+ };
118
+ const handleSearch = (value) => {
119
+ // listConversations.value = []
120
+ getData({ search: value }, { reset: true });
121
+ };
122
+ const handleScroll = useDebounce(async () => {
123
+ if (params.value.page >= pageCount) {
124
+ scrollEventRef.value?.hideLoading();
125
+ return;
126
+ }
127
+ let page = params.value.page + 1;
128
+ await getData({ page });
129
+ scrollEventRef.value?.hideLoading();
130
+ }, 200);
131
+ const selectUser = (user) => {
132
+ emit('selectReceiver', user);
133
+ };
134
+ const handleReadMessage = () => {
135
+ const index = listConversations.value.findIndex((e) => e.receiver_id == receiver_id.value);
136
+ if (index > -1) {
137
+ if (listConversations.value[index].unread_count) {
138
+ readMessages(listConversations.value[index].id);
139
+ listConversations.value[index].unread_count = 0;
140
+ }
141
+ }
142
+ };
143
+ getData();
144
+ const __VLS_exposed = { handleReadMessage };
145
+ defineExpose(__VLS_exposed);
146
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
147
+ const __VLS_modelEmit = defineEmits();
148
+ const __VLS_defaults = {};
149
+ const __VLS_ctx = {
150
+ ...{},
151
+ ...{},
152
+ ...{},
153
+ ...{},
154
+ ...{},
155
+ };
156
+ let __VLS_elements;
157
+ let __VLS_components;
158
+ let __VLS_directives;
159
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
160
+ ...{ class: "h-full flex flex-col chat-box-white pt-6" },
161
+ });
162
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
163
+ ...{ class: "shrink-0 w-full px-6 flex gap-2 mb-6" },
164
+ });
165
+ /** @type {[typeof InputSearch, ]} */ ;
166
+ // @ts-ignore
167
+ const __VLS_0 = __VLS_asFunctionalComponent(InputSearch, new InputSearch({
168
+ ...{ 'onSearch': {} },
169
+ ...{ class: "h-[45px] grow" },
170
+ response: (__VLS_ctx.response),
171
+ modelValue: (__VLS_ctx.keyword),
172
+ }));
173
+ const __VLS_1 = __VLS_0({
174
+ ...{ 'onSearch': {} },
175
+ ...{ class: "h-[45px] grow" },
176
+ response: (__VLS_ctx.response),
177
+ modelValue: (__VLS_ctx.keyword),
178
+ }, ...__VLS_functionalComponentArgsRest(__VLS_0));
179
+ let __VLS_3;
180
+ let __VLS_4;
181
+ const __VLS_5 = ({ search: {} },
182
+ { onSearch: (__VLS_ctx.handleSearch) });
183
+ // @ts-ignore
184
+ [response, keyword, handleSearch,];
185
+ var __VLS_2;
186
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
187
+ ...{ class: "h-[45px] w-[45px] rounded-full flex-center bg-[#C7DEFF]" },
188
+ });
189
+ /** @type {[typeof IconPlus, ]} */ ;
190
+ // @ts-ignore
191
+ const __VLS_7 = __VLS_asFunctionalComponent(IconPlus, new IconPlus({
192
+ ...{ class: "text-[#004AB3]" },
193
+ }));
194
+ const __VLS_8 = __VLS_7({
195
+ ...{ class: "text-[#004AB3]" },
196
+ }, ...__VLS_functionalComponentArgsRest(__VLS_7));
197
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
198
+ ...{ class: "grow relative overflow-hidden" },
199
+ });
200
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
201
+ ...{ class: "absolute sc-full flex-center bg-black/10" },
202
+ });
203
+ __VLS_asFunctionalDirective(__VLS_directives.vShow)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.isLoadingSearch) }, null, null);
204
+ // @ts-ignore
205
+ [isLoadingSearch,];
206
+ /** @type {[typeof BaseSpin, ]} */ ;
207
+ // @ts-ignore
208
+ const __VLS_11 = __VLS_asFunctionalComponent(BaseSpin, new BaseSpin({}));
209
+ const __VLS_12 = __VLS_11({}, ...__VLS_functionalComponentArgsRest(__VLS_11));
210
+ /** @type {[typeof ScrollEvent, typeof ScrollEvent, ]} */ ;
211
+ // @ts-ignore
212
+ const __VLS_15 = __VLS_asFunctionalComponent(ScrollEvent, new ScrollEvent({
213
+ ...{ 'onGetDataBottom': {} },
214
+ ref: "scrollEventRef",
215
+ ...{ class: "h-full overflow-auto" },
216
+ bottom: true,
217
+ }));
218
+ const __VLS_16 = __VLS_15({
219
+ ...{ 'onGetDataBottom': {} },
220
+ ref: "scrollEventRef",
221
+ ...{ class: "h-full overflow-auto" },
222
+ bottom: true,
223
+ }, ...__VLS_functionalComponentArgsRest(__VLS_15));
224
+ let __VLS_18;
225
+ let __VLS_19;
226
+ const __VLS_20 = ({ getDataBottom: {} },
227
+ { onGetDataBottom: (__VLS_ctx.handleScroll) });
228
+ /** @type {typeof __VLS_ctx.scrollEventRef} */ ;
229
+ var __VLS_21 = {};
230
+ const { default: __VLS_23 } = __VLS_17.slots;
231
+ // @ts-ignore
232
+ [handleScroll, scrollEventRef,];
233
+ for (const [user] of __VLS_getVForSourceType((__VLS_ctx.listConversations))) {
234
+ // @ts-ignore
235
+ [listConversations,];
236
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
237
+ ...{ onClick: (...[$event]) => {
238
+ __VLS_ctx.selectUser(user);
239
+ // @ts-ignore
240
+ [selectUser,];
241
+ } },
242
+ ...{ class: "" },
243
+ key: (user.id),
244
+ });
245
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
246
+ ...{ class: "w-full overflow-hidden flex items-center hover:bg-[#EDF5FF] cursor-pointer px-6 py-2" },
247
+ ...{ class: ({ 'bg-[#EDF5FF]': __VLS_ctx.receiver_id == user.receiver_id && __VLS_ctx.response == 'tablet' }) },
248
+ });
249
+ // @ts-ignore
250
+ [response, receiver_id,];
251
+ /** @type {[typeof Avatar, ]} */ ;
252
+ // @ts-ignore
253
+ const __VLS_24 = __VLS_asFunctionalComponent(Avatar, new Avatar({
254
+ ...{ class: "shrink-0" },
255
+ src: (user.avatar ?? ''),
256
+ color: (user.color),
257
+ name: (user.username ?? ''),
258
+ }));
259
+ const __VLS_25 = __VLS_24({
260
+ ...{ class: "shrink-0" },
261
+ src: (user.avatar ?? ''),
262
+ color: (user.color),
263
+ name: (user.username ?? ''),
264
+ }, ...__VLS_functionalComponentArgsRest(__VLS_24));
265
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
266
+ ...{ class: "grow ml-3 overflow-hidden" },
267
+ });
268
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
269
+ ...{ class: "flex justify-between items-center gap-4" },
270
+ });
271
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
272
+ ...{ class: "truncate" },
273
+ });
274
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
275
+ ...{ class: "flex items-center" },
276
+ });
277
+ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
278
+ ...{ class: "font-semibold" },
279
+ });
280
+ (user.username);
281
+ if (user.unread_count) {
282
+ __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
283
+ ...{ class: "ml-2 bg-[#E60000] text-white text-xs font-bold px-2 py-[1px] flex-center rounded-full" },
284
+ });
285
+ (user.unread_count);
286
+ }
287
+ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
288
+ ...{ class: "text-sm truncate" },
289
+ ...{ class: ({
290
+ 'font-semibold': user.unread_count,
291
+ 'text-chat-gray-3': !user.unread_count
292
+ }) },
293
+ });
294
+ (user.last_message ?? 'No messages');
295
+ __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
296
+ ...{ class: "text-sm text-right text-chat-gray-4 w-[130px]" },
297
+ });
298
+ (__VLS_ctx.dayjs(user.last_message_time).isValid()
299
+ ? __VLS_ctx.dayjs(user.last_message_time).fromNow()
300
+ : (user.last_message_time ?? ''));
301
+ // @ts-ignore
302
+ [dayjs, dayjs,];
303
+ }
304
+ var __VLS_17;
305
+ /** @type {__VLS_StyleScopedClasses['']} */ ;
306
+ /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
307
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
308
+ /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
309
+ /** @type {__VLS_StyleScopedClasses['chat-box-white']} */ ;
310
+ /** @type {__VLS_StyleScopedClasses['pt-6']} */ ;
311
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
312
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
313
+ /** @type {__VLS_StyleScopedClasses['px-6']} */ ;
314
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
315
+ /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
316
+ /** @type {__VLS_StyleScopedClasses['mb-6']} */ ;
317
+ /** @type {__VLS_StyleScopedClasses['h-[45px]']} */ ;
318
+ /** @type {__VLS_StyleScopedClasses['grow']} */ ;
319
+ /** @type {__VLS_StyleScopedClasses['h-[45px]']} */ ;
320
+ /** @type {__VLS_StyleScopedClasses['w-[45px]']} */ ;
321
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
322
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
323
+ /** @type {__VLS_StyleScopedClasses['bg-[#C7DEFF]']} */ ;
324
+ /** @type {__VLS_StyleScopedClasses['text-[#004AB3]']} */ ;
325
+ /** @type {__VLS_StyleScopedClasses['grow']} */ ;
326
+ /** @type {__VLS_StyleScopedClasses['relative']} */ ;
327
+ /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
328
+ /** @type {__VLS_StyleScopedClasses['absolute']} */ ;
329
+ /** @type {__VLS_StyleScopedClasses['sc-full']} */ ;
330
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
331
+ /** @type {__VLS_StyleScopedClasses['bg-black/10']} */ ;
332
+ /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
333
+ /** @type {__VLS_StyleScopedClasses['overflow-auto']} */ ;
334
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
335
+ /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
336
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
337
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
338
+ /** @type {__VLS_StyleScopedClasses['hover:bg-[#EDF5FF]']} */ ;
339
+ /** @type {__VLS_StyleScopedClasses['cursor-pointer']} */ ;
340
+ /** @type {__VLS_StyleScopedClasses['px-6']} */ ;
341
+ /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
342
+ /** @type {__VLS_StyleScopedClasses['bg-[#EDF5FF]']} */ ;
343
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
344
+ /** @type {__VLS_StyleScopedClasses['grow']} */ ;
345
+ /** @type {__VLS_StyleScopedClasses['ml-3']} */ ;
346
+ /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
347
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
348
+ /** @type {__VLS_StyleScopedClasses['justify-between']} */ ;
349
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
350
+ /** @type {__VLS_StyleScopedClasses['gap-4']} */ ;
351
+ /** @type {__VLS_StyleScopedClasses['truncate']} */ ;
352
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
353
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
354
+ /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
355
+ /** @type {__VLS_StyleScopedClasses['ml-2']} */ ;
356
+ /** @type {__VLS_StyleScopedClasses['bg-[#E60000]']} */ ;
357
+ /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
358
+ /** @type {__VLS_StyleScopedClasses['text-xs']} */ ;
359
+ /** @type {__VLS_StyleScopedClasses['font-bold']} */ ;
360
+ /** @type {__VLS_StyleScopedClasses['px-2']} */ ;
361
+ /** @type {__VLS_StyleScopedClasses['py-[1px]']} */ ;
362
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
363
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
364
+ /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
365
+ /** @type {__VLS_StyleScopedClasses['truncate']} */ ;
366
+ /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
367
+ /** @type {__VLS_StyleScopedClasses['text-chat-gray-3']} */ ;
368
+ /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
369
+ /** @type {__VLS_StyleScopedClasses['text-right']} */ ;
370
+ /** @type {__VLS_StyleScopedClasses['text-chat-gray-4']} */ ;
371
+ /** @type {__VLS_StyleScopedClasses['w-[130px]']} */ ;
372
+ // @ts-ignore
373
+ var __VLS_22 = __VLS_21;
374
+ const __VLS_export = (await import('vue')).defineComponent({
375
+ setup: () => (__VLS_exposed),
376
+ __typeEmits: {},
377
+ __typeProps: {},
378
+ props: {},
379
+ });
380
+ export default {};
@@ -0,0 +1,16 @@
1
+ import type { IResMessage, IResUser } from '../../../types/message';
2
+ import type { PAGE_RESPONSE } from '../../../types/chat/global';
3
+ type Props = {
4
+ data: IResUser | null;
5
+ message: IResMessage[];
6
+ response: PAGE_RESPONSE;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<Props, {
9
+ scrollBottom: () => void;
10
+ hideScrollEvent: () => void;
11
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
12
+ scrollTop: () => any;
13
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
14
+ onScrollTop?: (() => any) | undefined;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ export default _default;
@@ -0,0 +1,271 @@
1
+ /// <reference types="C:/phonghq/go-chat/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 { nextTick, ref } from 'vue';
5
+ import ScrollEvent from '../../../components/chat/ScrollEvent/ScrollEvent.vue';
6
+ import { MessageState } from '../../../constant/message';
7
+ const props = withDefaults(defineProps(), {});
8
+ const emit = defineEmits();
9
+ const scrollEventRef = ref(null);
10
+ const scrollBottom = () => {
11
+ nextTick(() => {
12
+ const eleIdContentChat = document.getElementById('content-chat');
13
+ if (eleIdContentChat) {
14
+ eleIdContentChat.scrollTop = eleIdContentChat.scrollHeight;
15
+ }
16
+ });
17
+ };
18
+ const shouldShowAvatar = (index) => {
19
+ if (index === 0)
20
+ return true;
21
+ return props.message[index - 1].sender_id !== props.message[index].sender_id;
22
+ };
23
+ const isEndMessage = (index) => {
24
+ if (props.message?.length == index + 1)
25
+ return true;
26
+ return props.message[index + 1].sender_id !== props.message[index].sender_id;
27
+ };
28
+ const handleScrollTop = () => {
29
+ emit('scrollTop');
30
+ };
31
+ const hideScrollEvent = () => {
32
+ scrollEventRef.value?.hideLoading();
33
+ scrollEventRef.value?.fixedScroll();
34
+ };
35
+ const getMessageStateText = (item) => {
36
+ const state = item.state;
37
+ switch (state) {
38
+ case MessageState.Sending:
39
+ return 'Sending...';
40
+ case MessageState.Uploading:
41
+ return 'Uploading...';
42
+ case MessageState.Sent:
43
+ return '';
44
+ case MessageState.Read:
45
+ return 'Seen';
46
+ case MessageState.Failed:
47
+ return item.error || 'Message failed';
48
+ default:
49
+ return '';
50
+ }
51
+ };
52
+ const __VLS_exposed = { scrollBottom, hideScrollEvent };
53
+ defineExpose(__VLS_exposed);
54
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
55
+ const __VLS_defaults = {};
56
+ const __VLS_ctx = {
57
+ ...{},
58
+ ...{},
59
+ ...{},
60
+ ...{},
61
+ ...{},
62
+ };
63
+ let __VLS_elements;
64
+ let __VLS_components;
65
+ let __VLS_directives;
66
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
67
+ ...{ class: "relative overflow-hidden" },
68
+ });
69
+ /** @type {[typeof ScrollEvent, typeof ScrollEvent, ]} */ ;
70
+ // @ts-ignore
71
+ const __VLS_0 = __VLS_asFunctionalComponent(ScrollEvent, new ScrollEvent({
72
+ ...{ 'onGetDataTop': {} },
73
+ ...{ class: "bg-white h-full flex flex-col overflow-auto" },
74
+ id: "content-chat",
75
+ top: true,
76
+ ref: "scrollEventRef",
77
+ }));
78
+ const __VLS_1 = __VLS_0({
79
+ ...{ 'onGetDataTop': {} },
80
+ ...{ class: "bg-white h-full flex flex-col overflow-auto" },
81
+ id: "content-chat",
82
+ top: true,
83
+ ref: "scrollEventRef",
84
+ }, ...__VLS_functionalComponentArgsRest(__VLS_0));
85
+ let __VLS_3;
86
+ let __VLS_4;
87
+ const __VLS_5 = ({ getDataTop: {} },
88
+ { onGetDataTop: (__VLS_ctx.handleScrollTop) });
89
+ /** @type {typeof __VLS_ctx.scrollEventRef} */ ;
90
+ var __VLS_6 = {};
91
+ const { default: __VLS_8 } = __VLS_2.slots;
92
+ // @ts-ignore
93
+ [handleScrollTop, scrollEventRef,];
94
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
95
+ ...{ class: "chat-padding-page" },
96
+ });
97
+ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
98
+ (item.id);
99
+ // @ts-ignore
100
+ [message,];
101
+ if (item.sender_id !== __VLS_ctx.dataProfile?.id) {
102
+ // @ts-ignore
103
+ [dataProfile,];
104
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
105
+ ...{ class: "flex items-end gap-2 mt-2" },
106
+ ...{ class: ({ 'mt-4': __VLS_ctx.shouldShowAvatar(index) }) },
107
+ });
108
+ // @ts-ignore
109
+ [shouldShowAvatar,];
110
+ if (item.state != __VLS_ctx.MessageState.Sending) {
111
+ // @ts-ignore
112
+ [MessageState,];
113
+ if (__VLS_ctx.shouldShowAvatar(index)) {
114
+ // @ts-ignore
115
+ [shouldShowAvatar,];
116
+ /** @type {[typeof Avatar, ]} */ ;
117
+ // @ts-ignore
118
+ const __VLS_9 = __VLS_asFunctionalComponent(Avatar, new Avatar({
119
+ src: (__VLS_ctx.data?.avatar ?? ''),
120
+ color: (__VLS_ctx.data?.color),
121
+ name: (__VLS_ctx.data?.username),
122
+ size: (__VLS_ctx.response == 'mobile' ? 'sm' : 'md'),
123
+ ...{ class: (__VLS_ctx.response == 'mobile' ? 'translate-y-[-2px]' : '') },
124
+ }));
125
+ const __VLS_10 = __VLS_9({
126
+ src: (__VLS_ctx.data?.avatar ?? ''),
127
+ color: (__VLS_ctx.data?.color),
128
+ name: (__VLS_ctx.data?.username),
129
+ size: (__VLS_ctx.response == 'mobile' ? 'sm' : 'md'),
130
+ ...{ class: (__VLS_ctx.response == 'mobile' ? 'translate-y-[-2px]' : '') },
131
+ }, ...__VLS_functionalComponentArgsRest(__VLS_9));
132
+ // @ts-ignore
133
+ [data, data, data, response, response,];
134
+ }
135
+ else {
136
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
137
+ ...{ class: (__VLS_ctx.response == 'mobile' ? 'w-8' : 'w-12') },
138
+ });
139
+ // @ts-ignore
140
+ [response,];
141
+ }
142
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
143
+ ...{ class: "bg-[#E4E4E4D4] text-chat-haze-600 px-3 py-2 rounded-2xl max-w-xs" },
144
+ ...{ class: ({
145
+ 'rounded-tl-none': !__VLS_ctx.shouldShowAvatar(index),
146
+ 'rounded-bl-none': !__VLS_ctx.isEndMessage(index)
147
+ }) },
148
+ });
149
+ // @ts-ignore
150
+ [shouldShowAvatar, isEndMessage,];
151
+ if (item.message) {
152
+ __VLS_asFunctionalElement(__VLS_elements.div)({
153
+ ...{ style: ({ wordBreak: 'break-word' }) },
154
+ });
155
+ __VLS_asFunctionalDirective(__VLS_directives.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (item.message) }, null, null);
156
+ }
157
+ else if (item.attachments.length) {
158
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
159
+ __VLS_asFunctionalElement(__VLS_elements.img)({
160
+ ...{ onLoad: (() => {
161
+ if (index == __VLS_ctx.message.length - 1) {
162
+ __VLS_ctx.scrollBottom();
163
+ }
164
+ }) },
165
+ src: (item.attachments[0]?.file_path),
166
+ alt: "avatar",
167
+ });
168
+ // @ts-ignore
169
+ [message, scrollBottom,];
170
+ }
171
+ }
172
+ }
173
+ else {
174
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
175
+ ...{ class: "flex flex-col items-end mt-2" },
176
+ ...{ class: ({ 'mt-4': __VLS_ctx.shouldShowAvatar(index) }) },
177
+ });
178
+ // @ts-ignore
179
+ [shouldShowAvatar,];
180
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
181
+ ...{ class: "bg-[#D0DFEC] text-[#266699] px-3 py-2 rounded-2xl max-w-xs" },
182
+ ...{ class: ({
183
+ 'rounded-tr-none': !__VLS_ctx.shouldShowAvatar(index),
184
+ 'rounded-br-none': !__VLS_ctx.isEndMessage(index)
185
+ }) },
186
+ });
187
+ // @ts-ignore
188
+ [shouldShowAvatar, isEndMessage,];
189
+ if (item.message) {
190
+ __VLS_asFunctionalElement(__VLS_elements.div)({
191
+ ...{ style: ({ wordBreak: 'break-word' }) },
192
+ });
193
+ __VLS_asFunctionalDirective(__VLS_directives.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (item.message) }, null, null);
194
+ }
195
+ else if (item?.attachments?.length) {
196
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
197
+ __VLS_asFunctionalElement(__VLS_elements.img)({
198
+ ...{ onLoad: (() => {
199
+ if (index == __VLS_ctx.message.length - 1) {
200
+ __VLS_ctx.scrollBottom();
201
+ }
202
+ }) },
203
+ src: (item.attachments[0]?.file_path),
204
+ alt: "avatar",
205
+ });
206
+ // @ts-ignore
207
+ [message, scrollBottom,];
208
+ }
209
+ if ((index == __VLS_ctx.message.length - 1 && __VLS_ctx.getMessageStateText(item)) || item.state == __VLS_ctx.MessageState.Failed) {
210
+ // @ts-ignore
211
+ [message, MessageState, getMessageStateText,];
212
+ __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
213
+ ...{ class: "text-chat-haze-200 text-xs mt-1" },
214
+ ...{ class: ({ 'text-danger': item.state == __VLS_ctx.MessageState.Failed }) },
215
+ });
216
+ // @ts-ignore
217
+ [MessageState,];
218
+ (__VLS_ctx.getMessageStateText(item));
219
+ // @ts-ignore
220
+ [getMessageStateText,];
221
+ }
222
+ }
223
+ }
224
+ var __VLS_2;
225
+ /** @type {__VLS_StyleScopedClasses['relative']} */ ;
226
+ /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
227
+ /** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
228
+ /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
229
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
230
+ /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
231
+ /** @type {__VLS_StyleScopedClasses['overflow-auto']} */ ;
232
+ /** @type {__VLS_StyleScopedClasses['chat-padding-page']} */ ;
233
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
234
+ /** @type {__VLS_StyleScopedClasses['items-end']} */ ;
235
+ /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
236
+ /** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
237
+ /** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
238
+ /** @type {__VLS_StyleScopedClasses['bg-[#E4E4E4D4]']} */ ;
239
+ /** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
240
+ /** @type {__VLS_StyleScopedClasses['px-3']} */ ;
241
+ /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
242
+ /** @type {__VLS_StyleScopedClasses['rounded-2xl']} */ ;
243
+ /** @type {__VLS_StyleScopedClasses['max-w-xs']} */ ;
244
+ /** @type {__VLS_StyleScopedClasses['rounded-tl-none']} */ ;
245
+ /** @type {__VLS_StyleScopedClasses['rounded-bl-none']} */ ;
246
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
247
+ /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
248
+ /** @type {__VLS_StyleScopedClasses['items-end']} */ ;
249
+ /** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
250
+ /** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
251
+ /** @type {__VLS_StyleScopedClasses['bg-[#D0DFEC]']} */ ;
252
+ /** @type {__VLS_StyleScopedClasses['text-[#266699]']} */ ;
253
+ /** @type {__VLS_StyleScopedClasses['px-3']} */ ;
254
+ /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
255
+ /** @type {__VLS_StyleScopedClasses['rounded-2xl']} */ ;
256
+ /** @type {__VLS_StyleScopedClasses['max-w-xs']} */ ;
257
+ /** @type {__VLS_StyleScopedClasses['rounded-tr-none']} */ ;
258
+ /** @type {__VLS_StyleScopedClasses['rounded-br-none']} */ ;
259
+ /** @type {__VLS_StyleScopedClasses['text-chat-haze-200']} */ ;
260
+ /** @type {__VLS_StyleScopedClasses['text-xs']} */ ;
261
+ /** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
262
+ /** @type {__VLS_StyleScopedClasses['text-danger']} */ ;
263
+ // @ts-ignore
264
+ var __VLS_7 = __VLS_6;
265
+ const __VLS_export = (await import('vue')).defineComponent({
266
+ setup: () => (__VLS_exposed),
267
+ __typeEmits: {},
268
+ __typeProps: {},
269
+ props: {},
270
+ });
271
+ export default {};
@@ -0,0 +1,14 @@
1
+ import type { IResUser } from '../../../types/message';
2
+ import type { PAGE_RESPONSE } from '../../../types/chat/global';
3
+ type Props = {
4
+ receiverId: any;
5
+ response: PAGE_RESPONSE;
6
+ };
7
+ declare const _default: import("vue").DefineComponent<Props, {
8
+ getData: (data?: any) => Promise<void>;
9
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
10
+ call: (value: IResUser) => any;
11
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
12
+ onCall?: ((value: IResUser) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ export default _default;