UNPKG

communication-react-19

Version:

React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)

47 lines 2.3 kB
import { ReactElement } from 'react'; import { Common } from "../../../acs-ui-common/src"; import { StatefulChatClient } from "../../../chat-stateful-client/src"; import { UploadChatImageResult } from "../../../acs-ui-common/src"; import { ChatThreadClient, SendMessageOptions } from '@azure/communication-chat'; import { MessageOptions } from "../../../acs-ui-common/src"; /** * 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 | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions) => Promise<void>; onUploadImage: (image: Blob, imageFilename: string) => Promise<UploadChatImageResult>; onDeleteImage: (imageId: string) => 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, options?: MessageOptions) => 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