@bcc-code/vue-bcc-chat-ui 4.4.6 → 4.4.10
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/dist/components/BccChatSendButton.vue.d.ts +3 -1
- package/dist/components/BccCometChatFullScreenViewer.vue.d.ts +3 -1
- package/dist/components/BccScheduledMessageModal.vue.d.ts +9 -0
- package/dist/components/BccScheduledSendButton.vue.d.ts +3 -1
- package/dist/style.css +1 -1
- package/dist/vue-bcc-chat-ui.js +21208 -21134
- package/dist/vue-bcc-chat-ui.js.map +1 -1
- package/package.json +2 -2
- package/src/components/BccChatMessageList.vue +16 -3
- package/src/components/BccChatMessages.vue +98 -94
- package/src/components/BccScheduledMessageModal.vue +11 -7
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.
|
|
5
|
+
"version": "4.4.10",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"private": false,
|
|
8
8
|
"files": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"vue": "^3.4.38"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@bcc-code/design-library-vue": "^2.
|
|
54
|
+
"@bcc-code/design-library-vue": "^2.9.2",
|
|
55
55
|
"@bcc-code/icons-vue": "^1.4.0",
|
|
56
56
|
"@cometchat/chat-sdk-javascript": "4.0.10",
|
|
57
57
|
"@cometchat/chat-uikit-vue": "4.3.17",
|
|
@@ -160,9 +160,22 @@ onMounted(() => {
|
|
|
160
160
|
"word-break": "break-all"
|
|
161
161
|
},
|
|
162
162
|
shadowDomSelector: "cometchat-preview",
|
|
163
|
-
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
selector: ".cc__polldata",
|
|
166
|
+
style: { color: "var(--cc__primary150)" },
|
|
167
|
+
shadowDomSelector: "create-poll"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
selector: ".cc__pollsbubble__option",
|
|
171
|
+
style: {
|
|
172
|
+
backgroundColor: "var(--cc__background)",
|
|
173
|
+
},
|
|
174
|
+
shadowDomSelector: "polls-bubble"
|
|
175
|
+
},
|
|
164
176
|
]);
|
|
165
177
|
|
|
178
|
+
|
|
166
179
|
CometChat.addGroupListener("groupListener", new CometChat.GroupListener({
|
|
167
180
|
onGroupMemberScopeChanged: (_action: any, changedUser: GroupMember, newScope: any, _oldScope: any, _changedGroup: GroupMember) => {
|
|
168
181
|
handleGroupMemberChanges(changedUser, "update", newScope);
|
|
@@ -315,7 +328,7 @@ accent900: text in avatar
|
|
|
315
328
|
--cc__primary150: #57639e;
|
|
316
329
|
--cc__background: hsl(230, 25%, 15%);
|
|
317
330
|
--cc__secondary: #111827;
|
|
318
|
-
--cc__accent: #
|
|
331
|
+
--cc__accent: #758abc;
|
|
319
332
|
--cc__accent50: rgba(98, 116, 174, 0.24);
|
|
320
333
|
--cc__accent100: linear-gradient(45deg, #05070b 0%, #0c111c 100%);
|
|
321
334
|
--cc__accent200: rgba(98, 116, 174, 0.35);
|
|
@@ -325,7 +338,7 @@ accent900: text in avatar
|
|
|
325
338
|
--cc__accent600: #758abc;
|
|
326
339
|
--cc__accent700: #6274ae;
|
|
327
340
|
--cc__accent800: rgba(98, 116, 174, 0.92);
|
|
328
|
-
--cc__accent900: #
|
|
341
|
+
--cc__accent900: #090A0B;
|
|
329
342
|
--cc__text-color: #fff;
|
|
330
343
|
--cc__link-color: #cfeac8;
|
|
331
344
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import chat from "../chat";
|
|
3
3
|
import { Group } from "@cometchat/chat-sdk-javascript";
|
|
4
|
-
import { computed, inject, nextTick, onMounted, Ref, ref, watch, watchEffect } from 'vue';
|
|
4
|
+
import { computed, inject, nextTick, onMounted, onUnmounted, Ref, ref, watch, watchEffect } from 'vue';
|
|
5
5
|
import { ChatInstance } from '../chat/types';
|
|
6
6
|
import BccAttachmentBox from "./BccAttachmentBox.vue";
|
|
7
7
|
import BccChatSendButton from "./BccChatSendButton.vue";
|
|
8
8
|
import { getMessageComposerConfiguration, getMessageListConfiguration, getThreadedMessagesConfiguration } from "../chat/uiKit";
|
|
9
9
|
import { CometChatMessages } from "../chat/cometChatPatches";
|
|
10
10
|
import { MessageComposerConfiguration } from "@cometchat/uikit-shared";
|
|
11
|
+
import { sendScheduledMessage } from "../chat/scheduledMessage";
|
|
12
|
+
import BccScheduledMessageModal from "./BccScheduledMessageModal.vue";
|
|
13
|
+
import { BccAlert } from "@bcc-code/design-library-vue";
|
|
14
|
+
import { localize } from "@cometchat/uikit-resources";
|
|
11
15
|
|
|
12
16
|
const props = defineProps({
|
|
13
17
|
chatUid: { type: String, required: true },
|
|
@@ -27,7 +31,7 @@ threadedMessagesConfiguration.messageComposerConfiguration = getThreadedMessageC
|
|
|
27
31
|
|
|
28
32
|
onMounted(async () => {
|
|
29
33
|
chatGroup.value = props.chatGroup
|
|
30
|
-
|
|
34
|
+
attachEventlisteners();
|
|
31
35
|
|
|
32
36
|
messageComposerConfiguration.value.text = chatInstance?.value.userInput ?? '';
|
|
33
37
|
|
|
@@ -38,9 +42,9 @@ onMounted(async () => {
|
|
|
38
42
|
}
|
|
39
43
|
})
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
onUnmounted(() => {
|
|
46
|
+
detachEventlisteners();
|
|
47
|
+
})
|
|
44
48
|
|
|
45
49
|
watch(() => props.chatGroup,
|
|
46
50
|
(group) => {
|
|
@@ -63,8 +67,8 @@ watchEffect(() => {
|
|
|
63
67
|
chatUid: props.chatUid
|
|
64
68
|
}
|
|
65
69
|
};
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
detachEventlisteners()
|
|
71
|
+
attachEventlisteners()
|
|
68
72
|
} else {
|
|
69
73
|
if (chatInstance && chatInstance.value.replyToMessage) {
|
|
70
74
|
messageComposerConfiguration.value.headerView = {
|
|
@@ -87,91 +91,91 @@ function getThreadedMessageComposerConfig(): MessageComposerConfiguration {
|
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
// Holding functionality temporarily disabled due to some bugs
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
//
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
94
|
+
|
|
95
|
+
function attachEventlisteners() {
|
|
96
|
+
const interval = setInterval(() => {
|
|
97
|
+
const btns = document.querySelectorAll('.cc-messagecomposer-wrapper__sendbutton');
|
|
98
|
+
const sendButton = btns[btns.length - 1]
|
|
99
|
+
document.querySelector("body")?.addEventListener("contextmenu", (event) => event.preventDefault());
|
|
100
|
+
|
|
101
|
+
if (sendButton) {
|
|
102
|
+
sendButton.addEventListener("pointerdown", onMouseDown);
|
|
103
|
+
sendButton.addEventListener("pointerup", clearTimer);
|
|
104
|
+
sendButton.addEventListener("mouseleave", clearTimer);
|
|
105
|
+
sendButton.addEventListener("contextmenu", onContextMenu);
|
|
106
|
+
clearInterval(interval)
|
|
107
|
+
}
|
|
108
|
+
}, 500);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function detachEventlisteners() {
|
|
112
|
+
const btns = document.querySelectorAll('.cc-messagecomposer-wrapper__sendbutton');
|
|
113
|
+
const sendButton = btns[btns.length - 1]
|
|
114
|
+
|
|
115
|
+
if (sendButton) {
|
|
116
|
+
sendButton.removeEventListener("pointerdown", onMouseDown);
|
|
117
|
+
sendButton.removeEventListener("pointerup", clearTimer);
|
|
118
|
+
sendButton.removeEventListener("mouseleave", clearTimer);
|
|
119
|
+
sendButton.removeEventListener("contextmenu", onContextMenu);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function closeModal() {
|
|
124
|
+
showModal.value = false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const showModal = ref(false);
|
|
128
|
+
let timerId: string | number | NodeJS.Timeout | null | undefined;
|
|
129
|
+
const duration = 500;
|
|
130
|
+
let longPressDetected = false;
|
|
131
|
+
|
|
132
|
+
const openPopup = () => {
|
|
133
|
+
showModal.value = true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const onMouseDown = (event: Event) => {
|
|
137
|
+
const userInput = document.querySelector(".messageinput-input")?.innerText;
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
event.stopPropagation();
|
|
140
|
+
if (userInput) {
|
|
141
|
+
// Only handle long press when there is user input
|
|
142
|
+
timerId = setTimeout(() => {
|
|
143
|
+
longPressDetected = true;
|
|
144
|
+
openPopup();
|
|
145
|
+
}, duration); // assuming duration is 500ms for long press
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const showAlert = ref<boolean>(false);
|
|
150
|
+
|
|
151
|
+
const onContextMenu = (event: Event) => {
|
|
152
|
+
if (longPressDetected) {
|
|
153
|
+
// Prevent context menu only when long press is detected
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
event.stopPropagation();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const clearTimer = (event: Event) => {
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
event.stopPropagation();
|
|
162
|
+
if (timerId !== null) {
|
|
163
|
+
clearTimeout(timerId);
|
|
164
|
+
timerId = null;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function scheduleMessage(scheduleDate?: string) {
|
|
169
|
+
if (scheduleDate && chatInstance) {
|
|
170
|
+
sendScheduledMessage(scheduleDate, props.chatUid, chatInstance).then((msgSuccessful) => {
|
|
171
|
+
if (!msgSuccessful) {
|
|
172
|
+
showModal.value = false
|
|
173
|
+
showAlert.value = true
|
|
174
|
+
setTimeout(() => showAlert.value = false, 3000)
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
}
|
|
175
179
|
|
|
176
180
|
function isChannel(): boolean {
|
|
177
181
|
return (props.chatGroup.getMetadata() as any)?.isChannel;
|
|
@@ -198,11 +202,11 @@ function isParticipant(): boolean {
|
|
|
198
202
|
<span v-if="isOffline">Waiting for network...</span>
|
|
199
203
|
<span v-else>Connecting... </span>
|
|
200
204
|
</div>
|
|
201
|
-
|
|
205
|
+
<BccScheduledMessageModal v-if="showModal" @close="closeModal()" @send="scheduleMessage" :closeOnOutsideClick="false">
|
|
202
206
|
</BccScheduledMessageModal>
|
|
203
207
|
<BccAlert class="absolute top-0 w-[97%] mx-2 mt-1" icon closeButton context="danger" :open="showAlert"
|
|
204
208
|
@close="showAlert = false">
|
|
205
209
|
{{ localize("ERROR_SENDING_SCHEDULED_MESSAGE") }}
|
|
206
|
-
</BccAlert>
|
|
210
|
+
</BccAlert>
|
|
207
211
|
</div>
|
|
208
212
|
</template>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { BccButton, BccFormMessage, BccModal } from '@bcc-code/design-library-vue';
|
|
3
3
|
import { localize } from '@cometchat/uikit-resources';
|
|
4
|
-
import { computed, onMounted, ref } from 'vue';
|
|
4
|
+
import { computed, onMounted, ref, watch } from 'vue';
|
|
5
5
|
|
|
6
6
|
const props = defineProps({
|
|
7
|
-
isReschedule: { type: Boolean, default: false }
|
|
7
|
+
isReschedule: { type: Boolean, default: false },
|
|
8
|
+
closeOnOutsideClick: { type: Boolean, default: true }
|
|
8
9
|
})
|
|
9
10
|
|
|
10
11
|
const title = props.isReschedule ? localize("RESCHEDULE") : localize("SCHEDULE_MESSAGE")
|
|
11
|
-
|
|
12
|
+
const closeOnOutsideClick = ref<boolean>(props.closeOnOutsideClick);
|
|
12
13
|
const emit = defineEmits(['close', 'schedule', 'reschedule']);
|
|
13
14
|
|
|
14
15
|
const dateInput = ref<string>();
|
|
@@ -32,6 +33,8 @@ onMounted(() => {
|
|
|
32
33
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
33
34
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
34
35
|
timeInput.value = `${hours}:${minutes}`;
|
|
36
|
+
|
|
37
|
+
setTimeout(() => closeOnOutsideClick.value = true, 500);
|
|
35
38
|
})
|
|
36
39
|
|
|
37
40
|
function close() {
|
|
@@ -47,11 +50,12 @@ function scheduleMessage() {
|
|
|
47
50
|
</script>
|
|
48
51
|
|
|
49
52
|
<template>
|
|
50
|
-
<BccModal class="modal" :title="title" :open="true" @close="close()" :
|
|
53
|
+
<BccModal class="modal" :title="title" :open="true" @close="close()" :closeOnOutsideClick="closeOnOutsideClick"
|
|
54
|
+
:closeButton="true">
|
|
51
55
|
<div class="flex flex-col w-full">
|
|
52
56
|
<div class="flex flex-row w-full justify-between">
|
|
53
57
|
<input class="input" type="date" v-model="dateInput" required>
|
|
54
|
-
<p class="at">
|
|
58
|
+
<p class="at">{{ localize("AT") }}</p>
|
|
55
59
|
<input class="input" type="time" v-model="timeInput" required>
|
|
56
60
|
</div>
|
|
57
61
|
<BccFormMessage class="text-center mt-2 mb-0 text-red-500" v-if="!isDateInFuture" state="error">{{
|
|
@@ -91,7 +95,7 @@ function scheduleMessage() {
|
|
|
91
95
|
--cc__primary150: #57639e;
|
|
92
96
|
--cc__background: hsl(230, 25%, 15%);
|
|
93
97
|
--cc__secondary: #111827;
|
|
94
|
-
--cc__accent: #
|
|
98
|
+
--cc__accent: #758abc;
|
|
95
99
|
--cc__accent50: rgba(98, 116, 174, 0.24);
|
|
96
100
|
--cc__accent100: linear-gradient(45deg, #05070b 0%, #0c111c 100%);
|
|
97
101
|
--cc__accent200: rgba(98, 116, 174, 0.35);
|
|
@@ -101,7 +105,7 @@ function scheduleMessage() {
|
|
|
101
105
|
--cc__accent600: #758abc;
|
|
102
106
|
--cc__accent700: #6274ae;
|
|
103
107
|
--cc__accent800: rgba(98, 116, 174, 0.92);
|
|
104
|
-
--cc__accent900: #
|
|
108
|
+
--cc__accent900: #090A0B;
|
|
105
109
|
--cc__text-color: #fff;
|
|
106
110
|
--cc__link-color: #cfeac8;
|
|
107
111
|
}
|