@bcc-code/vue-bcc-chat-ui 4.4.1 → 4.4.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/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": "4.4.1",
5
+ "version": "4.4.3",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -21,6 +21,7 @@ import BccChatMessages from "./BccChatMessages.vue";
21
21
  import BccScheduledMessages from "./BccScheduledMessages.vue";
22
22
  import { getGroupMembersInfo } from "../chat/data";
23
23
  import logger from "../chat/logger";
24
+ import { onlineMode, onlineStatus } from "../offline/connectivity";
24
25
  const props = defineProps({
25
26
  chatUid: { type: String, required: true },
26
27
  senderDisplayName: { type: String, required: false },
@@ -82,43 +83,47 @@ const onMessageSend = CometChatMessageEvents.ccMessageSent.subscribe(({ message,
82
83
  watch([loggedIn, chat.onlineStatus, () => props.chatUid, chat.initialized, () => props.groupMessageGetter], async ([_loggedIn, _online, _chatUid, _initialized, _groupMessageGetter]) => {
83
84
  logger.debug("ChatMessageList watch changed", { chatUid: _chatUid, loggedIn: _loggedIn, online: _online, initialized: _initialized });
84
85
 
85
- if (_loggedIn && _chatUid && _initialized) {
86
- chatGroupNotFound.value = false;
87
- const [_, group] = await Promise.all([
88
- connect(componentId.value),
89
- chat.getGroup(props.chatUid)
90
- ])
91
- chatGroup.value = group ?? undefined;
92
- chatGroupNotFound.value = group === undefined;
93
-
94
- if (_groupMessageGetter && !chatGroup.value?.getHasJoined()) {
95
- chat.updateGetGroupMessages(_groupMessageGetter)
96
- }
86
+ try {
87
+ if (_loggedIn && _chatUid && _initialized) {
88
+ chatGroupNotFound.value = false;
89
+ const [_, group] = await Promise.all([
90
+ connect(componentId.value),
91
+ chat.getGroup(props.chatUid)
92
+ ])
93
+ chatGroup.value = group ?? undefined;
94
+ chatGroupNotFound.value = group === undefined;
95
+
96
+ if (_groupMessageGetter && !chatGroup.value?.getHasJoined()) {
97
+ chat.updateGetGroupMessages(_groupMessageGetter)
98
+ }
97
99
 
98
- if (chatGroup.value) {
100
+ if (chatGroup.value) {
99
101
 
100
- let isChannel = (chatGroup.value.getMetadata() as any).isChannel;
102
+ let isChannel = (chatGroup.value.getMetadata() as any).isChannel;
101
103
 
102
- watchAndApplyStyle(".bcc-chat-message-list-wrapper", [
103
- {
104
- selector: ".cc-messagebubble-wrapper__container",
105
- style: {
106
- "max-width": isChannel ? "95%" : "80%"
104
+ watchAndApplyStyle(".bcc-chat-message-list-wrapper", [
105
+ {
106
+ selector: ".cc-messagebubble-wrapper__container",
107
+ style: {
108
+ "max-width": isChannel ? "95%" : "80%"
109
+ }
107
110
  }
111
+ ])
112
+
113
+ if (!isChannel) {
114
+ getGroupMembersInfo(_chatUid).then((participants) => groupMembers.value = participants);
115
+ } else {
116
+ groupMembers.value = [];
108
117
  }
109
- ])
110
118
 
111
- if (!isChannel) {
112
- getGroupMembersInfo(_chatUid).then((participants) => groupMembers.value = participants);
113
- } else {
114
- groupMembers.value = [];
115
119
  }
116
120
 
121
+ await chat.clearGroupChatCount(props.chatUid);
122
+ } else if (chatGroup.value) {
123
+ chatGroup.value = undefined;
117
124
  }
118
-
119
- await chat.clearGroupChatCount(props.chatUid);
120
- } else if (chatGroup.value) {
121
- chatGroup.value = undefined;
125
+ } catch (error) {
126
+ logger.error("Error in ChatMessageList watch", { error, chatUid: _chatUid, loggedIn: _loggedIn, online: _online, initialized: _initialized });
122
127
  }
123
128
  }, { immediate: true });
124
129
 
@@ -132,6 +137,13 @@ watchEffect(() => {
132
137
 
133
138
  onMounted(() => {
134
139
  logger.debug("Mounting chat", { chatUid: props.chatUid });
140
+ setTimeout(() => {
141
+ if (!chatGroup.value && !chatGroupNotFound.value) {
142
+ logger.error("Chat not loaded after 5 seconds", { chatUid: props.chatUid, connected: chat.connected.value, loggedIn: loggedIn.value, onlineMode: onlineMode.value, onlineStatus: onlineStatus.value, initialized: chat.initialized.value });
143
+ } else {
144
+ logger.debug("Chat successfully loaded", { chatUid: props.chatUid, connected: chat.connected.value, loggedIn: loggedIn.value, onlineMode: onlineMode.value, onlineStatus: onlineStatus.value, initialized: chat.initialized.value });
145
+ }
146
+ }, 5000);
135
147
  watchAndApplyStyle(".bcc-chat-message-list-wrapper", [
136
148
  {
137
149
  selector: ".cc__text",