@bcc-code/vue-bcc-chat-ui 3.27.0 → 3.30.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.27.0",
5
+ "version": "3.30.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -9,7 +9,6 @@ import {
9
9
  provide,
10
10
  ref,
11
11
  watch,
12
- watchEffect,
13
12
  } from "vue";
14
13
  import chat from "../chat";
15
14
  import { connect, disconnect } from "../chat/connection";
@@ -26,7 +25,8 @@ const props = defineProps({
26
25
  groupMessageGetter: {
27
26
  type: Function as PropType<(guid: string, query: string) => Promise<any>>,
28
27
  required: false,
29
- },});
28
+ },
29
+ });
30
30
 
31
31
  const componentId = ref(
32
32
  `component-${Math.random().toString(36).substring(2, 11)}`
@@ -40,7 +40,8 @@ const chatInstance: Ref<ChatInstance> = ref({
40
40
  decoyAttachment: null,
41
41
  showScheduledMessagesChat: false,
42
42
  showAlert: false,
43
- userInput: null
43
+ userInput: null,
44
+ rescheduleInfo: null
44
45
  });
45
46
 
46
47
  provide("chatInstance", chatInstance);
@@ -72,17 +73,17 @@ watch([loggedIn, () => props.chatUid, chat.initialized, () => props.groupMessage
72
73
  }
73
74
 
74
75
  if (chatGroup.value) {
75
- watchAndApplyStyle(".bcc-chat-message-list-wrapper", [
76
- {
77
- selector: ".cc-messagebubble-wrapper__container",
78
- style: {
79
- "max-width": (chatGroup.value.getMetadata() as any).isChannel ? "95%": "80%"
76
+ watchAndApplyStyle(".bcc-chat-message-list-wrapper", [
77
+ {
78
+ selector: ".cc-messagebubble-wrapper__container",
79
+ style: {
80
+ "max-width": (chatGroup.value.getMetadata() as any).isChannel ? "95%" : "80%"
81
+ }
80
82
  }
81
- }
82
- ])
83
- }
83
+ ])
84
+ }
84
85
 
85
- await chat.clearGroupChatCount(props.chatUid);
86
+ await chat.clearGroupChatCount(props.chatUid);
86
87
  } else if (chatGroup.value) {
87
88
  chatGroup.value = undefined;
88
89
  }
@@ -160,18 +161,18 @@ function closeScheduledMessage() {
160
161
 
161
162
  <style lang="scss">
162
163
  body {
163
- background: #fff;
164
- color: #000;
164
+ background: #fff;
165
+ color: #000;
165
166
 
166
- @media (prefers-color-scheme: dark) {
167
- background: #000;
168
- color: #fff;
169
- }
167
+ @media (prefers-color-scheme: dark) {
168
+ background: #000;
169
+ color: #fff;
170
+ }
170
171
  }
171
172
 
172
173
  .bcc-chat-message-list-wrapper {
173
- position: relative;
174
- height: 100%;
174
+ position: relative;
175
+ height: 100%;
175
176
  }
176
177
 
177
178
  /*
@@ -186,148 +187,150 @@ accent900: text in avatar
186
187
  */
187
188
 
188
189
  .bcc-chat-message-list {
189
- height: 100%;
190
- --cc__primary: #cfeac8;
191
- --cc__background: #f3faf7;
192
- --cc__secondary: white;
193
- --cc__accent: #004e48;
194
- --cc__accent50: rgba(62, 142, 117, 0.04);
195
- --cc__accent100: #ffffff;
196
- --cc__accent200: rgba(62, 142, 117, 0.15);
197
- --cc__accent300: rgba(62, 142, 117, 0.24);
198
- --cc__accent400: rgba(62, 142, 117, 0.33);
199
- --cc__accent500: rgba(62, 142, 117, 0.46);
200
- --cc__accent600: #004e48;
201
- --cc__accent700: #254a40;
202
- --cc__accent800: rgba(62, 142, 117, 0.82);
190
+ height: 100%;
191
+ --cc__primary: #cfeac8;
192
+ --cc__primary150: #004e48;
193
+ --cc__background: #f3faf7;
194
+ --cc__secondary: white;
195
+ --cc__accent: #004e48;
196
+ --cc__accent50: rgba(62, 142, 117, 0.04);
197
+ --cc__accent100: #ffffff;
198
+ --cc__accent200: rgba(62, 142, 117, 0.15);
199
+ --cc__accent300: rgba(62, 142, 117, 0.24);
200
+ --cc__accent400: rgba(62, 142, 117, 0.33);
201
+ --cc__accent500: rgba(62, 142, 117, 0.46);
202
+ --cc__accent600: #004e48;
203
+ --cc__accent700: #254a40;
204
+ --cc__accent800: rgba(62, 142, 117, 0.82);
205
+ --cc__accent900: #f3faf7;
206
+ --cc__text-color: #000;
207
+ --cc__link-color: #57639e;
208
+
209
+ @media (prefers-color-scheme: dark) {
210
+ --cc__primary: #57639e;
211
+ --cc__primary150: #57639e;
212
+ --cc__background: hsl(230, 25%, 15%);
213
+ --cc__secondary: #111827;
214
+ --cc__accent: #6274ae;
215
+ --cc__accent50: rgba(98, 116, 174, 0.24);
216
+ --cc__accent100: linear-gradient(45deg, #05070b 0%, #0c111c 100%);
217
+ --cc__accent200: rgba(98, 116, 174, 0.35);
218
+ --cc__accent300: rgba(98, 116, 174, 0.44);
219
+ --cc__accent400: rgba(98, 116, 174, 0.53);
220
+ --cc__accent500: rgba(98, 116, 174, 0.66);
221
+ --cc__accent600: #758abc;
222
+ --cc__accent700: #6274ae;
223
+ --cc__accent800: rgba(98, 116, 174, 0.92);
203
224
  --cc__accent900: #f3faf7;
204
- --cc__text-color: #000;
205
- --cc__link-color: #57639e;
206
-
207
- @media (prefers-color-scheme: dark) {
208
- --cc__primary: #57639e;
209
- --cc__background: hsl(230, 25%, 15%);
210
- --cc__secondary: #111827;
211
- --cc__accent: #6274ae;
212
- --cc__accent50: rgba(98, 116, 174, 0.24);
213
- --cc__accent100: linear-gradient(45deg, #05070b 0%, #0c111c 100%);
214
- --cc__accent200: rgba(98, 116, 174, 0.35);
215
- --cc__accent300: rgba(98, 116, 174, 0.44);
216
- --cc__accent400: rgba(98, 116, 174, 0.53);
217
- --cc__accent500: rgba(98, 116, 174, 0.66);
218
- --cc__accent600: #758abc;
219
- --cc__accent700: #6274ae;
220
- --cc__accent800: rgba(98, 116, 174, 0.92);
221
- --cc__accent900: #f3faf7;
222
- --cc__text-color: #fff;
223
- --cc__link-color: #cfeac8;
224
- }
225
-
226
- /* 1. Wrapper for Messages component */
227
- .cc-messages-wrapper {
225
+ --cc__text-color: #fff;
226
+ --cc__link-color: #cfeac8;
227
+ }
228
228
 
229
- /* 1.1 Messages component */
230
- .cc-messages-wrapper__messages {
229
+ /* 1. Wrapper for Messages component */
230
+ .cc-messages-wrapper {
231
231
 
232
- /* 1.1.1 Wrapper for Messages List */
233
- .cc-messages-wrapper__messages-list {
234
- height: 100%;
235
- }
232
+ /* 1.1 Messages component */
233
+ .cc-messages-wrapper__messages {
236
234
 
237
- /* 1.1.2 Wrapper for Messages Composer */
238
- .cc-messagecomposer-wrapper {
239
- //padding: 0; //Use to remove side padding on composer
240
- }
235
+ /* 1.1.1 Wrapper for Messages List */
236
+ .cc-messages-wrapper__messages-list {
237
+ height: 100%;
238
+ }
241
239
 
242
- /* 1.1.3 Wrapper for Messages Composer Header View */
243
- .cc-messagecomposer-wrapper__headerview {
244
- max-height: 100%;
245
- margin-bottom: 5px;
246
- }
247
- }
240
+ /* 1.1.2 Wrapper for Messages Composer */
241
+ .cc-messagecomposer-wrapper {
242
+ //padding: 0; //Use to remove side padding on composer
243
+ }
248
244
 
249
- .cc-messagebubble-wrapper__content {
250
- max-width: 100%;
251
- }
245
+ /* 1.1.3 Wrapper for Messages Composer Header View */
246
+ .cc-messagecomposer-wrapper__headerview {
247
+ max-height: 100%;
248
+ margin-bottom: 5px;
249
+ }
250
+ }
252
251
 
253
- .cc-messagebubble-wrapper__content>div>.bcc-message-wrapper.has-text.has-image+div>div>div:not([class]) {
254
- justify-content: flex-end !important;
255
- padding: 0px 8px 8px !important;
256
- margin-top: -5px !important;
257
- height: unset !important;
258
- border-radius: unset !important;
259
- line-height: unset !important;
260
- position: unset !important;
261
- margin-right: unset !important;
262
- background: unset !important;
263
- }
252
+ .cc-messagebubble-wrapper__content {
253
+ max-width: 100%;
264
254
  }
265
255
 
266
- .cc-messagebubble-wrapper__container {
267
- max-width: 80%;
256
+ .cc-messagebubble-wrapper__content>div>.bcc-message-wrapper.has-text.has-image+div>div>div:not([class]) {
257
+ justify-content: flex-end !important;
258
+ padding: 0px 8px 8px !important;
259
+ margin-top: -5px !important;
260
+ height: unset !important;
261
+ border-radius: unset !important;
262
+ line-height: unset !important;
263
+ position: unset !important;
264
+ margin-right: unset !important;
265
+ background: unset !important;
268
266
  }
267
+ }
269
268
 
270
- .cc-messagebubble-wrapper__messageoptions {
271
- border-radius: 8px;
269
+ .cc-messagebubble-wrapper__container {
270
+ max-width: 80%;
271
+ }
272
272
 
273
- .cc-context-menu__top-menu {
274
- border: 1px var(--cc__secondary) solid !important;
275
- }
273
+ .cc-messagebubble-wrapper__messageoptions {
274
+ border-radius: 8px;
275
+
276
+ .cc-context-menu__top-menu {
277
+ border: 1px var(--cc__secondary) solid !important;
276
278
  }
279
+ }
277
280
 
278
- /* 2. Message for Messages Composer when offline */
279
- .bcc-chat-message-composer-offline {
280
- position: relative;
281
- top: -96px;
282
- height: 96px;
283
- width: 100%;
284
- backdrop-filter: blur(4px);
285
- color: var(--cc__text-color);
286
- font: 700 1rem sans-serif;
287
-
288
- /* 2.1 Text of Messages Composer offline view */
289
- span {
290
- width: 100%;
291
- height: 100%;
292
- display: flex;
293
- justify-content: center;
294
- align-items: center;
295
- border-radius: 8px 8px 0 0;
296
- }
281
+ /* 2. Message for Messages Composer when offline */
282
+ .bcc-chat-message-composer-offline {
283
+ position: relative;
284
+ top: -96px;
285
+ height: 96px;
286
+ width: 100%;
287
+ backdrop-filter: blur(4px);
288
+ color: var(--cc__text-color);
289
+ font: 700 1rem sans-serif;
290
+
291
+ /* 2.1 Text of Messages Composer offline view */
292
+ span {
293
+ width: 100%;
294
+ height: 100%;
295
+ display: flex;
296
+ justify-content: center;
297
+ align-items: center;
298
+ border-radius: 8px 8px 0 0;
297
299
  }
300
+ }
298
301
  }
299
302
 
300
303
  .bcc-chat-message-list-offline {
301
- position: absolute;
302
- top: 0;
303
- bottom: 0;
304
- left: 0;
305
- right: 0;
306
- display: flex;
307
- justify-content: center;
308
- align-items: center;
309
- font: 700 22px sans-serif;
310
- color: #bcbcbc;
304
+ position: absolute;
305
+ top: 0;
306
+ bottom: 0;
307
+ left: 0;
308
+ right: 0;
309
+ display: flex;
310
+ justify-content: center;
311
+ align-items: center;
312
+ font: 700 22px sans-serif;
313
+ color: #bcbcbc;
311
314
  }
312
315
 
313
316
  .cc-messagecomposer__emojikeyboard {
314
- display: none;
317
+ display: none;
315
318
  }
316
319
 
317
320
  // Hide emoji keyboard
318
321
  .cc-messagecomposer__emojikeyboard {
319
- display: none;
322
+ display: none;
320
323
  }
321
324
 
322
325
  .cc-threadedmessages-wrapper__bubbleview::-webkit-scrollbar,
323
326
  .cc__message-list::-webkit-scrollbar {
324
- background: transparent;
325
- width: 8px;
327
+ background: transparent;
328
+ width: 8px;
326
329
  }
327
330
 
328
331
  .cc-threadedmessages-wrapper__bubbleview::-webkit-scrollbar-thumb,
329
332
  .cc__message-list::-webkit-scrollbar-thumb {
330
- background: rgb(232, 229, 229);
331
- border-radius: 8px;
333
+ background: rgb(232, 229, 229);
334
+ border-radius: 8px;
332
335
  }
333
336
  </style>
@@ -11,7 +11,7 @@ const sendButtonStyle = {
11
11
  width: "24px",
12
12
  border: "none",
13
13
  borderRadius: "0",
14
- buttonIconTint: "var(--cc__accent500, rgba(98, 116, 174, 0.66))",
14
+ buttonIconTint: "var(--cc__primary150, #3F4669)",
15
15
  background: "transparent"
16
16
  }
17
17
 
@@ -56,7 +56,7 @@ async function redirectToScheduledMessagesChat() {
56
56
  width: 24px;
57
57
  border: none;
58
58
  border-radius: 0;
59
- color: var(--cc__accent500, rgba(98, 116, 174, 0.66));
59
+ color: var(--cc__primary150, #3F4669);
60
60
  background: transparent;
61
61
  cursor: pointer;
62
62
  margin-right: -10px;
@@ -1,26 +1,8 @@
1
- <template>
2
- <BccModal class="modal" :title=title :open="true" @close="close()" :closeButton="true">
3
- <div class="flex flex-col w-full">
4
- <div class="flex flex-row w-full justify-between">
5
- <input class="input w-[45%]" type="date" v-model="dateInput" required>
6
- <p class="at w-[10%]">at</p>
7
- <input class="input w-[45%]" type="time" v-model="timeInput" required>
8
- </div>
9
- <BccFormMessage class="text-center mt-2 mb-0 text-red-500" v-if="!isDateInFuture" state="error">{{
10
- localize("ERROR_DATE_IN_FUTURE") }}</BccFormMessage>
11
- </div>
12
-
13
- <template #primaryAction>
14
- <BccButton class="button" :disabled="messageSent" @click="scheduleMessage()"> {{
15
- localize("SCHEDULE_MESSAGE") }}</BccButton>
16
- </template>
17
- </BccModal>
18
- </template>
19
-
20
1
  <script lang="ts" setup>
21
2
  import { BccButton, BccFormMessage, BccModal } from '@bcc-code/design-library-vue';
22
3
  import { localize } from '@cometchat/uikit-resources';
23
4
  import { computed, onMounted, ref } from 'vue';
5
+ import "../style.css";
24
6
 
25
7
  const emit = defineEmits(['close', 'send']);
26
8
 
@@ -61,9 +43,29 @@ function scheduleMessage() {
61
43
  }
62
44
  </script>
63
45
 
46
+ <template>
47
+ <BccModal class="modal" :title=title :open="true" @close="close()" :closeButton="true">
48
+ <div class="flex flex-col w-full">
49
+ <div class="flex flex-row w-full justify-between">
50
+ <input class="input" type="date" v-model="dateInput" required>
51
+ <p class="at">at</p>
52
+ <input class="input" type="time" v-model="timeInput" required>
53
+ </div>
54
+ <BccFormMessage class="text-center mt-2 mb-0 text-red-500" v-if="!isDateInFuture" state="error">{{
55
+ localize("ERROR_DATE_IN_FUTURE") }}</BccFormMessage>
56
+ </div>
57
+
58
+ <template #primaryAction>
59
+ <BccButton class="button" :disabled="messageSent" @click="scheduleMessage()"> {{
60
+ localize("SCHEDULE_MESSAGE") }}</BccButton>
61
+ </template>
62
+ </BccModal>
63
+ </template>
64
+
64
65
  <style lang="scss">
65
66
  :root {
66
67
  --cc__primary: #cfeac8;
68
+ --cc__primary150: #004e48;
67
69
  --cc__background: #f3faf7;
68
70
  --cc__secondary: white;
69
71
  --cc__accent: #004e48;
@@ -82,6 +84,7 @@ function scheduleMessage() {
82
84
 
83
85
  @media (prefers-color-scheme: dark) {
84
86
  --cc__primary: #57639e;
87
+ --cc__primary150: #57639e;
85
88
  --cc__background: hsl(230, 25%, 15%);
86
89
  --cc__secondary: #111827;
87
90
  --cc__accent: #6274ae;
@@ -101,31 +104,24 @@ function scheduleMessage() {
101
104
  }
102
105
 
103
106
  .modal {
104
- position: fixed;
105
107
  width: 90%;
106
- top: 50%;
107
- left: 50%;
108
- transform: translate(-50%, -50%);
108
+ margin-left: 5%;
109
+ margin-bottom: 40%;
109
110
  background-color: var(--cc__background);
110
111
  color: var(--cc__text-color);
111
112
  }
112
113
 
113
- .bcc-modal-content {
114
- display: flex;
115
- justify-content: space-between;
116
- width: 100%;
117
- }
118
-
119
- .bcc-modal-content .input {
114
+ .input {
120
115
  background-color: var(--cc__primary);
121
116
  border-radius: 5px;
122
117
  color: var(--cc__text-color);
123
118
  height: 40px;
124
119
  padding: 5px;
125
120
  width: 45%;
121
+ min-width: 37%;
126
122
  }
127
123
 
128
- .bcc-modal-content .at {
124
+ .at {
129
125
  width: 10%;
130
126
  text-align: center;
131
127
  margin-top: 7px;
@@ -160,5 +156,4 @@ function scheduleMessage() {
160
156
  .bcc-modal-primary-action button:hover {
161
157
  background-color: var(--cc__accent700);
162
158
  }
163
-
164
159
  </style>
@@ -1,10 +1,9 @@
1
1
  <script setup lang="ts">
2
- import { BccAlert, BccButton, BccModal } from '@bcc-code/design-library-vue';
3
2
  import { localize } from "@cometchat/uikit-resources";
4
- import { MessageComposerConfiguration, SendIcon } from "@cometchat/chat-uikit-vue";
5
- import { getCurrentInstance, inject, onBeforeUnmount, onMounted, Ref, ref } from "vue";
3
+ import { SendIcon } from "@cometchat/chat-uikit-vue";
4
+ import { getCurrentInstance, inject, onBeforeUnmount, onMounted, Ref, ref, watchEffect } from "vue";
6
5
  import { ChatInstance } from '../chat/types';
7
- import { sendScheduledMessage } from '../chat/scheduledMessage';
6
+ import { rescheduleMessage, sendScheduledMessage } from '../chat/scheduledMessage';
8
7
  import BccScheduledMessageModal from './BccScheduledMessageModal.vue';
9
8
 
10
9
  const props = defineProps({
@@ -15,6 +14,7 @@ const chatInstance = inject<Ref<ChatInstance>>("chatInstance");
15
14
  const vueInstance: any = getCurrentInstance();
16
15
  const msgComposerData = vueInstance?.parent?.type?.name === "CometChatMessageComposer" && vueInstance?.parent?.setupState;
17
16
  const msgComposerProps = vueInstance?.parent?.type?.name === "CometChatMessageComposer" && vueInstance?.parent?.props;
17
+ const showModal = ref(false);
18
18
 
19
19
  const sendButtonIconURL = SendIcon;
20
20
  const sendButtonStyle = {
@@ -22,7 +22,7 @@ const sendButtonStyle = {
22
22
  width: "24px",
23
23
  border: "none",
24
24
  borderRadius: "0",
25
- buttonIconTint: "var(--cc__accent500, rgba(98, 116, 174, 0.66))",
25
+ buttonIconTint: "var(--cc__primary150, #57639e)",
26
26
  background: "transparent"
27
27
  }
28
28
 
@@ -51,8 +51,14 @@ onBeforeUnmount(() => {
51
51
  msgComposerData.sendMessageOnEnter = originalSendMessageOnEnter;
52
52
  });
53
53
 
54
+ watchEffect(async () => {
55
+ if (chatInstance && chatInstance.value.rescheduleInfo) {
56
+ showModal.value = true;
57
+ } else {
58
+ showModal.value = false;
59
+ }
60
+ })
54
61
 
55
- const showModal = ref(false);
56
62
 
57
63
  function openModal() {
58
64
  const userInput = document.querySelector(".messageinput-input")?.innerText;
@@ -63,22 +69,27 @@ function openModal() {
63
69
 
64
70
  function closeModal() {
65
71
  showModal.value = false;
72
+ if (chatInstance) chatInstance.value.rescheduleInfo = null;
66
73
  }
67
74
 
68
75
  function scheduleMessage(scheduleDate?: string) {
69
76
  if (scheduleDate && chatInstance) {
70
- sendScheduledMessage(scheduleDate, props.chatUid, chatInstance).then((msgSuccessful) => {
71
- if (!msgSuccessful) {
72
- showModal.value = false
73
- chatInstance.value.showAlert = true
74
- setTimeout(() => chatInstance.value.showAlert = false, 5000)
75
- } else {
76
- showModal.value = false
77
- msgComposerData.messageText = "";
78
- msgComposerData.textRef = "";
79
- msgComposerData.inputRef?.emptyInputField();
80
- }
81
- });
77
+ if (chatInstance.value.rescheduleInfo) {
78
+ rescheduleMessage(scheduleDate, props.chatUid, chatInstance.value.rescheduleInfo.rescheduleMuid, chatInstance.value.rescheduleInfo.messageId)
79
+ } else {
80
+ sendScheduledMessage(scheduleDate, props.chatUid, chatInstance).then((msgSuccessful) => {
81
+ if (!msgSuccessful) {
82
+ showModal.value = false
83
+ chatInstance.value.showAlert = true
84
+ setTimeout(() => chatInstance.value.showAlert = false, 5000)
85
+ } else {
86
+ showModal.value = false
87
+ msgComposerData.messageText = "";
88
+ msgComposerData.textRef = "";
89
+ msgComposerData.inputRef?.emptyInputField();
90
+ }
91
+ });
92
+ }
82
93
  }
83
94
  }
84
95
  </script>