@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
77 lines (76 loc) • 2.72 kB
TypeScript
/**
* Module to open a share dialog for web content.
* For more info, see [Share to Teams from personal app or tab](https://learn.microsoft.com/microsoftteams/platform/concepts/build-and-test/share-to-teams-from-personal-app-or-tab)
* @module
*/
import { SdkError } from '../interfaces';
import * as history from './history';
/** shareWebContent callback function type */
export type shareWebContentCallbackFunctionType = (err?: SdkError) => void;
/** Type of message that can be sent or received by the sharing APIs */
export declare const SharingAPIMessages: {
/**
* Share web content message.
* @internal
*/
shareWebContent: string;
};
type ContentType = 'URL';
/** Represents parameters for base shared content. */
interface IBaseSharedContent {
/** Shared content type */
type: ContentType;
}
/** IShareRequestContentType defines share request type. */
export type IShareRequestContentType = IURLContent;
/** Represents IShareRequest parameters interface.
* @typeparam T - The identity type
*/
export interface IShareRequest<T> {
/** Content of the share request. */
content: T[];
}
/** Represents IURLContent parameters. */
export interface IURLContent extends IBaseSharedContent {
/** Type */
type: 'URL';
/**
* Required URL
*/
url: string;
/**
* Default initial message text
*/
message?: string;
/**
* Show URL preview, defaults to true
*/
preview?: boolean;
}
/**
* Feature is under development
* Opens a share dialog for web content
*
* @param shareWebContentRequest - web content info
* @returns Promise that will be fulfilled when the operation has completed
*/
export declare function shareWebContent(shareWebContentRequest: IShareRequest<IShareRequestContentType>): Promise<void>;
/**
* @deprecated
* As of TeamsJS v2.0.0, please use {@link sharing.shareWebContent sharing.shareWebContent(shareWebContentRequest: IShareRequest\<IShareRequestContentType\>): Promise\<void\>} instead.
*
* Feature is under development
* Opens a share dialog for web content
*
* @param shareWebContentRequest - web content info
* @param callback - optional callback
*/
export declare function shareWebContent(shareWebContentRequest: IShareRequest<IShareRequestContentType>, callback: shareWebContentCallbackFunctionType): void;
/**
* Checks if the sharing capability is supported by the host
* @returns boolean to represent whether the sharing capability is supported
*
* @throws Error if {@linkcode app.initialize} has not successfully completed
*/
export declare function isSupported(): boolean;
export { history };