UNPKG

@azure/communication-react

Version:

React library for building modern communication user experiences utilizing Azure Communication Services

43 lines 1.93 kB
import { ReactElement } from 'react'; import { Common } from "../../../acs-ui-common/src"; import { StatefulChatClient } from "../../../chat-stateful-client/src"; import { ChatThreadClient, SendMessageOptions } from '@azure/communication-chat'; /** * Object containing all the handlers required for chat components. * * Chat related components from this package are able to pick out relevant handlers from this object. * See {@link useHandlers} and {@link usePropsFor}. * * @public */ export type ChatHandlers = { onSendMessage: (content: string, options?: SendMessageOptions) => Promise<void>; onMessageSeen: (chatMessageId: string) => Promise<void>; onTyping: () => Promise<void>; onRemoveParticipant: (userId: string) => Promise<void>; updateThreadTopicName: (topicName: string) => Promise<void>; onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>; onUpdateMessage: (messageId: string, content: string) => Promise<void>; onDeleteMessage: (messageId: string) => Promise<void>; }; /** * Create the default implementation of {@link ChatHandlers}. * * Useful when implementing a custom component that utilizes the providers * exported from this library. * * Returned object is memoized to avoid rerenders when used as props for React Components. * * @public */ export declare const createDefaultChatHandlers: (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) => ChatHandlers; /** * Create a set of default handlers for given component. * * Returned object is memoized (with reference to the arguments) to avoid * renders when used as props for React Components. * * @public */ export declare const createDefaultChatHandlersForComponent: <Props>(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient, _: (props: Props) => ReactElement | null) => Common<ChatHandlers, Props>; //# sourceMappingURL=createHandlers.d.ts.map