@cometchat/chat-uikit-react 6.2.0 → 6.2.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/assets/message_blocked.svg +8 -0
- package/dist/index.d.ts +231 -206
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles/CometChatAIAssistantChat.css +13 -4
- package/dist/styles/CometChatAIAssistantMessageBubble.css +49 -17
- package/dist/styles/CometChatConversations.css +16 -0
- package/dist/styles/CometChatMessageList.css +30 -15
- package/dist/styles/CometChatModerationView.css +25 -0
- package/dist/styles/CometChatSearch.css +13 -0
- package/dist/styles/CometChatStreamMessageBubble.css +48 -19
- package/dist/styles/components/CometChatAIAssistantChat.css +13 -4
- package/dist/styles/components/CometChatAIAssistantMessageBubble.css +49 -17
- package/dist/styles/components/CometChatConversations.css +16 -0
- package/dist/styles/components/CometChatMessageList.css +30 -15
- package/dist/styles/components/CometChatModerationView.css +25 -0
- package/dist/styles/components/CometChatSearch.css +13 -0
- package/dist/styles/components/CometChatStreamMessageBubble.css +48 -19
- package/dist/styles/components/index.css +1 -0
- package/dist/styles/index.css +1 -0
- package/dist/types/components/BaseComponents/CometChatMessageBubble/CometChatMessageBubble.d.ts +1 -0
- package/dist/types/components/BaseComponents/CometChatModerationView/CometChatModerationView.d.ts +2 -0
- package/dist/types/components/CometChatMessageComposer/useCometChatMessageComposer.d.ts +1 -0
- package/dist/types/components/CometChatMessageList/CometChatMessageList.d.ts +20 -15
- package/dist/types/constants/CometChatUIKitConstants.d.ts +6 -0
- package/dist/types/events/CometChatMessageEvents.d.ts +1 -0
- package/dist/types/utils/MessageReceiptUtils.d.ts +1 -1
- package/dist/types/utils/MessageUtils.d.ts +6 -0
- package/dist/types/utils/util.d.ts +7 -0
- package/package.json +4 -3
|
@@ -64,28 +64,12 @@
|
|
|
64
64
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.cometchat-stream-message-
|
|
67
|
+
.cometchat-stream-message-bubble__code-block {
|
|
68
68
|
max-height: 300px;
|
|
69
|
-
overflow:
|
|
69
|
+
overflow: auto;
|
|
70
70
|
border: 1px solid var(--cometchat-border-color-default);
|
|
71
|
-
|
|
71
|
+
width: 100%;
|
|
72
72
|
|
|
73
|
-
@media (min-width: 620px) and (max-width: 780px) {
|
|
74
|
-
.cometchat-stream-message-bubble pre>div {
|
|
75
|
-
/* max-width: 600px; */
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
@media (min-width: 480px) and (max-width: 619px) {
|
|
80
|
-
.cometchat-stream-message-bubble pre>div {
|
|
81
|
-
/* max-width: 400px; */
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@media (min-width: 320px) and (max-width: 479px) {
|
|
86
|
-
.cometchat-stream-message-bubble pre>div {
|
|
87
|
-
/* max-width: 300px; */
|
|
88
|
-
}
|
|
89
73
|
}
|
|
90
74
|
|
|
91
75
|
.cometchat-stream-message-bubble *:not(pre *) {
|
|
@@ -142,7 +126,52 @@
|
|
|
142
126
|
border-radius: 0px;
|
|
143
127
|
color: var(--cometchat-text-color-secondary);
|
|
144
128
|
}
|
|
129
|
+
.cometchat-stream-message-bubble__code-block::-webkit-scrollbar {
|
|
130
|
+
width: 0px;
|
|
131
|
+
height: 8px;
|
|
132
|
+
background: transparent;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.cometchat-stream-message-bubble__code-block::-webkit-scrollbar-track {
|
|
136
|
+
background: transparent;
|
|
137
|
+
}
|
|
145
138
|
|
|
139
|
+
.cometchat-stream-message-bubble__code-block::-webkit-scrollbar-thumb {
|
|
140
|
+
background: var(--cometchat-icon-color-secondary);
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.cometchat-stream-message-bubble table {
|
|
145
|
+
width: 100%;
|
|
146
|
+
border-collapse: collapse;
|
|
147
|
+
table-layout: auto;
|
|
148
|
+
display: block;
|
|
149
|
+
overflow-x: auto;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.cometchat-stream-message-bubble th,
|
|
153
|
+
.cometchat-stream-message-bubble td {
|
|
154
|
+
padding: var(--cometchat-padding-2);
|
|
155
|
+
border: 1px solid var(--cometchat-border-color-light);
|
|
156
|
+
text-align: left;
|
|
157
|
+
word-break: break-word; /* prevents text overflow in cells */
|
|
158
|
+
min-width: 100px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.cometchat-stream-message-bubble table::-webkit-scrollbar {
|
|
162
|
+
width: 0px;
|
|
163
|
+
height: 8px;
|
|
164
|
+
background: transparent;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.cometchat-stream-message-bubble table::-webkit-scrollbar-track {
|
|
168
|
+
background: transparent;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.cometchat-stream-message-bubble table::-webkit-scrollbar-thumb {
|
|
172
|
+
background: var(--cometchat-icon-color-secondary);
|
|
173
|
+
border-radius: var(--cometchat-radius-2);
|
|
174
|
+
}
|
|
146
175
|
@keyframes shimmer {
|
|
147
176
|
0% {
|
|
148
177
|
left: -60%;
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
@import url('./CometChatThreadHeader.css');
|
|
56
56
|
@import url('./CometChatToast.css');
|
|
57
57
|
@import url('./CometChatSearch.css');
|
|
58
|
+
@import url('./CometChatModerationView.css');
|
|
58
59
|
@import url('./CometChatAIAssistantChat.css');
|
|
59
60
|
@import url('./CometChatAIAssistantMessageBubble.css');
|
|
60
61
|
@import url('./CometChatStreamMessageBubble.css');
|
package/dist/styles/index.css
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
@import url('./CometChatThreadHeader.css');
|
|
56
56
|
@import url('./CometChatToast.css');
|
|
57
57
|
@import url('./CometChatSearch.css');
|
|
58
|
+
@import url('./CometChatModerationView.css');
|
|
58
59
|
@import url('./CometChatAIAssistantChat.css');
|
|
59
60
|
@import url('./CometChatAIAssistantMessageBubble.css');
|
|
60
61
|
@import url('./CometChatStreamMessageBubble.css');
|
package/dist/types/components/BaseComponents/CometChatMessageBubble/CometChatMessageBubble.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ interface MessageBubbleProps {
|
|
|
13
13
|
threadView?: JSX.Element | null;
|
|
14
14
|
footerView?: JSX.Element | null;
|
|
15
15
|
statusInfoView?: JSX.Element | null;
|
|
16
|
+
includeBottomViewHeight?: boolean;
|
|
16
17
|
options: (CometChatActionsIcon | CometChatActionsView)[];
|
|
17
18
|
alignment: MessageBubbleAlignment;
|
|
18
19
|
topMenuSize?: number;
|
|
@@ -9,6 +9,7 @@ type Args = {
|
|
|
9
9
|
mySetAddToMsgInputText: (text: string) => void;
|
|
10
10
|
errorHandler: (error: unknown, source?: string) => void;
|
|
11
11
|
pasteHtmlAtCaret: (text: string) => void;
|
|
12
|
+
renderSanitizedHtml: (text: string) => void;
|
|
12
13
|
textFormatters: Array<CometChatTextFormatter>;
|
|
13
14
|
disableMentions: boolean;
|
|
14
15
|
textFormatterArray: Array<CometChatTextFormatter>;
|
|
@@ -27,6 +27,11 @@ interface MessageListProps {
|
|
|
27
27
|
* @default false
|
|
28
28
|
*/
|
|
29
29
|
hideStickyDate?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Hides the visibility of moderation status in the message list.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
hideModerationView?: boolean;
|
|
30
35
|
/**
|
|
31
36
|
* Hides the visibility of receipts in the message list.
|
|
32
37
|
* @default false
|
|
@@ -140,10 +145,10 @@ interface MessageListProps {
|
|
|
140
145
|
*/
|
|
141
146
|
customSoundForMessages?: string;
|
|
142
147
|
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
* Specifies the keywords in incoming messages that will trigger Smart Replies.
|
|
149
|
+
* If set to an empty array [], Smart Replies will be generated for all messages.
|
|
150
|
+
* @default ['what', 'when', 'why', 'who', 'where', 'how', '?']
|
|
151
|
+
*/
|
|
147
152
|
smartRepliesKeywords?: string[];
|
|
148
153
|
/**
|
|
149
154
|
* Specifies the delay in milliseconds before Smart Replies are displayed.
|
|
@@ -199,20 +204,20 @@ interface MessageListProps {
|
|
|
199
204
|
*/
|
|
200
205
|
footerView?: JSX.Element;
|
|
201
206
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
207
|
+
* Format for the date separators in the message list.
|
|
208
|
+
*/
|
|
204
209
|
separatorDateTimeFormat?: CalendarObject;
|
|
205
210
|
/**
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
* Format for sticky date headers displayed in the message list.
|
|
212
|
+
*/
|
|
208
213
|
stickyDateTimeFormat?: CalendarObject;
|
|
209
214
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
215
|
+
* Format for the timestamp displayed next to messages.
|
|
216
|
+
*/
|
|
212
217
|
messageSentAtDateTimeFormat?: CalendarObject;
|
|
213
218
|
/**
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
* Format for timestamps displayed in message details (e.g., delivery or read time).
|
|
220
|
+
*/
|
|
216
221
|
messageInfoDateTimeFormat?: CalendarObject;
|
|
217
222
|
/**
|
|
218
223
|
* ID of the message to automatically scroll to when the message list loads.
|
|
@@ -221,9 +226,9 @@ interface MessageListProps {
|
|
|
221
226
|
*/
|
|
222
227
|
goToMessageId?: string;
|
|
223
228
|
/**
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
* Controls the visibility of the scrollbar in the list.
|
|
230
|
+
* @defaultValue `false`
|
|
231
|
+
*/
|
|
227
232
|
showScrollbar?: boolean;
|
|
228
233
|
/**
|
|
229
234
|
* Toggles AI Agent functionality.
|
|
@@ -7,6 +7,12 @@ export declare class CometChatUIKitConstants {
|
|
|
7
7
|
interactive: string;
|
|
8
8
|
agentic: import("@cometchat/chat-sdk-javascript").MessageCategory.AGENTIC;
|
|
9
9
|
}>;
|
|
10
|
+
static moderationStatus: Readonly<{
|
|
11
|
+
pending: import("@cometchat/chat-sdk-javascript").ModerationStatus.PENDING;
|
|
12
|
+
approved: import("@cometchat/chat-sdk-javascript").ModerationStatus.APPROVED;
|
|
13
|
+
disapproved: import("@cometchat/chat-sdk-javascript").ModerationStatus.DISAPPROVED;
|
|
14
|
+
unmoderated: import("@cometchat/chat-sdk-javascript").ModerationStatus.UNMODERATED;
|
|
15
|
+
}>;
|
|
10
16
|
static MessageTypes: Readonly<{
|
|
11
17
|
text: string;
|
|
12
18
|
file: string;
|
|
@@ -19,6 +19,7 @@ export declare class CometChatMessageEvents {
|
|
|
19
19
|
* message events wrapper of SDK listeners (e.g., media message, typing indicator, read receipts, etc.)
|
|
20
20
|
*/
|
|
21
21
|
static onTextMessageReceived: Subject<CometChat.TextMessage>;
|
|
22
|
+
static onMessageModerated: Subject<CometChat.BaseMessage>;
|
|
22
23
|
static onMediaMessageReceived: Subject<CometChat.MediaMessage>;
|
|
23
24
|
static onCustomMessageReceived: Subject<CometChat.CustomMessage>;
|
|
24
25
|
static onTypingStarted: Subject<CometChat.TypingIndicator>;
|
|
@@ -13,5 +13,5 @@ export declare class MessageReceiptUtils {
|
|
|
13
13
|
* @param {CometChat.BaseMessage} messageObject - The message object for which to get the receipt status.
|
|
14
14
|
* @returns {Receipts} - The receipt status icon.
|
|
15
15
|
*/
|
|
16
|
-
static getReceiptStatus: (
|
|
16
|
+
static getReceiptStatus: (message: CometChat.BaseMessage) => Receipts;
|
|
17
17
|
}
|
|
@@ -23,6 +23,12 @@ export declare class MessageUtils {
|
|
|
23
23
|
* @returns {object | null} - The content view for the message, or null if not found.
|
|
24
24
|
*/
|
|
25
25
|
getStatusInfoView(message: CometChat.BaseMessage, template: CometChatMessageTemplate, alignment?: MessageBubbleAlignment, messageSentAtDateTimeFormat?: CalendarObject, hideReceipts?: boolean): any;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves the bottom view for moderated messages
|
|
28
|
+
*
|
|
29
|
+
* @returns {JSX.Element} The default view for moderated messages.
|
|
30
|
+
*/
|
|
31
|
+
getModeratedMessageBottomView(): JSX.Element;
|
|
26
32
|
/**
|
|
27
33
|
* Retrieves the bubble wrapper for a message based on the provided template.
|
|
28
34
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import WaveSurfer from "../components/BaseComponents/CometChatAudioBubble/src/wavesurfer";
|
|
2
2
|
import { CalendarObject } from "./CalendarObject";
|
|
3
|
+
import { CometChatTextFormatter } from "../formatters";
|
|
3
4
|
interface MediaPlayer {
|
|
4
5
|
video?: HTMLVideoElement | null;
|
|
5
6
|
mediaRecorder?: MediaRecorder | null;
|
|
@@ -52,6 +53,7 @@ export declare function sanitizeCalendarObject(calendarObject?: CalendarObject):
|
|
|
52
53
|
};
|
|
53
54
|
export declare function fireClickEvent(): void;
|
|
54
55
|
export declare const decodeHTML: (input: string) => string;
|
|
56
|
+
export declare const sanitizeHtmlStringToFragment: (html: string, textFormatterArray?: CometChatTextFormatter[]) => DocumentFragment;
|
|
55
57
|
/**
|
|
56
58
|
* Custom React hook for creating debounced callbacks with automatic cleanup.
|
|
57
59
|
*/
|
|
@@ -61,4 +63,9 @@ export declare const useDebouncedCallback: (callback: () => void, delay: number)
|
|
|
61
63
|
};
|
|
62
64
|
export declare function createMessageCopy(msg: CometChat.AIAssistantBaseEvent, user: CometChat.User, category?: string, type?: string): CometChat.BaseMessage;
|
|
63
65
|
export declare function isDarkMode(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Sanitizes HTML content to only allow span tags while keeping everything else as plain text
|
|
68
|
+
* Also removes any script or executable content
|
|
69
|
+
*/
|
|
70
|
+
export declare const sanitizeToSpanOnly: (htmlString: string, regexPatterns: RegExp[][]) => string;
|
|
64
71
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cometchat/chat-uikit-react",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "Ready-to-use Chat UI Components for React(Javascript/Web)",
|
|
5
5
|
"author": "CometChat",
|
|
6
6
|
"exports": {
|
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
"./css-variables.css": "./dist/styles/css-variables.css"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@cometchat/chat-sdk-javascript": "^4.1.
|
|
11
|
+
"@cometchat/chat-sdk-javascript": "^4.1.1",
|
|
12
12
|
"@rollup/plugin-json": "^6.1.0",
|
|
13
13
|
"rxjs": "^7.8.1",
|
|
14
14
|
"react-markdown": "^10.1.0",
|
|
15
15
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
16
|
-
"react-syntax-highlighter": "^15.6.1"
|
|
16
|
+
"react-syntax-highlighter": "^15.6.1",
|
|
17
|
+
"remark-gfm": "^4.0.1"
|
|
17
18
|
},
|
|
18
19
|
"scripts": {
|
|
19
20
|
"test": "echo \"Error: no test specified\" && exit 1",
|