UNPKG

@azure/communication-react

Version:

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

44 lines 2.23 kB
/// <reference types="react" /> import { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from "../../../react-components/src"; import { SendBoxSelector } from '../sendBoxSelector'; import { MessageThreadSelector } from '../messageThreadSelector'; import { TypingIndicatorSelector } from '../typingIndicatorSelector'; import { Common, AreEqual } from "../../../acs-ui-common/src"; import { ChatHandlers } from '../handlers/createHandlers'; import { ChatParticipantListSelector } from '../chatParticipantListSelector'; import { ErrorBarSelector } from '../errorBarSelector'; /** * Primary hook to get all hooks necessary for a chat Component. * * Most straightforward usage of chat components looks like: * * @example * ``` * import { ParticipantList, usePropsFor } from '@azure/communication-react'; * * const App = (): JSX.Element => { * // ... code to setup Providers ... * * return <ParticipantList {...usePropsFor(ParticipantList)}/> * } * ``` * * @public */ export declare const usePropsFor: <Component extends (props: any) => JSX.Element>(component: Component) => GetSelector<Component> extends ((props: any) => any) ? ReturnType<GetSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]> : undefined; /** * Specific type of the selector applicable to a given Component. * * @public */ export type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof SendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof MessageThread> extends true ? MessageThreadSelector : AreEqual<Component, typeof TypingIndicator> extends true ? TypingIndicatorSelector : AreEqual<Component, typeof ParticipantList> extends true ? ChatParticipantListSelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : undefined; /** * Get the selector for a specified component. * * Useful when implementing a custom component that utilizes the providers * exported from this library. * * @public */ export declare const getSelector: <Component extends (props: any) => JSX.Element | undefined>(component: Component) => GetSelector<Component>; //# sourceMappingURL=usePropsFor.d.ts.map