///
import { IStyle } from '@fluentui/react';
import { BaseCustomStyles, ChatMessage, CustomMessage, SystemMessage, OnRenderAvatarCallback, Message, ReadReceiptsBySenderId, ComponentSlotStyle } from '../types';
import { MessageStatusIndicatorProps } from './MessageStatusIndicator';
import { MessageStatus } from "../../../acs-ui-common/src";
import { InlineImageOptions } from './ChatMessage/ChatMessageContent';
/**
* Fluent styles for {@link MessageThread}.
*
* @public
*/
export interface MessageThreadStyles extends BaseCustomStyles {
/** Styles for load previous messages container. */
loadPreviousMessagesButtonContainer?: IStyle;
/** Styles for new message container. */
newMessageButtonContainer?: IStyle;
/** Styles for chat container. */
chatContainer?: ComponentSlotStyle;
/** styles for my chat items. */
myChatItemMessageContainer?: ComponentSlotStyle;
/** styles for chat items. */
chatItemMessageContainer?: ComponentSlotStyle;
/** Styles for my chat message container. */
myChatMessageContainer?: ComponentSlotStyle;
/** Styles for my chat message container in case of failure. */
failedMyChatMessageContainer?: ComponentSlotStyle;
/** Styles for chat message container. */
chatMessageContainer?: ComponentSlotStyle;
/** Styles for system message container. */
systemMessageContainer?: ComponentSlotStyle;
/** Styles for blocked message container. */
/** Styles for message status indicator container. */
messageStatusContainer?: (mine: boolean) => IStyle;
}
/**
* Strings of {@link MessageThread} that can be overridden.
*
* @public
*/
export interface MessageThreadStrings {
/** String for Sunday */
sunday: string;
/** String for Monday */
monday: string;
/** String for Tuesday */
tuesday: string;
/** String for Wednesday */
wednesday: string;
/** String for Thursday */
thursday: string;
/** String for Friday */
friday: string;
/** String for Saturday */
saturday: string;
/** String for Yesterday */
yesterday: string;
/** String for participants joined */
participantJoined: string;
/** String for participants left */
participantLeft: string;
/** Tag shown on a message that has been edited */
editedTag: string;
/** String for editing message in floating menu */
editMessage: string;
/** String for removing message in floating menu */
removeMessage: string;
/** String for resending failed message in floating menu */
resendMessage?: string;
/** String for indicating failed to send messages */
failToSendTag?: string;
/** String for LiveMessage introduction for the Chat Message */
liveAuthorIntro: string;
/** String for LiveMessage introduction for the edited Chat Message by remote user */
editedMessageLiveAuthorIntro: string;
/** String for LiveMessage introduction for the edited Chat Message sent by local user */
editedMessageLocalUserLiveAuthorIntro: string;
/** String for aria text of remote user's message content */
messageContentAriaText: string;
/** String for aria text of local user's message content */
messageContentMineAriaText: string;
/** String for warning on text limit exceeded in EditBox*/
editBoxTextLimit: string;
/** String for placeholder text in EditBox when there is no user input*/
editBoxPlaceholderText: string;
/** String for new messages indicator*/
newMessagesIndicator: string;
/** String for showing message read status in floating menu */
messageReadCount?: string;
/** String for replacing display name when there is none*/
noDisplayNameSub: string;
/** String for Cancel button in EditBox*/
editBoxCancelButton: string;
/** String for Submit in EditBox when there is no user input*/
editBoxSubmitButton: string;
/** String for action menu indicating there are more options */
actionMenuMoreOptions?: string;
/** Aria label to announce when a message is deleted */
messageDeletedAnnouncementAriaLabel: string;
/** String for open attachment button in attachment card */
openAttachment: string;
/** String for aria text in attachment card group*/
attachmentCardGroupMessage: string;
}
/**
* Arguments for {@link MessageThreadProps.onRenderJumpToNewMessageButton}.
*
* @public
*/
export interface JumpToNewMessageButtonProps {
/** String for button text */
text: string;
/** Callback for when button is clicked */
onClick: () => void;
}
/**
* A component to render a single message.
*
* @public
*/
export type MessageRenderer = (props: MessageProps) => JSX.Element;
/**
* @public
* Callback function run when a message is updated.
*/
export type UpdateMessageCallback = (messageId: string, content: string) => Promise;
/**
* @public
* Callback function run when a message edit is cancelled.
*/
export type CancelEditCallback = (messageId: string) => void;
/**
* Props for {@link MessageThread}.
*
* @public
*/
export type MessageThreadProps = {
/**
* UserId of the current user.
*/
userId: string;
/**
* Messages to render in message thread. A message can be of type `ChatMessage`, `SystemMessage`, `BlockedMessage` or `CustomMessage`.
*/
messages: (ChatMessage | SystemMessage | CustomMessage)[];
/**
* number of participants in the thread
*/
participantCount?: number;
/**
* read receipts for each sender in the chat
*/
readReceiptsBySenderId?: ReadReceiptsBySenderId;
/**
* Allows users to pass an object containing custom CSS styles.
* @Example
* ```
*
* ```
*/
styles?: MessageThreadStyles;
/**
* Whether the new message button is disabled or not.
*
* @defaultValue `false`
*/
disableJumpToNewMessageButton?: boolean;
/**
* Whether the date of each message is displayed or not.
* It is ignored when onDisplayDateTimeString is supplied.
*
* @defaultValue `false`
*/
showMessageDate?: boolean;
/**
* Whether the status indicator for each message is displayed or not.
*
* @defaultValue `false`
*/
showMessageStatus?: boolean;
/**
* Number of chat messages to reload each time onLoadPreviousChatMessages is called.
*
* @defaultValue 0
*/
numberOfChatMessagesToReload?: number;
/**
* Optional callback to override actions on message being seen.
*
* @param messageId - message Id
*/
onMessageSeen?: (messageId: string) => Promise;
/**
* Optional callback to override render of the message status indicator.
*
* @param messageStatusIndicatorProps - props of type MessageStatusIndicatorProps
*/
onRenderMessageStatus?: (messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null;
/**
* Optional callback to override render of the avatar.
*
* @param userId - user Id
*/
onRenderAvatar?: OnRenderAvatarCallback;
/**
* Optional callback to override render of the button for jumping to the new message.
*
* @param newMessageButtonProps - button props of type JumpToNewMessageButtonProps 0 */
onRenderJumpToNewMessageButton?: (newMessageButtonProps: JumpToNewMessageButtonProps) => JSX.Element;
/**
* Optional callback to override loading of previous messages.
* It accepts the number of history chat messages that we want to load and return a boolean Promise indicating if we have got all the history messages.
* If the promise resolves to `true`, we have load all chat messages into the message thread and `loadPreviousMessagesButton` will not be rendered anymore.
*/
onLoadPreviousChatMessages?: (messagesToLoad: number) => Promise;
/**
* Optional callback to override render of a message.
*
* @param messageProps - props of type {@link communication-react#MessageProps}
* @param defaultOnRender - default render of type {@link communication-react#MessageRenderer}
*
* @remarks
* `messageRenderer` is not provided for `CustomMessage` and thus only available for `ChatMessage` and `SystemMessage`.
*/
onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;
/**
* Optional callback to edit a message.
*
* @param messageId - message id from chatClient
* @param content - new content of the message
*
*/
onUpdateMessage?: UpdateMessageCallback;
/**
* Optional callback for when a message edit is cancelled.
*
* @param messageId - message id from chatClient
*/
onCancelEditMessage?: CancelEditCallback;
/**
* Optional callback to delete a message.
*
* @param messageId - message id from chatClient
*
*/
onDeleteMessage?: (messageId: string) => Promise;
/**
* Optional callback to send a message.
*
* @param content - message body to send
* @param options - message options to be included in the message
*
*/
onSendMessage?: (content: string) => Promise;
/**
/**
* Disable editing messages.
*
* @remarks This removes the action menu on messages.
*
* @defaultValue `false`
*/
disableEditing?: boolean;
/**
* Optional strings to override in component
*/
strings?: Partial;
/**
* Optional callback called when an inline image is clicked.
* @beta
*/
inlineImageOptions?: InlineImageOptions;
};
/**
* Props to render a single message.
*
* See {@link MessageRenderer}.
*
* @public
*/
export type MessageProps = {
/**
* Message to render. It can type `ChatMessage` or `SystemMessage`, `BlockedMessage` or `CustomMessage`.
*/
message: Message;
/**
* Strings from parent MessageThread component
*/
strings: MessageThreadStrings;
/**
* Custom CSS styles for chat message container.
*/
messageContainerStyle?: ComponentSlotStyle;
/**
* Whether the date of a message is displayed or not.
*
* @defaultValue `false`
*/
showDate?: boolean;
/**
* Disable editing messages.
*
* @remarks This removes the action menu on messages.
*
* @defaultValue `false`
*/
disableEditing?: boolean;
/**
* Optional callback to edit a message.
*
* @param messageId - message id from chatClient
* @param content - new content of the message
*/
onUpdateMessage?: UpdateMessageCallback;
/**
* Optional callback for when a message edit is cancelled.
*
* @param messageId - message id from chatClient
*/
onCancelEditMessage?: CancelEditCallback;
/**
* Optional callback to delete a message.
*
* @param messageId - message id from chatClient
*
*/
onDeleteMessage?: (messageId: string) => Promise;
/**
* Optional callback to send a message.
*
* @param content - message content from chatClient
* @param options - message options to be included in the message
*
*/
onSendMessage?: (content: string) => Promise;
};
/**
* @internal
*/
export type _ChatMessageProps = MessageProps & {
key: string;
statusToRender: MessageStatus | undefined;
showMessageStatus?: boolean;
};
/**
* `MessageThread` allows you to easily create a component for rendering chat messages, handling scrolling behavior of new/old messages and customizing icons & controls inside the chat thread.
* @param props - of type MessageThreadProps
*
* Users will need to provide at least chat messages and userId to render the `MessageThread` component.
* Users can also customize `MessageThread` by passing in their own Avatar, `MessageStatusIndicator` icon, `JumpToNewMessageButton`, `LoadPreviousMessagesButton` and the behavior of these controls.
*
* `MessageThread` internally uses the `Chat` component from `@fluentui-contrib/chat`. You can checkout the details about these components [here](https://microsoft.github.io/fluentui-contrib/react-chat/).
*
* @public
*/
export declare const MessageThread: (props: MessageThreadProps) => JSX.Element;
/**
* @private
*/
export declare const MessageThreadWrapper: (props: MessageThreadProps) => JSX.Element;
//# sourceMappingURL=MessageThread.d.ts.map