@bcc-code/vue-bcc-chat-ui 3.23.0 → 3.25.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.23.0",
5
+ "version": "3.25.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -33,18 +33,26 @@
33
33
  "vue": "^3.0.0"
34
34
  },
35
35
  "devDependencies": {
36
+ "@tailwindcss/aspect-ratio": "^0.4.2",
37
+ "@tailwindcss/forms": "^0.5.8",
38
+ "@tailwindcss/typography": "^0.5.15",
36
39
  "@types/dompurify": "^3.0.5",
37
40
  "@types/markdown-it": "^14.1.2",
38
41
  "@types/node": "^20.14.9",
39
42
  "@vitejs/plugin-vue": "^5.1.3",
43
+ "autoprefixer": "^10.4.20",
40
44
  "path": "^0.12.7",
45
+ "postcss": "^8.4.44",
41
46
  "sass": "^1.77.8",
47
+ "tailwindcss": "^3.4.10",
42
48
  "typescript": "^5.5.4",
43
49
  "vite": "^5.4.2",
44
50
  "vite-plugin-dts": "^4.1.0",
45
51
  "vue": "^3.4.38"
46
52
  },
47
53
  "dependencies": {
54
+ "@bcc-code/design-library-vue": "^2.6.3",
55
+ "@bcc-code/icons-vue": "^1.4.0",
48
56
  "@cometchat/chat-sdk-javascript": "4.0.10",
49
57
  "@cometchat/chat-uikit-vue": "4.3.17",
50
58
  "@cometchat/uikit-elements": "4.3.17",
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import {
3
+ PropType,
3
4
  Ref,
4
5
  onBeforeMount,
5
6
  onBeforeUnmount,
@@ -8,28 +9,23 @@ import {
8
9
  provide,
9
10
  ref,
10
11
  watch,
11
- watchEffect,
12
12
  } from "vue";
13
13
  import chat from "../chat";
14
14
  import { connect, disconnect } from "../chat/connection";
15
15
  import { loggedIn } from "../chat/login";
16
- import { CometChatMessages } from "../chat/cometChatPatches";
17
16
  import { Group } from "@cometchat/chat-sdk-javascript";
18
17
  import { watchAndApplyStyle } from "../chat/styleFix";
19
- import {
20
- getMessageComposerConfiguration,
21
- getMessageListConfiguration,
22
- getThreadedMessagesConfiguration
23
- } from "../chat/uiKit";
24
18
  import { ChatInstance } from "../chat/types";
25
19
  import { CometChatMessageEvents, MessageStatus } from "@cometchat/uikit-resources";
26
- import BccAttachmentBox from "./BccAttachmentBox.vue";
27
- import BccChatSendButton from "./BccChatSendButton.vue";
28
-
20
+ import BccChatMessages from "./BccChatMessages.vue";
21
+ import BccScheduledMessages from "./BccScheduledMessages.vue";
29
22
  const props = defineProps({
30
23
  chatUid: { type: String, required: true },
31
24
  senderDisplayName: { type: String, required: false },
32
- });
25
+ groupMessageGetter: {
26
+ type: Function as PropType<(guid: string, query: string) => Promise<any>>,
27
+ required: false,
28
+ },});
33
29
 
