@bcc-code/vue-bcc-chat-ui 3.21.0 → 3.22.0

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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@bcc-code/vue-bcc-chat-ui",
3
3
  "author": "bcc-code",
4
4
  "license": "Apache-2.0",
5
- "version": "3.21.0",
5
+ "version": "3.22.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -46,10 +46,10 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@cometchat/chat-sdk-javascript": "4.0.10",
49
- "@cometchat/chat-uikit-vue": "4.3.16",
50
- "@cometchat/uikit-elements": "4.3.15",
51
- "@cometchat/uikit-resources": "4.3.11",
52
- "@cometchat/uikit-shared": "4.3.17",
49
+ "@cometchat/chat-uikit-vue": "4.3.17",
50
+ "@cometchat/uikit-elements": "4.3.17",
51
+ "@cometchat/uikit-resources": "4.3.13",
52
+ "@cometchat/uikit-shared": "4.3.19",
53
53
  "dompurify": "^3.1.6",
54
54
  "jwt-decode": "^4.0.0",
55
55
  "markdown-it": "^14.1.0",
@@ -1,11 +1,30 @@
1
1
  <script setup lang="ts">
2
- import {
3
- CometChatMessageList,
4
- } from "@cometchat/chat-uikit-vue";
2
+ import { computed } from 'vue';
3
+ import { useAttrs } from 'vue';
4
+ import { CometChatMessageList } from "@cometchat/chat-uikit-vue";
5
5
  import chat from "../chat";
6
+
7
+ // The purpose of this file is to force the component to be "reloaded" when switching between online and offline vue. I.e. so that messages will be loaded again
8
+ // AND the user scrolled to the bottom when coming online. The default implementation has issues with scrolling the user to the bottom in some cases.
9
+
10
+ // The reason for doing this for the CometChatMessageList specifically(instead of the whole chat window) is to avoid losing messages that the user may
11
+ // have started writing in the chat box before going offline.
12
+
13
+
14
+ const attrs = useAttrs();
15
+
16
+ // Work-around to avoid id being set to the wrong ID when switching between online and offline message view
17
+ // For some reason switching between the first and second message list below resulted in messageRequestBuilder.id to be set to the previous message
18
+ // after every online/offline switch resulting in on message being removed from the conversation each time.
19
+ const modifiedAttrs = computed(() => {
20
+ const newAttrs = { ...attrs };
21
+ newAttrs.connected = chat.connected.value;
22
+ newAttrs.messagesRequestBuilder.id = 0;
23
+ return newAttrs;
24
+ });
6
25
  </script>
7
26
 
8
27
  <template>
9
- <CometChatMessageList v-if="chat.connected.value" v-bind="$attrs"/>
10
- <CometChatMessageList v-else v-bind="$attrs"/>
28
+ <CometChatMessageList v-if="chat.connected.value" v-bind="modifiedAttrs" />
29
+ <CometChatMessageList v-else v-bind="modifiedAttrs" />
11
30
  </template>