@bcc-code/vue-bcc-chat-ui 6.5.0 → 7.0.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.
Files changed (80) hide show
  1. package/dist/assets/index-B_y7vs2y.js +12519 -0
  2. package/dist/assets/index-uEhSMl7W.css +1 -0
  3. package/dist/assets/primeicons-C6QP2o4f.woff2 +0 -0
  4. package/dist/assets/primeicons-DMOk5skT.eot +0 -0
  5. package/dist/assets/primeicons-Dr5RGzOO.svg +345 -0
  6. package/dist/assets/primeicons-MpK4pl85.ttf +0 -0
  7. package/dist/assets/primeicons-WjwUDZjB.woff +0 -0
  8. package/dist/assets/web-Cp3vw--c.js +1 -0
  9. package/dist/assets/web-DSc1BjG7.js +1 -0
  10. package/dist/index.html +13 -0
  11. package/package.json +42 -51
  12. package/README.md +0 -89
  13. package/dist/App.vue.d.ts +0 -2
  14. package/dist/chat/accessToken.d.ts +0 -3
  15. package/dist/chat/bccuiExtension.d.ts +0 -7
  16. package/dist/chat/cacheScope.d.ts +0 -13
  17. package/dist/chat/captionedAttachment.d.ts +0 -7
  18. package/dist/chat/captionedAttachmentExtension.d.ts +0 -7
  19. package/dist/chat/cometChatPatches.d.ts +0 -3
  20. package/dist/chat/connection.d.ts +0 -14
  21. package/dist/chat/data.d.ts +0 -24
  22. package/dist/chat/environment.d.ts +0 -3
  23. package/dist/chat/index.d.ts +0 -453
  24. package/dist/chat/logger.d.ts +0 -12
  25. package/dist/chat/login.d.ts +0 -14
  26. package/dist/chat/message.d.ts +0 -15
  27. package/dist/chat/replyExtension.d.ts +0 -26
  28. package/dist/chat/replyStyle.d.ts +0 -30
  29. package/dist/chat/rescheduleExtension.d.ts +0 -22
  30. package/dist/chat/scheduledMessage.d.ts +0 -4
  31. package/dist/chat/styleFix.d.ts +0 -14
  32. package/dist/chat/theme.d.ts +0 -408
  33. package/dist/chat/translations.d.ts +0 -3
  34. package/dist/chat/types.d.ts +0 -123
  35. package/dist/chat/uiKit.d.ts +0 -10
  36. package/dist/component-overrides/BccBubbleWrapper.vue.d.ts +0 -156
  37. package/dist/component-overrides/CometChatMessageListOverride.vue.d.ts +0 -2
  38. package/dist/components/BccAttachmentBox.vue.d.ts +0 -29
  39. package/dist/components/BccAttachmentPreview.vue.d.ts +0 -23
  40. package/dist/components/BccChatMessageBubble.vue.d.ts +0 -99
  41. package/dist/components/BccChatMessageList.vue.d.ts +0 -82
  42. package/dist/components/BccChatMessages.vue.d.ts +0 -33
  43. package/dist/components/BccChatSendButton.vue.d.ts +0 -4
  44. package/dist/components/BccCometChatFullScreenViewer.vue.d.ts +0 -24
  45. package/dist/components/BccFileBubble.vue.d.ts +0 -70
  46. package/dist/components/BccImageBubble.vue.d.ts +0 -27
  47. package/dist/components/BccReplyBox.vue.d.ts +0 -36
  48. package/dist/components/BccReplyPreview.vue.d.ts +0 -30
  49. package/dist/components/BccScheduledMessageIcon.vue.d.ts +0 -2
  50. package/dist/components/BccScheduledMessageModal.vue.d.ts +0 -31
  51. package/dist/components/BccScheduledMessages.vue.d.ts +0 -25
  52. package/dist/components/BccScheduledSendButton.vue.d.ts +0 -14
  53. package/dist/index.d.ts +0 -4
  54. package/dist/main.d.ts +0 -1
  55. package/dist/offline/cometChatAPIInterceptor.d.ts +0 -2
  56. package/dist/offline/cometChatWSInterceptor.d.ts +0 -2
  57. package/dist/offline/connectivity.d.ts +0 -5
  58. package/dist/offline/failedSendingRetry.d.ts +0 -4
  59. package/dist/offline/index.d.ts +0 -10
  60. package/dist/offline/offlineStoreLocalStorage.d.ts +0 -32
  61. package/dist/offline/types.d.ts +0 -69
  62. package/dist/vite.svg +0 -1
  63. package/dist/vue-bcc-chat-ui.css +0 -1
  64. package/dist/vue-bcc-chat-ui.js +0 -86486
  65. package/dist/vue-bcc-chat-ui.js.map +0 -1
  66. package/src/components/BccAttachmentBox.vue +0 -133
  67. package/src/components/BccAttachmentPreview.vue +0 -57
  68. package/src/components/BccChatMessageBubble.vue +0 -219
  69. package/src/components/BccChatMessageList.vue +0 -488
  70. package/src/components/BccChatMessages.vue +0 -212
  71. package/src/components/BccChatSendButton.vue +0 -91
  72. package/src/components/BccCometChatFullScreenViewer.vue +0 -118
  73. package/src/components/BccFileBubble.vue +0 -137
  74. package/src/components/BccImageBubble.vue +0 -75
  75. package/src/components/BccReplyBox.vue +0 -141
  76. package/src/components/BccReplyPreview.vue +0 -113
  77. package/src/components/BccScheduledMessageIcon.vue +0 -65
  78. package/src/components/BccScheduledMessageModal.vue +0 -70
  79. package/src/components/BccScheduledMessages.vue +0 -125
  80. package/src/components/BccScheduledSendButton.vue +0 -118
