@bcc-code/vue-bcc-chat-ui 3.26.0 → 3.27.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.26.0",
5
+ "version": "3.27.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -28,7 +28,7 @@ threadedMessagesConfiguration.messageComposerConfiguration = getThreadedMessageC
28
28
 
29
29
  onMounted(async () => {
30
30
  chatGroup.value = props.chatGroup
31
- attachEventlisteners();
31
+ // attachEventlisteners();
32
32
 
33
33
  await nextTick();
34
34
  const userInput = document.querySelector('.messageinput-input');
@@ -41,9 +41,9 @@ onMounted(async () => {
41
41
  }
42
42
  })
43
43
 
44
- onUnmounted(() => {
45
- detachEventlisteners();
46
- })
44
+ // onUnmounted(() => {
45
+ // detachEventlisteners();
46
+ // })
47
47
 
48
48
  watch(() => props.chatGroup,
49
49
  (group) => {
@@ -66,8 +66,8 @@ watchEffect(() => {
66
66
  chatUid: props.chatUid
67
67
  }
68
68
  };
69
- detachEventlisteners()
70
- attachEventlisteners()
69
+ // detachEventlisteners()
70
+ // attachEventlisteners()
71
71
  } else {
72
72
  if (chatInstance && chatInstance.value.replyToMessage) {
73
73
  messageComposerConfiguration.value.headerView = {
@@ -89,37 +89,92 @@ function getThreadedMessageComposerConfig(): MessageComposerConfiguration {
89
89
  return composerConfig;
90
90
  }
91
91
 
92
- function attachEventlisteners() {
93
- const interval = setInterval(() => {
94
- const btns = document.querySelectorAll('.cc-messagecomposer-wrapper__sendbutton');
95
- const sendButton = btns[btns.length - 1]
96
-
97
- if (sendButton) {
98
- sendButton.addEventListener("pointerdown", onMouseDown);
99
- sendButton.addEventListener("pointerup", clearTimer);
100
- sendButton.addEventListener("mouseleave", clearTimer);
101
- sendButton.addEventListener("touchstart", onMouseDown);
102
- sendButton.addEventListener("touchend", clearTimer);
103
- sendButton.addEventListener("touchcancel", clearTimer);
92
+ // Holding functionality temporarily disabled due to some bugs
93
+ //
94
+ // function attachEventlisteners() {
95
+ // const interval = setInterval(() => {
96
+ // const btns = document.querySelectorAll('.cc-messagecomposer-wrapper__sendbutton');
97
+ // const sendButton = btns[btns.length - 1]
98
+ // document.querySelector("body")?.addEventListener("contextmenu", (event) => event.preventDefault());
99
+
100
+ // if (sendButton) {
101
+ // sendButton.addEventListener("pointerdown", onMouseDown);
102
+ // sendButton.addEventListener("pointerup", clearTimer);
103
+ // sendButton.addEventListener("mouseleave", clearTimer);
104
+ // sendButton.addEventListener("contextmenu", onContextMenu);
105
+ // clearInterval(interval)
106
+ // }
107
+ // }, 500);
108
+ // }
109
+
110
+ // function detachEventlisteners() {
111
+ // const btns = document.querySelectorAll('.cc-messagecomposer-wrapper__sendbutton');
112
+ // const sendButton = btns[btns.length - 1]
113
+
114
+ // if (sendButton) {
115
+ // sendButton.removeEventListener("pointerdown", onMouseDown);
116
+ // sendButton.removeEventListener("pointerup", clearTimer);
117
+ // sendButton.removeEventListener("mouseleave", clearTimer);
118
+ // sendButton.removeEventListener("contextmenu", onContextMenu);
119
+ // }
120
+ // }
121
+
122
+ // function closeModal() {
123
+ // showModal.value = false;
124
+ // }
125
+
126
+ // const showModal = ref(false);
127
+ // let timerId: string | number | NodeJS.Timeout | null | undefined;
128
+ // const duration = 500;
129
+ // let longPressDetected = false;
130
+
131
+ // const openPopup = () => {
132
+ // showModal.value = true;
133
+ // }
134
+
135
+ // const onMouseDown = (event: Event) => {
136
+ // const userInput = document.querySelector(".messageinput-input")?.innerText;
137
+ // event.preventDefault();
138
+ // event.stopPropagation();
139
+ // if (userInput) {
140
+ // // Only handle long press when there is user input
141
+ // timerId = setTimeout(() => {
142
+ // longPressDetected = true;
143
+ // openPopup();
144
+ // }, duration); // assuming duration is 500ms for long press
145
+ // }
146
+ // };
147
+
148
+ // const onContextMenu = (event: Event) => {
149
+ // if (longPressDetected) {
150
+ // // Prevent context menu only when long press is detected
151
+ // event.preventDefault();
152
+ // event.stopPropagation();
153
+ // }
154
+ // };
155
+
156
+ // const clearTimer = (event: Event) => {
157
+ // event.preventDefault();
158
+ // event.stopPropagation();
159
+ // if (timerId !== null) {
160
+ // clearTimeout(timerId);
161
+ // timerId = null;
162
+ // }
163
+ // }
104
164
 
105
- clearInterval(interval)
106
- }
107
- }, 500);
108
- }
165
+ const showAlert = ref<boolean>(false)
109
166
 
110
- function detachEventlisteners() {
111
- const btns = document.querySelectorAll('.cc-messagecomposer-wrapper__sendbutton');
112
- const sendButton = btns[btns.length - 1]
113
-
114
- if (sendButton) {
115
- sendButton.removeEventListener("pointerdown", onMouseDown);
116
- sendButton.removeEventListener("pointerup", clearTimer);
117
- sendButton.removeEventListener("mouseleave", clearTimer);
118
- sendButton.removeEventListener("touchstart", onMouseDown);
119
- sendButton.removeEventListener("touchend", clearTimer);
120
- sendButton.removeEventListener("touchcancel", clearTimer);
121
- }
122
- }
167
+ // function scheduleMessage(scheduleDate?: string) {
168
+ // if (scheduleDate && chatInstance) {
169
+ // sendScheduledMessage(scheduleDate, props.chatUid, chatInstance).then((msgSuccessful) => {
170
+ // if (!msgSuccessful) {
171
+ // showModal.value = false
172
+ // showAlert.value = true
173
+ // setTimeout(() => showAlert.value = false, 3000)
174
+ // }
175
+ // })
176
+ // }
177
+ // }
123
178
 
124
179
  function isChannel(): boolean {
125
180
  return (props.chatGroup.getMetadata() as any)?.isChannel;
@@ -132,49 +187,6 @@ function isParticipant(): boolean {
132
187
  }
133
188
  return chatGroup.value?.getScope() == "participant";
134
189
  }
135
-
136
- function closeModal() {
137
- showModal.value = false;
138
- }
139
-
140
- const showAlert = ref<boolean>(false)
141
-
142
- function scheduleMessage(scheduleDate?: string) {
143
- if (scheduleDate && chatInstance) {
144
- sendScheduledMessage(scheduleDate, props.chatUid, chatInstance).then((msgSuccessful) => {
145
- if (!msgSuccessful) {
146
- showModal.value = false
147
- showAlert.value = true
148
- setTimeout(() => showAlert.value = false, 3000)
149
- }
150
- })
151
- }
152
- }
153
- const showModal = ref(false);
154
- let timerId: string | number | NodeJS.Timeout | null | undefined;
155
- const duration = 500;
156
-
157
- const openPopup = () => {
158
- showModal.value = true;
159
- }
160
-
161
- const onMouseDown = () => {
162
- const userInput = document.querySelector(".messageinput-input")?.innerText;
163
-
164
- if (userInput) {
165
- timerId = setTimeout(() => {
166
- openPopup();
167
- }, duration)
168
- }
169
- }
170
-
171
- const clearTimer = () => {
172
- if (timerId !== null) {
173
- clearTimeout(timerId);
174
- timerId = null;
175
- }
176
- }
177
-
178
190
  </script>
179
191
 
180
192
  <template>
@@ -189,11 +201,11 @@ const clearTimer = () => {
189
201
  <span v-if="chat.onlineStatus.value === 'offline'">Waiting for network...</span>
190
202
  <span v-else>Connecting...</span>
191
203
  </div>
192
- <BccScheduledMessageModal v-if="showModal" @close="closeModal()" @send="scheduleMessage">
204
+ <!-- <BccScheduledMessageModal v-if="showModal" @close="closeModal()" @send="scheduleMessage">
193
205
  </BccScheduledMessageModal>
194
206
  <BccAlert class="absolute top-0 w-[97%] mx-2 mt-1" icon closeButton context="danger" :open="showAlert"
195
207
  @close="showAlert = false">
196
208
  {{ localize("ERROR_SENDING_SCHEDULED_MESSAGE") }}
197
- </BccAlert>
209
+ </BccAlert> -->
198
210
  </div>
199
211
  </template>
@@ -102,6 +102,7 @@ function scheduleMessage() {
102
102
 
103
103
  .modal {
104
104
  position: fixed;
105
+ width: 90%;
105
106
  top: 50%;
106
107
  left: 50%;
107
108
  transform: translate(-50%, -50%);
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { BccAlert, BccButton, BccModal } from '@bcc-code/design-library-vue';
3
3
  import { localize } from "@cometchat/uikit-resources";
4
- import { SendIcon } from "@cometchat/chat-uikit-vue";
4
+ import { MessageComposerConfiguration, SendIcon } from "@cometchat/chat-uikit-vue";
5
5
  import { getCurrentInstance, inject, onBeforeUnmount, onMounted, Ref, ref } from "vue";
6
6
  import { ChatInstance } from '../chat/types';
7
7
  import { sendScheduledMessage } from '../chat/scheduledMessage';
@@ -14,7 +14,7 @@ const props = defineProps({
14
14
  const chatInstance = inject<Ref<ChatInstance>>("chatInstance");
15
15
  const vueInstance: any = getCurrentInstance();
16
16
  const msgComposerData = vueInstance?.parent?.type?.name === "CometChatMessageComposer" && vueInstance?.parent?.setupState;
17
- // const msgComposerProps = vueInstance?.parent?.type?.name === "CometChatMessageComposer" && vueInstance?.parent?.props;
17
+ const msgComposerProps = vueInstance?.parent?.type?.name === "CometChatMessageComposer" && vueInstance?.parent?.props;
18
18
 
19
19
  const sendButtonIconURL = SendIcon;
20
20
  const sendButtonStyle = {
@@ -55,7 +55,10 @@ onBeforeUnmount(() => {
55
55
  const showModal = ref(false);
56
56
 
57
57
  function openModal() {
58
- showModal.value = true;
58
+ const userInput = document.querySelector(".messageinput-input")?.innerText;
59
+ if ((userInput && userInput !== "") || msgComposerProps.headerView !== undefined) {
60
+ showModal.value = true;
61
+ }
59
62
  }
60
63
 
61
64
  function closeModal() {