@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
53 lines (52 loc) • 3.72 kB
TypeScript
import { IAppWindow } from './appWindow';
import { TaskInfo } from './interfaces';
/**
* Function type that is used to receive the result when a task module is submitted by
* calling {@link tasks.submitTask tasks.submitTask(result?: string | object, appIds?: string | string[]): void}
*
* @param err - If the task module failed, this string contains the reason for failure. If the task module succeeded, this value is the empty string.
* @param result - On success, this is the value passed to the `result` parameter of {@link tasks.submitTask tasks.submitTask(result?: string | object, appIds?: string | string[]): void}. On failure, this is the empty string.
*/
export type startTaskSubmitHandlerFunctionType = (err: string, result: string | object) => void;
/**
* @deprecated
* As of 2.8.0:
* - For url-based dialogs, please use {@link dialog.url.open dialog.url.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} .
* - For url-based dialogs with bot interaction, please use {@link dialog.url.bot.open dialog.url.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void}
* - For Adaptive Card-based dialogs:
* - In Teams, please continue to use this function until the new functions in {@link dialog.adaptiveCard} have been fully implemented. You can tell at runtime when they are implemented in Teams by checking
* the return value of the {@link dialog.adaptiveCard.isSupported} function. This documentation line will also be removed once they have been fully implemented in Teams.
* - In all other hosts, please use {@link dialog.adaptiveCard.open dialog.adaptiveCard.open(cardDialogInfo: CardDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void}
*
* Allows an app to open the task module.
*
* @param taskInfo - An object containing the parameters of the task module
* @param submitHandler - Handler to call when the task module is completed
*/
export declare function startTask(taskInfo: TaskInfo, submitHandler?: startTaskSubmitHandlerFunctionType): IAppWindow;
/**
* @deprecated
* As of TeamsJS v2.0.0, please use {@link dialog.update.resize dialog.update.resize(dimensions: DialogSize): void} instead.
*
* Update height/width task info properties.
*
* @param taskInfo - An object containing width and height properties
*/
export declare function updateTask(taskInfo: TaskInfo): void;
/**
* @deprecated
* As of 2.8.0, please use {@link dialog.url.submit} instead.
*
* Submit the task module.
*
* @param result - Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
* @param appIds - Valid application(s) that can receive the result of the submitted dialogs. Specifying this parameter helps prevent malicious apps from retrieving the dialog result. Multiple app IDs can be specified because a web app from a single underlying domain can power multiple apps across different environments and branding schemes.
*/
export declare function submitTask(result?: string | object, appIds?: string | string[]): void;
/**
* Sets the height and width of the {@link TaskInfo} object to the original height and width, if initially specified,
* otherwise uses the height and width values corresponding to {@link DialogDimension | TaskModuleDimension.Small}
* @param taskInfo TaskInfo object from which to extract size info, if specified
* @returns TaskInfo with height and width specified
*/
export declare function getDefaultSizeIfNotProvided(taskInfo: TaskInfo): TaskInfo;