@cometchat/chat-uikit-react 6.1.2 → 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/Profile.png +0 -0
- package/dist/assets/chat-history.svg +3 -0
- package/dist/assets/copy-text.svg +3 -0
- package/dist/assets/message_blocked.svg +8 -0
- package/dist/assets/new-chat.svg +3 -0
- package/dist/assets/right-arrow.svg +3 -0
- package/dist/assets/send-message.svg +3 -0
- package/dist/assets/stop-message.svg +3 -0
- package/dist/assets/warning-small.svg +0 -0
- package/dist/index.d.ts +447 -198
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/styles/CometChatAIAssistantChat.css +465 -0
- package/dist/styles/CometChatAIAssistantChatHistory.css +175 -0
- package/dist/styles/CometChatAIAssistantMessageBubble.css +118 -0
- package/dist/styles/CometChatConversations.css +19 -0
- package/dist/styles/CometChatErrorView.css +22 -0
- package/dist/styles/CometChatMessageComposer.css +9 -9
- package/dist/styles/CometChatMessageHeader.css +2 -4
- package/dist/styles/CometChatMessageList.css +34 -19
- package/dist/styles/CometChatModerationView.css +25 -0
- package/dist/styles/CometChatSearch.css +13 -0
- package/dist/styles/CometChatStreamMessageBubble.css +183 -0
- package/dist/styles/CometChatToolCallArgumentBubble.css +100 -0
- package/dist/styles/CometChatToolCallResultBubble.css +91 -0
- package/dist/styles/components/CometChatAIAssistantChat.css +465 -0
- package/dist/styles/components/CometChatAIAssistantChatHistory.css +175 -0
- package/dist/styles/components/CometChatAIAssistantMessageBubble.css +118 -0
- package/dist/styles/components/CometChatConversations.css +19 -0
- package/dist/styles/components/CometChatErrorView.css +22 -0
- package/dist/styles/components/CometChatMessageComposer.css +9 -9
- package/dist/styles/components/CometChatMessageHeader.css +2 -4
- package/dist/styles/components/CometChatMessageList.css +34 -19
- package/dist/styles/components/CometChatModerationView.css +25 -0
- package/dist/styles/components/CometChatSearch.css +13 -0
- package/dist/styles/components/CometChatStreamMessageBubble.css +183 -0
- package/dist/styles/components/CometChatToolCallArgumentBubble.css +100 -0
- package/dist/styles/components/CometChatToolCallResultBubble.css +91 -0
- package/dist/styles/components/index.css +9 -2
- package/dist/styles/css-variables.css +5 -0
- package/dist/styles/index.css +9 -2
- package/dist/types/components/BaseComponents/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.d.ts +6 -0
- package/dist/types/components/BaseComponents/CometChatErrorView/CometChatErrorView.d.ts +9 -0
- package/dist/types/components/BaseComponents/CometChatList/CometChatList.d.ts +7 -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/BaseComponents/CometChatSendButtonView/CometChatSendButtonView.d.ts +4 -0
- package/dist/types/components/BaseComponents/CometChatStreamMessageBubble/CometChatStreamMessageBubble.d.ts +6 -0
- package/dist/types/components/BaseComponents/CometChatToolCallArgumentBubble/CometChatToolCallArgumentBubble.d.ts +6 -0
- package/dist/types/components/BaseComponents/CometChatToolCallResultBubble/CometChatToolCallResultBubble.d.ts +6 -0
- package/dist/types/components/CometChatAIAssistantChat/CometChatAIAssistantChat.d.ts +30 -0
- package/dist/types/components/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.d.ts +24 -0
- package/dist/types/components/CometChatMessageComposer/CometChatMessageComposer.d.ts +5 -0
- package/dist/types/components/CometChatMessageComposer/useCometChatMessageComposer.d.ts +2 -0
- package/dist/types/components/CometChatMessageList/CometChatMessageList.d.ts +24 -14
- package/dist/types/components/CometChatMessageList/CometChatMessageListController.d.ts +3 -2
- package/dist/types/components/CometChatMessageList/useCometChatMessageList.d.ts +1 -1
- package/dist/types/constants/CometChatUIKitConstants.d.ts +21 -0
- package/dist/types/events/CometChatMessageEvents.d.ts +4 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/modals/CometChatAIAssistantTools.d.ts +47 -0
- package/dist/types/modals/CometChatMessageTemplate.d.ts +1 -1
- package/dist/types/services/stream-message.service.d.ts +44 -0
- package/dist/types/utils/DataSource.d.ts +9 -1
- package/dist/types/utils/DataSourceDecorator.d.ts +9 -1
- package/dist/types/utils/MessageReceiptUtils.d.ts +1 -1
- package/dist/types/utils/MessageUtils.d.ts +6 -0
- package/dist/types/utils/MessagesDataSource.d.ts +15 -6
- package/dist/types/utils/util.d.ts +9 -0
- package/package.json +7 -3
|
@@ -7,6 +7,7 @@ export declare class MessageListManager {
|
|
|
7
7
|
static groupListenerId: string;
|
|
8
8
|
static callListenerId: string;
|
|
9
9
|
static connectionListenerId: string;
|
|
10
|
+
static streamListenerId: string;
|
|
10
11
|
private static errorHandler;
|
|
11
12
|
/**
|
|
12
13
|
* Creates an instance of MessageListManager which constructs a request builder for fetching messages from a particular user/group in the chat.
|
|
@@ -18,7 +19,7 @@ export declare class MessageListManager {
|
|
|
18
19
|
* @param {boolean} [hideGroupActionMessages]
|
|
19
20
|
* @memberof MessageListManager
|
|
20
21
|
*/
|
|
21
|
-
constructor(errorHandler: (error: unknown, source?: string) => void, messagesRequestBuilder?: CometChat.MessagesRequestBuilder, user?: CometChat.User, group?: CometChat.Group, messageId?: number, parentMessageId?: number, hideGroupActionMessages?: boolean);
|
|
22
|
+
constructor(errorHandler: (error: unknown, source?: string) => void, messagesRequestBuilder?: CometChat.MessagesRequestBuilder, user?: CometChat.User, group?: CometChat.Group, messageId?: number, parentMessageId?: number, hideGroupActionMessages?: boolean, isAgentChat?: boolean);
|
|
22
23
|
/**
|
|
23
24
|
* Function to invoke the fetchNext method of the messagesRequestBuilder to retrieve the subsequent messages following the latest fetched message.
|
|
24
25
|
*
|
|
@@ -36,7 +37,7 @@ export declare class MessageListManager {
|
|
|
36
37
|
*
|
|
37
38
|
* @param {Function} callback
|
|
38
39
|
*/
|
|
39
|
-
static attachListeners: (callback: (key: string, mesage: CometChat.BaseMessage, group?: CometChat.Group) => void) => void;
|
|
40
|
+
static attachListeners: (addStreamListener: boolean, callback: (key: string, mesage: CometChat.BaseMessage, group?: CometChat.Group) => void, addMessage: (message: CometChat.BaseMessage) => void, user?: CometChat.User) => void;
|
|
40
41
|
/**
|
|
41
42
|
* Function to remove the attached listeners for a particular user/group.
|
|
42
43
|
* */
|
|
@@ -2,5 +2,5 @@ import { MutableRefObject } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* This Hooks function is a custom React hook designed to manage functionalities of CometChatMessageList component. It fetches the logged-in user, handles event subscriptions and tracks message IDs for new message retrieval. It plays a key role in maintaining real-time functionality and user interactions in the chat interface.
|
|
4
4
|
**/
|
|
5
|
-
declare function useCometChatMessageList(loggedInUserRef: MutableRefObject<CometChat.User | null>, messageListManagerRef: MutableRefObject<any>, fetchPreviousMessages: () => void, updateMessage: (key: string, mesage: CometChat.BaseMessage, group?: CometChat.Group) => void, messagesRequestBuilder: CometChat.MessagesRequestBuilder | undefined, user: CometChat.User | undefined, group: CometChat.Group | undefined, messageIdRef: MutableRefObject<any>, totalMessagesCountRef: MutableRefObject<any>, messageList: CometChat.BaseMessage[], errorHandler: (error: unknown, source?: string) => void, setMessageList: (messages: CometChat.BaseMessage[]) => void, setScrollListToBottom: (scrollToBottom: boolean) => void, smartReplyViewRef: MutableRefObject<any>, isOnBottomRef: MutableRefObject<boolean>, isFirstReloadRef: MutableRefObject<boolean>, subscribeToUIEvents: Function, showSmartRepliesRef: MutableRefObject<any>, setDateHeader?: Function, parentMessageId?: number, hideGroupActionMessages?: boolean, showSmartReplies?: boolean, goToMessageId?: string): void;
|
|
5
|
+
declare function useCometChatMessageList(loggedInUserRef: MutableRefObject<CometChat.User | null>, messageListManagerRef: MutableRefObject<any>, fetchPreviousMessages: () => void, updateMessage: (key: string, mesage: CometChat.BaseMessage, group?: CometChat.Group) => void, messagesRequestBuilder: CometChat.MessagesRequestBuilder | undefined, user: CometChat.User | undefined, group: CometChat.Group | undefined, messageIdRef: MutableRefObject<any>, totalMessagesCountRef: MutableRefObject<any>, messageList: CometChat.BaseMessage[], errorHandler: (error: unknown, source?: string) => void, setMessageList: (messages: CometChat.BaseMessage[]) => void, setScrollListToBottom: (scrollToBottom: boolean) => void, smartReplyViewRef: MutableRefObject<any>, isOnBottomRef: MutableRefObject<boolean>, isFirstReloadRef: MutableRefObject<boolean>, subscribeToUIEvents: Function, showSmartRepliesRef: MutableRefObject<any>, addMessage: (message: CometChat.BaseMessage) => void, setDateHeader?: Function, parentMessageId?: number, hideGroupActionMessages?: boolean, showSmartReplies?: boolean, goToMessageId?: string, isAgentChat?: boolean): void;
|
|
6
6
|
export { useCometChatMessageList };
|
|
@@ -5,6 +5,13 @@ export declare class CometChatUIKitConstants {
|
|
|
5
5
|
action: string;
|
|
6
6
|
call: string;
|
|
7
7
|
interactive: string;
|
|
8
|
+
agentic: import("@cometchat/chat-sdk-javascript").MessageCategory.AGENTIC;
|
|
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;
|
|
8
15
|
}>;
|
|
9
16
|
static MessageTypes: Readonly<{
|
|
10
17
|
text: string;
|
|
@@ -19,6 +26,9 @@ export declare class CometChatUIKitConstants {
|
|
|
19
26
|
card: "card";
|
|
20
27
|
customInteractive: "customInteractive";
|
|
21
28
|
scheduler: "scheduler";
|
|
29
|
+
assistant: string;
|
|
30
|
+
toolArguments: string;
|
|
31
|
+
toolResults: string;
|
|
22
32
|
}>;
|
|
23
33
|
static groupMemberAction: Readonly<{
|
|
24
34
|
ROLE: "role";
|
|
@@ -147,4 +157,15 @@ export declare class CometChatUIKitConstants {
|
|
|
147
157
|
changeScope: "changeScope";
|
|
148
158
|
groupMembers: "groupMembers";
|
|
149
159
|
}>;
|
|
160
|
+
static streamMessageTypes: Readonly<{
|
|
161
|
+
run_started: string;
|
|
162
|
+
text_message_start: string;
|
|
163
|
+
text_message_content: string;
|
|
164
|
+
text_message_end: string;
|
|
165
|
+
run_finished: string;
|
|
166
|
+
tool_call_start: string;
|
|
167
|
+
tool_call_end: string;
|
|
168
|
+
tool_call_args: string;
|
|
169
|
+
tool_call_result: string;
|
|
170
|
+
}>;
|
|
150
171
|
}
|
|
@@ -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>;
|
|
@@ -35,6 +36,9 @@ export declare class CometChatMessageEvents {
|
|
|
35
36
|
static onFormMessageReceived: Subject<CometChat.InteractiveMessage>;
|
|
36
37
|
static onCardMessageReceived: Subject<CometChat.InteractiveMessage>;
|
|
37
38
|
static onSchedulerMessageReceived: Subject<CometChat.InteractiveMessage>;
|
|
39
|
+
static onAIAssistantMessageReceived: Subject<CometChat.AIAssistantMessage>;
|
|
40
|
+
static onAIToolResultReceived: Subject<CometChat.AIToolResultMessage>;
|
|
41
|
+
static onAIToolArgumentsReceived: Subject<CometChat.AIToolArgumentMessage>;
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
44
|
* Interface for message-related events
|
package/dist/types/index.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ export { CometChatRadioButton } from './components/BaseComponents/CometChatRadio
|
|
|
85
85
|
export { CometChatPopover } from './components/BaseComponents/CometChatPopover/CometChatPopover';
|
|
86
86
|
export { CometChatMediaRecorder } from './components/BaseComponents/CometChatMediaRecorder/CometChatMediaRecorder';
|
|
87
87
|
export { CometChatListItem } from './components/BaseComponents/CometChatListItem/CometChatListItem';
|
|
88
|
+
export { CometChatErrorView } from './components/BaseComponents/CometChatErrorView/CometChatErrorView';
|
|
88
89
|
export { CometChatImageBubble } from './components/BaseComponents/CometChatImageBubble/CometChatImageBubble';
|
|
89
90
|
export { CometChatFullScreenViewer } from './components/BaseComponents/CometChatFullScreenViewer/CometChatFullScreenViewer';
|
|
90
91
|
export { CometChatFileBubble } from './components/BaseComponents/CometChatFileBubble/CometChatFileBubble';
|
|
@@ -114,3 +115,9 @@ export * from './formatters/index';
|
|
|
114
115
|
export * from './utils/SearchUtils';
|
|
115
116
|
export { CometChatSearch } from './components/CometChatSearch/CometChatSearch';
|
|
116
117
|
export { CometChatFrameProvider, useCometChatFrameContext } from './context/CometChatFrameContext';
|
|
118
|
+
export { CometChatAIAssistantChat } from './components/CometChatAIAssistantChat/CometChatAIAssistantChat';
|
|
119
|
+
export * from './services/stream-message.service';
|
|
120
|
+
export { CometChatAIAssistantTools } from './modals/CometChatAIAssistantTools';
|
|
121
|
+
export { CometChatStreamMessageBubble } from './components/BaseComponents/CometChatStreamMessageBubble/CometChatStreamMessageBubble';
|
|
122
|
+
export { CometChatAIAssistantMessageBubble } from './components/BaseComponents/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble';
|
|
123
|
+
export { CometChatAIAssistantChatHistory } from './components/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definition for toolkit action functions
|
|
3
|
+
* Each function can return any value or a Promise for async operations
|
|
4
|
+
*/
|
|
5
|
+
type CometChatAIAssistantToolsFunction = (args: any) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Interface for the toolkit actions map
|
|
8
|
+
* Key: string (function name)
|
|
9
|
+
* Value: CometChatAIAssistantToolsFunction
|
|
10
|
+
*/
|
|
11
|
+
interface ICometChatAIAssistantToolsMap {
|
|
12
|
+
[functionName: string]: CometChatAIAssistantToolsFunction;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* CometChatAIAssistantTools class for managing action functions
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const toolkit = new CometChatAIAssistantTools({
|
|
20
|
+
* // Weather related functions
|
|
21
|
+
* getCurrentWeather: (params: {location: string}) => {
|
|
22
|
+
* // Implementation for getting current weather
|
|
23
|
+
* fetch(`/api/weather?location=${params.location}`);
|
|
24
|
+
* },
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare class CometChatAIAssistantTools {
|
|
30
|
+
private actionsMap;
|
|
31
|
+
[functionName: string]: any;
|
|
32
|
+
constructor(actions: ICometChatAIAssistantToolsMap);
|
|
33
|
+
/**
|
|
34
|
+
* Get the implementation of a specific action
|
|
35
|
+
*
|
|
36
|
+
* @param functionName - Name of the function
|
|
37
|
+
* @returns The function implementation or undefined if not found
|
|
38
|
+
*/
|
|
39
|
+
getAction(functionName: string): CometChatAIAssistantToolsFunction | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Get a copy of all actions
|
|
42
|
+
*
|
|
43
|
+
* @returns A copy of the actions map
|
|
44
|
+
*/
|
|
45
|
+
getActions(): ICometChatAIAssistantToolsMap;
|
|
46
|
+
}
|
|
47
|
+
export { CometChatAIAssistantTools, type ICometChatAIAssistantToolsMap, type CometChatAIAssistantToolsFunction };
|
|
@@ -50,7 +50,7 @@ declare class CometChatMessageTemplate {
|
|
|
50
50
|
* By default, it displays the receipt and the timestamp.
|
|
51
51
|
* @type {(message:CometChat.BaseMessage,alignment:MessageBubbleAlignment)=> Element | JSX.Element | null}
|
|
52
52
|
*/
|
|
53
|
-
statusInfoView: ((message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipts?: boolean, messageSentAtDateTimeFormat?: CalendarObject) => Element | JSX.Element | null) | null;
|
|
53
|
+
statusInfoView: ((message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipts?: boolean, messageSentAtDateTimeFormat?: CalendarObject, showError?: boolean) => Element | JSX.Element | null) | null;
|
|
54
54
|
/**
|
|
55
55
|
* List of available actions that any user can perform on a message, like reacting,
|
|
56
56
|
* editing or deleting a message.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CometChatAIAssistantTools } from '../modals/CometChatAIAssistantTools';
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing streaming message data that contains both the original message event
|
|
4
|
+
* and the accumulated streamed text content that has been processed so far.
|
|
5
|
+
*/
|
|
6
|
+
export interface IStreamData {
|
|
7
|
+
message: CometChat.AIAssistantBaseEvent;
|
|
8
|
+
streamedMessages?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Observable stream for streaming state changes
|
|
12
|
+
*/
|
|
13
|
+
export declare const streamingState$: import("rxjs").Observable<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Observable stream for message updates
|
|
16
|
+
*/
|
|
17
|
+
export declare const messageStream: import("rxjs").Observable<IStreamData>;
|
|
18
|
+
/**
|
|
19
|
+
* Starts a new streaming message session
|
|
20
|
+
* Resets accumulated content and initializes the message processor
|
|
21
|
+
*/
|
|
22
|
+
export declare const startStreamingMessage: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Handles incoming websocket messages by adding them to the processing queue
|
|
25
|
+
* @param msg - The message update to process
|
|
26
|
+
*/
|
|
27
|
+
export declare const handleWebsocketMessage: (msg: CometChat.AIAssistantBaseEvent) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the typing speed delay for text message content chunks
|
|
30
|
+
* @param delay - The delay in milliseconds between text content chunks (default: 80ms)
|
|
31
|
+
*/
|
|
32
|
+
export declare const setStreamSpeed: (delay: number) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the current typing speed delay for text message content chunks
|
|
35
|
+
* @returns The current delay in milliseconds
|
|
36
|
+
*/
|
|
37
|
+
export declare const getStreamSpeed: () => number;
|
|
38
|
+
export declare const getAIAssistantTools: () => CometChatAIAssistantTools;
|
|
39
|
+
export declare const setAIAssistantTools: (actions: CometChatAIAssistantTools) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Stops the streaming message session and cleans up resources
|
|
42
|
+
* Unsubscribes from the message processor and resets accumulated content
|
|
43
|
+
*/
|
|
44
|
+
export declare const stopStreamingMessage: () => void;
|
|
@@ -18,12 +18,16 @@ export declare abstract class DataSource {
|
|
|
18
18
|
abstract getAudioMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
|
|
19
19
|
abstract getFileMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
|
|
20
20
|
abstract getBottomView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment): Element | JSX.Element | null;
|
|
21
|
-
abstract getStatusInfoView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipts?: boolean, messageSentAtDateTimeFormat?: CalendarObject): Element | JSX.Element | null;
|
|
21
|
+
abstract getStatusInfoView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipts?: boolean, messageSentAtDateTimeFormat?: CalendarObject, showError?: boolean): Element | JSX.Element | null;
|
|
22
22
|
abstract getTextMessageContentView(message: CometChat.TextMessage, alignment: MessageBubbleAlignment, otherParams: Object | undefined): Element | JSX.Element;
|
|
23
23
|
abstract getImageMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): Element | JSX.Element;
|
|
24
24
|
abstract getVideoMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): Element | JSX.Element;
|
|
25
25
|
abstract getAudioMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): Element | JSX.Element;
|
|
26
26
|
abstract getFileMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): Element | JSX.Element;
|
|
27
|
+
abstract getAgentAssistantMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
28
|
+
abstract getToolArgumentsMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
29
|
+
abstract getToolResultsMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
30
|
+
abstract getStreamMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
27
31
|
abstract getTextMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
28
32
|
abstract getImageMessageTemplate(): CometChatMessageTemplate;
|
|
29
33
|
abstract getVideoMessageTemplate(): CometChatMessageTemplate;
|
|
@@ -41,6 +45,10 @@ export declare abstract class DataSource {
|
|
|
41
45
|
abstract getId(): string;
|
|
42
46
|
abstract getDeleteMessageBubble(messageObject: CometChat.BaseMessage, text?: string, alignment?: MessageBubbleAlignment): Element | JSX.Element;
|
|
43
47
|
abstract getGroupActionBubble(message: CometChat.BaseMessage): Element | JSX.Element;
|
|
48
|
+
abstract getStreamMessageBubble(message: CometChat.CustomMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): Element | JSX.Element;
|
|
49
|
+
abstract getAgentAssistantMessageBubble(message: CometChat.AIAssistantMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): Element | JSX.Element;
|
|
50
|
+
abstract getToolArgumentsMessageBubble(message: CometChat.AIToolArgumentMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): Element | JSX.Element;
|
|
51
|
+
abstract getToolResultsMessageBubble(message: CometChat.AIToolResultMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): Element | JSX.Element;
|
|
44
52
|
abstract getTextMessageBubble(messageText: string, message: CometChat.TextMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): Element | JSX.Element;
|
|
45
53
|
abstract getVideoMessageBubble(videoUrl: string, message: CometChat.MediaMessage, thumbnailUrl?: string, onClick?: Function, alignment?: MessageBubbleAlignment): Element | JSX.Element;
|
|
46
54
|
abstract getImageMessageBubble(imageUrl: string, placeholderImage: string, message: CometChat.MediaMessage, onClick?: Function, alignment?: MessageBubbleAlignment): Element | JSX.Element;
|
|
@@ -19,7 +19,7 @@ export declare abstract class DataSourceDecorator implements DataSource {
|
|
|
19
19
|
getVideoMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
|
|
20
20
|
getAudioMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
|
|
21
21
|
getFileMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
|
|
22
|
-
getStatusInfoView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipts?: boolean, messageSentAtDateTimeFormat?: CalendarObject): JSX.Element | Element | null;
|
|
22
|
+
getStatusInfoView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipts?: boolean, messageSentAtDateTimeFormat?: CalendarObject, showError?: boolean): JSX.Element | Element | null;
|
|
23
23
|
getBottomView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment): JSX.Element | Element | null;
|
|
24
24
|
getTextMessageContentView(message: CometChat.TextMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): JSX.Element | Element;
|
|
25
25
|
getImageMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): JSX.Element | Element;
|
|
@@ -27,6 +27,10 @@ export declare abstract class DataSourceDecorator implements DataSource {
|
|
|
27
27
|
getAudioMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): JSX.Element | Element;
|
|
28
28
|
getFileMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): JSX.Element | Element;
|
|
29
29
|
getTextMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
30
|
+
getAgentAssistantMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
31
|
+
getToolArgumentsMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
32
|
+
getToolResultsMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
33
|
+
getStreamMessageTemplate(additionalConfigurations?: Object | undefined): CometChatMessageTemplate;
|
|
30
34
|
getImageMessageTemplate(): CometChatMessageTemplate;
|
|
31
35
|
getVideoMessageTemplate(): CometChatMessageTemplate;
|
|
32
36
|
getAudioMessageTemplate(): CometChatMessageTemplate;
|
|
@@ -44,6 +48,10 @@ export declare abstract class DataSourceDecorator implements DataSource {
|
|
|
44
48
|
getDeleteMessageBubble(messageObject: CometChat.BaseMessage, text?: string, alignment?: MessageBubbleAlignment): JSX.Element | Element;
|
|
45
49
|
getGroupActionBubble(message: CometChat.BaseMessage): JSX.Element | Element;
|
|
46
50
|
getTextMessageBubble(messageText: string, message: CometChat.TextMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): JSX.Element | Element;
|
|
51
|
+
getAgentAssistantMessageBubble(message: CometChat.AIAssistantMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): JSX.Element | Element;
|
|
52
|
+
getToolArgumentsMessageBubble(message: CometChat.AIToolArgumentMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): JSX.Element | Element;
|
|
53
|
+
getToolResultsMessageBubble(message: CometChat.AIToolResultMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): JSX.Element | Element;
|
|
54
|
+
getStreamMessageBubble(message: CometChat.CustomMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): JSX.Element | Element;
|
|
47
55
|
getVideoMessageBubble(videoUrl: string, message: CometChat.MediaMessage, thumbnailUrl?: string, onClick?: Function, alignment?: MessageBubbleAlignment): JSX.Element | Element;
|
|
48
56
|
getImageMessageBubble(imageUrl: string, placeholderImage: string, message: CometChat.MediaMessage, onClick?: Function, alignment?: MessageBubbleAlignment): JSX.Element | Element;
|
|
49
57
|
getAudioMessageBubble(audioUrl: string, message: CometChat.MediaMessage, title?: string, alignment?: MessageBubbleAlignment): JSX.Element | Element;
|
|
@@ -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
|
*
|
|
@@ -41,17 +41,17 @@ export declare class MessagesDataSource implements DataSource {
|
|
|
41
41
|
getVideoMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
|
|
42
42
|
getAudioMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
|
|
43
43
|
getFileMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
|
|
44
|
-
getReceiptClass(status?: number): "error" | "
|
|
44
|
+
getReceiptClass(status?: number): "error" | "read" | "wait" | "delivered" | "sent" | undefined;
|
|
45
45
|
/**
|
|
46
46
|
* Function to get receipt for message bubble
|
|
47
47
|
* @param {CometChat.BaseMessage} item - The message bubble for which the receipt needs to be fetched
|
|
48
48
|
* @returns {JSX.Element | null} Returns JSX.Element for receipt of a message bubble or null
|
|
49
49
|
*/
|
|
50
|
-
getBubbleStatusInfoReceipt: (item: CometChat.BaseMessage, hideReceipts?: boolean) => JSX.Element | null;
|
|
50
|
+
getBubbleStatusInfoReceipt: (item: CometChat.BaseMessage, hideReceipts?: boolean, showError?: boolean) => JSX.Element | null;
|
|
51
51
|
/**
|
|
52
|
-
* Function for displaying the timestamp next to messages.
|
|
53
|
-
* @returns CalendarObject
|
|
54
|
-
*/
|
|
52
|
+
* Function for displaying the timestamp next to messages.
|
|
53
|
+
* @returns CalendarObject
|
|
54
|
+
*/
|
|
55
55
|
getMessageSentAtDateFormat(messageSentAtDateTimeFormat?: CalendarObject): {
|
|
56
56
|
today: string;
|
|
57
57
|
yesterday: string;
|
|
@@ -70,9 +70,18 @@ export declare class MessagesDataSource implements DataSource {
|
|
|
70
70
|
* @returns {JSX.Element | null} Returns JSX.Element for status and date of a message bubble or null
|
|
71
71
|
*/
|
|
72
72
|
getBubbleStatusInfoDate: (item: CometChat.BaseMessage, messageSentAtDateTimeFormat?: CalendarObject) => JSX.Element | null;
|
|
73
|
-
getStatusInfoView: (_messageObject: CometChat.BaseMessage, _alignment: MessageBubbleAlignment, hideReceipts?: boolean, messageSentAtDateTimeFormat?: CalendarObject) => import("react/jsx-runtime").JSX.Element | null;
|
|
73
|
+
getStatusInfoView: (_messageObject: CometChat.BaseMessage, _alignment: MessageBubbleAlignment, hideReceipts?: boolean, messageSentAtDateTimeFormat?: CalendarObject, showError?: boolean) => import("react/jsx-runtime").JSX.Element | null;
|
|
74
74
|
getBottomView(_messageObject: CometChat.BaseMessage, _alignment: MessageBubbleAlignment): null;
|
|
75
75
|
getTextMessageTemplate(additionalConfigurations?: additionalParams): CometChatMessageTemplate;
|
|
76
|
+
getAgentAssistantMessageBubble(message: CometChat.AIAssistantMessage): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
getToolArgumentsMessageBubble(message: CometChat.AIToolArgumentMessage): import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
getToolResultsMessageBubble(message: CometChat.AIToolResultMessage): import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
handleCopy: (message: CometChat.AIAssistantMessage) => void;
|
|
80
|
+
getAgentAssistantMessageTemplate(): CometChatMessageTemplate;
|
|
81
|
+
getToolResultsMessageTemplate(): CometChatMessageTemplate;
|
|
82
|
+
getToolArgumentsMessageTemplate(): CometChatMessageTemplate;
|
|
83
|
+
getStreamMessageBubble(message: CometChat.CustomMessage): import("react/jsx-runtime").JSX.Element;
|
|
84
|
+
getStreamMessageTemplate(): CometChatMessageTemplate;
|
|
76
85
|
getAudioMessageTemplate(): CometChatMessageTemplate;
|
|
77
86
|
getVideoMessageTemplate(): CometChatMessageTemplate;
|
|
78
87
|
getImageMessageTemplate(): CometChatMessageTemplate;
|
|
@@ -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
|
*/
|
|
@@ -59,4 +61,11 @@ export declare const useDebouncedCallback: (callback: () => void, delay: number)
|
|
|
59
61
|
debouncedCallback: () => void;
|
|
60
62
|
cleanup: () => void;
|
|
61
63
|
};
|
|
64
|
+
export declare function createMessageCopy(msg: CometChat.AIAssistantBaseEvent, user: CometChat.User, category?: string, type?: string): CometChat.BaseMessage;
|
|
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;
|
|
62
71
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cometchat/chat-uikit-react",
|
|
3
|
-
"version": "6.1
|
|
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,9 +8,13 @@
|
|
|
8
8
|
"./css-variables.css": "./dist/styles/css-variables.css"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@cometchat/chat-sdk-javascript": "^4.
|
|
11
|
+
"@cometchat/chat-sdk-javascript": "^4.1.1",
|
|
12
12
|
"@rollup/plugin-json": "^6.1.0",
|
|
13
|
-
"rxjs": "^7.8.1"
|
|
13
|
+
"rxjs": "^7.8.1",
|
|
14
|
+
"react-markdown": "^10.1.0",
|
|
15
|
+
"@types/react-syntax-highlighter": "^15.5.13",
|
|
16
|
+
"react-syntax-highlighter": "^15.6.1",
|
|
17
|
+
"remark-gfm": "^4.0.1"
|
|
14
18
|
},
|
|
15
19
|
"scripts": {
|
|
16
20
|
"test": "echo \"Error: no test specified\" && exit 1",
|