@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
76 lines (75 loc) • 2.88 kB
TypeScript
/**
* @beta
* @hidden
* User information required by specific apps
* @internal
* Limited to Microsoft-internal use
* @module
*/
import { SdkError } from '../../public/interfaces';
import { Content, ContentRequest, PreCheckContextResponse, SidePanelError, SidePanelErrorImpl, UserConsentRequest } from './sidePanelInterfaces';
/**
* @hidden
* @internal
* Limited to Microsoft-internal use
* @beta
* @returns boolean to represent whether copilot.sidePanel capability is supported
*
* @throws Error if {@linkcode app.initialize} has not successfully completed
*/
export declare function isSupported(): boolean;
/**
* @beta
* @hidden
* Determines if the provided error object is an instance of SidePanelError or SdkError.
* @internal
* Limited to Microsoft-internal use
* @param err The error object to check whether it is of SidePanelError type
*/
export declare function isResponseAReportableError(err: unknown): err is SidePanelError | SdkError;
/**
* Get user content data from the hub to send to copilot app.
*
* @returns { Promise<Content> } - promise resolves with a content object containing user content data
* @throws { SidePanelError | SdkError } - Throws a SidePanelError or SdkError if host SDK returns an error as a response to this call
*
* @hidden
* @beta
* @internal
* Limited to Microsoft-internal use
*/
export declare function getContent(request?: ContentRequest): Promise<Content>;
/**
* When the copilot detects a contextual query it gets the user consent status before making the getContent call.
*
* @returns { Promise<PreCheckContextResponse> } - promise resolves with a content object containing user content data
* @throws { SidePanelError | SdkError } - Throws a SidePanelError or SdkError if host SDK returns an error as a response to this call
*
* @hidden
* @beta
* @internal
* Limited to Microsoft-internal use
*/
export declare function preCheckUserConsent(request?: UserConsentRequest): Promise<PreCheckContextResponse>;
/** Register user action content select handler function type */
export type userActionHandlerType = (selectedContent: Content) => void;
/**
* @hidden
* @beta
* Registers a handler to get updated content data from the hub to send to copilot app.
* This handler will be called when the user selects content in the application.
* @param handler - The handler for getting user action content select.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare function registerUserActionContentSelect(handler: userActionHandlerType): void;
/**
* @hidden
* @beta
* @internal
* Limited to Microsoft-internal use
*
* Error thrown when the copilot side panel API is not supported on the current platform.
*/
export declare const copilotSidePanelNotSupportedOnPlatformError: SidePanelErrorImpl;