@bcc-code/vue-bcc-chat-ui 3.2.1 → 3.3.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.2.1",
5
+ "version": "3.3.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -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";
@@ -18,6 +17,8 @@ import {
18
17
  messageListConfiguration,
19
18
  threadedMessagesConfiguration
20
19
  } from "../chat/uiKit";
20
+ import CometChatMessageListOverride from "./CometChatMessageListOverride.vue";
21
+ CometChatMessages.components!.CometChatMessageList = CometChatMessageListOverride;
21
22
 
22
23
  const props = defineProps({
23
24
  chatUid: { type: String, required: true },
@@ -37,45 +38,8 @@ watch([loggedIn, ()=> props.chatUid, chat.initialized], async ([_loggedIn, _chat
37
38
  }
38
39
  }, { immediate: true });
39
40
 
40
- watch(chat.onlineStatus, () => {
41
- tryConnect(false);
42
- });
43
-
44
- watch(chat.onlineMode, () => {
45
- if (chat.onlineMode.value == 'online'){
46
- tryConnect(true);
47
- }
48
- });
49
-
50
- const showChat = ref(false);
51
- watchEffect(() => {
52
- if (chatGroup && (chat.connected.value || chat.onlineStatus.value == 'offline')){
53
- showChat.value = true;
54
- } else {
55
- // This line is a trade-off.
56
- // With it, the entire chat will be hidden and then reloaded when a connection is being established.
57
- // The advantage is that the chat should then scroll to the latest message after reconnecting.
58
- // Without it, the chat window won't reload. New messages should still be loaded, but the chat won't scroll down.
59
- // The advantage with removing this line would be that half finished messages that were being composed when the user went offline
60
- // wouldn't be lost...
61
- showChat.value = false;
62
- }
63
- })
64
-
65
- let _connecting = false;
66
- async function tryConnect(force: boolean) {
67
- if (chat.onlineStatus.value === "online" || force) {
68
- if (!_connecting){
69
- try {
70
- await connect(componentId.value);
71
- } catch { }
72
- _connecting = false;
73
- }
74
- }
75
- }
76
-
77
41
  onBeforeMount(() => {
78
- tryConnect(true);
42
+ connect(componentId.value);
79
43
  });
80
44
 
81
45
  onMounted(() => {
@@ -141,8 +105,8 @@ onUnmounted(async () => {
141
105
  <div>Connecting: {{chat.connecting.value}}</div>
142
106
  <div>CometChat: {{cometChatStatus}} <button @click="getCometChatStatus()">[refresh]</button></div>
143
107
  </div> -->
144
- <div v-if="showChat" class="bcc-chat-message-list">
145
- <CometChatMessages
108
+ <div v-if="chatGroup" class="bcc-chat-message-list">
109
+ <CometChatMessages
146
110
  :hideMessageHeader="true"
147
111
  :disableSoundForMessages="true"
148
112
  :messageComposerConfiguration="messageComposerConfiguration"
@@ -0,0 +1,129 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ CometChatMessageList,
4
+ } from "@cometchat/chat-uikit-vue";
5
+ import chat from "../chat";
6
+
7
+ defineProps({
8
+ hideError: {},
9
+ scrollToBottomOnNewMessages: {},
10
+ errorStateView: {},
11
+ loadingStateView: {},
12
+ emptyStateView: {},
13
+ state: {},
14
+ thresholdValue: {},
15
+ errorStateText: {},
16
+ emptyStateText: {},
17
+ loadingIconURL: {},
18
+ user: {},
19
+ group: {},
20
+ disableReceipt: {},
21
+ onError: {},
22
+ disableSoundForMessages: {},
23
+ customSoundForMessages: {},
24
+ readIcon: {},
25
+ deliveredIcon: {},
26
+ sentIcon: {},
27
+ waitIcon: {},
28
+ errorIcon: {},
29
+ alignment: {},
30
+ showAvatar: {},
31
+ timestampAlignment: {},
32
+ DateSeparatorPattern: {},
33
+ templates: {},
34
+ messagesRequestBuilder: {},
35
+ newMessageIndicatorText: {},
36
+ onThreadRepliesClick: {},
37
+ headerView: {},
38
+ footerView: {},
39
+ datePattern: {},
40
+ parentMessageId: {},
41
+ avatarStyle: {},
42
+ dateSeparatorStyle: {},
43
+ messageListStyle: {},
44
+ messageInformationConfiguration: {},
45
+ reactionsConfiguration: {},
46
+ disableReactions: {},
47
+ emojiKeyboardStyle: {},
48
+ threadIndicatorIcon: {},
49
+ disableMentions: {},
50
+ textFormatters: {}
51
+ });
52
+ </script>
53
+
54
+ <template>
55
+ <CometChatMessageList v-if="chat.connected.value"
56
+ :hideError="hideError"
57
+ :disableSoundForMessages="disableSoundForMessages"
58
+ :customSoundForMessages="customSoundForMessages"
59
+ :emptyStateView="emptyStateView"
60
+ :loadingStateView="loadingStateView"
61
+ :user="user"
62
+ :group="group"
63
+ :errorStateView="errorStateView"
64
+ :disableReceipt="disableReceipt"
65
+ :readIcon="readIcon"
66
+ :deliveredIcon="deliveredIcon"
67
+ :sentIcon="sentIcon"
68
+ :waitIcon="waitIcon"
69
+ :errorIcon="errorIcon"
70
+ :alignment="alignment"
71
+ :showAvatar="showAvatar"
72
+ :datePattern="datePattern"
73
+ :timestampAlignment="timestampAlignment"
74
+ :DateSeparatorPattern="DateSeparatorPattern"
75
+ :templates="templates"
76
+ :messagesRequestBuilder="messagesRequestBuilder"
77
+ :thresholdValue="thresholdValue"
78
+ :onThreadRepliesClick="onThreadRepliesClick"
79
+ :headerView="headerView"
80
+ :footerView="footerView"
81
+ :avatarStyle="avatarStyle"
82
+ :dateSeparatorStyle="dateSeparatorStyle"
83
+ :messageListStyle="messageListStyle"
84
+ :onError="onError"
85
+ :reactionsConfiguration="reactionsConfiguration"
86
+ :disableReactions="disableReactions"
87
+ :emojiKeyboardStyle="emojiKeyboardStyle"
88
+ :threadIndicatorIcon="threadIndicatorIcon"
89
+ :disableMentions="disableMentions"
90
+ :textFormatters="textFormatters"
91
+ />
92
+ <CometChatMessageList v-else
93
+ :hideError="hideError"
94
+ :disableSoundForMessages="disableSoundForMessages"
95
+ :customSoundForMessages="customSoundForMessages"
96
+ :emptyStateView="emptyStateView"
97
+ :loadingStateView="loadingStateView"
98
+ :user="user"
99
+ :group="group"
100
+ :errorStateView="errorStateView"
101
+ :disableReceipt="disableReceipt"
102
+ :readIcon="readIcon"
103
+ :deliveredIcon="deliveredIcon"
104
+ :sentIcon="sentIcon"
105
+ :waitIcon="waitIcon"
106
+ :errorIcon="errorIcon"
107
+ :alignment="alignment"
108
+ :showAvatar="showAvatar"
109
+ :datePattern="datePattern"
110
+ :timestampAlignment="timestampAlignment"
111
+ :DateSeparatorPattern="DateSeparatorPattern"
112
+ :templates="templates"
113
+ :messagesRequestBuilder="messagesRequestBuilder"
114
+ :thresholdValue="thresholdValue"
115
+ :onThreadRepliesClick="onThreadRepliesClick"
116
+ :headerView="headerView"
117
+ :footerView="footerView"
118
+ :avatarStyle="avatarStyle"
119
+ :dateSeparatorStyle="dateSeparatorStyle"
120
+ :messageListStyle="messageListStyle"
121
+ :onError="onError"
122
+ :reactionsConfiguration="reactionsConfiguration"
123
+ :disableReactions="disableReactions"
124
+ :emojiKeyboardStyle="emojiKeyboardStyle"
125
+ :threadIndicatorIcon="threadIndicatorIcon"
126
+ :disableMentions="disableMentions"
127
+ :textFormatters="textFormatters"
128
+ />
129
+ </template>