34
30
  const componentId = ref(
35
31
  `component-${Math.random().toString(36).substring(2, 11)}`
@@ -39,13 +35,11 @@ const chatGroup = ref<Group>();
39
35
  const chatInstance: Ref<ChatInstance> = ref({
40
36
  componentId: componentId,
41
37
  replyToMessage: null,
42
- captionedAttachment: null
38
+ captionedAttachment: null,
39
+ showScheduledMessagesChat: false,
40
+ showAlert: false
43
41
  });
44
42
 
45
- const messageComposerConfiguration = getMessageComposerConfiguration(chatInstance);
46
- const messageListConfiguration = getMessageListConfiguration(chatInstance, chatGroup);
47
- const threadedMessagesConfiguration = getThreadedMessagesConfiguration(chatGroup);
48
- threadedMessagesConfiguration.messageComposerConfiguration = messageComposerConfiguration.value;
49
43
  provide("chatInstance", chatInstance);
50
44
 
51
45
  const onMessageSend = CometChatMessageEvents.ccMessageSent.subscribe(({ message, status }) => {
@@ -66,37 +60,14 @@ const onMessageSend = CometChatMessageEvents.ccMessageSent.subscribe(({ message,
66
60
  }
67
61
  });
68
62
 
69
- watchEffect(() => {
70
- if (chatInstance.value.captionedAttachment) {
71
- messageComposerConfiguration.value.headerView = {
72
- componentName: BccAttachmentBox,
73
- props: {
74
- captionedAttachment: chatInstance.value.captionedAttachment
75
- }
76
- }
77
-
78
- messageComposerConfiguration.value.sendButtonView = {
79
- componentName: BccChatSendButton
80
- };
81
- } else {
82
- messageComposerConfiguration.value.sendButtonView = undefined;
83
- if (chatInstance.value.replyToMessage) {
84
- messageComposerConfiguration.value.headerView = {
85
- componentName: "bcc-reply-box",
86
- props: {
87
- replyToMessage: chatInstance.value.replyToMessage,
88
- }
89
- };
90
- } else {
91
- messageComposerConfiguration.value.headerView = undefined;
92
- }
93
- }
94
- });
95
-
96
- watch([loggedIn, () => props.chatUid, chat.initialized], async ([_loggedIn, _chatUid, _initialized]) => {
63
+ watch([loggedIn, () => props.chatUid, chat.initialized, () => props.groupMessageGetter], async ([_loggedIn, _chatUid, _initialized, _groupMessageGetter]) => {
97
64
  if (_loggedIn && _chatUid && _initialized) {
98
65
  chatGroup.value = (await chat.getGroup(props.chatUid)) ?? undefined;
99
66
 
67
+ if (_groupMessageGetter && !chatGroup.value?.getHasJoined()) {
68
+ chat.updateGetGroupMessages(_groupMessageGetter)
69
+ }
70
+
100
71
  if (chatGroup.value) {
101
72
  watchAndApplyStyle(".bcc-chat-message-list-wrapper", [
102
73
  {
@@ -118,6 +89,7 @@ onBeforeMount(() => {
118
89
  connect(componentId.value);
119
90
  });
120
91
 
92
+
121
93
  onMounted(() => {
122
94
  watchAndApplyStyle(".bcc-chat-message-list-wrapper", [
123
95
  {
@@ -147,16 +119,11 @@ onUnmounted(async () => {
147
119
  await disconnect(componentId.value);
148
120
  });
149
121
 
150
- function isChannel(): boolean {
151
- return (chatGroup.value?.getMetadata() as any)?.isChannel;
152
- }
153
-
154
- function isParticipant(): boolean {
155
- //if not part of the group return true anyway since getScope dosen't exist when not in the group
156
- if (!chatGroup.value?.getHasJoined()) {
157
- return true
158
- }
159
- return chatGroup.value?.getScope() == "participant";
122
+ function closeScheduledMessage() {
123
+ chatInstance.value.captionedAttachment = null
124
+ chatInstance.value.replyToMessage = null
125
+ chatInstance.value.scheduledMessageChat = undefined
126
+ chatInstance.value.showScheduledMessagesChat = false;
160
127
  }
161
128
 
162
129
  </script>
@@ -171,19 +138,11 @@ function isParticipant(): boolean {
171
138
  <div>Connecting: {{chat.connecting.value}}</div>
172
139
  <div>CometChat: {{cometChatStatus}} <button @click="getCometChatStatus()">[refresh]</button></div>
173
140
  </div> -->
174
- <div v-if="chatGroup" class="bcc-chat-message-list">
175
- <CometChatMessages :hideMessageHeader="true" :disableSoundForMessages="true"
176
- :messageComposerConfiguration="messageComposerConfiguration"
177
- :messageListConfiguration="messageListConfiguration"
178
- :threadedMessagesConfiguration="threadedMessagesConfiguration"
179
- :hideMessageComposer="isParticipant() && isChannel()" :hideDetails="true" :group="chatGroup" />
180
-
181
- <div v-if="chat.onlineStatus.value === 'offline' || !chat.connected.value"
182
- class="bcc-chat-message-composer-offline">
183
- <span v-if="chat.onlineStatus.value === 'offline'">Waiting for network...</span>
184
- <span v-else>Connecting...</span>
185
- </div>
186
- </div>
141
+ <BccChatMessages v-if="chatGroup && !chatInstance.showScheduledMessagesChat" :chatGroup="chatGroup"
142
+ :chatUid="props.chatUid"></BccChatMessages>
143
+ <BccScheduledMessages v-else-if="chatGroup && chatInstance.showScheduledMessagesChat"
144
+ class="bcc-scheduled-message-list" :chatGroup="chatInstance.scheduledMessageChat!"
145
+ :originalChatUid="props.chatUid" @close="closeScheduledMessage()"></BccScheduledMessages>
187
146
  <div v-else-if="!chat.connected.value" class="bcc-chat-message-list-offline">
188
147
  <span>Connecting...</span>
189
148
  </div>
@@ -198,18 +157,68 @@ function isParticipant(): boolean {
198
157
 
199
158
  <style lang="scss">
200
159
  body {
201
- background: #fff;
202
- color: #000;
160
+ background: #fff;
161
+ color: #000;
203
162
 
204
- @media (prefers-color-scheme: dark) {
205
- background: #000;
206
- color: #fff;
207
- }
163
+ @media (prefers-color-scheme: dark) {
164
+ background: #000;
165
+ color: #fff;
166
+ }
167
+ }
168
+
169
+ .modal {
170
+ background-color: hsl(230, 25%, 15%);
171
+ color: white;
172
+
173
+ .bcc-modal-content {
174
+ display: flex;
175
+ justify-content: space-between;
176
+ width: 100%;
177
+
178
+ .input {
179
+ background-color: #758abc;
180
+ border-radius: 5px;
181
+ color: white;
182
+ height: 40px;
183
+ padding: 5px;
184
+ width: 45%;
185
+ }
186
+
187
+ .at {
188
+ width: 10%;
189
+ text-align: center;
190
+ margin-top: 7px;
191
+ }
192
+ }
193
+
194
+ .bcc-modal-footer {
195
+ background-color: hsl(230, 25%, 15%);
196
+
197
+ .bcc-modal-actions {
198
+ background-color: hsl(230, 25%, 15%);
199
+ display: flex;
200
+ width: 100%;
201
+ justify-content: space-between;
202
+
203
+ .bcc-modal-secondary-action,
204
+ .bcc-modal-primary-action {
205
+ width: 100%;
206
+ background-color: hsl(230, 25%, 15%);
207
+
208
+ button {
209
+ background-color: #2fb5e9d1 !important;
210
+ width: 100%;
211
+ border-radius: 5px;
212
+ margin-top: -10px;
213
+ }
214
+ }
215
+ }
216
+ }
208
217
  }
209
218
 
210
219
  .bcc-chat-message-list-wrapper {
211
- position: relative;
212
- height: 100%;
220
+ position: relative;
221
+ height: 100%;
213
222
  }
214
223
 
215
224
  /*
@@ -224,148 +233,148 @@ accent900: text in avatar
224
233
  */
225
234
 
226
235
  .bcc-chat-message-list {
227
- height: 100%;
228
- --cc__primary: #cfeac8;
229
- --cc__background: #f3faf7;
230
- --cc__secondary: white;
231
- --cc__accent: #004e48;
232
- --cc__accent50: rgba(62, 142, 117, 0.04);
233
- --cc__accent100: #ffffff;
234
- --cc__accent200: rgba(62, 142, 117, 0.15);
235
- --cc__accent300: rgba(62, 142, 117, 0.24);
236
- --cc__accent400: rgba(62, 142, 117, 0.33);
237
- --cc__accent500: rgba(62, 142, 117, 0.46);
238
- --cc__accent600: #004e48;
239
- --cc__accent700: #254a40;
240
- --cc__accent800: rgba(62, 142, 117, 0.82);
241
- --cc__accent900: #f3faf7;
242
- --cc__text-color: #000;
243
- --cc__link-color: #57639e;
244
-
245
- @media (prefers-color-scheme: dark) {
246
- --cc__primary: #57639e;
247
- --cc__background: hsl(230, 25%, 15%);
248
- --cc__secondary: #111827;
249
- --cc__accent: #6274ae;
250
- --cc__accent50: rgba(98, 116, 174, 0.24);
251
- --cc__accent100: linear-gradient(45deg, #05070b 0%, #0c111c 100%);
252
- --cc__accent200: rgba(98, 116, 174, 0.35);
253
- --cc__accent300: rgba(98, 116, 174, 0.44);
254
- --cc__accent400: rgba(98, 116, 174, 0.53);
255
- --cc__accent500: rgba(98, 116, 174, 0.66);
256
- --cc__accent600: #758abc;
257
- --cc__accent700: #6274ae;
258
- --cc__accent800: rgba(98, 116, 174, 0.92);
236
+ height: 100%;
237
+ --cc__primary: #cfeac8;
238
+ --cc__background: #f3faf7;
239
+ --cc__secondary: white;
240
+ --cc__accent: #004e48;
241
+ --cc__accent50: rgba(62, 142, 117, 0.04);
242
+ --cc__accent100: #ffffff;
243
+ --cc__accent200: rgba(62, 142, 117, 0.15);
244
+ --cc__accent300: rgba(62, 142, 117, 0.24);
245
+ --cc__accent400: rgba(62, 142, 117, 0.33);
246
+ --cc__accent500: rgba(62, 142, 117, 0.46);
247
+ --cc__accent600: #004e48;
248
+ --cc__accent700: #254a40;
249
+ --cc__accent800: rgba(62, 142, 117, 0.82);
259
250
  --cc__accent900: #f3faf7;
260
- --cc__text-color: #fff;
261
- --cc__link-color: #cfeac8;
262
- }
251
+ --cc__text-color: #000;
252
+ --cc__link-color: #57639e;
253
+
254
+ @media (prefers-color-scheme: dark) {
255
+ --cc__primary: #57639e;
256
+ --cc__background: hsl(230, 25%, 15%);
257
+ --cc__secondary: #111827;
258
+ --cc__accent: #6274ae;
259
+ --cc__accent50: rgba(98, 116, 174, 0.24);
260
+ --cc__accent100: linear-gradient(45deg, #05070b 0%, #0c111c 100%);
261
+ --cc__accent200: rgba(98, 116, 174, 0.35);
262
+ --cc__accent300: rgba(98, 116, 174, 0.44);
263
+ --cc__accent400: rgba(98, 116, 174, 0.53);
264
+ --cc__accent500: rgba(98, 116, 174, 0.66);
265
+ --cc__accent600: #758abc;
266
+ --cc__accent700: #6274ae;
267
+ --cc__accent800: rgba(98, 116, 174, 0.92);
268
+ --cc__accent900: #f3faf7;
269
+ --cc__text-color: #fff;
270
+ --cc__link-color: #cfeac8;
271
+ }
263
272
 
264
- /* 1. Wrapper for Messages component */
265
- .cc-messages-wrapper {
273
+ /* 1. Wrapper for Messages component */
274
+ .cc-messages-wrapper {
266
275
 
267
- /* 1.1 Messages component */
268
- .cc-messages-wrapper__messages {
276
+ /* 1.1 Messages component */
277
+ .cc-messages-wrapper__messages {
269
278
 
270
- /* 1.1.1 Wrapper for Messages List */
271
- .cc-messages-wrapper__messages-list {
272
- height: 100%;
273
- }
279
+ /* 1.1.1 Wrapper for Messages List */
280
+ .cc-messages-wrapper__messages-list {
281
+ height: 100%;
282
+ }
274
283
 
275
- /* 1.1.2 Wrapper for Messages Composer */
276
- .cc-messagecomposer-wrapper {
277
- //padding: 0; //Use to remove side padding on composer
278
- }
284
+ /* 1.1.2 Wrapper for Messages Composer */
285
+ .cc-messagecomposer-wrapper {
286
+ //padding: 0; //Use to remove side padding on composer
287
+ }
279
288
 
280
- /* 1.1.3 Wrapper for Messages Composer Header View */
281
- .cc-messagecomposer-wrapper__headerview {
282
- max-height: 100%;
283
- margin-bottom: 5px;
284
- }
285
- }
289
+ /* 1.1.3 Wrapper for Messages Composer Header View */
290
+ .cc-messagecomposer-wrapper__headerview {
291
+ max-height: 100%;
292
+ margin-bottom: 5px;
293
+ }
294
+ }
286
295
 
287
- .cc-messagebubble-wrapper__content {
288
- max-width: 100%;
289
- }
296
+ .cc-messagebubble-wrapper__content {
297
+ max-width: 100%;
298
+ }
290
299
 
291
- .cc-messagebubble-wrapper__content > div > .bcc-message-wrapper.has-text.has-image + div > div > div:not([class]) {
292
- justify-content: flex-end !important;
293
- padding: 0px 8px 8px !important;
294
- margin-top: -5px !important;
295
- height: unset !important;
296
- border-radius: unset !important;
297
- line-height: unset !important;
298
- position: unset !important;
299
- margin-right: unset !important;
300
- background: unset !important;
300
+ .cc-messagebubble-wrapper__content>div>.bcc-message-wrapper.has-text.has-image+div>div>div:not([class]) {
301
+ justify-content: flex-end !important;
302
+ padding: 0px 8px 8px !important;
303
+ margin-top: -5px !important;
304
+ height: unset !important;
305
+ border-radius: unset !important;
306
+ line-height: unset !important;
307
+ position: unset !important;
308
+ margin-right: unset !important;
309
+ background: unset !important;
310
+ }
301
311
  }
302
- }
303
312
 
304
- .cc-messagebubble-wrapper__container {
305
- max-width: 80%;
306
- }
313
+ .cc-messagebubble-wrapper__container {
314
+ max-width: 80%;
315
+ }
307
316
 
308
- .cc-messagebubble-wrapper__messageoptions {
309
- border-radius: 8px;
317
+ .cc-messagebubble-wrapper__messageoptions {
318
+ border-radius: 8px;
310
319
 
311
- .cc-context-menu__top-menu {
312
- border: 1px var(--cc__secondary) solid !important;
320
+ .cc-context-menu__top-menu {
321
+ border: 1px var(--cc__secondary) solid !important;
322
+ }
313
323
  }
314
- }
315
324
 
316
- /* 2. Message for Messages Composer when offline */
317
- .bcc-chat-message-composer-offline {
318
- position: relative;
319
- top: -96px;
320
- height: 96px;
321
- width: 100%;
322
- backdrop-filter: blur(4px);
323
- color: var(--cc__text-color);
324
- font: 700 1rem sans-serif;
325
-
326
- /* 2.1 Text of Messages Composer offline view */
327
- span {
328
- width: 100%;
329
- height: 100%;
330
- display: flex;
331
- justify-content: center;
332
- align-items: center;
333
- border-radius: 8px 8px 0 0;
325
+ /* 2. Message for Messages Composer when offline */
326
+ .bcc-chat-message-composer-offline {
327
+ position: relative;
328
+ top: -96px;
329
+ height: 96px;
330
+ width: 100%;
331
+ backdrop-filter: blur(4px);
332
+ color: var(--cc__text-color);
333
+ font: 700 1rem sans-serif;
334
+
335
+ /* 2.1 Text of Messages Composer offline view */
336
+ span {
337
+ width: 100%;
338
+ height: 100%;
339
+ display: flex;
340
+ justify-content: center;
341
+ align-items: center;
342
+ border-radius: 8px 8px 0 0;
343
+ }
334
344
  }
335
- }
336
345
  }
337
346
 
338
347
  .bcc-chat-message-list-offline {
339
- position: absolute;
340
- top: 0;
341
- bottom: 0;
342
- left: 0;
343
- right: 0;
344
- display: flex;
345
- justify-content: center;
346
- align-items: center;
347
- font: 700 22px sans-serif;
348
- color: #bcbcbc;
348
+ position: absolute;
349
+ top: 0;
350
+ bottom: 0;
351
+ left: 0;
352
+ right: 0;
353
+ display: flex;
354
+ justify-content: center;
355
+ align-items: center;
356
+ font: 700 22px sans-serif;
357
+ color: #bcbcbc;
349
358
  }
350
359
 
351
360
  .cc-messagecomposer__emojikeyboard {
352
- display: none;
361
+ display: none;
353
362
  }
354
363
 
355
364
  // Hide emoji keyboard
356
365
  .cc-messagecomposer__emojikeyboard {
357
- display: none;
366
+ display: none;
358
367
  }
359
368
 
360
369
  .cc-threadedmessages-wrapper__bubbleview::-webkit-scrollbar,
361
370
  .cc__message-list::-webkit-scrollbar {
362
- background: transparent;
363
- width: 8px;
371
+ background: transparent;
372
+ width: 8px;
364
373
  }
365
374
 
366
375
  .cc-threadedmessages-wrapper__bubbleview::-webkit-scrollbar-thumb,
367
376
  .cc__message-list::-webkit-scrollbar-thumb {
368
- background: rgb(232, 229, 229);
369
- border-radius: 8px;
377
+ background: rgb(232, 229, 229);
378
+ border-radius: 8px;
370
379
  }
371
- </style>
380
+ </style>