UNPKG

@cometchat/chat-uikit-react-native

Version:

Ready-to-use Chat UI Components for React Native

144 lines (143 loc) 5.93 kB
import { CometChat } from "@cometchat/chat-sdk-react-native"; import { JSX } from "react"; import { AdditionalAuxiliaryHeaderOptionsParams, AdditionalParams } from "../shared/base/Types"; import { DataSource } from "../shared/framework/DataSource"; import { DataSourceDecorator } from "../shared/framework/DataSourceDecorator"; import { CometChatMessageTemplate } from "../shared/modals"; import { CallingConfiguration } from "./CallingConfiguration"; import { CometChatTheme } from "../theme/type"; /** * CallingExtensionDecorator extends the DataSourceDecorator to add calling-specific * configurations and templates. * * @class CallingExtensionDecorator * @extends {DataSourceDecorator} */ export declare class CallingExtensionDecorator extends DataSourceDecorator { /** * Optional calling configuration. */ configuration?: CallingConfiguration; /** * The logged in CometChat user. */ loggedInUser: CometChat.User; /** * Creates an instance of CallingExtensionDecorator. * * @param {object} props - The properties object. * @param {DataSource} props.dataSource - The original data source. * @param {CallingConfiguration} [props.configuration] - Optional calling configuration. */ constructor(props: { dataSource: DataSource; configuration?: CallingConfiguration; }); /** * Returns a unique identifier for this decorator. * * @returns {string} The identifier. */ getId(): string; /** * Determines whether a message is deleted. * * @param {CometChat.BaseMessage} message - The message to check. * @returns {boolean} True if the message is deleted; otherwise false. */ isDeletedMessage(message: CometChat.BaseMessage): boolean; /** * Retrieves all supported message types including call types. * * @returns An array of message type strings. */ getAllMessageTypes(): string[]; /** * Retrieves all supported message categories including call-related categories. * * @returns An array of message category strings. */ getAllMessageCategories(): string[]; /** * Renders the call bubble view for one-to-one call messages. * * @param {object} param0 - The props object. * @param {any} param0.message - The call message. * @param {CometChatTheme} param0.theme - The theme. * @returns {JSX.Element|null} The rendered call bubble view. */ UserCallBubbleView: ({ message, theme }: { message: any; theme: CometChatTheme; }) => JSX.Element | null; /** * Returns the audio call message template for one-to-one chats. * * @param {CometChatTheme} theme - The theme to use for the template. * @returns {CometChatMessageTemplate} The audio call message template. */ getUserAudioCallTemplate: (theme: CometChatTheme) => CometChatMessageTemplate; /** * Returns the video call message template for one-to-one chats. * * @param {CometChatTheme} theme - The theme to use for the template. * @returns {CometChatMessageTemplate} The video call message template. */ getUserVideoCallTemplates: (theme: CometChatTheme) => CometChatMessageTemplate; /** * Renders the group call bubble view. * * @param {object} props - The props for the group call bubble view. * @param {CometChat.CustomMessage} props.message - The call message. * @param {CometChatTheme} props.theme - The theme. * @param {string} props.alignment - Alignment for the bubble. * @returns {JSX.Element} The rendered group call bubble view. */ GroupCallBubbleView: (props: { message: CometChat.CustomMessage; theme: CometChatTheme; alignment: string; }) => JSX.Element; /** * Initiates a direct call by checking permissions and showing the ongoing call screen. * * @param sessionId - The call session ID. * @param message - The call message. * @param [theme] - The theme. * @param [callType] - The type of call (audio/video). * @returns */ startDirectCall(sessionId: string, message: CometChat.BaseMessage, theme?: CometChatTheme, callType?: string): Promise<void>; /** * Renders the call buttons in the auxiliary header app bar. * * @param [user] - The user for one-to-one chats. * @param [group] - The group for group chats. * @param [additionalParams] - Additional parameters. * @returns The rendered call buttons or null if conditions are not met. */ getAuxiliaryHeaderAppbarOptions(user?: CometChat.User, group?: CometChat.Group, additionalAuxiliaryHeaderOptionsParams?: AdditionalAuxiliaryHeaderOptionsParams): JSX.Element | null; /** * Returns the group call template to render group call messages. * * @param {CometChatTheme} theme - The theme. * @returns {CometChatMessageTemplate} The group call message template. */ getGroupCallTemplate: (theme: CometChatTheme) => CometChatMessageTemplate; /** * Retrieves all message templates including call-related templates. * * @param {CometChatTheme} theme - The theme. * @param {AdditionalParams} [additionalParams] - Additional parameters. * @returns {CometChatMessageTemplate[]} An array of message templates. */ getAllMessageTemplates(theme: CometChatTheme, additionalParams?: AdditionalParams): CometChatMessageTemplate[]; /** * Retrieves the last conversation message for display in the conversation list. * * @param {CometChat.Conversation} conversation - The conversation object. * @param {CometChatTheme} [theme] - The theme. * @returns {string | JSX.Element} The last conversation message. */ getLastConversationMessage(conversation: CometChat.Conversation, theme?: CometChatTheme): string | JSX.Element; }