botframework-webchat-component
Version:
React component of botframework-webchat
330 lines • 15.3 kB
TypeScript
/// <reference types="node" />
import { hooks as apiHooks, concatMiddleware, localize } from 'botframework-webchat-api';
import { type WebChatActivity } from 'botframework-webchat-core';
import ReactWebChat, { ReactWebChatProps } from './ReactWebChat';
import { ComposerProps } from './Composer';
import { BasicWebChatProps } from './BasicWebChat';
import createCoreAttachmentMiddleware from './Attachment/createMiddleware';
import createCoreActivityMiddleware from './Middleware/Activity/createCoreMiddleware';
import createCoreActivityStatusMiddleware from './Middleware/ActivityStatus/createCoreMiddleware';
import createStyleSet from './Styles/createStyleSet';
import getTabIndex from './Utils/TypeFocusSink/getTabIndex';
import Context from './hooks/internal/WebChatUIContext';
import withEmoji from './withEmoji/withEmoji';
import * as componentHooks from './hooks/index';
export { type SendBoxFocusOptions } from './hooks/index';
declare const hooks: {
useDictateAbortable: typeof componentHooks.useDictateAbortable;
useFocus: typeof componentHooks.useFocus;
useMakeThumbnail: typeof componentHooks.useMakeThumbnail;
useMicrophoneButtonClick: typeof componentHooks.useMicrophoneButtonClick;
useMicrophoneButtonDisabled: typeof componentHooks.useMicrophoneButtonDisabled;
useObserveScrollPosition: typeof componentHooks.useObserveScrollPosition;
useObserveTranscriptFocus: typeof componentHooks.useObserveTranscriptFocus;
useRegisterFocusSendBox: (listener: (value: componentHooks.SendBoxFocusOptions) => void) => void;
useRenderMarkdownAsHTML: typeof componentHooks.useRenderMarkdownAsHTML;
useScrollDown: typeof componentHooks.useScrollDown;
useScrollTo: typeof componentHooks.useScrollTo;
useScrollToEnd: typeof componentHooks.useScrollToEnd;
useScrollUp: typeof componentHooks.useScrollUp;
useSendBoxSpeechInterimsVisible: typeof componentHooks.useSendBoxSpeechInterimsVisible;
useSendFiles: typeof componentHooks.useSendFiles;
useSendMessage: typeof componentHooks.useSendMessage;
useStyleSet: typeof componentHooks.useStyleSet;
useTextBoxSubmit: typeof componentHooks.useTextBoxSubmit;
useTextBoxValue: typeof componentHooks.useTextBoxValue;
useTypingIndicatorVisible: typeof componentHooks.useTypingIndicatorVisible;
useWebSpeechPonyfill: typeof componentHooks.useWebSpeechPonyfill;
useActiveTyping: (expireAfter?: number) => readonly [Readonly<Record<string, import("botframework-webchat-api").Typing>>];
useActivities: () => [WebChatActivity[]];
useActivityKeys: () => readonly [readonly string[]];
useActivityKeysByRead: () => readonly [readonly string[], readonly string[]];
useAvatarForBot: () => [{
image: string;
initials: string;
}];
useAvatarForUser: () => [{
image: string;
initials: string;
}];
useByteFormatter: () => (bytes: number) => string;
useConnectivityStatus: () => [string];
useCreateActivityRenderer: () => import("botframework-webchat-api").ActivityComponentFactory;
useCreateActivityStatusRenderer: () => import("botframework-webchat-api").ActivityStatusRenderer;
useCreateAttachmentForScreenReaderRenderer: () => import("botframework-webchat-api").AttachmentForScreenReaderComponentFactory;
useCreateAvatarRenderer: () => ({ activity }: {
activity: WebChatActivity;
}) => false | (() => import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal);
useCreateScrollToEndButtonRenderer: () => import("botframework-webchat-api").ScrollToEndButtonComponentFactory;
useDateFormatter: () => (date: string | number | Date) => string;
useDebouncedNotifications: () => [import("botframework-webchat-api").DebouncedNotifications];
useDictateInterims: () => [string[], (interims: string[]) => void];
useDictateState: () => [number];
useDirection: () => ["auto" | "ltr" | "rtl"];
useDisabled: () => [boolean];
useDismissNotification: () => (id: string) => void;
useEmitTypingIndicator: () => () => void;
useGetActivitiesByKey: () => (key?: string) => readonly WebChatActivity[];
useGetActivityByKey: () => (key?: string) => WebChatActivity;
useGetHasAcknowledgedByActivityKey: typeof apiHooks.useGetHasAcknowledgedByActivityKey;
useGetKeyByActivity: () => (activity?: WebChatActivity) => string;
useGetKeyByActivityId: () => (activityId?: string) => string;
useGetSendTimeoutForActivity: () => ({ activity }: {
activity: WebChatActivity;
}) => number;
useGrammars: () => [any];
useGroupActivities: () => ({ activities }: {
activities: WebChatActivity[];
}) => {
sender: WebChatActivity[][];
status: WebChatActivity[][];
};
useGroupTimestamp: () => [number | boolean];
useLanguage: (options?: "speech") => [string];
useLastAcknowledgedActivityKey: () => readonly [string];
useLastReadActivityKey: () => readonly [string];
useLocalizer: ({ plural }?: {
plural?: boolean;
}) => (id: string | {
zero?: string;
one?: string;
two?: string;
few?: string;
many?: string;
other: string;
}, args_0?: string | number, ...args_1: string[]) => any;
useMarkActivityAsSpoken: () => (activity: WebChatActivity) => void;
useMarkActivityKeyAsRead: () => (activityKey: string) => void;
useMarkAllAsAcknowledged: () => () => void;
useNotifications: () => [import("botframework-webchat-api").Notification[]];
usePerformCardAction: () => import("botframework-webchat-api").PerformCardAction;
usePonyfill: () => readonly [{
cancelAnimationFrame?: typeof cancelAnimationFrame;
cancelIdleCallback?: typeof cancelIdleCallback;
clearImmediate?: typeof clearImmediate;
clearInterval: typeof clearInterval;
clearTimeout: typeof clearTimeout;
Date: DateConstructor;
requestAnimationFrame?: typeof requestAnimationFrame;
requestIdleCallback?: typeof requestIdleCallback;
setImmediate?: typeof setImmediate;
setInterval: typeof setInterval;
setTimeout: typeof setTimeout;
}];
usePostActivity: () => (activity: WebChatActivity) => import("botframework-webchat-core").Observable<string>;
useReferenceGrammarID: () => [string];
useRelativeTimeFormatter: () => (dateOrString: string | Date) => string;
useRenderAttachment: () => import("botframework-webchat-api").RenderAttachment;
useRenderToast: () => import("botframework-webchat-api").RenderToast;
useRenderTypingIndicator: () => import("botframework-webchat-api").RenderTypingIndicator;
useSendBoxAttachments: () => readonly [readonly Readonly<{
blob: Blob | File;
thumbnailURL?: URL;
}>[], (attachments: readonly Readonly<{
blob: Blob | File;
thumbnailURL?: URL;
}>[]) => void];
useSendBoxValue: () => [string, (value: string) => void];
useSendEvent: () => (name: string, value: any) => void;
useSendMessageBack: () => (value: any, text?: string, displayText?: string) => void;
useSendPostBack: () => (value?: any) => void;
useSendStatusByActivityKey: typeof apiHooks.useSendStatusByActivityKey;
useSendTimeoutForActivity: (activity: WebChatActivity) => number;
useSendTypingIndicator: () => [boolean];
useSetNotification: () => (notification: import("botframework-webchat-api").Notification) => void;
useShouldSpeakIncomingActivity: () => [boolean, (value: boolean) => void];
useStartDictate: () => () => void;
useStopDictate: () => () => void;
useStyleOptions: () => [import("botframework-webchat-api").StrictStyleOptions];
useSubmitSendBox: () => (method?: string, { channelData }?: {
channelData: any;
}) => void;
useSuggestedActions: () => [import("botframework-webchat-core").DirectLineCardAction[], (suggestedActions: never[]) => void];
useTimeoutForSend: () => [number | ((activity: WebChatActivity) => number)];
useTrackDimension: () => (name: string, data: any) => void;
useTrackEvent: () => {
(name: string, data: any): void;
debug: (name: string, data: any) => void;
error: (name: string, data: any) => void;
info: (name: string, data: any) => void;
warn: (name: string, data: any) => void;
};
useTrackException: () => (error: Error, fatal: boolean) => void;
useTrackTiming: <T>() => (name: string, functionOrPromise: (() => T) | Promise<T>) => Promise<T>;
useUserID: () => [string];
useUsername: () => [string];
useVoiceSelector: (activity: any) => (voices: {
new (): SpeechSynthesisVoice;
prototype: SpeechSynthesisVoice;
}[]) => {
new (): SpeechSynthesisVoice;
prototype: SpeechSynthesisVoice;
};
};
declare const version: string;
declare const buildInfo: {
buildTool: string;
moduleFormat: string;
version: string;
};
declare const Components: {
BasicWebChat: import("react").FC<BasicWebChatProps>;
Composer: {
({ activityMiddleware, activityStatusMiddleware, attachmentForScreenReaderMiddleware, attachmentMiddleware, avatarMiddleware, cardActionMiddleware, children, extraStyleSet, renderMarkdown, scrollToEndButtonMiddleware, sendBoxMiddleware: sendBoxMiddlewareFromProps, sendBoxToolbarMiddleware: sendBoxToolbarMiddlewareFromProps, styleOptions, styleSet, suggestedActionsAccessKey, toastMiddleware, typingIndicatorMiddleware, webSpeechPonyfillFactory, ...composerProps }: ComposerProps): import("react").JSX.Element;
defaultProps: {
children: any;
extraStyleSet: any;
nonce: any;
renderMarkdown: any;
styleSet: any;
suggestedActionsAccessKey: string;
webSpeechPonyfillFactory: any;
internalRenderErrorBox: any;
onTelemetry: any;
ponyfill: any;
store: any;
};
propTypes: {
children: import("prop-types").Requireable<any>;
extraStyleSet: import("prop-types").Requireable<any>;
nonce: import("prop-types").Requireable<string>;
renderMarkdown: import("prop-types").Requireable<(...args: any[]) => any>;
styleSet: import("prop-types").Requireable<any>;
suggestedActionsAccessKey: import("prop-types").Requireable<NonNullable<string | boolean>>;
webSpeechPonyfillFactory: import("prop-types").Requireable<(...args: any[]) => any>;
internalRenderErrorBox: import("prop-types").Requireable<any>;
onTelemetry: import("prop-types").Requireable<(...args: any[]) => any>;
ponyfill: import("prop-types").Requireable<any>;
store: import("prop-types").Requireable<any>;
};
};
ThemeProvider: import("react").MemoExoticComponent<({ children, activityMiddleware, activityStatusMiddleware, attachmentForScreenReaderMiddleware, attachmentMiddleware, avatarMiddleware, cardActionMiddleware, groupActivitiesMiddleware, scrollToEndButtonMiddleware, sendBoxMiddleware, sendBoxToolbarMiddleware, styleOptions, toastMiddleware, typingIndicatorMiddleware }: Readonly<{
children?: import("react").ReactNode;
} & Partial<import("./providers/Theme/private/Context").ContextType>>) => import("react").JSX.Element>;
AccessKeySinkSurface: any;
BasicConnectivityStatus: any;
BasicSendBox: import("react").FC<Readonly<{
className?: string;
}>>;
BasicSendBoxToolbar: import("react").MemoExoticComponent<({ className }: {
className?: string;
}) => import("react").JSX.Element>;
BasicToaster: any;
BasicTranscript: import("react").NamedExoticComponent<{
className?: string;
}>;
AudioContent: import("react").FC<{
alt?: string;
autoPlay?: boolean;
loop?: boolean;
poster?: string;
src: string;
}>;
FileContent: import("react").FC<{
className?: string;
fileName: string;
href?: string;
size?: number;
}>;
HTMLVideoContent: import("react").FC<{
alt?: string;
autoPlay?: boolean;
loop?: boolean;
poster?: string;
src: string;
}>;
ImageContent: import("react").FC<{
alt?: string;
src: string;
}>;
TextContent: import("react").FC<Readonly<{
activity: WebChatActivity;
contentType?: string;
text: string;
}>>;
VideoContent: import("react").FC<{
alt?: string;
autoPlay?: boolean;
loop?: boolean;
poster?: string;
src: string;
}>;
VimeoContent: import("react").FC<{
alt?: string;
autoPlay?: boolean;
embedID: string;
loop?: boolean;
}>;
YouTubeContent: import("react").FC<{
alt?: string;
autoPlay?: boolean;
embedID: string;
loop?: boolean;
}>;
Avatar: import("react").VFC<{
'aria-hidden'?: boolean;
className?: string;
fromUser?: boolean;
}>;
Bubble: import("react").NamedExoticComponent<{
'aria-hidden'?: boolean;
children?: import("react").ReactNode;
className?: string;
fromUser?: boolean;
nub?: boolean | "hidden";
}>;
ErrorBox: import("react").FC<{
error: Error;
type?: string;
}>;
SendStatus: import("react").FC<{
activity: WebChatActivity;
sendStatus: import("./types/internal/SendStatus").SendStatus;
}>;
SpeakActivity: import("react").NamedExoticComponent<{
activity: WebChatActivity;
}>;
Timestamp: import("react").FC<{
timestamp: string;
}>;
DictationInterims: import("react").FC<{
className?: string;
}>;
MicrophoneButton: import("react").FC<{
className?: string;
}>;
SendButton: import("react").FC<{
className?: string;
}>;
SendTextBox: ({ className }: Readonly<{
className?: string;
}>) => import("react").JSX.Element;
SuggestedActions: ({ className }: Readonly<{
className?: string;
}>) => import("react").JSX.Element;
UploadButton: import("react").FC<{
className?: string;
}>;
LocalizedString: import("react").MemoExoticComponent<(props: Readonly<{
className?: string;
linkClassName?: string;
onDecorateLink?: (href: string, textContent: string) => import("./Utils/betterLinks").LinkOptions;
}> & (Readonly<{
stringIds: {
zero?: string;
one?: string;
two?: string;
few?: string;
many?: string;
other: string;
};
values: readonly [number, ...(string | number)[]];
}> | Readonly<{
stringIds: string;
values?: readonly (string | number)[];
}>)) => import("react").JSX.Element>;
};
export default ReactWebChat;
export { Components, Context, buildInfo, concatMiddleware, createCoreActivityMiddleware, createCoreActivityStatusMiddleware, createCoreAttachmentMiddleware, createStyleSet, getTabIndex, hooks, localize, version, withEmoji };
export type { BasicWebChatProps, ComposerProps, ReactWebChatProps, WebChatActivity };
//# sourceMappingURL=index.d.ts.map