@cometchat/chat-uikit-react 6.3.4 → 6.3.6
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/file_unsupported.svg +3 -0
- package/dist/assets/warning_neutral.svg +3 -0
- package/dist/index.d.ts +92 -9
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles/CometChatConversations.css +7 -0
- package/dist/styles/CometChatFlagMessageDialog.css +207 -0
- package/dist/styles/CometChatMessageComposer.css +5 -7
- package/dist/styles/CometChatMessageList.css +7 -2
- package/dist/styles/CometChatMessagePreview.css +7 -0
- package/dist/styles/CometChatUserMemberWrapper.css +25 -0
- package/dist/styles/components/CometChatConversations.css +7 -0
- package/dist/styles/components/CometChatFlagMessageDialog.css +207 -0
- package/dist/styles/components/CometChatMessageComposer.css +5 -7
- package/dist/styles/components/CometChatMessageList.css +7 -2
- package/dist/styles/components/CometChatMessagePreview.css +7 -0
- package/dist/styles/components/CometChatUserMemberWrapper.css +25 -0
- package/dist/styles/components/index.css +2 -0
- package/dist/styles/index.css +2 -0
- package/dist/types/components/CometChatConversations/useCometChatConversations.d.ts +1 -0
- package/dist/types/components/CometChatFlagMessageDialog/CometChatFlagMessageDialog.d.ts +29 -0
- package/dist/types/components/CometChatMessageComposer/CometChatMessageComposer.d.ts +9 -0
- package/dist/types/components/CometChatMessageComposer/useCometChatMessageComposer.d.ts +0 -1
- package/dist/types/components/CometChatMessageList/CometChatMessageList.d.ts +10 -0
- package/dist/types/components/CometChatUserMemberWrapper/CometChatUserMemberWrapper.d.ts +15 -1
- package/dist/types/constants/CometChatUIKitConstants.d.ts +1 -0
- package/dist/types/formatters/CometChatFormatters/CometChatMentionsFormatter/CometChatMentionsFormatter.d.ts +22 -5
- package/dist/types/formatters/CometChatFormatters/CometChatTextFormatter.d.ts +3 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/MessagesDataSource.d.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface CometChatFlagMessageDialogProps {
|
|
2
|
+
message: CometChat.BaseMessage;
|
|
3
|
+
/**
|
|
4
|
+
* Callback triggered when the dialog is closed.
|
|
5
|
+
* @returns void
|
|
6
|
+
*/
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
/**
|
|
9
|
+
* Callback triggered when an error occurs when trying to flag a message.
|
|
10
|
+
* @param error - An instance of `CometChat.CometChatException` representing the error.
|
|
11
|
+
* @returns void
|
|
12
|
+
*/
|
|
13
|
+
onError?: ((error: CometChat.CometChatException) => void) | null;
|
|
14
|
+
/**
|
|
15
|
+
* Callback triggered when the flag report is submitted.
|
|
16
|
+
* @param messageId - ID of the message being flagged.
|
|
17
|
+
* @param reasonId - ID of the reason for flagging the message.
|
|
18
|
+
* @param remark - Optional remark provided by the user.
|
|
19
|
+
* @returns A promise that resolves to a boolean indicating the success of the flagging operation.
|
|
20
|
+
*/
|
|
21
|
+
onSubmit?: (messageId: string, reasonId: string, remark?: string) => Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Boolean to hide the remark input field.
|
|
24
|
+
* @defaultValue `false`
|
|
25
|
+
*/
|
|
26
|
+
hideFlagRemarkField?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const CometChatFlagMessageDialog: (props: CometChatFlagMessageDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export { CometChatFlagMessageDialog };
|
|
@@ -159,6 +159,15 @@ interface MessageComposerProps {
|
|
|
159
159
|
* @defaultValue ""
|
|
160
160
|
*/
|
|
161
161
|
placeholderText?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Boolean to show or hide "@all" mention functionality in group chats.
|
|
164
|
+
* @defaultValue `false`
|
|
165
|
+
*/
|
|
166
|
+
disableMentionAll?: boolean;
|
|
167
|
+
/** The mentionAll label for the app used to render "@all" mentions
|
|
168
|
+
* @defaultValue "all"
|
|
169
|
+
*/
|
|
170
|
+
mentionAllLabel?: string;
|
|
162
171
|
/**
|
|
163
172
|
* Custom request builder for mentions user list.
|
|
164
173
|
* @defaultValue `undefined` - Uses default internal request builder.
|
|
@@ -11,7 +11,6 @@ type Args = {
|
|
|
11
11
|
pasteHtmlAtCaret: (text: string) => void;
|
|
12
12
|
renderSanitizedHtml: (text: string) => void;
|
|
13
13
|
textFormatters: Array<CometChatTextFormatter>;
|
|
14
|
-
disableMentions: boolean;
|
|
15
14
|
textFormatterArray: Array<CometChatTextFormatter>;
|
|
16
15
|
mentionsTextFormatterInstanceRef: React.MutableRefObject<CometChatMentionsFormatter>;
|
|
17
16
|
setTextFormatters: React.Dispatch<React.SetStateAction<CometChatTextFormatter[]>>;
|
|
@@ -240,6 +240,16 @@ interface MessageListProps {
|
|
|
240
240
|
* @defaultValue `false`
|
|
241
241
|
*/
|
|
242
242
|
isAgentChat?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* hides the "Flag Message" option from message actions menu
|
|
245
|
+
* @defaultValue `false`
|
|
246
|
+
*/
|
|
247
|
+
hideFlagMessageOption?: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* hides the remark text area in the flag dialog
|
|
250
|
+
* @defaultValue `false`
|
|
251
|
+
*/
|
|
252
|
+
hideFlagRemarkField?: boolean;
|
|
243
253
|
}
|
|
244
254
|
declare const CometChatMessageList: (props: MessageListProps) => import("react/jsx-runtime").JSX.Element;
|
|
245
255
|
export { CometChatMessageList };
|
|
@@ -11,7 +11,7 @@ export interface MentionsProps {
|
|
|
11
11
|
* @param user - The clicked user (CometChat.User) or group member (CometChat.GroupMember)
|
|
12
12
|
* @returns void
|
|
13
13
|
*/
|
|
14
|
-
onItemClick?: (user: CometChat.User | CometChat.GroupMember) => void;
|
|
14
|
+
onItemClick?: (user: CometChat.User | CometChat.GroupMember | null) => void;
|
|
15
15
|
/**
|
|
16
16
|
* A custom view to render each user or group member item in the list.
|
|
17
17
|
*
|
|
@@ -59,5 +59,19 @@ export interface MentionsProps {
|
|
|
59
59
|
* @defaultValue `false`
|
|
60
60
|
*/
|
|
61
61
|
showScrollbar?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Disables the mentions functionality in the message composer.
|
|
64
|
+
* @defaultValue `false`
|
|
65
|
+
*/
|
|
66
|
+
disableMentions?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Boolean to show or hide '@all' mention option in the mentions list.
|
|
69
|
+
* @defaultValue `false`
|
|
70
|
+
*/
|
|
71
|
+
disableMentionAll?: boolean;
|
|
72
|
+
/** The mentionAll label for the app used to render "@all" mentions
|
|
73
|
+
* @defaultValue "all"
|
|
74
|
+
*/
|
|
75
|
+
mentionAllLabel?: string;
|
|
62
76
|
}
|
|
63
77
|
export declare function CometChatUserMemberWrapper(props: MentionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -59,6 +59,7 @@ export declare class CometChatUIKitConstants {
|
|
|
59
59
|
translateMessage: "translate";
|
|
60
60
|
reactToMessage: "react";
|
|
61
61
|
messageInformation: "messageInformation";
|
|
62
|
+
flagMessage: "flagMessage";
|
|
62
63
|
copyMessage: "copy";
|
|
63
64
|
shareMessage: "share";
|
|
64
65
|
forwardMessage: "forward";
|
|
@@ -15,6 +15,7 @@ export declare class CometChatMentionsFormatter extends CometChatTextFormatter {
|
|
|
15
15
|
* List of users for mentions.
|
|
16
16
|
*/
|
|
17
17
|
private cometChatUserGroupMembers;
|
|
18
|
+
private mentionedChannels;
|
|
18
19
|
/**
|
|
19
20
|
* Mapping of CSS classes for mentions.
|
|
20
21
|
*/
|
|
@@ -113,6 +114,20 @@ export declare class CometChatMentionsFormatter extends CometChatTextFormatter {
|
|
|
113
114
|
*/
|
|
114
115
|
setCometChatUserGroupMembers(CometChatUserGroupMembers: Array<CometChat.User | CometChat.GroupMember>): void;
|
|
115
116
|
resetCometChatUserGroupMembers(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Retrieves the mentioned channels.
|
|
119
|
+
* @returns {string[]} - The current mentioned channels.
|
|
120
|
+
*/
|
|
121
|
+
getCometChatMentionedChannels(): string[];
|
|
122
|
+
/**
|
|
123
|
+
* Sets the mentioned channels.
|
|
124
|
+
* @param {string[]} mentionAllLabels - The mentionAll labels to be set as mentioned channels.
|
|
125
|
+
*/
|
|
126
|
+
setCometChatMentionedChannels(mentionAllLabels: string[]): void;
|
|
127
|
+
/**
|
|
128
|
+
* Resets the mentioned channels.
|
|
129
|
+
*/
|
|
130
|
+
resetCometChatMentionedChannels(): void;
|
|
116
131
|
/**
|
|
117
132
|
* Sets the callback function for handling key down events.
|
|
118
133
|
*
|
|
@@ -137,12 +152,13 @@ export declare class CometChatMentionsFormatter extends CometChatTextFormatter {
|
|
|
137
152
|
stopTracking(): void;
|
|
138
153
|
/**
|
|
139
154
|
* Formats the input text if provided, otherwise edits the text at the cursor position.
|
|
140
|
-
* @param {string
|
|
155
|
+
* @param {string} inputText - The input text to be formatted.
|
|
141
156
|
* @returns {string|void} - The formatted input text, or void if inputText is not provided.
|
|
142
157
|
*/
|
|
143
|
-
getFormattedText(inputText: string
|
|
158
|
+
getFormattedText(inputText: string, params?: {
|
|
144
159
|
mentionsTargetElement: MentionsTargetElement;
|
|
145
160
|
}): string | void;
|
|
161
|
+
getFormattedTextForEntity(entity: CometChat.User | CometChat.GroupMember | string): void;
|
|
146
162
|
/**
|
|
147
163
|
* This function adds the mention span to the input text.
|
|
148
164
|
* @param {string} inputText - The input text where the span needs to be added.
|
|
@@ -192,12 +208,13 @@ export declare class CometChatMentionsFormatter extends CometChatTextFormatter {
|
|
|
192
208
|
*/
|
|
193
209
|
protected addAtCaretPosition(newHtml: string, currentCaretPosition: Selection, currentRange: Range): void;
|
|
194
210
|
/**
|
|
195
|
-
* Matches the regex with the given inputText and replaces the matched text with respective spans
|
|
211
|
+
* Matches the regex with the given inputText and replaces the matched text with respective spans of the provided entity
|
|
196
212
|
*
|
|
197
|
-
* @param {string
|
|
213
|
+
* @param {string} inputText - The text in which the regex patterns needs to be matched
|
|
214
|
+
* @param {CometChat.User | CometChat.GroupMember | string} entity - The entity to be used for replacing the matched text
|
|
198
215
|
* @return {string} - The text after replacing the matched text with spans
|
|
199
216
|
*/
|
|
200
|
-
onRegexMatch(inputText
|
|
217
|
+
onRegexMatch(inputText: string, entity: CometChat.User | CometChat.GroupMember | string): string;
|
|
201
218
|
/**
|
|
202
219
|
* Retrieves the original text after replacing mentions span with UIDs
|
|
203
220
|
*
|
|
@@ -165,9 +165,10 @@ export declare abstract class CometChatTextFormatter {
|
|
|
165
165
|
* @param {string|null} inputText - The text to format.
|
|
166
166
|
* @return {string|void} - The original or formatted input text, or void if editing was done based on cursor position.
|
|
167
167
|
*/
|
|
168
|
-
getFormattedText(inputText: string
|
|
168
|
+
getFormattedText(inputText: string, params: {
|
|
169
169
|
mentionsTargetElement: MentionsTargetElement;
|
|
170
170
|
}): string | void;
|
|
171
|
+
getFormattedTextForEntity(entity: any): void;
|
|
171
172
|
/**
|
|
172
173
|
* Sets the message object.
|
|
173
174
|
*
|
|
@@ -213,7 +214,7 @@ export declare abstract class CometChatTextFormatter {
|
|
|
213
214
|
* @param {string|null} inputText - The text to apply regex match.
|
|
214
215
|
* @return {string} - The replaced text.
|
|
215
216
|
*/
|
|
216
|
-
protected onRegexMatch(inputText?: string | null): string;
|
|
217
|
+
protected onRegexMatch(inputText?: string | null, entity?: any): string;
|
|
217
218
|
/**
|
|
218
219
|
* Debounce function.
|
|
219
220
|
* @param {Function} func - The function to debounce.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export { CometChatMessageHeader } from './components/CometChatMessageHeader/Come
|
|
|
41
41
|
export { CometChatMessageList } from './components/CometChatMessageList/CometChatMessageList';
|
|
42
42
|
export { CometChatUsers } from './components/CometChatUsers/CometChatUsers';
|
|
43
43
|
export { CometChatMessageInformation } from './components/CometChatMessageInformation/CometChatMessageInformation';
|
|
44
|
+
export { CometChatFlagMessageDialog } from './components/CometChatFlagMessageDialog/CometChatFlagMessageDialog';
|
|
44
45
|
export { CometChatUIKitCalls } from './CometChatUIKit/CometChatCalls';
|
|
45
46
|
export { CometChatUIKitConstants } from "./constants/CometChatUIKitConstants";
|
|
46
47
|
export { CometChatUtilityConstants } from "./constants/CometChatUtilityConstants";
|
|
@@ -26,6 +26,7 @@ export interface additionalParamsOptions {
|
|
|
26
26
|
hideMessagePrivatelyOption?: boolean;
|
|
27
27
|
hideCopyMessageOption?: boolean;
|
|
28
28
|
hideMessageInfoOption?: boolean;
|
|
29
|
+
hideFlagMessageOption?: boolean;
|
|
29
30
|
}
|
|
30
31
|
export declare class MessagesDataSource implements DataSource {
|
|
31
32
|
getEditOption(): CometChatActionsIcon;
|
|
@@ -36,6 +37,7 @@ export declare class MessagesDataSource implements DataSource {
|
|
|
36
37
|
getSendMessagePrivatelyOption(): CometChatActionsIcon;
|
|
37
38
|
getCopyOption(): CometChatActionsIcon;
|
|
38
39
|
getMessageInfoOption(): CometChatActionsIcon;
|
|
40
|
+
getReportOption(): CometChatActionsIcon;
|
|
39
41
|
isSentByMe(loggedInUser: CometChat.User, message: CometChat.BaseMessage): boolean;
|
|
40
42
|
getTextMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: additionalParamsOptions): Array<CometChatActionsIcon | CometChatActionsView>;
|
|
41
43
|
getIsSentByMe(message: CometChat.BaseMessage): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cometchat/chat-uikit-react",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.6",
|
|
4
4
|
"description": "Ready-to-use Chat UI Components for React(Javascript/Web)",
|
|
5
5
|
"author": "CometChat",
|
|
6
6
|
"exports": {
|
|
@@ -8,7 +8,7 @@
|
|
|
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.5",
|
|
12
12
|
"@rollup/plugin-json": "^6.1.0",
|
|
13
13
|
"rxjs": "^7.8.1",
|
|
14
14
|
"react-markdown": "^10.1.0",
|