@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
102 lines (101 loc) • 3.09 kB
TypeScript
/**
* @beta
* @hidden
* User information required by specific apps
* @internal
* Limited to Microsoft-internal use
* @module
*/
import { DisplayMode, IModalOptions, IModalResponse, IToolInput, IToolOutput, JSONValue } from './widgetContext';
/**
* @hidden
* @internal
* Limited to Microsoft-internal use
* @beta
* @returns boolean to represent whether widgetHosting capability is supported
*
* @throws Error if {@linkcode app.initialize} has not successfully completed
*/
export declare function isSupported(): boolean;
export declare function callTool(widgetId: string, input: IToolInput): Promise<IToolOutput>;
/**
* @beta
* @hidden
* Sends a follow-up message to the host
* @internal
* Limited to Microsoft-internal use
*/
export declare function sendFollowUpMessage(widgetId: string, args: {
prompt: string;
}): Promise<void>;
/**
* @beta
* @hidden
* Requests a specific display mode for the widget
* @internal
* Limited to Microsoft-internal use
*/
export declare function requestDisplayMode(widgetId: string, args: {
mode: DisplayMode;
}): Promise<void>;
/**
* @beta
* @hidden
* Requests a modal dialog to be displayed
* @internal
* Limited to Microsoft-internal use
* @param widgetId - The unique identifier for the widget
* @param options - Configuration options for the modal
* @returns A DOM element representing the modal's root
*/
export declare function requestModal(widgetId: string, options: IModalOptions): Promise<IModalResponse>;
/**
* @beta
* @hidden
* Notifies the host about the intrinsic height of the widget content
* @internal
* Limited to Microsoft-internal use
*/
export declare function notifyIntrinsicHeight(widgetId: string, height: number): void;
/**
* @beta
* @hidden
* Notifies the host about content size changes
* @internal
* Limited to Microsoft-internal use
* @param widgetId - The unique identifier for the widget
* @param width - The width of the content in pixels
* @param height - The height of the content in pixels
*/
export declare function contentSizeChanged(widgetId: string, width: number, height: number): void;
/**
* @beta
* @hidden
* Sets the widget state
* @internal
* Limited to Microsoft-internal use
*/
export declare function setWidgetState(widgetId: string, state: JSONValue): Promise<void>;
/**
* @beta
* @hidden
* Opens an external URL
* @internal
* Limited to Microsoft-internal use
*/
export declare function openExternal(widgetId: string, payload: {
href: string;
}): void;
/** Modal close handler function type */
export type ModalCloseHandlerType = (modalId: string) => void;
/**
* @hidden
* @beta
* Registers a handler to be called when a modal is closed.
* This handler will be called when the user closes a modal or when .close() is invoked.
* @param handler - The handler for modal close events.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare function registerModalCloseHandler(handler: ModalCloseHandlerType): void;