@bcc-code/vue-bcc-chat-ui 4.6.1 → 5.0.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": "4.6.1",
5
+ "version": "5.0.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -59,6 +59,7 @@
59
59
  "@cometchat/uikit-resources": "4.3.13",
60
60
  "@cometchat/uikit-shared": "4.3.19",
61
61
  "dompurify": "^3.1.7",
62
+ "fuse.js": "^7.0.0",
62
63
  "jwt-decode": "^4.0.0",
63
64
  "markdown-it": "^14.1.0",
64
65
  "panzoom": "^9.4.3"
@@ -115,9 +115,6 @@ const wrapperStyle = () => {
115
115
  }
116
116
  </style>
117
117
  <style scoped>
118
- * {
119
- box-sizing: border-box;
120
- }
121
118
  .bcc__attachment_box {
122
119
  padding: 8px;
123
120
  display: flex;
@@ -9,6 +9,11 @@ import BccImageBubble from './BccImageBubble.vue';
9
9
  import { offlineStore } from '../offline';
10
10
 
11
11
  const props = defineProps({
12
+ id: {
13
+ type: String,
14
+ required: false,
15
+ default: ""
16
+ },
12
17
  text: {
13
18
  type: String,
14
19
  required: true
@@ -138,7 +143,7 @@ const replyPreviewStyle = {
138
143
  </div>
139
144
  <div v-if="text && metadata && metadata.translated_message" v-html="toMarkdownHtml(metadata.translated_message)"
140
145
  class="bcc-chat-msg-bubble bcc-chat-msg-bubble--translation" />
141
- <div v-if="text" v-html="toMarkdownHtml(text)" class="bcc-chat-msg-bubble"
146
+ <div v-if="text" v-html="toMarkdownHtml(text)" class="bcc-chat-msg-bubble" :id="id"
142
147
  :class="{ 'bcc-chat-msg-bubble--translated': metadata && !!metadata.translated_message }" />
143
148
  </div>
144
149
  </template>
@@ -30,6 +30,7 @@ const props = defineProps({
30
30
  type: Function as PropType<(guid: string, query: string) => Promise<any>>,
31
31
  required: false,
32
32
  },
33
+ loadMessageId: { type: String, required: false, default: "" },
33
34
  });
34
35
 
35
36
  const componentId = ref(
@@ -55,6 +56,11 @@ const chatInstance: Ref<ChatInstance> = ref({
55
56
 
56
57
  provide("chatInstance", chatInstance);
57
58
 
59
+ const localLoadMessageId = ref(props.loadMessageId);
60
+ watch(() => props.loadMessageId, (newVal) => {
61
+ localLoadMessageId.value = newVal;
62
+ });
63
+
58
64
  const onMessageSend = CometChatMessageEvents.ccMessageSent.subscribe(({ message, status }) => {
59
65
  if (status !== MessageStatus.inprogress) {
60
66
  return
@@ -80,9 +86,8 @@ const onMessageSend = CometChatMessageEvents.ccMessageSent.subscribe(({ message,
80
86
  (message as any).setMetadata(metadata);
81
87
  });
82
88
 
83
- watch([loggedIn, chat.onlineStatus, () => props.chatUid, chat.initialized, () => props.groupMessageGetter], async ([_loggedIn, _online, _chatUid, _initialized, _groupMessageGetter]) => {
89
+ watch([loggedIn, chat.onlineStatus, () => props.chatUid, chat.initialized, () => props.groupMessageGetter, chat.scrollToMessageId, localLoadMessageId], async ([_loggedIn, _online, _chatUid, _initialized, _groupMessageGetter, _scrollToMessageId, _localLoadMessageId]) => {
84
90
  logger.debug("ChatMessageList watch changed", { chatUid: _chatUid, loggedIn: _loggedIn, online: _online, initialized: _initialized });
85
-
86
91
  try {
87
92
  if (_loggedIn && _chatUid && _initialized) {
88
93
  chatGroupNotFound.value = false;
@@ -97,6 +102,15 @@ watch([loggedIn, chat.onlineStatus, () => props.chatUid, chat.initialized, () =>
97
102
  chat.updateGetGroupMessages(_groupMessageGetter)
98
103
  }
99
104
 
105
+ if (_scrollToMessageId) {
106
+ chat.scrollToMessage(_scrollToMessageId);
107
+ }
108
+
109
+ if (_localLoadMessageId) {
110
+ chat.loadMessageId.value = _localLoadMessageId;
111
+ localLoadMessageId.value = "";
112
+ }
113
+
100
114
  if (chatGroup.value) {
101
115
 
102
116
  let isChannel = (chatGroup.value.getMetadata() as any).isChannel;
@@ -117,7 +131,6 @@ watch([loggedIn, chat.onlineStatus, () => props.chatUid, chat.initialized, () =>
117
131
  }
118
132
 
119
133
  }
120
-
121
134
  await chat.clearGroupChatCount(props.chatUid);
122
135
  } else if (chatGroup.value) {
123
136
  chatGroup.value = undefined;
@@ -277,16 +290,6 @@ function closeScheduledMessage() {
277
290
  </template>
278
291
 
279
292
  <style lang="scss">
280
- body {
281
- background: #fff;
282
- color: #000;
283
- }
284
-
285
- :host.dark body {
286
- background: #000;
287
- color: #fff;
288
- }
289
-
290
293
  .bcc-chat-message-list-wrapper {
291
294
  position: relative;
292
295
  height: 100%;
@@ -343,8 +346,6 @@ accent900: text in avatar
343
346
  --cc__link-color: #cfeac8;
344
347
  }
345
348
 
346
-
347
-
348
349
  .bcc-chat-message-list {
349
350
  height: 100%;
350
351
 
@@ -18,9 +18,9 @@
18
18
  </div>
19
19
  </div>
20
20
  <div class="cc__file__icon">
21
- <a :href="fileURL" target="_blank"
22
- ><i :style="messageFileIconStyle"></i
23
- ></a>
21
+ <a :href="fileURL" target="_blank">
22
+ <i :style="messageFileIconStyle" />
23
+ </a>
24
24
  </div>
25
25
  </div>
26
26
  </template>
@@ -127,7 +127,7 @@ const messageFileIconStyle = computed(() => {
127
127
  width: fit-content;
128
128
  line-height: 36px;
129
129
  }
130
- i {
130
+ .cc__file__icon i {
131
131
  display: inline-block;
132
132
  width: 24px;
133
133
  height: 24px;
@@ -90,7 +90,7 @@ function closeImageInFullScreen() {
90
90
  }
91
91
 
92
92
  /* Placeholder styles */
93
- .placeholder {
93
+ .bcc-image_container .placeholder {
94
94
  width: 100%;
95
95
  height: auto;
96
96
  display: flex;
@@ -103,12 +103,12 @@ function closeImageInFullScreen() {
103
103
  z-index: -1;
104
104
  }
105
105
 
106
- .placeholder::before {
106
+ .bcc-image_container .placeholder::before {
107
107
  content: "⌛";
108
108
  position: absolute;
109
109
  }
110
110
 
111
- .placeholder.landscape > img {
111
+ .bcc-image_container .placeholder.landscape > img {
112
112
  width: 100%;
113
113
  }
114
114
 
@@ -125,9 +125,6 @@ const wrapperStyle = () => {
125
125
  }
126
126
  </style>
127
127
  <style scoped>
128
- * {
129
- box-sizing: border-box;
130
- }
131
128
  .bcc__reply_box {
132
129
  padding: 8px;
133
130
  display: flex;
@@ -51,7 +51,7 @@ async function redirectToScheduledMessagesChat() {
51
51
  </div>
52
52
  </template>
53
53
 
54
- <style lang="scss">
54
+ <style lang="scss" scoped>
55
55
  .update-icon-style {
56
56
  height: 24px;
57
57
  width: 24px;
@@ -53,115 +53,20 @@ function scheduleMessage() {
53
53
  <BccModal class="modal" :title="title" :open="true" @close="close()" :closeOnOutsideClick="closeOnOutsideClick"
54
54
  :closeButton="true">
55
55
  <div class="flex flex-col w-full">
56
- <div class="flex flex-row w-full justify-between">
57
- <input class="input" type="date" v-model="dateInput" required>
58
- <p class="at">{{ localize("AT") }}</p>
59
- <input class="input" type="time" v-model="timeInput" required>
56
+ <div class="flex w-full items-center justify-between">
57
+ <input class="bcc-input text-right justify-end" type="date" v-model="dateInput" required />
58
+ <p class="mx-2">{{ localize("AT") }}</p>
59
+ <input class="bcc-input text-right justify-end" type="time" v-model="timeInput" required />
60
60
  </div>
61
- <BccFormMessage class="text-center mt-2 mb-0 text-red-500" v-if="!isDateInFuture" state="error">{{
62
- localize("ERROR_DATE_IN_FUTURE") }}</BccFormMessage>
61
+ <BccFormMessage class="text-center mt-2 mb-0 text-red-500" v-if="!isDateInFuture" state="error">
62
+ {{ localize("ERROR_DATE_IN_FUTURE") }}
63
+ </BccFormMessage>
63
64
  </div>
64
65
 
65
66
  <template #primaryAction>
66
- <BccButton class="button" :disabled="messageSent" @click="scheduleMessage()"> {{
67
- localize("SCHEDULE_MESSAGE") }}</BccButton>
67
+ <BccButton class="button" :disabled="messageSent" @click="scheduleMessage()">
68
+ {{ localize("SCHEDULE_MESSAGE") }}
69
+ </BccButton>
68
70
  </template>
69
71
  </BccModal>
70
- </template>
71
-
72
- <style lang="scss">
73
- :root {
74
- --cc__primary: #cfeac8;
75
- --cc__primary150: #004e48;
76
- --cc__background: #f3faf7;
77
- --cc__secondary: white;
78
- --cc__accent: #004e48;
79
- --cc__accent50: rgba(62, 142, 117, 0.04);
80
- --cc__accent100: #ffffff;
81
- --cc__accent200: rgba(62, 142, 117, 0.15);
82
- --cc__accent300: rgba(62, 142, 117, 0.24);
83
- --cc__accent400: rgba(62, 142, 117, 0.33);
84
- --cc__accent500: rgba(62, 142, 117, 0.46);
85
- --cc__accent600: #004e48;
86
- --cc__accent700: #254a40;
87
- --cc__accent800: rgba(62, 142, 117, 0.82);
88
- --cc__accent900: #f3faf7;
89
- --cc__text-color: #000;
90
- --cc__link-color: #57639e;
91
- }
92
-
93
- :root.dark {
94
- --cc__primary: #57639e;
95
- --cc__primary150: #57639e;
96
- --cc__background: hsl(230, 25%, 15%);
97
- --cc__secondary: #111827;
98
- --cc__accent: #758abc;
99
- --cc__accent50: rgba(98, 116, 174, 0.24);
100
- --cc__accent100: linear-gradient(45deg, #05070b 0%, #0c111c 100%);
101
- --cc__accent200: rgba(98, 116, 174, 0.35);
102
- --cc__accent300: rgba(98, 116, 174, 0.44);
103
- --cc__accent400: rgba(98, 116, 174, 0.53);
104
- --cc__accent500: rgba(98, 116, 174, 0.66);
105
- --cc__accent600: #758abc;
106
- --cc__accent700: #6274ae;
107
- --cc__accent800: rgba(98, 116, 174, 0.92);
108
- --cc__accent900: #090A0B;
109
- --cc__text-color: #fff;
110
- --cc__link-color: #cfeac8;
111
- }
112
-
113
- .modal {
114
- width: 90%;
115
- margin-left: 5%;
116
- margin-top: auto;
117
- margin-bottom: auto;
118
- background-color: var(--cc__background);
119
- color: var(--cc__text-color);
120
- }
121
-
122
- .input {
123
- background-color: var(--cc__primary);
124
- border-radius: 5px;
125
- color: var(--cc__text-color);
126
- height: 40px;
127
- padding: 5px;
128
- width: 45%;
129
- min-width: 37%;
130
- }
131
-
132
- .at {
133
- width: 10%;
134
- text-align: center;
135
- margin-top: 7px;
136
- }
137
-
138
- .bcc-modal-footer {
139
- background-color: var(--cc__background);
140
- }
141
-
142
- .bcc-modal-actions {
143
- background-color: var(--cc__background);
144
- display: flex;
145
- width: 100%;
146
- justify-content: space-between;
147
- }
148
-
149
- .bcc-modal-actions .bcc-modal-secondary-action,
150
- .bcc-modal-primary-action {
151
- width: 100%;
152
- background-color: var(--cc__background);
153
- }
154
-
155
- .bcc-modal-secondary-action button,
156
- .bcc-modal-primary-action button {
157
- background-color: var(--cc__accent800);
158
- width: 100%;
159
- border-radius: 5px;
160
- margin-top: -10px;
161
- }
162
-
163
- .bcc-modal-secondary-action button:hover,
164
- .bcc-modal-primary-action button:hover {
165
- background-color: var(--cc__accent700);
166
- }
167
- </style>
72
+ </template>