@bcc-code/vue-bcc-chat-ui 3.10.1 → 3.12.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.10.1",
5
+ "version": "3.12.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -18,7 +18,8 @@
18
18
  "exports": {
19
19
  ".": {
20
20
  "import": "./dist/vue-bcc-chat-ui.js",
21
- "require": "./dist/vue-bcc-chat-ui.js"
21
+ "require": "./dist/vue-bcc-chat-ui.js",
22
+ "types": "./dist/index.d.ts"
22
23
  },
23
24
  "./style.css": {
24
25
  "import": "./dist/style.css",
@@ -33,22 +34,23 @@
33
34
  },
34
35
  "devDependencies": {
35
36
  "@types/dompurify": "^3.0.5",
36
- "@types/markdown-it": "^14.1.1",
37
+ "@types/markdown-it": "^14.1.2",
37
38
  "@types/node": "^20.14.9",
38
- "@vitejs/plugin-vue": "^5.0.5",
39
+ "@vitejs/plugin-vue": "^5.1.3",
39
40
  "path": "^0.12.7",
40
- "sass": "^1.77.6",
41
- "typescript": "^5.5.2",
42
- "vite": "^5.3.2",
43
- "vite-plugin-dts": "^3.9.1",
44
- "vue": "^3.4.31"
41
+ "sass": "^1.77.8",
42
+ "typescript": "^5.5.4",
43
+ "vite": "^5.4.2",
44
+ "vite-plugin-dts": "^4.1.0",
45
+ "vue": "^3.4.38"
45
46
  },
46
47
  "dependencies": {
47
- "@cometchat/chat-sdk-javascript": "4.0.7",
48
- "@cometchat/chat-uikit-vue": "4.3.11",
49
- "@cometchat/uikit-resources": "4.3.9",
50
- "@cometchat/uikit-shared": "4.3.12",
51
- "dompurify": "^3.1.5",
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",
53
+ "dompurify": "^3.1.6",
52
54
  "jwt-decode": "^4.0.0",
53
55
  "markdown-it": "^14.1.0",
54
56
  "panzoom": "^9.4.3"
@@ -8,7 +8,7 @@ import {
8
8
  provide,
9
9
  ref,
10
10
  watch,
11
- watchEffect,
11
+ watchEffect,
12
12
  } from "vue";
13
13
  import chat from "../chat";
14
14
  import { connect, disconnect } from "../chat/connection";
@@ -26,6 +26,7 @@ import { CometChatMessageEvents, MessageStatus } from "@cometchat/uikit-resource
26
26
 
27
27
  const props = defineProps({
28
28
  chatUid: { type: String, required: true },
29
+ senderDisplayName: { type: String, required: false}
29
30
  });
30
31
 
31
32
  const componentId = ref(
@@ -39,15 +40,29 @@ const chatInstance: Ref<ChatInstance> = ref({
39
40
  });
40
41
 
41
42
  const messageComposerConfiguration = getMessageComposerConfiguration();
42
- const messageListConfiguration = getMessageListConfiguration(chatInstance);
43
- const threadedMessagesConfiguration = getThreadedMessagesConfiguration();
43
+ const messageListConfiguration = getMessageListConfiguration(chatInstance, chatGroup);
44
+ const threadedMessagesConfiguration = getThreadedMessagesConfiguration(chatGroup);
44
45
 
45
46
  provide("chatInstance", chatInstance);
47
+
46
48
  const onMessageSend = CometChatMessageEvents.ccMessageSent.subscribe(({ message, status }) => {
47
- if (status === MessageStatus.inprogress && chatInstance.value.replyToMessage) {
48
- (message as any).setMetadata({
49
- replyToMessageId: chatInstance.value.replyToMessage?.getId()
50
- });
49
+ if (status === MessageStatus.inprogress) {
50
+ let metadata: any = {};
51
+ let scope: string | undefined = chatGroup.value?.getScope()
52
+
53
+ if (chatInstance.value.replyToMessage) {
54
+ metadata.replyToMessageId = chatInstance.value.replyToMessage?.getId()
55
+ }
56
+
57
+ if (props.senderDisplayName && (scope == "moderator" || scope == "admin")) {
58
+ metadata.senderDisplayName = props.senderDisplayName
59
+ }
60
+
61
+ if (Object.keys(metadata).length === 0) {
62
+ return
63
+ }
64
+
65
+ (message as any).setMetadata(metadata);
51
66
  }
52
67
  });
53
68
 
@@ -64,10 +79,10 @@ watchEffect(() => {
64
79
  }
65
80
  });
66
81
 
67
- watch([loggedIn, ()=> props.chatUid, chat.initialized], async ([_loggedIn, _chatUid, _initialized]) => {
82
+ watch([loggedIn, () => props.chatUid, chat.initialized], async ([_loggedIn, _chatUid, _initialized]) => {
68
83
  if (_loggedIn && _chatUid && _initialized) {
69
84
  chatGroup.value = (await chat.getGroup(props.chatUid)) ?? undefined;
70
- await chat.clearGroupChatCount(props.chatUid);
85
+ await chat.clearGroupChatCount(props.chatUid);
71
86
  } else if (chatGroup.value) {
72
87
  chatGroup.value = undefined;
73
88
  }
@@ -86,7 +101,7 @@ onMounted(() => {
86
101
  },
87
102
  {
88
103
  selector: ".cc__preview__subtitle",
89
- style: {
104
+ style: {
90
105
  "overflow": "hidden",
91
106
  "display": "-webkit-box",
92
107
  "-webkit-box-orient": "vertical",
@@ -106,6 +121,14 @@ onUnmounted(async () => {
106
121
  await disconnect(componentId.value);
107
122
  });
108
123
 
124
+ function isChannel(): boolean {
125
+ return chatGroup.value?.getMetadata()?.isChannel;
126
+ }
127
+
128
+ function isParticipant(): boolean {
129
+ return chatGroup.value?.getScope() == "participant";
130
+ }
131
+
109
132
  </script>
110
133
 
111
134
  <template>
@@ -119,18 +142,14 @@ onUnmounted(async () => {
119
142
  <div>CometChat: {{cometChatStatus}} <button @click="getCometChatStatus()">[refresh]</button></div>
120
143
  </div> -->
121
144
  <div v-if="chatGroup" class="bcc-chat-message-list">
122
- <CometChatMessages
123
- :hideMessageHeader="true"
124
- :disableSoundForMessages="true"
145
+ <CometChatMessages :hideMessageHeader="true" :disableSoundForMessages="true"
125
146
  :messageComposerConfiguration="messageComposerConfiguration"
126
147
  :messageListConfiguration="messageListConfiguration"
127
148
  :threadedMessagesConfiguration="threadedMessagesConfiguration"
128
- :hideMessageComposer="false"
129
- :hideDetails="true"
130
- :group="chatGroup"
131
- />
149
+ :hideMessageComposer="isParticipant() && isChannel()" :hideDetails="true" :group="chatGroup" />
132
150
 
133
- <div v-if="chat.onlineStatus.value === 'offline' || !chat.connected.value" class="bcc-chat-message-composer-offline">
151
+ <div v-if="chat.onlineStatus.value === 'offline' || !chat.connected.value"
152
+ class="bcc-chat-message-composer-offline">
134
153
  <span v-if="chat.onlineStatus.value === 'offline'">Waiting for network...</span>
135
154
  <span v-else>Connecting...</span>
136
155
  </div>
@@ -214,11 +233,13 @@ accent900: text in avatar
214
233
 
215
234
  /* 1. Wrapper for Messages component */
216
235
  .cc-messages-wrapper {
236
+
217
237
  /* 1.1 Messages component */
218
238
  .cc-messages-wrapper__messages {
239
+
219
240
  /* 1.1.1 Wrapper for Messages List */
220
241
  .cc-messages-wrapper__messages-list {
221
- height: calc(100% - 96px);
242
+ height: 100%;
222
243
  }
223
244
 
224
245
  /* 1.1.2 Wrapper for Messages Composer */
@@ -239,10 +260,12 @@ accent900: text in avatar
239
260
 
240
261
  .cc-messagebubble-wrapper__messageoptions {
241
262
  border-radius: 8px;
263
+
242
264
  .cc-context-menu__top-menu {
243
265
  border: 1px var(--cc__secondary) solid !important;
244
266
  }
245
267
  }
268
+
246
269
  /* 2. Message for Messages Composer when offline */
247
270
  .bcc-chat-message-composer-offline {
248
271
  position: relative;
@@ -3,7 +3,7 @@ import { CometChatTheme, CometChatUIKitConstants } from "@cometchat/uikit-resour
3
3
  import { inject, ref } from "vue";
4
4
  import { ReplyPreviewStyle } from "../chat/replyStyle";
5
5
  import { BaseMessage, MediaMessage } from "@cometchat/chat-sdk-javascript";
6
- import { getMessageTextPreview, proxyImage } from "../chat/data";
6
+ import { getMessageTextPreview, proxyImage, getSenderDisplayName } from "../chat/data";
7
7
 
8
8
  const props = defineProps({
9
9
  replyToMessage: { type: BaseMessage },
@@ -62,7 +62,7 @@ function getThumbnailURL() {
62
62
  </div>
63
63
  <div class="bcc__reply_preview__content">
64
64
  <p class="bcc__reply_preview__title" :style="titleStyle()">
65
- {{ props.titlePrefix + ( props?.replyToMessage?.getSender()?.getName() || "" ) || "Reply to ..." }}
65
+ {{ props.titlePrefix + ( getSenderDisplayName(props.replyToMessage) || "" ) || "Reply to ..." }}
66
66
  </p>
67
67
  <p class="cc__preview__subtitle" :style="subtitleStyle()">
68
68
  {{ getMessageTextPreview(props?.replyToMessage) || "‎" }}