@@ -1,91 +0,0 @@
1
- <script setup lang="ts">
2
- import { localize } from "@cometchat/uikit-resources";
3
- import { SendIcon } from "@cometchat/chat-uikit-vue";
4
- import { sendMediaMessage } from "../chat/captionedAttachment";
5
- import { ChatInstance } from "../chat/types";
6
- import { getCurrentInstance, inject, onBeforeUnmount, onMounted, Ref } from "vue";
7
- import chat from "../chat";
8
-
9
- const sendButtonIconURL = SendIcon;
10
- const sendButtonStyle = {
11
- height: "24px",
12
- width: "24px",
13
- border: "none",
14
- borderRadius: "0",
15
- buttonIconTint: "var(--cc__primary150, #3F4669)",
16
- background: "transparent"
17
- }
18
-
19
- const chatInstance = inject<Ref<ChatInstance>>("chatInstance");
20
- const vueInstance: any = getCurrentInstance();
21
- const msgComposerData = vueInstance?.parent?.type?.name === "CometChatMessageComposer" && vueInstance?.parent?.setupState;
22
- const msgComposerProps = vueInstance?.parent?.type?.name === "CometChatMessageComposer" && vueInstance?.parent?.props;
23
-
24
- function sendMessage() {
25
- if (chat.onlineStatus.value === "offline") return;
26
- if (!msgComposerData) return false;
27
- if (!chatInstance?.value.captionedAttachment?.fileObject) return false;
28
- if (!msgComposerProps?.group && !msgComposerProps?.user) return false;
29
-
30
- const receiverId = msgComposerProps?.group?.getGuid() || msgComposerProps?.user?.getUid();
31
- const receiverType = msgComposerProps?.group ? "group" : "user";
32
- const fileObject = chatInstance.value.captionedAttachment.fileObject;
33
- const caption = msgComposerData.messageText;
34
- const dimensions = chatInstance.value.captionedAttachment.dimensions;
35
-
36
- const sendMessageResult = sendMediaMessage(msgComposerProps, fileObject, receiverId, receiverType, "image", dimensions, caption);
37
- if (sendMessageResult) {
38
- msgComposerData.showSendButton = false;
39
- // Clear text input
40
- msgComposerData.messageText = "";
41
- msgComposerData.textRef = "";
42
- msgComposerData.inputRef?.emptyInputField();
43
- return true;
44
- }
45
- return false;
46
- }
47
-
48
- function sendMessageOnEnter(textEnteredEvent: CustomEventInit) {
49
- if (chat.onlineStatus.value === "offline") return;
50
- if (!msgComposerData) return;
51
- msgComposerData.messageText = textEnteredEvent.detail.value;
52
- if (sendMessage()) {
53
- msgComposerData.showMentionsCountWarning = false;
54
- msgComposerData.showListForMentions = false;
55
- }
56
- }
57
-
58
- // The following will send the message when **enter is pressed** in the input box and the input box **is not empty**.
59
- const originalSendMessageOnEnter = msgComposerData?.sendMessageOnEnter;
60
- onMounted(() => {
61
- if (!msgComposerData) return;
62
- msgComposerData.sendMessageOnEnter = sendMessageOnEnter;
63
- });
64
- onBeforeUnmount(() => {
65
- msgComposerData.sendMessageOnEnter = originalSendMessageOnEnter;
66
- });
67
-
68
- if (chatInstance) {
69
- // Here we add an additional onKeyDown event on the input field that sends our image when pressing Enter if the input field **is empty**.
70
- // We need this in addition to hooking into the "cc-text-input-entered" event because that event isn't triggered if the input field is empty.
71
- const ccTextInput = msgComposerData.inputRef.querySelector(".messageinput-input");
72
- ccTextInput.addEventListener("keydown", function (event: KeyboardEvent) {
73
- if (msgComposerData.messageText?.trim() == "" && event.keyCode === 13 && !event.shiftKey) sendMessage();
74
- });
75
- }
76
-
77
- </script>
78
-
79
- <template>
80
- <div class="cc-messagecomposer-wrapper__sendbutton" ref="sendButton"
81
- :style="{ 'background': !msgComposerData || !msgComposerProps ? '#f00' : 'unset' }">
82
- <cometchat-button :iconURL="sendButtonIconURL" :buttonStyle="sendButtonStyle"
83
- :hoverText="localize('SEND_MESSAGE')" @click=sendMessage() />
84
- </div>
85
- </template>
86
-
87
- <style scoped>
88
- .cc-messagecomposer-wrapper__sendbutton {
89
- margin: 0 5px
90
- }
91
- </style>
@@ -1,118 +0,0 @@
1
- <template>
2
- <div class="cc__imageviewer__full-screen-viewer">
3
- <div class="cc__imageviewer__zoom-container" ref="zoomContainer">
4
- <img class="cc__imageviewer__loading" :src="placeholderImage" v-if="!isImageLoaded" />
5
- <img :src="proxyImage(url)" @load="imageLoaded" />
6
- </div>
7
- </div>
8
- <div class="cc__imageviewer-option cc__imageviewer-option--close" @click="dispatchCloseClickEvent">
9
- <CloseIcon class="w-6 h-6 text-white" />
10
- </div>
11
- <div class="cc__imageviewer-option cc__imageviewer-option--download" @click="openImage">
12
- <DownloadIcon class="w-6 h-6 text-white" />
13
- </div>
14
- </template>
15
-
16
- <script setup lang="ts">
17
- import { CloseIcon, DownloadIcon } from '@bcc-code/icons-vue';
18
- import { CometChatIcon } from '@cometchat/chat-uikit-vue';
19
- import createPanZoom from 'panzoom';
20
- import { onBeforeUnmount, onMounted, ref } from 'vue';
21
- import { proxyImage } from '../chat/data';
22
-
23
- if (!window.customElements.get('cometchat-icon')) {
24
- window.customElements.define('cometchat-icon', CometChatIcon);
25
- }
26
-
27
- const props = defineProps({
28
- url: {
29
- type: String,
30
- required: true
31
- },
32
- placeholderImage: {
33
- type: String
34
- }
35
- });
36
-
37
- const emit = defineEmits<{
38
- (e: 'cc-close-clicked'): void;
39
- }>();
40
-
41
- const dispatchCloseClickEvent = (event: Event) => {
42
- event?.stopPropagation();
43
- emit('cc-close-clicked');
44
- };
45
-
46
- const openImage = () => {
47
- window.open(props.url, '_blank');
48
- };
49
-
50
- const isImageLoaded = ref(false);
51
- const imageLoaded = () => {
52
- isImageLoaded.value = true;
53
- }
54
-
55
- const zoomContainer = ref();
56
- let panZoomInstance: any;
57
- onMounted(() => {
58
- panZoomInstance = createPanZoom(zoomContainer.value, {
59
- bounds: true,
60
- boundsPadding: 1,
61
- maxZoom: 10,
62
- minZoom: 1,
63
- });
64
- });
65
-
66
- onBeforeUnmount(() => {
67
- panZoomInstance.dispose();
68
- })
69
- </script>
70
-
71
- <style scoped>
72
- .cc__imageviewer__full-screen-viewer {
73
- position: fixed;
74
- top: 0;
75
- left: 0;
76
- width: 100%;
77
- height: 100%;
78
- background-color: rgba(0, 0, 0, 0.9);
79
- z-index: 10000;
80
- }
81
-
82
- .cc__imageviewer__zoom-container {
83
- display: flex;
84
- align-items: center;
85
- justify-content: center;
86
- width: 100%;
87
- height: 100%;
88
- }
89
-
90
- .cc__imageviewer__loading {
91
- position: absolute;
92
- z-index: -1;
93
- }
94
-
95
- img {
96
- max-width: 100%;
97
- max-height: 100%;
98
- }
99
-
100
- .cc__imageviewer-option {
101
- position: fixed;
102
- cursor: pointer;
103
- z-index: 10001;
104
- padding: 10px;
105
- }
106
-
107
- .cc__imageviewer-option--close {
108
- top: 0;
109
- right: 0;
110
- margin-top: env(safe-area-inset-top);
111
- }
112
-
113
- .cc__imageviewer-option--download {
114
- top: 0;
115
- left: 0;
116
- margin-top: env(safe-area-inset-top);
117
- }
118
- </style>
@@ -1,137 +0,0 @@
1
- <template>
2
- <div
3
- :style="messageKitBlockStyle"
4
- class="bcc-chat-msg-bubble cc__file__bubble"
5
- >
6
- <div class="message__block">
7
- <div class="cc__file__title">
8
- <a
9
- :href="fileURL"
10
- target="_blank"
11
- :style="messageTitleStyle"
12
- class="cc__file__url"
13
- >{{ title }}</a
14
- >
15
- </div>
16
- <div :style="messageSubTitleStyle" class="cc__file__subtitle">
17
- {{ subtitle }}
18
- </div>
19
- </div>
20
- <div class="cc__file__icon">
21
- <a :href="fileURL" target="_blank">
22
- <i :style="messageFileIconStyle" />
23
- </a>
24
- </div>
25
- </div>
26
- </template>
27
-
28
- <script setup lang="ts">
29
- import { computed } from "vue";
30
-
31
- const props = defineProps({
32
- fileURL: {
33
- type: String,
34
- default: "",
35
- },
36
- downloadIconURL: {
37
- type: String,
38
- default: "",
39
- },
40
- title: {
41
- type: String,
42
- default: "",
43
- },
44
- subtitle: {
45
- type: String,
46
- default: "",
47
- },
48
- fileStyle: {
49
- type: Object,
50
- default: () => ({
51
- width: "fit-content",
52
- height: "fit-content",
53
- border: "none",
54
- background: "transparent",
55
- borderRadius: "none",
56
- titleFont: "600 14px Archivo,Inter,sans-serif",
57
- titleColor: "rgb(20, 20, 20)",
58
- subtitleFont: "400 13px Archivo,Inter,sans-serif",
59
- subtitleColor: "rgba(20, 20, 20, 0.58)",
60
- }),
61
- },
62
- });
63
-
64
- const downloadIcon =
65
- "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%3Csvg%20width%3D%2224px%22%20height%3D%2224px%22%20viewBox%3D%220%200%2024%2024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%20%20%20%20%3Ctitle%3EIcons%2F24%2FDownload%3C%2Ftitle%3E%20%20%20%20%3Cg%20id%3D%22Icons%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%20%20%20%20%20%20%20%20%3Cg%20id%3D%22Icons%2F24%2FDownload%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20id%3D%22Group%22%20transform%3D%22translate%281.000000%2C%201.000000%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpolyline%20id%3D%22Path%22%20points%3D%227.33333333%2013.2%2011%2016.8666667%2014.6666667%2013.2%22%3E%3C%2Fpolyline%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cline%20x1%3D%2211%22%20y1%3D%225.86666667%22%20x2%3D%2211%22%20y2%3D%2216.8666667%22%20id%3D%22Path%22%3E%3C%2Fline%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M0%2C11%20C0%2C17.0751322%204.92486775%2C22%2011%2C22%20C17.0751322%2C22%2022%2C17.0751322%2022%2C11%20C22%2C4.92486775%2017.0751322%2C0%2011%2C0%20C4.92486775%2C0%200%2C4.92486775%200%2C11%20Z%22%20id%3D%22Path%22%3E%3C%2Fpath%3E%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%3C%2Fg%3E%3C%2Fsvg%3E";
66
- const downloadIconURL = props.downloadIconURL ?? downloadIcon;
67
-
68
- const messageKitBlockStyle = computed(() => ({
69
- width: props.fileStyle.width,
70
- height: props.fileStyle.height,
71
- border: props.fileStyle.border,
72
- borderRadius: props.fileStyle.borderRadius,
73
- background: props.fileStyle.background,
74
- }));
75
-
76
- const messageTitleStyle = computed(() => ({
77
- font: props.fileStyle.titleFont,
78
- color: props.fileStyle.titleColor,
79
- }));
80
-
81
- const messageSubTitleStyle = computed(() => ({
82
- font: props.fileStyle.subtitleFont,
83
- color: props.fileStyle.subtitleColor,
84
- }));
85
-
86
- const messageFileIconStyle = computed(() => {
87
- let isDisable = !props.fileURL;
88
- return {
89
- WebkitMask: `url(${downloadIconURL})`,
90
- WebkitMaskSize: "contain",
91
- opacity: isDisable ? 0.5 : 1,
92
- };
93
- });
94
- </script>
95
-
96
- <style scoped>
97
- .cc__file__bubble {
98
- background: transparent;
99
- display: flex;
100
- justify-content: space-between;
101
- overflow: hidden;
102
- width: 100%;
103
- box-sizing: border-box;
104
- gap: 8px;
105
- }
106
- .message__block {
107
- word-wrap: break-word;
108
- text-align: left;
109
- overflow: hidden;
110
- }
111
- .cc__file__title {
112
- overflow: hidden;
113
- overflow-wrap: anywhere;
114
- }
115
- .cc__file__url {
116
- all: unset;
117
- color: var(--cc__text-color);
118
- cursor: pointer;
119
- }
120
- .cc__file__subtitle {
121
- margin-top: 4px;
122
- }
123
- .cc__file__icon {
124
- display: flex;
125
- align-items: flex-start;
126
- justify-content: flex-end;
127
- width: fit-content;
128
- line-height: 36px;
129
- }
130
- .cc__file__icon i {
131
- display: inline-block;
132
- width: 24px;
133
- height: 24px;
134
- cursor: pointer;
135
- background: var(--cc__accent);
136
- }
137
- </style>
@@ -1,75 +0,0 @@
1
- <script setup lang="ts">
2
- import { MediaMessage } from '@cometchat/chat-sdk-javascript';
3
- import { ref } from 'vue';
4
- import BccCometChatFullScreenViewer from './BccCometChatFullScreenViewer.vue';
5
-
6
-
7
- const props = defineProps({
8
- src: {
9
- type: String,
10
- default: null
11
- },
12
- placeholderImage: {
13
- type: String
14
- },
15
- message: {
16
- type: MediaMessage
17
- }
18
- })
19
-
20
- const imgDimensions = (props.message?.getMetadata() as any)?.dimensions || { width: 300, height: 150 };
21
-
22
- const imageLoaded = ref(false);
23
- const openFullscreenView = ref(false);
24
- const imageurlToOpen = ref("");
25
-
26
- async function openImageInFullScreen() {
27
- imageurlToOpen.value = props.message?.getAttachments()[0]?.getUrl() || props.src;
28
- openFullscreenView.value = true;
29
- }
30
-
31
- function closeImageInFullScreen() {
32
- imageurlToOpen.value = "";
33
- openFullscreenView.value = false;
34
- }
35
- </script>
36
-
37
- <template>
38
- <div class="bcc-image_container">
39
- <div class="bg-gradient-to-tr from-brand-200 to-brand-50 dark:from-brand-900 dark:to-brand-700"
40
- :class="{ 'animate-pulse': !imageLoaded }"
41
- :style="!imageLoaded ? `width: ${imgDimensions.width}px; height: ${imgDimensions.height}px` : ''"
42
- >
43
- <img @load="imageLoaded = true" :src="src" @click="openImageInFullScreen" />
44
- </div>
45
- </div>
46
- <BccCometChatFullScreenViewer
47
- v-if="openFullscreenView"
48
- @CcCloseClicked="closeImageInFullScreen"
49
- :placeholder-image="placeholderImage"
50
- :url="imageurlToOpen"
51
- />
52
- </template>
53
-
54
- <style scoped>
55
- .bcc-image_container {
56
- max-height: 300px;
57
- justify-content: center;
58
- overflow: hidden;
59
- border-radius: 10px;
60
- isolation: isolate;
61
- min-height: 28px;
62
- min-width: 84px;
63
- }
64
- .bcc-image_container img {
65
- max-height: 500px;
66
- max-width: 400px;
67
- object-fit: contain;
68
- object-position: center;
69
- position: relative;
70
- }
71
-
72
- .bcc-image_container .placeholder::before {
73
- content: "⌛";
74
- }
75
- </style>
@@ -1,141 +0,0 @@
1
- <script setup lang="ts">
2
- import {
3
- CometChatMessageEvents,
4
- CometChatTheme,
5
- MessageStatus,
6
- } from "@cometchat/uikit-resources";
7
- import { CloseIcon } from "@cometchat/chat-uikit-vue";
8
- import {
9
- getCurrentInstance,
10
- ref,
11
- inject,
12
- Ref,
13
- onBeforeUnmount,
14
- onMounted,
15
- } from "vue";
16
- import { ChatInstance } from "../chat/types";
17
- import { ReplyPreviewStyle } from "../chat/replyStyle";
18
- import { BaseMessage } from "@cometchat/chat-sdk-javascript";
19
- import BccReplyPreview from "./BccReplyPreview.vue";
20
-
21
- const props = defineProps({
22
- replyToMessage: { type: BaseMessage },
23
- titlePrefix: { type: String },
24
- closeButtonIconURL: { type: String, default: CloseIcon },
25
- previewStyle: { type: Object, default: {} },
26
- });
27
-
28
- const chatInstance = inject<Ref<ChatInstance>>("chatInstance");
29
- const vueInstance: any = getCurrentInstance();
30
- const msgComposerData = vueInstance?.parent?.type?.name === "CometChatMessageComposer" && vueInstance?.parent?.setupState;
31
-
32
- const { theme } = inject("theme", { theme: ref(new CometChatTheme({})) });
33
- const previewStyle = new ReplyPreviewStyle(props.previewStyle, theme.value);
34
-
35
- function closePreview(_event?: MouseEvent) {
36
- if (chatInstance) {
37
- chatInstance.value.replyToMessage = null;
38
- }
39
- }
40
-
41
- const onMessageEditStart = CometChatMessageEvents.ccMessageEdited.subscribe(
42
- ({ status }) => {
43
- if (status === MessageStatus.inprogress) {
44
- closePreview();
45
- }
46
- }
47
- );
48
-
49
- const onMessageSend = CometChatMessageEvents.ccMessageSent.subscribe(
50
- ({ status }) => {
51
- if (status === MessageStatus.inprogress) {
52
- closePreview();
53
- }
54
- }
55
- );
56
-
57
- let originalGetAttachmentOptions: Function;
58
- onMounted(() => {
59
- if (msgComposerData && chatInstance) {
60
- msgComposerData.inputRef.querySelector(".messageinput-input").focus()
61
- if (msgComposerData.messageToBeEdited) {
62
- msgComposerData.showPreview = false; // This is only used for edit message preview
63
- msgComposerData.messageToBeEdited = null;
64
- msgComposerData.messageText = "";
65
- msgComposerData.textRef = "";
66
- msgComposerData.inputRef?.emptyInputField();
67
- }
68
- originalGetAttachmentOptions = msgComposerData.getAttachmentOptions;
69
- msgComposerData.getAttachmentOptions = function() {
70
- return originalGetAttachmentOptions().filter((option: any) => option.id === "captionedimage");
71
- }
72
- }
73
- });
74
-
75
- onBeforeUnmount(() => {
76
- msgComposerData.getAttachmentOptions = originalGetAttachmentOptions;
77
- onMessageEditStart.unsubscribe();
78
- onMessageSend.unsubscribe();
79
- });
80
-
81
- const closeBtnIconStyle = () => {
82
- return {
83
- buttonIconTint: previewStyle?.closeButtonIconTint,
84
- height: "14px",
85
- width: "14px",
86
- border: "none",
87
- borderRadius: "0",
88
- background: "transparent",
89
- display: "flex",
90
- justifyContent: "center",
91
- alignItems: "center",
92
- };
93
- };
94
-
95
- const wrapperStyle = () => {
96
- return {
97
- background: previewStyle?.background,
98
- border: previewStyle?.border,
99
- height: previewStyle?.height,
100
- width: previewStyle?.width,
101
- borderRadius: previewStyle?.borderRadius,
102
- };
103
- };
104
- </script>
105
-
106
- <template>
107
- <div class="bcc__reply_box" :style="wrapperStyle()">
108
- <BccReplyPreview
109
- titlePrefix="Reply to "
110
- :replyToMessage="props.replyToMessage"
111
- :previewStyle="previewStyle"
112
- />
113
- <div class="bcc__reply_preview__close" @click="closePreview">
114
- <cometchat-button
115
- :buttonStyle="closeBtnIconStyle()"
116
- :iconURL="props.closeButtonIconURL"
117
- ></cometchat-button>
118
- </div>
119
- </div>
120
- </template>
121
-
122
- <style>
123
- .cc-messagecomposer-wrapper__headerview {
124
- position: static !important;
125
- }
126
- </style>
127
- <style scoped>
128
- .bcc__reply_box {
129
- padding: 8px;
130
- display: flex;
131
- flex-direction: row;
132
- justify-content: space-between;
133
- margin: 0;
134
- min-height: 30px;
135
- }
136
- .bcc__reply_preview__close {
137
- width: 14px;
138
- height: 14px;
139
- display: inline-block;
140
- }
141
- </style>
@@ -1,113 +0,0 @@
1
- <script setup lang="ts">
2
- import { BaseMessage, MediaMessage } from "@cometchat/chat-sdk-javascript";
3
- import { CometChatTheme, CometChatUIKitConstants } from "@cometchat/uikit-resources";
4
- import { inject, ref } from "vue";
5
- import chat from '../chat';
6
- import { getMessageTextPreview, getSenderDisplayName, proxyImage } from "../chat/data";
7
- import { ReplyPreviewStyle } from "../chat/replyStyle";
8
-
9
- const props = defineProps({
10
- replyToMessage: { type: BaseMessage },
11
- titlePrefix: { type: String, default: "" },
12
- previewStyle: { type: Object, default: {} },
13
- });
14
-
15
- const { theme } = inject("theme", { theme: ref(new CometChatTheme({})) });
16
- const previewStyle = new ReplyPreviewStyle(props.previewStyle, theme.value);
17
-
18
- const subtitleStyle = () => {
19
- return {
20
- font: previewStyle?.subtitleFont,
21
- color: previewStyle?.subtitleColor,
22
- };
23
- };
24
-
25
- const titleStyle = () => {
26
- return {
27
- font: previewStyle?.titleFont,
28
- color: previewStyle?.titleColor,
29
- };
30
- }
31
-
32
- const barStyle = () => {
33
- return {
34
- insetInlineStart: previewStyle?.barLeftPosition,
35
- width: previewStyle?.barWidth,
36
- background: previewStyle?.barBackground,
37
- opacity: previewStyle?.barOpacity,
38
- };
39
- };
40
-
41
- const previewWrapperStyle = () => {
42
- return {
43
- padding: previewStyle?.previewWrapperPadding,
44
- opacity: previewStyle?.previewWrapperOpacity,
45
- };
46
- };
47
-
48
- function getThumbnailURL() {
49
- const msg = props.replyToMessage as MediaMessage;
50
- const url =
51
- (msg?.getMetadata() as any)?.['@injected']?.extensions?.['thumbnail-generation']?.url_small ||
52
- (msg?.getData() as any)?.url;
53
- return proxyImage(url);
54
- }
55
-
56
- </script>
57
-
58
- <template>
59
- <div class="bcc__reply_preview__content_wrapper" :style="previewWrapperStyle()">
60
- <div class="bcc__reply_preview__content_bar" :style="barStyle()"></div>
61
- <div v-if="props.replyToMessage?.getType() === CometChatUIKitConstants.MessageTypes.image" class="bcc__reply_preview__thumbnail">
62
- <img :src="getThumbnailURL()" />
63
- </div>
64
- <div class="bcc__reply_preview__content">
65
- <p class="bcc__reply_preview__title" :style="titleStyle()">
66
- {{ props.titlePrefix + ( getSenderDisplayName(props.replyToMessage) || "" ) || "Reply to ..." }}
67
- </p>
68
- <p class="cc__preview__subtitle" v-html="chat.toMarkdownHtml(getMessageTextPreview(props?.replyToMessage), props.replyToMessage?.getMentionedUsers()) || '‎'" :style="subtitleStyle()"/>
69
- </div>
70
- </div>
71
- </template>
72
-
73
- <style scoped>
74
- .bcc__reply_preview__content_wrapper {
75
- padding: 0 12px;
76
- position: relative;
77
- display: grid;
78
- justify-content: start;
79
- }
80
- .bcc__reply_preview__content_bar {
81
- position: absolute;
82
- top: 0;
83
- bottom: 0;
84
- border-radius: 25px;
85
- }
86
- .bcc__reply_preview__content {
87
- grid-column: 2;
88
- }
89
- .bcc__reply_preview__content > p {
90
- margin: 0;
91
- overflow: hidden;
92
- display: -webkit-box;
93
- -webkit-box-orient: vertical;
94
- -webkit-line-clamp: 8;
95
- word-break: break-all;
96
- }
97
- .bcc__reply_preview__content > .bcc__reply_preview__title {
98
- margin-bottom: 2px;
99
- }
100
- .bcc__reply_preview__thumbnail {
101
- grid-column: 1;
102
- width: 2rem;
103
- height: 2rem;
104
- align-self: center;
105
- border-radius: 3px;
106
- overflow: hidden;
107
- margin-right: 5px;
108
- }
109
- .bcc__reply_preview__thumbnail > img {
110
- width: 100%;
111
- height: 100%;
112
- }
113
- </style>