@bcc-code/vue-bcc-chat-ui 3.18.0 → 3.20.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/dist/chat/login.d.ts +1 -0
- package/dist/components/BccChatMessageBubble.vue.d.ts +9 -0
- package/dist/offline/index.d.ts +2 -0
- package/dist/offline/types.d.ts +5 -0
- package/dist/vue-bcc-chat-ui.js +12697 -12655
- package/package.json +1 -1
- package/src/components/BccChatMessageBubble.vue +28 -1
- package/src/components/BccChatMessageList.vue +17 -1
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import { inject, ref } from 'vue';
|
|
|
6
6
|
import { CometChatTheme, fontHelper } from '@cometchat/uikit-resources';
|
|
7
7
|
import BccReplyPreview from "./BccReplyPreview.vue";
|
|
8
8
|
import BccImageBubble from './BccImageBubble.vue';
|
|
9
|
+
import { offlineStore } from '../offline';
|
|
9
10
|
|
|
10
11
|
const props = defineProps({
|
|
11
12
|
text: {
|
|
@@ -15,6 +16,10 @@ const props = defineProps({
|
|
|
15
16
|
metadata: {
|
|
16
17
|
type: Object
|
|
17
18
|
},
|
|
19
|
+
guid: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
18
23
|
mentionedUsers: {
|
|
19
24
|
type: Array<User>
|
|
20
25
|
},
|
|
@@ -79,7 +84,29 @@ function formatMentionsInText(text: string) {
|
|
|
79
84
|
|
|
80
85
|
let parentMsgRef = ref<BaseMessage>();
|
|
81
86
|
if (props.metadata?.replyToMessageId) {
|
|
82
|
-
|
|
87
|
+
let guidString = props.guid?.toString()
|
|
88
|
+
let group = offlineStore.getGroup(guidString)
|
|
89
|
+
|
|
90
|
+
//for read only replies
|
|
91
|
+
if (group != null && group?.hasJoined == undefined) {
|
|
92
|
+
let message = offlineStore.getMessage(props.metadata.replyToMessageId).data
|
|
93
|
+
|
|
94
|
+
if (message !== undefined) {
|
|
95
|
+
if (message.type == CometChat.MESSAGE_TYPE.TEXT) {
|
|
96
|
+
let text = new CometChat.TextMessage(message.receiver, message.data.text, message.receiverType)
|
|
97
|
+
text.setData(message.data)
|
|
98
|
+
parentMsgRef.value = text
|
|
99
|
+
} else {
|
|
100
|
+
let media = new CometChat.MediaMessage(message.receiver, {}, message.type, message.receiverType)
|
|
101
|
+
media.setData(message.data)
|
|
102
|
+
parentMsgRef.value = media
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
parentMsgRef.value = new CometChat.TextMessage("","Cannot load message","")
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
CometChat.getMessageDetails(props.metadata.replyToMessageId).then((msg: BaseMessage) => parentMsgRef.value = msg).catch(() => parentMsgRef.value = new CometChat.TextMessage("","Unknown message",""));
|
|
109
|
+
}
|
|
83
110
|
};
|
|
84
111
|
|
|
85
112
|
const { theme } = inject("theme", { theme: ref(new CometChatTheme({})) });
|
|
@@ -96,7 +96,19 @@ watchEffect(() => {
|
|
|
96
96
|
watch([loggedIn, () => props.chatUid, chat.initialized], async ([_loggedIn, _chatUid, _initialized]) => {
|
|
97
97
|
if (_loggedIn && _chatUid && _initialized) {
|
|
98
98
|
chatGroup.value = (await chat.getGroup(props.chatUid)) ?? undefined;
|
|
99
|
-
|
|
99
|
+
|
|
100
|
+
if (chatGroup.value) {
|
|
101
|
+
watchAndApplyStyle(".bcc-chat-message-list-wrapper", [
|
|
102
|
+
{
|
|
103
|
+
selector: ".cc-messagebubble-wrapper__container",
|
|
104
|
+
style: {
|
|
105
|
+
"max-width": (chatGroup.value.getMetadata() as any).isChannel ? "95%": "80%"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
])
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
await chat.clearGroupChatCount(props.chatUid);
|
|
100
112
|
} else if (chatGroup.value) {
|
|
101
113
|
chatGroup.value = undefined;
|
|
102
114
|
}
|
|
@@ -140,6 +152,10 @@ function isChannel(): boolean {
|
|
|
140
152
|
}
|
|
141
153
|
|
|
142
154
|
function isParticipant(): boolean {
|
|
155
|
+
//if not part of the group return true anyway since getScope dosen't exist when not in the group
|
|
156
|
+
if (!chatGroup.value?.getHasJoined()) {
|
|
157
|
+
return true
|
|
158
|
+
}
|
|
143
159
|
return chatGroup.value?.getScope() == "participant";
|
|
144
160
|
}
|
|
145
161
|
|