UNPKG

@microsoft/teams-js

Version:

Microsoft Client SDK for building app for Microsoft hosts

55 lines (54 loc) 2.66 kB
import { BotUrlDialogInfo, DialogInfo, UrlDialogInfo } from '../../interfaces'; import { DialogSubmitHandler, PostMessageChannel } from '../dialog'; import * as bot from './bot'; import * as parentCommunication from './parentCommunication'; /** * Allows app to open a url based dialog. * * @remarks * This function cannot be called from inside of a dialog * * @param urlDialogInfo - An object containing the parameters of the dialog module. * @param submitHandler - Handler that triggers when a dialog calls the {@linkcode submit} function or when the user closes the dialog. * @param messageFromChildHandler - Handler that triggers if dialog sends a message to the app. */ export declare function open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void; /** * Submit the dialog module and close the dialog * * @remarks * This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect. * * @param result - The result to be sent to the bot or the app. Typically a JSON object or a serialized version of it, * If this function is called from a dialog while {@link M365ContentAction} is set in the context object by the host, result will be ignored * * @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 submit(result?: string | object, appIds?: string | string[]): void; /** * Checks if dialog.url module is supported by the host * * @returns boolean to represent whether dialog.url module is supported * * @throws Error if {@linkcode app.initialize} has not successfully completed */ export declare function isSupported(): boolean; /** * @hidden * * Convert UrlDialogInfo to DialogInfo to send the information to host in {@linkcode open} API. * * @internal * Limited to Microsoft-internal use */ export declare function getDialogInfoFromUrlDialogInfo(urlDialogInfo: UrlDialogInfo): DialogInfo; /** * @hidden * * Convert BotUrlDialogInfo to DialogInfo to send the information to host in {@linkcode bot.open} API. * * @internal * Limited to Microsoft-internal use */ export declare function getDialogInfoFromBotUrlDialogInfo(botUrlDialogInfo: BotUrlDialogInfo): DialogInfo; export { bot, parentCommunication };