@bcc-code/vue-bcc-chat-ui 2.3.0 → 3.0.0-alpha.10
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/connection.d.ts +2 -0
- package/dist/chat/index.d.ts +25 -0
- package/dist/chat/theme.d.ts +24 -0
- package/dist/chat/uiKit.d.ts +2 -1
- package/dist/style.css +1 -1
- package/dist/vue-bcc-chat-ui.js +35683 -32766
- package/package.json +9 -9
- package/src/components/BccChatMessageList.vue +84 -29
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": "
|
|
5
|
+
"version": "3.0.0-alpha.10",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"private": false,
|
|
8
8
|
"files": [
|
|
@@ -23,20 +23,20 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/markdown-it": "^13.0.7",
|
|
26
|
-
"@types/node": "^20.11.
|
|
26
|
+
"@types/node": "^20.11.30",
|
|
27
27
|
"@vitejs/plugin-vue": "^4.6.2",
|
|
28
28
|
"path": "^0.12.7",
|
|
29
|
-
"sass": "^1.
|
|
30
|
-
"typescript": "^5.4.
|
|
31
|
-
"vite": "^5.
|
|
29
|
+
"sass": "^1.72.0",
|
|
30
|
+
"typescript": "^5.4.3",
|
|
31
|
+
"vite": "^5.2.6",
|
|
32
32
|
"vite-plugin-dts": "^3.7.3",
|
|
33
33
|
"vue": "^3.4.21"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@cometchat/chat-sdk-javascript": "^4.0.
|
|
37
|
-
"@cometchat/chat-uikit-vue": "^4.
|
|
38
|
-
"@cometchat/uikit-resources": "^4.
|
|
39
|
-
"@cometchat/uikit-shared": "^4.
|
|
36
|
+
"@cometchat/chat-sdk-javascript": "^4.0.4",
|
|
37
|
+
"@cometchat/chat-uikit-vue": "^4.3.1",
|
|
38
|
+
"@cometchat/uikit-resources": "^4.3.1",
|
|
39
|
+
"@cometchat/uikit-shared": "^4.3.2",
|
|
40
40
|
"jwt-decode": "^4.0.0",
|
|
41
41
|
"markdown-it": "^14.1.0"
|
|
42
42
|
},
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
onUnmounted,
|
|
6
6
|
ref,
|
|
7
7
|
watch,
|
|
8
|
+
watchEffect,
|
|
8
9
|
} from "vue";
|
|
9
10
|
import chat from "../chat";
|
|
10
11
|
import { connect, disconnect } from "../chat/connection";
|
|
@@ -12,9 +13,11 @@ import { loggedIn } from "../chat/login";
|
|
|
12
13
|
import { CometChatMessages } from "@cometchat/chat-uikit-vue";
|
|
13
14
|
import { Group } from "@cometchat/chat-sdk-javascript";
|
|
14
15
|
import { watchAndApplyStyle } from "../chat/styleFix";
|
|
16
|
+
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
15
17
|
import {
|
|
16
18
|
messageComposerConfiguration,
|
|
17
19
|
messageListConfiguration,
|
|
20
|
+
threadedMessagesConfiguration
|
|
18
21
|
} from "../chat/uiKit";
|
|
19
22
|
|
|
20
23
|
const props = defineProps({
|
|
@@ -35,13 +38,41 @@ watch([loggedIn, ()=>props.chatUid, chat.initialized], async ([_loggedIn, _chatU
|
|
|
35
38
|
}
|
|
36
39
|
}, { immediate: true });
|
|
37
40
|
|
|
38
|
-
watch(chat.onlineStatus,
|
|
39
|
-
|
|
41
|
+
watch(chat.onlineStatus, () => {
|
|
42
|
+
tryConnect(false);
|
|
40
43
|
});
|
|
41
44
|
|
|
45
|
+
watch(chat.onlineMode, () => {
|
|
46
|
+
if (chat.onlineMode.value == 'online'){
|
|
47
|
+
tryConnect(true);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const showChat = ref(false);
|
|
52
|
+
watchEffect(() => {
|
|
53
|
+
if (chatGroup && (chat.connected.value || chat.onlineStatus.value == 'offline')){
|
|
54
|
+
showChat.value = true;
|
|
55
|
+
} else {
|
|
56
|
+
// This line is a trade-off.
|
|
57
|
+
// With it, the entire chat will be hidden and then reloaded when a connection is being established.
|
|
58
|
+
// The advantage is that the chat should then scroll to the latest message after reconnecting.
|
|
59
|
+
// Without it, the chat window won't reload. New messages should still be loaded, but the chat won't scroll down.
|
|
60
|
+
// The advantage with removing this line would be that half finished messages that were being composed when the user went offline
|
|
61
|
+
// wouldn't be lost...
|
|
62
|
+
showChat.value = false;
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
let _connecting = false;
|
|
42
67
|
async function tryConnect(force: boolean) {
|
|
43
68
|
if (chat.onlineStatus.value === "online" || force) {
|
|
44
|
-
|
|
69
|
+
console.log('CONNECTING::::');
|
|
70
|
+
if (!_connecting){
|
|
71
|
+
try {
|
|
72
|
+
await connect(componentId.value);
|
|
73
|
+
} catch { }
|
|
74
|
+
_connecting = false;
|
|
75
|
+
}
|
|
45
76
|
}
|
|
46
77
|
}
|
|
47
78
|
|
|
@@ -76,25 +107,23 @@ onMounted(() => {
|
|
|
76
107
|
style: { 'flex-shrink': '0' },
|
|
77
108
|
shadowDomSelector: "link-preview",
|
|
78
109
|
},
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
shadowDomSelector: "cometchat-message-input",
|
|
97
|
-
},
|
|
110
|
+
// {
|
|
111
|
+
// selector: ".messageinput",
|
|
112
|
+
// style: {
|
|
113
|
+
// "border-radius": "8px 8px 0 0",
|
|
114
|
+
// "box-shadow":
|
|
115
|
+
// "0px -1px 2px 0px rgba(17, 24, 39, 0.05), 1px -1px 3px 0px rgba(17, 24, 39, 0.1)",
|
|
116
|
+
// },
|
|
117
|
+
// },
|
|
118
|
+
// {
|
|
119
|
+
// selector: ".messageinput-input",
|
|
120
|
+
// style: {
|
|
121
|
+
// "font-size": "16px",
|
|
122
|
+
// padding: "8px",
|
|
123
|
+
// "max-height": "none",
|
|
124
|
+
// height: "64px",
|
|
125
|
+
// },
|
|
126
|
+
// },
|
|
98
127
|
]);
|
|
99
128
|
});
|
|
100
129
|
|
|
@@ -102,26 +131,49 @@ onUnmounted(async () => {
|
|
|
102
131
|
await disconnect(componentId.value);
|
|
103
132
|
});
|
|
104
133
|
|
|
134
|
+
const cometChatStatus = ref('');
|
|
135
|
+
function getCometChatStatus(){
|
|
136
|
+
cometChatStatus.value = new Date().getTime() + CometChat.getConnectionStatus();
|
|
137
|
+
}
|
|
138
|
+
|
|
105
139
|
</script>
|
|
106
140
|
|
|
107
141
|
<template>
|
|
108
142
|
<div class="bcc-chat-message-list-wrapper">
|
|
109
|
-
<div
|
|
110
|
-
<
|
|
143
|
+
<div>
|
|
144
|
+
<div>Connecting... <button @click="tryConnect(true)">[retry]</button></div>
|
|
145
|
+
<div>Online status: {{chat.onlineStatus}}</div>
|
|
146
|
+
<div>Online mode: {{chat.onlineMode}}</div>
|
|
147
|
+
<div>Connected: {{chat.connected.value}}</div>
|
|
148
|
+
<div>Connecting: {{chat.connecting.value}}</div>
|
|
149
|
+
<div>CometChat: {{cometChatStatus}} <button @click="getCometChatStatus()">[refresh]</button></div>
|
|
150
|
+
</div>
|
|
151
|
+
<div v-if="showChat" class="bcc-chat-message-list">
|
|
152
|
+
|
|
153
|
+
<CometChatMessages
|
|
111
154
|
:hideMessageHeader="true"
|
|
112
155
|
:disableSoundForMessages="true"
|
|
113
156
|
:messageComposerConfiguration="messageComposerConfiguration"
|
|
114
157
|
:messageListConfiguration="messageListConfiguration"
|
|
158
|
+
:threadedMessagesConfiguration="threadedMessagesConfiguration"
|
|
115
159
|
:hideMessageComposer="false"
|
|
116
160
|
:hideDetails="true"
|
|
117
161
|
:group="chatGroup"
|
|
118
162
|
/>
|
|
163
|
+
|
|
119
164
|
<div v-if="chat.onlineStatus.value === 'offline' || !chat.connected.value" class="bcc-chat-message-composer-offline">
|
|
120
|
-
<span>Waiting for
|
|
165
|
+
<span v-if="chat.onlineStatus.value === 'offline'">Waiting for network...</span>
|
|
166
|
+
<span v-else>Connecting...</span>
|
|
121
167
|
</div>
|
|
122
168
|
</div>
|
|
123
|
-
<div class="bcc-chat-message-list-offline">
|
|
124
|
-
<span>
|
|
169
|
+
<div v-else-if="!chat.connected.value" class="bcc-chat-message-list-offline">
|
|
170
|
+
<span>Connecting... <button @click="tryConnect(true)">[retry]</button></span>
|
|
171
|
+
</div>
|
|
172
|
+
<div v-else-if="!chatGroup" class="bcc-chat-message-list-offline">
|
|
173
|
+
<span>Loading chat...</span>
|
|
174
|
+
</div>
|
|
175
|
+
<div v-else class="bcc-chat-message-list-offline">
|
|
176
|
+
<span>Loading...</span>
|
|
125
177
|
</div>
|
|
126
178
|
</div>
|
|
127
179
|
</template>
|
|
@@ -202,11 +254,15 @@ accent900: text in avatar
|
|
|
202
254
|
|
|
203
255
|
/* 1.1.2 Wrapper for Messages Composer */
|
|
204
256
|
.cc-messagecomposer-wrapper {
|
|
205
|
-
padding: 0;
|
|
257
|
+
//padding: 0; //Use to remove side padding on composer
|
|
206
258
|
}
|
|
207
259
|
}
|
|
208
260
|
}
|
|
209
261
|
|
|
262
|
+
.cc-messagebubble-wrapper__container {
|
|
263
|
+
max-width: 80%;
|
|
264
|
+
}
|
|
265
|
+
|
|
210
266
|
.cc-messagebubble-wrapper__messageoptions {
|
|
211
267
|
border-radius: 8px;
|
|
212
268
|
.cc-context-menu__top-menu {
|
|
@@ -246,7 +302,6 @@ accent900: text in avatar
|
|
|
246
302
|
align-items: center;
|
|
247
303
|
font: 700 22px sans-serif;
|
|
248
304
|
color: #bcbcbc;
|
|
249
|
-
z-index: -1;
|
|
250
305
|
}
|
|
251
306
|
|
|
252
307
|
.cc-messagecomposer__emojikeyboard {
|