@bcc-code/vue-bcc-chat-ui 3.35.0 → 3.39.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.35.0",
5
+ "version": "3.39.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -22,6 +22,7 @@ import BccScheduledMessages from "./BccScheduledMessages.vue";
22
22
  const props = defineProps({
23
23
  chatUid: { type: String, required: true },
24
24
  senderDisplayName: { type: String, required: false },
25
+ hideDeletedMessages: { type: Boolean, required: false, default: false },
25
26
  groupMessageGetter: {
26
27
  type: Function as PropType<(guid: string, query: string) => Promise<any>>,
27
28
  required: false,
@@ -40,6 +41,7 @@ const chatInstance: Ref<ChatInstance> = ref({
40
41
  decoyAttachment: null,
41
42
  showScheduledMessagesChat: false,
42
43
  showAlert: false,
44
+ showRescheduleAlert: false,
43
45
  userInput: null,
44
46
  rescheduleInfo: null
45
47
  });
@@ -142,7 +144,7 @@ function closeScheduledMessage() {
142
144
  <div>Connecting: {{chat.connecting.value}}</div>
143
145
  <div>CometChat: {{cometChatStatus}} <button @click="getCometChatStatus()">[refresh]</button></div>
144
146
  </div> -->
145
- <BccChatMessages v-if="chatGroup && !chatInstance.showScheduledMessagesChat" :chatGroup="chatGroup"
147
+ <BccChatMessages v-if="chatGroup && !chatInstance.showScheduledMessagesChat" :chatGroup="chatGroup" :hide-deleted-messages="props.hideDeletedMessages"
146
148
  :chatUid="props.chatUid"></BccChatMessages>
147
149
  <BccScheduledMessages v-else-if="chatGroup && chatInstance.showScheduledMessagesChat"
148
150
  class="bcc-scheduled-message-list" :chatGroup="chatInstance.scheduledMessageChat!"
@@ -11,14 +11,15 @@ import { MessageComposerConfiguration } from "@cometchat/uikit-shared";
11
11
 
12
12
  const props = defineProps({
13
13
  chatUid: { type: String, required: true },
14
- chatGroup: { type: Group, required: true }
14
+ chatGroup: { type: Group, required: true },
15
+ hideDeletedMessages: { type: Boolean, required: false, default: false }
15
16
  })
16
17
 
17
18
  const chatGroup = ref<Group>();
18
19
 
19
20
  const chatInstance = inject<Ref<ChatInstance>>("chatInstance");
20
21
  const messageComposerConfiguration = getMessageComposerConfiguration(chatInstance);
21
- const messageListConfiguration = getMessageListConfiguration(chatInstance, chatGroup);
22
+ const messageListConfiguration = getMessageListConfiguration(props.hideDeletedMessages, chatInstance, chatGroup);
22
23
  const threadedMessagesConfiguration = getThreadedMessagesConfiguration(chatGroup);
23
24
  threadedMessagesConfiguration.messageComposerConfiguration = getThreadedMessageComposerConfig();
24
25
 
@@ -4,7 +4,13 @@ import { localize } from '@cometchat/uikit-resources';
4
4
  import { computed, onMounted, ref } from 'vue';
5
5
  import "../style.css";
6
6
 
7
- const emit = defineEmits(['close', 'send']);
7
+ const props = defineProps({
8
+ isReschedule: { type: Boolean, default: false }
9
+ })
10
+
11
+ const title = props.isReschedule ? localize("RESCHEDULE") : localize("SCHEDULE_MESSAGE")
12
+
13
+ const emit = defineEmits(['close', 'schedule', 'reschedule']);
8
14
 
9
15
  const dateInput = ref<string>();
10
16
  const timeInput = ref<string>();
@@ -14,8 +20,6 @@ const localDateTime = computed<string>(() => {
14
20
  return new Date(dateInput.value + "T" + timeInput.value).toISOString()
15
21
  })
16
22
 
17
- const title = ref(localize("SCHEDULE_MESSAGE"));
18
-
19
23
  const isDateInFuture = computed<boolean>(() => {
20
24
  if (dateInput.value === '' || timeInput.value === '') return false
21
25
  return new Date(localDateTime.value) > new Date();
@@ -37,14 +41,14 @@ function close() {
37
41
 
38
42
  function scheduleMessage() {
39
43
  if (isDateInFuture && !messageSent.value) {
40
- emit('send', localDateTime.value)
44
+ emit(props.isReschedule ? 'reschedule' : 'schedule', localDateTime.value)
41
45
  messageSent.value = true;
42
46
  }
43
47
  }
44
48
  </script>
45
49
 
46
50
  <template>
47
- <BccModal class="modal" :title=title :open="true" @close="close()" :closeButton="true">
51
+ <BccModal class="modal" :title="title" :open="true" @close="close()" :closeButton="true">
48
52
  <div class="flex flex-col w-full">
49
53
  <div class="flex flex-row w-full justify-between">
50
54
  <input class="input" type="date" v-model="dateInput" required>
@@ -65,6 +65,7 @@ onUnmounted(() => {
65
65
  chatInstance.value.scheduledMessageChat = undefined
66
66
  chatInstance.value.showScheduledMessagesChat = false
67
67
  chatInstance.value.showAlert = false
68
+ chatInstance.value.rescheduleInfo = null
68
69
  }
69
70
  })
70
71
 
@@ -90,6 +91,10 @@ onUnmounted(() => {
90
91
  :open="chatInstance!.showAlert" @close="chatInstance!.showAlert = false">
91
92
  {{ localize("ERROR_SENDING_SCHEDULED_MESSAGE") }}
92
93
  </BccAlert>
94
+ <BccAlert class="absolute top-0 w-[97%] mx-2 mt-11" icon closeButton context="danger"
95
+ :open="chatInstance!.showRescheduleAlert" @close="chatInstance!.showRescheduleAlert = false">
96
+ {{ localize("ERROR_RESCHEDULING_MESSAGE") }}
97
+ </BccAlert>
93
98
  </div>
94
99
  </div>
95
100
  </template>
@@ -10,6 +10,8 @@ const props = defineProps({
10
10
  chatUid: { type: String, required: true }
11
11
  })
12
12
 
13
+ const isReschedule = ref<boolean>(false);
14
+
13
15
  const chatInstance = inject<Ref<ChatInstance>>("chatInstance");
14
16
  const vueInstance: any = getCurrentInstance();
15
17
  const msgComposerData = vueInstance?.parent?.type?.name === "CometChatMessageComposer" && vueInstance?.parent?.setupState;
@@ -53,8 +55,10 @@ onBeforeUnmount(() => {
53
55
 
54
56
  watchEffect(async () => {
55
57
  if (chatInstance && chatInstance.value.rescheduleInfo) {
58
+ isReschedule.value = true;
56
59
  showModal.value = true;
57
60
  } else {
61
+ isReschedule.value = false;
58
62
  showModal.value = false;
59
63
  }
60
64
  })
@@ -74,22 +78,32 @@ function closeModal() {
74
78
 
75
79
  function scheduleMessage(scheduleDate?: string) {
76
80
  if (scheduleDate && chatInstance) {
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
- }
81
+ sendScheduledMessage(scheduleDate, props.chatUid, chatInstance).then((msgSuccessful) => {
82
+ if (!msgSuccessful) {
83
+ showModal.value = false
84
+ chatInstance.value.showAlert = true
85
+ setTimeout(() => chatInstance.value.showAlert = false, 5000)
86
+ } else {
87
+ showModal.value = false
88
+ msgComposerData.messageText = "";
89
+ msgComposerData.textRef = "";
90
+ msgComposerData.inputRef?.emptyInputField();
91
+ }
92
+ });
93
+ }
94
+ }
95
+
96
+ function reschedule(scheduleDate?: string) {
97
+ if (scheduleDate && chatInstance && chatInstance.value.rescheduleInfo) {
98
+ rescheduleMessage(scheduleDate, props.chatUid, chatInstance.value.rescheduleInfo.rescheduleMuid, chatInstance.value.rescheduleInfo.messageId).then((successful) => {
99
+ if (!successful) {
100
+ showModal.value = false
101
+ chatInstance.value.showRescheduleAlert = true
102
+ setTimeout(() => chatInstance.value.showRescheduleAlert = false, 5000)
103
+ } else {
104
+ showModal.value = false
105
+ }
106
+ })
93
107
  }
94
108
  }
95
109
  </script>
@@ -99,5 +113,6 @@ function scheduleMessage(scheduleDate?: string) {
99
113
  <cometchat-button :iconURL="sendButtonIconURL" :buttonStyle="sendButtonStyle"
100
114
  :hoverText="localize('SCHEDULE_MESSAGE')" @click="sendMessage()" />
101
115
  </div>
102
- <BccScheduledMessageModal v-if="showModal" @close="closeModal()" @send="scheduleMessage"></BccScheduledMessageModal>
116
+ <BccScheduledMessageModal v-if="showModal" @close="closeModal()" @schedule="scheduleMessage" @reschedule="reschedule" :isReschedule="isReschedule">
117
+ </BccScheduledMessageModal>
103
118
  </template>