@bcc-code/vue-bcc-chat-ui 3.25.0 → 3.26.1
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/chat/types.d.ts +8 -0
- package/dist/style.css +1 -1
- package/dist/vue-bcc-chat-ui.js +5309 -5308
- package/package.json +1 -1
- package/src/components/BccChatMessageList.vue +4 -51
- package/src/components/BccChatMessages.vue +22 -5
- package/src/components/BccChatSendButton.vue +1 -1
- package/src/components/BccScheduledMessageIcon.vue +3 -1
- package/src/components/BccScheduledMessageModal.vue +114 -8
- package/src/components/BccScheduledMessages.vue +19 -1
- package/src/components/BccScheduledSendButton.vue +1 -1
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
provide,
|
|
10
10
|
ref,
|
|
11
11
|
watch,
|
|
12
|
+
watchEffect,
|
|
12
13
|
} from "vue";
|
|
13
14
|
import chat from "../chat";
|
|
14
15
|
import { connect, disconnect } from "../chat/connection";
|
|
@@ -36,8 +37,10 @@ const chatInstance: Ref<ChatInstance> = ref({
|
|
|
36
37
|
componentId: componentId,
|
|
37
38
|
replyToMessage: null,
|
|
38
39
|
captionedAttachment: null,
|
|
40
|
+
decoyAttachment: null,
|
|
39
41
|
showScheduledMessagesChat: false,
|
|
40
|
-
showAlert: false
|
|
42
|
+
showAlert: false,
|
|
43
|
+
userInput: null
|
|
41
44
|
});
|
|
42
45
|
|
|
43
46
|
provide("chatInstance", chatInstance);
|
|
@@ -166,56 +169,6 @@ body {
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
|
|
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
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
172
|
.bcc-chat-message-list-wrapper {
|
|
220
173
|
position: relative;
|
|
221
174
|
height: 100%;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import chat from "../chat";
|
|
3
3
|
import { Group } from "@cometchat/chat-sdk-javascript";
|
|
4
|
-
import { inject, onMounted, onUnmounted, Ref, ref, watch, watchEffect } from 'vue';
|
|
4
|
+
import { inject, nextTick, onMounted, onUnmounted, Ref, ref, watch, watchEffect } from 'vue';
|
|
5
5
|
import { sendScheduledMessage } from '../chat/scheduledMessage';
|
|
6
6
|
import { ChatInstance } from '../chat/types';
|
|
7
7
|
import BccAttachmentBox from "./BccAttachmentBox.vue";
|
|
@@ -26,9 +26,19 @@ const messageListConfiguration = getMessageListConfiguration(chatInstance, chatG
|
|
|
26
26
|
const threadedMessagesConfiguration = getThreadedMessagesConfiguration(chatGroup);
|
|
27
27
|
threadedMessagesConfiguration.messageComposerConfiguration = getThreadedMessageComposerConfig();
|
|
28
28
|
|
|
29
|
-
onMounted(() => {
|
|
29
|
+
onMounted(async () => {
|
|
30
30
|
chatGroup.value = props.chatGroup
|
|
31
31
|
attachEventlisteners();
|
|
32
|
+
|
|
33
|
+
await nextTick();
|
|
34
|
+
const userInput = document.querySelector('.messageinput-input');
|
|
35
|
+
if (userInput && chatInstance?.value.userInput) {
|
|
36
|
+
userInput.innerHTML = chatInstance.value.userInput;
|
|
37
|
+
}
|
|
38
|
+
if (chatInstance?.value.decoyAttachment) {
|
|
39
|
+
chatInstance.value.captionedAttachment = chatInstance.value.decoyAttachment
|
|
40
|
+
chatInstance.value.decoyAttachment = null
|
|
41
|
+
}
|
|
32
42
|
})
|
|
33
43
|
|
|
34
44
|
onUnmounted(() => {
|
|
@@ -58,7 +68,7 @@ watchEffect(() => {
|
|
|
58
68
|
};
|
|
59
69
|
detachEventlisteners()
|
|
60
70
|
attachEventlisteners()
|
|
61
|
-
} else {
|
|
71
|
+
} else {
|
|
62
72
|
if (chatInstance && chatInstance.value.replyToMessage) {
|
|
63
73
|
messageComposerConfiguration.value.headerView = {
|
|
64
74
|
componentName: "bcc-reply-box",
|
|
@@ -74,7 +84,7 @@ watchEffect(() => {
|
|
|
74
84
|
});
|
|
75
85
|
|
|
76
86
|
function getThreadedMessageComposerConfig(): MessageComposerConfiguration {
|
|
77
|
-
let composerConfig = {...messageComposerConfiguration.value}
|
|
87
|
+
let composerConfig = { ...messageComposerConfiguration.value }
|
|
78
88
|
composerConfig.auxilaryButtonView = undefined
|
|
79
89
|
return composerConfig;
|
|
80
90
|
}
|
|
@@ -88,6 +98,9 @@ function attachEventlisteners() {
|
|
|
88
98
|
sendButton.addEventListener("pointerdown", onMouseDown);
|
|
89
99
|
sendButton.addEventListener("pointerup", clearTimer);
|
|
90
100
|
sendButton.addEventListener("mouseleave", clearTimer);
|
|
101
|
+
sendButton.addEventListener("touchstart", onMouseDown);
|
|
102
|
+
sendButton.addEventListener("touchend", clearTimer);
|
|
103
|
+
sendButton.addEventListener("touchcancel", clearTimer);
|
|
91
104
|
|
|
92
105
|
clearInterval(interval)
|
|
93
106
|
}
|
|
@@ -102,6 +115,9 @@ function detachEventlisteners() {
|
|
|
102
115
|
sendButton.removeEventListener("pointerdown", onMouseDown);
|
|
103
116
|
sendButton.removeEventListener("pointerup", clearTimer);
|
|
104
117
|
sendButton.removeEventListener("mouseleave", clearTimer);
|
|
118
|
+
sendButton.removeEventListener("touchstart", onMouseDown);
|
|
119
|
+
sendButton.removeEventListener("touchend", clearTimer);
|
|
120
|
+
sendButton.removeEventListener("touchcancel", clearTimer);
|
|
105
121
|
}
|
|
106
122
|
}
|
|
107
123
|
|
|
@@ -175,7 +191,8 @@ const clearTimer = () => {
|
|
|
175
191
|
</div>
|
|
176
192
|
<BccScheduledMessageModal v-if="showModal" @close="closeModal()" @send="scheduleMessage">
|
|
177
193
|
</BccScheduledMessageModal>
|
|
178
|
-
<BccAlert class="absolute top-0 w-[97%] mx-2 mt-1" icon closeButton context="danger" :open="showAlert"
|
|
194
|
+
<BccAlert class="absolute top-0 w-[97%] mx-2 mt-1" icon closeButton context="danger" :open="showAlert"
|
|
195
|
+
@close="showAlert = false">
|
|
179
196
|
{{ localize("ERROR_SENDING_SCHEDULED_MESSAGE") }}
|
|
180
197
|
</BccAlert>
|
|
181
198
|
</div>
|
|
@@ -34,9 +34,11 @@ async function redirectToScheduledMessagesChat() {
|
|
|
34
34
|
}
|
|
35
35
|
if (schedMsgChat) {
|
|
36
36
|
chatInstance.value.scheduledMessageChat = schedMsgChat
|
|
37
|
+
chatInstance.value.decoyAttachment = chatInstance.value.captionedAttachment
|
|
37
38
|
chatInstance.value.captionedAttachment = null
|
|
38
39
|
chatInstance.value.replyToMessage = null
|
|
39
40
|
chatInstance.value.showScheduledMessagesChat = true
|
|
41
|
+
chatInstance.value.userInput = document.querySelector(".messageinput-input")?.innerText;
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -54,7 +56,7 @@ async function redirectToScheduledMessagesChat() {
|
|
|
54
56
|
width: 24px;
|
|
55
57
|
border: none;
|
|
56
58
|
border-radius: 0;
|
|
57
|
-
color:
|
|
59
|
+
color: var(--cc__accent500, rgba(98, 116, 174, 0.66));
|
|
58
60
|
background: transparent;
|
|
59
61
|
cursor: pointer;
|
|
60
62
|
margin-right: -10px;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<BccModal class="modal" title=
|
|
2
|
+
<BccModal class="modal" :title=title :open="true" @close="close()" :closeButton="true">
|
|
3
3
|
<div class="flex flex-col w-full">
|
|
4
|
-
<div class="flex flex-row w-full">
|
|
5
|
-
<input class="input" type="date" v-model="dateInput" required>
|
|
6
|
-
<p class="at">at</p>
|
|
7
|
-
<input class="input" type="time" v-model="timeInput" required>
|
|
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
8
|
</div>
|
|
9
|
-
<BccFormMessage class="text-center mt-2 mb-0 text-red-500" v-if="!isDateInFuture" state="error">{{
|
|
9
|
+
<BccFormMessage class="text-center mt-2 mb-0 text-red-500" v-if="!isDateInFuture" state="error">{{
|
|
10
|
+
localize("ERROR_DATE_IN_FUTURE") }}</BccFormMessage>
|
|
10
11
|
</div>
|
|
11
12
|
|
|
12
13
|
<template #primaryAction>
|
|
13
|
-
<BccButton class="button" :disabled="messageSent" @click="scheduleMessage()"> {{
|
|
14
|
+
<BccButton class="button" :disabled="messageSent" @click="scheduleMessage()"> {{
|
|
15
|
+
localize("SCHEDULE_MESSAGE") }}</BccButton>
|
|
14
16
|
</template>
|
|
15
17
|
</BccModal>
|
|
16
18
|
</template>
|
|
@@ -19,6 +21,7 @@
|
|
|
19
21
|
import { BccButton, BccFormMessage, BccModal } from '@bcc-code/design-library-vue';
|
|
20
22
|
import { localize } from '@cometchat/uikit-resources';
|
|
21
23
|
import { computed, onMounted, ref } from 'vue';
|
|
24
|
+
|
|
22
25
|
const emit = defineEmits(['close', 'send']);
|
|
23
26
|
|
|
24
27
|
const dateInput = ref<string>();
|
|
@@ -29,6 +32,8 @@ const localDateTime = computed<string>(() => {
|
|
|
29
32
|
return new Date(dateInput.value + "T" + timeInput.value).toISOString()
|
|
30
33
|
})
|
|
31
34
|
|
|
35
|
+
const title = ref(localize("SCHEDULE_MESSAGE"));
|
|
36
|
+
|
|
32
37
|
const isDateInFuture = computed<boolean>(() => {
|
|
33
38
|
if (dateInput.value === '' || timeInput.value === '') return false
|
|
34
39
|
return new Date(localDateTime.value) > new Date();
|
|
@@ -54,4 +59,105 @@ function scheduleMessage() {
|
|
|
54
59
|
messageSent.value = true;
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
|
-
</script>
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style lang="scss">
|
|
65
|
+
:root {
|
|
66
|
+
--cc__primary: #cfeac8;
|
|
67
|
+
--cc__background: #f3faf7;
|
|
68
|
+
--cc__secondary: white;
|
|
69
|
+
--cc__accent: #004e48;
|
|
70
|
+
--cc__accent50: rgba(62, 142, 117, 0.04);
|
|
71
|
+
--cc__accent100: #ffffff;
|
|
72
|
+
--cc__accent200: rgba(62, 142, 117, 0.15);
|
|
73
|
+
--cc__accent300: rgba(62, 142, 117, 0.24);
|
|
74
|
+
--cc__accent400: rgba(62, 142, 117, 0.33);
|
|
75
|
+
--cc__accent500: rgba(62, 142, 117, 0.46);
|
|
76
|
+
--cc__accent600: #004e48;
|
|
77
|
+
--cc__accent700: #254a40;
|
|
78
|
+
--cc__accent800: rgba(62, 142, 117, 0.82);
|
|
79
|
+
--cc__accent900: #f3faf7;
|
|
80
|
+
--cc__text-color: #000;
|
|
81
|
+
--cc__link-color: #57639e;
|
|
82
|
+
|
|
83
|
+
@media (prefers-color-scheme: dark) {
|
|
84
|
+
--cc__primary: #57639e;
|
|
85
|
+
--cc__background: hsl(230, 25%, 15%);
|
|
86
|
+
--cc__secondary: #111827;
|
|
87
|
+
--cc__accent: #6274ae;
|
|
88
|
+
--cc__accent50: rgba(98, 116, 174, 0.24);
|
|
89
|
+
--cc__accent100: linear-gradient(45deg, #05070b 0%, #0c111c 100%);
|
|
90
|
+
--cc__accent200: rgba(98, 116, 174, 0.35);
|
|
91
|
+
--cc__accent300: rgba(98, 116, 174, 0.44);
|
|
92
|
+
--cc__accent400: rgba(98, 116, 174, 0.53);
|
|
93
|
+
--cc__accent500: rgba(98, 116, 174, 0.66);
|
|
94
|
+
--cc__accent600: #758abc;
|
|
95
|
+
--cc__accent700: #6274ae;
|
|
96
|
+
--cc__accent800: rgba(98, 116, 174, 0.92);
|
|
97
|
+
--cc__accent900: #f3faf7;
|
|
98
|
+
--cc__text-color: #fff;
|
|
99
|
+
--cc__link-color: #cfeac8;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.modal {
|
|
104
|
+
position: fixed;
|
|
105
|
+
top: 50%;
|
|
106
|
+
left: 50%;
|
|
107
|
+
transform: translate(-50%, -50%);
|
|
108
|
+
background-color: var(--cc__background);
|
|
109
|
+
color: var(--cc__text-color);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.bcc-modal-content {
|
|
113
|
+
display: flex;
|
|
114
|
+
justify-content: space-between;
|
|
115
|
+
width: 100%;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.bcc-modal-content .input {
|
|
119
|
+
background-color: var(--cc__primary);
|
|
120
|
+
border-radius: 5px;
|
|
121
|
+
color: var(--cc__text-color);
|
|
122
|
+
height: 40px;
|
|
123
|
+
padding: 5px;
|
|
124
|
+
width: 45%;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.bcc-modal-content .at {
|
|
128
|
+
width: 10%;
|
|
129
|
+
text-align: center;
|
|
130
|
+
margin-top: 7px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.bcc-modal-footer {
|
|
134
|
+
background-color: var(--cc__background);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.bcc-modal-actions {
|
|
138
|
+
background-color: var(--cc__background);
|
|
139
|
+
display: flex;
|
|
140
|
+
width: 100%;
|
|
141
|
+
justify-content: space-between;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.bcc-modal-actions .bcc-modal-secondary-action,
|
|
145
|
+
.bcc-modal-primary-action {
|
|
146
|
+
width: 100%;
|
|
147
|
+
background-color: var(--cc__background);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.bcc-modal-secondary-action button,
|
|
151
|
+
.bcc-modal-primary-action button {
|
|
152
|
+
background-color: var(--cc__accent800);
|
|
153
|
+
width: 100%;
|
|
154
|
+
border-radius: 5px;
|
|
155
|
+
margin-top: -10px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.bcc-modal-secondary-action button:hover,
|
|
159
|
+
.bcc-modal-primary-action button:hover {
|
|
160
|
+
background-color: var(--cc__accent700);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
</style>
|
|
@@ -4,7 +4,7 @@ import { Group } from "@cometchat/chat-sdk-javascript";
|
|
|
4
4
|
import { CloseIcon } from "@bcc-code/icons-vue";
|
|
5
5
|
import { CometChatMessages } from "../chat/cometChatPatches";
|
|
6
6
|
import { getScheduledMessagesComposerConfiguration, getScheduledMessagesListConfiguration } from "../chat/uiKit";
|
|
7
|
-
import { inject, onUnmounted, ref, Ref, watchEffect } from "vue";
|
|
7
|
+
import { inject, nextTick, onMounted, onUnmounted, ref, Ref, watchEffect } from "vue";
|
|
8
8
|
import { ChatInstance } from "../chat/types";
|
|
9
9
|
import { localize } from "@cometchat/uikit-resources";
|
|
10
10
|
import { BccAlert } from "@bcc-code/design-library-vue";
|
|
@@ -24,6 +24,11 @@ const messageComposerConfiguration = getScheduledMessagesComposerConfiguration(p
|
|
|
24
24
|
const messageListConfiguration = getScheduledMessagesListConfiguration(props.originalChatUid, chatInstance, chatGroup);
|
|
25
25
|
|
|
26
26
|
function closeList() {
|
|
27
|
+
if (chatInstance?.value) {
|
|
28
|
+
chatInstance.value.userInput = document.querySelector('.messageinput-input')?.innerHTML ?? null;
|
|
29
|
+
chatInstance.value.decoyAttachment = chatInstance.value.captionedAttachment
|
|
30
|
+
chatInstance.value.captionedAttachment = null
|
|
31
|
+
}
|
|
27
32
|
emit('close');
|
|
28
33
|
}
|
|
29
34
|
|
|
@@ -40,6 +45,19 @@ watchEffect(() => {
|
|
|
40
45
|
}
|
|
41
46
|
})
|
|
42
47
|
|
|
48
|
+
onMounted(async () => {
|
|
49
|
+
await nextTick();
|
|
50
|
+
const userInput = document.querySelector('.messageinput-input');
|
|
51
|
+
if (userInput && chatInstance?.value.userInput) {
|
|
52
|
+
userInput.innerHTML = chatInstance.value.userInput;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (chatInstance?.value.decoyAttachment) {
|
|
56
|
+
chatInstance.value.captionedAttachment = chatInstance.value.decoyAttachment
|
|
57
|
+
chatInstance.value.decoyAttachment = null
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
43
61
|
onUnmounted(() => {
|
|
44
62
|
if (chatInstance) {
|
|
45
63
|
chatInstance.value.captionedAttachment = null
|