@bcc-code/vue-bcc-chat-ui 3.0.0-alpha.10 → 3.0.0-alpha.3
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 +0 -2
- package/dist/chat/index.d.ts +0 -1
- package/dist/style.css +1 -1
- package/dist/vue-bcc-chat-ui.js +6220 -6281
- package/package.json +1 -1
- package/src/components/BccChatMessageList.vue +9 -64
package/package.json
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
onUnmounted,
|
|
6
6
|
ref,
|
|
7
7
|
watch,
|
|
8
|
-
watchEffect,
|
|
9
8
|
} from "vue";
|
|
10
9
|
import chat from "../chat";
|
|
11
10
|
import { connect, disconnect } from "../chat/connection";
|
|
@@ -13,7 +12,6 @@ import { loggedIn } from "../chat/login";
|
|
|
13
12
|
import { CometChatMessages } from "@cometchat/chat-uikit-vue";
|
|
14
13
|
import { Group } from "@cometchat/chat-sdk-javascript";
|
|
15
14
|
import { watchAndApplyStyle } from "../chat/styleFix";
|
|
16
|
-
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
17
15
|
import {
|
|
18
16
|
messageComposerConfiguration,
|
|
19
17
|
messageListConfiguration,
|
|
@@ -38,41 +36,13 @@ watch([loggedIn, ()=>props.chatUid, chat.initialized], async ([_loggedIn, _chatU
|
|
|
38
36
|
}
|
|
39
37
|
}, { immediate: true });
|
|
40
38
|
|
|
41
|
-
watch(chat.onlineStatus, () => {
|
|
42
|
-
tryConnect(false);
|
|
39
|
+
watch(chat.onlineStatus, async () => {
|
|
40
|
+
await tryConnect(false);
|
|
43
41
|
});
|
|
44
42
|
|
|
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;
|
|
67
43
|
async function tryConnect(force: boolean) {
|
|
68
44
|
if (chat.onlineStatus.value === "online" || force) {
|
|
69
|
-
|
|
70
|
-
if (!_connecting){
|
|
71
|
-
try {
|
|
72
|
-
await connect(componentId.value);
|
|
73
|
-
} catch { }
|
|
74
|
-
_connecting = false;
|
|
75
|
-
}
|
|
45
|
+
await connect(componentId.value);
|
|
76
46
|
}
|
|
77
47
|
}
|
|
78
48
|
|
|
@@ -131,26 +101,12 @@ onUnmounted(async () => {
|
|
|
131
101
|
await disconnect(componentId.value);
|
|
132
102
|
});
|
|
133
103
|
|
|
134
|
-
const cometChatStatus = ref('');
|
|
135
|
-
function getCometChatStatus(){
|
|
136
|
-
cometChatStatus.value = new Date().getTime() + CometChat.getConnectionStatus();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
104
|
</script>
|
|
140
105
|
|
|
141
106
|
<template>
|
|
142
107
|
<div class="bcc-chat-message-list-wrapper">
|
|
143
|
-
<div>
|
|
144
|
-
<
|
|
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
|
|
108
|
+
<div v-if="chatGroup && (chat.connected.value || chat.onlineStatus.value === 'offline')" class="bcc-chat-message-list">
|
|
109
|
+
<CometChatMessages
|
|
154
110
|
:hideMessageHeader="true"
|
|
155
111
|
:disableSoundForMessages="true"
|
|
156
112
|
:messageComposerConfiguration="messageComposerConfiguration"
|
|
@@ -160,20 +116,12 @@ function getCometChatStatus(){
|
|
|
160
116
|
:hideDetails="true"
|
|
161
117
|
:group="chatGroup"
|
|
162
118
|
/>
|
|
163
|
-
|
|
164
119
|
<div v-if="chat.onlineStatus.value === 'offline' || !chat.connected.value" class="bcc-chat-message-composer-offline">
|
|
165
|
-
<span
|
|
166
|
-
<span v-else>Connecting...</span>
|
|
120
|
+
<span>Waiting for connection...</span>
|
|
167
121
|
</div>
|
|
168
122
|
</div>
|
|
169
|
-
<div
|
|
170
|
-
<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>
|
|
123
|
+
<div class="bcc-chat-message-list-offline">
|
|
124
|
+
<span>Waiting for connection...</span>
|
|
177
125
|
</div>
|
|
178
126
|
</div>
|
|
179
127
|
</template>
|
|
@@ -259,10 +207,6 @@ accent900: text in avatar
|
|
|
259
207
|
}
|
|
260
208
|
}
|
|
261
209
|
|
|
262
|
-
.cc-messagebubble-wrapper__container {
|
|
263
|
-
max-width: 80%;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
210
|
.cc-messagebubble-wrapper__messageoptions {
|
|
267
211
|
border-radius: 8px;
|
|
268
212
|
.cc-context-menu__top-menu {
|
|
@@ -302,6 +246,7 @@ accent900: text in avatar
|
|
|
302
246
|
align-items: center;
|
|
303
247
|
font: 700 22px sans-serif;
|
|
304
248
|
color: #bcbcbc;
|
|
249
|
+
z-index: -1;
|
|
305
250
|
}
|
|
306
251
|
|
|
307
252
|
.cc-messagecomposer__emojikeyboard {
|