@bcc-code/vue-bcc-chat-ui 4.7.0 → 5.0.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": "4.7.0",
5
+ "version": "5.0.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -59,6 +59,7 @@
59
59
  "@cometchat/uikit-resources": "4.3.13",
60
60
  "@cometchat/uikit-shared": "4.3.19",
61
61
  "dompurify": "^3.1.7",
62
+ "fuse.js": "^7.0.0",
62
63
  "jwt-decode": "^4.0.0",
63
64
  "markdown-it": "^14.1.0",
64
65
  "panzoom": "^9.4.3"
@@ -9,6 +9,11 @@ import BccImageBubble from './BccImageBubble.vue';
9
9
  import { offlineStore } from '../offline';
10
10
 
11
11
  const props = defineProps({
12
+ id: {
13
+ type: String,
14
+ required: false,
15
+ default: ""
16
+ },
12
17
  text: {
13
18
  type: String,
14
19
  required: true
@@ -138,7 +143,7 @@ const replyPreviewStyle = {
138
143
  </div>
139
144
  <div v-if="text && metadata && metadata.translated_message" v-html="toMarkdownHtml(metadata.translated_message)"
140
145
  class="bcc-chat-msg-bubble bcc-chat-msg-bubble--translation" />
141
- <div v-if="text" v-html="toMarkdownHtml(text)" class="bcc-chat-msg-bubble"
146
+ <div v-if="text" v-html="toMarkdownHtml(text)" class="bcc-chat-msg-bubble" :id="id"
142
147
  :class="{ 'bcc-chat-msg-bubble--translated': metadata && !!metadata.translated_message }" />
143
148
  </div>
144
149
  </template>
@@ -30,6 +30,7 @@ const props = defineProps({
30
30
  type: Function as PropType<(guid: string, query: string) => Promise<any>>,
31
31
  required: false,
32
32
  },
33
+ loadMessageId: { type: String, required: false, default: "" },
33
34
  });
34
35
 
35
36
  const componentId = ref(
@@ -55,6 +56,11 @@ const chatInstance: Ref<ChatInstance> = ref({
55
56
 
56
57
  provide("chatInstance", chatInstance);
57
58
 
59
+ const localLoadMessageId = ref(props.loadMessageId);
60
+ watch(() => props.loadMessageId, (newVal) => {
61
+ localLoadMessageId.value = newVal;
62
+ });
63
+
58
64
  const onMessageSend = CometChatMessageEvents.ccMessageSent.subscribe(({ message, status }) => {
59
65
  if (status !== MessageStatus.inprogress) {
60
66
  return
@@ -80,9 +86,8 @@ const onMessageSend = CometChatMessageEvents.ccMessageSent.subscribe(({ message,
80
86
  (message as any).setMetadata(metadata);
81
87
  });
82
88
 
83
- watch([loggedIn, chat.onlineStatus, () => props.chatUid, chat.initialized, () => props.groupMessageGetter], async ([_loggedIn, _online, _chatUid, _initialized, _groupMessageGetter]) => {
89
+ watch([loggedIn, chat.onlineStatus, () => props.chatUid, chat.initialized, () => props.groupMessageGetter, chat.scrollToMessageId, localLoadMessageId], async ([_loggedIn, _online, _chatUid, _initialized, _groupMessageGetter, _scrollToMessageId, _localLoadMessageId]) => {
84
90
  logger.debug("ChatMessageList watch changed", { chatUid: _chatUid, loggedIn: _loggedIn, online: _online, initialized: _initialized });
85
-
86
91
  try {
87
92
  if (_loggedIn && _chatUid && _initialized) {
88
93
  chatGroupNotFound.value = false;
@@ -97,6 +102,15 @@ watch([loggedIn, chat.onlineStatus, () => props.chatUid, chat.initialized, () =>
97
102
  chat.updateGetGroupMessages(_groupMessageGetter)
98
103
  }
99
104
 
105
+ if (_scrollToMessageId) {
106
+ chat.scrollToMessage(_scrollToMessageId);
107
+ }
108
+
109
+ if (_localLoadMessageId) {
110
+ chat.loadMessageId.value = _localLoadMessageId;
111
+ localLoadMessageId.value = "";
112
+ }
113
+
100
114
  if (chatGroup.value) {
101
115
 
102
116
  let isChannel = (chatGroup.value.getMetadata() as any).isChannel;
@@ -117,7 +131,6 @@ watch([loggedIn, chat.onlineStatus, () => props.chatUid, chat.initialized, () =>
117
131
  }
118
132
 
119
133
  }
120
-
121
134
  await chat.clearGroupChatCount(props.chatUid);
122
135
  } else if (chatGroup.value) {
123
136
  chatGroup.value = undefined;