UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

46 lines 2.79 kB
import type { PropsWithChildren } from 'react'; import React from 'react'; import type { DeleteMessageOptions, LocalMessage, Message, MessageResponse, SendMessageOptions, UpdateMessageAPIResponse, UpdateMessageOptions } from 'stream-chat'; import type { ChannelStateReducerAction } from '../components/Channel/channelState'; import type { CustomMentionHandler } from '../components/Message/hooks/useMentionsHandler'; import type { ChannelUnreadUiState } from '../types/types'; export type MarkReadWrapperOptions = { /** * Signal, whether the `channelUnreadUiState` should be updated. * By default, the local state update is prevented when the Channel component is mounted. * This is in order to keep the UI indicating the original unread state, when the user opens a channel. */ updateChannelUiUnreadState?: boolean; }; export type RetrySendMessage = (message: LocalMessage) => Promise<void>; export type ChannelActionContextValue = { closeThread: (event?: React.BaseSyntheticEvent) => void; deleteMessage: (message: LocalMessage, options?: DeleteMessageOptions) => Promise<MessageResponse>; dispatch: React.Dispatch<ChannelStateReducerAction>; editMessage: (message: LocalMessage | MessageResponse, options?: UpdateMessageOptions) => Promise<UpdateMessageAPIResponse | void>; jumpToFirstUnreadMessage: (queryMessageLimit?: number, highlightDuration?: number) => Promise<void>; jumpToLatestMessage: () => Promise<void>; jumpToMessage: (messageId: string, limit?: number, highlightDuration?: number) => Promise<void>; loadMore: (limit?: number) => Promise<number>; loadMoreNewer: (limit?: number) => Promise<number>; loadMoreThread: () => Promise<void>; markRead: (options?: MarkReadWrapperOptions) => void; onMentionsClick: CustomMentionHandler; onMentionsHover: CustomMentionHandler; openThread: (message: LocalMessage, event?: React.BaseSyntheticEvent) => void; removeMessage: (message: LocalMessage) => void; retrySendMessage: RetrySendMessage; sendMessage: (params: { localMessage: LocalMessage; message: Message; options?: SendMessageOptions; }) => Promise<void>; setChannelUnreadUiState: React.Dispatch<React.SetStateAction<ChannelUnreadUiState | undefined>>; updateMessage: (message: MessageResponse | LocalMessage) => void; }; export declare const ChannelActionContext: React.Context<ChannelActionContextValue | undefined>; export declare const ChannelActionProvider: ({ children, value, }: PropsWithChildren<{ value: ChannelActionContextValue; }>) => import("react/jsx-runtime").JSX.Element; export declare const useChannelActionContext: (componentName?: string) => ChannelActionContextValue; //# sourceMappingURL=ChannelActionContext.d.ts.map