@bcc-code/vue-bcc-chat-ui 3.0.0-alpha.7 → 3.1.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.0.0-alpha.7",
5
+ "version": "3.1.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -13,6 +13,7 @@ import { loggedIn } from "../chat/login";
13
13
  import { CometChatMessages } from "@cometchat/chat-uikit-vue";
14
14
  import { Group } from "@cometchat/chat-sdk-javascript";
15
15
  import { watchAndApplyStyle } from "../chat/styleFix";
16
+ //import { CometChat } from "@cometchat/chat-sdk-javascript";
16
17
  import {
17
18
  messageComposerConfiguration,
18
19
  messageListConfiguration,
@@ -37,8 +38,14 @@ watch([loggedIn, ()=>props.chatUid, chat.initialized], async ([_loggedIn, _chatU
37
38
  }
38
39
  }, { immediate: true });
39
40
 
40
- watch(chat.onlineStatus, async () => {
41
- await tryConnect(false);
41
+ watch(chat.onlineStatus, () => {
42
+ tryConnect(false);
43
+ });
44
+
45
+ watch(chat.onlineMode, () => {
46
+ if (chat.onlineMode.value == 'online'){
47
+ tryConnect(true);
48
+ }
42
49
  });
43
50
 
44
51
  const showChat = ref(false);
@@ -56,9 +63,15 @@ watchEffect(() => {
56
63
  }
57
64
  })
58
65
 
66
+ let _connecting = false;
59
67
  async function tryConnect(force: boolean) {
60
68
  if (chat.onlineStatus.value === "online" || force) {
61
- await connect(componentId.value);
69
+ if (!_connecting){
70
+ try {
71
+ await connect(componentId.value);
72
+ } catch { }
73
+ _connecting = false;
74
+ }
62
75
  }
63
76
  }
64
77
 
@@ -117,10 +130,23 @@ onUnmounted(async () => {
117
130
  await disconnect(componentId.value);
118
131
  });
119
132
 
133
+ // const cometChatStatus = ref('');
134
+ // function getCometChatStatus(){
135
+ // cometChatStatus.value = new Date().getTime() + CometChat.getConnectionStatus();
136
+ // }
137
+
120
138
  </script>
121
139
 
122
140
  <template>
123
141
  <div class="bcc-chat-message-list-wrapper">
142
+ <!-- <div>
143
+ <div>Connecting... <button @click="tryConnect(true)">[retry]</button></div>
144
+ <div>Online status: {{chat.onlineStatus}}</div>
145
+ <div>Online mode: {{chat.onlineMode}}</div>
146
+ <div>Connected: {{chat.connected.value}}</div>
147
+ <div>Connecting: {{chat.connecting.value}}</div>
148
+ <div>CometChat: {{cometChatStatus}} <button @click="getCometChatStatus()">[refresh]</button></div>
149
+ </div> -->
124
150
  <div v-if="showChat" class="bcc-chat-message-list">
125
151
 
126
152
  <CometChatMessages